Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This structure contains a description of a surface.

This structure is used to pass surface parameters to the IDirectDraw::CreateSurfacemethod.

It is also used to retrieve information about a surface in calls to IDirectDrawSurface::Lockand IDirectDrawSurface::GetSurfaceDesc.

The relevant members differ for each potential type of surface.

Syntax

typedef struct _DDSURFACEDESC {
  DWORD 
dwSize;
  DWORD 
dwFlags;
  DWORD 
dwHeight;
  DWORD 
dwWidth;
  LONG 
lPitch;
  LONG 
lXPitch;
  DWORD 
dwBackBufferCount;
  DWORD 
dwRefreshRate;
  LPVOID 
lpSurface;
  DDCOLORKEY 
ddckCKDestOverlay;
  DDCOLORKEY 
ddckCKDestBlt;
  DDCOLORKEY 
ddckCKSrcOverlay;
  DDCOLORKEY 
ddckCKSrcBlt;
  DDPIXELFORMAT 
ddpfPixelFormat;
  DDSCAPS 
ddsCaps;
  DWORD 
dwSurfaceSize;
} DDSURFACEDESC, FAR* LPDDSURFACEDESC; 

Members

dwSize

Size of the structure in bytes.

This member must be initialized before the structure is used.

dwFlags

Optional control flags.

The following table shows the possible flags.

Flag Description

DDSD_BACKBUFFERCOUNT

Indicates that the dwBackBufferCountmember is valid.

DDSD_CAPS

Indicates that the ddsCapsmember is valid.

DDSD_CKDESTBLT

Indicates that the ddckCKDestBltmember is valid.

DDSD_CKDESTOVERLAY

Indicates that the ddckCKDestOverlaymember is valid.

DDSD_CKSRCBLT

Indicates that the ddckCKSrcBltmember is valid.

DDSD_CKSRCOVERLAY

Indicates that the ddckCKSrcOverlaymember is valid.

DDSD_HEIGHT

Indicates that the dwHeightmember is valid.

DDSD_LPSURFACE

Indicates that the lpSurfacemember is valid.

DDSD_PITCH

Indicates that the lPitchmember is valid.

DDSD_PIXELFORMAT

Indicates that the ddpfPixelFormatmember is valid.

DDSD_REFRESHRATE

Indicates that the dwRefreshRatemember is valid.

DDSD_SURFACESIZE

Indicates that the dwSurfaceSizemember is valid.

DDSD_WIDTH

Indicates that the dwWidthmember is valid.

DDSD_XPITCH

Indicates that the lXpitchmember is valid.

dwHeightand dwWidth

Dimensions, in pixels, of the surface to be created.

lPitch

Distance, in bytes, to the start of next line.

When used with the IDirectDrawSurface::GetSurfaceDescmethod, this is a return value.

See remarks for more information.

lXPitch

Distance, in bytes, to next pixel to the right.

dwBackBufferCount

Number of back buffers.

dwRefreshRate

Refresh rate (used when the display mode is described).

The value of zero indicates that the adapter is using its default refresh rate.

It is not possible to change an adapter's refresh rate in Windows Embedded CE, therefore dwRefreshRatewill always be 0.

lpSurface

Address of the associated surface memory.

When calling IDirectDrawSurface::Lock, this member is a valid pointer to surface memory.

See remarks for more information.

ddckCKDestOverlay

DDCOLORKEYstructure that describes the destination color key to be used for an overlay surface.

ddckCKDestBlt

DDCOLORKEYstructure that describes the destination color key for blit operations.

ddckCKSrcOverlay

DDCOLORKEYstructure that describes the source color key to be used for an overlay surface.

ddckCKSrcBlt

DDCOLORKEYstructure that describes the source color key for blit operations.

ddpfPixelFormat

DDPIXELFORMATstructure that describes the surface's pixel format.

ddsCaps

DDSCAPSstructure containing the surface's capabilities.

dwSurfaceSize

Surface size, in bytes.

Remarks

The lPitchand lXPitchmembers are used to indicate the number of bytes between a pixel and the pixel directly below it onscreen and the pixel directly to the right of it onscreen. These will vary depending on the current rotation of the surface, and either value can be negative. For example:

On a 240x320 16bpp surface that is not rotated, lPitchwill usually be 480 and lXPitchwill be 2, and lpSurfacewill point to the first byte in memory of the surface.

Rotated to 90 degrees, lPitchbecomes 2 and lXPitchbecomes -480.

Rotated to 180 degrees, lPitchbecomes -480 and lXPitchbecomes -2.

Rotated to 270 degrees, lPitch becomes -2 and lXPitch becomes 480.

lpSurfacealways points to the memory for the pixel at (0,0), which when rotated is not going to be the first byte in memory of the surface.

The lPitchand lpSurfacemembers are output values when calling the IDirectDrawSurface::GetSurfaceDescmethod.

When creating surfaces from existing memory, or updating surface characteristics, these members are input values that describe the pitch and location of memory allocated by the calling application for use by DirectDraw.

DirectDraw does not attempt to manage or free memory allocated by the application.

Requirements

Header ddraw.h
Windows Embedded CE Windows Embedded CE 6.0 and later
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later