Re: XForms: Problem displaying images

Ravi Mehrotra (ravi@csnpl.ren.nic.in)
Wed, 15 Sep 1999 08:30:37 +0530

# To subscribers of the xforms list from Ravi Mehrotra <ravi@csnpl.ren.nic.in> :

Dear Michael,

Thanks for replying. As indicated the section of the code I included,
the canvas is moved programmatically (fl_set_object_position) and I also
execute a pic->display and XFlush(fl_display) after the move. Actually,
how one moves the canvas does not seem to matter.I have also tried
moving the canvas by traping a mouse event with the same results. The
only way it works is to free the pic and reload it into the canvas. But
that is very inconvenient.

I will try out the xpm format. However, it would be nice to get the ppm
also working wihtout glitches.

Regards,

Ravi Mehrotra
National Physical Laboratory
New Delhi 110012
India

Michael Glickman wrote:
>
> # 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/
_________________________________________________
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/