QueryDeviceSurface: Difference between revisions
Created page with "This routine is used by the graphics engine to query the device surface information. This function fills the DEVICESURFACE structure to be used by both the graphics engine and..." |
No edit summary |
||
Line 1: | Line 1: | ||
QueryDeviceSurface provides the needed information to the graphics engine for handling the new Device Driver Interface (DDI) architecture. | |||
This routine is used by the graphics engine to query the device surface information. This function fills the DEVICESURFACE structure to be used by both the graphics engine and the device driver. | This routine is used by the graphics engine to query the device surface information. This function fills the DEVICESURFACE structure to be used by both the graphics engine and the device driver. | ||
Line 4: | Line 6: | ||
==Syntax== | ==Syntax== | ||
QueryDeviceSurface( | QueryDeviceSurface(ulSubfunction, pParam1, pParam2); | ||
==Parameters== | |||
; ulSubfunction (ULONG) - input | |||
: 0Eh. | |||
; pParam1 (PLONG) - input | |||
: Pointer to the DEVICESURFACE data structure. | |||
Points to information needed by the graphics engine. | |||
* ulLength Length of the DEVICESURFACE data structure, in bytes. | |||
* 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. | |||
Device Font Flags | |||
Normal output to the device from the graphics subsystem is generated from the device origin with scan lines horizontal and incrementing both pels and scan lines. This output can be altered by the following flags: | |||
DS_BITBLT_XROW_YSCAN | |||
Generates row data as sequential bit stream instead of scan line data. | |||
DS_BITBLT_ROW_NEGATIVE | |||
Generates rows in opposite direction, for example, Start at Device Origin + Device Height. | |||
DS_BITBLT_SCAN_NEGATIVE | |||
Generates scan lines in opposite direction, for example, Start at Device Origin + Device Length. | |||
Output Surface Direction Flags | |||
As of OS/2 Warp Version 4, the graphics subsystem added device font support for the new device driver model. Below are some of the device surface flags to support it: | |||
DS_DOWNLOAD_FONTS | |||
(GRE_VERSION 234) - The device request downloading of system fonts via pfnTextBlt in new cached format. | |||
DS_DEVICE_FONTS | |||
(GRE_VERSION 234) - The device has its own hardware fonts. It will provide font definition information, but wants the system to handle all query and character string operations. It will render fonts via the pfnTextBlt call. | |||
DS_FONT_CLIP_SUPPORT | |||
(GRE_VERSION 238) - In Gre Version 234, only the precise rule is used. | |||
DS_CLIP_100_RULE | |||
Graphics subsystem will not send the glyph to the driver unless it is fully visible. | |||
DS_CLIP_66_RULE | |||
Graphics subsystem will only send the glyph to the driver if it is at least 66% visible. | |||
DS_CLIP_PRECISE_RULE | |||
Graphics subsystem will send the all glyphs to the driver with all the current clip rectangles. | |||
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. | |||
For additional details on dithering refer to the section, Dithering / Color Mapping Interface. | |||
ulLength | |||
Length of dither matrix structure. | |||
fExt2IntSup | |||
Gre dither flags for external to internal. | |||
pExt2IntDI | |||
Used for GDM_USERDEF. Pointer to users dither information. | |||
fStretchSup | |||
Gre dither flags for stretch support. | |||
pStretchDI | |||
Used for GDM_USERDEF. Pointer to users dither information. | |||
fLog2PhysSup | |||
Gre dither flags for logical to physical color mapping. | |||
pLog2PhysDI | |||
Used for GDM_USERDEF. Pointer to users dither information. | |||
pfnDither | |||
Used for GDM_USERDEF. Pointer to users dither function. | |||
DitherMatrix Flags: | |||
GDM_NO_DITHER | |||
No dithering in system. | |||
GDM_USERDEF_DITHER | |||
Users supplies own dithering routines. | |||
GDM_MATRIX_DITHER | |||
Use system-ordered dithering. | |||
GDM_ERRORDIF_DITHER | |||
Use system error diffusion dithering. | |||
GDM_DITHER_BEGIN | |||
Used with dithering that needs to save data across output bands of an image. | |||
GDM_DITHER_END | |||
Used with dithering that needs to save data across output bands of an image. | |||
GDM_COLOR_CONVERT | |||
Use device's color mapping functions. | |||
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. | |||
pfnTextBlt Used in conjunction with DS_DOWNLOAD_FONTS and DS_DEVICE_FONTS. If flags are not specified, text strings will be simulated through bitblts. | |||
Refer to Device Font Support for additional details. | |||
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. | |||
ulhddc Handle to device's device context. | |||
ulReserved[4] 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] | |||
; pParam2 (LONG) - input | |||
: Long integer returned from FillPhysicalDeviceBlock. | |||
==Return Code== | |||
; rc (LONG) - returns | |||
: Return codes. | |||
The handling routine should return a LONG integer. Valid values are: | |||
* Zero (0) Success | |||
* - 1 Error | |||
If pParam1 is a null pointer, return a zero (0) if you are requesting new graphics engine support; otherwise, return a - 1. | |||
==Remarks== | |||
For display drivers, the system layer is responsible for handling the QueryDeviceSurface subfunction call. This call is made from the graphics engine during an OpenDC request. | |||
==Example Code== | |||
<PRE> | |||
#include <os2.h> | |||
ULONG ulSubfunction; /* 0Eh. */ | |||
PLONG pParam1; /* Pointer to the DEVICESURFACE data structure. */ | |||
LONG pParam2; /* Long integer returned from FillPhysicalDeviceBlock. */ | |||
LONG rc; /* Return codes. */ | |||
rc = QueryDeviceSurface(ulSubfunction, pParam1, | |||
pParam2); | |||
</PRE> | |||
[[Category:Draft]] | [[Category:Draft]] |
Revision as of 23:25, 19 November 2019
QueryDeviceSurface provides the needed information to the graphics engine for handling the new Device Driver Interface (DDI) architecture.
This routine is used by the graphics engine to query the device surface information. This function fills the DEVICESURFACE structure to be used by both the graphics engine and the device driver.
Required by the OS/2 graphics engine (version 2.2 and later). Gives engine description of raster surface and performs some modifications to the device surface structure.
Syntax
QueryDeviceSurface(ulSubfunction, pParam1, pParam2);
Parameters
- ulSubfunction (ULONG) - input
- 0Eh.
- pParam1 (PLONG) - input
- Pointer to the DEVICESURFACE data structure.
Points to information needed by the graphics engine.
- ulLength Length of the DEVICESURFACE data structure, in bytes.
- 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.
Device Font Flags
Normal output to the device from the graphics subsystem is generated from the device origin with scan lines horizontal and incrementing both pels and scan lines. This output can be altered by the following flags:
DS_BITBLT_XROW_YSCAN Generates row data as sequential bit stream instead of scan line data. DS_BITBLT_ROW_NEGATIVE Generates rows in opposite direction, for example, Start at Device Origin + Device Height. DS_BITBLT_SCAN_NEGATIVE Generates scan lines in opposite direction, for example, Start at Device Origin + Device Length.
Output Surface Direction Flags
As of OS/2 Warp Version 4, the graphics subsystem added device font support for the new device driver model. Below are some of the device surface flags to support it:
DS_DOWNLOAD_FONTS (GRE_VERSION 234) - The device request downloading of system fonts via pfnTextBlt in new cached format. DS_DEVICE_FONTS (GRE_VERSION 234) - The device has its own hardware fonts. It will provide font definition information, but wants the system to handle all query and character string operations. It will render fonts via the pfnTextBlt call. DS_FONT_CLIP_SUPPORT (GRE_VERSION 238) - In Gre Version 234, only the precise rule is used. DS_CLIP_100_RULE Graphics subsystem will not send the glyph to the driver unless it is fully visible. DS_CLIP_66_RULE Graphics subsystem will only send the glyph to the driver if it is at least 66% visible. DS_CLIP_PRECISE_RULE Graphics subsystem will send the all glyphs to the driver with all the current clip rectangles.
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.
For additional details on dithering refer to the section, Dithering / Color Mapping Interface.
ulLength Length of dither matrix structure. fExt2IntSup Gre dither flags for external to internal. pExt2IntDI Used for GDM_USERDEF. Pointer to users dither information. fStretchSup Gre dither flags for stretch support. pStretchDI Used for GDM_USERDEF. Pointer to users dither information. fLog2PhysSup Gre dither flags for logical to physical color mapping. pLog2PhysDI Used for GDM_USERDEF. Pointer to users dither information. pfnDither Used for GDM_USERDEF. Pointer to users dither function.
DitherMatrix Flags:
GDM_NO_DITHER No dithering in system. GDM_USERDEF_DITHER Users supplies own dithering routines. GDM_MATRIX_DITHER Use system-ordered dithering. GDM_ERRORDIF_DITHER Use system error diffusion dithering. GDM_DITHER_BEGIN Used with dithering that needs to save data across output bands of an image. GDM_DITHER_END Used with dithering that needs to save data across output bands of an image. GDM_COLOR_CONVERT Use device's color mapping functions.
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.
pfnTextBlt Used in conjunction with DS_DOWNLOAD_FONTS and DS_DEVICE_FONTS. If flags are not specified, text strings will be simulated through bitblts.
Refer to Device Font Support for additional details.
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.
ulhddc Handle to device's device context.
ulReserved[4] 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]
- pParam2 (LONG) - input
- Long integer returned from FillPhysicalDeviceBlock.
Return Code
- rc (LONG) - returns
- Return codes.
The handling routine should return a LONG integer. Valid values are:
- Zero (0) Success
- - 1 Error
If pParam1 is a null pointer, return a zero (0) if you are requesting new graphics engine support; otherwise, return a - 1.
Remarks
For display drivers, the system layer is responsible for handling the QueryDeviceSurface subfunction call. This call is made from the graphics engine during an OpenDC request.
Example Code
#include <os2.h> ULONG ulSubfunction; /* 0Eh. */ PLONG pParam1; /* Pointer to the DEVICESURFACE data structure. */ LONG pParam2; /* Long integer returned from FillPhysicalDeviceBlock. */ LONG rc; /* Return codes. */ rc = QueryDeviceSurface(ulSubfunction, pParam1, pParam2);