GreSetDeviceSurface
GreSetDeviceSurface allows printer devices to dynamically optimize their frame buffer's height, width, bits per pel and DevCaps.
Syntax
GreSetDeviceSurface(hdc, pDS);
Parameters
- hdc (HDC) - input
- The device context handle.
- pDS (PDEVICESURFACE) - input
- Pointer to information needed by the graphics engine.
- ulLength Length of the DEVICESURFACE data structure.
- SurfaceBmapInfo
- Information used by the graphics engine when rastering to a linear address. (See BMAPINFO in Data Types)
- ulDSFlgs
- Miscellaneous flags used by the graphics engine for rendering of rasterized data.
- Color format flag
- DS_MONO_INVERT
- Mono ROPs are inverted.
- Destination color format flags
- DS_COLOR_RGB
- Color is in RGB.
- DS_COLOR_RGB2
- Color is in RGB2 (default).
- DS_COLOR_24BIT_BGR
- First byte=blue (default).
- DS_COLOR_24BIT_RGB
- First byte=red, second byte=green, third byte=blue.
- DS_COLOR_16BIT_565_BGR
- Blue 5 bits (default)
- Green 6 bits
- Red 5 bits
- |b|b|b|b|b|g|g|g|g|g|g|r|r|r|r|r|
- DS_COLOR_16BIT_565_RGB
- Red 5 bits
- Green 6 bits
- Blue 5 bits
- |r|r|r|r|r|g|g|g|g|g|g|b|b|b|b|b|
- DS_COLOR_16BIT_1555_BGR
- Overlay 1
- Blue 5 bits
- Green 5 bits
- Red 5 bits
- |o|b|b|b|b|b|g|g|g|g|g|r|r|r|r|r|
- DS_COLOR_16BIT_1555_RGB
- Overlay 1
- Red 5 bits
- Green 5 bits
- Blue 5 bits
- |o|r|r|r|r|r|g|g|g|g|g|b|b|b|b|b|
Direction flags
DS_BOTTOMTOP Bottom-to-top is Y position. DS_TOPBOTTOM Top-to-bottom is Y position.
Hardcopy flag
DS_QUEUED_RAW_DEFAULT Set QUEUED to RAW as default.
Notification flag
DS_NOTIFY_LAST_SDBITBLT Last banded blit per API bit map transfer.
Scanline alignment flags
DS_BYTE_ALIGNMENT DS scan line alignment. DS_2BYTE_ALIGNMENT DS scan line alignment. DS_4BYTE_ALIGNMENT DS scan line alignment. DS_KEEP_EXTFORMAT Variable alignment; let application decide.
Surface description flag
DS_MEMORY Memory surface.
- ulStyleRatio
- Default style ratio used by the current device.
- abmapinfoDefPattern[ ]
- Set of default patterns supplied by the graphics engine that can be changed by the presentation driver. [DEFAULT_PATTERNS_NUMBER].
- pHWPalette
- Default hardware palette for the current device.
- DitherMatrix
- Default is the generic dither support for hardcopy devices.
- pfnDevLockDC
- Pointer to allow the device driver to retrieve its device-specific information from the graphics engine. Pointer is stored by the device driver.
- pfnDevUnLockDC
- Pointer to the function to release the lock on the current DC. Pointer is stored by the device driver.
- pfnBitBlt
- Pointer defaults to SOFTDRAW's handling of the new SDBitBlt function. If a device does not have linear address support or would rather handle preclipped bit map transfers itself, then it should hook out this function with its own routine.
- pfnLine
- Pointer defaults to SOFTDRAW's handling of the new SDLine function. If a device does not have linear address support or would rather handle preclipped line operations itself, then it should hook out this function with its own routine.
- pfnReserved
- Reserved by system.
- pfnLockPhysDev
- Pointer prevents other processes from accessing the physical hardware between the lock and unlock.
- pfnUnLockPhysDev
- Pointer releases the physical hardware for access by other processes.
- ulReserved[5]
- Reserved by system.
- ulCapsCnt
- Size in ULONGs of the DevCaps field.
- DevCaps[ ]
- The device capabilities array in OS/2 2.0 and previous versions. Array must be filled out in order for the graphics engine to handle a call to the DevQueryCaps function. [CAPS_MAX_CAPS + 1]
Return Code
- rc (LONG) - returns
- Return codes.
The handling routine should return a LONG integer. Valid values are:
- Zero (0) Success
- Other Failure
Remarks
Printer devices can change their surface definition between pages using the GreSetDeviceSurface call. (This call must be imported.)
Example Code
#include <os2.h> HDC hdc; /* The device context handle. */ PDEVICESURFACE pDS; /* Pointer to information needed by the graphics engine. */ LONG rc; /* Return codes. */ rc = GreSetDeviceSurface(hdc, pDS);