VPrepareGrayImage
Name
VPrepareGrayImage - computes a prepared gray-level image.
Synopsis
VPrepareGrayImage(data, width, height, bits_per_pixel, min, max, ximage)
unsigned char *data;
int width, height;
int bits_per_pixel;
unsigned long min, max;
XImage *ximage; /*RETURN*/
Description
VPrepareGrayImage computes a prepared gray-level image. If bits_per_pixel
is 8, the input data is assigned to character pointer type. If bits_per_pixel
is 16, the input data is assigned to short pointer type. The pixel values
are assigned to colorcells as in the array returned by VGetFreeColorcells
in increasing order of gray values. The output data byte order depends on the
X server, and VPrepareGrayImage gets this information from XImageByteOrder.
In order to display the prepared image stored in ximage, VPutImage should be
called. The data stored by the ximage structure (ximage->data) can be freed
by calling free().
Return Value
0 - work successfully.
1 - memory allocation error.
Parameters
data - the data to be converted.
width,height - specifies the width and height in pixels of the image.
bits_per_pixel - specifies the number of bits per pixel, the value is
8 or 16.
min,max - the minimum and maximum gray values of the image data.
image - returns precomputed image into the XImage structure.
Side Effects
None.
Entry Conditions
If the value of width, height, or bits_per_rgb is not valid, or
VCreateColormap is not called earlier, VPrepareGrayImage prints an error
message to the standard error stream, produces a core dump file and exits
from the current process.
Related Functions
VPrepareColorImage,
VDisplayGrayImage,
VDisplayColorImage,
VPutImage,
VGetImage.