Re: XForms: Pixmap!

Claudio Andrade Macedo (cmacedo@infonet.com.br)
Mon, 15 Feb 1999 09:17:17 -0300

# To subscribers of the xforms list from cmacedo@infonet.com.br (Claudio Andrade Macedo) :

Thank you very much Steve!

You don't have idea how it was important to me!
I need to show satellite images in my program. And, really, the set_pixmap_data was
not working.
The images are ASCII files:
45 56 67 53 42 12 12 32 ...
34 90 89 89 100 123 200 ...
23 34 45 56 67 43 43 21...
...
I need a way to read a file like this and show it as a image.

If you could help me in any way ...

thanks

Hendrik

Steve Lamont wrote:

> # To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :
>
> > Anyone can tell me how do I create a pixmap inside the code of the
> > program.
> > Let me explain. A pixmap is a const char **matrix, isn't it?
>
> No, it is not.
>
> The problem here is a confusion of terms: The `data' referred to in
> the function fl_set_pixmap_data() is an array of char strings in the
> XPM format, which is translated to a real server Pixmap object by the
> libXpm functions. I really wish the developers of XPM had picked some
> other term than "Pixmap" to describe their format. Here is an example
> of an XPM data structure from the `eye.xpm' file supplied with XForms:
>
> /* XPM */
> static char * eye[] = {
> /* eye pixmap
> * width height ncolors chars_per_pixel */
> "32 32 4 2 ",
> " c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ",
> ". c #000 s s_#000 ",
> "X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ",
> "o c #32329999CCCC s s_#32329999CCCC ",
> /* pixels */
> " ",
> " ",
> " . . . . . . . ",
> " . . . X X X X X X X . . . ",
> " . . X X X X X X X X X X X X X . . ",
> " . X X X X X X X X X X X X X X X X X . ",
> " . X X X X X X X X X X X X X X X X X X X . ",
> " . X X X X X X X X X X X X X X X X X X X X X . ",
> " . X X X X X X X X X X X X X X X X . X . X . X X . ",
> " . X X X X X X X X X X X X X X X . . . . X . ",
> " . X X X X X X X X X X X X X X X . . o . . X . ",
> " . X X X X X X . X X X X X X X . . o o o o o . . ",
> " . X X X X X . X X . X X X X . . o o o o o o . ",
> " . X X X X . X X . X X X X X X . o o o o o o o . . ",
> " . X X X . X X . X X X X X X . . o o o o o o o . ",
> " . X X . X X . X X X X X X X X . o o o o o o o o . . ",
> " . X X X . X X . X X X X X X . . o o o o o o o . ",
> " . X X X X . X X . . . X X X X . . o o o o o . . ",
> " . X X X X . X X X X . X X X X . . o . . . ",
> " . X X X X X . X X X X . X X X X . . . . X . ",
> " . X X X X . . X X X . X X X X X . X . X . X . ",
> " . X X . X X X X . X X X X X X X X X X X . ",
> " . X X . X X . X X X X X X X X X X X . ",
> " . . X . . X X X X X X X X X X . . ",
> " . X X X X X X X X X . . . ",
> " . X X X X . . . . ",
> " . X X . X X . ",
> " . X X . X X . ",
> " . X X . . . . . . . ",
> " . X . X X X X X . . X . . ",
> " . X X X X X X X X X X . X X . ",
> " . . . . . . . . . . . . . X . . "
> } ;
>
> It consists of an introducer line giving the size of the image, the
> number of colors and the number of bytes (characters) per color,
> followed by the color map, finally followed by the image data itself.
>
> In the above case, your call would look like
>
> fl_set_pixmap_data( obj, eye );
>
> XPM is mostly useful for small icons and other graphic objects which
> are generally static in nature. It is *not* an appropriate format for
> real useful image data (such as satellite images, etc.) given the high
> overhead in translating from the XPM format to the XImage structure
> and Pixmap server object, not to mention various bits of colormap
> fiddling.
>
> If you want to display an image of any significant size you really,
> really, really *must* use the Canvas object with raw Xlib XImage and
> Pixmap objects or use another API. For information on how to deal
> with this data you should refer to a good Xlib reference, such as the
> O'Reilly book I recommended in an earlier posting or the other book
> referred to by another poster to this list. You may also want to look
> at my color quantization library (available at
> ftp://ncmir.ucsd.edu/pub/quantize -- refer to
> ftp://ncmir.ucsd.edu/pub/quantize/libquantize.html for documentation.
> See the README file in the same location for downloading details, etc.).
>
> If you have OpenGL on your system, use the GLCanvas object. The
> glDrawPixels() function will allow you to write images to a GLCanvas
>
> The next release of XForms will have support for images built in but
> I'm not certain when that will be out -- Real Soon Now, I suppose,
> depending upon how busy they keep TC at MERL. :-)
>
> spl
> _________________________________________________
> To unsubscribe, send the message "unsubscribe" to
> xforms-request@bob.usuf2.usuhs.mil or see
> http://bob.usuf2.usuhs.mil/mailserv/xforms.html
> XForms Home Page: http://bragg.phys.uwm.edu/xforms
> List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/