Read and write XBM images.
XBM IO | Read and write XBM images. |
Functions | |
gdImageCreateFromXbm | gdImageCreateFromXbm is called to load images from X bitmap format files. |
gdImageXbmCtx | Writes an image to an IO context in X11 bitmap format. |
gdImagePtr gdImageCreateFromXbm( FILE * fd )
gdImageCreateFromXbm is called to load images from X bitmap format files. Invoke gdImageCreateFromXbm with an already opened pointer to a file containing the desired image. gdImageCreateFromXbm returns a gdImagePtr to the new image, or NULL if unable to load the image (most often because the file is corrupt or does not contain an X bitmap format image). gdImageCreateFromXbm does not close the file.
You can inspect the sx and sy members of the image to determine its size. The image must eventually be destroyed using gdImageDestroy.
X11 X bitmaps (which define a char[]) as well as X10 X bitmaps (which define a short[]) are supported.
fd | The input FILE pointer |
A pointer to the new image or NULL if an error occurred.
gdImagePtr im; FILE *in; in = fopen("myxbm.xbm", "rb"); im = gdImageCreateFromXbm(in); fclose(in); // ... Use the image ... gdImageDestroy(im);
void gdImageXbmCtx( gdImagePtr image, char * file_name, int fg, gdIOCtx * out )
Writes an image to an IO context in X11 bitmap format.
image | The gdImagePtr to write. |
file_name | The prefix of the XBM’s identifiers. Illegal characters are automatically stripped. |
gd | Which color to use as forground color. All pixels with another color are unset. |
out | The gdIOCtx to write the image file to. |
gdImageCreateFromXbm is called to load images from X bitmap format files.
gdImagePtr gdImageCreateFromXbm( FILE * fd )
Writes an image to an IO context in X11 bitmap format.
void gdImageXbmCtx( gdImagePtr image, char * file_name, int fg, gdIOCtx * out )
gdImageDestroy is used to free the memory associated with an image.
void gdImageDestroy ( gdImagePtr im )