GXDisplayProperties
The GXDisplayProperties structure provides information about the video frame buffer (VFB) memory.
Note GAPI is deprecated. Use DirectDraw and Direct3D Mobile APIs instead.
Syntax
struct GXDisplayProperties {
DWORD cxWidth;
DWORD cyHeight;
long cbxPitch;
long cbyPitch;
long cBPP;
DWORD ffFormat;
};
Members
- cxWidth
Number of visible pixels across the display. Width is considered the left to right measurement when looking at the physical device. - cyHeight
Number of visible pixels along the height of the display. - cbxPitch
Number of bytes to add to move a pointer to the right one pixel. See Remarks for information about display depths that are less than 8 bits per pixel. - cbyPitch
Number of bytes to add to move a pointer down one pixel. See Remarks for information about display depths that are less than 8 bits per pixel. - cBPP
Number of bits per pixel; always a power of 2. - ffFormat
Information about the display format. Code member is one of the format flags described in the following table.Flag Description kfLandscape Display is oriented on its side; 0,0 is in the lower-left corner; increasing addresses move up the screen. Generally, it is not an issue if you use cbxPitch and cbyPitch. See Remarks for information about display depths that are less than 8 bits per pixel. kfPalette Display is palette based. kfDirect Display is direct mapped, no palette. This is a "helper" bit, so you do not have to check all the direct flags manually. kfDirectInverted Indicates the display colors are inverted. For example, with black and white colors, white is black. kfDirect555
kfDirect565
kfDirect888Format of a direct mapped pixel. Numbers specify bits per color in red-green-blue order. The Intel byte order is assumed: for kfDirect565, a left shift of 11 puts the low-order bits of a short or long into the red position.
Remarks
On displays with fewer than 8 bits per pixel, a byte pointer points to more than one pixel. The cbxPitch and cbyPitch values cannot be fractions, so pointer arithmetic should be done with coordinate values that are shifted down appropriately. Because some devices have rotated frame buffers, the pointer can point to pixels that are either side by side or on top of each other. The bits-per-pixel value (cBPP) of the display should be used to calculate addresses in this case.
Code Example
The following code example demonstrates how to use an expression to find the address of pixel (x, y), on a display that is 4 bits per pixel.
Note To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.
unsigned char * pb;
if (cBPP < 8)
{
address = pb + ((x * cBPP) >> 3) + (y * cbyPitch);
}
A masking operation is required for setting or reading the correct bits in the byte that correspond to the actual pixel.
On displays with 8 or more bits per pixel, the arithmetic is straightforward, as follows:
address = pb + (x * cbxPitch) + (y * cbyPitch);
The resulting address points to only one pixel.
Requirements
Pocket PC: Pocket PC 2000 and later
Smartphone: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: gx.h
Library: gx.lib
See Also
GAPI Structures | Windows Mobile Game Programming
Send Feedback on this topic to the authors