RE: XForms: Problem displaying images

Michael Glickman (michaelg@linx.com.au)
Wed, 15 Sep 1999 10:58:10 +1000

# To subscribers of the xforms list from Michael Glickman <michaelg@linx.com.au> :

Hello, Ravi

You didn't tell, how the canvas moves. Do you make it moving
programmatically, or it moves as a result of user interaction
(dragging the form, etc) ?

If canvas moves as the result of your code, I would suggest to
repeat 'pic->display' and 'XFlush' after move. This may help.
If the problem appears as the result of user interaction, you can
trap 'move' event and do 'pic->display' and 'XFlush' in the
handler.

Actually PPM support is a relatively new feature in XForms,
therefore
I prefer good old pixmap (XPM) format. It has a number of
advantages,
e.g. direct X server support, no need for extra libraries, and
ability
to keep the image as the source code. And, what is more important,
I don't have any troubles like that. You may argue, that XPM
requires
more hard disc space then the compressed PPM. But you can
compress XPM with gzip and decompress it into a temporary file
by calling zcat from your program before starting using the image.

Regards, Michael

> -----Original Message-----
> From: Ravi Mehrotra [SMTP:ravi@csnpl.ren.nic.in]
> Sent: Tuesday, 14 September 1999 17:05 EST
> To: xforms@bob.usuhs.mil
> Subject: XForms: Problem displaying images
>
> # To subscribers of the xforms list from Ravi Mehrotra
> <ravi@csnpl.ren.nic.in> :
>
> Hi,
>
> I am using XForms version 0.89 on a Linux 2.2.6 Pentium II machine.
> I have a True color image with depth 16. I use the following code to
> display the image in a canvas.
>
> void load_cb(FL_OBJECT *ob, long data)
> {
> FL_IMAGE *pic;
>
> pic=flimage_alloc();
> pic=flimage_load("picture.ppm");
> pic->display(pic, FL_ObjWin(canvas));
> XFlush(fl_display);
> sleep(1);
> fl_set_object_position(canvas,canvas->x+50,canvas->y+50);
> pic->display(pic, FL_ObjWin(canvas));
> XFlush(fl_display);
> }
>
> The picture shows up OK. However, after the canvas is moved, the
> picture appears as a faint ghost without color. This happens if I
> start my Xserver with depth 16 or 24. The problem disappears if
> I start up the Xserver with depth 8 but then I am limited in colors.
>
> Is there a bug or am I doing something wrong ? I will appreciate any
> help.
>
> Thanks.
>
> Ravi Mehrotra
> National Physical Laboratory
> New Delhi 110012
> India
> _________________________________________________
> To unsubscribe, send the message "unsubscribe" to
> xforms-request@bob.usuhs.mil or see
> http://bob.usuhs.mil/mailserv/xforms.html
> XForms Home Page: http://bragg.phys.uwm.edu/xforms
> List Archive: http://bob.usuhs.mil/mailserv/list-archives/
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/