Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ximage display

126 views
Skip to first unread message

selvam

unread,
Sep 22, 2009, 3:09:19 PM9/22/09
to
Hi all,

I need to display XImage of xlib iusing motif .I learned
XmInstallImage can be used, but i dont know how to implement it.Any
sample link or help would put me in right path,

My pseudo code might look like,

XImage *img;
img=XCreateImage(...);
XmInstallImage(img," name");
/*need to display in scrollable window*/

Thanks
va

arahne

unread,
Sep 22, 2009, 4:22:46 PM9/22/09
to
selvam wrote:
> I need to display XImage of xlib iusing motif .I learned
> XmInstallImage can be used, but i dont know how to implement it.Any
> sample link or help would put me in right path,

From my understanding, XmInstallImage is mainly used for images which
will not be modified, and you need to display them several times across
your interface. That means mainly icon pixmaps.

The proper way to display image in Motif is to use XDrawingArea, handle
the expose events and copy your image from XImage to drawing area by
XPutImage. Or XShmputimage, if speed is an issue.
Note that you must create XImage with same image layout (depth, rgb bits
layout) as your X server, or XPutImage will fail.
Alternatively, you need to do image depth and format conversion by
yourself, on every expose, which can be difficult (take it from someone
how did it).

Here is some info on handling display of an area with scrollbars:
http://www.ist.co.uk/motif/books/vol6A/ch-10.fm.html

The lazy way to accomplish the same (if you are using OpenMotif 2.3 or
later) is to simply use XmLabel, and specify jpeg or PNG file as
labelPixmap in the resource file.
www.sfr-fresh.com/unix/misc/openmotif-2.3.0-manual.pdf.tgz:a/appendixg.pdf
Note that PNG file must be 32 bit with alpha channel, or it won't work.

Dušan Peterc
http://www.arahne.si

arahne

unread,
Sep 23, 2009, 3:45:45 PM9/23/09
to
selvam wrote:
>
> I have been looking for Xputimage image into DrawingArea ,
> Meanwhile, If you can give me a sample code , it would be helpful.

You can check this thread:
http://fixunix.com/xwindows/91794-displaying-image.html

Personally, I also use this approach
http://www.google.com/codesearch
by searching for function which I don't know how to use
http://www.google.com/codesearch?hl=en&start=40&sa=N&q=XPutImage

After finding a reasonably small program I can understand, I try to
implement a similar approach in my code.

Hope this helps.

Dušan Peterc
http://www.arahne.si

0 new messages