GXDisplayProperties

The GXDisplayProperties structure provides information about the video frame buffer (VFB) memory.

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
    kfDirect888
    Format 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.

For example, on a display that is 4 bits per pixel, use an expression such as the following to find the address of pixel (x, y):

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

Smartphone: Windows Mobile 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

Last updated on Friday, April 22, 2005

© 2005 Microsoft Corporation. All rights reserved.

Send feedback on this topic to the authors.