GreImageData
GreImageData draws a single row of image data with one bit per pel by using the current image foreground and background color and mix attributes.
This function must be supported by the presentation driver. GreImageData is called by the function GpiImage. GreImageData is called multiple times for each call made to GpiImage, once for each scan line in the monochrome bit map.
- Simulation support
- None. This function is mandatory for all drivers.
Syntax
GreImageData(hdc, pData, cBits, offRow, pInstance, lFunction);
Parameters
- hdc (HDC) - input
- Device context handle.
- pData (PBYTE) - input
- Pointer to data string.
- cBits (LONG) - input
- Number of bits in row (maximum is 2040).
- offRow (ULONG) - input
- Row number relative to the current y-position.
- Zero is the current position. A value of 1 indicates one row below the current position.
- pInstance (PVOID) - input
- Pointer to instance data.
- lFunction (ULONG) - input
- High-order WORD=flags; low-order WORD=NGreImageData.
Returns
- rc (LONG) - returns
- Return Code.
On completion, the handling routine must return a LONG integer (cHits), indicating whether correlation hits have been detected:
- GPI_OK Successful
- GPI_HITS Successful with correlate hit (returned by display drivers when the correlate flag is ON, and a hit is detected)
- GPI_ERROR Error
Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:
- PMERR_BITMAP_NOT_SELECTED
- PMERR_COORDINATE_OVERFLOW
- PMERR_DEV_FUNC_NOT_INSTALLED
- PMERR_HDC_BUSY
- PMERR_INV_COLOR_DATA
- PMERR_INV_COLOR_INDEX
- PMERR_INV_COORD_SPACE
- PMERR_INV_COORDINATE
- PMERR_INV_HDC
- PMERR_INV_IMAGE_DATA_LENGTH
- PMERR_INV_IN_AREA
- PMERR_INV_IN_PATH
- PMERR_INV_LENGTH_OR_COUNT
- PMERR_INV_PICK_APERTURE_POSN
- PMERR_INV_RECT
- PMERR_INV_REGION_CONTROL
- PMERR_INV_SCAN_START
Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.
Sample
#define INCL_GRE_BITMAPS #include <os2.h> HDC hdc; /* Device context handle. */ PBYTE pData; /* Pointer to data string. */ LONG cBits; /* Number of bits in row (maximum is 2040). */ ULONG offRow; /* Row number relative to the current y-position. */ PVOID pInstance; /* Pointer to instance data. */ ULONG lFunction; /* High-order WORD=flags; low-order WORD=NGreImageData. */ LONG rc; /* Return Code. */ rc = GreImageData(hdc, pData, cBits, offRow, pInstance, lFunction);
Remarks
Drawing starts at the current X-position and at a Y-position defined as a row offset below the current Y-position. Data is supplied as a series of bytes and a count of the bits to be drawn. The handling routine cannot assume that unused bits at the end of the stream are set to 0. Bits are drawn from left to right. The high-order bit of each byte is the leftmost-image bit. The 1 bits are foreground and the 0 bits are background. Note that this function does not affect the current position.