DirectDraw.pas

Top  Previous  Next

(*==========================================================================;

*

*  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.

*

*  Files:        ddraw.h dvp.h

*  Content:        DirectDraw and DirectDrawVideoPort include files

*

*  DirectX 7.0 Delphi adaptation by Erik Unger

*

*  Modified: 10-Sep-2000

*

*  Download: http://www.delphi-jedi.org/DelphiGraphics/

*  E-Mail: DelphiDirectX@next-reality.com

*

*

***************************************************************************)

 

unit DirectDraw;

 

interface

 

{$MINENUMSIZE 4}

{$ALIGN ON}

 

uses

Windows;

 

var

DDrawDLL : HMODULE = 0;

 

function DDErrorString(Value: HResult) : string;

 

function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;

 

(*

* FOURCC codes for DX compressed-texture pixel formats

*)

const

FOURCC_DXT1 = 'DXT1';

FOURCC_DXT2 = 'DXT2';

FOURCC_DXT3 = 'DXT3';

FOURCC_DXT4 = 'DXT4';

FOURCC_DXT5 = 'DXT5';

 

(*

* GUIDS used by DirectDraw objects

*)

const

CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}';

CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}';

CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}';

 

const

DD_ROP_SPACE = (256 div 32);       // space required to store ROP array

 

MAX_DDDEVICEID_STRING        = 512;

 

(*

* Flags for the IDirectDraw4::GetDeviceIdentifier method

*)

 

(*

* This flag causes GetDeviceIdentifier to return information about the host (typically 2D) adapter in a system equipped

* with a stacked secondary 3D adapter. Such an adapter appears to the application as if it were part of the

* host adapter, but is typically physcially located on a separate card. The stacked secondary's information is

* returned when GetDeviceIdentifier's dwFlags field is zero, since this most accurately reflects the qualities

* of the DirectDraw object involved.

*)

DDGDI_GETHOSTIDENTIFIER         = $00000001;

 

(*============================================================================

*

* DirectDraw Structures

*

* Various structures used to invoke DirectDraw.

*

*==========================================================================*)

 

var

NilGUID : TGUID = '{00000000-0000-0000-0000-000000000000}';

 

 

type

TRefGUID = packed record

   case integer of

   1: (guid : PGUID);

   2: (dwFlags : DWORD);

end;

 

IDirectDraw = interface;

IDirectDraw2 = interface;

IDirectDraw4 = interface;

IDirectDraw7 = interface;

IDirectDrawSurface = interface;

IDirectDrawSurface2 = interface;

IDirectDrawSurface3 = interface;

IDirectDrawSurface4 = interface;

IDirectDrawSurface7 = interface;

 

IDirectDrawPalette = interface;

IDirectDrawClipper = interface;

IDirectDrawColorControl = interface;

IDirectDrawGammaControl = interface;

 

(*

* Generic pixel format with 8-bit RGB and alpha components

*)

PDDARGB = ^TDDARGB;

TDDARGB = packed record

   blue:     BYTE;

   green:    BYTE;

   red:      BYTE;

   alpha:    BYTE;

end;

 

(*

* This version of the structure remains for backwards source compatibility.

* The DDARGB structure is the one that should be used for all DirectDraw APIs.

*)

PDDRGBA = ^TDDRGBA;

TDDRGBA = packed record

   red   : BYTE;

   green : BYTE;

   blue  : BYTE;

   alpha : BYTE;

end;

 

(*

* TDDColorKey

*)

PDDColorKey = ^TDDColorKey;

TDDColorKey = packed record

   dwColorSpaceLowValue: DWORD;   // low boundary of color space that is to

                                  // be treated as Color Key, inclusive

   dwColorSpaceHighValue: DWORD;  // high boundary of color space that is

                                  // to be treated as Color Key, inclusive

end;

 

// Delphi 5 can't handle interface in variant records

// so we have to use pointers instead (which can be type-casted into interfaces):

 

{$IFDEF VER130}

PDirectDrawSurface = Pointer;             

{$ELSE}

{$IFDEF VER140}                // D6, TP 14

PDirectDrawSurface = Pointer;

{$ELSE}

PDirectDrawSurface = IDirectDrawSurface;

{$ENDIF}

{$ENDIF}

 

(*

* TDDBltFX

* Used to pass override information to the DIRECTDRAWSURFACE callback Blt.

*)

PDDBltFX = ^TDDBltFX;

TDDBltFX = packed record

   dwSize                        : DWORD;     // size of structure

   dwDDFX                        : DWORD;     // FX operations

   dwROP                         : DWORD;     // Win32 raster operations

   dwDDROP                       : DWORD;     // Raster operations new for DirectDraw

   dwRotationAngle               : DWORD;     // Rotation angle for blt

   dwZBufferOpCode               : DWORD;     // ZBuffer compares

   dwZBufferLow                  : DWORD;     // Low limit of Z buffer

   dwZBufferHigh                 : DWORD;     // High limit of Z buffer

   dwZBufferBaseDest             : DWORD;     // Destination base value

   dwZDestConstBitDepth          : DWORD;     // Bit depth used to specify Z constant for destination

   case integer of

   0: (

     dwZDestConst                : DWORD      // Constant to use as Z buffer for dest

    );

   1: (

     lpDDSZBufferDest            : PDirectDrawSurface; // Surface to use as Z buffer for dest

     dwZSrcConstBitDepth         : DWORD;     // Bit depth used to specify Z constant for source

     case integer of

     0: (

       dwZSrcConst               : DWORD;     // Constant to use as Z buffer for src

      );

     1: (

       lpDDSZBufferSrc           : PDirectDrawSurface; // Surface to use as Z buffer for src

       dwAlphaEdgeBlendBitDepth  : DWORD;     // Bit depth used to specify constant for alpha edge blend

       dwAlphaEdgeBlend          : DWORD;     // Alpha for edge blending

       dwReserved                : DWORD;

       dwAlphaDestConstBitDepth  : DWORD;     // Bit depth used to specify alpha constant for destination

       case integer of

       0: (

         dwAlphaDestConst        : DWORD;     // Constant to use as Alpha Channel

        );

       1: (

         lpDDSAlphaDest          : PDirectDrawSurface; // Surface to use as Alpha Channel

         dwAlphaSrcConstBitDepth : DWORD;     // Bit depth used to specify alpha constant for source

         case integer of

         0: (

           dwAlphaSrcConst       : DWORD;     // Constant to use as Alpha Channel

         );

         1: (

           lpDDSAlphaSrc         : PDirectDrawSurface; // Surface to use as Alpha Channel

           case integer of

           0: (

             dwFillColor         : DWORD;     // color in RGB or Palettized

           );

           1: (

             dwFillDepth         : DWORD;     // depth value for z-buffer

           );

           2: (

             dwFillPixel         : DWORD;     // pixel value

           );

           3: (

             lpDDSPattern        : PDirectDrawSurface; // Surface to use as pattern

             ddckDestColorkey    : TDDColorKey; // DestColorkey override

             ddckSrcColorkey     : TDDColorKey; // SrcColorkey override

           )

       )

     )

   )

)

end;

 

(*

* TDDSCaps

*)

PDDSCaps = ^TDDSCaps;

TDDSCaps = packed record

   dwCaps: DWORD;         // capabilities of surface wanted

end;

 

(*

* TDDOSCaps

*)

PDDOSCaps = ^TDDOSCaps;

TDDOSCaps = packed record

   dwCaps: DWORD;         // capabilities of surface wanted

end;

 

(*

* This structure is used internally by DirectDraw.

*)

PDDSCapsEx = ^TDDSCapsEx;

TDDSCapsEx = packed record

   dwCaps2 : DWORD;

   dwCaps3 : DWORD;

   dwCaps4 : DWORD;

end;

 

(*

* TDDSCaps2

*)

PDDSCaps2 = ^TDDSCaps2;

TDDSCaps2 = packed record

   dwCaps: DWORD;         // capabilities of surface wanted

   dwCaps2 : DWORD;

   dwCaps3 : DWORD;

   dwCaps4 : DWORD;

end;

 

(*

* TDDCaps

*)

(*

* This structure is the TDDCaps structure as it was in version 2 and 3 of Direct X.

* It is present for back compatability.

*)

PDDCaps_DX3 = ^TDDCaps_DX3;

TDDCaps_DX3 = packed record

   dwSize: DWORD;                 // size of the DDDRIVERCAPS structure

   dwCaps: DWORD;                 // driver specific capabilities

   dwCaps2: DWORD;                // more driver specific capabilites

   dwCKeyCaps: DWORD;             // color key capabilities of the surface

   dwFXCaps: DWORD;               // driver specific stretching and effects capabilites

   dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities

   dwPalCaps: DWORD;              // palette capabilities

   dwSVCaps: DWORD;               // stereo vision capabilities

   dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8

   dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8

   dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8

   dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8

   dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8

   dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8

   dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32

   dwVidMemTotal: DWORD;          // total amount of video memory

   dwVidMemFree: DWORD;           // amount of free video memory

   dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays

   dwCurrVisibleOverlays: DWORD;  // current number of visible overlays

   dwNumFourCCCodes: DWORD;       // number of four cc codes

   dwAlignBoundarySrc: DWORD;     // source rectangle alignment

   dwAlignSizeSrc: DWORD;         // source rectangle byte size

   dwAlignBoundaryDest: DWORD;    // dest rectangle alignment

   dwAlignSizeDest: DWORD;        // dest rectangle byte size

   dwAlignStrideAlign: DWORD;     // stride alignment

   dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported

   ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities

   dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwReserved1: DWORD;            // reserved

   dwReserved2: DWORD;            // reserved

   dwReserved3: DWORD;            // reserved

   dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts

   dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts

   dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts

   dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts

   dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts

   dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts

   dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts

   dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts

   dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts

   dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts

   dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts

   dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts

   dwReserved4 : DWORD;

   dwReserved5 : DWORD;

   dwReserved6 : DWORD;

end;

 

(*

* This structure is the TDDCaps structure as it was in version 5 of Direct X.

* It is present for back compatability.

*)

PDDCaps_DX5 = ^TDDCaps_DX5;

TDDCaps_DX5 = packed record

   dwSize: DWORD;                 // size of the DDDRIVERCAPS structure

   dwCaps: DWORD;                 // driver specific capabilities

   dwCaps2: DWORD;                // more driver specific capabilites

   dwCKeyCaps: DWORD;             // color key capabilities of the surface

   dwFXCaps: DWORD;               // driver specific stretching and effects capabilites

   dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities

   dwPalCaps: DWORD;              // palette capabilities

   dwSVCaps: DWORD;               // stereo vision capabilities

   dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8

   dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8

   dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8

   dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8

   dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8

   dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8

   dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32

   dwVidMemTotal: DWORD;          // total amount of video memory

   dwVidMemFree: DWORD;           // amount of free video memory

   dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays

   dwCurrVisibleOverlays: DWORD;  // current number of visible overlays

   dwNumFourCCCodes: DWORD;       // number of four cc codes

   dwAlignBoundarySrc: DWORD;     // source rectangle alignment

   dwAlignSizeSrc: DWORD;         // source rectangle byte size

   dwAlignBoundaryDest: DWORD;    // dest rectangle alignment

   dwAlignSizeDest: DWORD;        // dest rectangle byte size

   dwAlignStrideAlign: DWORD;     // stride alignment

   dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported

   ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities

   dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwReserved1: DWORD;            // reserved

   dwReserved2: DWORD;            // reserved

   dwReserved3: DWORD;            // reserved

   dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts

   dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts

   dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts

   dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts

   dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts

   dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts

   dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts

   dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts

   dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts

   dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts

   dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts

   dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts

   // Members added for DX5:

   dwMaxVideoPorts: DWORD;           // maximum number of usable video ports

   dwCurrVideoPorts: DWORD;           // current number of video ports used

   dwSVBCaps2: DWORD;                   // more driver specific capabilities for System->Vmem blts

   dwNLVBCaps: DWORD;                   // driver specific capabilities for non-local->local vidmem blts

   dwNLVBCaps2: DWORD;                   // more driver specific capabilities non-local->local vidmem blts

   dwNLVBCKeyCaps: DWORD;           // driver color key capabilities for non-local->local vidmem blts

   dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts

   dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts

end;

 

PDDCaps_DX6 = ^TDDCaps_DX6;

TDDCaps_DX6 = packed record

   dwSize: DWORD;                 // size of the DDDRIVERCAPS structure

   dwCaps: DWORD;                 // driver specific capabilities

   dwCaps2: DWORD;                // more driver specific capabilites

   dwCKeyCaps: DWORD;             // color key capabilities of the surface

   dwFXCaps: DWORD;               // driver specific stretching and effects capabilites

   dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities

   dwPalCaps: DWORD;              // palette capabilities

   dwSVCaps: DWORD;               // stereo vision capabilities

   dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8

   dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8

   dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8

   dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8

   dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8

   dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8

   dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32

   dwVidMemTotal: DWORD;          // total amount of video memory

   dwVidMemFree: DWORD;           // amount of free video memory

   dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays

   dwCurrVisibleOverlays: DWORD;  // current number of visible overlays

   dwNumFourCCCodes: DWORD;       // number of four cc codes

   dwAlignBoundarySrc: DWORD;     // source rectangle alignment

   dwAlignSizeSrc: DWORD;         // source rectangle byte size

   dwAlignBoundaryDest: DWORD;    // dest rectangle alignment

   dwAlignSizeDest: DWORD;        // dest rectangle byte size

   dwAlignStrideAlign: DWORD;     // stride alignment

   dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported

   ddsOldCaps: TDDSCaps;          // Was dssCaps: TDDSCaps. ddsCaps is of type TDDScaps2 for DX6

   dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3

   dwReserved1: DWORD;            // reserved

   dwReserved2: DWORD;            // reserved

   dwReserved3: DWORD;            // reserved

   dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts

   dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts

   dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts

   dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts

   dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts

   dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts

   dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts

   dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts

   dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts

   dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts

   dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts

   dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts

   // Members added for DX5:

   dwMaxVideoPorts: DWORD;           // maximum number of usable video ports

   dwCurrVideoPorts: DWORD;           // current number of video ports used

   dwSVBCaps2: DWORD;                   // more driver specific capabilities for System->Vmem blts

   dwNLVBCaps: DWORD;                   // driver specific capabilities for non-local->local vidmem blts

   dwNLVBCaps2: DWORD;                   // more driver specific capabilities non-local->local vidmem blts

   dwNLVBCKeyCaps: DWORD;           // driver color key capabilities for non-local->local vidmem blts

   dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts

   dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts

   // Members added for DX6 release

   ddsCaps : TDDSCaps2 ;          // Surface Caps

end;

 

TDDCaps_DX7 = TDDCaps_DX6;

 

PDDCaps = ^TDDCaps;

 

{$IFDEF DIRECTX3}

TDDCaps = TDDCaps_DX3;

{$ELSE}

{$IFDEF DIRECTX5}

   TDDCaps = TDDCaps_DX5;

{$ELSE}

   {$IFDEF DIRECTX6}

     TDDCaps = TDDCaps_DX6;

   {$ELSE}

     TDDCaps = TDDCaps_DX7;

   {$ENDIF}

{$ENDIF}

{$ENDIF}

 

 

 

 

(*

* TDDPixelFormat

*)

PDDPixelFormat_DX5 = ^TDDPixelFormat_DX5;

TDDPixelFormat_DX5 = packed record

   dwSize: DWORD;                 // size of structure

   dwFlags: DWORD;                // pixel format flags

   dwFourCC: DWORD;               // (FOURCC code)

   case Integer of

   0: (

     dwZBufferBitDepth: DWORD;      // how many bits for z buffers

    );

   1: (

     dwAlphaBitDepth: DWORD;        // how many bits for alpha channels

    );

   2: (

     dwRGBBitCount: DWORD;          // how many bits per pixel

     dwRBitMask: DWORD;             // mask for red bit

     dwGBitMask: DWORD;             // mask for green bits

     dwBBitMask: DWORD;             // mask for blue bits

     dwRGBAlphaBitMask: DWORD;      // mask for alpha channel

    );

   3: (

     dwYUVBitCount: DWORD;          // how many bits per pixel

     dwYBitMask: DWORD;             // mask for Y bits

     dwUBitMask: DWORD;             // mask for U bits

     dwVBitMask: DWORD;             // mask for V bits

     case Integer of

     0: (

       dwYUVAlphaBitMask: DWORD;      // mask for alpha channel

      );

     1: (

       dwRGBZBitMask: DWORD;

      );

     2: (

       dwYUVZBitMask: DWORD;

      );

    );

end;

 

PDDPixelFormat_DX6 = ^TDDPixelFormat_DX6;

TDDPixelFormat_DX6 = packed record

   dwSize: DWORD;                 // size of structure

   dwFlags: DWORD;                // pixel format flags

   dwFourCC: DWORD;               // (FOURCC code)

   case Integer of

     1: (

         dwRGBBitCount : DWORD;  // how many bits per pixel

         dwRBitMask : DWORD;  // mask for red bit

         dwGBitMask : DWORD;  // mask for green bits

         dwBBitMask : DWORD;  // mask for blue bits

         dwRGBAlphaBitMask : DWORD; // mask for alpha channel

         );

     2: (

         dwYUVBitCount : DWORD;  // how many bits per pixel

         dwYBitMask : DWORD;  // mask for Y bits

         dwUBitMask : DWORD;  // mask for U bits

         dwVBitMask : DWORD;  // mask for V bits

         dwYUVAlphaBitMask : DWORD; // mask for alpha channel

         );

     3: (

         dwZBufferBitDepth : DWORD; // how many total bits/pixel in z buffer (including any stencil bits)

         dwStencilBitDepth : DWORD; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)

         dwZBitMask : DWORD;  // mask for Z bits

         dwStencilBitMask : DWORD; // mask for stencil bits

         dwLuminanceAlphaBitMask : DWORD;// mask for alpha channel

         );

     4: (

         dwAlphaBitDepth : DWORD; // how many bits for alpha channels

         dwLuminanceBitMask : DWORD; // mask for luminance bits

         dwBumpDvBitMask : DWORD;        // mask for bump map V delta bits

         dwBumpLuminanceBitMask : DWORD; // mask for luminance in bump map

         dwRGBZBitMask : DWORD;  // mask for Z channel

         );

     5: (

          dwLuminanceBitCount : DWORD; // how many bits per pixel

          dwBumpDuBitMask : DWORD;       // mask for bump map U delta bits

          Fill1, Fill2    : DWORD;

          dwYUVZBitMask   : DWORD;  // mask for Z channel

        );

     6: ( dwBumpBitCount  : DWORD;         // how many bits per "buxel", total

        );

end;

 

TDDPixelFormat_DX3 = TDDPixelFormat_DX5;

TDDPixelFormat_DX7 = TDDPixelFormat_DX6;

 

PDDPixelFormat = ^TDDPixelFormat;

{$IFDEF DIRECTX3}

TDDPixelFormat = TDDPixelFormat_DX3;

{$ELSE}

{$IFDEF DIRECTX5}

   TDDPixelFormat = TDDPixelFormat_DX5;

{$ELSE}

   {$IFDEF DIRECTX6}

     TDDPixelFormat = TDDPixelFormat_DX6;

   {$ELSE}

     TDDPixelFormat = TDDPixelFormat_DX7;

   {$ENDIF}

{$ENDIF}

{$ENDIF}

 

(*

* TDDOverlayFX

*)

PDDOverlayFX = ^TDDOverlayFX;

TDDOverlayFX = packed record

   dwSize: DWORD;                         // size of structure

   dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend

   dwAlphaEdgeBlend: DWORD;               // Constant to use as alpha for edge blend

   dwReserved: DWORD;

   dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination

   case Integer of

   0: (

     dwAlphaDestConst: DWORD;               // Constant to use as alpha channel for dest

     dwAlphaSrcConstBitDepth: DWORD;        // Bit depth used to specify alpha constant for source

     dwAlphaSrcConst: DWORD;                // Constant to use as alpha channel for src

     dckDestColorkey: TDDColorKey;                // DestColorkey override

     dckSrcColorkey: TDDColorKey;                 // DestColorkey override

     dwDDFX: DWORD;                         // Overlay FX

     dwFlags: DWORD;                        // flags

    );

   1: (

     lpDDSAlphaDest: PDirectDrawSurface;     // Surface to use as alpha channel for dest

     filler: DWORD;

     lpDDSAlphaSrc: PDirectDrawSurface;      // Surface to use as alpha channel for src

    );

end;

 

(*

* TDDBltBatch: BltBatch entry structure

*)

PDDBltBatch = ^TDDBltBatch;

TDDBltBatch = packed record

   lprDest: PRect;

   lpDDSSrc: IDirectDrawSurface;

   lprSrc: PRect;

   dwFlags: DWORD;

   lpDDBltFx: TDDBltFX;

end;

 

(*

* TDDGammaRamp

*)

PDDGammaRamp = ^TDDGammaRamp;

TDDGammaRamp = packed record

   red   : array[0..255] of WORD;

   green : array[0..255] of WORD;

   blue  : array[0..255] of WORD;

end;

 

(*

*  This is the structure within which DirectDraw returns data about the current graphics driver and chipset

*)

 

PDDDeviceIdentifier = ^TDDDeviceIdentifier;

TDDDeviceIdentifier = packed record

   //

   // These elements are for presentation to the user only. They should not be used to identify particular

   // drivers, since this is unreliable and many different strings may be associated with the same

   // device, and the same driver from different vendors.

   //

   szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;

   szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;

 

   //

   // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons

   // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic

   // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.

   //

   // This version has the form:

   //  wProduct = HIWORD(liDriverVersion.HighPart)

   //  wVersion = LOWORD(liDriverVersion.HighPart)

   //  wSubVersion = HIWORD(liDriverVersion.LowPart)

   //  wBuild = LOWORD(liDriverVersion.LowPart)

   //

   liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components

 

   //

   // These elements can be used to identify particular chipsets. Use with extreme caution.

   //   dwVendorId     Identifies the manufacturer. May be zero if unknown.

   //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.

   //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.

   //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.

   //

   dwVendorId: DWORD;

   dwDeviceId: DWORD;

   dwSubSysId: DWORD;

   dwRevision: DWORD;

 

   //

   // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the

   // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to

   // reprofile the graphics subsystem.

   // This element can also be used to identify particular problematic drivers.

   //

   guidDeviceIdentifier: TGUID;

end;

 

PDDDeviceIdentifier2 = ^TDDDeviceIdentifier2;

TDDDeviceIdentifier2 = packed record

   //

   // These elements are for presentation to the user only. They should not be used to identify particular

   // drivers, since this is unreliable and many different strings may be associated with the same

   // device, and the same driver from different vendors.

   //

   szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;

   szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;

 

   //

   // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons

   // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic

   // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.

   //

   // This version has the form:

   //  wProduct = HIWORD(liDriverVersion.HighPart)

   //  wVersion = LOWORD(liDriverVersion.HighPart)

   //  wSubVersion = HIWORD(liDriverVersion.LowPart)

   //  wBuild = LOWORD(liDriverVersion.LowPart)

   //

   liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components

 

   //

   // These elements can be used to identify particular chipsets. Use with extreme caution.

   //   dwVendorId     Identifies the manufacturer. May be zero if unknown.

   //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.

   //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.

   //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.

   //

   dwVendorId: DWORD;

   dwDeviceId: DWORD;

   dwSubSysId: DWORD;

   dwRevision: DWORD;

 

   //

   // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the

   // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to

   // reprofile the graphics subsystem.

   // This element can also be used to identify particular problematic drivers.

   //

   guidDeviceIdentifier: TGUID;

 

   (*

    * This element is used to determine the Windows Hardware Quality Lab (WHQL)

    * certification level for this driver/device pair.

    *)

   dwWHQLLevel: DWORD;

end;

 

(*

* callbacks

*)

TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND;

     Code: DWORD; lpContext: Pointer): HResult; stdcall;

TSurfacesStreamingCallback = function(Arg: DWORD): HResult; stdcall;

 

(*

* TDDSurfaceDesc

*)

PDDSurfaceDesc_DX5 = ^TDDSurfaceDesc_DX5;

TDDSurfaceDesc_DX5 = packed record

   dwSize: DWORD;                 // size of the TDDSurfaceDesc structure

   dwFlags: DWORD;                // determines what fields are valid

   dwHeight: DWORD;               // height of surface to be created

   dwWidth: DWORD;                // width of input surface

   case Integer of

   0: (

     dwLinearSize : DWORD;       // unused at the moment

    );

   1: (

     lPitch: LongInt;                 // distance to start of next line (return value only)

     dwBackBufferCount: DWORD;      // number of back buffers requested

     case Integer of

     0: (

       dwMipMapCount: DWORD;          // number of mip-map levels requested

       dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested

       dwReserved: DWORD;             // reserved

       lpSurface: Pointer;              // pointer to the associated surface memory

       ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use

       ddckCKDestBlt: TDDColorKey;          // color key for destination blt use

       ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use

       ddckCKSrcBlt: TDDColorKey;           // color key for source blt use

       ddpfPixelFormat: TDDPixelFormat_DX5; // pixel format description of the surface

       ddsCaps: TDDSCaps;                // direct draw surface capabilities

      );

     1: (

       dwZBufferBitDepth: DWORD;      // depth of Z buffer requested

      );

     2: (

       dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)

      );

    );

end;

 

PDDSurfaceDesc_DX6 = ^TDDSurfaceDesc_DX6;

TDDSurfaceDesc_DX6 = packed record

   dwSize: DWORD;                 // size of the TDDSurfaceDesc structure

   dwFlags: DWORD;                // determines what fields are valid

   dwHeight: DWORD;               // height of surface to be created

   dwWidth: DWORD;                // width of input surface

   case Integer of

   0: (

     dwLinearSize : DWORD;       // unused at the moment

    );

   1: (

     lPitch: LongInt;                 // distance to start of next line (return value only)

     dwBackBufferCount: DWORD;      // number of back buffers requested

     case Integer of

     0: (

       dwMipMapCount: DWORD;          // number of mip-map levels requested

       dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested

       dwReserved: DWORD;             // reserved

       lpSurface: Pointer;              // pointer to the associated surface memory

       ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use

       ddckCKDestBlt: TDDColorKey;          // color key for destination blt use

       ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use

       ddckCKSrcBlt: TDDColorKey;           // color key for source blt use

       ddpfPixelFormat: TDDPixelFormat_DX6; // pixel format description of the surface

       ddsCaps: TDDSCaps;                // direct draw surface capabilities

      );

     1: (

       dwZBufferBitDepth: DWORD;      // depth of Z buffer requested

      );

     2: (

       dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)

      );

    );

end;

 

PDDSurfaceDesc = ^TDDSurfaceDesc;

{$IFDEF DIRECTX5}

TDDSurfaceDesc = TDDSurfaceDesc_DX5;

{$ELSE}

TDDSurfaceDesc = TDDSurfaceDesc_DX6;

{$ENDIF}

 

 

(*

* TDDSurfaceDesc2

*)

PDDSurfaceDesc2 = ^TDDSurfaceDesc2;

TDDSurfaceDesc2 = packed record

   dwSize: DWORD;                 // size of the TDDSurfaceDesc structure

   dwFlags: DWORD;                // determines what fields are valid

   dwHeight: DWORD;               // height of surface to be created

   dwWidth: DWORD;                // width of input surface

   case Integer of

   0: (

     lPitch : LongInt;                  // distance to start of next line (return value only)

    );

   1: (

     dwLinearSize : DWORD;              // Formless late-allocated optimized surface size

     dwBackBufferCount: DWORD;          // number of back buffers requested

     case Integer of

     0: (

       dwMipMapCount: DWORD;            // number of mip-map levels requested

       dwAlphaBitDepth: DWORD;          // depth of alpha buffer requested

       dwReserved: DWORD;               // reserved

       lpSurface: Pointer;              // pointer to the associated surface memory

       ddckCKDestOverlay: TDDColorKey;  // color key for destination overlay use

       ddckCKDestBlt: TDDColorKey;      // color key for destination blt use

       ddckCKSrcOverlay: TDDColorKey;   // color key for source overlay use

       ddckCKSrcBlt: TDDColorKey;       // color key for source blt use

       ddpfPixelFormat: TDDPixelFormat; // pixel format description of the surface

       ddsCaps: TDDSCaps2;              // direct draw surface capabilities

       dwTextureStage: DWORD;           // stage in multitexture cascade

      );

     1: (

       dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)

      );

    );

end;

 

(*

* TDDOptSurfaceDesc

*)

 

PDDOptSurfaceDesc = ^TDDOptSurfaceDesc;

TDDOptSurfaceDesc = packed record

   dwSize : DWORD;             // size of the DDOPTSURFACEDESC structure

   dwFlags : DWORD;            // determines what fields are valid

   ddSCaps : TDDSCaps2;        // Common caps like: Memory type

   ddOSCaps : TDDOSCaps;       // Common caps like: Memory type

   guid : TGUID;               // Compression technique GUID

   dwCompressionRatio : DWORD; // Compression ratio

end;

 

(*

* DDCOLORCONTROL

*)

PDDColorControl = ^TDDColorControl;

TDDColorControl = packed record

   dwSize: DWORD;

   dwFlags: DWORD;

   lBrightness: LongInt;

   lContrast: LongInt;

   lHue: LongInt;

   lSaturation: LongInt;

   lSharpness: LongInt;

   lGamma: LongInt;

   lColorEnable: LongInt;

   dwReserved1: DWORD;

end;

 

(*

* callbacks

*)

 

{$IFNDEF WINNT}

TDDEnumModesCallback = function (const lpDDSurfaceDesc: TDDSurfaceDesc;

     lpContext: Pointer) : HResult; stdcall;

TDDEnumModesCallback2 = function (const lpDDSurfaceDesc: TDDSurfaceDesc2;

     lpContext: Pointer) : HResult; stdcall;

TDDEnumSurfacesCallback = function (lpDDSurface: IDirectDrawSurface;

     const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer) : HResult; stdcall;

TDDEnumSurfacesCallback2 = function (lpDDSurface: IDirectDrawSurface4;

     const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;

TDDEnumSurfacesCallback7 = function (lpDDSurface: IDirectDrawSurface7;

     const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;

{$ENDIF}

 

(*

* INTERACES FOLLOW:

*      IDirectDraw

*      IDirectDrawClipper

*      IDirectDrawPalette

*      IDirectDrawSurface

*)

 

(*

* IDirectDraw

*)

 

IDirectDraw = interface (IUnknown)

   ['{6C14DB80-A733-11CE-A521-0020AF0BE560}']

   (*** IDirectDraw methods ***)

   function Compact: HResult; stdcall;

   function CreateClipper (dwFlags: DWORD;

       out lplpDDClipper: IDirectDrawClipper;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;

       out lplpDDPalette: IDirectDrawPalette;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;

       out lplpDDSurface: IDirectDrawSurface;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function DuplicateSurface (lpDDSurface: IDirectDrawSurface;

       out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;

   function EnumDisplayModes (dwFlags: DWORD;

       lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;

       lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;

   function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc;

       lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :

       HResult; stdcall;

   function FlipToGDISurface: HResult; stdcall;

   function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;

   function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;

   function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;

   function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) :

       HResult; stdcall;

   function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;

   function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;

   function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;

   function Initialize (lpGUID: PGUID) : HResult; stdcall;

   function RestoreDisplayMode: HResult; stdcall;

   function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;

   (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)

   function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD;

       dwBpp: DWORD) : HResult; stdcall;

   function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :

       HResult; stdcall;

end;

 

IDirectDraw2 = interface (IUnknown)

   ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}']

   (*** IDirectDraw methods ***)

   function Compact: HResult; stdcall;

   function CreateClipper (dwFlags: DWORD;

       out lplpDDClipper: IDirectDrawClipper;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;

       out lplpDDPalette: IDirectDrawPalette;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;

       out lplpDDSurface: IDirectDrawSurface;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function DuplicateSurface (lpDDSurface: IDirectDrawSurface;

       out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;

   function EnumDisplayModes (dwFlags: DWORD;

       lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;

       lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;

   function EnumSurfaces (dwFlags: DWORD; var lpDDSD: TDDSurfaceDesc;

       lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :

       HResult; stdcall;

   function FlipToGDISurface: HResult; stdcall;

   function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;

   function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;

   function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;

   function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) : HResult; stdcall;

   function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;

   function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;

   function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;

   function Initialize (lpGUID: PGUID) : HResult; stdcall;

   function RestoreDisplayMode: HResult; stdcall;

   function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;

(*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)

   function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;

       dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;

   function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :

       HResult; stdcall;

   (*** Added in the v2 interface ***)

   function GetAvailableVidMem (var lpDDSCaps: TDDSCaps;

       out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;

end;

 

IDirectDraw4 = interface (IUnknown)

   ['{9c59509a-39bd-11d1-8c4a-00c04fd930c5}']

   (*** IDirectDraw methods ***)

   function Compact: HResult; stdcall;

   function CreateClipper (dwFlags: DWORD;

       out lplpDDClipper: IDirectDrawClipper;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;

       out lplpDDPalette: IDirectDrawPalette;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;

       out lplpDDSurface: IDirectDrawSurface4;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function DuplicateSurface (lpDDSurface: IDirectDrawSurface4;

       out lplpDupDDSurface: IDirectDrawSurface4) : HResult; stdcall;

   function EnumDisplayModes (dwFlags: DWORD;

       lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;

       lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;

   function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;

       lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback2) :

       HResult; stdcall;

   function FlipToGDISurface: HResult; stdcall;

   function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;

   function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;

   function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;

   function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface4) :

       HResult; stdcall;

   function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;

   function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;

   function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;

   function Initialize (lpGUID: PGUID) : HResult; stdcall;

   function RestoreDisplayMode: HResult; stdcall;

   function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;

(*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)

   function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;

       dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;

   function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :

       HResult; stdcall;

   (*** Added in the v2 interface ***)

   function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;

       out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;

   (*** Added in the V4 Interface ***)

   function GetSurfaceFromDC (hdc : Windows.HDC;

       out lpDDS4: IDirectDrawSurface4) : HResult; stdcall;

   function RestoreAllSurfaces : HResult; stdcall;

   function TestCooperativeLevel : HResult; stdcall;

   function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier;

       dwFlags: DWORD) : HResult; stdcall;

end;

 

IDirectDraw7 = interface (IUnknown)

   ['{15e65ec0-3b9c-11d2-b92f-00609797ea5b}']

   (*** IDirectDraw methods ***)

   function Compact: HResult; stdcall;

   function CreateClipper (dwFlags: DWORD;

       out lplpDDClipper: IDirectDrawClipper;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;

       out lplpDDPalette: IDirectDrawPalette;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;

       out lplpDDSurface: IDirectDrawSurface7;

       pUnkOuter: IUnknown) : HResult; stdcall;

   function DuplicateSurface (lpDDSurface: IDirectDrawSurface7;

       out lplpDupDDSurface: IDirectDrawSurface7) : HResult; stdcall;

   function EnumDisplayModes (dwFlags: DWORD;

       lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;

       lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;

   function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;

       lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback7) :

       HResult; stdcall;

   function FlipToGDISurface: HResult; stdcall;

   function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;

   function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;

   function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;

   function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface7) :

       HResult; stdcall;

   function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;

   function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;

   function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;

   function Initialize (lpGUID: PGUID) : HResult; stdcall;

   function RestoreDisplayMode: HResult; stdcall;

   function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;

   function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;

       dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;

   function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :

       HResult; stdcall;

   (*** Added in the v2 interface ***)

   function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;

       out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;

   (*** Added in the V4 Interface ***)

   function GetSurfaceFromDC (hdc : Windows.HDC;

       out lpDDS: IDirectDrawSurface7) : HResult; stdcall;

   function RestoreAllSurfaces : HResult; stdcall;

   function TestCooperativeLevel : HResult; stdcall;

   function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier2;

       dwFlags: DWORD) : HResult; stdcall;

   function StartModeTest(const lpModesToTest; dwNumEntries, dwFlags: DWORD) : HResult; stdcall;

   function EvaluateMode(dwFlags: DWORD; out pSecondsUntilTimeout: DWORD) : HResult; stdcall;

end;

 

 

 

(*

* IDirectDrawPalette

*)

 

IDirectDrawPalette = interface (IUnknown)

   ['{6C14DB84-A733-11CE-A521-0020AF0BE560}']

   (*** IDirectDrawPalette methods ***)

   function GetCaps (out lpdwCaps: DWORD) : HResult; stdcall;

   function GetEntries (dwFlags: DWORD; dwBase: DWORD; dwNumEntries: DWORD;

       lpEntries: pointer) : HResult; stdcall;

   function Initialize (lpDD: IDirectDraw; dwFlags: DWORD;

       lpDDColorTable: pointer) : HResult; stdcall;

   function SetEntries (dwFlags: DWORD; dwStartingEntry: DWORD;

       dwCount: DWORD; lpEntries: pointer) : HResult; stdcall;

end;

 

(*

* IDirectDrawClipper

*)

 

IDirectDrawClipper = interface (IUnknown)

   ['{6C14DB85-A733-11CE-A521-0020AF0BE560}']

   (*** IDirectDrawClipper methods ***)

   function GetClipList (lpRect: PRect; lpClipList: PRgnData;

       var lpdwSize: DWORD) : HResult; stdcall;

   function GetHWnd (out lphWnd: HWND) : HResult; stdcall;

   function Initialize (lpDD: IDirectDraw; dwFlags: DWORD) : HResult; stdcall;

   function IsClipListChanged (out lpbChanged: BOOL) : HResult; stdcall;

   function SetClipList (lpClipList: PRgnData; dwFlags: DWORD) : HResult; stdcall;

   function SetHWnd (dwFlags: DWORD; hWnd: HWND) : HResult; stdcall;

end;

 

(*

* IDirectDrawSurface and related interfaces

*)

 

IDirectDrawSurface = interface (IUnknown)

   ['{6C14DB81-A733-11CE-A521-0020AF0BE560}']

   (*** IDirectDrawSurface methods ***)

   function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface) :

       HResult; stdcall;

   function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;

   function Blt (lpDestRect: PRect;

       lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;

       dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;

   function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;

       dwFlags: DWORD) : HResult; stdcall;

   function BltFast (dwX: DWORD; dwY: DWORD;

       lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;

       dwTrans: DWORD) : HResult; stdcall;

   function DeleteAttachedSurface (dwFlags: DWORD;

       lpDDSAttachedSurface: IDirectDrawSurface) : HResult; stdcall;

   function EnumAttachedSurfaces (lpContext: Pointer;

       lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;

   function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;

       lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;

   function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface;

       dwFlags: DWORD) : HResult; stdcall;

   function GetAttachedSurface (var lpDDSCaps: TDDSCaps;

       (*out*)var lplpDDAttachedSurface: IDirectDrawSurface) : HResult; stdcall;

   function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;

   function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;

   function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;

   function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :

       HResult; stdcall;

   function GetDC (out lphDC: HDC) : HResult; stdcall;

   function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;

   function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;

   function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;

   function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;

   function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;

   function Initialize (lpDD: IDirectDraw;

       out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;

   function IsLost: HResult; stdcall;

   function Lock (lpDestRect: PRect; out lpDDSurfaceDesc:

       TDDSurfaceDesc; dwFlags: DWORD; hEvent: THandle) : HResult; stdcall;

   function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;

   function _Restore: HResult; stdcall;

   function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;

   function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :

       HResult; stdcall;

   function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;

   function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;

   function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;

   function UpdateOverlay (lpSrcRect: PRect;

       lpDDDestSurface: IDirectDrawSurface; lpDestRect: PRect;

       dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;

   function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;

   function UpdateOverlayZOrder (dwFlags: DWORD;

       lpDDSReference: IDirectDrawSurface) : HResult; stdcall;

end;

 

(*

* IDirectDrawSurface2 and related interfaces

*)

 

IDirectDrawSurface2 = interface (IUnknown)

   ['{57805885-6eec-11cf-9441-a82303c10e27}']

   (*** IDirectDrawSurface methods ***)

   function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface2) :

       HResult; stdcall;

   function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;

   function Blt (lpDestRect: PRect;

       lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;

       dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;

   function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;

       dwFlags: DWORD) : HResult; stdcall;

   function BltFast (dwX: DWORD; dwY: DWORD;

       lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;

       dwTrans: DWORD) : HResult; stdcall;

   function DeleteAttachedSurface (dwFlags: DWORD;

       lpDDSAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;

   function EnumAttachedSurfaces (lpContext: Pointer;

       lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;

   function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;

       lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;

   function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface2;

       dwFlags: DWORD) : HResult; stdcall;

   function GetAttachedSurface (var lpDDSCaps: TDDSCaps;

       out lplpDDAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;

   function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;

   function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;

   function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;

   function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :

       HResult; stdcall;

   function GetDC (out lphDC: HDC) : HResult; stdcall;

   function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;

   function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;

   function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;

   function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;

   function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;

   function Initialize (lpDD: IDirectDraw;

       out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;

   function IsLost: HResult; stdcall;

   function Lock (lpDestRect: PRect;

       out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;

       hEvent: THandle) : HResult; stdcall;

   function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;

   function _Restore: HResult; stdcall;

   function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;

   function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :

       HResult; stdcall;

   function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;

   function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;

   function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;

   function UpdateOverlay (lpSrcRect: PRect;

       lpDDDestSurface: IDirectDrawSurface2; lpDestRect: PRect;

       dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;

   function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;

   function UpdateOverlayZOrder (dwFlags: DWORD;

       lpDDSReference: IDirectDrawSurface2) : HResult; stdcall;

   (*** Added in the v2 interface ***)

   function GetDDInterface (var lplpDD: IDirectDraw) : HResult; stdcall;

   function PageLock (dwFlags: DWORD) : HResult; stdcall;

   function PageUnlock (dwFlags: DWORD) : HResult; stdcall;

end;

 

IDirectDrawSurface3 = interface (IUnknown)

   ['{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}']

   (*** IDirectDrawSurface methods ***)

   function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface3) :

       HResult; stdcall;

   function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;

   function Blt (lpDestRect: PRect;

       lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;

       dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;

   function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;

       dwFlags: DWORD) : HResult; stdcall;

   function BltFast (dwX: DWORD; dwY: DWORD;

       lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;

       dwTrans: DWORD) : HResult; stdcall;

   function DeleteAttachedSurface (dwFlags: DWORD;

       lpDDSAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;

   function EnumAttachedSurfaces (lpContext: Pointer;

       lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;

   function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;

       lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;

   function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface3;

       dwFlags: DWORD) : HResult; stdcall;

   function GetAttachedSurface (var lpDDSCaps: TDDSCaps;

       out lplpDDAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;

   function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;

   function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;

   function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;

   function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :

       HResult; stdcall;

   function GetDC (out lphDC: HDC) : HResult; stdcall;

   function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;

   function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;

   function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;

   function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;

   function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;

   function Initialize (lpDD: IDirectDraw;

       out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;

   function IsLost: HResult; stdcall;

   function Lock (lpDestRect: PRect;

       out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;

       hEvent: THandle) : HResult; stdcall;

   function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;

   function _Restore: HResult; stdcall;

   function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;

   function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :

       HResult; stdcall;

   function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;

   function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;

   function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;

   function UpdateOverlay (lpSrcRect: PRect;

       lpDDDestSurface: IDirectDrawSurface3; lpDestRect: PRect;

       dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;

   function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;

   function UpdateOverlayZOrder (dwFlags: DWORD;

       lpDDSReference: IDirectDrawSurface3) : HResult; stdcall;

   (*** Added in the v2 interface ***)

   function GetDDInterface (out lplpDD: IDirectDraw) : HResult; stdcall;

   function PageLock (dwFlags: DWORD) : HResult; stdcall;

   function PageUnlock (dwFlags: DWORD) : HResult; stdcall;

   (*** Added in the V3 interface ***)

   function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc; dwFlags: DWORD) : HResult; stdcall;

end;

 

(*

* IDirectDrawSurface4 and related interfaces

*)

IDirectDrawSurface4 = interface (IUnknown)

   ['{0B2B8630-AD35-11D0-8EA6-00609797EA5B}']

   (*** IDirectDrawSurface methods ***)

   function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface4) :

       HResult; stdcall;

   function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;

   function Blt (lpDestRect: PRect;

       lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;

       dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;

   function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;

       dwFlags: DWORD) : HResult; stdcall;

   function BltFast (dwX: DWORD; dwY: DWORD;

       lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;

       dwTrans: DWORD) : HResult; stdcall;

   function DeleteAttachedSurface (dwFlags: DWORD;

       lpDDSAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;

   function EnumAttachedSurfaces (lpContext: Pointer;

       lpEnumSurfacesCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;

   function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;

       lpfnCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;

   function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface4;

       dwFlags: DWORD) : HResult; stdcall;

   function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;

       out lplpDDAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;

   function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;

   function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;

   function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;

   function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :

       HResult; stdcall;

   function GetDC (out lphDC: HDC) : HResult; stdcall;

   function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;

   function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;

   function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;

   function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;

   function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;

   function Initialize (lpDD: IDirectDraw;

       out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;

   function IsLost: HResult; stdcall;

   function Lock (lpDestRect: PRect;

       out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;

       hEvent: THandle) : HResult; stdcall;

   function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;

   function _Restore: HResult; stdcall;

   function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;

   function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :

       HResult; stdcall;

   function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;

   function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;

   function Unlock (lpRect: PRect) : HResult; stdcall;

   function UpdateOverlay (lpSrcRect: PRect;

       lpDDDestSurface: IDirectDrawSurface4; lpDestRect: PRect;

       dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;

   function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;

   function UpdateOverlayZOrder (dwFlags: DWORD;

       lpDDSReference: IDirectDrawSurface4) : HResult; stdcall;

   (*** Added in the v2 interface ***)

   function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;

   function PageLock (dwFlags: DWORD) : HResult; stdcall;

   function PageUnlock (dwFlags: DWORD) : HResult; stdcall;

   (*** Added in the V3 interface ***)

   function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;

   (*** Added in the v4 interface ***)

   function SetPrivateData(const guidTag: TGUID; lpData: pointer;

       cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;

   function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;

       var lpcbBufferSize: DWORD) : HResult; stdcall;

   function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;

   function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;

   function ChangeUniquenessValue : HResult; stdcall;

end;

 

IDirectDrawSurface7 = interface (IUnknown)

   ['{06675a80-3b9b-11d2-b92f-00609797ea5b}']

   (*** IDirectDrawSurface methods ***)

   function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface7) :

       HResult; stdcall;

   function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;

   function Blt (lpDestRect: PRect;

       lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;

       dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;

   function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;

       dwFlags: DWORD) : HResult; stdcall;

   function BltFast (dwX: DWORD; dwY: DWORD;

       lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;

       dwTrans: DWORD) : HResult; stdcall;

   function DeleteAttachedSurface (dwFlags: DWORD;

       lpDDSAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;

   function EnumAttachedSurfaces (lpContext: Pointer;

       lpEnumSurfacesCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;

   function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;

       lpfnCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;

   function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface7;

       dwFlags: DWORD) : HResult; stdcall;

   function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;

       out lplpDDAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;

   function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;

   function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;

   function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;

   function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :

       HResult; stdcall;

   function GetDC (out lphDC: HDC) : HResult; stdcall;

   function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;

   function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;

   function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;

   function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;

   function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;

   function Initialize (lpDD: IDirectDraw;

       out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;

   function IsLost: HResult; stdcall;

   function Lock (lpDestRect: PRect;

       out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;

       hEvent: THandle) : HResult; stdcall;

   function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;

   function _Restore: HResult; stdcall;

   function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;

   function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :

       HResult; stdcall;

   function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;

   function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;

   function Unlock (lpRect: PRect) : HResult; stdcall;

   function UpdateOverlay (lpSrcRect: PRect;

       lpDDDestSurface: IDirectDrawSurface7; lpDestRect: PRect;

       dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;

   function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;

   function UpdateOverlayZOrder (dwFlags: DWORD;

       lpDDSReference: IDirectDrawSurface7) : HResult; stdcall;

   (*** Added in the v2 interface ***)

   function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;

   function PageLock (dwFlags: DWORD) : HResult; stdcall;

   function PageUnlock (dwFlags: DWORD) : HResult; stdcall;

   (*** Added in the V3 interface ***)

   function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;

   (*** Added in the v4 interface ***)

   function SetPrivateData(const guidTag: TGUID; lpData: pointer;

       cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;

   function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;

       var lpcbBufferSize: DWORD) : HResult; stdcall;

   function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;

   function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;

   function ChangeUniquenessValue : HResult; stdcall;

   (*** Moved Texture7 methods here ***)

   function SetPriority(dwPriority: DWORD) : HResult; stdcall;

   function GetPriority(out lpdwPriority: DWORD) : HResult; stdcall;

   function SetLOD(dwMaxLOD: DWORD) : HResult; stdcall;

   function GetLOD(out lpdwMaxLOD: DWORD) : HResult; stdcall;

end;

 

IDirectDrawColorControl = interface (IUnknown)

   ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}']

   function GetColorControls(out lpColorControl: TDDColorControl) : HResult; stdcall;

   function SetColorControls(const lpColorControl: TDDColorControl) : HResult; stdcall;

end;

 

(*

* IDirectDrawGammaControl

*)

IDirectDrawGammaControl = interface (IUnknown)

   ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}']

   function GetGammaRamp (dwFlags: DWORD; out lpRampData: TDDGammaRamp)

       : HResult; stdcall;

   function SetGammaRamp (dwFlags: DWORD; const lpRampData: TDDGammaRamp)

       : HResult; stdcall;

end;

 

type

IID_IDirectDraw = IDirectDraw;

IID_IDirectDraw2 = IDirectDraw2;

IID_IDirectDraw4 = IDirectDraw4;

IID_IDirectDraw7 = IDirectDraw7;

IID_IDirectDrawSurface = IDirectDrawSurface;

IID_IDirectDrawSurface2 = IDirectDrawSurface2;

IID_IDirectDrawSurface3 = IDirectDrawSurface3;

IID_IDirectDrawSurface4 = IDirectDrawSurface4;

IID_IDirectDrawSurface7 = IDirectDrawSurface7;

 

IID_IDirectDrawPalette = IDirectDrawPalette;

IID_IDirectDrawClipper = IDirectDrawClipper;

IID_IDirectDrawColorControl = IDirectDrawColorControl;

IID_IDirectDrawGammaControl = IDirectDrawGammaControl;

 

const

(*

* ddsCaps field is valid.

*)

DDSD_CAPS               = $00000001;     // default

 

(*

* dwHeight field is valid.

*)

DDSD_HEIGHT             = $00000002;

 

(*

* dwWidth field is valid.

*)

DDSD_WIDTH              = $00000004;

 

(*

* lPitch is valid.

*)

DDSD_PITCH              = $00000008;

 

(*

* dwBackBufferCount is valid.

*)

DDSD_BACKBUFFERCOUNT    = $00000020;

 

(*

* dwZBufferBitDepth is valid.  (shouldnt be used in DDSURFACEDESC2)

*)

DDSD_ZBUFFERBITDEPTH    = $00000040;

 

(*

* dwAlphaBitDepth is valid.

*)

  DDSD_ALPHABITDEPTH      = $00000080;

 

(*

* lpSurface is valid.

*)

DDSD_LPSURFACE           = $00000800;

 

(*

* ddpfPixelFormat is valid.

*)

DDSD_PIXELFORMAT        = $00001000;

 

(*

* ddckCKDestOverlay is valid.

*)

DDSD_CKDESTOVERLAY      = $00002000;

 

(*

* ddckCKDestBlt is valid.

*)

DDSD_CKDESTBLT          = $00004000;

 

(*

* ddckCKSrcOverlay is valid.

*)

DDSD_CKSRCOVERLAY       = $00008000;

 

(*

* ddckCKSrcBlt is valid.

*)

DDSD_CKSRCBLT           = $00010000;

 

(*

* dwMipMapCount is valid.

*)

DDSD_MIPMAPCOUNT        = $00020000;

 

(*

* dwRefreshRate is valid

*)

DDSD_REFRESHRATE        = $00040000;

 

(*

* dwLinearSize is valid

*)

DDSD_LINEARSIZE         = $00080000;

 

(*

* dwTextureStage is valid

*)

DDSD_TEXTURESTAGE       = $00100000;

 

(*

* All input fields are valid.

*)

DDSD_ALL                 = $001ff9ee;

 

 

(*

* guid field is valid.

*)

DDOSD_GUID                  = $00000001;

 

(*

* dwCompressionRatio field is valid.

*)

DDOSD_COMPRESSION_RATIO     = $00000002;

 

(*

* ddSCaps field is valid.

*)

DDOSD_SCAPS                 = $00000004;

 

(*

* ddOSCaps field is valid.

*)

DDOSD_OSCAPS                = $00000008;

 

(*

* All input fields are valid.

*)

DDOSD_ALL                   = $0000000f;

 

(*

* The surface's optimized pixelformat is compressed

*)

DDOSDCAPS_OPTCOMPRESSED                        = $00000001;

 

(*

* The surface's optimized pixelformat is reordered

*)

DDOSDCAPS_OPTREORDERED                        = $00000002;

 

(*

* The opt surface is a monolithic mipmap

*)

DDOSDCAPS_MONOLITHICMIPMAP                = $00000004;

 

(*

* The valid Surf caps:

*   DDSCAPS_SYSTEMMEMORY         = $00000800;

*   DDSCAPS_VIDEOMEMORY        = $00004000;

*   DDSCAPS_LOCALVIDMEM        = $10000000;

*   DDSCAPS_NONLOCALVIDMEM     = $20000000;

*)

DDOSDCAPS_VALIDSCAPS                = $30004800;

 

(*

* The valid OptSurf caps

*)

DDOSDCAPS_VALIDOSCAPS                = $00000007;

 

 

(*

* DDCOLORCONTROL

*)

 

(*

* lBrightness field is valid.

*)

DDCOLOR_BRIGHTNESS                = $00000001;

 

(*

* lContrast field is valid.

*)

DDCOLOR_CONTRAST                = $00000002;

 

(*

* lHue field is valid.

*)

DDCOLOR_HUE                        = $00000004;

 

(*

* lSaturation field is valid.

*)

DDCOLOR_SATURATION                = $00000008;

 

(*

* lSharpness field is valid.

*)

DDCOLOR_SHARPNESS                = $00000010;

 

(*

* lGamma field is valid.

*)

DDCOLOR_GAMMA                        = $00000020;

 

(*

* lColorEnable field is valid.

*)

DDCOLOR_COLORENABLE                = $00000040;

 

 

 

(*============================================================================

*

* Direct Draw Capability Flags

*

* These flags are used to describe the capabilities of a given Surface.

* All flags are bit flags.

*

*==========================================================================*)

 

(****************************************************************************

*

* DIRECTDRAWSURFACE CAPABILITY FLAGS

*

****************************************************************************)

(*

* This bit currently has no meaning.

*)

DDSCAPS_RESERVED1                       = $00000001;

 

(*

* Indicates that this surface contains alpha-only information.

* (To determine if a surface is RGBA/YUVA, the pixel format must be

* interrogated.)

*)

DDSCAPS_ALPHA                           = $00000002;

 

(*

* Indicates that this surface is a backbuffer.  It is generally

* set by CreateSurface when the DDSCAPS_FLIP capability bit is set.

* It indicates that this surface is THE back buffer of a surface

* flipping structure.  DirectDraw supports N surfaces in a

* surface flipping structure.  Only the surface that immediately

* precedeces the DDSCAPS_FRONTBUFFER has this capability bit set.

* The other surfaces are identified as back buffers by the presence

* of the DDSCAPS_FLIP capability, their attachment order, and the

* absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER

* capabilities.  The bit is sent to CreateSurface when a standalone

* back buffer is being created.  This surface could be attached to

* a front buffer and/or back buffers to form a flipping surface

* structure after the CreateSurface call.  See AddAttachments for

* a detailed description of the behaviors in this case.

*)

DDSCAPS_BACKBUFFER                      = $00000004;

 

(*

* Indicates a complex surface structure is being described.  A

* complex surface structure results in the creation of more than

* one surface.  The additional surfaces are attached to the root

* surface.  The complex structure can only be destroyed by

* destroying the root.

*)

DDSCAPS_COMPLEX                         = $00000008;

 

(*

* Indicates that this surface is a part of a surface flipping structure.

* When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and

* DDSCAP_BACKBUFFER bits are not set.  They are set by CreateSurface

* on the resulting creations.  The dwBackBufferCount field in the

* TDDSurfaceDesc structure must be set to at least 1 in order for

* the CreateSurface call to succeed.  The DDSCAPS_COMPLEX capability

* must always be set with creating multiple surfaces through CreateSurface.

*)

DDSCAPS_FLIP                            = $00000010;

 

(*

* Indicates that this surface is THE front buffer of a surface flipping

* structure.  It is generally set by CreateSurface when the DDSCAPS_FLIP

* capability bit is set.

* If this capability is sent to CreateSurface then a standalonw front buffer

* is created.  This surface will not have the DDSCAPS_FLIP capability.

* It can be attached to other back buffers to form a flipping structure.

* See AddAttachments for a detailed description of the behaviors in this

* case.

*)

DDSCAPS_FRONTBUFFER                     = $00000020;

 

(*

* Indicates that this surface is any offscreen surface that is not an overlay,

* texture, zbuffer, front buffer, back buffer, or alpha surface.  It is used

* to identify plain vanilla surfaces.

*)

DDSCAPS_OFFSCREENPLAIN                  = $00000040;

 

(*

* Indicates that this surface is an overlay.  It may or may not be directly visible

* depending on whether or not it is currently being overlayed onto the primary

* surface.  DDSCAPS_VISIBLE can be used to determine whether or not it is being

* overlayed at the moment.

*)

DDSCAPS_OVERLAY                         = $00000080;

 

(*

* Indicates that unique DirectDrawPalette objects can be created and

* attached to this surface.

*)

DDSCAPS_PALETTE                         = $00000100;

 

(*

* Indicates that this surface is the primary surface.  The primary

* surface represents what the user is seeing at the moment.

*)

DDSCAPS_PRIMARYSURFACE                  = $00000200;

 

(*

* This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now

* obsolete.

*)

DDSCAPS_RESERVED3              = $00000400;

(*

* Indicates that this surface is the primary surface for the left eye.

* The primary surface for the left eye represents what the user is seeing

* at the moment with the users left eye.  When this surface is created the

* DDSCAPS_PRIMARYSURFACE represents what the user is seeing with the users

* right eye.

*)

DDSCAPS_PRIMARYSURFACELEFT = DDSCAPS_RESERVED3;

 

(*

* Indicates that this surface memory was allocated in system memory

*)

DDSCAPS_SYSTEMMEMORY                    = $00000800;

 

(*

* Indicates that this surface can be used as a 3D texture.  It does not

* indicate whether or not the surface is being used for that purpose.

*)

DDSCAPS_TEXTURE                         = $00001000;

 

(*

* Indicates that a surface may be a destination for 3D rendering.  This

* bit must be set in order to query for a Direct3D Device Interface

* from this surface.

*)

DDSCAPS_3DDEVICE                        = $00002000;

 

(*

* Indicates that this surface exists in video memory.

*)

DDSCAPS_VIDEOMEMORY                     = $00004000;

 

(*

* Indicates that changes made to this surface are immediately visible.

* It is always set for the primary surface and is set for overlays while

* they are being overlayed and texture maps while they are being textured.

*)

DDSCAPS_VISIBLE                         = $00008000;

 

(*

* Indicates that only writes are permitted to the surface.  Read accesses

* from the surface may or may not generate a protection fault, but the

* results of a read from this surface will not be meaningful.  READ ONLY.

*)

DDSCAPS_WRITEONLY                       = $00010000;

 

(*

* Indicates that this surface is a z buffer. A z buffer does not contain

* displayable information.  Instead it contains bit depth information that is

* used to determine which pixels are visible and which are obscured.

*)

DDSCAPS_ZBUFFER                         = $00020000;

 

(*

* Indicates surface will have a DC associated long term

*)

DDSCAPS_OWNDC                           = $00040000;

 

(*

* Indicates surface should be able to receive live video

*)

DDSCAPS_LIVEVIDEO                       = $00080000;

 

(*

* Indicates surface should be able to have a stream decompressed

* to it by the hardware.

*)

DDSCAPS_HWCODEC                         = $00100000;

 

(*

* Surface is a ModeX surface.

*

*)

DDSCAPS_MODEX                           = $00200000;

 

(*

* Indicates surface is one level of a mip-map. This surface will

* be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map.

* This can be done explicitly, by creating a number of surfaces and

* attaching them with AddAttachedSurface or by implicitly by CreateSurface.

* If this bit is set then DDSCAPS_TEXTURE must also be set.

*)

DDSCAPS_MIPMAP                          = $00400000;

 

(*

* This bit is reserved. It should not be specified.

*)

DDSCAPS_RESERVED2                       = $00800000;

 

(*

* Indicates that memory for the surface is not allocated until the surface

* is loaded (via the Direct3D texture Load() function).

*)

DDSCAPS_ALLOCONLOAD                     = $04000000;

 

(*

* Indicates that the surface will recieve data from a video port.

*)

DDSCAPS_VIDEOPORT                          = $08000000;

 

(*

* Indicates that a video memory surface is resident in true, local video

* memory rather than non-local video memory. If this flag is specified then

* so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with

* DDSCAPS_NONLOCALVIDMEM.

*)

DDSCAPS_LOCALVIDMEM                     = $10000000;

 

(*

* Indicates that a video memory surface is resident in non-local video

* memory rather than true, local video memory. If this flag is specified

* then so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with

* DDSCAPS_LOCALVIDMEM.

*)

DDSCAPS_NONLOCALVIDMEM                  = $20000000;

 

(*

* Indicates that this surface is a standard VGA mode surface, and not a

* ModeX surface. (This flag will never be set in combination with the

* DDSCAPS_MODEX flag).

*)

DDSCAPS_STANDARDVGAMODE                 = $40000000;

 

(*

* Indicates that this surface will be an optimized surface. This flag is

* currently only valid in conjunction with the DDSCAPS_TEXTURE flag. The surface

* will be created without any underlying video memory until loaded.

*)

DDSCAPS_OPTIMIZED                       = $80000000;

 

 

 

(*

* Indicates that this surface will receive data from a video port using

* the de-interlacing hardware.  This allows the driver to allocate memory

* for any extra buffers that may be required.  The DDSCAPS_VIDEOPORT and

* DDSCAPS_OVERLAY flags must also be set.

*)

DDSCAPS2_HARDWAREDEINTERLACE            = $00000002;

 

(*

* Indicates to the driver that this surface will be locked very frequently

* (for procedural textures, dynamic lightmaps, etc). Surfaces with this cap

* set must also have DDSCAPS_TEXTURE. This cap cannot be used with

* DDSCAPS2_HINTSTATIC and DDSCAPS2_OPAQUE.

*)

DDSCAPS2_HINTDYNAMIC                        = $00000004;

 

(*

* Indicates to the driver that this surface can be re-ordered/retiled on

* load. This operation will not change the size of the texture. It is

* relatively fast and symmetrical, since the application may lock these

* bits (although it will take a performance hit when doing so). Surfaces

* with this cap set must also have DDSCAPS_TEXTURE. This cap cannot be

* used with DDSCAPS2_HINTDYNAMIC and DDSCAPS2_OPAQUE.

*)

DDSCAPS2_HINTSTATIC                        = $00000008;

 

(*

* Indicates that the client would like this texture surface to be managed by the

* DirectDraw/Direct3D runtime. Surfaces with this cap set must also have

* DDSCAPS_TEXTURE and DDSCAPS_SYSTEMMEMORY.

*)

DDSCAPS2_TEXTUREMANAGE                  = $00000010;

 

(*

* These bits are reserved for internal use *)

DDSCAPS2_RESERVED1                      = $00000020;

DDSCAPS2_RESERVED2                      = $00000040;

 

(*

* Indicates to the driver that this surface will never be locked again.

* The driver is free to optimize this surface via retiling and actual compression.

* All calls to Lock() or Blts from this surface will fail. Surfaces with this

* cap set must also have DDSCAPS_TEXTURE. This cap cannot be used with

* DDSCAPS2_HINTDYNAMIC and DDSCAPS2_HINTSTATIC.

*)

DDSCAPS2_OPAQUE                         = $00000080;

 

(*

* Applications should set this bit at CreateSurface time to indicate that they

* intend to use antialiasing. Only valid if DDSCAPS_3DDEVICE is also set.

*)

DDSCAPS2_HINTANTIALIASING               = $00000100;

 

(*

* This flag is used at CreateSurface time to indicate that this set of

* surfaces is a cubic environment map

*)

DDSCAPS2_CUBEMAP                        = $00000200;

 

(*

* These flags preform two functions:

* - At CreateSurface time, they define which of the six cube faces are

*   required by the application.

* - After creation, each face in the cubemap will have exactly one of these

*   bits set.

*)

DDSCAPS2_CUBEMAP_POSITIVEX              = $00000400;

DDSCAPS2_CUBEMAP_NEGATIVEX              = $00000800;

DDSCAPS2_CUBEMAP_POSITIVEY              = $00001000;

DDSCAPS2_CUBEMAP_NEGATIVEY              = $00002000;

DDSCAPS2_CUBEMAP_POSITIVEZ              = $00004000;

DDSCAPS2_CUBEMAP_NEGATIVEZ              = $00008000;

 

(*

* This macro may be used to specify all faces of a cube map at CreateSurface time

*)

DDSCAPS2_CUBEMAP_ALLFACES = ( DDSCAPS2_CUBEMAP_POSITIVEX or

                               DDSCAPS2_CUBEMAP_NEGATIVEX or

                               DDSCAPS2_CUBEMAP_POSITIVEY or

                               DDSCAPS2_CUBEMAP_NEGATIVEY or

                               DDSCAPS2_CUBEMAP_POSITIVEZ or

                               DDSCAPS2_CUBEMAP_NEGATIVEZ );

 

 

(*

* This flag is an additional flag which is present on mipmap sublevels from DX7 onwards

* It enables easier use of GetAttachedSurface rather than EnumAttachedSurfaces for surface

* constructs such as Cube Maps, wherein there are more than one mipmap surface attached

* to the root surface.

* This caps bit is ignored by CreateSurface

*)

DDSCAPS2_MIPMAPSUBLEVEL                 = $00010000;

 

(* This flag indicates that the texture should be managed by D3D only *)

DDSCAPS2_D3DTEXTUREMANAGE               = $00020000;

 

(* This flag indicates that the managed surface can be safely lost *)

DDSCAPS2_DONOTPERSIST                   = $00040000;

 

(* indicates that this surface is part of a stereo flipping chain *)

DDSCAPS2_STEREOSURFACELEFT              = $00080000;

 

 

 

(****************************************************************************

*

* DIRECTDRAW DRIVER CAPABILITY FLAGS

*

****************************************************************************)

 

(*

* Display hardware has 3D acceleration.

*)

DDCAPS_3D                       = $00000001;

 

(*

* Indicates that DirectDraw will support only dest rectangles that are aligned

* on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively.

* READ ONLY.

*)

DDCAPS_ALIGNBOUNDARYDEST        = $00000002;

 

(*

* Indicates that DirectDraw will support only source rectangles  whose sizes in

* BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively.  READ ONLY.

*)

DDCAPS_ALIGNSIZEDEST            = $00000004;

(*

* Indicates that DirectDraw will support only source rectangles that are aligned

* on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively.

* READ ONLY.

*)

DDCAPS_ALIGNBOUNDARYSRC         = $00000008;

 

(*

* Indicates that DirectDraw will support only source rectangles  whose sizes in

* BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively.  READ ONLY.

*)

DDCAPS_ALIGNSIZESRC             = $00000010;

 

(*

* Indicates that DirectDraw will create video memory surfaces that have a stride

* alignment equal to DIRECTDRAWCAPS.dwAlignStride.  READ ONLY.

*)

DDCAPS_ALIGNSTRIDE              = $00000020;

 

(*

* Display hardware is capable of blt operations.

*)

DDCAPS_BLT                      = $00000040;

 

(*

* Display hardware is capable of asynchronous blt operations.

*)

DDCAPS_BLTQUEUE                 = $00000080;

 

(*

* Display hardware is capable of color space conversions during the blt operation.

*)

DDCAPS_BLTFOURCC                = $00000100;

 

(*

* Display hardware is capable of stretching during blt operations.

*)

DDCAPS_BLTSTRETCH               = $00000200;

 

(*

* Display hardware is shared with GDI.

*)

DDCAPS_GDI                      = $00000400;

 

(*

* Display hardware can overlay.

*)

DDCAPS_OVERLAY                  = $00000800;

 

(*

* Set if display hardware supports overlays but can not clip them.

*)

DDCAPS_OVERLAYCANTCLIP          = $00001000;

 

(*

* Indicates that overlay hardware is capable of color space conversions during

* the overlay operation.

*)

DDCAPS_OVERLAYFOURCC            = $00002000;

 

(*

* Indicates that stretching can be done by the overlay hardware.

*)

DDCAPS_OVERLAYSTRETCH           = $00004000;

 

(*

* Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces

* other than the primary surface.

*)

DDCAPS_PALETTE                  = $00008000;

 

(*

* Indicates that palette changes can be syncd with the veritcal refresh.

*)

DDCAPS_PALETTEVSYNC             = $00010000;

 

(*

* Display hardware can return the current scan line.

*)

DDCAPS_READSCANLINE             = $00020000;

 

(*

* Display hardware has stereo vision capabilities.  DDSCAPS_PRIMARYSURFACELEFT

* can be created.

*)

DDCAPS_STEREOVIEW               = $00040000;

 

(*

* Display hardware is capable of generating a vertical blank interrupt.

*)

DDCAPS_VBI                      = $00080000;

 

(*

* Supports the use of z buffers with blt operations.

*)

DDCAPS_ZBLTS                    = $00100000;

 

(*

* Supports Z Ordering of overlays.

*)

DDCAPS_ZOVERLAYS                = $00200000;

 

(*

* Supports color key

*)

DDCAPS_COLORKEY                 = $00400000;

 

(*

* Supports alpha surfaces

*)

DDCAPS_ALPHA                    = $00800000;

 

(*

* colorkey is hardware assisted(DDCAPS_COLORKEY will also be set)

*)

DDCAPS_COLORKEYHWASSIST         = $01000000;

 

(*

* no hardware support at all

*)

DDCAPS_NOHARDWARE               = $02000000;

 

(*

* Display hardware is capable of color fill with bltter

*)

DDCAPS_BLTCOLORFILL             = $04000000;

 

(*

* Display hardware is bank switched, and potentially very slow at

* random access to VRAM.

*)

DDCAPS_BANKSWITCHED             = $08000000;

 

(*

* Display hardware is capable of depth filling Z-buffers with bltter

*)

DDCAPS_BLTDEPTHFILL             = $10000000;

 

(*

* Display hardware is capable of clipping while bltting.

*)

DDCAPS_CANCLIP                  = $20000000;

 

(*

* Display hardware is capable of clipping while stretch bltting.

*)

DDCAPS_CANCLIPSTRETCHED         = $40000000;

 

(*

* Display hardware is capable of bltting to or from system memory

*)

DDCAPS_CANBLTSYSMEM             = $80000000;

 

 

(****************************************************************************

*

* MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2)

*

****************************************************************************)

 

(*

* Display hardware is certified

*)

DDCAPS2_CERTIFIED               = $00000001;

 

(*

* Driver cannot interleave 2D operations (lock and blt) to surfaces with

* Direct3D rendering operations between calls to BeginScene() and EndScene()

*)

DDCAPS2_NO2DDURING3DSCENE       = $00000002;

 

(*

* Display hardware contains a video port

*)

DDCAPS2_VIDEOPORT                  = $00000004;

 

(*

* The overlay can be automatically flipped according to the video port

* VSYNCs, providing automatic doubled buffered display of video port

* data using an overlay

*)

DDCAPS2_AUTOFLIPOVERLAY         = $00000008;

 

(*

* Overlay can display each field of interlaced data individually while

* it is interleaved in memory without causing jittery artifacts.

*)

DDCAPS2_CANBOBINTERLEAVED        = $00000010;

 

(*

* Overlay can display each field of interlaced data individually while

* it is not interleaved in memory without causing jittery artifacts.

*)

DDCAPS2_CANBOBNONINTERLEAVED        = $00000020;

 

(*

* The overlay surface contains color controls (brightness, sharpness, etc.)

*)

DDCAPS2_COLORCONTROLOVERLAY        = $00000040;

 

(*

* The primary surface contains color controls (gamma, etc.)

*)

DDCAPS2_COLORCONTROLPRIMARY        = $00000080;

 

(*

* RGBZ -> RGB supported for 16:16 RGB:Z

*)

DDCAPS2_CANDROPZ16BIT                = $00000100;

 

(*

* Driver supports non-local video memory.

*)

DDCAPS2_NONLOCALVIDMEM          = $00000200;

 

(*

* Dirver supports non-local video memory but has different capabilities for

* non-local video memory surfaces. If this bit is set then so must

* DDCAPS2_NONLOCALVIDMEM.

*)

DDCAPS2_NONLOCALVIDMEMCAPS      = $00000400;

 

(*

* Driver neither requires nor prefers surfaces to be pagelocked when performing

* blts involving system memory surfaces

*)

DDCAPS2_NOPAGELOCKREQUIRED      = $00000800;

 

(*

* Driver can create surfaces which are wider than the primary surface

*)

DDCAPS2_WIDESURFACES            = $00001000;

 

(*

* Driver supports bob without using a video port by handling the

* DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip.

*)

DDCAPS2_CANFLIPODDEVEN          = $00002000;

 

(*

* Driver supports bob using hardware

*)

DDCAPS2_CANBOBHARDWARE          = $00004000;

 

(*

* Driver supports bltting any FOURCC surface to another surface of the same FOURCC

*)

DDCAPS2_COPYFOURCC              = $00008000;

 

 

(*

* Driver supports loadable gamma ramps for the primary surface

*)

DDCAPS2_PRIMARYGAMMA            = $00020000;

 

(*

* Driver can render in windowed mode.

*)

DDCAPS2_CANRENDERWINDOWED       = $00080000;

 

(*

* A calibrator is available to adjust the gamma ramp according to the

* physical display properties so that the result will be identical on

* all calibrated systems.

*)

DDCAPS2_CANCALIBRATEGAMMA       = $00100000;

 

(*

* Indicates that the driver will respond to DDFLIP_INTERVALn flags

*)

DDCAPS2_FLIPINTERVAL            = $00200000;

 

(*

* Indicates that the driver will respond to DDFLIP_NOVSYNC

*)

  DDCAPS2_FLIPNOVSYNC             = $00400000;

 

(*

* Driver supports management of video memory, if this flag is ON,

* driver manages the texture if requested with DDSCAPS2_TEXTUREMANAGE on

* DirectX manages the texture if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on

*)

DDCAPS2_CANMANAGETEXTURE        = $00800000;

 

(*

* The Direct3D texture manager uses this cap to decide whether to put managed

* surfaces in non-local video memory. If the cap is set, the texture manager will

* put managed surfaces in non-local vidmem. Drivers that cannot texture from

* local vidmem SHOULD NOT set this cap.

*)

DDCAPS2_TEXMANINNONLOCALVIDMEM  = $01000000;

 

(*

* Indicates that the driver supports DX7 type of stereo in at least one mode (which may

* not necessarily be the current mode). Applications should use IDirectDraw7 (or higher)

* ::EnumDisplayModes and check the DDSURFACEDESC.ddsCaps.dwCaps2 field for the presence of

* DDSCAPS2_STEREOSURFACELEFT to check if a particular mode supports stereo. The application

* can also use IDirectDraw7(or higher)::GetDisplayMode to check the current mode.

*)

DDCAPS2_STEREO                  = $02000000;

 

(*

* This caps bit is intended for internal DirectDraw use.

* -It is only valid if DDCAPS2_NONLOCALVIDMEMCAPS is set.

* -If this bit is set, then DDCAPS_CANBLTSYSMEM MUST be set by the driver (and

*  all the assoicated system memory blt caps must be correct).

* -It implies that the system->video blt caps in DDCAPS also apply to system to

*  nonlocal blts. I.e. the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops

*  members of DDCAPS (DDCORECAPS) are filled in correctly.

* -Any blt from system to nonlocal memory that matches these caps bits will

*  be passed to the driver.

*

* NOTE: This is intended to enable the driver itself to do efficient reordering

* of textures. This is NOT meant to imply that hardware can write into AGP memory.

* This operation is not currently supported.

*)

DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL   = $04000000;

 

(****************************************************************************

*

* DIRECTDRAW FX ALPHA CAPABILITY FLAGS

*

****************************************************************************)

 

(*

* Supports alpha blending around the edge of a source color keyed surface.

* For Blt.

*)

DDFXALPHACAPS_BLTALPHAEDGEBLEND         = $00000001;

 

(*

* Supports alpha information in the pixel format.  The bit depth of alpha

* information in the pixel format can be 1,2,4, or 8.  The alpha value becomes

* more opaque as the alpha value increases.  (0 is transparent.)

* For Blt.

*)

DDFXALPHACAPS_BLTALPHAPIXELS            = $00000002;

 

(*

* Supports alpha information in the pixel format.  The bit depth of alpha

* information in the pixel format can be 1,2,4, or 8.  The alpha value

* becomes more transparent as the alpha value increases.  (0 is opaque.)

* This flag can only be set if DDCAPS_ALPHA is set.

* For Blt.

*)

DDFXALPHACAPS_BLTALPHAPIXELSNEG         = $00000004;

 

(*

* Supports alpha only surfaces.  The bit depth of an alpha only surface can be

* 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.

* (0 is transparent.)

* For Blt.

*)

DDFXALPHACAPS_BLTALPHASURFACES          = $00000008;

 

(*

* The depth of the alpha channel data can range can be 1,2,4, or 8.

* The NEG suffix indicates that this alpha channel becomes more transparent

* as the alpha value increases. (0 is opaque.)  This flag can only be set if

* DDCAPS_ALPHA is set.

* For Blt.

*)

DDFXALPHACAPS_BLTALPHASURFACESNEG       = $00000010;

 

(*

* Supports alpha blending around the edge of a source color keyed surface.

* For Overlays.

*)

DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND     = $00000020;

 

(*

* Supports alpha information in the pixel format.  The bit depth of alpha

* information in the pixel format can be 1,2,4, or 8.  The alpha value becomes

* more opaque as the alpha value increases.  (0 is transparent.)

* For Overlays.

*)

DDFXALPHACAPS_OVERLAYALPHAPIXELS        = $00000040;

 

(*

* Supports alpha information in the pixel format.  The bit depth of alpha

* information in the pixel format can be 1,2,4, or 8.  The alpha value

* becomes more transparent as the alpha value increases.  (0 is opaque.)

* This flag can only be set if DDCAPS_ALPHA is set.

* For Overlays.

*)

DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG     = $00000080;

 

(*

* Supports alpha only surfaces.  The bit depth of an alpha only surface can be

* 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.

* (0 is transparent.)

* For Overlays.

*)

DDFXALPHACAPS_OVERLAYALPHASURFACES      = $00000100;

 

(*

* The depth of the alpha channel data can range can be 1,2,4, or 8

* The NEG suffix indicates that this alpha channel becomes more transparent

* as the alpha value increases. (0 is opaque.)  This flag can only be set if

* DDCAPS_ALPHA is set.

* For Overlays.

*)

DDFXALPHACAPS_OVERLAYALPHASURFACESNEG   = $00000200;

 

(****************************************************************************

*

* DIRECTDRAW FX CAPABILITY FLAGS

*

****************************************************************************)

 

(*

* Uses arithmetic operations to stretch and shrink surfaces during blt

* rather than pixel doubling techniques.  Along the Y axis.

*)

DDFXCAPS_BLTARITHSTRETCHY       = $00000020;

 

(*

* Uses arithmetic operations to stretch during blt

* rather than pixel doubling techniques.  Along the Y axis. Only

* works for x1, x2, etc.

*)

DDFXCAPS_BLTARITHSTRETCHYN      = $00000010;

 

(*

* Supports mirroring left to right in blt.

*)

DDFXCAPS_BLTMIRRORLEFTRIGHT     = $00000040;

 

(*

* Supports mirroring top to bottom in blt.

*)

DDFXCAPS_BLTMIRRORUPDOWN        = $00000080;

 

(*

* Supports arbitrary rotation for blts.

*)

DDFXCAPS_BLTROTATION            = $00000100;

 

(*

* Supports 90 degree rotations for blts.

*)

  DDFXCAPS_BLTROTATION90          = $00000200;

 

(*

* DirectDraw supports arbitrary shrinking of a surface along the

* x axis (horizontal direction) for blts.

*)

DDFXCAPS_BLTSHRINKX             = $00000400;

 

(*

* DirectDraw supports integer shrinking (1x,2x,) of a surface

* along the x axis (horizontal direction) for blts.

*)

DDFXCAPS_BLTSHRINKXN            = $00000800;

 

(*

* DirectDraw supports arbitrary shrinking of a surface along the

* y axis (horizontal direction) for blts. 

*)

DDFXCAPS_BLTSHRINKY             = $00001000;

 

(*

* DirectDraw supports integer shrinking (1x,2x,) of a surface

* along the y axis (vertical direction) for blts.

*)

DDFXCAPS_BLTSHRINKYN            = $00002000;

 

(*

* DirectDraw supports arbitrary stretching of a surface along the

* x axis (horizontal direction) for blts.

*)

DDFXCAPS_BLTSTRETCHX            = $00004000;

 

(*

* DirectDraw supports integer stretching (1x,2x,) of a surface

* along the x axis (horizontal direction) for blts.

*)

DDFXCAPS_BLTSTRETCHXN           = $00008000;

 

(*

* DirectDraw supports arbitrary stretching of a surface along the

* y axis (horizontal direction) for blts. 

*)

DDFXCAPS_BLTSTRETCHY            = $00010000;

 

(*

* DirectDraw supports integer stretching (1x,2x,) of a surface

* along the y axis (vertical direction) for blts. 

*)

DDFXCAPS_BLTSTRETCHYN           = $00020000;

 

(*

* Uses arithmetic operations to stretch and shrink surfaces during

* overlay rather than pixel doubling techniques.  Along the Y axis

* for overlays.

*)

DDFXCAPS_OVERLAYARITHSTRETCHY   = $00040000;

 

(*

* Uses arithmetic operations to stretch surfaces during

* overlay rather than pixel doubling techniques.  Along the Y axis

* for overlays. Only works for x1, x2, etc.

*)

DDFXCAPS_OVERLAYARITHSTRETCHYN  = $00000008;

 

(*

* DirectDraw supports arbitrary shrinking of a surface along the

* x axis (horizontal direction) for overlays.

*)

DDFXCAPS_OVERLAYSHRINKX         = $00080000;

 

(*

* DirectDraw supports integer shrinking (1x,2x,) of a surface

* along the x axis (horizontal direction) for overlays.

*)

DDFXCAPS_OVERLAYSHRINKXN        = $00100000;

 

(*

* DirectDraw supports arbitrary shrinking of a surface along the

* y axis (horizontal direction) for overlays. 

*)

DDFXCAPS_OVERLAYSHRINKY         = $00200000;

 

(*

* DirectDraw supports integer shrinking (1x,2x,) of a surface

* along the y axis (vertical direction) for overlays. 

*)

DDFXCAPS_OVERLAYSHRINKYN        = $00400000;

 

(*

* DirectDraw supports arbitrary stretching of a surface along the

* x axis (horizontal direction) for overlays.

*)

DDFXCAPS_OVERLAYSTRETCHX        = $00800000;

 

(*

* DirectDraw supports integer stretching (1x,2x,) of a surface

* along the x axis (horizontal direction) for overlays.

*)

DDFXCAPS_OVERLAYSTRETCHXN       = $01000000;

 

(*

* DirectDraw supports arbitrary stretching of a surface along the

* y axis (horizontal direction) for overlays. 

*)

DDFXCAPS_OVERLAYSTRETCHY        = $02000000;

 

(*

* DirectDraw supports integer stretching (1x,2x,) of a surface

* along the y axis (vertical direction) for overlays. 

*)

DDFXCAPS_OVERLAYSTRETCHYN       = $04000000;

 

(*

* DirectDraw supports mirroring of overlays across the vertical axis

*)

DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000;

 

(*

* DirectDraw supports mirroring of overlays across the horizontal axis

*)

DDFXCAPS_OVERLAYMIRRORUPDOWN    = $10000000;

 

(*

* Driver can do alpha blending for blits.

*)

DDFXCAPS_BLTALPHA                = $00000001;

 

(*

* Driver can do geometric transformations (or warps) for blits.

*)

DDFXCAPS_BLTTRANSFORM                = $00000002;

 

(*

* Driver can do surface-reconstruction filtering for warped blits.

*)

DDFXCAPS_BLTFILTER               = DDFXCAPS_BLTARITHSTRETCHY;

 

(*

* Driver can do alpha blending for overlays.

*)

DDFXCAPS_OVERLAYALPHA                = $00000004;

 

(*

* Driver can do geometric transformations (or warps) for overlays.

*)

DDFXCAPS_OVERLAYTRANSFORM        = $20000000;

 

(*

* Driver can do surface-reconstruction filtering for warped overlays.

*)

DDFXCAPS_OVERLAYFILTER              = DDFXCAPS_OVERLAYARITHSTRETCHY;

 

(****************************************************************************

*

* DIRECTDRAW STEREO VIEW CAPABILITIES

*

****************************************************************************)

 

(*

* This flag used to be DDSVCAPS_ENIGMA, which is now obsolete

* The stereo view is accomplished via enigma encoding.