Subversion Repositories spacemission

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. (*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1994-1999 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  DirectX header version 98.11.20
  6.  *
  7.  *  Present by Hiroyuki Hori.
  8.  *
  9.  *  E-Mail: hori@ingjapan.ne.jp
  10.  *  Homepage: http://www.ingjapan.ne.jp/hori/index.html
  11.  *  Homepage: http://www.ingjapan.ne.jp/hori/index-e.html
  12.  *
  13.  *  Present unit:
  14.  *    DirectX.pas    DirectX 7 (DirectX 7 SDK)
  15.  *    DShow.pas      DirectShow (DirectX Media SDK 5.1)
  16.  *    DAnim.pas      DirectAnimation (DirectX Media SDK 5.1)
  17.  *
  18.  *--------------------------------------------------------------------------
  19.  *
  20.  *    DirectMusic header version 1.0
  21.  *
  22.  *    Present by Kazuya Yamane
  23.  *
  24.  *    e-mail : kazuya-y@infosakyu.ne.jp
  25.  *    URL    : http://www.infosakyu.ne.jp/~kazuya-y/index.html
  26.  *
  27.  ***************************************************************************)
  28.  
  29. unit DirectX;
  30.  
  31. interface
  32.  
  33. {$Z4}
  34. {$A+}
  35. {$WEAKPACKAGEUNIT}
  36.  
  37. {$IFNDEF DirectX3}
  38. {$IFNDEF DirectX5}
  39. {$IFNDEF DirectX6}
  40. {$IFNDEF DirectX7}
  41.   {$DEFINE DirectX7}
  42. {$ENDIF}
  43. {$ENDIF}
  44. {$ENDIF}
  45. {$ENDIF}
  46.  
  47. {$IFDEF DirectX3}
  48.   {$UNDEF DirectX5}
  49.   {$UNDEF DirectX6}
  50.   {$UNDEF DirectX7}
  51.   {$DEFINE SupportDirectX3}
  52. {$ENDIF}
  53.  
  54. {$IFDEF DirectX5}
  55.   {$UNDEF DirectX3}
  56.   {$UNDEF DirectX6}
  57.   {$UNDEF DirectX7}
  58.   {$DEFINE SupportDirectX3}
  59.   {$DEFINE SupportDirectX5}
  60. {$ENDIF}
  61.  
  62. {$IFDEF DirectX6}
  63.   {$UNDEF DirectX3}
  64.   {$UNDEF DirectX5}
  65.   {$UNDEF DirectX7}
  66.   {$DEFINE SupportDirectX3}
  67.   {$DEFINE SupportDirectX5}
  68.   {$DEFINE SupportDirectX6}
  69. {$ENDIF}
  70.  
  71. {$IFDEF DirectX7}
  72.   {$UNDEF DirectX3}
  73.   {$UNDEF DirectX5}
  74.   {$UNDEF DirectX6}
  75.   {$DEFINE SupportDirectX3}
  76.   {$DEFINE SupportDirectX5}
  77.   {$DEFINE SupportDirectX6}
  78.   {$DEFINE SupportDirectX7}
  79. {$ENDIF}
  80.  
  81. uses Windows, MMSystem, ActiveX;
  82.  
  83. const
  84. {$IFDEF DirectX3}
  85.   DirectXUnitVersion = 3;
  86. {$ENDIF}{$IFDEF DirectX5}
  87.   DirectXUnitVersion = 5;
  88. {$ENDIF}{$IFDEF DirectX6}
  89.   DirectXUnitVersion = 6;
  90. {$ENDIF}{$IFDEF DirectX7}
  91.   DirectXUnitVersion = 7;
  92. {$ENDIF}
  93.  
  94. (*==========================================================================;
  95.  *
  96.  *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  97.  *
  98.  *  File:       ddraw.h
  99.  *  Content:    DirectDraw include file
  100.  *
  101.  ***************************************************************************)
  102.  
  103. { FOURCC codes for DX compressed-texture pixel formats }
  104.  
  105. const
  106.   FOURCC_DXT1 = Ord('D') + Ord('X') shl 8 + Ord('T') shl 16 + Ord('1') shl 24;
  107.   FOURCC_DXT2 = Ord('D') + Ord('X') shl 8 + Ord('T') shl 16 + Ord('2') shl 24;
  108.   FOURCC_DXT3 = Ord('D') + Ord('X') shl 8 + Ord('T') shl 16 + Ord('3') shl 24;
  109.   FOURCC_DXT4 = Ord('D') + Ord('X') shl 8 + Ord('T') shl 16 + Ord('4') shl 24;
  110.   FOURCC_DXT5 = Ord('D') + Ord('X') shl 8 + Ord('T') shl 16 + Ord('5') shl 24;
  111.  
  112. { GUIDS used by DirectDraw objects }
  113.  
  114. const
  115.   CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}';
  116.   CLSID_DirectDraw7: TGUID = '{3C305196-50DB-11D3-9CFE-00C04FD930C5}';
  117.   CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00B93356}';
  118.   IID_IDirectDraw: TGUID = '{6C14DB80-A733-11CE-A521-0020AF0BE560}';
  119.   IID_IDirectDraw2: TGUID = '{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}';
  120.   IID_IDirectDraw4: TGUID = '{9C59509A-39BD-11D1-8C4A-00C04FD930C5}';
  121.   IID_IDirectDraw7: TGUID = '{15E65EC0-3B9C-11D2-B92F-00609797EA5B}';
  122.   IID_IDirectDrawSurface: TGUID = '{6C14DB81-A733-11CE-A521-0020AF0BE560}';
  123.   IID_IDirectDrawSurface2: TGUID = '{57805885-6EEC-11CF-9441-A82303C10E27}';
  124.   IID_IDirectDrawSurface3: TGUID = '{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}';
  125.   IID_IDirectDrawSurface4: TGUID = '{0B2B8630-AD35-11D0-8EA6-00609797EA5B}';
  126.   IID_IDirectDrawSurface7: TGUID = '{06675A80-3B9B-11D2-B92F-00609797EA5B}';
  127.   IID_IDirectDrawPalette: TGUID = '{6C14DB84-A733-11CE-A521-0020AF0BE560}';
  128.   IID_IDirectDrawClipper: TGUID = '{6C14DB85-A733-11CE-A521-0020AF0BE560}';
  129.   IID_IDirectDrawColorControl: TGUID = '{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}';
  130.   IID_IDirectDrawGammaControl: TGUID = '{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}';
  131.  
  132. const
  133.   DD_ROP_SPACE = 256 div 32;       // space required to store ROP array
  134.  
  135.   MAX_DDDEVICEID_STRING = 512;
  136.  
  137. { DirectDraw Structures }
  138.  
  139. type
  140.   IDirectDraw = interface;
  141.   IDirectDraw2 = interface;
  142.   IDirectDraw4 = interface;
  143.   IDirectDraw7 = interface;
  144.   IDirectDrawSurface = interface;
  145.   IDirectDrawSurface2 = interface;
  146.   IDirectDrawSurface3 = interface;
  147.   IDirectDrawSurface4 = interface;
  148.   IDirectDrawSurface7 = interface;
  149.   IDirectDrawPalette = interface;
  150.   IDirectDrawClipper = interface;
  151.   IDirectDrawColorControl = interface;
  152.   IDirectDrawGammaControl = interface;
  153.  
  154. { TDDARGB structure }
  155.  
  156.   PDDARGB = ^TDDARGB;
  157.   TDDARGB = record
  158.     Blue: Byte;
  159.     Green: Byte;
  160.     Red: Byte;
  161.     Alpha: Byte;
  162.   end;
  163.  
  164.   DDARGB = TDDARGB;
  165.   LPDDARGB = PDDARGB;
  166.  
  167. { TDDRGBA structure }
  168.  
  169.   PDDRGBA = ^TDDRGBA;
  170.   TDDRGBA = record
  171.     Red: Byte;
  172.     Green: Byte;
  173.     Blue: Byte;
  174.     Alpha: Byte;
  175.   end;
  176.  
  177.   DDRGBA = TDDRGBA;
  178.   LPDDRGBA = PDDRGBA;
  179.  
  180. { TDDColorKey structure }
  181.  
  182.   PDDColorKey = ^TDDColorKey;
  183.   TDDColorKey = record
  184.     dwColorSpaceLowValue: DWORD;   // low boundary of color space that is to
  185.                                    //  be treated as Color Key, inclusive
  186.     dwColorSpaceHighValue: DWORD;  // high boundary of color space that is
  187.                                    //  to be treated as Color Key, inclusive
  188.   end;
  189.  
  190.   DDCOLORKEY = TDDColorKey;
  191.   LPDDCOLORKEY = PDDColorKey;
  192.  
  193. { TDDBltFX structure }
  194.  
  195.   PDDBltFX = ^TDDBltFX;
  196.   TDDBltFX = record
  197.     dwSize: DWORD;                           // size of structure
  198.     dwDDFX: DWORD;                           // FX operations
  199.     dwROP: DWORD;                            // Win32 raster operations
  200.     dwDDROP: DWORD;                          // Raster operations new for DirectDraw
  201.     dwRotationAngle: DWORD;                  // Rotation angle for blt
  202.     dwZBufferOpCode: DWORD;                  // ZBuffer compares
  203.     dwZBufferLow: DWORD;                     // Low limit of Z buffer
  204.     dwZBufferHigh: DWORD;                    // High limit of Z buffer
  205.     dwZBufferBaseDest: DWORD;                // Destination base value
  206.     dwZDestConstBitDepth: DWORD;             // Bit depth used to specify Z constant for destination
  207.     case Integer of
  208.     0: (
  209.       dwZDestConst: DWORD;                   // Constant to use as Z buffer for dest
  210.       dwZSrcConstBitDepth: DWORD;            // Bit depth used to specify Z constant for source
  211.       dwZSrcConst: DWORD;                    // Constant to use as Z buffer for src
  212.       dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
  213.       dwAlphaEdgeBlend: DWORD;               // Alpha for edge blending
  214.       dwReserved: DWORD;
  215.       dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
  216.       dwAlphaDestConst: DWORD;               // Constant to use as Alpha Channel
  217.       dwAlphaSrcConstBitDepth: DWORD;        // Bit depth used to specify alpha constant for source
  218.       dwAlphaSrcConst: DWORD;                // Constant to use as Alpha Channel
  219.       dwFillColor: DWORD;                    // color in RGB or Palettized
  220.       ddckDestColorkey: TDDColorKey;          // DestColorkey override
  221.       ddckSrcColorkey: TDDColorKey;           // SrcColorkey override
  222.       );
  223.     1: (
  224.       lpDDSZBufferDest: Pointer{IDirectDrawSurface};  // Surface to use as Z buffer for dest
  225.       _union1b: DWORD;
  226.       lpDDSZBufferSrc: Pointer{IDirectDrawSurface};   // Surface to use as Z buffer for src
  227.       _union1d: DWORD;
  228.       _union1e: DWORD;
  229.       _union1f: DWORD;
  230.       _union1g: DWORD;
  231.       lpDDSAlphaDest: Pointer{IDirectDrawSurface};    // Surface to use as Alpha Channel
  232.       _union1i: DWORD;
  233.       lpDDSAlphaSrc: Pointer{IDirectDrawSurface};     // Surface to use as Alpha Channel
  234.       dwFillDepth: DWORD;                    // depth value for z-buffer
  235.       );
  236.     2: (
  237.       _union2a: DWORD;
  238.       _union2b: DWORD;
  239.       _union2c: DWORD;
  240.       _union2d: DWORD;
  241.       _union2e: DWORD;
  242.       _union2f: DWORD;
  243.       _union2g: DWORD;
  244.       _union2h: DWORD;
  245.       _union2i: DWORD;
  246.       _union2j: DWORD;
  247.       lpDDSPattern: Pointer{IDirectDrawSurface};       // Surface to use as pattern
  248.       );
  249.   end;
  250.  
  251.   DDBLTFX = TDDBltFX;
  252.   LPDDBLTFX = PDDBltFX;
  253.  
  254. { TDDSCaps structure }
  255.  
  256.   PDDSCaps = ^TDDSCaps;
  257.   TDDSCaps = record
  258.     dwCaps: DWORD;         // capabilities of surface wanted
  259.   end;
  260.  
  261.   DDSCAPS = TDDSCaps;
  262.   LPDDSCAPS = PDDSCaps;
  263. { TDDOSCaps structure }
  264.  
  265.   PDDOSCaps = ^TDDOSCaps;
  266.   TDDOSCaps = record
  267.     dwCaps: DWORD;         // capabilities of surface wanted
  268.   end;
  269.  
  270.   DDOSCAPS = TDDOSCaps;
  271.   LPDDOSCAPS = PDDOSCaps;
  272.  
  273.  
  274. { TDDSCapsEx structure }
  275.  
  276.   PDDSCapsEx = ^TDDSCapsEx;
  277.   TDDSCapsEx = record
  278.     dwCaps2: DWORD;
  279.     dwCaps3: DWORD;
  280.     dwCaps4: DWORD;
  281.   end;
  282.  
  283.   DDSCAPSEX = TDDSCapsEx;
  284.   LPDDSCAPSEX = PDDSCapsEx;
  285.  
  286. { TDDSCaps2 structure }
  287.  
  288.   PDDSCaps2 = ^TDDSCaps2;
  289.   TDDSCaps2 = record
  290.     dwCaps: DWORD;         // capabilities of surface wanted
  291.     dwCaps2: DWORD;
  292.     dwCaps3: DWORD;
  293.     dwCaps4: DWORD;
  294.   end;
  295.  
  296.   DDSCAPS2 = TDDSCaps2;
  297.   LPDDSCAPS2 = PDDSCaps2;
  298.  
  299. { TDDCaps structure }
  300.  
  301.   PDDCaps_DX1 = ^TDDCaps_DX1;
  302.   TDDCaps_DX1 = record
  303.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  304.     dwCaps: DWORD;                 // driver specific capabilities
  305.     dwCaps2: DWORD;                // more driver specific capabilites
  306.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  307.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  308.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  309.     dwPalCaps: DWORD;              // palette capabilities
  310.     dwSVCaps: DWORD;               // stereo vision capabilities
  311.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  312.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  313.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  314.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  315.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  316.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  317.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  318.     dwVidMemTotal: DWORD;          // total amount of video memory
  319.     dwVidMemFree: DWORD;           // amount of free video memory
  320.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  321.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  322.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  323.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  324.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  325.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  326.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  327.     dwAlignStrideAlign: DWORD;     // stride alignment
  328.     dwRops: array[0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  329.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  330.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  331.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  332.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  333.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  334.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  335.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  336.     dwReserved1: DWORD;            // reserved
  337.     dwReserved2: DWORD;            // reserved
  338.     dwReserved3: DWORD;            // reserved
  339.   end;
  340.  
  341.   PDDCaps_DX3 = ^TDDCaps_DX3;
  342.   TDDCaps_DX3 = record
  343.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  344.     dwCaps: DWORD;                 // driver specific capabilities
  345.     dwCaps2: DWORD;                // more driver specific capabilites
  346.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  347.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  348.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  349.     dwPalCaps: DWORD;              // palette capabilities
  350.     dwSVCaps: DWORD;               // stereo vision capabilities
  351.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  352.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  353.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  354.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  355.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  356.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  357.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  358.     dwVidMemTotal: DWORD;          // total amount of video memory
  359.     dwVidMemFree: DWORD;           // amount of free video memory
  360.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  361.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  362.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  363.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  364.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  365.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  366.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  367.     dwAlignStrideAlign: DWORD;     // stride alignment
  368.     dwRops: array[0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  369.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  370.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  371.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  372.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  373.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  374.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  375.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  376.     dwReserved1: DWORD;            // reserved
  377.     dwReserved2: DWORD;            // reserved
  378.     dwReserved3: DWORD;            // reserved
  379.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  380.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  381.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  382.     dwSVBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  383.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  384.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  385.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  386.     dwVSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  387.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  388.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  389.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  390.     dwSSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  391.     dwReserved4: DWORD;            // reserved
  392.     dwReserved5: DWORD;            // reserved
  393.     dwReserved6: DWORD;            // reserved
  394.   end;
  395.  
  396.   PDDCaps_DX5 = ^TDDCaps_DX5;
  397.   TDDCaps_DX5 = record
  398.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  399.     dwCaps: DWORD;                 // driver specific capabilities
  400.     dwCaps2: DWORD;                // more driver specific capabilites
  401.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  402.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  403.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  404.     dwPalCaps: DWORD;              // palette capabilities
  405.     dwSVCaps: DWORD;               // stereo vision capabilities
  406.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  407.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  408.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  409.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  410.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  411.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  412.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  413.     dwVidMemTotal: DWORD;          // total amount of video memory
  414.     dwVidMemFree: DWORD;           // amount of free video memory
  415.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  416.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  417.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  418.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  419.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  420.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  421.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  422.     dwAlignStrideAlign: DWORD;     // stride alignment
  423.     dwRops: array[0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  424.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  425.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  426.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  427.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  428.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  429.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  430.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  431.     dwReserved1: DWORD;            // reserved
  432.     dwReserved2: DWORD;            // reserved
  433.     dwReserved3: DWORD;            // reserved
  434.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  435.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  436.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  437.     dwSVBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  438.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  439.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  440.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  441.     dwVSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  442.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  443.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  444.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  445.     dwSSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  446.     { Members added for DX5 }
  447.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  448.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  449.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  450.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  451.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  452.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  453.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  454.     dwNLVBRops: array[0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  455.   end;
  456.  
  457.   PDDCaps_DX6 = ^TDDCaps_DX6;
  458.   TDDCaps_DX6 = record
  459.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  460.     dwCaps: DWORD;                 // driver specific capabilities
  461.     dwCaps2: DWORD;                // more driver specific capabilites
  462.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  463.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  464.     dwFXAlphaCaps: DWORD;          // alpha caps
  465.     dwPalCaps: DWORD;              // palette capabilities
  466.     dwSVCaps: DWORD;               // stereo vision capabilities
  467.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  468.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  469.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  470.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  471.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  472.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  473.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  474.     dwVidMemTotal: DWORD;          // total amount of video memory
  475.     dwVidMemFree: DWORD;           // amount of free video memory
  476.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  477.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  478.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  479.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  480.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  481.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  482.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  483.     dwAlignStrideAlign: DWORD;     // stride alignment
  484.     dwRops: array[0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  485.     ddsOldCaps: TDDSCaps;          // Was TDDSCaps ddsCaps. ddsCaps is of type DDSCAPS2 for DX6
  486.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  487.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  488.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  489.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  490.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  491.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  492.     dwReserved1: DWORD;            // reserved
  493.     dwReserved2: DWORD;            // reserved
  494.     dwReserved3: DWORD;            // reserved
  495.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  496.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  497.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  498.     dwSVBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  499.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  500.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  501.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  502.     dwVSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  503.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  504.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  505.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  506.     dwSSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  507.     { Members added for DX5 }
  508.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  509.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  510.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  511.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  512.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  513.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  514.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  515.     dwNLVBRops: array[0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  516.     { Members added for DX6 }
  517.     ddsCaps: TDDSCaps2;            // Surface Caps
  518.   end;
  519.  
  520.   PDDCaps_DX7 = ^TDDCaps_DX7;
  521.   TDDCaps_DX7 = record
  522.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  523.     dwCaps: DWORD;                 // driver specific capabilities
  524.     dwCaps2: DWORD;                // more driver specific capabilites
  525.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  526.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  527.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  528.     dwPalCaps: DWORD;              // palette capabilities
  529.     dwSVCaps: DWORD;               // stereo vision capabilities
  530.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  531.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  532.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  533.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  534.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  535.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  536.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  537.     dwVidMemTotal: DWORD;          // total amount of video memory
  538.     dwVidMemFree: DWORD;           // amount of free video memory
  539.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  540.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  541.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  542.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  543.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  544.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  545.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  546.     dwAlignStrideAlign: DWORD;     // stride alignment
  547.     dwRops: array[0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  548.     ddsOldCaps: TDDSCaps;          // Was TDDSCaps ddsCaps. ddsCaps is of type DDSCAPS2 for DX6
  549.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  550.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  551.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  552.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  553.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  554.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  555.     dwReserved1: DWORD;            // reserved
  556.     dwReserved2: DWORD;            // reserved
  557.     dwReserved3: DWORD;            // reserved
  558.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  559.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  560.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  561.     dwSVBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  562.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  563.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  564.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  565.     dwVSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  566.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  567.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  568.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  569.     dwSSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  570.     { Members added for DX5 }
  571.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  572.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  573.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  574.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  575.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  576.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  577.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  578.     dwNLVBRops: array[0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  579.     { Members added for DX6 }
  580.     ddsCaps: TDDSCaps2;            // Surface Caps
  581.   end;
  582.  
  583. {$IFDEF DirectX1}
  584.   TDDCaps = TDDCaps_DX1;
  585.   PDDCaps = PDDCaps_DX1;
  586. {$ENDIF}{$IFDEF DirectX3}
  587.   TDDCaps = TDDCaps_DX3;
  588.   PDDCaps = PDDCaps_DX3;
  589. {$ENDIF}{$IFDEF DirectX5}
  590.   TDDCaps = TDDCaps_DX5;
  591.   PDDCaps = PDDCaps_DX5;
  592. {$ENDIF}{$IFDEF DirectX6}
  593.   TDDCaps = TDDCaps_DX6;
  594.   PDDCaps = PDDCaps_DX6;
  595. {$ENDIF}{$IFDEF DirectX7}
  596.   TDDCaps = TDDCaps_DX7;
  597.   PDDCaps = PDDCaps_DX7;
  598. {$ENDIF}
  599.  
  600.   DDCAPS = TDDCaps;
  601.   LPDDCAPS = PDDCaps;
  602.  
  603. { TDDPixelFormat structure }
  604.  
  605.   PDDPixelFormat = ^TDDPixelFormat;
  606.   TDDPixelFormat = record
  607.     dwSize: DWORD;                // size of structure
  608.     dwFlags: DWORD;               // pixel format flags
  609.     dwFourCC: DWORD;              // (FOURCC code)
  610.     case Integer of
  611.       0: (
  612.         dwRGBBitCount: DWORD;          // how many bits per pixel
  613.         dwRBitMask: DWORD;             // mask for red bit
  614.         dwGBitMask: DWORD;             // mask for green bits
  615.         dwBBitMask: DWORD;             // mask for blue bits
  616.         dwRGBAlphaBitMask: DWORD;      // mask for alpha channel
  617.         );
  618.       1: (
  619.         _union1a: DWORD;
  620.         _union1b: DWORD;
  621.         _union1c: DWORD;
  622.         _union1d: DWORD;
  623.         dwRGBZBitMask: DWORD;          // mask for Z channel
  624.         );
  625.       2: (
  626.         dwYUVBitCount: DWORD;          // how many bits per pixel
  627.         dwYBitMask: DWORD;             // mask for Y bits
  628.         dwUBitMask: DWORD;             // mask for U bits
  629.         dwVBitMask: DWORD;             // mask for V bits
  630.         dwYUVAlphaBitMask: DWORD;      // mask for alpha channel
  631.         );
  632.       3: (
  633.         _union3a: DWORD;
  634.         _union3b: DWORD;
  635.         _union3c: DWORD;
  636.         _union3d: DWORD;
  637.         dwYUVZBitMask: DWORD;          // mask for Z channel
  638.         );
  639.       4: (
  640.         dwZBufferBitDepth: DWORD;      // how many bits for z buffers
  641.         dwStencilBitDepth: DWORD;      // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)
  642.         dwZBitMask: DWORD;             // mask for Z bits
  643.         dwStencilBitMask: DWORD;       // mask for stencil bits
  644.         );
  645.       5: (
  646.         dwAlphaBitDepth: DWORD;        // how many bits for alpha channels
  647.         );
  648.       6: (
  649.         dwLuminanceBitCount: DWORD;    // how many bits per pixel
  650.         dwLuminanceBitMask: DWORD;     // mask for luminance bits
  651.         _union6c: DWORD;
  652.         _union6d: DWORD;
  653.         dwLuminanceAlphaBitMask: DWORD;
  654.        );
  655.       7: (
  656.         dwBumpBitCount: DWORD;         // how many bits per "buxel", total
  657.         dwBumpDuBitMask: DWORD;        // mask for bump map U delta bits
  658.         dwBumpDvBitMask: DWORD;        // mask for bump map V delta bits
  659.         dwBumpLuminanceBitMask: DWORD; // mask for luminance in bump map
  660.        );
  661.   end;
  662.  
  663.   DDPIXELFORMAT = TDDPixelFormat;
  664.   LPDDPIXELFORMAT = PDDPixelFormat;
  665.  
  666. { DDOVERLAYFX structure }
  667.  
  668.   PDDOverlayFx = ^TDDOverlayFx;
  669.   TDDOverlayFx = record
  670.     dwSize: DWORD;                         // size of structure
  671.     dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
  672.     dwAlphaEdgeBlend: DWORD;               // Constant to use as alpha for edge blend
  673.     dwReserved: DWORD;
  674.     dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
  675.     case Integer of
  676.     0: (
  677.       dwAlphaDestConst: DWORD;             // Constant to use as alpha channel for dest
  678.       dwAlphaSrcConstBitDepth: DWORD;      // Bit depth used to specify alpha constant for source
  679.       dwAlphaSrcConst: DWORD;              // Constant to use as alpha channel for src
  680.       dckDestColorkey: TDDColorKey;        // DestColorkey override
  681.       dckSrcColorkey: TDDColorKey;         // DestColorkey override
  682.       dwDDFX: DWORD;                       // Overlay FX
  683.       dwFlags: DWORD;                      // flags
  684.       );
  685.     1: (
  686.       lpDDSAlphaDest: Pointer{IDirectDrawSurface};  // Surface to use as alpha channel for dest
  687.       _union1b: DWORD;
  688.       lpDDSAlphaSrc: Pointer{IDirectDrawSurface};   // Surface to use as alpha channel for src
  689.       );
  690.   end;
  691.  
  692.   DDOVERLAYFX = TDDOverlayFx;
  693.   LPDDOVERLAYFX = PDDOverlayFx;
  694.  
  695. { TDDBltBatch structure }
  696.  
  697.   PDDBltBatch = ^TDDBltBatch;
  698.   TDDBltBatch = record
  699.     lprDest: PRect;
  700.     lpDDSSrc: IDirectDrawSurface;
  701.     lprSrc: PRect;
  702.     dwFlags: DWORD;
  703.     lpDDBltFx: PDDBltFX;
  704.   end;
  705.  
  706.   DDBLTBATCH = TDDBltBatch;
  707.   LPDDBLTBATCH = PDDBltBatch;
  708.  
  709. { TDDSurfaceDesc structure }
  710.  
  711.   PDDSurfaceDesc = ^TDDSurfaceDesc;
  712.   TDDSurfaceDesc = record
  713.     dwSize: DWORD;                   // size of the TDDSurfaceDesc structure
  714.     dwFlags: DWORD;                  // determines what fields are valid
  715.     dwHeight: DWORD;                 // height of surface to be created
  716.     dwWidth: DWORD;                  // width of input surface
  717.     case Integer of
  718.       0: (
  719.         lPitch: Longint;
  720.         dwBackBufferCount: DWORD;        // number of back buffers requested
  721.         case Integer of
  722.         0: (
  723.           dwMipMapCount: DWORD;          // number of mip-map levels requested
  724.           dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  725.           dwReserved: DWORD;             // reserved
  726.           lpSurface: Pointer;            // pointer to the associated surface memory
  727.           ddckCKDestOverlay: TDDColorKey;// color key for destination overlay use
  728.           ddckCKDestBlt: TDDColorKey;    // color key for destination blt use
  729.           ddckCKSrcOverlay: TDDColorKey; // color key for source overlay use
  730.           ddckCKSrcBlt: TDDColorKey;     // color key for source blt use
  731.           ddpfPixelFormat: TDDPixelFormat;// pixel format description of the surface
  732.           ddsCaps: TDDSCaps;             // direct draw surface capabilities
  733.           );
  734.         1: (
  735.           dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
  736.           );
  737.         2: (
  738.           dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  739.           );
  740.       );
  741.       1: (
  742.         dwLinearSize: DWORD
  743.       );
  744.   end;
  745.  
  746.   DDSURFACEDESC = TDDSurfaceDesc;
  747.   LPDDSURFACEDESC = PDDSurfaceDesc;
  748.  
  749. { TDDSurfaceDesc2 structure }
  750.  
  751.   PDDSurfaceDesc2 = ^TDDSurfaceDesc2;
  752.   TDDSurfaceDesc2 = record
  753.     dwSize: DWORD;                   // size of the TDDSurfaceDesc2 structure
  754.     dwFlags: DWORD;                  // determines what fields are valid
  755.     dwHeight: DWORD;                 // height of surface to be created
  756.     dwWidth: DWORD;                  // width of input surface
  757.     case Integer of
  758.       0: (
  759.         lPitch: Longint;
  760.         dwBackBufferCount: DWORD;        // number of back buffers requested
  761.         case Integer of
  762.         0: (
  763.           dwMipMapCount: DWORD;          // number of mip-map levels requested
  764.           dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  765.           dwReserved: DWORD;             // reserved
  766.           lpSurface: Pointer;            // pointer to the associated surface memory
  767.           ddckCKDestOverlay: TDDColorKey;// color key for destination overlay use
  768.           ddckCKDestBlt: TDDColorKey;    // color key for destination blt use
  769.           ddckCKSrcOverlay: TDDColorKey; // color key for source overlay use
  770.           ddckCKSrcBlt: TDDColorKey;     // color key for source blt use
  771.           ddpfPixelFormat: TDDPixelFormat;// pixel format description of the surface
  772.           ddsCaps: TDDSCaps2;            // direct draw surface capabilities
  773.           dwTextureStage: DWORD;         // stage in multitexture cascade
  774.           );
  775.         1: (
  776.           dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  777.           );
  778.       );
  779.       1: (
  780.         dwLinearSize: DWORD
  781.       );
  782.   end;
  783.  
  784.   DDSURFACEDESC2 = TDDSurfaceDesc2;
  785.   LPDDSURFACEDESC2 = PDDSurfaceDesc2;
  786.  
  787. { TDDOptSurfaceDesc structure }
  788.  
  789.   PDDOptSurfaceDesc = ^TDDOptSurfaceDesc;
  790.   TDDOptSurfaceDesc = record
  791.     dwSize: DWORD;             // size of the DDOPTSURFACEDESC structure
  792.     dwFlags: DWORD;            // determines what fields are valid
  793.     ddSCaps: TDDSCaps2;        // Common caps like: Memory type
  794.     ddOSCaps: TDDOSCaps;       // Common caps like: Memory type
  795.     guid: TGUID;               // Compression technique GUID
  796.     dwCompressionRatio: DWORD; // Compression ratio
  797.   end;
  798.  
  799.   DDOPTSURFACEDESC = TDDOptSurfaceDesc;
  800.   LPDDOPTSURFACEDESC = PDDOptSurfaceDesc;
  801.  
  802. { TDDColorControl structure }
  803.  
  804.   PDDColorControl = ^TDDColorControl;
  805.   TDDColorControl = record
  806.     dwSize: DWORD;
  807.     dwFlags: DWORD;
  808.     lBrightness: Longint;
  809.     lContrast: Longint;
  810.     lHue: Longint;
  811.     lSaturation: Longint;
  812.     lSharpness: Longint;
  813.     lGamma: Longint;
  814.     lColorEnable: Longint;
  815.     dwReserved1: DWORD;
  816.   end;
  817.  
  818.   DDCOLORCONTROL = TDDColorControl;
  819.   LPDDCOLORCONTROL = PDDCOLORCONTROL;
  820.  
  821. { TDDGammaRamp structure }
  822.  
  823.   PDDGammaRamp = ^TDDGammaRamp;
  824.   TDDGammaRamp = record
  825.     Red: array[0..255] of Word;
  826.     Green: array[0..255] of Word;
  827.     Blue: array[0..255] of Word;
  828.   end;
  829.  
  830.   DDGAMMARAMP = TDDGammaRamp;
  831.   LPDDGAMMARAMP = PDDGammaRamp;
  832.  
  833. { TDDDeviceIdentifier structure }
  834.  
  835.   PDDDeviceIdentifier = ^TDDDeviceIdentifier;
  836.   TDDDeviceIdentifier = record
  837.     //
  838.     // These elements are for presentation to the user only. They should not be used to identify particular
  839.     // drivers, since this is unreliable and many different strings may be associated with the same
  840.     // device, and the same driver from different vendors.
  841.     //
  842.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  843.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  844.  
  845.     //
  846.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  847.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  848.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  849.     //
  850.     // This version has the form:
  851.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  852.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  853.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  854.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  855.     //
  856.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  857.  
  858.     //
  859.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  860.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  861.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  862.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  863.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  864.     //
  865.     dwVendorId: DWORD;
  866.     dwDeviceId: DWORD;
  867.     dwSubSysId: DWORD;
  868.     dwRevision: DWORD;
  869.  
  870.     //
  871.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  872.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  873.     // reprofile the graphics subsystem.
  874.     // This element can also be used to identify particular problematic drivers.
  875.     //
  876.     guidDeviceIdentifier: TGUID;
  877.   end;
  878.  
  879.   DDDEVICEIDENTIFIER = TDDDeviceIdentifier;
  880.   LPDDDEVICEIDENTIFIER = PDDDeviceIdentifier;
  881.  
  882. { TDDDeviceIdentifier2 structure }
  883.  
  884.   PDDDeviceIdentifier2 = ^TDDDeviceIdentifier2;
  885.   TDDDeviceIdentifier2 = record
  886.     //
  887.     // These elements are for presentation to the user only. They should not be used to identify particular
  888.     // drivers, since this is unreliable and many different strings may be associated with the same
  889.     // device, and the same driver from different vendors.
  890.     //
  891.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  892.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  893.  
  894.     //
  895.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  896.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  897.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  898.     //
  899.     // This version has the form:
  900.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  901.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  902.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  903.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  904.     //
  905.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  906.  
  907.     //
  908.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  909.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  910.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  911.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  912.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  913.     //
  914.     dwVendorId: DWORD;
  915.     dwDeviceId: DWORD;
  916.     dwSubSysId: DWORD;
  917.     dwRevision: DWORD;
  918.  
  919.     //
  920.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  921.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  922.     // reprofile the graphics subsystem.
  923.     // This element can also be used to identify particular problematic drivers.
  924.     //
  925.     guidDeviceIdentifier: TGUID;
  926.  
  927.     //
  928.     // This element is used to determine the Windows Hardware Quality Lab (WHQL)
  929.     // certification level for this driver/device pair.
  930.     //
  931.     dwWHQLLevel: DWORD;
  932.   end;
  933.  
  934.   DDDEVICEIDENTIFIER2 = TDDDeviceIdentifier2;
  935.   LPDDDEVICEIDENTIFIER2 = PDDDeviceIdentifier2;
  936.  
  937. { Callbacks }
  938.  
  939.   TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND;
  940.       Code: DWORD; lpContext: Pointer): HResult; stdcall;
  941.   LPCLIPPERCALLBACK = TClipperCallback;
  942.  
  943.   TSurfacesStreamingCallback = function(Arg: DWORD): HResult; stdcall;
  944.   LPSURFACESTREAMINGCALLBACK =TSurfacesStreamingCallback;
  945.  
  946.   TDDEnumModesCallback = function(const lpDDSurfaceDesc: TDDSurfaceDesc;
  947.       lpContext: Pointer): HResult; stdcall;
  948.   LPDDENUMMODESCALLBACK = TDDEnumModesCallback;
  949.  
  950.   TDDEnumModesCallback2 = function(const lpDDSurfaceDesc: TDDSurfaceDesc2;
  951.       lpContext: Pointer): HResult; stdcall;
  952.   LPDDENUMMODESCALLBACK2 = TDDEnumModesCallback2;
  953.  
  954.   TDDEnumSurfacesCallback = function(lpDDSurface: IDirectDrawSurface;
  955.       const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer): HResult; stdcall;
  956.   LPDDENUMSURFACESCALLBACK = TDDEnumSurfacesCallback;
  957.  
  958.   TDDEnumSurfacesCallback2 = function(lpDDSurface: IDirectDrawSurface4;
  959.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer): HResult; stdcall;
  960.   LPDDENUMSURFACESCALLBACK2 = TDDEnumSurfacesCallback2;
  961.  
  962.   TDDEnumSurfacesCallback7 = function(lpDDSurface: IDirectDrawSurface7;
  963.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer): HResult; stdcall;
  964.   LPDDENUMSURFACESCALLBACK7 = TDDEnumSurfacesCallback7;
  965.  
  966. { IDirectDraw Interface }
  967.  
  968.   IDirectDraw = interface(IUnknown)
  969.     ['{6C14DB80-A733-11CE-A521-0020AF0BE560}']
  970.     // IDirectDraw methods
  971.     function Compact: HResult; stdcall;
  972.     function CreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper;
  973.         pUnkOuter: IUnknown): HResult; stdcall;
  974.     function CreatePalette(dwFlags: DWORD; lpColorTable: PPaletteEntry;
  975.         out lplpDDPalette: IDirectDrawPalette; pUnkOuter: IUnknown): HResult; stdcall;
  976.     function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc;
  977.         out lplpDDSurface: IDirectDrawSurface; pUnkOuter: IUnknown): HResult; stdcall;
  978.     function DuplicateSurface(lpDDSurface: IDirectDrawSurface;
  979.         out lplpDupDDSurface: IDirectDrawSurface): HResult; stdcall;
  980.     function EnumDisplayModes(dwFlags: DWORD;
  981.         const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer;
  982.         lpEnumModesCallback: TDDEnumModesCallback): HResult; stdcall;
  983.     function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc;
  984.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  985.     function FlipToGDISurface: HResult; stdcall;
  986.     function GetCaps(var lpDDDriverCaps: TDDCaps; var lpDDHELCaps: TDDCaps): HResult; stdcall;
  987.     function GetDisplayMode(var lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  988.     function GetFourCCCodes(var lpNumCodes, lpCodes: DWORD): HResult; stdcall;
  989.     function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface): HResult; stdcall;
  990.     function GetMonitorFrequency(var lpdwFrequency: DWORD): HResult; stdcall;
  991.     function GetScanLine(var lpdwScanLine: DWORD): HResult; stdcall;
  992.     function GetVerticalBlankStatus(var lpbIsInVB: BOOL): HResult; stdcall;
  993.     function Initialize(lpGUID: PGUID): HResult; stdcall;
  994.     function RestoreDisplayMode: HResult; stdcall;
  995.     function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall;
  996.     function SetDisplayMode(dwWidth, dwHeight, dwBpp: DWORD): HResult; stdcall;
  997.     function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  998.   end;
  999.  
  1000. { IDirectDraw2 Interface }
  1001.  
  1002.   IDirectDraw2 = interface(IUnknown)
  1003.     ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}']
  1004.     // IDirectDraw methods
  1005.     function Compact: HResult; stdcall;
  1006.     function CreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper;
  1007.         pUnkOuter: IUnknown): HResult; stdcall;
  1008.     function CreatePalette(dwFlags: DWORD; lpColorTable: PPaletteEntry;
  1009.         out lplpDDPalette: IDirectDrawPalette; pUnkOuter: IUnknown): HResult; stdcall;
  1010.     function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc;
  1011.         out lplpDDSurface: IDirectDrawSurface; pUnkOuter: IUnknown): HResult; stdcall;
  1012.     function DuplicateSurface(lpDDSurface: IDirectDrawSurface;
  1013.         out lplpDupDDSurface: IDirectDrawSurface): HResult; stdcall;
  1014.     function EnumDisplayModes(dwFlags: DWORD;
  1015.         const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer;
  1016.         lpEnumModesCallback: TDDEnumModesCallback): HResult; stdcall;
  1017.     function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc;
  1018.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1019.     function FlipToGDISurface: HResult; stdcall;
  1020.     function GetCaps(var lpDDDriverCaps: TDDCaps; var lpDDHELCaps: TDDCaps): HResult; stdcall;
  1021.     function GetDisplayMode(var lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1022.     function GetFourCCCodes(var lpNumCodes, lpCodes: DWORD): HResult; stdcall;
  1023.     function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface): HResult; stdcall;
  1024.     function GetMonitorFrequency(var lpdwFrequency: DWORD): HResult; stdcall;
  1025.     function GetScanLine(var lpdwScanLine: DWORD): HResult; stdcall;
  1026.     function GetVerticalBlankStatus(var lpbIsInVB: BOOL): HResult; stdcall;
  1027.     function Initialize(lpGUID: PGUID): HResult; stdcall;
  1028.     function RestoreDisplayMode: HResult; stdcall;
  1029.     function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall;
  1030.     function SetDisplayMode(dwWidth, dwHeight, dwBPP, dwRefreshRate: DWORD;
  1031.         dwFlags: DWORD): HResult; stdcall;
  1032.     function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1033.     // IDirectDraw2 methods
  1034.     function GetAvailableVidMem(var lpDDSCaps: TDDSCaps;
  1035.         var lpdwTotal, lpdwFree: DWORD): HResult; stdcall;
  1036.   end;
  1037.  
  1038. { IDirectDraw4 Interface }
  1039.  
  1040.   IDirectDraw4 = interface(IUnknown)
  1041.     ['{9C59509A-39BD-11D1-8C4A-00C04FD930C5}']
  1042.     // IDirectDraw methods
  1043.     function Compact: HResult; stdcall;
  1044.     function CreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper;
  1045.         pUnkOuter: IUnknown): HResult; stdcall;
  1046.     function CreatePalette(dwFlags: DWORD; lpColorTable: PPaletteEntry;
  1047.         out lplpDDPalette: IDirectDrawPalette; pUnkOuter: IUnknown): HResult; stdcall;
  1048.     function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1049.         out lplpDDSurface: IDirectDrawSurface4; pUnkOuter: IUnknown): HResult; stdcall;
  1050.     function DuplicateSurface(lpDDSurface: IDirectDrawSurface4;
  1051.         out lplpDupDDSurface: IDirectDrawSurface4): HResult; stdcall;
  1052.     function EnumDisplayModes(dwFlags: DWORD;
  1053.         const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer;
  1054.         lpEnumModesCallback: TDDEnumModesCallback2): HResult; stdcall;
  1055.     function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1056.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback2): HResult; stdcall;
  1057.     function FlipToGDISurface: HResult; stdcall;
  1058.     function GetCaps(var lpDDDriverCaps: TDDCaps; var lpDDHELCaps: TDDCaps): HResult; stdcall;
  1059.     function GetDisplayMode(var lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1060.     function GetFourCCCodes(var lpNumCodes, lpCodes: DWORD): HResult; stdcall;
  1061.     function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface2): HResult; stdcall;
  1062.     function GetMonitorFrequency(var lpdwFrequency: DWORD): HResult; stdcall;
  1063.     function GetScanLine(var lpdwScanLine: DWORD): HResult; stdcall;
  1064.     function GetVerticalBlankStatus(var lpbIsInVB: BOOL): HResult; stdcall;
  1065.     function Initialize(lpGUID: PGUID): HResult; stdcall;
  1066.     function RestoreDisplayMode: HResult; stdcall;
  1067.     function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall;
  1068.     function SetDisplayMode(dwWidth, dwHeight, dwBPP, dwRefreshRate: DWORD;
  1069.         dwFlags: DWORD): HResult; stdcall;
  1070.     function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1071.     // IDirectDraw2 methods
  1072.     function GetAvailableVidMem(var lpDDSCaps: TDDSCaps;
  1073.         var lpdwTotal, lpdwFree: DWORD): HResult; stdcall;
  1074.     // IDirectDraw4 methods
  1075.     function GetSurfaceFromDC(hdc: HDC; lpDDS: IDirectDrawSurface4): HResult; stdcall;
  1076.     function RestoreAllSurfaces: HResult; stdcall;
  1077.     function TestCooperativeLevel: HResult; stdcall;
  1078.     function GetDeviceIdentifier(var lpdddi: TDDDeviceIdentifier; dwFlags: DWORD): HResult; stdcall;
  1079.   end;
  1080.  
  1081. { IDirectDraw7 Interface }
  1082.  
  1083.   IDirectDraw7 = interface(IUnknown)
  1084.     ['{15E65EC0-3B9C-11D2-B92F-00609797EA5B}']
  1085.     // IDirectDraw methods
  1086.     function Compact: HResult; stdcall;
  1087.     function CreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper;
  1088.         pUnkOuter: IUnknown): HResult; stdcall;
  1089.     function CreatePalette(dwFlags: DWORD; lpColorTable: PPaletteEntry;
  1090.         out lplpDDPalette: IDirectDrawPalette; pUnkOuter: IUnknown): HResult; stdcall;
  1091.     function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1092.         out lplpDDSurface: IDirectDrawSurface7; pUnkOuter: IUnknown): HResult; stdcall;
  1093.     function DuplicateSurface(lpDDSurface: IDirectDrawSurface7;
  1094.         out lplpDupDDSurface: IDirectDrawSurface7): HResult; stdcall;
  1095.     function EnumDisplayModes(dwFlags: DWORD;
  1096.         const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer;
  1097.         lpEnumModesCallback: TDDEnumModesCallback2): HResult; stdcall;
  1098.     function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1099.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback7): HResult; stdcall;
  1100.     function FlipToGDISurface: HResult; stdcall;
  1101.     function GetCaps(var lpDDDriverCaps: TDDCaps; var lpDDHELCaps: TDDCaps): HResult; stdcall;
  1102.     function GetDisplayMode(var lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1103.     function GetFourCCCodes(var lpNumCodes, lpCodes: DWORD): HResult; stdcall;
  1104.     function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface7): HResult; stdcall;
  1105.     function GetMonitorFrequency(var lpdwFrequency: DWORD): HResult; stdcall;
  1106.     function GetScanLine(var lpdwScanLine: DWORD): HResult; stdcall;
  1107.     function GetVerticalBlankStatus(var lpbIsInVB: BOOL): HResult; stdcall;
  1108.     function Initialize(lpGUID: PGUID): HResult; stdcall;
  1109.     function RestoreDisplayMode: HResult; stdcall;
  1110.     function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall;
  1111.     function SetDisplayMode(dwWidth, dwHeight, dwBPP, dwRefreshRate: DWORD;
  1112.         dwFlags: DWORD): HResult; stdcall;
  1113.     function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1114.     // IDirectDraw2 methods
  1115.     function GetAvailableVidMem(var lpDDSCaps: TDDSCaps;
  1116.         var lpdwTotal, lpdwFree: DWORD): HResult; stdcall;
  1117.     // IDirectDraw4 methods
  1118.     function GetSurfaceFromDC(hdc: HDC; lpDDS: IDirectDrawSurface4): HResult; stdcall;
  1119.     function RestoreAllSurfaces: HResult; stdcall;
  1120.     function TestCooperativeLevel: HResult; stdcall;
  1121.     function GetDeviceIdentifier(var lpdddi: TDDDeviceIdentifier; dwFlags: DWORD): HResult; stdcall;
  1122.     // IDirectDraw7 methods
  1123.     function StartModeTest(var lpModesToTest: TSize; dwNumEntries: DWORD; dwFlags: DWORD): HResult; stdcall;
  1124.     function EvaluateMode(dwFlags: DWORD; var pSecondsUntilTimeout: DWORD): HResult; stdcall;
  1125.   end;
  1126.  
  1127. { IDirectDrawPalette Interface }
  1128.  
  1129.   IDirectDrawPalette = interface(IUnknown)
  1130.     ['{6C14DB84-A733-11CE-A521-0020AF0BE560}']
  1131.     // IDirectDrawPalette methods
  1132.     function GetCaps(varlpdwCaps: DWORD): HResult; stdcall;
  1133.     function GetEntries(dwFlags: DWORD; dwBase: DWORD; dwNumEntries: DWORD;
  1134.         lpEntries: PPaletteEntry): HResult; stdcall;
  1135.     function Initialize(lpDD: IDirectDraw; dwFlags: DWORD;
  1136.         lpDDColorTable: PPaletteEntry): HResult; stdcall;
  1137.     function SetEntries(dwFlags: DWORD; dwStartingEntry: DWORD;
  1138.         dwCount: DWORD; lpEntries: PPaletteEntry): HResult; stdcall;
  1139.   end;
  1140.  
  1141. { IDirectDrawClipper Interface }
  1142.  
  1143.   IDirectDrawClipper = interface(IUnknown)
  1144.     ['{6C14DB85-A733-11CE-A521-0020AF0BE560}']
  1145.     // IDirectDrawClipper methods
  1146.     function GetClipList(const lpRect: TRect; lpClipList: PRgnData;
  1147.         var lpdwSize: DWORD): HResult; stdcall;
  1148.     function GetHWnd(var lphWnd: HWND): HResult; stdcall;
  1149.     function Initialize(lpDD: IDirectDraw; dwFlags: DWORD): HResult; stdcall;
  1150.     function IsClipListChanged(var lpbChanged: BOOL): HResult; stdcall;
  1151.     function SetClipList(lpClipList: PRgnData; dwFlags: DWORD): HResult; stdcall;
  1152.     function SetHWnd(dwFlags: DWORD; hWnd: HWND): HResult; stdcall;
  1153.   end;
  1154.  
  1155. { IDirectDrawSurface Interface }
  1156.  
  1157.   IDirectDrawSurface = interface(IUnknown)
  1158.     ['{6C14DB81-A733-11CE-A521-0020AF0BE560}']
  1159.     // IDirectDrawSurface methods
  1160.     function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface): HResult; stdcall;
  1161.     function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall;
  1162.     function Blt(const lpDestRect: TRect; lpDDSrcSurface: IDirectDrawSurface;
  1163.         const lpSrcRect: TRect; dwFlags: DWORD; const lpDDBltFx: TDDBltFX): HResult; stdcall;
  1164.     function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1165.         dwFlags: DWORD): HResult; stdcall;
  1166.     function BltFast(dwX, dwY: DWORD; lpDDSrcSurface: IDirectDrawSurface;
  1167.         const lpSrcRect: TRect; dwTrans: DWORD): HResult; stdcall;
  1168.     function DeleteAttachedSurface(dwFlags: DWORD;
  1169.         lpDDSAttachedSurface: IDirectDrawSurface): HResult; stdcall;
  1170.     function EnumAttachedSurfaces(lpContext: Pointer;
  1171.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1172.     function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer;
  1173.         lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1174.     function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface;
  1175.         dwFlags: DWORD): HResult; stdcall;
  1176.     function GetAttachedSurface(var lpDDSCaps: TDDSCaps;
  1177.         out lplpDDAttachedSurface: IDirectDrawSurface): HResult; stdcall;
  1178.     function GetBltStatus(dwFlags: DWORD): HResult; stdcall;
  1179.     function GetCaps(var lpDDSCaps: TDDSCaps): HResult; stdcall;
  1180.     function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1181.     function GetColorKey(dwFlags: DWORD; var lpDDColorKey: TDDColorKey): HResult; stdcall;
  1182.     function GetDC(var lphDC: HDC): HResult; stdcall;
  1183.     function GetFlipStatus(dwFlags: DWORD): HResult; stdcall;
  1184.     function GetOverlayPosition(var lplX, lplY: Longint): HResult; stdcall;
  1185.     function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1186.     function GetPixelFormat(var lpDDPixelFormat: TDDPixelFormat): HResult; stdcall;
  1187.     function GetSurfaceDesc(var lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1188.     function Initialize(lpDD: IDirectDraw;
  1189.         const lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1190.     function IsLost: HResult; stdcall;
  1191.     function Lock(lpDestRect: PRect; var lpDDSurfaceDesc: TDDSurfaceDesc;
  1192.         dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1193.     function ReleaseDC(hDC: HDC): HResult; stdcall;
  1194.     function Restore: HResult; stdcall;
  1195.     function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1196.     function SetColorKey(dwFlags: DWORD; const lpDDColorKey: TDDColorKey): HResult; stdcall;
  1197.     function SetOverlayPosition(lX, lY: Longint): HResult; stdcall;
  1198.     function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1199.     function Unlock(lpSurfaceData: Pointer): HResult; stdcall;
  1200.     function UpdateOverlay(const lpSrcRect: TRect;
  1201.         lpDDDestSurface: IDirectDrawSurface; const lpDestRect: TRect;
  1202.         dwFlags: DWORD; const lpDDOverlayFx: TDDOverlayFX): HResult; stdcall;
  1203.     function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall;
  1204.     function UpdateOverlayZOrder(dwFlags: DWORD;
  1205.         lpDDSReference: IDirectDrawSurface): HResult; stdcall;
  1206.   end;
  1207.  
  1208. { IDirectDrawSurface2 Interface }
  1209.  
  1210.   IDirectDrawSurface2 = interface(IUnknown)
  1211.     ['{57805885-6EEC-11CF-9441-A82303C10E27}']
  1212.     // IDirectDrawSurface methods
  1213.     function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface2): HResult; stdcall;
  1214.     function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall;
  1215.     function Blt(const lpDestRect: TRect; lpDDSrcSurface: IDirectDrawSurface2;
  1216.         const lpSrcRect: TRect; dwFlags: DWORD; const lpDDBltFx: TDDBltFX): HResult; stdcall;
  1217.     function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1218.         dwFlags: DWORD): HResult; stdcall;
  1219.     function BltFast(dwX, dwY: DWORD; lpDDSrcSurface: IDirectDrawSurface2;
  1220.         const lpSrcRect: TRect; dwTrans: DWORD): HResult; stdcall;
  1221.     function DeleteAttachedSurface(dwFlags: DWORD;
  1222.         lpDDSAttachedSurface: IDirectDrawSurface2): HResult; stdcall;
  1223.     function EnumAttachedSurfaces(lpContext: Pointer;
  1224.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1225.     function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer;
  1226.         lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1227.     function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface2;
  1228.         dwFlags: DWORD): HResult; stdcall;
  1229.     function GetAttachedSurface(var lpDDSCaps: TDDSCaps;
  1230.         out lplpDDAttachedSurface: IDirectDrawSurface2): HResult; stdcall;
  1231.     function GetBltStatus(dwFlags: DWORD): HResult; stdcall;
  1232.     function GetCaps(var lpDDSCaps: TDDSCaps): HResult; stdcall;
  1233.     function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1234.     function GetColorKey(dwFlags: DWORD; var lpDDColorKey: TDDColorKey): HResult; stdcall;
  1235.     function GetDC(var lphDC: HDC): HResult; stdcall;
  1236.     function GetFlipStatus(dwFlags: DWORD): HResult; stdcall;
  1237.     function GetOverlayPosition(var lplX, lplY: Longint): HResult; stdcall;
  1238.     function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1239.     function GetPixelFormat(var lpDDPixelFormat: TDDPixelFormat): HResult; stdcall;
  1240.     function GetSurfaceDesc(var lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1241.     function Initialize(lpDD: IDirectDraw; const lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1242.     function IsLost: HResult; stdcall;
  1243.     function Lock(lpDestRect: PRect; const lpDDSurfaceDesc: TDDSurfaceDesc;
  1244.         dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1245.     function ReleaseDC(hDC: HDC): HResult; stdcall;
  1246.     function Restore: HResult; stdcall;
  1247.     function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1248.     function SetColorKey(dwFlags: DWORD; const lpDDColorKey: TDDColorKey): HResult; stdcall;
  1249.     function SetOverlayPosition(lX, lY: Longint): HResult; stdcall;
  1250.     function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1251.     function Unlock(lpSurfaceData: Pointer): HResult; stdcall;
  1252.     function UpdateOverlay(const lpSrcRect: TRect;
  1253.         lpDDDestSurface: IDirectDrawSurface2; const lpDestRect: TRect;
  1254.         dwFlags: DWORD; const lpDDOverlayFx: TDDOverlayFX): HResult; stdcall;
  1255.     function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall;
  1256.     function UpdateOverlayZOrder(dwFlags: DWORD;
  1257.         lpDDSReference: IDirectDrawSurface2): HResult; stdcall;
  1258.     // IDirectDrawSurface2 methods
  1259.     function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall;
  1260.     function PageLock(dwFlags: DWORD): HResult; stdcall;
  1261.     function PageUnlock(dwFlags: DWORD): HResult; stdcall;
  1262.   end;
  1263.  
  1264. { IDirectDrawSurface3 Interface }
  1265.  
  1266.   IDirectDrawSurface3 = interface(IUnknown)
  1267.     ['{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}']
  1268.     // IDirectDrawSurface methods
  1269.     function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface3): HResult; stdcall;
  1270.     function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall;
  1271.     function Blt(const lpDestRect: TRect; lpDDSrcSurface: IDirectDrawSurface3;
  1272.         const lpSrcRect: TRect; dwFlags: DWORD; const lpDDBltFx: TDDBltFX): HResult; stdcall;
  1273.     function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1274.         dwFlags: DWORD): HResult; stdcall;
  1275.     function BltFast(dwX, dwY: DWORD; lpDDSrcSurface: IDirectDrawSurface3;
  1276.         const lpSrcRect: TRect; dwTrans: DWORD): HResult; stdcall;
  1277.     function DeleteAttachedSurface(dwFlags: DWORD;
  1278.         lpDDSAttachedSurface: IDirectDrawSurface3): HResult; stdcall;
  1279.     function EnumAttachedSurfaces(lpContext: Pointer;
  1280.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1281.     function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer;
  1282.         lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall;
  1283.     function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface3;
  1284.         dwFlags: DWORD): HResult; stdcall;
  1285.     function GetAttachedSurface(var lpDDSCaps: TDDSCaps;
  1286.         out lplpDDAttachedSurface: IDirectDrawSurface3): HResult; stdcall;
  1287.     function GetBltStatus(dwFlags: DWORD): HResult; stdcall;
  1288.     function GetCaps(var lpDDSCaps: TDDSCaps): HResult; stdcall;
  1289.     function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1290.     function GetColorKey(dwFlags: DWORD; var lpDDColorKey: TDDColorKey): HResult; stdcall;
  1291.     function GetDC(var lphDC: HDC): HResult; stdcall;
  1292.     function GetFlipStatus(dwFlags: DWORD): HResult; stdcall;
  1293.     function GetOverlayPosition(var lplX, lplY: Longint): HResult; stdcall;
  1294.     function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1295.     function GetPixelFormat(var lpDDPixelFormat: TDDPixelFormat): HResult; stdcall;
  1296.     function GetSurfaceDesc(var lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1297.     function Initialize(lpDD: IDirectDraw; const lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall;
  1298.     function IsLost: HResult; stdcall;
  1299.     function Lock(lpDestRect: PRect; const lpDDSurfaceDesc: TDDSurfaceDesc;
  1300.         dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1301.     function ReleaseDC(hDC: HDC): HResult; stdcall;
  1302.     function Restore: HResult; stdcall;
  1303.     function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1304.     function SetColorKey(dwFlags: DWORD; const lpDDColorKey: TDDColorKey): HResult; stdcall;
  1305.     function SetOverlayPosition(lX, lY: Longint): HResult; stdcall;
  1306.     function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1307.     function Unlock(lpSurfaceData: Pointer): HResult; stdcall;
  1308.     function UpdateOverlay(const lpSrcRect: TRect;
  1309.         lpDDDestSurface: IDirectDrawSurface3; const lpDestRect: TRect;
  1310.         dwFlags: DWORD; const lpDDOverlayFx: TDDOverlayFX): HResult; stdcall;
  1311.     function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall;
  1312.     function UpdateOverlayZOrder(dwFlags: DWORD;
  1313.         lpDDSReference: IDirectDrawSurface3): HResult; stdcall;
  1314.     // IDirectDrawSurface2 methods
  1315.     function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall;
  1316.     function PageLock(dwFlags: DWORD): HResult; stdcall;
  1317.     function PageUnlock(dwFlags: DWORD): HResult; stdcall;
  1318.     // IDirectDrawSurface3 methods
  1319.     function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc; dwFlags: DWORD): HResult; stdcall;
  1320.   end;
  1321.  
  1322. { IDirectDrawSurface4 Interface }
  1323.  
  1324.   IDirectDrawSurface4 = interface(IUnknown)
  1325.     ['{0B2B8630-AD35-11D0-8EA6-00609797EA5B}']
  1326.     // IDirectDrawSurface methods
  1327.     function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface4): HResult; stdcall;
  1328.     function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall;
  1329.     function Blt(const lpDestRect: TRect; lpDDSrcSurface: IDirectDrawSurface4;
  1330.         const lpSrcRect: TRect; dwFlags: DWORD; const lpDDBltFx: TDDBltFX): HResult; stdcall;
  1331.     function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1332.         dwFlags: DWORD): HResult; stdcall;
  1333.     function BltFast(dwX, dwY: DWORD; lpDDSrcSurface: IDirectDrawSurface4;
  1334.         const lpSrcRect: TRect; dwTrans: DWORD): HResult; stdcall;
  1335.     function DeleteAttachedSurface(dwFlags: DWORD;
  1336.         lpDDSAttachedSurface: IDirectDrawSurface4): HResult; stdcall;
  1337.     function EnumAttachedSurfaces(lpContext: Pointer;
  1338.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback2): HResult; stdcall;
  1339.     function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer;
  1340.         lpfnCallback: TDDEnumSurfacesCallback2): HResult; stdcall;
  1341.     function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface4;
  1342.         dwFlags: DWORD): HResult; stdcall;
  1343.     function GetAttachedSurface(var lpDDSCaps: TDDSCaps2;
  1344.         out lplpDDAttachedSurface: IDirectDrawSurface4): HResult; stdcall;
  1345.     function GetBltStatus(dwFlags: DWORD): HResult; stdcall;
  1346.     function GetCaps(var lpDDSCaps: TDDSCaps2): HResult; stdcall;
  1347.     function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1348.     function GetColorKey(dwFlags: DWORD; var lpDDColorKey: TDDColorKey): HResult; stdcall;
  1349.     function GetDC(var lphDC: HDC): HResult; stdcall;
  1350.     function GetFlipStatus(dwFlags: DWORD): HResult; stdcall;
  1351.     function GetOverlayPosition(var lplX, lplY: Longint): HResult; stdcall;
  1352.     function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1353.     function GetPixelFormat(var lpDDPixelFormat: TDDPixelFormat): HResult; stdcall;
  1354.     function GetSurfaceDesc(var lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1355.     function Initialize(lpDD: IDirectDraw; const lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1356.     function IsLost: HResult; stdcall;
  1357.     function Lock(lpDestRect: PRect; const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1358.         dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1359.     function ReleaseDC(hDC: HDC): HResult; stdcall;
  1360.     function Restore: HResult; stdcall;
  1361.     function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1362.     function SetColorKey(dwFlags: DWORD; const lpDDColorKey: TDDColorKey): HResult; stdcall;
  1363.     function SetOverlayPosition(lX, lY: Longint): HResult; stdcall;
  1364.     function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1365.     function Unlock(lpSurfaceData: Pointer): HResult; stdcall;
  1366.     function UpdateOverlay(const lpSrcRect: TRect; lpDDDestSurface: IDirectDrawSurface4;
  1367.         const lpDestRect: TRect; dwFlags: DWORD; const lpDDOverlayFx: TDDOverlayFX): HResult; stdcall;
  1368.     function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall;
  1369.     function UpdateOverlayZOrder(dwFlags: DWORD; lpDDSReference: IDirectDrawSurface4): HResult; stdcall;
  1370.     // IDirectDrawSurface2 methods
  1371.     function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall;
  1372.     function PageLock(dwFlags: DWORD): HResult; stdcall;
  1373.     function PageUnlock(dwFlags: DWORD): HResult; stdcall;
  1374.     // IDirectDrawSurface3 methods
  1375.     function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc2; dwFlags: DWORD): HResult; stdcall;
  1376.     // IDirectDrawSurface4 methods
  1377.     function SetPrivateData(const guidTag: TGUID; lpData: Pointer;
  1378.       cbSize: DWORD; dwFlags: DWORD): HResult; stdcall;
  1379.     function GetPrivateData(const guidTag: TGUID; lpData: Pointer;
  1380.       var cbSize: DWORD): HResult; stdcall;
  1381.     function FreePrivateData(const guidTag: TGUID): HResult; stdcall;
  1382.     function GetUniquenessValue(var lpValue: DWORD): HResult; stdcall;
  1383.     function ChangeUniquenessValue: HResult; stdcall;
  1384.   end;
  1385.  
  1386. { IDirectDrawSurface7 Interface }
  1387.  
  1388.   IDirectDrawSurface7 = interface(IUnknown)
  1389.     ['{06675A80-3B9B-11D2-B92F-00609797EA5B}']
  1390.     // IDirectDrawSurface methods
  1391.     function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface7): HResult; stdcall;
  1392.     function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall;
  1393.     function Blt(const lpDestRect: TRect; lpDDSrcSurface: IDirectDrawSurface7;
  1394.         const lpSrcRect: TRect; dwFlags: DWORD; const lpDDBltFx: TDDBltFX): HResult; stdcall;
  1395.     function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1396.         dwFlags: DWORD): HResult; stdcall;
  1397.     function BltFast(dwX, dwY: DWORD; lpDDSrcSurface: IDirectDrawSurface7;
  1398.         const lpSrcRect: TRect; dwTrans: DWORD): HResult; stdcall;
  1399.     function DeleteAttachedSurface(dwFlags: DWORD;
  1400.         lpDDSAttachedSurface: IDirectDrawSurface7): HResult; stdcall;
  1401.     function EnumAttachedSurfaces(lpContext: Pointer;
  1402.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback7): HResult; stdcall;
  1403.     function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer;
  1404.         lpfnCallback: TDDEnumSurfacesCallback7): HResult; stdcall;
  1405.     function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface7;
  1406.         dwFlags: DWORD): HResult; stdcall;
  1407.     function GetAttachedSurface(var lpDDSCaps: TDDSCaps2;
  1408.         out lplpDDAttachedSurface: IDirectDrawSurface7): HResult; stdcall;
  1409.     function GetBltStatus(dwFlags: DWORD): HResult; stdcall;
  1410.     function GetCaps(var lpDDSCaps: TDDSCaps2): HResult; stdcall;
  1411.     function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1412.     function GetColorKey(dwFlags: DWORD; var lpDDColorKey: TDDColorKey): HResult; stdcall;
  1413.     function GetDC(var lphDC: HDC): HResult; stdcall;
  1414.     function GetFlipStatus(dwFlags: DWORD): HResult; stdcall;
  1415.     function GetOverlayPosition(var lplX, lplY: Longint): HResult; stdcall;
  1416.     function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1417.     function GetPixelFormat(var lpDDPixelFormat: TDDPixelFormat): HResult; stdcall;
  1418.     function GetSurfaceDesc(var lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1419.     function Initialize(lpDD: IDirectDraw; const lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall;
  1420.     function IsLost: HResult; stdcall;
  1421.     function Lock(lpDestRect: PRect; const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1422.         dwFlags: DWORD; hEvent: THandle): HResult; stdcall;
  1423.     function ReleaseDC(hDC: HDC): HResult; stdcall;
  1424.     function Restore: HResult; stdcall;
  1425.     function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall;
  1426.     function SetColorKey(dwFlags: DWORD; const lpDDColorKey: TDDColorKey): HResult; stdcall;
  1427.     function SetOverlayPosition(lX, lY: Longint): HResult; stdcall;
  1428.     function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall;
  1429.     function Unlock(lpSurfaceData: Pointer): HResult; stdcall;
  1430.     function UpdateOverlay(const lpSrcRect: TRect; lpDDDestSurface: IDirectDrawSurface7;
  1431.         const lpDestRect: TRect; dwFlags: DWORD; const lpDDOverlayFx: TDDOverlayFX): HResult; stdcall;
  1432.     function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall;
  1433.     function UpdateOverlayZOrder(dwFlags: DWORD; lpDDSReference: IDirectDrawSurface7): HResult; stdcall;
  1434.     // IDirectDrawSurface2 methods
  1435.     function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall;
  1436.     function PageLock(dwFlags: DWORD): HResult; stdcall;
  1437.     function PageUnlock(dwFlags: DWORD): HResult; stdcall;
  1438.     // IDirectDrawSurface3 methods
  1439.     function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc2; dwFlags: DWORD): HResult; stdcall;
  1440.     // IDirectDrawSurface4 methods
  1441.     function SetPrivateData(const guidTag: TGUID; lpData: Pointer;
  1442.       cbSize: DWORD; dwFlags: DWORD): HResult; stdcall;
  1443.     function GetPrivateData(const guidTag: TGUID; lpData: Pointer;
  1444.       var cbSize: DWORD): HResult; stdcall;
  1445.     function FreePrivateData(const guidTag: TGUID): HResult; stdcall;
  1446.     function GetUniquenessValue(var lpValue: DWORD): HResult; stdcall;
  1447.     function ChangeUniquenessValue: HResult; stdcall;
  1448.     // Moved Texture7 methods here
  1449.     function SetPriority(dwPriority: DWORD): HResult; stdcall;
  1450.     function GetPriority(var lpdwPriority: DWORD): HResult; stdcall;
  1451.     function SetLOD(dwMaxLOD: DWORD): HResult; stdcall;
  1452.     function GetLOD(var lpdwMaxLOD: DWORD): HResult; stdcall;
  1453.   end;
  1454.  
  1455. { IDirectDrawColorControl Interface }
  1456.  
  1457.   IDirectDrawColorControl = interface(IUnknown)
  1458.     ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}']
  1459.     // IDirectDrawColorControl methods
  1460.     function GetColorControls(var lpColorControl: TDDColorControl): HResult; stdcall;
  1461.     function SetColorControls(const lpColorControl: TDDColorControl): HResult; stdcall;
  1462.   end;
  1463.  
  1464. { IDirectDrawGammaControl Interface }
  1465.  
  1466.   IDirectDrawGammaControl = interface(IUnknown)
  1467.     ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}']
  1468.     // IDirectDrawGammaControl methods
  1469.     function GetGammaRamp(dwFlags: DWORD; var lpRampData: TDDGammaRamp): HResult; stdcall;
  1470.     function SetGammaRamp(dwFlags: DWORD; const lpRampData: TDDGammaRamp): HResult; stdcall;
  1471.   end;
  1472.  
  1473. const
  1474. { Flags for DirectDrawEnumerateEx }
  1475.   DDENUM_ATTACHEDSECONDARYDEVICES = $00000001;
  1476.   DDENUM_DETACHEDSECONDARYDEVICES = $00000002;
  1477.   DDENUM_NONDISPLAYDEVICES        = $00000004;
  1478.  
  1479. { Flags for the IDirectDraw4.GetDeviceIdentifier method }
  1480.   DDGDI_GETHOSTIDENTIFIER = $00000001;
  1481.  
  1482. { ddsCaps field is valid. }
  1483.   DDSD_CAPS               = $00000001;     // default
  1484.   DDSD_HEIGHT             = $00000002;
  1485.   DDSD_WIDTH              = $00000004;
  1486.   DDSD_PITCH              = $00000008;
  1487.   DDSD_BACKBUFFERCOUNT    = $00000020;
  1488.   DDSD_ZBUFFERBITDEPTH    = $00000040;
  1489.   DDSD_ALPHABITDEPTH      = $00000080;
  1490.   DDSD_LPSURFACE          = $00000800;
  1491.   DDSD_PIXELFORMAT        = $00001000;
  1492.   DDSD_CKDESTOVERLAY      = $00002000;
  1493.   DDSD_CKDESTBLT          = $00004000;
  1494.   DDSD_CKSRCOVERLAY       = $00008000;
  1495.   DDSD_CKSRCBLT           = $00010000;
  1496.   DDSD_MIPMAPCOUNT        = $00020000;
  1497.   DDSD_REFRESHRATE        = $00040000;
  1498.   DDSD_LINEARSIZE         = $00080000;
  1499.   DDSD_TEXTURESTAGE       = $00100000;
  1500.   DDSD_FVF                = $00200000;
  1501.   DDSD_SRCVBHANDLE        = $00400000;
  1502.   DDSD_ALL                = $007ff9ee;
  1503.  
  1504. { DirectDraw Driver Capability Flags }
  1505.  
  1506.   DDCAPS_3D                   = $00000001;
  1507.   DDCAPS_ALIGNBOUNDARYDEST    = $00000002;
  1508.   DDCAPS_ALIGNSIZEDEST        = $00000004;
  1509.   DDCAPS_ALIGNBOUNDARYSRC     = $00000008;
  1510.   DDCAPS_ALIGNSIZESRC         = $00000010;
  1511.   DDCAPS_ALIGNSTRIDE          = $00000020;
  1512.   DDCAPS_BLT                  = $00000040;
  1513.   DDCAPS_BLTQUEUE             = $00000080;
  1514.   DDCAPS_BLTFOURCC            = $00000100;
  1515.   DDCAPS_BLTSTRETCH           = $00000200;
  1516.   DDCAPS_GDI                  = $00000400;
  1517.   DDCAPS_OVERLAY              = $00000800;
  1518.   DDCAPS_OVERLAYCANTCLIP      = $00001000;
  1519.   DDCAPS_OVERLAYFOURCC        = $00002000;
  1520.   DDCAPS_OVERLAYSTRETCH       = $00004000;
  1521.   DDCAPS_PALETTE              = $00008000;
  1522.   DDCAPS_PALETTEVSYNC         = $00010000;
  1523.   DDCAPS_READSCANLINE         = $00020000;
  1524.   DDCAPS_STEREOVIEW           = $00040000;
  1525.   DDCAPS_VBI                  = $00080000;
  1526.   DDCAPS_ZBLTS                = $00100000;
  1527.   DDCAPS_ZOVERLAYS            = $00200000;
  1528.   DDCAPS_COLORKEY             = $00400000;
  1529.   DDCAPS_ALPHA                = $00800000;
  1530.   DDCAPS_COLORKEYHWASSIST     = $01000000;
  1531.   DDCAPS_NOHARDWARE           = $02000000;
  1532.   DDCAPS_BLTCOLORFILL         = $04000000;
  1533.   DDCAPS_BANKSWITCHED         = $08000000;
  1534.   DDCAPS_BLTDEPTHFILL         = $10000000;
  1535.   DDCAPS_CANCLIP              = $20000000;
  1536.   DDCAPS_CANCLIPSTRETCHED     = $40000000;
  1537.   DDCAPS_CANBLTSYSMEM         = $80000000;
  1538.  
  1539. { More DirectDraw Driver Capability Flags (dwCaps2) }
  1540.  
  1541.   DDCAPS2_CERTIFIED            = $00000001;
  1542.   DDCAPS2_NO2DDURING3DSCENE    = $00000002;
  1543.   DDCAPS2_VIDEOPORT            = $00000004;
  1544.   DDCAPS2_AUTOFLIPOVERLAY      = $00000008;
  1545.   DDCAPS2_CANBOBINTERLEAVED    = $00000010;
  1546.   DDCAPS2_CANBOBNONINTERLEAVED = $00000020;
  1547.   DDCAPS2_COLORCONTROLOVERLAY  = $00000040;
  1548.   DDCAPS2_COLORCONTROLPRIMARY  = $00000080;
  1549.   DDCAPS2_CANDROPZ16BIT        = $00000100;
  1550.   DDCAPS2_NONLOCALVIDMEM       = $00000200;
  1551.   DDCAPS2_NONLOCALVIDMEMCAPS   = $00000400;
  1552.   DDCAPS2_NOPAGELOCKREQUIRED   = $00000800;
  1553.   DDCAPS2_WIDESURFACES         = $00001000;
  1554.   DDCAPS2_CANFLIPODDEVEN       = $00002000;
  1555.   DDCAPS2_CANBOBHARDWARE       = $00004000;
  1556.   DDCAPS2_COPYFOURCC           = $00008000;
  1557.   DDCAPS2_PRIMARYGAMMA         = $00020000;
  1558.   DDCAPS2_CANRENDERWINDOWED    = $00080000;
  1559.   DDCAPS2_CANCALIBRATEGAMMA    = $00100000;
  1560.   DDCAPS2_FLIPINTERVAL         = $00200000;
  1561.   DDCAPS2_FLIPNOVSYNC          = $00400000;
  1562.   DDCAPS2_CANMANAGETEXTURE     = $00800000;
  1563.   DDCAPS2_TEXMANINNONLOCALVIDMEM = $01000000;
  1564.   DDCAPS2_STEREO                 = $02000000;
  1565.   DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL = $04000000;
  1566.  
  1567. { DirectDrawSurface Capability Flags }
  1568.  
  1569.   DDSCAPS_RESERVED1           = $00000001; { DDSCAPS_3D }
  1570.   DDSCAPS_ALPHA               = $00000002;
  1571.   DDSCAPS_BACKBUFFER          = $00000004;
  1572.   DDSCAPS_COMPLEX             = $00000008;
  1573.   DDSCAPS_FLIP                = $00000010;
  1574.   DDSCAPS_FRONTBUFFER         = $00000020;
  1575.   DDSCAPS_OFFSCREENPLAIN      = $00000040;
  1576.   DDSCAPS_OVERLAY             = $00000080;
  1577.   DDSCAPS_PALETTE             = $00000100;
  1578.   DDSCAPS_PRIMARYSURFACE      = $00000200;
  1579.   DDSCAPS_RESERVED3           = $00000400; { DDSCAPS_PRIMARYSURFACELEFT }
  1580.   DDSCAPS_SYSTEMMEMORY        = $00000800;
  1581.   DDSCAPS_TEXTURE             = $00001000;
  1582.   DDSCAPS_3DDEVICE            = $00002000;
  1583.   DDSCAPS_VIDEOMEMORY         = $00004000;
  1584.   DDSCAPS_VISIBLE             = $00008000;
  1585.   DDSCAPS_WRITEONLY           = $00010000;
  1586.   DDSCAPS_ZBUFFER             = $00020000;
  1587.   DDSCAPS_OWNDC               = $00040000;
  1588.   DDSCAPS_LIVEVIDEO           = $00080000;
  1589.   DDSCAPS_HWCODEC             = $00100000;
  1590.   DDSCAPS_MODEX               = $00200000;
  1591.   DDSCAPS_MIPMAP              = $00400000;
  1592.   DDSCAPS_RESERVED2           = $00800000;
  1593.   DDSCAPS_ALLOCONLOAD         = $04000000;
  1594.   DDSCAPS_VIDEOPORT           = $08000000;
  1595.   DDSCAPS_LOCALVIDMEM         = $10000000;
  1596.   DDSCAPS_NONLOCALVIDMEM      = $20000000;
  1597.   DDSCAPS_STANDARDVGAMODE     = $40000000;
  1598.   DDSCAPS_OPTIMIZED           = $80000000;
  1599.  
  1600. { DirectDrawSurface Capability Flags 2 }
  1601.  
  1602.   DDSCAPS2_HARDWAREDEINTERLACE = $00000002;
  1603.   DDSCAPS2_HINTDYNAMIC         = $00000004;
  1604.   DDSCAPS2_HINTSTATIC          = $00000008;
  1605.   DDSCAPS2_TEXTUREMANAGE       = $00000010;
  1606.   DDSCAPS2_RESERVED1           = $00000020;
  1607.   DDSCAPS2_RESERVED2           = $00000040;
  1608.   DDSCAPS2_OPAQUE              = $00000080;
  1609.   DDSCAPS2_HINTANTIALIASING    = $00000100;
  1610.   DDSCAPS2_CUBEMAP             = $00000200;
  1611.   DDSCAPS2_CUBEMAP_POSITIVEX   = $00000400;
  1612.   DDSCAPS2_CUBEMAP_NEGATIVEX   = $00000800;
  1613.   DDSCAPS2_CUBEMAP_POSITIVEY   = $00001000;
  1614.   DDSCAPS2_CUBEMAP_NEGATIVEY   = $00002000;
  1615.   DDSCAPS2_CUBEMAP_POSITIVEZ   = $00004000;
  1616.   DDSCAPS2_CUBEMAP_NEGATIVEZ   = $00008000;
  1617.  
  1618.   DDSCAPS2_CUBEMAP_ALLFACES    =
  1619.     DDSCAPS2_CUBEMAP_POSITIVEX or DDSCAPS2_CUBEMAP_NEGATIVEX or
  1620.     DDSCAPS2_CUBEMAP_POSITIVEY or DDSCAPS2_CUBEMAP_NEGATIVEY or
  1621.     DDSCAPS2_CUBEMAP_POSITIVEZ or DDSCAPS2_CUBEMAP_NEGATIVEZ;
  1622.  
  1623.   DDSCAPS2_MIPMAPSUBLEVEL      = $00010000;
  1624.   DDSCAPS2_D3DTEXTUREMANAGE    = $00020000;
  1625.   DDSCAPS2_DONOTPERSIST        = $00040000;
  1626.   DDSCAPS2_STEREOSURFACELEFT   = $00080000;
  1627.  
  1628. { TDDOptSurfaceDesc flags }
  1629.  
  1630.   DDOSD_GUID              = $00000001;
  1631.   DDOSD_COMPRESSION_RATIO = $00000002;
  1632.   DDOSD_SCAPS             = $00000004;
  1633.   DDOSD_OSCAPS            = $00000008;
  1634.   DDOSD_ALL               = $0000000F;
  1635.  
  1636. { ddOSCaps field is valid. }
  1637.  
  1638.   DDOSDCAPS_OPTCOMPRESSED    = $00000001;
  1639.   DDOSDCAPS_OPTREORDERED     = $00000002;
  1640.   DDOSDCAPS_MONOLITHICMIPMAP = $00000004;
  1641.   DDOSDCAPS_VALIDSCAPS       = $30004800;
  1642.   DDOSDCAPS_VALIDOSCAPS      = $00000007;
  1643.  
  1644. { DirectDraw FX Alpha Capability Flags }
  1645.  
  1646.   DDFXALPHACAPS_BLTALPHAEDGEBLEND         = $00000001;
  1647.   DDFXALPHACAPS_BLTALPHAPIXELS            = $00000002;
  1648.   DDFXALPHACAPS_BLTALPHAPIXELSNEG         = $00000004;
  1649.   DDFXALPHACAPS_BLTALPHASURFACES          = $00000008;
  1650.   DDFXALPHACAPS_BLTALPHASURFACESNEG       = $00000010;
  1651.   DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND     = $00000020;
  1652.   DDFXALPHACAPS_OVERLAYALPHAPIXELS        = $00000040;
  1653.   DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG     = $00000080;
  1654.   DDFXALPHACAPS_OVERLAYALPHASURFACES      = $00000100;
  1655.   DDFXALPHACAPS_OVERLAYALPHASURFACESNEG   = $00000200;
  1656.  
  1657. { DirectDraw FX Capability Flags }
  1658.  
  1659.   DDFXCAPS_BLTARITHSTRETCHY       = $00000020;
  1660.   DDFXCAPS_BLTARITHSTRETCHYN      = $00000010;
  1661.   DDFXCAPS_BLTMIRRORLEFTRIGHT     = $00000040;
  1662.   DDFXCAPS_BLTMIRRORUPDOWN        = $00000080;
  1663.   DDFXCAPS_BLTROTATION            = $00000100;
  1664.   DDFXCAPS_BLTROTATION90          = $00000200;
  1665.   DDFXCAPS_BLTSHRINKX             = $00000400;
  1666.   DDFXCAPS_BLTSHRINKXN            = $00000800;
  1667.   DDFXCAPS_BLTSHRINKY             = $00001000;
  1668.   DDFXCAPS_BLTSHRINKYN            = $00002000;
  1669.   DDFXCAPS_BLTSTRETCHX            = $00004000;
  1670.   DDFXCAPS_BLTSTRETCHXN           = $00008000;
  1671.   DDFXCAPS_BLTSTRETCHY            = $00010000;
  1672.   DDFXCAPS_BLTSTRETCHYN           = $00020000;
  1673.   DDFXCAPS_OVERLAYARITHSTRETCHY   = $00040000;
  1674.   DDFXCAPS_OVERLAYARITHSTRETCHYN  = $00000008;
  1675.   DDFXCAPS_OVERLAYSHRINKX         = $00080000;
  1676.   DDFXCAPS_OVERLAYSHRINKXN        = $00100000;
  1677.   DDFXCAPS_OVERLAYSHRINKY         = $00200000;
  1678.   DDFXCAPS_OVERLAYSHRINKYN        = $00400000;
  1679.   DDFXCAPS_OVERLAYSTRETCHX        = $00800000;
  1680.   DDFXCAPS_OVERLAYSTRETCHXN       = $01000000;
  1681.   DDFXCAPS_OVERLAYSTRETCHY        = $02000000;
  1682.   DDFXCAPS_OVERLAYSTRETCHYN       = $04000000;
  1683.   DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000;
  1684.   DDFXCAPS_OVERLAYMIRRORUPDOWN    = $10000000;
  1685.   DDFXCAPS_BLTALPHA               = $00000001;
  1686.   DDFXCAPS_BLTTRANSFORM           = $00000002;
  1687.   DDFXCAPS_BLTFILTER              = DDFXCAPS_BLTARITHSTRETCHY;
  1688.   DDFXCAPS_OVERLAYALPHA           = $00000004;
  1689.   DDFXCAPS_OVERLAYTRANSFORM       = $20000000;
  1690.   DDFXCAPS_OVERLAYFILTER          = DDFXCAPS_OVERLAYARITHSTRETCHY;
  1691.  
  1692. { DirectDraw Stereo View Capabilities }
  1693.  
  1694.   DDSVCAPS_RESERVED1              = $00000001;
  1695.   DDSVCAPS_RESERVED2              = $00000002;
  1696.   DDSVCAPS_RESERVED3              = $00000004;
  1697.   DDSVCAPS_RESERVED4              = $00000008;
  1698.   DDSVCAPS_STEREOSEQUENTIAL       = $00000010;
  1699.  
  1700. { DirectDrawPalette Capabilities }
  1701.  
  1702.   DDPCAPS_4BIT               = $00000001;
  1703.   DDPCAPS_8BITENTRIES        = $00000002;
  1704.   DDPCAPS_8BIT               = $00000004;
  1705.   DDPCAPS_INITIALIZE         = $00000008;
  1706.   DDPCAPS_PRIMARYSURFACE     = $00000010;
  1707.   DDPCAPS_PRIMARYSURFACELEFT = $00000020;
  1708.   DDPCAPS_ALLOW256           = $00000040;
  1709.   DDPCAPS_VSYNC              = $00000080;
  1710.   DDPCAPS_1BIT               = $00000100;
  1711.   DDPCAPS_2BIT               = $00000200;
  1712.   DDPCAPS_ALPHA              = $00000400;
  1713.  
  1714. { DirectDraw BitDepth Constants }
  1715.  
  1716.   DDBD_1  = $00004000;
  1717.   DDBD_2  = $00002000;
  1718.   DDBD_4  = $00001000;
  1719.   DDBD_8  = $00000800;
  1720.   DDBD_16 = $00000400;
  1721.   DDBD_24 = $00000200;
  1722.   DDBD_32 = $00000100;
  1723.  
  1724. { DirectDraw Set/Get Color Key Flags }
  1725.  
  1726.   DDCKEY_COLORSPACE  = $00000001;
  1727.   DDCKEY_DESTBLT     = $00000002;
  1728.   DDCKEY_DESTOVERLAY = $00000004;
  1729.   DDCKEY_SRCBLT      = $00000008;
  1730.   DDCKEY_SRCOVERLAY  = $00000010;
  1731.  
  1732. { DirectDraw Color Key Capability Flags }
  1733.  
  1734.   DDCKEYCAPS_DESTBLT                = $00000001;
  1735.   DDCKEYCAPS_DESTBLTCLRSPACE        = $00000002;
  1736.   DDCKEYCAPS_DESTBLTCLRSPACEYUV     = $00000004;
  1737.   DDCKEYCAPS_DESTBLTYUV             = $00000008;
  1738.   DDCKEYCAPS_DESTOVERLAY            = $00000010;
  1739.   DDCKEYCAPS_DESTOVERLAYCLRSPACE    = $00000020;
  1740.   DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV = $00000040;
  1741.   DDCKEYCAPS_DESTOVERLAYONEACTIVE   = $00000080;
  1742.   DDCKEYCAPS_DESTOVERLAYYUV         = $00000100;
  1743.   DDCKEYCAPS_SRCBLT                 = $00000200;
  1744.   DDCKEYCAPS_SRCBLTCLRSPACE         = $00000400;
  1745.   DDCKEYCAPS_SRCBLTCLRSPACEYUV      = $00000800;
  1746.   DDCKEYCAPS_SRCBLTYUV              = $00001000;
  1747.   DDCKEYCAPS_SRCOVERLAY             = $00002000;
  1748.   DDCKEYCAPS_SRCOVERLAYCLRSPACE     = $00004000;
  1749.   DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV  = $00008000;
  1750.   DDCKEYCAPS_SRCOVERLAYONEACTIVE    = $00010000;
  1751.   DDCKEYCAPS_SRCOVERLAYYUV          = $00020000;
  1752.   DDCKEYCAPS_NOCOSTOVERLAY          = $00040000;
  1753.  
  1754. { DirectDraw PixelFormat Flags }
  1755.  
  1756.   DDPF_ALPHAPIXELS       = $00000001;
  1757.   DDPF_ALPHA             = $00000002;
  1758.   DDPF_FOURCC            = $00000004;
  1759.   DDPF_PALETTEINDEXED4   = $00000008;
  1760.   DDPF_PALETTEINDEXEDTO8 = $00000010;
  1761.   DDPF_PALETTEINDEXED8   = $00000020;
  1762.   DDPF_RGB               = $00000040;
  1763.   DDPF_COMPRESSED        = $00000080;
  1764.   DDPF_RGBTOYUV          = $00000100;
  1765.   DDPF_YUV               = $00000200;
  1766.   DDPF_ZBUFFER           = $00000400;
  1767.   DDPF_PALETTEINDEXED1   = $00000800;
  1768.   DDPF_PALETTEINDEXED2   = $00001000;
  1769.   DDPF_ZPIXELS           = $00002000;
  1770.   DDPF_STENCILBUFFER     = $00004000;
  1771.   DDPF_ALPHAPREMULT      = $00008000;
  1772.   DDPF_LUMINANCE         = $00020000;
  1773.   DDPF_BUMPLUMINANCE     = $00040000;
  1774.   DDPF_BUMPDUDV          = $00080000;
  1775.  
  1776. { DirectDraw SetDisplayMode Flags }
  1777.  
  1778.   DDSDM_STANDARDVGAMODE  = $00000001;
  1779.  
  1780. { DirectDraw EnumDisplayModes Flags }
  1781.  
  1782.   DDEDM_REFRESHRATES     = $00000001;
  1783.   DDEDM_STANDARDVGAMODES = $00000002;
  1784.  
  1785. { DirectDraw EnumSurfaces Flags }
  1786.  
  1787.   DDENUMSURFACES_ALL           = $00000001;
  1788.   DDENUMSURFACES_MATCH         = $00000002;
  1789.   DDENUMSURFACES_NOMATCH       = $00000004;
  1790.   DDENUMSURFACES_CANBECREATED  = $00000008;
  1791.   DDENUMSURFACES_DOESEXIST     = $00000010;
  1792.  
  1793. { DirectDraw SetCooperativeLevel Flags }
  1794.  
  1795.   DDSCL_FULLSCREEN          = $00000001;
  1796.   DDSCL_ALLOWREBOOT         = $00000002;
  1797.   DDSCL_NOWINDOWCHANGES     = $00000004;
  1798.   DDSCL_NORMAL              = $00000008;
  1799.   DDSCL_EXCLUSIVE           = $00000010;
  1800.   DDSCL_ALLOWMODEX          = $00000040;
  1801.   DDSCL_SETFOCUSWINDOW      = $00000080;
  1802.   DDSCL_SETDEVICEWINDOW     = $00000100;
  1803.   DDSCL_CREATEDEVICEWINDOW  = $00000200;
  1804.   DDSCL_MULTITHREADED       = $00000400;
  1805.   DDSCL_FPUSETUP            = $00000800;
  1806.   DDSCL_FPUPRESERVE         = $00001000;
  1807.  
  1808. { DirectDraw Blt Flags }
  1809.  
  1810.   DDBLT_ALPHADEST                = $00000001;
  1811.   DDBLT_ALPHADESTCONSTOVERRIDE   = $00000002;
  1812.   DDBLT_ALPHADESTNEG             = $00000004;
  1813.   DDBLT_ALPHADESTSURFACEOVERRIDE = $00000008;
  1814.   DDBLT_ALPHAEDGEBLEND           = $00000010;
  1815.   DDBLT_ALPHASRC                 = $00000020;
  1816.   DDBLT_ALPHASRCCONSTOVERRIDE    = $00000040;
  1817.   DDBLT_ALPHASRCNEG              = $00000080;
  1818.   DDBLT_ALPHASRCSURFACEOVERRIDE  = $00000100;
  1819.   DDBLT_ASYNC                    = $00000200;
  1820.   DDBLT_COLORFILL                = $00000400;
  1821.   DDBLT_DDFX                     = $00000800;
  1822.   DDBLT_DDROPS                   = $00001000;
  1823.   DDBLT_KEYDEST                  = $00002000;
  1824.   DDBLT_KEYDESTOVERRIDE          = $00004000;
  1825.   DDBLT_KEYSRC                   = $00008000;
  1826.   DDBLT_KEYSRCOVERRIDE           = $00010000;
  1827.   DDBLT_ROP                      = $00020000;
  1828.   DDBLT_ROTATIONANGLE            = $00040000;
  1829.   DDBLT_ZBUFFER                  = $00080000;
  1830.   DDBLT_ZBUFFERDESTCONSTOVERRIDE = $00100000;
  1831.   DDBLT_ZBUFFERDESTOVERRIDE      = $00200000;
  1832.   DDBLT_ZBUFFERSRCCONSTOVERRIDE  = $00400000;
  1833.   DDBLT_ZBUFFERSRCOVERRIDE       = $00800000;
  1834.   DDBLT_WAIT                     = $01000000;
  1835.   DDBLT_DEPTHFILL                = $02000000;
  1836.   DDBLT_DONOTWAIT                = $08000000;
  1837.  
  1838. { BltFast Flags }
  1839.  
  1840.   DDBLTFAST_NOCOLORKEY   = $00000000;
  1841.   DDBLTFAST_SRCCOLORKEY  = $00000001;
  1842.   DDBLTFAST_DESTCOLORKEY = $00000002;
  1843.   DDBLTFAST_WAIT         = $00000010;
  1844.   DDBLTFAST_DONOTWAIT    = $00000020;
  1845.  
  1846. { Flip Flags }
  1847.  
  1848.   DDFLIP_WAIT      = $00000001;
  1849.   DDFLIP_EVEN      = $00000002;
  1850.   DDFLIP_ODD       = $00000004;
  1851.   DDFLIP_NOVSYNC   = $00000008;
  1852.   DDFLIP_INTERVAL2 = $02000000;
  1853.   DDFLIP_INTERVAL3 = $03000000;
  1854.   DDFLIP_INTERVAL4 = $04000000;
  1855.   DDFLIP_STEREO    = $00000010;
  1856.   DDFLIP_DONOTWAIT = $00000020;
  1857.  
  1858. { DirectDraw Surface Overlay Flags }
  1859.  
  1860.   DDOVER_ALPHADEST                = $00000001;
  1861.   DDOVER_ALPHADESTCONSTOVERRIDE   = $00000002;
  1862.   DDOVER_ALPHADESTNEG             = $00000004;
  1863.   DDOVER_ALPHADESTSURFACEOVERRIDE = $00000008;
  1864.   DDOVER_ALPHAEDGEBLEND           = $00000010;
  1865.   DDOVER_ALPHASRC                 = $00000020;
  1866.   DDOVER_ALPHASRCCONSTOVERRIDE    = $00000040;
  1867.   DDOVER_ALPHASRCNEG              = $00000080;
  1868.   DDOVER_ALPHASRCSURFACEOVERRIDE  = $00000100;
  1869.   DDOVER_HIDE                     = $00000200;
  1870.   DDOVER_KEYDEST                  = $00000400;
  1871.   DDOVER_KEYDESTOVERRIDE          = $00000800;
  1872.   DDOVER_KEYSRC                   = $00001000;
  1873.   DDOVER_KEYSRCOVERRIDE           = $00002000;
  1874.   DDOVER_SHOW                     = $00004000;
  1875.   DDOVER_ADDDIRTYRECT             = $00008000;
  1876.   DDOVER_REFRESHDIRTYRECTS        = $00010000;
  1877.   DDOVER_REFRESHALL               = $00020000;
  1878.   DDOVER_DDFX                     = $00080000;
  1879.   DDOVER_AUTOFLIP                 = $00100000;
  1880.   DDOVER_BOB                      = $00200000;
  1881.   DDOVER_OVERRIDEBOBWEAVE         = $00400000;
  1882.   DDOVER_INTERLEAVED              = $00800000;
  1883.   DDOVER_BOBHARDWARE              = $01000000;
  1884.   DDOVER_ARGBSCALEFACTORS         = $02000000;
  1885.   DDOVER_DEGRADEARGBSCALING       = $04000000;
  1886.  
  1887. { DirectDrawSurface Lock Flags }
  1888.  
  1889.   DDLOCK_SURFACEMEMORYPTR  = $00000000;    // default
  1890.   DDLOCK_WAIT              = $00000001;
  1891.   DDLOCK_EVENT             = $00000002;
  1892.   DDLOCK_READONLY          = $00000010;
  1893.   DDLOCK_WRITEONLY         = $00000020;
  1894.   DDLOCK_NOSYSLOCK         = $00000800;
  1895.   DDLOCK_NOOVERWRITE       = $00001000;
  1896.   DDLOCK_DISCARDCONTENTS   = $00002000;
  1897.   DDLOCK_OKTOSWAP          = $00002000;
  1898.   DDLOCK_DONOTWAIT         = $00004000;
  1899.  
  1900. { DirectDrawSurface Blt FX Flags }
  1901.  
  1902.   DDBLTFX_ARITHSTRETCHY    = $00000001;
  1903.   DDBLTFX_MIRRORLEFTRIGHT  = $00000002;
  1904.   DDBLTFX_MIRRORUPDOWN     = $00000004;
  1905.   DDBLTFX_NOTEARING        = $00000008;
  1906.   DDBLTFX_ROTATE180        = $00000010;
  1907.   DDBLTFX_ROTATE270        = $00000020;
  1908.   DDBLTFX_ROTATE90         = $00000040;
  1909.   DDBLTFX_ZBUFFERRANGE     = $00000080;
  1910.   DDBLTFX_ZBUFFERBASEDEST  = $00000100;
  1911.  
  1912. { DirectDrawSurface Overlay FX Flags }
  1913.  
  1914.   DDOVERFX_ARITHSTRETCHY   = $00000001;
  1915.   DDOVERFX_MIRRORLEFTRIGHT = $00000002;
  1916.   DDOVERFX_MIRRORUPDOWN    = $00000004;
  1917.  
  1918. { Flags for dwDDFX member of DDSPRITEFX structure }
  1919.  
  1920.   DDSPRITEFX_AFFINETRANSFORM    = $00000001;
  1921.   DDSPRITEFX_RGBASCALING        = $00000002;
  1922.   DDSPRITEFX_DEGRADERGBASCALING = $00000004;
  1923.   DDSPRITEFX_BILINEARFILTER     = $00000008;
  1924.   DDSPRITEFX_BLURFILTER         = $00000010;
  1925.   DDSPRITEFX_FLATFILTER         = $00000020;
  1926.   DDSPRITEFX_DEGRADEFILTER      = $00000040;
  1927.  
  1928. { DirectDraw WaitForVerticalBlank Flags }
  1929.  
  1930.   DDWAITVB_BLOCKBEGIN      = $00000001;
  1931.   DDWAITVB_BLOCKBEGINEVENT = $00000002;
  1932.   DDWAITVB_BLOCKEND        = $00000004;
  1933.  
  1934. { DirectDraw GetFlipStatus Flags }
  1935.  
  1936.   DDGFS_CANFLIP    = $00000001;
  1937.   DDGFS_ISFLIPDONE = $00000002;
  1938.  
  1939. { DirectDraw GetBltStatus Flags }
  1940.  
  1941.   DDGBS_CANBLT     = $00000001;
  1942.   DDGBS_ISBLTDONE  = $00000002;
  1943.  
  1944. { DirectDraw EnumOverlayZOrder Flags }
  1945.  
  1946.   DDENUMOVERLAYZ_BACKTOFRONT = $00000000;
  1947.   DDENUMOVERLAYZ_FRONTTOBACK = $00000001;
  1948.  
  1949. { DirectDraw UpdateOverlayZOrder Flags }
  1950.  
  1951.   DDOVERZ_SENDTOFRONT     = $00000000;
  1952.   DDOVERZ_SENDTOBACK      = $00000001;
  1953.   DDOVERZ_MOVEFORWARD     = $00000002;
  1954.   DDOVERZ_MOVEBACKWARD    = $00000003;
  1955.   DDOVERZ_INSERTINFRONTOF = $00000004;
  1956.   DDOVERZ_INSERTINBACKOF  = $00000005;
  1957.  
  1958. { DirectDrawSurface SetPrivateData Constants }
  1959.  
  1960.   DDSPD_IUNKNOWNPOINTER   = $00000001;
  1961.   DDSPD_VOLATILE          = $00000002;
  1962.  
  1963. { TDDColorControl flags }
  1964.  
  1965.   DDCOLOR_BRIGHTNESS    = $00000001;
  1966.   DDCOLOR_CONTRAST      = $00000002;
  1967.   DDCOLOR_HUE           = $00000004;
  1968.   DDCOLOR_SATURATION    = $00000008;
  1969.   DDCOLOR_SHARPNESS     = $00000010;
  1970.   DDCOLOR_GAMMA         = $00000020;
  1971.   DDCOLOR_COLORENABLE   = $00000040;
  1972.  
  1973. { DirectDraw SetGammaRamp Flags }
  1974.  
  1975.   DDSGR_CALIBRATE = $00000001;
  1976.  
  1977. { DirectDraw StartModeTest Flags }
  1978.  
  1979.   DDSMT_ISTESTREQUIRED = $00000001;
  1980.  
  1981. { DirectDraw EvaluateMode Flags  }
  1982.  
  1983.   DDEM_MODEPASSED      = $00000001;
  1984.   DDEM_MODEFAILED      = $00000002;
  1985.  
  1986. { DirectDraw Return Codes }
  1987.  
  1988.   DD_OK                                   = HResult(0);
  1989.   DD_FALSE                                = HResult(S_FALSE);
  1990.  
  1991. { DirectDraw EnumCallback Return Values }
  1992.  
  1993.   DDENUMRET_CANCEL = 0;
  1994.   DDENUMRET_OK     = 1;
  1995.  
  1996. { DirectDraw Error Codes }
  1997.  
  1998.   DDERR_ALREADYINITIALIZED                = HResult($88760000 + 5);
  1999.   DDERR_CANNOTATTACHSURFACE               = HResult($88760000 + 10);
  2000.   DDERR_CANNOTDETACHSURFACE               = HResult($88760000 + 20);
  2001.   DDERR_CURRENTLYNOTAVAIL                 = HResult($88760000 + 40);
  2002.   DDERR_EXCEPTION                         = HResult($88760000 + 55);
  2003.   DDERR_GENERIC                           = HResult(E_FAIL);
  2004.   DDERR_HEIGHTALIGN                       = HResult($88760000 + 90);
  2005.   DDERR_INCOMPATIBLEPRIMARY               = HResult($88760000 + 95);
  2006.   DDERR_INVALIDCAPS                       = HResult($88760000 + 100);
  2007.   DDERR_INVALIDCLIPLIST                   = HResult($88760000 + 110);
  2008.   DDERR_INVALIDMODE                       = HResult($88760000 + 120);
  2009.   DDERR_INVALIDOBJECT                     = HResult($88760000 + 130);
  2010.   DDERR_INVALIDPARAMS                     = HResult(E_INVALIDARG);
  2011.   DDERR_INVALIDPIXELFORMAT                = HResult($88760000 + 145);
  2012.   DDERR_INVALIDRECT                       = HResult($88760000 + 150);
  2013.   DDERR_LOCKEDSURFACES                    = HResult($88760000 + 160);
  2014.   DDERR_NO3D                              = HResult($88760000 + 170);
  2015.   DDERR_NOALPHAHW                         = HResult($88760000 + 180);
  2016.   DDERR_NOSTEREOHARDWARE                  = HResult($88760000 + 181);
  2017.   DDERR_NOSURFACELEFT                     = HResult($88760000 + 182);
  2018.   DDERR_NOCLIPLIST                        = HResult($88760000 + 205);
  2019.   DDERR_NOCOLORCONVHW                     = HResult($88760000 + 210);
  2020.   DDERR_NOCOOPERATIVELEVELSET             = HResult($88760000 + 212);
  2021.   DDERR_NOCOLORKEY                        = HResult($88760000 + 215);
  2022.   DDERR_NOCOLORKEYHW                      = HResult($88760000 + 220);
  2023.   DDERR_NODIRECTDRAWSUPPORT               = HResult($88760000 + 222);
  2024.   DDERR_NOEXCLUSIVEMODE                   = HResult($88760000 + 225);
  2025.   DDERR_NOFLIPHW                          = HResult($88760000 + 230);
  2026.   DDERR_NOGDI                             = HResult($88760000 + 240);
  2027.   DDERR_NOMIRRORHW                        = HResult($88760000 + 250);
  2028.   DDERR_NOTFOUND                          = HResult($88760000 + 255);
  2029.   DDERR_NOOVERLAYHW                       = HResult($88760000 + 260);
  2030.   DDERR_OVERLAPPINGRECTS                  = HResult($88760000 + 270);
  2031.   DDERR_NORASTEROPHW                      = HResult($88760000 + 280);
  2032.   DDERR_NOROTATIONHW                      = HResult($88760000 + 290);
  2033.   DDERR_NOSTRETCHHW                       = HResult($88760000 + 310);
  2034.   DDERR_NOT4BITCOLOR                      = HResult($88760000 + 316);
  2035.   DDERR_NOT4BITCOLORINDEX                 = HResult($88760000 + 317);
  2036.   DDERR_NOT8BITCOLOR                      = HResult($88760000 + 320);
  2037.   DDERR_NOTEXTUREHW                       = HResult($88760000 + 330);
  2038.   DDERR_NOVSYNCHW                         = HResult($88760000 + 335);
  2039.   DDERR_NOZBUFFERHW                       = HResult($88760000 + 340);
  2040.   DDERR_NOZOVERLAYHW                      = HResult($88760000 + 350);
  2041.   DDERR_OUTOFCAPS                         = HResult($88760000 + 360);
  2042.   DDERR_OUTOFMEMORY                       = HResult(E_OUTOFMEMORY);
  2043.   DDERR_OUTOFVIDEOMEMORY                  = HResult($88760000 + 380);
  2044.   DDERR_OVERLAYCANTCLIP                   = HResult($88760000 + 382);
  2045.   DDERR_OVERLAYCOLORKEYONLYONEACTIVE      = HResult($88760000 + 384);
  2046.   DDERR_PALETTEBUSY                       = HResult($88760000 + 387);
  2047.   DDERR_COLORKEYNOTSET                    = HResult($88760000 + 400);
  2048.   DDERR_SURFACEALREADYATTACHED            = HResult($88760000 + 410);
  2049.   DDERR_SURFACEALREADYDEPENDENT           = HResult($88760000 + 420);
  2050.   DDERR_SURFACEBUSY                       = HResult($88760000 + 430);
  2051.   DDERR_CANTLOCKSURFACE                   = HResult($88760000 + 435);
  2052.   DDERR_SURFACEISOBSCURED                 = HResult($88760000 + 440);
  2053.   DDERR_SURFACELOST                       = HResult($88760000 + 450);
  2054.   DDERR_SURFACENOTATTACHED                = HResult($88760000 + 460);
  2055.   DDERR_TOOBIGHEIGHT                      = HResult($88760000 + 470);
  2056.   DDERR_TOOBIGSIZE                        = HResult($88760000 + 480);
  2057.   DDERR_TOOBIGWIDTH                       = HResult($88760000 + 490);
  2058.   DDERR_UNSUPPORTED                       = HResult(E_NOTIMPL);
  2059.   DDERR_UNSUPPORTEDFORMAT                 = HResult($88760000 + 510);
  2060.   DDERR_UNSUPPORTEDMASK                   = HResult($88760000 + 520);
  2061.   DDERR_INVALIDSTREAM                     = HResult($88760000 + 521);
  2062.   DDERR_VERTICALBLANKINPROGRESS           = HResult($88760000 + 537);
  2063.   DDERR_WASSTILLDRAWING                   = HResult($88760000 + 540);
  2064.   DDERR_DDSCAPSCOMPLEXREQUIRED            = HResult($88760000 + 542);
  2065.   DDERR_XALIGN                            = HResult($88760000 + 560);
  2066.   DDERR_INVALIDDIRECTDRAWGUID             = HResult($88760000 + 561);
  2067.   DDERR_DIRECTDRAWALREADYCREATED          = HResult($88760000 + 562);
  2068.   DDERR_NODIRECTDRAWHW                    = HResult($88760000 + 563);
  2069.   DDERR_PRIMARYSURFACEALREADYEXISTS       = HResult($88760000 + 564);
  2070.   DDERR_NOEMULATION                       = HResult($88760000 + 565);
  2071.   DDERR_REGIONTOOSMALL                    = HResult($88760000 + 566);
  2072.   DDERR_CLIPPERISUSINGHWND                = HResult($88760000 + 567);
  2073.   DDERR_NOCLIPPERATTACHED                 = HResult($88760000 + 568);
  2074.   DDERR_NOHWND                            = HResult($88760000 + 569);
  2075.   DDERR_HWNDSUBCLASSED                    = HResult($88760000 + 570);
  2076.   DDERR_HWNDALREADYSET                    = HResult($88760000 + 571);
  2077.   DDERR_NOPALETTEATTACHED                 = HResult($88760000 + 572);
  2078.   DDERR_NOPALETTEHW                       = HResult($88760000 + 573);
  2079.   DDERR_BLTFASTCANTCLIP                   = HResult($88760000 + 574);
  2080.   DDERR_NOBLTHW                           = HResult($88760000 + 575);
  2081.   DDERR_NODDROPSHW                        = HResult($88760000 + 576);
  2082.   DDERR_OVERLAYNOTVISIBLE                 = HResult($88760000 + 577);
  2083.   DDERR_NOOVERLAYDEST                     = HResult($88760000 + 578);
  2084.   DDERR_INVALIDPOSITION                   = HResult($88760000 + 579);
  2085.   DDERR_NOTAOVERLAYSURFACE                = HResult($88760000 + 580);
  2086.   DDERR_EXCLUSIVEMODEALREADYSET           = HResult($88760000 + 581);
  2087.   DDERR_NOTFLIPPABLE                      = HResult($88760000 + 582);
  2088.   DDERR_CANTDUPLICATE                     = HResult($88760000 + 583);
  2089.   DDERR_NOTLOCKED                         = HResult($88760000 + 584);
  2090.   DDERR_CANTCREATEDC                      = HResult($88760000 + 585);
  2091.   DDERR_NODC                              = HResult($88760000 + 586);
  2092.   DDERR_WRONGMODE                         = HResult($88760000 + 587);
  2093.   DDERR_IMPLICITLYCREATED                 = HResult($88760000 + 588);
  2094.   DDERR_NOTPALETTIZED                     = HResult($88760000 + 589);
  2095.   DDERR_UNSUPPORTEDMODE                   = HResult($88760000 + 590);
  2096.   DDERR_NOMIPMAPHW                        = HResult($88760000 + 591);
  2097.   DDERR_INVALIDSURFACETYPE                = HResult($88760000 + 592);
  2098.   DDERR_NOOPTIMIZEHW                      = HResult($88760000 + 600);
  2099.   DDERR_NOTLOADED                         = HResult($88760000 + 601);
  2100.   DDERR_NOFOCUSWINDOW                     = HResult($88760000 + 602);
  2101.   DDERR_NOTONMIPMAPSUBLEVEL               = HResult($88760000 + 603);
  2102.   DDERR_DCALREADYCREATED                  = HResult($88760000 + 620);
  2103.   DDERR_NONONLOCALVIDMEM                  = HResult($88760000 + 630);
  2104.   DDERR_CANTPAGELOCK                      = HResult($88760000 + 640);
  2105.   DDERR_CANTPAGEUNLOCK                    = HResult($88760000 + 660);
  2106.   DDERR_NOTPAGELOCKED                     = HResult($88760000 + 680);
  2107.   DDERR_MOREDATA                          = HResult($88760000 + 690);
  2108.   DDERR_EXPIRED                           = HResult($88760000 + 691);
  2109.   DDERR_TESTFINISHED                      = HResult($88760000 + 692);
  2110.   DDERR_NEWMODE                           = HResult($88760000 + 693);
  2111.   DDERR_D3DNOTINITIALIZED                 = HResult($88760000 + 694);
  2112.   DDERR_VIDEONOTACTIVE                    = HResult($88760000 + 695);
  2113.   DDERR_NOMONITORINFORMATION              = HResult($88760000 + 696);
  2114.   DDERR_NODRIVERSUPPORT                   = HResult($88760000 + 697);
  2115.   DDERR_DEVICEDOESNTOWNSURFACE            = HResult($88760000 + 699);
  2116.   DDERR_NOTINITIALIZED                    = HResult(CO_E_NOTINITIALIZED);
  2117.  
  2118. { API's }
  2119.  
  2120. function GET_WHQL_YEAR(dwWHQLLevel: DWORD): DWORD;
  2121. function GET_WHQL_MONTH(dwWHQLLevel: DWORD): DWORD;
  2122. function GET_WHQL_DAY(dwWHQLLevel: DWORD): DWORD;
  2123.  
  2124. type
  2125.   HMonitor = THandle;
  2126.  
  2127.   TDDEnumCallbackA = function(lpGUID: PGUID; lpDriverDescription: LPSTR;
  2128.     lpDriverName: LPSTR; lpContext: Pointer): BOOL; stdcall;
  2129.   LPDDENUMCALLBACKA = TDDEnumCallbackA;
  2130.  
  2131.   TDDEnumCallbackW = function(lpGUID: PGUID; lpDriverDescription: LPWSTR;
  2132.     lpDriverName: LPWSTR; lpContext: Pointer): BOOL; stdcall;
  2133.   LPDDENUMCALLBACKW = TDDEnumCallbackW;
  2134.  
  2135.   TDDEnumCallback = TDDEnumCallbackA;
  2136.   LPDDENUMCALLBACK = TDDEnumCallback;
  2137.  
  2138.   TDDEnumCallbackExA = function(lpGUID: PGUID; lpDriverDescription: LPSTR;
  2139.     lpDriverName: LPSTR; lpContext: Pointer; Monitor: HMonitor): BOOL; stdcall;
  2140.   LPDDENUMCALLBACKEXA = TDDEnumCallbackExA;
  2141.  
  2142.   TDDEnumCallbackExW = function(lpGUID: PGUID; lpDriverDescription: LPWSTR;
  2143.     lpDriverName: LPWSTR; lpContext: Pointer; Monitor: HMonitor): BOOL; stdcall;
  2144.   LPDDENUMCALLBACKEXW = TDDEnumCallbackExW;
  2145.  
  2146.   TDDEnumCallbackEx = TDDEnumCallbackExA;
  2147.   LPDDENUMCALLBACKEX = TDDEnumCallbackEx;
  2148.  
  2149. const
  2150.   REGSTR_KEY_DDHW_DESCRIPTION = 'Description';
  2151.   REGSTR_KEY_DDHW_DRIVERNAME  = 'DriverName';
  2152.   REGSTR_PATH_DDHW            = 'Hardware\DirectDrawDrivers';
  2153.  
  2154.   DDCREATE_HARDWAREONLY       = $00000001;
  2155.   DDCREATE_EMULATIONONLY      = $00000002;
  2156.  
  2157. function DirectDrawEnumerateA(lpCallback: TDDEnumCallbackA; lpContext: Pointer): HResult; stdcall;
  2158. function DirectDrawEnumerateW(lpCallback: TDDEnumCallbackW; lpContext: Pointer): HResult; stdcall;
  2159. function DirectDrawEnumerate(lpCallback: TDDEnumCallbackA; lpContext: Pointer): HResult; stdcall;
  2160.  
  2161. function DirectDrawEnumerateExA(lpCallback: TDDEnumCallbackExA; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  2162. function DirectDrawEnumerateExW(lpCallback: TDDEnumCallbackExW; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  2163. function DirectDrawEnumerateEx(lpCallback: TDDEnumCallbackExA; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
  2164.  
  2165. function DirectDrawCreate(lpGUID: PGUID; out lplpDD: IDirectDraw;
  2166.   pUnkOuter: IUnknown): HResult; stdcall;
  2167. function DirectDrawCreateEx(lpGUID: PGUID; out lplpDD; const iid: TGUID;
  2168.   pUnkOuter: IUnknown): HResult; stdcall;
  2169. function DirectDrawCreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper;
  2170.   pUnkOuter: IUnknown): HResult; stdcall;
  2171.  
  2172. (*==========================================================================;
  2173.  *
  2174.  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
  2175.  *
  2176.  *  File:       dvp.h
  2177.  *  Content:    DirectDrawVideoPort include file
  2178.  *
  2179.  ***************************************************************************)
  2180.  
  2181. { GUIDS used by DirectDrawVideoPort objects }
  2182.  
  2183. const
  2184.   IID_IDDVideoPortContainer: TGUID = '{6C142760-A733-11CE-A521-0020AF0BE560}';
  2185.   IID_IDirectDrawVideoPort: TGUID = '{B36D93E0-2B43-11CF-A2DE-00AA00B93356}';
  2186.  
  2187.   DDVPTYPE_E_HREFH_VREFH: TGUID = '{54F39980-DA60-11CF-9B06-00A0C903A3B8}';
  2188.   DDVPTYPE_E_HREFH_VREFL: TGUID = '{92783220-DA60-11CF-9B06-00A0C903A3B8}';
  2189.   DDVPTYPE_E_HREFL_VREFH: TGUID = '{A07A02E0-DA60-11CF-9B06-00A0C903A3B8}';
  2190.   DDVPTYPE_E_HREFL_VREFL: TGUID = '{E09C77E0-DA60-11CF-9B06-00A0C903A3B8}';
  2191.   DDVPTYPE_CCIR656: TGUID = '{FCA326A0-DA60-11CF-9B06-00A0C903A3B8}';
  2192.   DDVPTYPE_BROOKTREE: TGUID = '{1352A560-DA61-11CF-9B06-00A0C903A3B8}';
  2193.   DDVPTYPE_PHILIPS: TGUID = '{332CF160-DA61-11CF-9B06-00A0C903A3B8}';
  2194.  
  2195. { DirectDraw Structures }
  2196.  
  2197. type
  2198.   IDDVideoPortContainer = interface;
  2199.   IDirectDrawVideoPort = interface;
  2200.  
  2201. { TDDVideoportConnect structure }
  2202.  
  2203.   PDDVideoportConnect = ^TDDVideoportConnect;
  2204.   TDDVideoportConnect = record
  2205.     dwSize: DWORD;        // size of the TDDVideoportConnect structure
  2206.     dwPortWidth: DWORD;   // Width of the video port
  2207.     guidTypeID: TGUID;    // Description of video port connection
  2208.     dwFlags: DWORD;       // Connection flags
  2209.     dwReserved1: DWORD;   // Reserved, set to zero.
  2210.   end;
  2211.  
  2212.   DDVIDEOPORTCONNECT = TDDVideoportConnect;
  2213.   LPDDVIDEOPORTCONNECT = PDDVideoportConnect;
  2214.  
  2215. { TDDVideoportCaps structure }
  2216.  
  2217.   PDDVideoportCaps = ^TDDVideoportCaps;
  2218.   TDDVideoportCaps = record
  2219.     dwSize: DWORD;                          // size of the TDDVideoportCaps structure
  2220.     dwFlags: DWORD;                         // indicates which fields contain data
  2221.     dwMaxWidth: DWORD;                      // max width of the video port field
  2222.     dwMaxVBIWidth: DWORD;                   // max width of the VBI data
  2223.     dwMaxHeight: DWORD;                     // max height of the video port field
  2224.     dwVideoPortID: DWORD;                   // Video port ID (0 - (dwMaxVideoPorts -1))
  2225.     dwCaps: DWORD;                          // Video port capabilities
  2226.     dwFX: DWORD;                            // More video port capabilities
  2227.     dwNumAutoFlipSurfaces: DWORD;           // Number of autoflippable surfaces
  2228.     dwAlignVideoPortBoundary: DWORD;        // Byte restriction of placement within the surface
  2229.     dwAlignVideoPortPrescaleWidth: DWORD;   // Byte restriction of width after prescaling
  2230.     dwAlignVideoPortCropBoundary: DWORD;    // Byte restriction of left cropping
  2231.     dwAlignVideoPortCropWidth: DWORD;       // Byte restriction of cropping width
  2232.     dwPreshrinkXStep: DWORD;                // Width can be shrunk in steps of 1/x
  2233.     dwPreshrinkYStep: DWORD;                // Height can be shrunk in steps of 1/x
  2234.     dwNumVBIAutoFlipSurfaces: DWORD;        // Number of VBI autoflippable surfaces
  2235.     dwNumPreferredAutoflip: DWORD;          // Optimal number of autoflippable surfaces for hardware
  2236.     wNumFilterTapsX: WORD;                  // Number of taps the prescaler uses in the X direction (0 - no prescale, 1 - replication, etc.)
  2237.     wNumFilterTapsY: WORD;                  // Number of taps the prescaler uses in the Y direction (0 - no prescale, 1 - replication, etc.)
  2238.   end;
  2239.  
  2240.   DDVIDEOPORTCAPS = TDDVideoportCaps;
  2241.   LPDDVIDEOPORTCAPS = PDDVideoportCaps;
  2242.  
  2243. { TDDVideoportDesc structure }
  2244.  
  2245.   PDDVideoportDesc = ^TDDVideoportDesc;
  2246.   TDDVideoportDesc = record
  2247.     dwSize: DWORD;                       // size of the TDDVideoportDesc structure
  2248.     dwFieldWidth: DWORD;                 // width of the video port field
  2249.     dwVBIWidth: DWORD;                   // width of the VBI data
  2250.     dwFieldHeight: DWORD;                // height of the video port field
  2251.     dwMicrosecondsPerField: DWORD;       // Microseconds per video field
  2252.     dwMaxPixelsPerSecond: DWORD;         // Maximum pixel rate per second
  2253.     dwVideoPortID: DWORD;                // Video port ID (0 - (dwMaxVideoPorts -1))
  2254.     dwReserved1: DWORD;                  // Reserved for future use - set to zero
  2255.     VideoPortType: TDDVideoportConnect;   // Description of video port connection
  2256.     dwReserved2: DWORD;                  // Reserved for future use - set to zero
  2257.     dwReserved3: DWORD;                  // Reserved for future use - set to zero
  2258.   end;
  2259.  
  2260.   DDVIDEOPORTDESC = TDDVideoportDesc;
  2261.   LPDDVIDEOPORTDESC = PDDVideoportDesc;
  2262.  
  2263. { TDDVideoportInfo structure }
  2264.  
  2265.   PDDVideoportInfo = ^TDDVideoportInfo;
  2266.   TDDVideoportInfo = record
  2267.     dwSize: DWORD;                            // Size of the structure
  2268.     dwOriginX: DWORD;                         // Placement of the video data within the surface.
  2269.     dwOriginY: DWORD;                         // Placement of the video data within the surface.
  2270.     dwVPFlags: DWORD;                         // Video port options
  2271.     rCrop: TRect;                             // Cropping rectangle (optional).
  2272.     dwPrescaleWidth: DWORD;                   // Determines pre-scaling/zooming in the X direction (optional).
  2273.     dwPrescaleHeight: DWORD;                  // Determines pre-scaling/zooming in the Y direction (optional).
  2274.     lpddpfInputFormat: PDDPixelFormat;        // Video format written to the video port
  2275.     lpddpfVBIInputFormat: PDDPixelFormat;     // Input format of the VBI data
  2276.     lpddpfVBIOutputFormat: PDDPixelFormat;    // Output format of the data
  2277.     dwVBIHeight: DWORD;                       // Specifies the number of lines of data within the vertical blanking interval.
  2278.     dwReserved1: DWORD;                       // Reserved for future use - set to zero
  2279.     dwReserved2: DWORD;                       // Reserved for future use - set to zero
  2280.   end;
  2281.  
  2282.   DDVIDEOPORTINFO = TDDVideoportInfo;
  2283.   LPDDVIDEOPORTINFO = PDDVideoportInfo;
  2284.  
  2285. { TDDVideoportBandWidth structure }
  2286.  
  2287.   PDDVideoportBandWidth = ^TDDVideoportBandWidth;
  2288.   TDDVideoportBandWidth = record
  2289.     dwSize: DWORD;                 // Size of the structure
  2290.     dwCaps: DWORD;
  2291.     dwOverlay: DWORD;              // Zoom factor at which overlay is supported
  2292.     dwColorkey: DWORD;             // Zoom factor at which overlay w/ colorkey is supported
  2293.     dwYInterpolate: DWORD;         // Zoom factor at which overlay w/ Y interpolation is supported
  2294.     dwYInterpAndColorkey: DWORD;   // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported
  2295.     dwReserved1: DWORD;            // Reserved for future use - set to zero
  2296.     dwReserved2: DWORD;            // Reserved for future use - set to zero
  2297.   end;
  2298.  
  2299.   DDVIDEOPORTBANDWIDTH = TDDVideoportBandWidth;
  2300.   LPDDVIDEOPORTBANDWIDTH = PDDVideoportBandWidth;
  2301.  
  2302. { TDDVideoportStatus structure }
  2303.  
  2304.   PDDVideoportStatus = ^TDDVideoportStatus;
  2305.   TDDVideoportStatus = record
  2306.     dwSize: DWORD;                       // Size of the structure
  2307.     bInUse: BOOL;                        // TRUE if video port is currently being used
  2308.     dwFlags: DWORD;                      // Currently not used
  2309.     dwReserved1: DWORD;                  // Reserved for future use
  2310.     VideoPortType: TDDVideoportConnect;   // Information about the connection
  2311.     dwReserved2: DWORD;                  // Reserved for future use
  2312.     dwReserved3: DWORD;                  // Reserved for future use
  2313.   end;
  2314.  
  2315.   DDVIDEOPORTSTATUS = TDDVideoportStatus;
  2316.   LPDDVIDEOPORTSTATUS = PDDVideoportStatus;
  2317.  
  2318. { API's }
  2319.  
  2320.   TDDEnumVideoCallback = function(const lpDDVideoPortCaps: TDDVideoportCaps;
  2321.       lpContext: Pointer): HResult; stdcall;
  2322.   LPDDENUMVIDEOCALLBACK = TDDEnumVideoCallback;
  2323.  
  2324. { IDirectDrawVideoPortContainer Interface }
  2325.  
  2326.   IDDVideoPortContainer = interface(IUnknown)
  2327.     ['{6C142760-A733-11CE-A521-0020AF0BE560}']
  2328.     // IDDVideoPortContainer methods
  2329.     function CreateVideoPort(dwFlags: DWORD; const lpDDVideoPortDesc:
  2330.         TDDVideoportDesc; out lplpDDVideoPort: IDirectDrawVideoPort;
  2331.         pUnkOuter: IUnknown): HResult; stdcall;
  2332.     function EnumVideoPorts(dwFlags: DWORD;
  2333.         const lpDDVideoPortCaps: TDDVideoportCaps; lpContext: Pointer;
  2334.         lpEnumVideoCallback: TDDEnumVideoCallback): HResult; stdcall;
  2335.     function GetVideoPortConnectInfo(dwPortId: DWORD; var lpNumEntries: DWORD;
  2336.         var lpConnectInfo: TDDVideoportConnect): HResult; stdcall;
  2337.     function QueryVideoPortStatus(dwPortId: DWORD;
  2338.         var lpVPStatus: TDDVideoportStatus): HResult; stdcall;
  2339.   end;
  2340.  
  2341. { IDirectDrawVideoPort Interface }
  2342.  
  2343.   IDirectDrawVideoPort = interface(IUnknown)
  2344.     ['{B36D93E0-2B43-11CF-A2DE-00AA00B93356}']
  2345.     // IDirectDrawVideoPort methods
  2346.     function Flip(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD): HResult; stdcall;
  2347.     function GetBandwidthInfo(const lpddpfFormat: TDDPixelFormat; dwWidth: DWORD;
  2348.         dwHeight: DWORD; dwFlags: DWORD; var lpBandwidth: TDDVideoportBandWidth): HResult; stdcall;
  2349.     function GetColorControls(var lpColorControl: TDDColorControl): HResult; stdcall;
  2350.     function GetInputFormats(var lpNumFormats: DWORD; var lpFormats:
  2351.         TDDPixelFormat; dwFlags: DWORD): HResult; stdcall;
  2352.     function GetOutputFormats(const lpInputFormat: TDDPixelFormat;
  2353.         var lpNumFormats: DWORD; var lpFormats: TDDPixelFormat; dwFlags: DWORD): HResult; stdcall;
  2354.     function GetFieldPolarity(var lpbVideoField: BOOL): HResult; stdcall;
  2355.     function GetVideoLine(var lpdwLine: DWORD): HResult; stdcall;
  2356.     function GetVideoSignalStatus(varlpdwStatus: DWORD): HResult; stdcall;
  2357.     function SetColorControls(const lpColorControl: TDDColorControl): HResult; stdcall;
  2358.     function SetTargetSurface(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD): HResult; stdcall;
  2359.     function StartVideo(const lpVideoInfo: TDDVideoportInfo): HResult; stdcall;
  2360.     function StopVideo: HResult; stdcall;
  2361.     function UpdateVideo(const lpVideoInfo: TDDVideoportInfo): HResult; stdcall;
  2362.     function WaitForSync(dwFlags: DWORD; dwLine: DWORD; dwTimeout: DWORD): HResult; stdcall;
  2363.   end;
  2364.  
  2365.  
  2366. const
  2367. { Video Port Flags }
  2368.  
  2369.   DDVPD_WIDTH             = $00000001;
  2370.   DDVPD_HEIGHT            = $00000002;
  2371.   DDVPD_ID                = $00000004;
  2372.   DDVPD_CAPS              = $00000008;
  2373.   DDVPD_FX                = $00000010;
  2374.   DDVPD_AUTOFLIP          = $00000020;
  2375.   DDVPD_ALIGN             = $00000040;
  2376.   DDVPD_PREFERREDAUTOFLIP = $00000080;
  2377.   DDVPD_FILTERQUALITY     = $00000100;
  2378.  
  2379. { TDDVideoportConnect flags }
  2380.  
  2381.   DDVPCONNECT_DOUBLECLOCK      = $00000001;
  2382.   DDVPCONNECT_VACT             = $00000002;
  2383.   DDVPCONNECT_INVERTPOLARITY   = $00000004;
  2384.   DDVPCONNECT_DISCARDSVREFDATA = $00000008;
  2385.   DDVPCONNECT_HALFLINE         = $00000010;
  2386.   DDVPCONNECT_INTERLACED       = $00000020;
  2387.   DDVPCONNECT_SHAREEVEN        = $00000040;
  2388.   DDVPCONNECT_SHAREODD         = $00000080;
  2389.  
  2390. { TDDVideoportDesc caps }
  2391.  
  2392.   DDVPCAPS_AUTOFLIP               = $00000001;
  2393.   DDVPCAPS_INTERLACED             = $00000002;
  2394.   DDVPCAPS_NONINTERLACED          = $00000004;
  2395.   DDVPCAPS_READBACKFIELD          = $00000008;
  2396.   DDVPCAPS_READBACKLINE           = $00000010;
  2397.   DDVPCAPS_SHAREABLE              = $00000020;
  2398.   DDVPCAPS_SKIPEVENFIELDS         = $00000040;
  2399.   DDVPCAPS_SKIPODDFIELDS          = $00000080;
  2400.   DDVPCAPS_SYNCMASTER             = $00000100;
  2401.   DDVPCAPS_VBISURFACE             = $00000200;
  2402.   DDVPCAPS_COLORCONTROL           = $00000400;
  2403.   DDVPCAPS_OVERSAMPLEDVBI         = $00000800;
  2404.   DDVPCAPS_SYSTEMMEMORY           = $00001000;
  2405.   DDVPCAPS_VBIANDVIDEOINDEPENDENT = $00002000;
  2406.   DDVPCAPS_HARDWAREDEINTERLACE    = $00004000;
  2407.  
  2408. { TDDVideoportDesc FX }
  2409.  
  2410.   DDVPFX_CROPTOPDATA     = $00000001;
  2411.   DDVPFX_CROPX           = $00000002;
  2412.   DDVPFX_CROPY           = $00000004;
  2413.   DDVPFX_INTERLEAVE      = $00000008;
  2414.   DDVPFX_MIRRORLEFTRIGHT = $00000010;
  2415.   DDVPFX_MIRRORUPDOWN    = $00000020;
  2416.   DDVPFX_PRESHRINKX      = $00000040;
  2417.   DDVPFX_PRESHRINKY      = $00000080;
  2418.   DDVPFX_PRESHRINKXB     = $00000100;
  2419.   DDVPFX_PRESHRINKYB     = $00000200;
  2420.   DDVPFX_PRESHRINKXS     = $00000400;
  2421.   DDVPFX_PRESHRINKYS     = $00000800;
  2422.   DDVPFX_PRESTRETCHX     = $00001000;
  2423.   DDVPFX_PRESTRETCHY     = $00002000;
  2424.   DDVPFX_PRESTRETCHXN    = $00004000;
  2425.   DDVPFX_PRESTRETCHYN    = $00008000;
  2426.   DDVPFX_VBICONVERT      = $00010000;
  2427.   DDVPFX_VBINOSCALE      = $00020000;
  2428.   DDVPFX_IGNOREVBIXCROP  = $00040000;
  2429.   DDVPFX_VBINOINTERLEAVE = $00080000;
  2430.  
  2431. { TDDVideoportInfo flags }
  2432.  
  2433.   DDVP_AUTOFLIP            = $00000001;
  2434.   DDVP_CONVERT             = $00000002;
  2435.   DDVP_CROP                = $00000004;
  2436.   DDVP_INTERLEAVE          = $00000008;
  2437.   DDVP_MIRRORLEFTRIGHT     = $00000010;
  2438.   DDVP_MIRRORUPDOWN        = $00000020;
  2439.   DDVP_PRESCALE            = $00000040;
  2440.   DDVP_SKIPEVENFIELDS      = $00000080;
  2441.   DDVP_SKIPODDFIELDS       = $00000100;
  2442.   DDVP_SYNCMASTER          = $00000200;
  2443.   DDVP_VBICONVERT          = $00000400;
  2444.   DDVP_VBINOSCALE          = $00000800;
  2445.   DDVP_OVERRIDEBOBWEAVE    = $00001000;
  2446.   DDVP_IGNOREVBIXCROP      = $00002000;
  2447.   DDVP_HARDWAREDEINTERLACE = $00008000;
  2448.  
  2449. { DirectDrawVideoport GetInputFormat/GetOutputFormat flags }
  2450.  
  2451.   DDVPFORMAT_VIDEO = $00000001;
  2452.   DDVPFORMAT_VBI = $00000002;
  2453.  
  2454. { DirectDrawVideoport SetTargetSurface flags }
  2455.  
  2456.   DDVPTARGET_VIDEO = $00000001;
  2457.   DDVPTARGET_VBI = $00000002;
  2458.  
  2459. { DirectDrawVideoport WaitForSync flags }
  2460.  
  2461.   DDVPWAIT_BEGIN = $00000001;
  2462.   DDVPWAIT_END = $00000002;
  2463.