Previous: , Up: Pixmap Object   [Contents][Index]


15.6.6 Remarks

The following routines may be handy for reading a pixmap file into a pixmap

Pixmap fl_read_pixmapfile(Window win, const char *filename,
                          unsigned *width, unsigned *height,
                          Pixmap *shape_mask, int *hotx, int *hoty,
                          FL_COLOR tran);

where win is the window in which the pixmap is to be displayed. If the window is yet to be created, you can use the default window, returned by a call of fl_default_window(). Parameter shape_mask is a pointer to an already existing Pixmap, which, if not NULL, is used as a clipping mask to achieve transparency. hotx and hoty are the center of the pixmap (useful if the pixmap is to be used as a cursor). Parameter tran is currently not used.

If you already have the pixmap data in memory, the following routine can be used

Pixmap fl_create_from_pixmapdata(Window win, char **data,
                                 unsigned *width, unsigned *height,
                                 Pixmap *shape_mask, int *hotx,
                                 int *hoty, FL_COLOR tran);

All parameters have the same meaning as for fl_read_pixmapfile.

Note that the Forms Library handles transparency, if specified in the pixmap file or data, for pixmap and pixmapbutton objects. However, when using fl_read_pixmapfile() or fl_create_from_pixmapdata(), the application programmer is responsible to set the clip mask in an appropriate GC.

Finally there is a routine that can be used to free a Pixmap

void fl_free_pixmap(Pixmap id);

You will need the XPM library (version 3.4c or later)m developed by Arnaud Le Hors and Groupe Bull, to use pixmaps. The XPM library is avalialble as a package for most distributions, but can also be obtained from many X mirror sites, e.g., via anonymous FTP from (ftp://ftp.x.org/contrib/libraries/. Its home page is http://old.koalateam.com/lehors/xpm.html.


Previous: , Up: Pixmap Object   [Contents][Index]