Re: Bitmaps (several other questions)

"Michael A. Borisov" <[email protected]>
Newsgroups gmane.comp.video.picogui.devel
Message-ID <[email protected]>
Dear Mr. Dowty,

Micah Dowty wrote:

>There are two ways to convert raw RGB data to a picogui bitmap:
>
> - If you want to do it as easily as possible, and you don't
>   need exceptional speed, you can prepend a .PPM header in front
>   and use pgNewBitmap(). There is information about this file
>   format at:
>   http://www-info2.informatik.uni-wuerzburg.de/mitarbeiter/wolfram/lehre/bildformate.html
>
This approach solves my problem. Thank you very much.

But I have several other questions.

1. I would like to create application without panelbar. How I can do it?

2. I'm trying to handle events for PG_WIDGET_CANWAS with the help of 
following code:

int pg_process_events(struct pgEvent *pg_event)
{
  int ch = pg_event->e.kbd.key;

  if (ch >= 32)
    printf("process_event %d %c\n", pg_event->type, ch);
  else
    printf("process_event %d CTRLSYM\n", pg_event->type);
  return 0;
}

unsigned char *pg_init_driver(unsigned char *param, unsigned char *ignore)
{
  pgInit(0, NULL);
  mPGPanel = pgRegisterApp(PG_APP_NORMAL, "Links", 0);
  pgSetWidget(mPGPanel, PG_WP_MARGIN, 0, 0);
  mPGCanvas = pgNewWidget(PG_WIDGET_CANVAS, PG_DERIVE_INSIDE, mPGPanel);
  pgSetWidget(mPGCanvas, PG_WP_TRIGGERMASK,
    pgGetWidget(mPGCanvas, PG_WP_TRIGGERMASK) |
    PG_TRIGGERS_MOUSE | PG_TRIGGERS_KEY,
    0);

  mPGGraphicalContext = pgNewCanvasContext(mPGCanvas, PGFX_IMMEDIATE);
  pgSetLgop(mPGGraphicalContext, PG_LGOP_NONE);
  pgSetMapping(mPGGraphicalContext, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 
PG_MAP_NONE);
  pgSetColor(mPGGraphicalContext, 0);
  pgBind(mPGCanvas, PGBIND_ANY, &pg_process_events, NULL);

  return NULL;
}

But pg_process_events never prints anything when I'm pressing keys on 
the keyboard. Maybe PG_WIDGET_CANVAS can not handle events from 
keyboard? But it is very important for me to handle such events in my 
application.

Respectfully yours,
Michael.

>
> - If you need more speed but don't mind managing the potential
>   complexity of translating the bitmap into other formats, you
>   can use a shared memory segment. There is a short SHM demo in
>   the apps directory, and a longer example in SDL's picogui video driver.
>
>--Micah
>
>On Tue, Mar 18, 2003 at 07:14:46PM +0300, [email protected] wrote:
>  
>
>>Hello everybody,
>>
>>I would like to create bitmap from raw data. I think I have to use
>>pgCreateBitmap function and then fill this bitmap. I have raw data
>>(3 bytes per pixel as array). How I can do it?
>>
>>-- 
>>Best regards,
>> mic                          mailto:[email protected]
>>
>>
>>
>>-------------------------------------------------------
>>This SF.net email is sponsored by: Does your code think in ink? 
>>You could win a Tablet PC. Get a free Tablet PC hat just for playing. 
>>What are you waiting for?
>>http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
>>_______________________________________________
>>Pgui-devel mailing list
>>[email protected]
>>https://lists.sourceforge.net/lists/listinfo/pgui-devel
>>    
>>
>
>  
>




-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink? 
You could win a Tablet PC. Get a free Tablet PC hat just for playing. 
What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.