Subversion Repositories spacemission

Rev

Rev 4 | Rev 16 | 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. (c)2004 Jaro Benes Recompilation with Erik Unger's headers
  30. (c)2024 Daniel Marschall, small fixes
  31.  
  32. Join in order:
  33.   1) DirectDraw
  34.   2) Direct3D
  35.   3) Direct3DRM
  36.   4) DirectInput
  37.   5) DirectPlay
  38.   6) DirectSetup
  39.   7) DirectSound
  40.   8) DirectMusic
  41. }
  42. Unit DirectX;
  43.  
  44. Interface
  45.  
  46. {Delphi version marks}
  47.  
  48. {$I DelphiXcfg.inc}
  49.  
  50. {$MINENUMSIZE 4}
  51. {$ALIGN ON}
  52.  
  53. uses
  54.   Windows, MMSystem;
  55. //DirectDraw file
  56. (*==========================================================================;
  57.  *
  58.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  59.  *
  60.  *  Files:      ddraw.h dvp.h
  61.  *  Content:    DirectDraw and DirectDrawVideoPort include files
  62.  *
  63.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  64.  *
  65.  *  Modified: 10-Sep-2000
  66.  *
  67.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  68.  *  E-Mail: DelphiDirectX@next-reality.com
  69.  *
  70.  *
  71.  ***************************************************************************)
  72.  
  73. var
  74.   DDrawDLL : HMODULE = 0;
  75.  
  76. function DDErrorString(Value: HResult) : string;
  77.  
  78. function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
  79.  
  80. (*
  81.  * FOURCC codes for DX compressed-texture pixel formats
  82.  *)
  83. const
  84.   FOURCC_DXT1 = 'DXT1';
  85.   FOURCC_DXT2 = 'DXT2';
  86.   FOURCC_DXT3 = 'DXT3';
  87.   FOURCC_DXT4 = 'DXT4';
  88.   FOURCC_DXT5 = 'DXT5';
  89.  
  90. (*
  91.  * GUIDS used by DirectDraw objects
  92.  *)
  93. const
  94.   CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}';
  95.   CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}';
  96.   CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}';
  97.  
  98. const
  99.   DD_ROP_SPACE = (256 div 32);       // space required to store ROP array
  100.  
  101.   MAX_DDDEVICEID_STRING = 512;
  102.  
  103. (*
  104.  * Flags for the IDirectDraw4::GetDeviceIdentifier method
  105.  *)
  106.  
  107. (*
  108.  * This flag causes GetDeviceIdentifier to return information about the host (typically 2D) adapter in a system equipped
  109.  * with a stacked secondary 3D adapter. Such an adapter appears to the application as if it were part of the
  110.  * host adapter, but is typically physcially located on a separate card. The stacked secondary's information is
  111.  * returned when GetDeviceIdentifier's dwFlags field is zero, since this most accurately reflects the qualities
  112.  * of the DirectDraw object involved.
  113.  *)
  114.   DDGDI_GETHOSTIDENTIFIER         = $00000001;
  115.  
  116. (*============================================================================
  117.  *
  118.  * DirectDraw Structures
  119.  *
  120.  * Various structures used to invoke DirectDraw.
  121.  *
  122.  *==========================================================================*)
  123.  
  124. var
  125.   NilGUID : TGUID{$IfNDef VER6UP} absolute 0{$EndIf};
  126.  
  127. type
  128.   TRefGUID = packed record
  129.     case integer of
  130.     1: (guid : PGUID);
  131.     2: (dwFlags : DWORD);
  132.   end;
  133.  
  134.   IDirectDraw = interface;
  135.   IDirectDraw2 = interface;
  136.   IDirectDraw4 = interface;
  137.   IDirectDraw7 = interface;
  138.   IDirectDrawSurface = interface;
  139.   IDirectDrawSurface2 = interface;
  140.   IDirectDrawSurface3 = interface;
  141.   IDirectDrawSurface4 = interface;
  142.   IDirectDrawSurface7 = interface;
  143.  
  144.   IDirectDrawPalette = interface;
  145.   IDirectDrawClipper = interface;
  146.   IDirectDrawColorControl = interface;
  147.   IDirectDrawGammaControl = interface;
  148.  
  149. (*
  150.  * Generic pixel format with 8-bit RGB and alpha components
  151.  *)
  152.   PDDARGB = ^TDDARGB;
  153.   TDDARGB = packed record
  154.     blue:     BYTE;
  155.     green:    BYTE;
  156.     red:      BYTE;
  157.     alpha:    BYTE;
  158.   end;
  159.  
  160. (*
  161.  * This version of the structure remains for backwards source compatibility.
  162.  * The DDARGB structure is the one that should be used for all DirectDraw APIs.
  163.  *)
  164.   PDDRGBA = ^TDDRGBA;
  165.   TDDRGBA = packed record
  166.     red   : BYTE;
  167.     green : BYTE;
  168.     blue  : BYTE;
  169.     alpha : BYTE;
  170.   end;
  171.  
  172. (*
  173.  * TDDColorKey
  174.  *)
  175.   PDDColorKey = ^TDDColorKey;
  176.   TDDColorKey = packed record
  177.     dwColorSpaceLowValue: DWORD;   // low boundary of color space that is to
  178.                                    // be treated as Color Key, inclusive
  179.     dwColorSpaceHighValue: DWORD;  // high boundary of color space that is
  180.                                    // to be treated as Color Key, inclusive
  181.   end;
  182.  
  183. // Delphi 5 can't handle interface in variant records
  184. // so we have to use pointers instead (which can be type-casted into interfaces):
  185.  
  186. {$IFDEF VER5UP}
  187.   PDirectDrawSurface = Pointer;              
  188. {$ELSE}
  189.   PDirectDrawSurface = IDirectDrawSurface;
  190. {$ENDIF}
  191.  
  192. (*
  193.  * TDDBltFX
  194.  * Used to pass override information to the DIRECTDRAWSURFACE callback Blt.
  195.  *)
  196.   PDDBltFX = ^TDDBltFX;
  197.   TDDBltFX = packed record
  198.     dwSize                        : DWORD;     // size of structure
  199.     dwDDFX                        : DWORD;     // FX operations
  200.     dwROP                         : DWORD;     // Win32 raster operations
  201.     dwDDROP                       : DWORD;     // Raster operations new for DirectDraw
  202.     dwRotationAngle               : DWORD;     // Rotation angle for blt
  203.     dwZBufferOpCode               : DWORD;     // ZBuffer compares
  204.     dwZBufferLow                  : DWORD;     // Low limit of Z buffer
  205.     dwZBufferHigh                 : DWORD;     // High limit of Z buffer
  206.     dwZBufferBaseDest             : DWORD;     // Destination base value
  207.     dwZDestConstBitDepth          : DWORD;     // Bit depth used to specify Z constant for destination
  208.     case integer of
  209.     0: (
  210.       dwZDestConst                : DWORD      // Constant to use as Z buffer for dest
  211.      );
  212.     1: (
  213.       lpDDSZBufferDest            : PDirectDrawSurface; // Surface to use as Z buffer for dest
  214.       dwZSrcConstBitDepth         : DWORD;     // Bit depth used to specify Z constant for source
  215.       case integer of
  216.       0: (
  217.         dwZSrcConst               : DWORD;     // Constant to use as Z buffer for src
  218.        );
  219.       1: (
  220.         lpDDSZBufferSrc           : PDirectDrawSurface; // Surface to use as Z buffer for src
  221.         dwAlphaEdgeBlendBitDepth  : DWORD;     // Bit depth used to specify constant for alpha edge blend
  222.         dwAlphaEdgeBlend          : DWORD;     // Alpha for edge blending
  223.         dwReserved                : DWORD;
  224.         dwAlphaDestConstBitDepth  : DWORD;     // Bit depth used to specify alpha constant for destination
  225.         case integer of
  226.         0: (
  227.           dwAlphaDestConst        : DWORD;     // Constant to use as Alpha Channel
  228.          );
  229.         1: (
  230.           lpDDSAlphaDest          : PDirectDrawSurface; // Surface to use as Alpha Channel
  231.           dwAlphaSrcConstBitDepth : DWORD;     // Bit depth used to specify alpha constant for source
  232.           case integer of
  233.           0: (
  234.             dwAlphaSrcConst       : DWORD;     // Constant to use as Alpha Channel
  235.           );
  236.           1: (
  237.             lpDDSAlphaSrc         : PDirectDrawSurface; // Surface to use as Alpha Channel
  238.             case integer of
  239.             0: (
  240.               dwFillColor         : DWORD;     // color in RGB or Palettized
  241.             );
  242.             1: (
  243.               dwFillDepth         : DWORD;     // depth value for z-buffer
  244.             );
  245.             2: (
  246.               dwFillPixel         : DWORD;     // pixel value
  247.             );
  248.             3: (
  249.               lpDDSPattern        : PDirectDrawSurface; // Surface to use as pattern
  250.               ddckDestColorkey    : TDDColorKey; // DestColorkey override
  251.               ddckSrcColorkey     : TDDColorKey; // SrcColorkey override
  252.             )
  253.         )
  254.       )
  255.     )
  256.   )
  257.   end;
  258.  
  259. (*
  260.  * TDDSCaps
  261.  *)
  262.   PDDSCaps = ^TDDSCaps;
  263.   TDDSCaps = packed record
  264.     dwCaps: DWORD;         // capabilities of surface wanted
  265.   end;
  266.  
  267. (*
  268.  * TDDOSCaps
  269.  *)
  270.   PDDOSCaps = ^TDDOSCaps;
  271.   TDDOSCaps = packed record
  272.     dwCaps: DWORD;         // capabilities of surface wanted
  273.   end;
  274.  
  275. (*
  276.  * This structure is used internally by DirectDraw.
  277.  *)
  278.   PDDSCapsEx = ^TDDSCapsEx;
  279.   TDDSCapsEx = packed record
  280.     dwCaps2 : DWORD;
  281.     dwCaps3 : DWORD;
  282.     dwCaps4 : DWORD;
  283.   end;
  284.  
  285. (*
  286.  * TDDSCaps2
  287.  *)
  288.   PDDSCaps2 = ^TDDSCaps2;
  289.   TDDSCaps2 = packed record
  290.     dwCaps: DWORD;         // capabilities of surface wanted
  291.     dwCaps2 : DWORD;
  292.     dwCaps3 : DWORD;
  293.     dwCaps4 : DWORD;
  294.   end;
  295.  
  296. (*
  297.  * TDDCaps
  298.  *)
  299. (*
  300.  * This structure is the TDDCaps structure as it was in version 2 and 3 of Direct X.
  301.  * It is present for back compatability.
  302.  *)
  303.   PDDCaps_DX3 = ^TDDCaps_DX3;
  304.   TDDCaps_DX3 = packed record
  305.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  306.     dwCaps: DWORD;                 // driver specific capabilities
  307.     dwCaps2: DWORD;                // more driver specific capabilites
  308.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  309.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  310.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  311.     dwPalCaps: DWORD;              // palette capabilities
  312.     dwSVCaps: DWORD;               // stereo vision capabilities
  313.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  314.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  315.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  316.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  317.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  318.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  319.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  320.     dwVidMemTotal: DWORD;          // total amount of video memory
  321.     dwVidMemFree: DWORD;           // amount of free video memory
  322.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  323.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  324.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  325.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  326.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  327.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  328.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  329.     dwAlignStrideAlign: DWORD;     // stride alignment
  330.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  331.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  332.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  333.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  334.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  335.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  336.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  337.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  338.     dwReserved1: DWORD;            // reserved
  339.     dwReserved2: DWORD;            // reserved
  340.     dwReserved3: DWORD;            // reserved
  341.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  342.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  343.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  344.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  345.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  346.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  347.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  348.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  349.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  350.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  351.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  352.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  353.     dwReserved4 : DWORD;
  354.     dwReserved5 : DWORD;
  355.     dwReserved6 : DWORD;
  356.   end;
  357.  
  358. (*
  359.  * This structure is the TDDCaps structure as it was in version 5 of Direct X.
  360.  * It is present for back compatability.
  361.  *)
  362.   PDDCaps_DX5 = ^TDDCaps_DX5;
  363.   TDDCaps_DX5 = packed record
  364.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  365.     dwCaps: DWORD;                 // driver specific capabilities
  366.     dwCaps2: DWORD;                // more driver specific capabilites
  367.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  368.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  369.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  370.     dwPalCaps: DWORD;              // palette capabilities
  371.     dwSVCaps: DWORD;               // stereo vision capabilities
  372.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  373.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  374.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  375.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  376.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  377.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  378.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  379.     dwVidMemTotal: DWORD;          // total amount of video memory
  380.     dwVidMemFree: DWORD;           // amount of free video memory
  381.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  382.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  383.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  384.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  385.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  386.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  387.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  388.     dwAlignStrideAlign: DWORD;     // stride alignment
  389.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  390.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  391.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  392.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  393.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  394.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  395.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  396.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  397.     dwReserved1: DWORD;            // reserved
  398.     dwReserved2: DWORD;            // reserved
  399.     dwReserved3: DWORD;            // reserved
  400.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  401.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  402.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  403.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  404.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  405.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  406.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  407.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  408.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  409.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  410.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  411.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  412.     // Members added for DX5:
  413.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  414.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  415.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  416.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  417.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  418.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  419.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  420.     dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  421.   end;
  422.  
  423.   PDDCaps_DX6 = ^TDDCaps_DX6;
  424.   TDDCaps_DX6 = packed record
  425.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  426.     dwCaps: DWORD;                 // driver specific capabilities
  427.     dwCaps2: DWORD;                // more driver specific capabilites
  428.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  429.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  430.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  431.     dwPalCaps: DWORD;              // palette capabilities
  432.     dwSVCaps: DWORD;               // stereo vision capabilities
  433.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  434.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  435.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  436.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  437.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  438.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  439.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  440.     dwVidMemTotal: DWORD;          // total amount of video memory
  441.     dwVidMemFree: DWORD;           // amount of free video memory
  442.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  443.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  444.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  445.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  446.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  447.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  448.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  449.     dwAlignStrideAlign: DWORD;     // stride alignment
  450.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  451.     ddsOldCaps: TDDSCaps;          // Was dssCaps: TDDSCaps. ddsCaps is of type TDDScaps2 for DX6
  452.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  453.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  454.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  455.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  456.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  457.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  458.     dwReserved1: DWORD;            // reserved
  459.     dwReserved2: DWORD;            // reserved
  460.     dwReserved3: DWORD;            // reserved
  461.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  462.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  463.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  464.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  465.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  466.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  467.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  468.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  469.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  470.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  471.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  472.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  473.     // Members added for DX5:
  474.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  475.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  476.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  477.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  478.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  479.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  480.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  481.     dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  482.     // Members added for DX6 release
  483.     ddsCaps : TDDSCaps2 ;          // Surface Caps
  484.   end;
  485.  
  486.   TDDCaps_DX7 = TDDCaps_DX6;
  487.  
  488.   PDDCaps = ^TDDCaps;
  489.  
  490. {$IFDEF DIRECTX3}
  491.   TDDCaps = TDDCaps_DX3;
  492. {$ELSE}
  493.   {$IFDEF DIRECTX5}
  494.     TDDCaps = TDDCaps_DX5;
  495.   {$ELSE}
  496.     {$IFDEF DIRECTX6}
  497.       TDDCaps = TDDCaps_DX6;
  498.     {$ELSE}
  499.       TDDCaps = TDDCaps_DX7;
  500.     {$ENDIF}
  501.   {$ENDIF}
  502. {$ENDIF}
  503.  
  504.  
  505.  
  506.  
  507. (*
  508.  * TDDPixelFormat
  509.  *)
  510.   PDDPixelFormat_DX5 = ^TDDPixelFormat_DX5;
  511.   TDDPixelFormat_DX5 = packed record
  512.     dwSize: DWORD;                 // size of structure
  513.     dwFlags: DWORD;                // pixel format flags
  514.     dwFourCC: DWORD;               // (FOURCC code)
  515.     case Integer of
  516.     0: (
  517.       dwZBufferBitDepth: DWORD;      // how many bits for z buffers
  518.      );
  519.     1: (
  520.       dwAlphaBitDepth: DWORD;        // how many bits for alpha channels
  521.      );
  522.     2: (
  523.       dwRGBBitCount: DWORD;          // how many bits per pixel
  524.       dwRBitMask: DWORD;             // mask for red bit
  525.       dwGBitMask: DWORD;             // mask for green bits
  526.       dwBBitMask: DWORD;             // mask for blue bits
  527.       dwRGBAlphaBitMask: DWORD;      // mask for alpha channel
  528.      );
  529.     3: (
  530.       dwYUVBitCount: DWORD;          // how many bits per pixel
  531.       dwYBitMask: DWORD;             // mask for Y bits
  532.       dwUBitMask: DWORD;             // mask for U bits
  533.       dwVBitMask: DWORD;             // mask for V bits
  534.       case Integer of
  535.       0: (
  536.         dwYUVAlphaBitMask: DWORD;      // mask for alpha channel
  537.        );
  538.       1: (
  539.         dwRGBZBitMask: DWORD;
  540.        );
  541.       2: (
  542.         dwYUVZBitMask: DWORD;
  543.        );
  544.      );
  545.   end;
  546.  
  547.   PDDPixelFormat_DX6 = ^TDDPixelFormat_DX6;
  548.   TDDPixelFormat_DX6 = packed record
  549.     dwSize: DWORD;                 // size of structure
  550.     dwFlags: DWORD;                // pixel format flags
  551.     dwFourCC: DWORD;               // (FOURCC code)
  552.     case Integer of
  553.       1: (
  554.           dwRGBBitCount : DWORD;  // how many bits per pixel
  555.           dwRBitMask : DWORD;  // mask for red bit
  556.           dwGBitMask : DWORD;  // mask for green bits
  557.           dwBBitMask : DWORD;  // mask for blue bits
  558.           dwRGBAlphaBitMask : DWORD; // mask for alpha channel
  559.           );
  560.       2: (
  561.           dwYUVBitCount : DWORD;  // how many bits per pixel
  562.           dwYBitMask : DWORD;  // mask for Y bits
  563.           dwUBitMask : DWORD;  // mask for U bits
  564.           dwVBitMask : DWORD;  // mask for V bits
  565.           dwYUVAlphaBitMask : DWORD; // mask for alpha channel
  566.           );
  567.       3: (
  568.           dwZBufferBitDepth : DWORD; // how many total bits/pixel in z buffer (including any stencil bits)
  569.           dwStencilBitDepth : DWORD; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)
  570.           dwZBitMask : DWORD;  // mask for Z bits
  571.           dwStencilBitMask : DWORD; // mask for stencil bits
  572.           dwLuminanceAlphaBitMask : DWORD;// mask for alpha channel
  573.           );
  574.       4: (
  575.           dwAlphaBitDepth : DWORD; // how many bits for alpha channels
  576.           dwLuminanceBitMask : DWORD; // mask for luminance bits
  577.           dwBumpDvBitMask : DWORD;        // mask for bump map V delta bits
  578.           dwBumpLuminanceBitMask : DWORD; // mask for luminance in bump map
  579.           dwRGBZBitMask : DWORD;  // mask for Z channel
  580.           );
  581.       5: (
  582.            dwLuminanceBitCount : DWORD; // how many bits per pixel
  583.            dwBumpDuBitMask : DWORD;       // mask for bump map U delta bits
  584.            Fill1, Fill2    : DWORD;
  585.            dwYUVZBitMask   : DWORD;  // mask for Z channel
  586.          );
  587.       6: ( dwBumpBitCount  : DWORD;         // how many bits per "buxel", total
  588.          );
  589.   end;
  590.  
  591.   TDDPixelFormat_DX3 = TDDPixelFormat_DX5;
  592.   TDDPixelFormat_DX7 = TDDPixelFormat_DX6;
  593.  
  594.   PDDPixelFormat = ^TDDPixelFormat;
  595. {$IFDEF DIRECTX3}
  596.   TDDPixelFormat = TDDPixelFormat_DX3;
  597. {$ELSE}
  598.   {$IFDEF DIRECTX5}
  599.     TDDPixelFormat = TDDPixelFormat_DX5;
  600.   {$ELSE}
  601.     {$IFDEF DIRECTX6}
  602.       TDDPixelFormat = TDDPixelFormat_DX6;
  603.     {$ELSE}
  604.       TDDPixelFormat = TDDPixelFormat_DX7;
  605.     {$ENDIF}
  606.   {$ENDIF}
  607. {$ENDIF}
  608.  
  609. (*
  610.  * TDDOverlayFX
  611.  *)
  612.   PDDOverlayFX = ^TDDOverlayFX;
  613.   TDDOverlayFX = packed record
  614.     dwSize: DWORD;                         // size of structure
  615.     dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
  616.     dwAlphaEdgeBlend: DWORD;               // Constant to use as alpha for edge blend
  617.     dwReserved: DWORD;
  618.     dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
  619.     case Integer of
  620.     0: (
  621.       dwAlphaDestConst: DWORD;               // Constant to use as alpha channel for dest
  622.       dwAlphaSrcConstBitDepth: DWORD;        // Bit depth used to specify alpha constant for source
  623.       dwAlphaSrcConst: DWORD;                // Constant to use as alpha channel for src
  624.       dckDestColorkey: TDDColorKey;                // DestColorkey override
  625.       dckSrcColorkey: TDDColorKey;                 // DestColorkey override
  626.       dwDDFX: DWORD;                         // Overlay FX
  627.       dwFlags: DWORD;                        // flags
  628.      );
  629.     1: (
  630.       lpDDSAlphaDest: PDirectDrawSurface;     // Surface to use as alpha channel for dest
  631.       filler: DWORD;
  632.       lpDDSAlphaSrc: PDirectDrawSurface;      // Surface to use as alpha channel for src
  633.      );
  634.   end;
  635.  
  636. (*
  637.  * TDDBltBatch: BltBatch entry structure
  638.  *)
  639.   PDDBltBatch = ^TDDBltBatch;
  640.   TDDBltBatch = packed record
  641.     lprDest: PRect;
  642.     lpDDSSrc: IDirectDrawSurface;
  643.     lprSrc: PRect;
  644.     dwFlags: DWORD;
  645.     lpDDBltFx: TDDBltFX;
  646.   end;
  647.  
  648. (*
  649.  * TDDGammaRamp
  650.  *)
  651.   PDDGammaRamp = ^TDDGammaRamp;
  652.   TDDGammaRamp = packed record
  653.     red   : array[0..255] of WORD;
  654.     green : array[0..255] of WORD;
  655.     blue  : array[0..255] of WORD;
  656.   end;
  657.  
  658. (*
  659.  *  This is the structure within which DirectDraw returns data about the current graphics driver and chipset
  660.  *)
  661.  
  662.   PDDDeviceIdentifier = ^TDDDeviceIdentifier;
  663.   TDDDeviceIdentifier = packed record
  664.     //
  665.     // These elements are for presentation to the user only. They should not be used to identify particular
  666.     // drivers, since this is unreliable and many different strings may be associated with the same
  667.     // device, and the same driver from different vendors.
  668.     //
  669.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  670.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  671.  
  672.     //
  673.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  674.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  675.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  676.     //
  677.     // This version has the form:
  678.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  679.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  680.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  681.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  682.     //
  683.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  684.  
  685.     //
  686.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  687.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  688.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  689.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  690.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  691.     //
  692.     dwVendorId: DWORD;
  693.     dwDeviceId: DWORD;
  694.     dwSubSysId: DWORD;
  695.     dwRevision: DWORD;
  696.  
  697.     //
  698.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  699.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  700.     // reprofile the graphics subsystem.
  701.     // This element can also be used to identify particular problematic drivers.
  702.     //
  703.     guidDeviceIdentifier: TGUID;
  704.   end;
  705.  
  706.   PDDDeviceIdentifier2 = ^TDDDeviceIdentifier2;
  707.   TDDDeviceIdentifier2 = packed record
  708.     //
  709.     // These elements are for presentation to the user only. They should not be used to identify particular
  710.     // drivers, since this is unreliable and many different strings may be associated with the same
  711.     // device, and the same driver from different vendors.
  712.     //
  713.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  714.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  715.  
  716.     //
  717.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  718.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  719.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  720.     //
  721.     // This version has the form:
  722.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  723.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  724.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  725.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  726.     //
  727.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  728.  
  729.     //
  730.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  731.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  732.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  733.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  734.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  735.     //
  736.     dwVendorId: DWORD;
  737.     dwDeviceId: DWORD;
  738.     dwSubSysId: DWORD;
  739.     dwRevision: DWORD;
  740.  
  741.     //
  742.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  743.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  744.     // reprofile the graphics subsystem.
  745.     // This element can also be used to identify particular problematic drivers.
  746.     //
  747.     guidDeviceIdentifier: TGUID;
  748.  
  749.     (*
  750.      * This element is used to determine the Windows Hardware Quality Lab (WHQL)
  751.      * certification level for this driver/device pair.
  752.      *)
  753.     dwWHQLLevel: DWORD;
  754.   end;
  755.  
  756. (*
  757.  * callbacks
  758.  *)
  759.   TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND;
  760.       Code: DWORD; lpContext: Pointer): HResult; stdcall;
  761.   TSurfacesStreamingCallback = function(Arg: DWORD): HResult; stdcall;
  762.  
  763. (*
  764.  * TDDSurfaceDesc
  765.  *)
  766.   PDDSurfaceDesc_DX5 = ^TDDSurfaceDesc_DX5;
  767.   TDDSurfaceDesc_DX5 = packed record
  768.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  769.     dwFlags: DWORD;                // determines what fields are valid
  770.     dwHeight: DWORD;               // height of surface to be created
  771.     dwWidth: DWORD;                // width of input surface
  772.     case Integer of
  773.     0: (
  774.       dwLinearSize : DWORD;       // unused at the moment
  775.      );
  776.     1: (
  777.       lPitch: LongInt;                 // distance to start of next line (return value only)
  778.       dwBackBufferCount: DWORD;      // number of back buffers requested
  779.       case Integer of
  780.       0: (
  781.         dwMipMapCount: DWORD;          // number of mip-map levels requested
  782.         dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  783.         dwReserved: DWORD;             // reserved
  784.         lpSurface: Pointer;              // pointer to the associated surface memory
  785.         ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
  786.         ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
  787.         ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
  788.         ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
  789.         ddpfPixelFormat: TDDPixelFormat_DX5; // pixel format description of the surface
  790.         ddsCaps: TDDSCaps;                // direct draw surface capabilities
  791.        );
  792.       1: (
  793.         dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
  794.        );
  795.       2: (
  796.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  797.        );
  798.      );
  799.   end;
  800.  
  801.   PDDSurfaceDesc_DX6 = ^TDDSurfaceDesc_DX6;
  802.   TDDSurfaceDesc_DX6 = packed record
  803.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  804.     dwFlags: DWORD;                // determines what fields are valid
  805.     dwHeight: DWORD;               // height of surface to be created
  806.     dwWidth: DWORD;                // width of input surface
  807.     case Integer of
  808.     0: (
  809.       dwLinearSize : DWORD;       // unused at the moment
  810.      );
  811.     1: (
  812.       lPitch: LongInt;                 // distance to start of next line (return value only)
  813.       dwBackBufferCount: DWORD;      // number of back buffers requested
  814.       case Integer of
  815.       0: (
  816.         dwMipMapCount: DWORD;          // number of mip-map levels requested
  817.         dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  818.         dwReserved: DWORD;             // reserved
  819.         lpSurface: Pointer;              // pointer to the associated surface memory
  820.         ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
  821.         ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
  822.         ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
  823.         ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
  824.         ddpfPixelFormat: TDDPixelFormat_DX6; // pixel format description of the surface
  825.         ddsCaps: TDDSCaps;                // direct draw surface capabilities
  826.        );
  827.       1: (
  828.         dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
  829.        );
  830.       2: (
  831.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  832.        );
  833.      );
  834.   end;
  835.  
  836.   PDDSurfaceDesc = ^TDDSurfaceDesc;
  837. {$IFDEF DIRECTX5}
  838.   TDDSurfaceDesc = TDDSurfaceDesc_DX5;
  839. {$ELSE}
  840.   TDDSurfaceDesc = TDDSurfaceDesc_DX6;
  841. {$ENDIF}
  842.  
  843.  
  844. (*
  845.  * TDDSurfaceDesc2
  846.  *)
  847.   PDDSurfaceDesc2 = ^TDDSurfaceDesc2;
  848.   TDDSurfaceDesc2 = packed record
  849.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  850.     dwFlags: DWORD;                // determines what fields are valid
  851.     dwHeight: DWORD;               // height of surface to be created
  852.     dwWidth: DWORD;                // width of input surface
  853.     case Integer of
  854.     0: (
  855.       lPitch : LongInt;                  // distance to start of next line (return value only)
  856.      );
  857.     1: (
  858.       dwLinearSize : DWORD;              // Formless late-allocated optimized surface size
  859.       dwBackBufferCount: DWORD;          // number of back buffers requested
  860.       case Integer of
  861.       0: (
  862.         dwMipMapCount: DWORD;            // number of mip-map levels requested
  863.         dwAlphaBitDepth: DWORD;          // depth of alpha buffer requested
  864.         dwReserved: DWORD;               // reserved
  865.         lpSurface: Pointer;              // pointer to the associated surface memory
  866.         ddckCKDestOverlay: TDDColorKey;  // color key for destination overlay use
  867.         ddckCKDestBlt: TDDColorKey;      // color key for destination blt use
  868.         ddckCKSrcOverlay: TDDColorKey;   // color key for source overlay use
  869.         ddckCKSrcBlt: TDDColorKey;       // color key for source blt use
  870.         ddpfPixelFormat: TDDPixelFormat; // pixel format description of the surface
  871.         ddsCaps: TDDSCaps2;              // direct draw surface capabilities
  872.         dwTextureStage: DWORD;           // stage in multitexture cascade
  873.        );
  874.       1: (
  875.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  876.        );
  877.      );
  878.   end;
  879.  
  880. (*
  881.  * TDDOptSurfaceDesc
  882.  *)
  883.  
  884.   PDDOptSurfaceDesc = ^TDDOptSurfaceDesc;
  885.   TDDOptSurfaceDesc = packed record
  886.     dwSize : DWORD;             // size of the DDOPTSURFACEDESC structure
  887.     dwFlags : DWORD;            // determines what fields are valid
  888.     ddSCaps : TDDSCaps2;        // Common caps like: Memory type
  889.     ddOSCaps : TDDOSCaps;       // Common caps like: Memory type
  890.     guid : TGUID;               // Compression technique GUID
  891.     dwCompressionRatio : DWORD; // Compression ratio
  892.   end;
  893.  
  894. (*
  895.  * DDCOLORCONTROL
  896.  *)
  897.   PDDColorControl = ^TDDColorControl;
  898.   TDDColorControl = packed record
  899.     dwSize: DWORD;
  900.     dwFlags: DWORD;
  901.     lBrightness: LongInt;
  902.     lContrast: LongInt;
  903.     lHue: LongInt;
  904.     lSaturation: LongInt;
  905.     lSharpness: LongInt;
  906.     lGamma: LongInt;
  907.     lColorEnable: LongInt;
  908.     dwReserved1: DWORD;
  909.   end;
  910.  
  911. (*
  912.  * callbacks
  913.  *)
  914.  
  915. {$IFNDEF WINNT}
  916.   TDDEnumModesCallback = function (const lpDDSurfaceDesc: TDDSurfaceDesc;
  917.       lpContext: Pointer) : HResult; stdcall;
  918.   TDDEnumModesCallback2 = function (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  919.       lpContext: Pointer) : HResult; stdcall;
  920.   TDDEnumSurfacesCallback = function (lpDDSurface: IDirectDrawSurface;
  921.       const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer) : HResult; stdcall;
  922.   TDDEnumSurfacesCallback2 = function (lpDDSurface: IDirectDrawSurface4;
  923.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
  924.   TDDEnumSurfacesCallback7 = function (lpDDSurface: IDirectDrawSurface7;
  925.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
  926. {$ENDIF}
  927.  
  928. (*
  929.  * INTERACES FOLLOW:
  930.  *      IDirectDraw
  931.  *      IDirectDrawClipper
  932.  *      IDirectDrawPalette
  933.  *      IDirectDrawSurface
  934.  *)
  935.  
  936. (*
  937.  * IDirectDraw
  938.  *)
  939.  
  940.   IDirectDraw = interface (IUnknown)
  941.     ['{6C14DB80-A733-11CE-A521-0020AF0BE560}']
  942.     (*** IDirectDraw methods ***)
  943.     function Compact: HResult; stdcall;
  944.     function CreateClipper (dwFlags: DWORD;
  945.         out lplpDDClipper: IDirectDrawClipper;
  946.         pUnkOuter: IUnknown) : HResult; stdcall;
  947.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  948.         out lplpDDPalette: IDirectDrawPalette;
  949.         pUnkOuter: IUnknown) : HResult; stdcall;
  950.     function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
  951.         out lplpDDSurface: IDirectDrawSurface;
  952.         pUnkOuter: IUnknown) : HResult; stdcall;
  953.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
  954.         out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
  955.     function EnumDisplayModes (dwFlags: DWORD;
  956.         lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
  957.         lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
  958.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc;
  959.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
  960.         HResult; stdcall;
  961.     function FlipToGDISurface: HResult; stdcall;
  962.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  963.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  964.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  965.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) :
  966.         HResult; stdcall;
  967.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  968.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  969.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  970.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  971.     function RestoreDisplayMode: HResult; stdcall;
  972.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  973.     (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  974.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD;
  975.         dwBpp: DWORD) : HResult; stdcall;
  976.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  977.         HResult; stdcall;
  978.   end;
  979.  
  980.   IDirectDraw2 = interface (IUnknown)
  981.     ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}']
  982.     (*** IDirectDraw methods ***)
  983.     function Compact: HResult; stdcall;
  984.     function CreateClipper (dwFlags: DWORD;
  985.         out lplpDDClipper: IDirectDrawClipper;
  986.         pUnkOuter: IUnknown) : HResult; stdcall;
  987.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  988.         out lplpDDPalette: IDirectDrawPalette;
  989.         pUnkOuter: IUnknown) : HResult; stdcall;
  990.     function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
  991.         out lplpDDSurface: IDirectDrawSurface;
  992.         pUnkOuter: IUnknown) : HResult; stdcall;
  993.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
  994.         out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
  995.     function EnumDisplayModes (dwFlags: DWORD;
  996.         lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
  997.         lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
  998.     function EnumSurfaces (dwFlags: DWORD; var lpDDSD: TDDSurfaceDesc;
  999.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
  1000.         HResult; stdcall;
  1001.     function FlipToGDISurface: HResult; stdcall;
  1002.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1003.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1004.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1005.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) : HResult; stdcall;
  1006.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1007.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1008.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1009.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1010.     function RestoreDisplayMode: HResult; stdcall;
  1011.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1012. (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  1013.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1014.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1015.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1016.         HResult; stdcall;
  1017.     (*** Added in the v2 interface ***)
  1018.     function GetAvailableVidMem (var lpDDSCaps: TDDSCaps;
  1019.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1020.   end;
  1021.  
  1022.   IDirectDraw4 = interface (IUnknown)
  1023.     ['{9c59509a-39bd-11d1-8c4a-00c04fd930c5}']
  1024.     (*** IDirectDraw methods ***)
  1025.     function Compact: HResult; stdcall;
  1026.     function CreateClipper (dwFlags: DWORD;
  1027.         out lplpDDClipper: IDirectDrawClipper;
  1028.         pUnkOuter: IUnknown) : HResult; stdcall;
  1029.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  1030.         out lplpDDPalette: IDirectDrawPalette;
  1031.         pUnkOuter: IUnknown) : HResult; stdcall;
  1032.     function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1033.         out lplpDDSurface: IDirectDrawSurface4;
  1034.         pUnkOuter: IUnknown) : HResult; stdcall;
  1035.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface4;
  1036.         out lplpDupDDSurface: IDirectDrawSurface4) : HResult; stdcall;
  1037.     function EnumDisplayModes (dwFlags: DWORD;
  1038.         lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
  1039.         lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
  1040.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1041.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback2) :
  1042.         HResult; stdcall;
  1043.     function FlipToGDISurface: HResult; stdcall;
  1044.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1045.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1046.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1047.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface4) :
  1048.         HResult; stdcall;
  1049.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1050.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1051.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1052.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1053.     function RestoreDisplayMode: HResult; stdcall;
  1054.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1055. (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  1056.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1057.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1058.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1059.         HResult; stdcall;
  1060.     (*** Added in the v2 interface ***)
  1061.     function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
  1062.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1063.     (*** Added in the V4 Interface ***)
  1064.     function GetSurfaceFromDC (hdc : Windows.HDC;
  1065.         out lpDDS4: IDirectDrawSurface4) : HResult; stdcall;
  1066.     function RestoreAllSurfaces : HResult; stdcall;
  1067.     function TestCooperativeLevel : HResult; stdcall;
  1068.     function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier;
  1069.         dwFlags: DWORD) : HResult; stdcall;
  1070.   end;
  1071.  
  1072.   IDirectDraw7 = interface (IUnknown)
  1073.     ['{15e65ec0-3b9c-11d2-b92f-00609797ea5b}']
  1074.     (*** IDirectDraw methods ***)
  1075.     function Compact: HResult; stdcall;
  1076.     function CreateClipper (dwFlags: DWORD;
  1077.         out lplpDDClipper: IDirectDrawClipper;
  1078.         pUnkOuter: IUnknown) : HResult; stdcall;
  1079.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  1080.         out lplpDDPalette: IDirectDrawPalette;
  1081.         pUnkOuter: IUnknown) : HResult; stdcall;
  1082.     function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1083.         out lplpDDSurface: IDirectDrawSurface7;
  1084.         pUnkOuter: IUnknown) : HResult; stdcall;
  1085.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface7;
  1086.         out lplpDupDDSurface: IDirectDrawSurface7) : HResult; stdcall;
  1087.     function EnumDisplayModes (dwFlags: DWORD;
  1088.         lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
  1089.         lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
  1090.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1091.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback7) :
  1092.         HResult; stdcall;
  1093.     function FlipToGDISurface: HResult; stdcall;
  1094.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1095.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1096.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1097.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface7) :
  1098.         HResult; stdcall;
  1099.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1100.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1101.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1102.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1103.     function RestoreDisplayMode: HResult; stdcall;
  1104.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1105.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1106.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1107.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1108.         HResult; stdcall;
  1109.     (*** Added in the v2 interface ***)
  1110.     function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
  1111.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1112.     (*** Added in the V4 Interface ***)
  1113.     function GetSurfaceFromDC (hdc : Windows.HDC;
  1114.         out lpDDS: IDirectDrawSurface7) : HResult; stdcall;
  1115.     function RestoreAllSurfaces : HResult; stdcall;
  1116.     function TestCooperativeLevel : HResult; stdcall;
  1117.     function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier2;
  1118.         dwFlags: DWORD) : HResult; stdcall;
  1119.     function StartModeTest(const lpModesToTest; dwNumEntries, dwFlags: DWORD) : HResult; stdcall;
  1120.     function EvaluateMode(dwFlags: DWORD; out pSecondsUntilTimeout: DWORD) : HResult; stdcall;
  1121.   end;
  1122.  
  1123.  
  1124.  
  1125. (*
  1126.  * IDirectDrawPalette
  1127.  *)
  1128.  
  1129.   IDirectDrawPalette = interface (IUnknown)
  1130.     ['{6C14DB84-A733-11CE-A521-0020AF0BE560}']
  1131.     (*** IDirectDrawPalette methods ***)
  1132.     function GetCaps (out lpdwCaps: DWORD) : HResult; stdcall;
  1133.     function GetEntries (dwFlags: DWORD; dwBase: DWORD; dwNumEntries: DWORD;
  1134.         lpEntries: pointer) : HResult; stdcall;
  1135.     function Initialize (lpDD: IDirectDraw; dwFlags: DWORD;
  1136.         lpDDColorTable: pointer) : HResult; stdcall;
  1137.     function SetEntries (dwFlags: DWORD; dwStartingEntry: DWORD;
  1138.         dwCount: DWORD; lpEntries: pointer) : HResult; stdcall;
  1139.   end;
  1140.  
  1141. (*
  1142.  * IDirectDrawClipper
  1143.  *)
  1144.  
  1145.   IDirectDrawClipper = interface (IUnknown)
  1146.     ['{6C14DB85-A733-11CE-A521-0020AF0BE560}']
  1147.     (*** IDirectDrawClipper methods ***)
  1148.     function GetClipList (lpRect: PRect; lpClipList: PRgnData;
  1149.         var lpdwSize: DWORD) : HResult; stdcall;
  1150.     function GetHWnd (out lphWnd: HWND) : HResult; stdcall;
  1151.     function Initialize (lpDD: IDirectDraw; dwFlags: DWORD) : HResult; stdcall;
  1152.     function IsClipListChanged (out lpbChanged: BOOL) : HResult; stdcall;
  1153.     function SetClipList (lpClipList: PRgnData; dwFlags: DWORD) : HResult; stdcall;
  1154.     function SetHWnd (dwFlags: DWORD; hWnd: HWND) : HResult; stdcall;
  1155.   end;
  1156.  
  1157. (*
  1158.  * IDirectDrawSurface and related interfaces
  1159.  *)
  1160.  
  1161.   IDirectDrawSurface = interface (IUnknown)
  1162.     ['{6C14DB81-A733-11CE-A521-0020AF0BE560}']
  1163.     (*** IDirectDrawSurface methods ***)
  1164.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface) :
  1165.         HResult; stdcall;
  1166.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1167.     function Blt (lpDestRect: PRect;
  1168.         lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
  1169.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1170.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1171.         dwFlags: DWORD) : HResult; stdcall;
  1172.     function BltFast (dwX: DWORD; dwY: DWORD;
  1173.         lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
  1174.         dwTrans: DWORD) : HResult; stdcall;
  1175.     function DeleteAttachedSurface (dwFlags: DWORD;
  1176.         lpDDSAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
  1177.     function EnumAttachedSurfaces (lpContext: Pointer;
  1178.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1179.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1180.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1181.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface;
  1182.         dwFlags: DWORD) : HResult; stdcall;
  1183.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1184.         (*out*)var lplpDDAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
  1185.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1186.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1187.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1188.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1189.         HResult; stdcall;
  1190.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1191.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1192.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1193.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1194.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1195.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1196.     function Initialize (lpDD: IDirectDraw;
  1197.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1198.     function IsLost: HResult; stdcall;
  1199.     function Lock (lpDestRect: PRect; out lpDDSurfaceDesc:
  1200.         TDDSurfaceDesc; dwFlags: DWORD; hEvent: THandle) : HResult; stdcall;
  1201.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1202.     function _Restore: HResult; stdcall;
  1203.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1204.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1205.         HResult; stdcall;
  1206.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1207.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1208.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1209.     function UpdateOverlay (lpSrcRect: PRect;
  1210.         lpDDDestSurface: IDirectDrawSurface; lpDestRect: PRect;
  1211.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1212.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1213.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1214.         lpDDSReference: IDirectDrawSurface) : HResult; stdcall;
  1215.   end;
  1216.  
  1217. (*
  1218.  * IDirectDrawSurface2 and related interfaces
  1219.  *)
  1220.  
  1221.   IDirectDrawSurface2 = interface (IUnknown)
  1222.     ['{57805885-6eec-11cf-9441-a82303c10e27}']
  1223.     (*** IDirectDrawSurface methods ***)
  1224.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface2) :
  1225.         HResult; stdcall;
  1226.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1227.     function Blt (lpDestRect: PRect;
  1228.         lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
  1229.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1230.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1231.         dwFlags: DWORD) : HResult; stdcall;
  1232.     function BltFast (dwX: DWORD; dwY: DWORD;
  1233.         lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
  1234.         dwTrans: DWORD) : HResult; stdcall;
  1235.     function DeleteAttachedSurface (dwFlags: DWORD;
  1236.         lpDDSAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
  1237.     function EnumAttachedSurfaces (lpContext: Pointer;
  1238.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1239.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1240.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1241.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface2;
  1242.         dwFlags: DWORD) : HResult; stdcall;
  1243.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1244.         out lplpDDAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
  1245.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1246.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1247.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1248.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1249.         HResult; stdcall;
  1250.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1251.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1252.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1253.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1254.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1255.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1256.     function Initialize (lpDD: IDirectDraw;
  1257.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1258.     function IsLost: HResult; stdcall;
  1259.     function Lock (lpDestRect: PRect;
  1260.         out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
  1261.         hEvent: THandle) : HResult; stdcall;
  1262.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1263.     function _Restore: HResult; stdcall;
  1264.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1265.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1266.         HResult; stdcall;
  1267.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1268.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1269.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1270.     function UpdateOverlay (lpSrcRect: PRect;
  1271.         lpDDDestSurface: IDirectDrawSurface2; lpDestRect: PRect;
  1272.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1273.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1274.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1275.         lpDDSReference: IDirectDrawSurface2) : HResult; stdcall;
  1276.     (*** Added in the v2 interface ***)
  1277.     function GetDDInterface (var lplpDD: IDirectDraw) : HResult; stdcall;
  1278.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1279.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1280.   end;
  1281.  
  1282.   IDirectDrawSurface3 = interface (IUnknown)
  1283.     ['{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}']
  1284.     (*** IDirectDrawSurface methods ***)
  1285.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface3) :
  1286.         HResult; stdcall;
  1287.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1288.     function Blt (lpDestRect: PRect;
  1289.         lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
  1290.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1291.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1292.         dwFlags: DWORD) : HResult; stdcall;
  1293.     function BltFast (dwX: DWORD; dwY: DWORD;
  1294.         lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
  1295.         dwTrans: DWORD) : HResult; stdcall;
  1296.     function DeleteAttachedSurface (dwFlags: DWORD;
  1297.         lpDDSAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
  1298.     function EnumAttachedSurfaces (lpContext: Pointer;
  1299.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1300.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1301.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1302.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface3;
  1303.         dwFlags: DWORD) : HResult; stdcall;
  1304.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1305.         out lplpDDAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
  1306.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1307.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1308.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1309.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1310.         HResult; stdcall;
  1311.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1312.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1313.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1314.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1315.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1316.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1317.     function Initialize (lpDD: IDirectDraw;
  1318.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1319.     function IsLost: HResult; stdcall;
  1320.     function Lock (lpDestRect: PRect;
  1321.         out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
  1322.         hEvent: THandle) : HResult; stdcall;
  1323.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1324.     function _Restore: HResult; stdcall;
  1325.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1326.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1327.         HResult; stdcall;
  1328.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1329.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1330.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1331.     function UpdateOverlay (lpSrcRect: PRect;
  1332.         lpDDDestSurface: IDirectDrawSurface3; lpDestRect: PRect;
  1333.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1334.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1335.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1336.         lpDDSReference: IDirectDrawSurface3) : HResult; stdcall;
  1337.     (*** Added in the v2 interface ***)
  1338.     function GetDDInterface (out lplpDD: IDirectDraw) : HResult; stdcall;
  1339.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1340.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1341.     (*** Added in the V3 interface ***)
  1342.     function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc; dwFlags: DWORD) : HResult; stdcall;
  1343.   end;
  1344.  
  1345. (*
  1346.  * IDirectDrawSurface4 and related interfaces
  1347.  *)
  1348.   IDirectDrawSurface4 = interface (IUnknown)
  1349.     ['{0B2B8630-AD35-11D0-8EA6-00609797EA5B}']
  1350.     (*** IDirectDrawSurface methods ***)
  1351.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface4) :
  1352.         HResult; stdcall;
  1353.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1354.     function Blt (lpDestRect: PRect;
  1355.         lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
  1356.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1357.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1358.         dwFlags: DWORD) : HResult; stdcall;
  1359.     function BltFast (dwX: DWORD; dwY: DWORD;
  1360.         lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
  1361.         dwTrans: DWORD) : HResult; stdcall;
  1362.     function DeleteAttachedSurface (dwFlags: DWORD;
  1363.         lpDDSAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
  1364.     function EnumAttachedSurfaces (lpContext: Pointer;
  1365.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
  1366.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1367.         lpfnCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
  1368.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface4;
  1369.         dwFlags: DWORD) : HResult; stdcall;
  1370.     function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
  1371.         out lplpDDAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
  1372.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1373.     function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
  1374.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1375.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1376.         HResult; stdcall;
  1377.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1378.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1379.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1380.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1381.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1382.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1383.     function Initialize (lpDD: IDirectDraw;
  1384.         out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1385.     function IsLost: HResult; stdcall;
  1386.     function Lock (lpDestRect: PRect;
  1387.         out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
  1388.         hEvent: THandle) : HResult; stdcall;
  1389.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1390.     function _Restore: HResult; stdcall;
  1391.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1392.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1393.         HResult; stdcall;
  1394.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1395.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1396.     function Unlock (lpRect: PRect) : HResult; stdcall;
  1397.     function UpdateOverlay (lpSrcRect: PRect;
  1398.         lpDDDestSurface: IDirectDrawSurface4; lpDestRect: PRect;
  1399.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1400.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1401.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1402.         lpDDSReference: IDirectDrawSurface4) : HResult; stdcall;
  1403.     (*** Added in the v2 interface ***)
  1404.     function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
  1405.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1406.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1407.     (*** Added in the V3 interface ***)
  1408.     function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
  1409.     (*** Added in the v4 interface ***)
  1410.     function SetPrivateData(const guidTag: TGUID; lpData: pointer;
  1411.         cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1412.     function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
  1413.         var lpcbBufferSize: DWORD) : HResult; stdcall;
  1414.     function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
  1415.     function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
  1416.     function ChangeUniquenessValue : HResult; stdcall;
  1417.   end;
  1418.  
  1419.   IDirectDrawSurface7 = interface (IUnknown)
  1420.     ['{06675a80-3b9b-11d2-b92f-00609797ea5b}']
  1421.     (*** IDirectDrawSurface methods ***)
  1422.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface7) :
  1423.         HResult; stdcall;
  1424.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1425.     function Blt (lpDestRect: PRect;
  1426.         lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
  1427.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1428.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1429.         dwFlags: DWORD) : HResult; stdcall;
  1430.     function BltFast (dwX: DWORD; dwY: DWORD;
  1431.         lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
  1432.         dwTrans: DWORD) : HResult; stdcall;
  1433.     function DeleteAttachedSurface (dwFlags: DWORD;
  1434.         lpDDSAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
  1435.     function EnumAttachedSurfaces (lpContext: Pointer;
  1436.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
  1437.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1438.         lpfnCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
  1439.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface7;
  1440.         dwFlags: DWORD) : HResult; stdcall;
  1441.     function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
  1442.         out lplpDDAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
  1443.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1444.     function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
  1445.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1446.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1447.         HResult; stdcall;
  1448.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1449.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1450.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1451.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1452.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1453.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1454.     function Initialize (lpDD: IDirectDraw;
  1455.         out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1456.     function IsLost: HResult; stdcall;
  1457.     function Lock (lpDestRect: PRect;
  1458.         out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
  1459.         hEvent: THandle) : HResult; stdcall;
  1460.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1461.     function _Restore: HResult; stdcall;
  1462.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1463.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1464.         HResult; stdcall;
  1465.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1466.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1467.     function Unlock (lpRect: PRect) : HResult; stdcall;
  1468.     function UpdateOverlay (lpSrcRect: PRect;
  1469.         lpDDDestSurface: IDirectDrawSurface7; lpDestRect: PRect;
  1470.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1471.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1472.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1473.         lpDDSReference: IDirectDrawSurface7) : HResult; stdcall;
  1474.     (*** Added in the v2 interface ***)
  1475.     function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
  1476.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1477.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1478.     (*** Added in the V3 interface ***)
  1479.     function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
  1480.     (*** Added in the v4 interface ***)
  1481.     function SetPrivateData(const guidTag: TGUID; lpData: pointer;
  1482.         cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1483.     function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
  1484.         var lpcbBufferSize: DWORD) : HResult; stdcall;
  1485.     function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
  1486.     function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
  1487.     function ChangeUniquenessValue : HResult; stdcall;
  1488.     (*** Moved Texture7 methods here ***)
  1489.     function SetPriority(dwPriority: DWORD) : HResult; stdcall;
  1490.     function GetPriority(out lpdwPriority: DWORD) : HResult; stdcall;
  1491.     function SetLOD(dwMaxLOD: DWORD) : HResult; stdcall;
  1492.     function GetLOD(out lpdwMaxLOD: DWORD) : HResult; stdcall;
  1493.   end;
  1494.  
  1495.   IDirectDrawColorControl = interface (IUnknown)
  1496.     ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}']
  1497.     function GetColorControls(out lpColorControl: TDDColorControl) : HResult; stdcall;
  1498.     function SetColorControls(const lpColorControl: TDDColorControl) : HResult; stdcall;
  1499.   end;
  1500.  
  1501. (*
  1502.  * IDirectDrawGammaControl
  1503.  *)
  1504.   IDirectDrawGammaControl = interface (IUnknown)
  1505.     ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}']
  1506.     function GetGammaRamp (dwFlags: DWORD; out lpRampData: TDDGammaRamp)
  1507.         : HResult; stdcall;
  1508.     function SetGammaRamp (dwFlags: DWORD; const lpRampData: TDDGammaRamp)
  1509.         : HResult; stdcall;
  1510.   end;
  1511.  
  1512. type
  1513.   IID_IDirectDraw = IDirectDraw;
  1514.   IID_IDirectDraw2 = IDirectDraw2;
  1515.   IID_IDirectDraw4 = IDirectDraw4;
  1516.   IID_IDirectDraw7 = IDirectDraw7;
  1517.   IID_IDirectDrawSurface = IDirectDrawSurface;
  1518.   IID_IDirectDrawSurface2 = IDirectDrawSurface2;
  1519.   IID_IDirectDrawSurface3 = IDirectDrawSurface3;
  1520.   IID_IDirectDrawSurface4 = IDirectDrawSurface4;
  1521.   IID_IDirectDrawSurface7 = IDirectDrawSurface7;
  1522.  
  1523.   IID_IDirectDrawPalette = IDirectDrawPalette;
  1524.   IID_IDirectDrawClipper = IDirectDrawClipper;
  1525.   IID_IDirectDrawColorControl = IDirectDrawColorControl;
  1526.   IID_IDirectDrawGammaControl = IDirectDrawGammaControl;
  1527.  
  1528. const  
  1529. (*
  1530.  * ddsCaps field is valid.
  1531.  *)
  1532.   DDSD_CAPS               = $00000001;     // default
  1533.  
  1534. (*
  1535.  * dwHeight field is valid.
  1536.  *)
  1537.   DDSD_HEIGHT             = $00000002;
  1538.  
  1539. (*
  1540.  * dwWidth field is valid.
  1541.  *)
  1542.   DDSD_WIDTH              = $00000004;
  1543.  
  1544. (*
  1545.  * lPitch is valid.
  1546.  *)
  1547.   DDSD_PITCH              = $00000008;
  1548.  
  1549. (*
  1550.  * dwBackBufferCount is valid.
  1551.  *)
  1552.   DDSD_BACKBUFFERCOUNT    = $00000020;
  1553.  
  1554. (*
  1555.  * dwZBufferBitDepth is valid.  (shouldnt be used in DDSURFACEDESC2)
  1556.  *)
  1557.   DDSD_ZBUFFERBITDEPTH    = $00000040;
  1558.  
  1559. (*
  1560.  * dwAlphaBitDepth is valid.
  1561.  *)
  1562.    DDSD_ALPHABITDEPTH      = $00000080;
  1563.  
  1564. (*
  1565.  * lpSurface is valid.
  1566.  *)
  1567.   DDSD_LPSURFACE           = $00000800;
  1568.  
  1569. (*
  1570.  * ddpfPixelFormat is valid.
  1571.  *)
  1572.   DDSD_PIXELFORMAT        = $00001000;
  1573.  
  1574. (*
  1575.  * ddckCKDestOverlay is valid.
  1576.  *)
  1577.   DDSD_CKDESTOVERLAY      = $00002000;
  1578.  
  1579. (*
  1580.  * ddckCKDestBlt is valid.
  1581.  *)
  1582.   DDSD_CKDESTBLT          = $00004000;
  1583.  
  1584. (*
  1585.  * ddckCKSrcOverlay is valid.
  1586.  *)
  1587.   DDSD_CKSRCOVERLAY       = $00008000;
  1588.  
  1589. (*
  1590.  * ddckCKSrcBlt is valid.
  1591.  *)
  1592.   DDSD_CKSRCBLT           = $00010000;
  1593.  
  1594. (*
  1595.  * dwMipMapCount is valid.
  1596.  *)
  1597.   DDSD_MIPMAPCOUNT        = $00020000;
  1598.  
  1599.  (*
  1600.   * dwRefreshRate is valid
  1601.   *)
  1602.   DDSD_REFRESHRATE        = $00040000;
  1603.  
  1604. (*
  1605.  * dwLinearSize is valid
  1606.  *)
  1607.   DDSD_LINEARSIZE         = $00080000;
  1608.  
  1609. (*
  1610.  * dwTextureStage is valid
  1611.  *)
  1612.   DDSD_TEXTURESTAGE       = $00100000;
  1613.  
  1614. (*
  1615.  * All input fields are valid.
  1616.  *)
  1617.   DDSD_ALL                = $001ff9ee;
  1618.  
  1619.  
  1620. (*
  1621.  * guid field is valid.
  1622.  *)
  1623.   DDOSD_GUID                  = $00000001;
  1624.  
  1625. (*
  1626.  * dwCompressionRatio field is valid.
  1627.  *)
  1628.   DDOSD_COMPRESSION_RATIO     = $00000002;
  1629.  
  1630. (*
  1631.  * ddSCaps field is valid.
  1632.  *)
  1633.   DDOSD_SCAPS                 = $00000004;
  1634.  
  1635. (*
  1636.  * ddOSCaps field is valid.
  1637.  *)
  1638.   DDOSD_OSCAPS                = $00000008;
  1639.  
  1640. (*
  1641.  * All input fields are valid.
  1642.  *)
  1643.   DDOSD_ALL                   = $0000000f;
  1644.  
  1645. (*
  1646.  * The surface's optimized pixelformat is compressed
  1647.  *)
  1648.   DDOSDCAPS_OPTCOMPRESSED                       = $00000001;
  1649.  
  1650. (*
  1651.  * The surface's optimized pixelformat is reordered
  1652.  *)
  1653.   DDOSDCAPS_OPTREORDERED                        = $00000002;
  1654.  
  1655. (*
  1656.  * The opt surface is a monolithic mipmap
  1657.  *)
  1658.   DDOSDCAPS_MONOLITHICMIPMAP            = $00000004;
  1659.  
  1660. (*
  1661.  * The valid Surf caps:
  1662.  *   DDSCAPS_SYSTEMMEMORY       = $00000800;
  1663.  *   DDSCAPS_VIDEOMEMORY        = $00004000;
  1664.  *   DDSCAPS_LOCALVIDMEM        = $10000000;
  1665.  *   DDSCAPS_NONLOCALVIDMEM     = $20000000;
  1666.  *)
  1667.   DDOSDCAPS_VALIDSCAPS          = $30004800;
  1668.  
  1669. (*
  1670.  * The valid OptSurf caps
  1671.  *)
  1672.   DDOSDCAPS_VALIDOSCAPS                 = $00000007;
  1673.  
  1674.  
  1675. (*
  1676.  * DDCOLORCONTROL
  1677.  *)
  1678.  
  1679. (*
  1680.  * lBrightness field is valid.
  1681.  *)
  1682.   DDCOLOR_BRIGHTNESS            = $00000001;
  1683.  
  1684. (*
  1685.  * lContrast field is valid.
  1686.  *)
  1687.   DDCOLOR_CONTRAST              = $00000002;
  1688.  
  1689. (*
  1690.  * lHue field is valid.
  1691.  *)
  1692.   DDCOLOR_HUE                   = $00000004;
  1693.  
  1694. (*
  1695.  * lSaturation field is valid.
  1696.  *)
  1697.   DDCOLOR_SATURATION            = $00000008;
  1698.  
  1699. (*
  1700.  * lSharpness field is valid.
  1701.  *)
  1702.   DDCOLOR_SHARPNESS             = $00000010;
  1703.  
  1704. (*
  1705.  * lGamma field is valid.
  1706.  *)
  1707.   DDCOLOR_GAMMA                 = $00000020;
  1708.  
  1709. (*
  1710.  * lColorEnable field is valid.
  1711.  *)
  1712.   DDCOLOR_COLORENABLE           = $00000040;
  1713.  
  1714.  
  1715.  
  1716. (*============================================================================
  1717.  *
  1718.  * Direct Draw Capability Flags
  1719.  *
  1720.  * These flags are used to describe the capabilities of a given Surface.
  1721.  * All flags are bit flags.
  1722.  *
  1723.  *==========================================================================*)
  1724.  
  1725. (****************************************************************************
  1726.  *
  1727.  * DIRECTDRAWSURFACE CAPABILITY FLAGS
  1728.  *
  1729.  ****************************************************************************)
  1730. (*
  1731.  * This bit currently has no meaning.
  1732.  *)
  1733.   DDSCAPS_RESERVED1                       = $00000001;
  1734.  
  1735. (*
  1736.  * Indicates that this surface contains alpha-only information.
  1737.  * (To determine if a surface is RGBA/YUVA, the pixel format must be
  1738.  * interrogated.)
  1739.  *)
  1740.   DDSCAPS_ALPHA                           = $00000002;
  1741.  
  1742. (*
  1743.  * Indicates that this surface is a backbuffer.  It is generally
  1744.  * set by CreateSurface when the DDSCAPS_FLIP capability bit is set.
  1745.  * It indicates that this surface is THE back buffer of a surface
  1746.  * flipping structure.  DirectDraw supports N surfaces in a
  1747.  * surface flipping structure.  Only the surface that immediately
  1748.  * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set.
  1749.  * The other surfaces are identified as back buffers by the presence
  1750.  * of the DDSCAPS_FLIP capability, their attachment order, and the
  1751.  * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER
  1752.  * capabilities.  The bit is sent to CreateSurface when a standalone
  1753.  * back buffer is being created.  This surface could be attached to
  1754.  * a front buffer and/or back buffers to form a flipping surface
  1755.  * structure after the CreateSurface call.  See AddAttachments for
  1756.  * a detailed description of the behaviors in this case.
  1757.  *)
  1758.   DDSCAPS_BACKBUFFER                      = $00000004;
  1759.  
  1760. (*
  1761.  * Indicates a complex surface structure is being described.  A
  1762.  * complex surface structure results in the creation of more than
  1763.  * one surface.  The additional surfaces are attached to the root
  1764.  * surface.  The complex structure can only be destroyed by
  1765.  * destroying the root.
  1766.  *)
  1767.   DDSCAPS_COMPLEX                         = $00000008;
  1768.  
  1769. (*
  1770.  * Indicates that this surface is a part of a surface flipping structure.
  1771.  * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and
  1772.  * DDSCAP_BACKBUFFER bits are not set.  They are set by CreateSurface
  1773.  * on the resulting creations.  The dwBackBufferCount field in the
  1774.  * TDDSurfaceDesc structure must be set to at least 1 in order for
  1775.  * the CreateSurface call to succeed.  The DDSCAPS_COMPLEX capability
  1776.  * must always be set with creating multiple surfaces through CreateSurface.
  1777.  *)
  1778.   DDSCAPS_FLIP                            = $00000010;
  1779.  
  1780. (*
  1781.  * Indicates that this surface is THE front buffer of a surface flipping
  1782.  * structure.  It is generally set by CreateSurface when the DDSCAPS_FLIP
  1783.  * capability bit is set.
  1784.  * If this capability is sent to CreateSurface then a standalonw front buffer
  1785.  * is created.  This surface will not have the DDSCAPS_FLIP capability.
  1786.  * It can be attached to other back buffers to form a flipping structure.
  1787.  * See AddAttachments for a detailed description of the behaviors in this
  1788.  * case.
  1789.  *)
  1790.   DDSCAPS_FRONTBUFFER                     = $00000020;
  1791.  
  1792. (*
  1793.  * Indicates that this surface is any offscreen surface that is not an overlay,
  1794.  * texture, zbuffer, front buffer, back buffer, or alpha surface.  It is used
  1795.  * to identify plain vanilla surfaces.
  1796.  *)
  1797.   DDSCAPS_OFFSCREENPLAIN                  = $00000040;
  1798.  
  1799. (*
  1800.  * Indicates that this surface is an overlay.  It may or may not be directly visible
  1801.  * depending on whether or not it is currently being overlayed onto the primary
  1802.  * surface.  DDSCAPS_VISIBLE can be used to determine whether or not it is being
  1803.  * overlayed at the moment.
  1804.  *)
  1805.   DDSCAPS_OVERLAY                         = $00000080;
  1806.  
  1807. (*
  1808.  * Indicates that unique DirectDrawPalette objects can be created and
  1809.  * attached to this surface.
  1810.  *)
  1811.   DDSCAPS_PALETTE                         = $00000100;
  1812.  
  1813. (*
  1814.  * Indicates that this surface is the primary surface.  The primary
  1815.  * surface represents what the user is seeing at the moment.
  1816.  *)
  1817.   DDSCAPS_PRIMARYSURFACE                  = $00000200;
  1818.  
  1819. (*
  1820.  * This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now
  1821.  * obsolete.
  1822.  *)
  1823.   DDSCAPS_RESERVED3              = $00000400;
  1824. (*
  1825.  * Indicates that this surface is the primary surface for the left eye.
  1826.  * The primary surface for the left eye represents what the user is seeing
  1827.  * at the moment with the users left eye.  When this surface is created the
  1828.  * DDSCAPS_PRIMARYSURFACE represents what the user is seeing with the users
  1829.  * right eye.
  1830.  *)
  1831.   DDSCAPS_PRIMARYSURFACELEFT = DDSCAPS_RESERVED3;
  1832.  
  1833. (*
  1834.  * Indicates that this surface memory was allocated in system memory
  1835.  *)
  1836.   DDSCAPS_SYSTEMMEMORY                    = $00000800;
  1837.  
  1838. (*
  1839.  * Indicates that this surface can be used as a 3D texture.  It does not
  1840.  * indicate whether or not the surface is being used for that purpose.
  1841.  *)
  1842.   DDSCAPS_TEXTURE                         = $00001000;
  1843.  
  1844. (*
  1845.  * Indicates that a surface may be a destination for 3D rendering.  This
  1846.  * bit must be set in order to query for a Direct3D Device Interface
  1847.  * from this surface.
  1848.  *)
  1849.   DDSCAPS_3DDEVICE                        = $00002000;
  1850.  
  1851. (*
  1852.  * Indicates that this surface exists in video memory.
  1853.  *)
  1854.   DDSCAPS_VIDEOMEMORY                     = $00004000;
  1855.  
  1856. (*
  1857.  * Indicates that changes made to this surface are immediately visible.
  1858.  * It is always set for the primary surface and is set for overlays while
  1859.  * they are being overlayed and texture maps while they are being textured.
  1860.  *)
  1861.   DDSCAPS_VISIBLE                         = $00008000;
  1862.  
  1863. (*
  1864.  * Indicates that only writes are permitted to the surface.  Read accesses
  1865.  * from the surface may or may not generate a protection fault, but the
  1866.  * results of a read from this surface will not be meaningful.  READ ONLY.
  1867.  *)
  1868.   DDSCAPS_WRITEONLY                       = $00010000;
  1869.  
  1870. (*
  1871.  * Indicates that this surface is a z buffer. A z buffer does not contain
  1872.  * displayable information.  Instead it contains bit depth information that is
  1873.  * used to determine which pixels are visible and which are obscured.
  1874.  *)
  1875.   DDSCAPS_ZBUFFER                         = $00020000;
  1876.  
  1877. (*
  1878.  * Indicates surface will have a DC associated long term
  1879.  *)
  1880.   DDSCAPS_OWNDC                           = $00040000;
  1881.  
  1882. (*
  1883.  * Indicates surface should be able to receive live video
  1884.  *)
  1885.   DDSCAPS_LIVEVIDEO                       = $00080000;
  1886.  
  1887. (*
  1888.  * Indicates surface should be able to have a stream decompressed
  1889.  * to it by the hardware.
  1890.  *)
  1891.   DDSCAPS_HWCODEC                         = $00100000;
  1892.  
  1893. (*
  1894.  * Surface is a ModeX surface.
  1895.  *
  1896.  *)
  1897.   DDSCAPS_MODEX                           = $00200000;
  1898.  
  1899. (*
  1900.  * Indicates surface is one level of a mip-map. This surface will
  1901.  * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map.
  1902.  * This can be done explicitly, by creating a number of surfaces and
  1903.  * attaching them with AddAttachedSurface or by implicitly by CreateSurface.
  1904.  * If this bit is set then DDSCAPS_TEXTURE must also be set.
  1905.  *)
  1906.   DDSCAPS_MIPMAP                          = $00400000;
  1907.  
  1908. (*
  1909.  * This bit is reserved. It should not be specified.
  1910.  *)
  1911.   DDSCAPS_RESERVED2                       = $00800000;
  1912.  
  1913. (*
  1914.  * Indicates that memory for the surface is not allocated until the surface
  1915.  * is loaded (via the Direct3D texture Load() function).
  1916.  *)
  1917.   DDSCAPS_ALLOCONLOAD                     = $04000000;
  1918.  
  1919. (*
  1920.  * Indicates that the surface will recieve data from a video port.
  1921.  *)
  1922.   DDSCAPS_VIDEOPORT                       = $08000000;
  1923.  
  1924. (*
  1925.  * Indicates that a video memory surface is resident in true, local video
  1926.  * memory rather than non-local video memory. If this flag is specified then
  1927.  * so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
  1928.  * DDSCAPS_NONLOCALVIDMEM.
  1929.  *)
  1930.   DDSCAPS_LOCALVIDMEM                     = $10000000;
  1931.  
  1932. (*
  1933.  * Indicates that a video memory surface is resident in non-local video
  1934.  * memory rather than true, local video memory. If this flag is specified
  1935.  * then so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
  1936.  * DDSCAPS_LOCALVIDMEM.
  1937.  *)
  1938.   DDSCAPS_NONLOCALVIDMEM                  = $20000000;
  1939.  
  1940. (*
  1941.  * Indicates that this surface is a standard VGA mode surface, and not a
  1942.  * ModeX surface. (This flag will never be set in combination with the
  1943.  * DDSCAPS_MODEX flag).
  1944.  *)
  1945.   DDSCAPS_STANDARDVGAMODE                 = $40000000;
  1946.  
  1947. (*
  1948.  * Indicates that this surface will be an optimized surface. This flag is
  1949.  * currently only valid in conjunction with the DDSCAPS_TEXTURE flag. The surface
  1950.  * will be created without any underlying video memory until loaded.
  1951.  *)
  1952.   DDSCAPS_OPTIMIZED                       = $80000000;
  1953.  
  1954.  
  1955.  
  1956. (*
  1957.  * Indicates that this surface will receive data from a video port using
  1958.  * the de-interlacing hardware.  This allows the driver to allocate memory
  1959.  * for any extra buffers that may be required.  The DDSCAPS_VIDEOPORT and
  1960.  * DDSCAPS_OVERLAY flags must also be set.
  1961.  *)
  1962.   DDSCAPS2_HARDWAREDEINTERLACE            = $00000002;
  1963.  
  1964. (*
  1965.  * Indicates to the driver that this surface will be locked very frequently
  1966.  * (for procedural textures, dynamic lightmaps, etc). Surfaces with this cap
  1967.  * set must also have DDSCAPS_TEXTURE. This cap cannot be used with
  1968.  * DDSCAPS2_HINTSTATIC and DDSCAPS2_OPAQUE.
  1969.  *)
  1970.   DDSCAPS2_HINTDYNAMIC                  = $00000004;
  1971.  
  1972. (*
  1973.  * Indicates to the driver that this surface can be re-ordered/retiled on
  1974.  * load. This operation will not change the size of the texture. It is
  1975.  * relatively fast and symmetrical, since the application may lock these
  1976.  * bits (although it will take a performance hit when doing so). Surfaces
  1977.  * with this cap set must also have DDSCAPS_TEXTURE. This cap cannot be
  1978.  * used with DDSCAPS2_HINTDYNAMIC and DDSCAPS2_OPAQUE.
  1979.  *)
  1980.   DDSCAPS2_HINTSTATIC                   = $00000008;
  1981.  
  1982. (*
  1983.  * Indicates that the client would like this texture surface to be managed by the
  1984.  * DirectDraw/Direct3D runtime. Surfaces with this cap set must also have
  1985.  * DDSCAPS_TEXTURE and DDSCAPS_SYSTEMMEMORY.
  1986.  *)
  1987.   DDSCAPS2_TEXTUREMANAGE                  = $00000010;
  1988.  
  1989. (*
  1990.  * These bits are reserved for internal use *)
  1991.   DDSCAPS2_RESERVED1                      = $00000020;
  1992.   DDSCAPS2_RESERVED2                      = $00000040;
  1993.  
  1994. (*
  1995.  * Indicates to the driver that this surface will never be locked again.
  1996.  * The driver is free to optimize this surface via retiling and actual compression.
  1997.  * All calls to Lock() or Blts from this surface will fail. Surfaces with this
  1998.  * cap set must also have DDSCAPS_TEXTURE. This cap cannot be used with
  1999.  * DDSCAPS2_HINTDYNAMIC and DDSCAPS2_HINTSTATIC.
  2000.  *)
  2001.   DDSCAPS2_OPAQUE                         = $00000080;
  2002.  
  2003. (*
  2004.  * Applications should set this bit at CreateSurface time to indicate that they
  2005.  * intend to use antialiasing. Only valid if DDSCAPS_3DDEVICE is also set.
  2006.  *)
  2007.   DDSCAPS2_HINTANTIALIASING               = $00000100;
  2008.  
  2009. (*
  2010.  * This flag is used at CreateSurface time to indicate that this set of
  2011.  * surfaces is a cubic environment map
  2012.  *)
  2013.   DDSCAPS2_CUBEMAP                        = $00000200;
  2014.  
  2015. (*
  2016.  * These flags preform two functions:
  2017.  * - At CreateSurface time, they define which of the six cube faces are
  2018.  *   required by the application.
  2019.  * - After creation, each face in the cubemap will have exactly one of these
  2020.  *   bits set.
  2021.  *)
  2022.   DDSCAPS2_CUBEMAP_POSITIVEX              = $00000400;
  2023.   DDSCAPS2_CUBEMAP_NEGATIVEX              = $00000800;
  2024.   DDSCAPS2_CUBEMAP_POSITIVEY              = $00001000;
  2025.   DDSCAPS2_CUBEMAP_NEGATIVEY              = $00002000;
  2026.   DDSCAPS2_CUBEMAP_POSITIVEZ              = $00004000;
  2027.   DDSCAPS2_CUBEMAP_NEGATIVEZ              = $00008000;
  2028.  
  2029. (*
  2030.  * This macro may be used to specify all faces of a cube map at CreateSurface time
  2031.  *)
  2032.   DDSCAPS2_CUBEMAP_ALLFACES = ( DDSCAPS2_CUBEMAP_POSITIVEX or
  2033.                                 DDSCAPS2_CUBEMAP_NEGATIVEX or
  2034.                                 DDSCAPS2_CUBEMAP_POSITIVEY or
  2035.                                 DDSCAPS2_CUBEMAP_NEGATIVEY or
  2036.                                 DDSCAPS2_CUBEMAP_POSITIVEZ or
  2037.                                 DDSCAPS2_CUBEMAP_NEGATIVEZ );
  2038.  
  2039.  
  2040. (*
  2041.  * This flag is an additional flag which is present on mipmap sublevels from DX7 onwards
  2042.  * It enables easier use of GetAttachedSurface rather than EnumAttachedSurfaces for surface
  2043.  * constructs such as Cube Maps, wherein there are more than one mipmap surface attached
  2044.  * to the root surface.
  2045.  * This caps bit is ignored by CreateSurface
  2046.  *)
  2047.   DDSCAPS2_MIPMAPSUBLEVEL                 = $00010000;
  2048.  
  2049. (* This flag indicates that the texture should be managed by D3D only *)
  2050.   DDSCAPS2_D3DTEXTUREMANAGE               = $00020000;
  2051.  
  2052. (* This flag indicates that the managed surface can be safely lost *)
  2053.   DDSCAPS2_DONOTPERSIST                   = $00040000;
  2054.  
  2055. (* indicates that this surface is part of a stereo flipping chain *)
  2056.   DDSCAPS2_STEREOSURFACELEFT              = $00080000;
  2057.  
  2058.  
  2059.  
  2060.  (****************************************************************************
  2061.  *
  2062.  * DIRECTDRAW DRIVER CAPABILITY FLAGS
  2063.  *
  2064.  ****************************************************************************)
  2065.  
  2066. (*
  2067.  * Display hardware has 3D acceleration.
  2068.  *)
  2069.   DDCAPS_3D                       = $00000001;
  2070.  
  2071. (*
  2072.  * Indicates that DirectDraw will support only dest rectangles that are aligned
  2073.  * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively.
  2074.  * READ ONLY.
  2075.  *)
  2076.   DDCAPS_ALIGNBOUNDARYDEST        = $00000002;
  2077.  
  2078. (*
  2079.  * Indicates that DirectDraw will support only source rectangles  whose sizes in
  2080.  * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively.  READ ONLY.
  2081.  *)
  2082.   DDCAPS_ALIGNSIZEDEST            = $00000004;
  2083. (*
  2084.  * Indicates that DirectDraw will support only source rectangles that are aligned
  2085.  * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively.
  2086.  * READ ONLY.
  2087.  *)
  2088.   DDCAPS_ALIGNBOUNDARYSRC         = $00000008;
  2089.  
  2090. (*
  2091.  * Indicates that DirectDraw will support only source rectangles  whose sizes in
  2092.  * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively.  READ ONLY.
  2093.  *)
  2094.   DDCAPS_ALIGNSIZESRC             = $00000010;
  2095.  
  2096. (*
  2097.  * Indicates that DirectDraw will create video memory surfaces that have a stride
  2098.  * alignment equal to DIRECTDRAWCAPS.dwAlignStride.  READ ONLY.
  2099.  *)
  2100.   DDCAPS_ALIGNSTRIDE              = $00000020;
  2101.  
  2102. (*
  2103.  * Display hardware is capable of blt operations.
  2104.  *)
  2105.   DDCAPS_BLT                      = $00000040;
  2106.  
  2107. (*
  2108.  * Display hardware is capable of asynchronous blt operations.
  2109.  *)
  2110.   DDCAPS_BLTQUEUE                 = $00000080;
  2111.  
  2112. (*
  2113.  * Display hardware is capable of color space conversions during the blt operation.
  2114.  *)
  2115.   DDCAPS_BLTFOURCC                = $00000100;
  2116.  
  2117. (*
  2118.  * Display hardware is capable of stretching during blt operations.
  2119.  *)
  2120.   DDCAPS_BLTSTRETCH               = $00000200;
  2121.  
  2122. (*
  2123.  * Display hardware is shared with GDI.
  2124.  *)
  2125.   DDCAPS_GDI                      = $00000400;
  2126.  
  2127. (*
  2128.  * Display hardware can overlay.
  2129.  *)
  2130.   DDCAPS_OVERLAY                  = $00000800;
  2131.  
  2132. (*
  2133.  * Set if display hardware supports overlays but can not clip them.
  2134.  *)
  2135.   DDCAPS_OVERLAYCANTCLIP          = $00001000;
  2136.  
  2137. (*
  2138.  * Indicates that overlay hardware is capable of color space conversions during
  2139.  * the overlay operation.
  2140.  *)
  2141.   DDCAPS_OVERLAYFOURCC            = $00002000;
  2142.  
  2143. (*
  2144.  * Indicates that stretching can be done by the overlay hardware.
  2145.  *)
  2146.   DDCAPS_OVERLAYSTRETCH           = $00004000;
  2147.  
  2148. (*
  2149.  * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces
  2150.  * other than the primary surface.
  2151.  *)
  2152.   DDCAPS_PALETTE                  = $00008000;
  2153.  
  2154. (*
  2155.  * Indicates that palette changes can be syncd with the veritcal refresh.
  2156.  *)
  2157.   DDCAPS_PALETTEVSYNC             = $00010000;
  2158.  
  2159. (*
  2160.  * Display hardware can return the current scan line.
  2161.  *)
  2162.   DDCAPS_READSCANLINE             = $00020000;
  2163.  
  2164. (*
  2165.  * Display hardware has stereo vision capabilities.  DDSCAPS_PRIMARYSURFACELEFT
  2166.  * can be created.
  2167.  *)
  2168.   DDCAPS_STEREOVIEW               = $00040000;
  2169.  
  2170. (*
  2171.  * Display hardware is capable of generating a vertical blank interrupt.
  2172.  *)
  2173.   DDCAPS_VBI                      = $00080000;
  2174.  
  2175. (*
  2176.  * Supports the use of z buffers with blt operations.
  2177.  *)
  2178.   DDCAPS_ZBLTS                    = $00100000;
  2179.  
  2180. (*
  2181.  * Supports Z Ordering of overlays.
  2182.  *)
  2183.   DDCAPS_ZOVERLAYS                = $00200000;
  2184.  
  2185. (*
  2186.  * Supports color key
  2187.  *)
  2188.   DDCAPS_COLORKEY                 = $00400000;
  2189.  
  2190. (*
  2191.  * Supports alpha surfaces
  2192.  *)
  2193.   DDCAPS_ALPHA                    = $00800000;
  2194.  
  2195. (*
  2196.  * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set)
  2197.  *)
  2198.   DDCAPS_COLORKEYHWASSIST         = $01000000;
  2199.  
  2200. (*
  2201.  * no hardware support at all
  2202.  *)
  2203.   DDCAPS_NOHARDWARE               = $02000000;
  2204.  
  2205. (*
  2206.  * Display hardware is capable of color fill with bltter
  2207.  *)
  2208.   DDCAPS_BLTCOLORFILL             = $04000000;
  2209.  
  2210. (*
  2211.  * Display hardware is bank switched, and potentially very slow at
  2212.  * random access to VRAM.
  2213.  *)
  2214.   DDCAPS_BANKSWITCHED             = $08000000;
  2215.  
  2216. (*
  2217.  * Display hardware is capable of depth filling Z-buffers with bltter
  2218.  *)
  2219.   DDCAPS_BLTDEPTHFILL             = $10000000;
  2220.  
  2221. (*
  2222.  * Display hardware is capable of clipping while bltting.
  2223.  *)
  2224.   DDCAPS_CANCLIP                  = $20000000;
  2225.  
  2226. (*
  2227.  * Display hardware is capable of clipping while stretch bltting.
  2228.  *)
  2229.   DDCAPS_CANCLIPSTRETCHED         = $40000000;
  2230.  
  2231. (*
  2232.  * Display hardware is capable of bltting to or from system memory
  2233.  *)
  2234.   DDCAPS_CANBLTSYSMEM             = $80000000;
  2235.  
  2236.  
  2237.  (****************************************************************************
  2238.  *
  2239.  * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2)
  2240.  *
  2241.  ****************************************************************************)
  2242.  
  2243. (*
  2244.  * Display hardware is certified
  2245.  *)
  2246.   DDCAPS2_CERTIFIED               = $00000001;
  2247.  
  2248. (*
  2249.  * Driver cannot interleave 2D operations (lock and blt) to surfaces with
  2250.  * Direct3D rendering operations between calls to BeginScene() and EndScene()
  2251.  *)
  2252.   DDCAPS2_NO2DDURING3DSCENE       = $00000002;
  2253.  
  2254. (*
  2255.  * Display hardware contains a video port
  2256.  *)
  2257.   DDCAPS2_VIDEOPORT               = $00000004;
  2258.  
  2259. (*
  2260.  * The overlay can be automatically flipped according to the video port
  2261.  * VSYNCs, providing automatic doubled buffered display of video port
  2262.  * data using an overlay
  2263.  *)
  2264.   DDCAPS2_AUTOFLIPOVERLAY         = $00000008;
  2265.  
  2266. (*
  2267.  * Overlay can display each field of interlaced data individually while
  2268.  * it is interleaved in memory without causing jittery artifacts.
  2269.  *)
  2270.   DDCAPS2_CANBOBINTERLEAVED     = $00000010;
  2271.  
  2272. (*
  2273.  * Overlay can display each field of interlaced data individually while
  2274.  * it is not interleaved in memory without causing jittery artifacts.
  2275.  *)
  2276.   DDCAPS2_CANBOBNONINTERLEAVED  = $00000020;
  2277.  
  2278. (*
  2279.  * The overlay surface contains color controls (brightness, sharpness, etc.)
  2280.  *)
  2281.   DDCAPS2_COLORCONTROLOVERLAY   = $00000040;
  2282.  
  2283. (*
  2284.  * The primary surface contains color controls (gamma, etc.)
  2285.  *)
  2286.   DDCAPS2_COLORCONTROLPRIMARY   = $00000080;
  2287.  
  2288. (*
  2289.  * RGBZ -> RGB supported for 16:16 RGB:Z
  2290.  *)
  2291.   DDCAPS2_CANDROPZ16BIT         = $00000100;
  2292.  
  2293. (*
  2294.  * Driver supports non-local video memory.
  2295.  *)
  2296.   DDCAPS2_NONLOCALVIDMEM          = $00000200;
  2297.  
  2298. (*
  2299.  * Dirver supports non-local video memory but has different capabilities for
  2300.  * non-local video memory surfaces. If this bit is set then so must
  2301.  * DDCAPS2_NONLOCALVIDMEM.
  2302.  *)
  2303.   DDCAPS2_NONLOCALVIDMEMCAPS      = $00000400;
  2304.  
  2305. (*
  2306.  * Driver neither requires nor prefers surfaces to be pagelocked when performing
  2307.  * blts involving system memory surfaces
  2308.  *)
  2309.   DDCAPS2_NOPAGELOCKREQUIRED      = $00000800;
  2310.  
  2311. (*
  2312.  * Driver can create surfaces which are wider than the primary surface
  2313.  *)
  2314.   DDCAPS2_WIDESURFACES            = $00001000;
  2315.  
  2316. (*
  2317.  * Driver supports bob without using a video port by handling the
  2318.  * DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip.
  2319.  *)
  2320.   DDCAPS2_CANFLIPODDEVEN          = $00002000;
  2321.  
  2322. (*
  2323.  * Driver supports bob using hardware
  2324.  *)
  2325.   DDCAPS2_CANBOBHARDWARE          = $00004000;
  2326.  
  2327. (*
  2328.  * Driver supports bltting any FOURCC surface to another surface of the same FOURCC
  2329.  *)
  2330.   DDCAPS2_COPYFOURCC              = $00008000;
  2331.  
  2332.  
  2333. (*
  2334.  * Driver supports loadable gamma ramps for the primary surface
  2335.  *)
  2336.   DDCAPS2_PRIMARYGAMMA            = $00020000;
  2337.  
  2338. (*
  2339.  * Driver can render in windowed mode.
  2340.  *)
  2341.   DDCAPS2_CANRENDERWINDOWED       = $00080000;
  2342.  
  2343. (*
  2344.  * A calibrator is available to adjust the gamma ramp according to the
  2345.  * physical display properties so that the result will be identical on
  2346.  * all calibrated systems.
  2347.  *)
  2348.   DDCAPS2_CANCALIBRATEGAMMA       = $00100000;
  2349.  
  2350. (*
  2351.  * Indicates that the driver will respond to DDFLIP_INTERVALn flags
  2352.  *)
  2353.   DDCAPS2_FLIPINTERVAL            = $00200000;
  2354.  
  2355. (*
  2356.  * Indicates that the driver will respond to DDFLIP_NOVSYNC
  2357.  *)
  2358.    DDCAPS2_FLIPNOVSYNC             = $00400000;
  2359.  
  2360. (*
  2361.  * Driver supports management of video memory, if this flag is ON,
  2362.  * driver manages the texture if requested with DDSCAPS2_TEXTUREMANAGE on
  2363.  * DirectX manages the texture if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on
  2364.  *)
  2365.   DDCAPS2_CANMANAGETEXTURE        = $00800000;
  2366.  
  2367. (*
  2368.  * The Direct3D texture manager uses this cap to decide whether to put managed
  2369.  * surfaces in non-local video memory. If the cap is set, the texture manager will
  2370.  * put managed surfaces in non-local vidmem. Drivers that cannot texture from
  2371.  * local vidmem SHOULD NOT set this cap.
  2372.  *)
  2373.   DDCAPS2_TEXMANINNONLOCALVIDMEM  = $01000000;
  2374.  
  2375. (*
  2376.  * Indicates that the driver supports DX7 type of stereo in at least one mode (which may
  2377.  * not necessarily be the current mode). Applications should use IDirectDraw7 (or higher)
  2378.  * ::EnumDisplayModes and check the DDSURFACEDESC.ddsCaps.dwCaps2 field for the presence of
  2379.  * DDSCAPS2_STEREOSURFACELEFT to check if a particular mode supports stereo. The application
  2380.  * can also use IDirectDraw7(or higher)::GetDisplayMode to check the current mode.
  2381.  *)
  2382.   DDCAPS2_STEREO                  = $02000000;
  2383.  
  2384. (*
  2385.  * This caps bit is intended for internal DirectDraw use.
  2386.  * -It is only valid if DDCAPS2_NONLOCALVIDMEMCAPS is set.
  2387.  * -If this bit is set, then DDCAPS_CANBLTSYSMEM MUST be set by the driver (and
  2388.  *  all the assoicated system memory blt caps must be correct).
  2389.  * -It implies that the system->video blt caps in DDCAPS also apply to system to
  2390.  *  nonlocal blts. I.e. the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops
  2391.  *  members of DDCAPS (DDCORECAPS) are filled in correctly.
  2392.  * -Any blt from system to nonlocal memory that matches these caps bits will
  2393.  *  be passed to the driver.
  2394.  *
  2395.  * NOTE: This is intended to enable the driver itself to do efficient reordering
  2396.  * of textures. This is NOT meant to imply that hardware can write into AGP memory.
  2397.  * This operation is not currently supported.
  2398.  *)
  2399.   DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL   = $04000000;
  2400.  
  2401. (****************************************************************************
  2402.  *
  2403.  * DIRECTDRAW FX ALPHA CAPABILITY FLAGS
  2404.  *
  2405.  ****************************************************************************)
  2406.  
  2407. (*
  2408.  * Supports alpha blending around the edge of a source color keyed surface.
  2409.  * For Blt.
  2410.  *)
  2411.   DDFXALPHACAPS_BLTALPHAEDGEBLEND         = $00000001;
  2412.  
  2413. (*
  2414.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2415.  * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
  2416.  * more opaque as the alpha value increases.  (0 is transparent.)
  2417.  * For Blt.
  2418.  *)
  2419.   DDFXALPHACAPS_BLTALPHAPIXELS            = $00000002;
  2420.  
  2421. (*
  2422.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2423.  * information in the pixel format can be 1,2,4, or 8.  The alpha value
  2424.  * becomes more transparent as the alpha value increases.  (0 is opaque.)
  2425.  * This flag can only be set if DDCAPS_ALPHA is set.
  2426.  * For Blt.
  2427.  *)
  2428.   DDFXALPHACAPS_BLTALPHAPIXELSNEG         = $00000004;
  2429.  
  2430. (*
  2431.  * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
  2432.  * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
  2433.  * (0 is transparent.)
  2434.  * For Blt.
  2435.  *)
  2436.   DDFXALPHACAPS_BLTALPHASURFACES          = $00000008;
  2437.  
  2438. (*
  2439.  * The depth of the alpha channel data can range can be 1,2,4, or 8.
  2440.  * The NEG suffix indicates that this alpha channel becomes more transparent
  2441.  * as the alpha value increases. (0 is opaque.)  This flag can only be set if
  2442.  * DDCAPS_ALPHA is set.
  2443.  * For Blt.
  2444.  *)
  2445.   DDFXALPHACAPS_BLTALPHASURFACESNEG       = $00000010;
  2446.  
  2447. (*
  2448.  * Supports alpha blending around the edge of a source color keyed surface.
  2449.  * For Overlays.
  2450.  *)
  2451.   DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND     = $00000020;
  2452.  
  2453. (*
  2454.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2455.  * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
  2456.  * more opaque as the alpha value increases.  (0 is transparent.)
  2457.  * For Overlays.
  2458.  *)
  2459.   DDFXALPHACAPS_OVERLAYALPHAPIXELS        = $00000040;
  2460.  
  2461. (*
  2462.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2463.  * information in the pixel format can be 1,2,4, or 8.  The alpha value
  2464.  * becomes more transparent as the alpha value increases.  (0 is opaque.)
  2465.  * This flag can only be set if DDCAPS_ALPHA is set.
  2466.  * For Overlays.
  2467.  *)
  2468.   DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG     = $00000080;
  2469.  
  2470. (*
  2471.  * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
  2472.  * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
  2473.  * (0 is transparent.)
  2474.  * For Overlays.
  2475.  *)
  2476.   DDFXALPHACAPS_OVERLAYALPHASURFACES      = $00000100;
  2477.  
  2478. (*
  2479.  * The depth of the alpha channel data can range can be 1,2,4, or 8.  
  2480.  * The NEG suffix indicates that this alpha channel becomes more transparent
  2481.  * as the alpha value increases. (0 is opaque.)  This flag can only be set if
  2482.  * DDCAPS_ALPHA is set.
  2483.  * For Overlays.
  2484.  *)
  2485.   DDFXALPHACAPS_OVERLAYALPHASURFACESNEG   = $00000200;
  2486.  
  2487. (****************************************************************************
  2488.  *
  2489.  * DIRECTDRAW FX CAPABILITY FLAGS
  2490.  *
  2491.  ****************************************************************************)
  2492.  
  2493. (*
  2494.  * Uses arithmetic operations to stretch and shrink surfaces during blt
  2495.  * rather than pixel doubling techniques.  Along the Y axis.
  2496.  *)
  2497.   DDFXCAPS_BLTARITHSTRETCHY       = $00000020;
  2498.  
  2499. (*
  2500.  * Uses arithmetic operations to stretch during blt
  2501.  * rather than pixel doubling techniques.  Along the Y axis. Only
  2502.  * works for x1, x2, etc.
  2503.  *)
  2504.   DDFXCAPS_BLTARITHSTRETCHYN      = $00000010;
  2505.  
  2506. (*
  2507.  * Supports mirroring left to right in blt.
  2508.  *)
  2509.   DDFXCAPS_BLTMIRRORLEFTRIGHT     = $00000040;
  2510.  
  2511. (*
  2512.  * Supports mirroring top to bottom in blt.
  2513.  *)
  2514.   DDFXCAPS_BLTMIRRORUPDOWN        = $00000080;
  2515.  
  2516. (*
  2517.  * Supports arbitrary rotation for blts.
  2518.  *)
  2519.   DDFXCAPS_BLTROTATION            = $00000100;
  2520.  
  2521. (*
  2522.  * Supports 90 degree rotations for blts.
  2523.  *)
  2524.    DDFXCAPS_BLTROTATION90          = $00000200;
  2525.  
  2526. (*
  2527.  * DirectDraw supports arbitrary shrinking of a surface along the
  2528.  * x axis (horizontal direction) for blts.
  2529.  *)
  2530.   DDFXCAPS_BLTSHRINKX             = $00000400;
  2531.  
  2532. (*
  2533.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2534.  * along the x axis (horizontal direction) for blts.
  2535.  *)
  2536.   DDFXCAPS_BLTSHRINKXN            = $00000800;
  2537.  
  2538. (*
  2539.  * DirectDraw supports arbitrary shrinking of a surface along the
  2540.  * y axis (horizontal direction) for blts.  
  2541.  *)
  2542.   DDFXCAPS_BLTSHRINKY             = $00001000;
  2543.  
  2544. (*
  2545.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2546.  * along the y axis (vertical direction) for blts.
  2547.  *)
  2548.   DDFXCAPS_BLTSHRINKYN            = $00002000;
  2549.  
  2550. (*
  2551.  * DirectDraw supports arbitrary stretching of a surface along the
  2552.  * x axis (horizontal direction) for blts.
  2553.  *)
  2554.   DDFXCAPS_BLTSTRETCHX            = $00004000;
  2555.  
  2556. (*
  2557.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2558.  * along the x axis (horizontal direction) for blts.
  2559.  *)
  2560.   DDFXCAPS_BLTSTRETCHXN           = $00008000;
  2561.  
  2562. (*
  2563.  * DirectDraw supports arbitrary stretching of a surface along the
  2564.  * y axis (horizontal direction) for blts.  
  2565.  *)
  2566.   DDFXCAPS_BLTSTRETCHY            = $00010000;
  2567.  
  2568. (*
  2569.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2570.  * along the y axis (vertical direction) for blts.  
  2571.  *)
  2572.   DDFXCAPS_BLTSTRETCHYN           = $00020000;
  2573.  
  2574. (*
  2575.  * Uses arithmetic operations to stretch and shrink surfaces during
  2576.  * overlay rather than pixel doubling techniques.  Along the Y axis
  2577.  * for overlays.
  2578.  *)
  2579.   DDFXCAPS_OVERLAYARITHSTRETCHY   = $00040000;
  2580.  
  2581. (*
  2582.  * Uses arithmetic operations to stretch surfaces during
  2583.  * overlay rather than pixel doubling techniques.  Along the Y axis
  2584.  * for overlays. Only works for x1, x2, etc.
  2585.  *)
  2586.   DDFXCAPS_OVERLAYARITHSTRETCHYN  = $00000008;
  2587.  
  2588. (*
  2589.  * DirectDraw supports arbitrary shrinking of a surface along the
  2590.  * x axis (horizontal direction) for overlays.
  2591.  *)
  2592.   DDFXCAPS_OVERLAYSHRINKX         = $00080000;
  2593.  
  2594. (*
  2595.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2596.  * along the x axis (horizontal direction) for overlays.
  2597.  *)
  2598.   DDFXCAPS_OVERLAYSHRINKXN        = $00100000;
  2599.  
  2600. (*
  2601.  * DirectDraw supports arbitrary shrinking of a surface along the
  2602.  * y axis (horizontal direction) for overlays.
  2603.  *)
  2604.   DDFXCAPS_OVERLAYSHRINKY         = $00200000;
  2605.  
  2606. (*
  2607.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2608.  * along the y axis (vertical direction) for overlays.  
  2609.  *)
  2610.   DDFXCAPS_OVERLAYSHRINKYN        = $00400000;
  2611.  
  2612. (*
  2613.  * DirectDraw supports arbitrary stretching of a surface along the
  2614.  * x axis (horizontal direction) for overlays.
  2615.  *)
  2616.   DDFXCAPS_OVERLAYSTRETCHX        = $00800000;
  2617.  
  2618. (*
  2619.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2620.  * along the x axis (horizontal direction) for overlays.
  2621.  *)
  2622.   DDFXCAPS_OVERLAYSTRETCHXN       = $01000000;
  2623.  
  2624. (*
  2625.  * DirectDraw supports arbitrary stretching of a surface along the
  2626.  * y axis (horizontal direction) for overlays.  
  2627.  *)
  2628.   DDFXCAPS_OVERLAYSTRETCHY        = $02000000;
  2629.  
  2630. (*
  2631.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2632.  * along the y axis (vertical direction) for overlays.  
  2633.  *)
  2634.   DDFXCAPS_OVERLAYSTRETCHYN       = $04000000;
  2635.  
  2636. (*
  2637.  * DirectDraw supports mirroring of overlays across the vertical axis
  2638.  *)
  2639.   DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000;
  2640.  
  2641. (*
  2642.  * DirectDraw supports mirroring of overlays across the horizontal axis
  2643.  *)
  2644.   DDFXCAPS_OVERLAYMIRRORUPDOWN    = $10000000;
  2645.  
  2646. (*
  2647.  * Driver can do alpha blending for blits.
  2648.  *)
  2649.   DDFXCAPS_BLTALPHA             = $00000001;
  2650.  
  2651. (*
  2652.  * Driver can do geometric transformations (or warps) for blits.
  2653.  *)
  2654.   DDFXCAPS_BLTTRANSFORM         = $00000002;
  2655.  
  2656. (*
  2657.  * Driver can do surface-reconstruction filtering for warped blits.
  2658.  *)
  2659.   DDFXCAPS_BLTFILTER           = DDFXCAPS_BLTARITHSTRETCHY;
  2660.  
  2661. (*
  2662.  * Driver can do alpha blending for overlays.
  2663.  *)
  2664.   DDFXCAPS_OVERLAYALPHA                 = $00000004;
  2665.  
  2666. (*
  2667.  * Driver can do geometric transformations (or warps) for overlays.
  2668.  *)
  2669.   DDFXCAPS_OVERLAYTRANSFORM     = $20000000;
  2670.  
  2671. (*
  2672.  * Driver can do surface-reconstruction filtering for warped overlays.
  2673.  *)
  2674.   DDFXCAPS_OVERLAYFILTER              = DDFXCAPS_OVERLAYARITHSTRETCHY;
  2675.  
  2676. (****************************************************************************
  2677.  *
  2678.  * DIRECTDRAW STEREO VIEW CAPABILITIES
  2679.  *
  2680.  ****************************************************************************)
  2681.  
  2682. (*
  2683.  * This flag used to be DDSVCAPS_ENIGMA, which is now obsolete
  2684.  * The stereo view is accomplished via enigma encoding.
  2685.  *)
  2686.   DDSVCAPS_RESERVED1                 = $00000001;
  2687.   DDSVCAPS_ENIGMA                 = DDSVCAPS_RESERVED1;
  2688.  
  2689. (*
  2690.  * This flag used to be DDSVCAPS_FLICKER, which is now obsolete
  2691.  * The stereo view is accomplished via high frequency flickering.
  2692.  *)
  2693.   DDSVCAPS_RESERVED2                = $00000002;
  2694.   DDSVCAPS_FLICKER                = DDSVCAPS_RESERVED2;
  2695.  
  2696. (*
  2697.  * This flag used to be DDSVCAPS_REDBLUE, which is now obsolete
  2698.  * The stereo view is accomplished via red and blue filters applied
  2699.  * to the left and right eyes.  All images must adapt their colorspaces
  2700.  * for this process.
  2701.  *)
  2702.   DDSVCAPS_RESERVED3                = $00000004;
  2703.   DDSVCAPS_REDBLUE                = DDSVCAPS_RESERVED3;
  2704.  
  2705. (*
  2706.  * This flag used to be DDSVCAPS_SPLIT, which is now obsolete
  2707.  * The stereo view is accomplished with split screen technology.
  2708.  *)
  2709.   DDSVCAPS_RESERVED4                  = $00000008;
  2710.   DDSVCAPS_SPLIT                  = DDSVCAPS_RESERVED4;
  2711.  
  2712. (*
  2713.  * The stereo view is accomplished with switching technology
  2714.  *)
  2715.   DDSVCAPS_STEREOSEQUENTIAL       = $00000010;
  2716.  
  2717. (****************************************************************************
  2718.  *
  2719.  * DIRECTDRAWPALETTE CAPABILITIES
  2720.  *
  2721.  ****************************************************************************)
  2722.  
  2723. (*
  2724.  * Index is 4 bits.  There are sixteen color entries in the palette table.
  2725.  *)
  2726.   DDPCAPS_4BIT                    = $00000001;
  2727.  
  2728. (*
  2729.  * Index is onto a 8 bit color index.  This field is only valid with the
  2730.  * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target
  2731.  * surface is in 8bpp. Each color entry is one byte long and is an index
  2732.  * into destination surface's 8bpp palette.
  2733.  *)
  2734.   DDPCAPS_8BITENTRIES             = $00000002;
  2735.  
  2736. (*
  2737.  * Index is 8 bits.  There are 256 color entries in the palette table.
  2738.  *)
  2739.   DDPCAPS_8BIT                    = $00000004;
  2740.  
  2741. (*
  2742.  * Indicates that this DIRECTDRAWPALETTE should use the palette color array
  2743.  * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE
  2744.  * object.
  2745.  * This flag is obsolete. DirectDraw always initializes the color array from
  2746.  * the lpDDColorArray parameter. The definition remains for source-level
  2747.  * compatibility.
  2748.  *)
  2749.   DDPCAPS_INITIALIZE              = $00000008;
  2750.  
  2751. (*
  2752.  * This palette is the one attached to the primary surface.  Changing this
  2753.  * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified
  2754.  * and supported.
  2755.  *)
  2756.   DDPCAPS_PRIMARYSURFACE          = $00000010;
  2757.  
  2758. (*
  2759.  * This palette is the one attached to the primary surface left.  Changing
  2760.  * this table has immediate effect on the display for the left eye unless
  2761.  * DDPSETPAL_VSYNC is specified and supported.
  2762.  *)
  2763.   DDPCAPS_PRIMARYSURFACELEFT      = $00000020;
  2764.  
  2765. (*
  2766.  * This palette can have all 256 entries defined
  2767.  *)
  2768.   DDPCAPS_ALLOW256                = $00000040;
  2769.  
  2770. (*
  2771.  * This palette can have modifications to it synced with the monitors
  2772.  * refresh rate.
  2773.  *)
  2774.   DDPCAPS_VSYNC                   = $00000080;
  2775.  
  2776. (*
  2777.  * Index is 1 bit.  There are two color entries in the palette table.
  2778.  *)
  2779.   DDPCAPS_1BIT                    = $00000100;
  2780.  
  2781. (*
  2782.  * Index is 2 bit.  There are four color entries in the palette table.
  2783.  *)
  2784.   DDPCAPS_2BIT                    = $00000200;
  2785.  
  2786. (*
  2787.  * The peFlags member of PALETTEENTRY denotes an 8 bit alpha value
  2788.  *)
  2789.   DDPCAPS_ALPHA                 = $00000400;
  2790.  
  2791. (****************************************************************************
  2792.  *
  2793.  * DIRECTDRAWPALETTE SETENTRY CONSTANTS
  2794.  *
  2795.  ****************************************************************************)
  2796.  
  2797.  
  2798. (****************************************************************************
  2799.  *
  2800.  * DIRECTDRAWPALETTE GETENTRY CONSTANTS
  2801.  *
  2802.  ****************************************************************************)
  2803.  
  2804. (* 0 is the only legal value *)
  2805.  
  2806. (****************************************************************************
  2807.  *
  2808.  * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
  2809.  *
  2810.  ****************************************************************************)
  2811.  
  2812. (*
  2813.  * The passed pointer is an IUnknown ptr. The cbData argument to SetPrivateData
  2814.  * must be set to sizeof(IUnknown^). DirectDraw will call AddRef through this
  2815.  * pointer and Release when the private data is destroyed. This includes when
  2816.  * the surface or palette is destroyed before such priovate data is destroyed.
  2817.  *)
  2818.   DDSPD_IUNKNOWNPOINTER           = $00000001;
  2819.  
  2820. (*
  2821.  * Private data is only valid for the current state of the object,
  2822.  * as determined by the uniqueness value.
  2823.  *)
  2824.   DDSPD_VOLATILE                  = $00000002;
  2825.  
  2826. (****************************************************************************
  2827.  *
  2828.  * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
  2829.  *
  2830.  ****************************************************************************)
  2831.  
  2832.  
  2833. (****************************************************************************
  2834.  *
  2835.  * DIRECTDRAW BITDEPTH CONSTANTS
  2836.  *
  2837.  * NOTE:  These are only used to indicate supported bit depths.   These
  2838.  * are flags only, they are not to be used as an actual bit depth.   The
  2839.  * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual
  2840.  * bit depths in a surface or for changing the display mode.
  2841.  *
  2842.  ****************************************************************************)
  2843.  
  2844. (*
  2845.  * 1 bit per pixel.
  2846.  *)
  2847.   DDBD_1                  = $00004000;
  2848.  
  2849. (*
  2850.  * 2 bits per pixel.
  2851.  *)
  2852.   DDBD_2                  = $00002000;
  2853.  
  2854. (*
  2855.  * 4 bits per pixel.
  2856.  *)
  2857.   DDBD_4                  = $00001000;
  2858.  
  2859. (*
  2860.  * 8 bits per pixel.
  2861.  *)
  2862.   DDBD_8                  = $00000800;
  2863.  
  2864. (*
  2865.  * 16 bits per pixel.
  2866.  *)
  2867.   DDBD_16                 = $00000400;
  2868.  
  2869. (*
  2870.  * 24 bits per pixel.
  2871.  *)
  2872.   DDBD_24                 = $00000200;
  2873.  
  2874. (*
  2875.  * 32 bits per pixel.
  2876.  *)
  2877.   DDBD_32                 = $00000100;
  2878.  
  2879. (****************************************************************************
  2880.  *
  2881.  * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS
  2882.  *
  2883.  ****************************************************************************)
  2884.  
  2885. (*
  2886.  * Set if the structure contains a color space.  Not set if the structure
  2887.  * contains a single color key.
  2888.  *)
  2889.   DDCKEY_COLORSPACE       = $00000001;
  2890.  
  2891. (*
  2892.  * Set if the structure specifies a color key or color space which is to be
  2893.  * used as a destination color key for blt operations.
  2894.  *)
  2895.   DDCKEY_DESTBLT          = $00000002;
  2896.  
  2897. (*
  2898.  * Set if the structure specifies a color key or color space which is to be
  2899.  * used as a destination color key for overlay operations.
  2900.  *)
  2901.   DDCKEY_DESTOVERLAY      = $00000004;
  2902.  
  2903. (*
  2904.  * Set if the structure specifies a color key or color space which is to be
  2905.  * used as a source color key for blt operations.
  2906.  *)
  2907.   DDCKEY_SRCBLT           = $00000008;
  2908.  
  2909. (*
  2910.  * Set if the structure specifies a color key or color space which is to be
  2911.  * used as a source color key for overlay operations.
  2912.  *)
  2913.   DDCKEY_SRCOVERLAY       = $00000010;
  2914.  
  2915.  
  2916. (****************************************************************************
  2917.  *
  2918.  * DIRECTDRAW COLOR KEY CAPABILITY FLAGS
  2919.  *
  2920.  ****************************************************************************)
  2921.  
  2922. (*
  2923.  * Supports transparent blting using a color key to identify the replaceable
  2924.  * bits of the destination surface for RGB colors.
  2925.  *)
  2926.   DDCKEYCAPS_DESTBLT                      = $00000001;
  2927.  
  2928. (*
  2929.  * Supports transparent blting using a color space to identify the replaceable
  2930.  * bits of the destination surface for RGB colors.
  2931.  *)
  2932.   DDCKEYCAPS_DESTBLTCLRSPACE              = $00000002;
  2933.  
  2934. (*
  2935.  * Supports transparent blting using a color space to identify the replaceable
  2936.  * bits of the destination surface for YUV colors.
  2937.  *)
  2938.   DDCKEYCAPS_DESTBLTCLRSPACEYUV           = $00000004;
  2939.  
  2940. (*
  2941.  * Supports transparent blting using a color key to identify the replaceable
  2942.  * bits of the destination surface for YUV colors.
  2943.  *)
  2944.   DDCKEYCAPS_DESTBLTYUV                   = $00000008;
  2945.  
  2946. (*
  2947.  * Supports overlaying using colorkeying of the replaceable bits of the surface
  2948.  * being overlayed for RGB colors.
  2949.  *)
  2950.   DDCKEYCAPS_DESTOVERLAY                  = $00000010;
  2951.  
  2952. (*
  2953.  * Supports a color space as the color key for the destination for RGB colors.
  2954.  *)
  2955.   DDCKEYCAPS_DESTOVERLAYCLRSPACE          = $00000020;
  2956.  
  2957. (*
  2958.  * Supports a color space as the color key for the destination for YUV colors.
  2959.  *)
  2960.   DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV       = $00000040;
  2961.  
  2962. (*
  2963.  * Supports only one active destination color key value for visible overlay
  2964.  * surfaces.
  2965.  *)
  2966.   DDCKEYCAPS_DESTOVERLAYONEACTIVE         = $00000080;
  2967.  
  2968. (*
  2969.  * Supports overlaying using colorkeying of the replaceable bits of the
  2970.  * surface being overlayed for YUV colors.
  2971.  *)
  2972.   DDCKEYCAPS_DESTOVERLAYYUV               = $00000100;
  2973.  
  2974. (*
  2975.  * Supports transparent blting using the color key for the source with
  2976.  * this surface for RGB colors.
  2977.  *)
  2978.   DDCKEYCAPS_SRCBLT                       = $00000200;
  2979.  
  2980. (*
  2981.  * Supports transparent blting using a color space for the source with
  2982.  * this surface for RGB colors.
  2983.  *)
  2984.   DDCKEYCAPS_SRCBLTCLRSPACE               = $00000400;
  2985.  
  2986. (*
  2987.  * Supports transparent blting using a color space for the source with
  2988.  * this surface for YUV colors.
  2989.  *)
  2990.   DDCKEYCAPS_SRCBLTCLRSPACEYUV            = $00000800;
  2991.  
  2992. (*
  2993.  * Supports transparent blting using the color key for the source with
  2994.  * this surface for YUV colors.
  2995.  *)
  2996.   DDCKEYCAPS_SRCBLTYUV                    = $00001000;
  2997.  
  2998. (*
  2999.  * Supports overlays using the color key for the source with this
  3000.  * overlay surface for RGB colors.
  3001.  *)
  3002.   DDCKEYCAPS_SRCOVERLAY                   = $00002000;
  3003.  
  3004. (*
  3005.  * Supports overlays using a color space as the source color key for
  3006.  * the overlay surface for RGB colors.
  3007.  *)
  3008.   DDCKEYCAPS_SRCOVERLAYCLRSPACE           = $00004000;
  3009.  
  3010. (*
  3011.  * Supports overlays using a color space as the source color key for
  3012.  * the overlay surface for YUV colors.
  3013.  *)
  3014.   DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV        = $00008000;
  3015.  
  3016. (*
  3017.  * Supports only one active source color key value for visible
  3018.  * overlay surfaces.
  3019.  *)
  3020.   DDCKEYCAPS_SRCOVERLAYONEACTIVE          = $00010000;
  3021.  
  3022. (*
  3023.  * Supports overlays using the color key for the source with this
  3024.  * overlay surface for YUV colors.
  3025.  *)
  3026.   DDCKEYCAPS_SRCOVERLAYYUV                = $00020000;
  3027.  
  3028. (*
  3029.  * there are no bandwidth trade-offs for using colorkey with an overlay
  3030.  *)
  3031.   DDCKEYCAPS_NOCOSTOVERLAY                = $00040000;
  3032.  
  3033.  
  3034. (****************************************************************************
  3035.  *
  3036.  * DIRECTDRAW PIXELFORMAT FLAGS
  3037.  *
  3038.  ****************************************************************************)
  3039.  
  3040. (*
  3041.  * The surface has alpha channel information in the pixel format.
  3042.  *)
  3043.   DDPF_ALPHAPIXELS                        = $00000001;
  3044.  
  3045. (*
  3046.  * The pixel format contains alpha only information
  3047.  *)
  3048.   DDPF_ALPHA                              = $00000002;
  3049.  
  3050. (*
  3051.  * The FourCC code is valid.
  3052.  *)
  3053.   DDPF_FOURCC                             = $00000004;
  3054.  
  3055. (*
  3056.  * The surface is 4-bit color indexed.
  3057.  *)
  3058.   DDPF_PALETTEINDEXED4                    = $00000008;
  3059.  
  3060. (*
  3061.  * The surface is indexed into a palette which stores indices
  3062.  * into the destination surface's 8-bit palette.
  3063.  *)
  3064.   DDPF_PALETTEINDEXEDTO8                  = $00000010;
  3065.  
  3066. (*
  3067.  * The surface is 8-bit color indexed.
  3068.  *)
  3069.   DDPF_PALETTEINDEXED8                    = $00000020;
  3070.  
  3071. (*
  3072.  * The RGB data in the pixel format structure is valid.
  3073.  *)
  3074.   DDPF_RGB                                = $00000040;
  3075.  
  3076. (*
  3077.  * The surface will accept pixel data in the format specified
  3078.  * and compress it during the write.
  3079.  *)
  3080.   DDPF_COMPRESSED                         = $00000080;
  3081.  
  3082. (*
  3083.  * The surface will accept RGB data and translate it during
  3084.  * the write to YUV data.  The format of the data to be written
  3085.  * will be contained in the pixel format structure.  The DDPF_RGB
  3086.  * flag will be set.
  3087.  *)
  3088.   DDPF_RGBTOYUV                           = $00000100;
  3089.  
  3090. (*
  3091.  * pixel format is YUV - YUV data in pixel format struct is valid
  3092.  *)
  3093.   DDPF_YUV                                = $00000200;
  3094.  
  3095. (*
  3096.  * pixel format is a z buffer only surface
  3097.  *)
  3098.   DDPF_ZBUFFER                            = $00000400;
  3099.  
  3100. (*
  3101.  * The surface is 1-bit color indexed.
  3102.  *)
  3103.   DDPF_PALETTEINDEXED1                    = $00000800;
  3104.  
  3105. (*
  3106.  * The surface is 2-bit color indexed.
  3107.  *)
  3108.   DDPF_PALETTEINDEXED2                    = $00001000;
  3109.  
  3110. (*
  3111.  * The surface contains Z information in the pixels
  3112.  *)
  3113.   DDPF_ZPIXELS                          = $00002000;
  3114.  
  3115. (*
  3116.  * The surface contains stencil information along with Z
  3117.  *)
  3118.   DDPF_STENCILBUFFER                    = $00004000;
  3119.  
  3120. (*
  3121.  * Premultiplied alpha format -- the color components have been
  3122.  * premultiplied by the alpha component.
  3123.  *)
  3124.   DDPF_ALPHAPREMULT                     = $00008000;
  3125.  
  3126.  
  3127. (*
  3128.  * Luminance data in the pixel format is valid.
  3129.  * Use this flag for luminance-only or luminance+alpha surfaces,
  3130.  * the bit depth is then ddpf.dwLuminanceBitCount.
  3131.  *)
  3132.   DDPF_LUMINANCE                          = $00020000;
  3133.  
  3134. (*
  3135.  * Luminance data in the pixel format is valid.
  3136.  * Use this flag when hanging luminance off bumpmap surfaces,
  3137.  * the bit mask for the luminance portion of the pixel is then
  3138.  * ddpf.dwBumpLuminanceBitMask
  3139.  *)
  3140.   DDPF_BUMPLUMINANCE                      = $00040000;
  3141.  
  3142. (*
  3143.  * Bump map dUdV data in the pixel format is valid.
  3144.  *)
  3145.   DDPF_BUMPDUDV                           = $00080000;
  3146.  
  3147. (*===========================================================================
  3148.  *
  3149.  *
  3150.  * DIRECTDRAW CALLBACK FLAGS
  3151.  *
  3152.  *
  3153.  *==========================================================================*)
  3154.  
  3155. (****************************************************************************
  3156.  *
  3157.  * DIRECTDRAW ENUMSURFACES FLAGS
  3158.  *
  3159.  ****************************************************************************)
  3160.  
  3161. (*
  3162.  * Enumerate all of the surfaces that meet the search criterion.
  3163.  *)
  3164.   DDENUMSURFACES_ALL                      = $00000001;
  3165.  
  3166. (*
  3167.  * A search hit is a surface that matches the surface description.
  3168.  *)
  3169.   DDENUMSURFACES_MATCH                    = $00000002;
  3170.  
  3171. (*
  3172.  * A search hit is a surface that does not match the surface description.
  3173.  *)
  3174.   DDENUMSURFACES_NOMATCH                  = $00000004;
  3175.  
  3176. (*
  3177.  * Enumerate the first surface that can be created which meets the search criterion.
  3178.  *)
  3179.   DDENUMSURFACES_CANBECREATED             = $00000008;
  3180.  
  3181. (*
  3182.  * Enumerate the surfaces that already exist that meet the search criterion.
  3183.  *)
  3184.   DDENUMSURFACES_DOESEXIST                = $00000010;
  3185.  
  3186. (****************************************************************************
  3187.  *
  3188.  * DIRECTDRAW SETDISPLAYMODE FLAGS
  3189.  *
  3190.  ****************************************************************************)
  3191.  
  3192. (*
  3193.  * The desired mode is a standard VGA mode
  3194.  *)
  3195.   DDSDM_STANDARDVGAMODE                   = $00000001;
  3196.  
  3197. (****************************************************************************
  3198.  *
  3199.  * DIRECTDRAW ENUMDISPLAYMODES FLAGS
  3200.  *
  3201.  ****************************************************************************)
  3202.  
  3203. (*
  3204.  * Enumerate Modes with different refresh rates.  EnumDisplayModes guarantees
  3205.  * that a particular mode will be enumerated only once.  This flag specifies whether
  3206.  * the refresh rate is taken into account when determining if a mode is unique.
  3207.  *)
  3208.   DDEDM_REFRESHRATES                      = $00000001;
  3209.  
  3210. (*
  3211.  * Enumerate VGA modes. Specify this flag if you wish to enumerate supported VGA
  3212.  * modes such as mode 0x13 in addition to the usual ModeX modes (which are always
  3213.  * enumerated if the application has previously called SetCooperativeLevel with the
  3214.  * DDSCL_ALLOWMODEX flag set).
  3215.  *)
  3216.   DDEDM_STANDARDVGAMODES                  = $00000002;
  3217.  
  3218.  
  3219. (****************************************************************************
  3220.  *
  3221.  * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS
  3222.  *
  3223.  ****************************************************************************)
  3224.  
  3225. (*
  3226.  * Exclusive mode owner will be responsible for the entire primary surface.
  3227.  * GDI can be ignored. used with DD
  3228.  *)
  3229.   DDSCL_FULLSCREEN                        = $00000001;
  3230.  
  3231. (*
  3232.  * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode
  3233.  *)
  3234.   DDSCL_ALLOWREBOOT                       = $00000002;
  3235.  
  3236. (*
  3237.  * prevents DDRAW from modifying the application window.
  3238.  * prevents DDRAW from minimize/restore the application window on activation.
  3239.  *)
  3240.   DDSCL_NOWINDOWCHANGES                   = $00000004;
  3241.  
  3242. (*
  3243.  * app wants to work as a regular Windows application
  3244.  *)
  3245.   DDSCL_NORMAL                            = $00000008;
  3246.  
  3247. (*
  3248.  * app wants exclusive access
  3249.  *)
  3250.   DDSCL_EXCLUSIVE                         = $00000010;
  3251.  
  3252.  
  3253. (*
  3254.  * app can deal with non-windows display modes
  3255.  *)
  3256.   DDSCL_ALLOWMODEX                        = $00000040;
  3257.  
  3258. (*
  3259.  * this window will receive the focus messages
  3260.  *)
  3261.   DDSCL_SETFOCUSWINDOW                    = $00000080;
  3262.  
  3263. (*
  3264.  * this window is associated with the DDRAW object and will
  3265.  * cover the screen in fullscreen mode
  3266.  *)
  3267.   DDSCL_SETDEVICEWINDOW                   = $00000100;
  3268.  
  3269. (*
  3270.  * app wants DDRAW to create a window to be associated with the
  3271.  * DDRAW object
  3272.  *)
  3273.   DDSCL_CREATEDEVICEWINDOW                = $00000200;
  3274.  
  3275. (*
  3276.  * App explicitly asks DDRAW/D3D to be multithread safe. This makes D3D
  3277.  * take the global crtisec more frequently.
  3278.  *)
  3279.   DDSCL_MULTITHREADED                     = $00000400;
  3280.  
  3281. (*
  3282.  * App hints that it would like to keep the FPU set up for optimal Direct3D
  3283.  * performance (single precision and exceptions disabled) so Direct3D
  3284.  * does not need to explicitly set the FPU each time
  3285.  *)
  3286.   DDSCL_FPUSETUP                          = $00000800;
  3287.  
  3288. (*
  3289.  * App specifies that it needs either double precision FPU or FPU exceptions
  3290.  * enabled. This makes Direct3D explicitly set the FPU state eah time it is
  3291.  * called. Setting the flag will reduce Direct3D performance. The flag is
  3292.  * assumed by default in DirectX 6 and earlier. See also DDSCL_FPUSETUP
  3293.  *)
  3294.   DDSCL_FPUPRESERVE                          = $00001000;
  3295.  
  3296. (****************************************************************************
  3297.  *
  3298.  * DIRECTDRAW BLT FLAGS
  3299.  *
  3300.  ****************************************************************************)
  3301.  
  3302. (*
  3303.  * Use the alpha information in the pixel format or the alpha channel surface
  3304.  * attached to the destination surface as the alpha channel for this blt.
  3305.  *)
  3306.   DDBLT_ALPHADEST                         = $00000001;
  3307.  
  3308. (*
  3309.  * Use the dwConstAlphaDest field in the TDDBltFX structure as the alpha channel
  3310.  * for the destination surface for this blt.
  3311.  *)
  3312.   DDBLT_ALPHADESTCONSTOVERRIDE            = $00000002;
  3313.  
  3314. (*
  3315.  * The NEG suffix indicates that the destination surface becomes more
  3316.  * transparent as the alpha value increases. (0 is opaque)
  3317.  *)
  3318.   DDBLT_ALPHADESTNEG                      = $00000004;
  3319.  
  3320. (*
  3321.  * Use the lpDDSAlphaDest field in the TDDBltFX structure as the alpha
  3322.  * channel for the destination for this blt.
  3323.  *)
  3324.   DDBLT_ALPHADESTSURFACEOVERRIDE          = $00000008;
  3325.  
  3326. (*
  3327.  * Use the dwAlphaEdgeBlend field in the TDDBltFX structure as the alpha channel
  3328.  * for the edges of the image that border the color key colors.
  3329.  *)
  3330.   DDBLT_ALPHAEDGEBLEND                    = $00000010;
  3331.  
  3332. (*
  3333.  * Use the alpha information in the pixel format or the alpha channel surface
  3334.  * attached to the source surface as the alpha channel for this blt.
  3335.  *)
  3336.   DDBLT_ALPHASRC                          = $00000020;
  3337.  
  3338. (*
  3339.  * Use the dwConstAlphaSrc field in the TDDBltFX structure as the alpha channel
  3340.  * for the source for this blt.
  3341.  *)
  3342.   DDBLT_ALPHASRCCONSTOVERRIDE             = $00000040;
  3343.  
  3344. (*
  3345.  * The NEG suffix indicates that the source surface becomes more transparent
  3346.  * as the alpha value increases. (0 is opaque)
  3347.  *)
  3348.   DDBLT_ALPHASRCNEG                       = $00000080;
  3349.  
  3350. (*
  3351.  * Use the lpDDSAlphaSrc field in the TDDBltFX structure as the alpha channel
  3352.  * for the source for this blt.
  3353.  *)
  3354.   DDBLT_ALPHASRCSURFACEOVERRIDE           = $00000100;
  3355.  
  3356. (*
  3357.  * Do this blt asynchronously through the FIFO in the order received.  If
  3358.  * there is no room in the hardware FIFO fail the call.
  3359.  *)
  3360.   DDBLT_ASYNC                             = $00000200;
  3361.  
  3362. (*
  3363.  * Uses the dwFillColor field in the TDDBltFX structure as the RGB color
  3364.  * to fill the destination rectangle on the destination surface with.
  3365.  *)
  3366.   DDBLT_COLORFILL                         = $00000400;
  3367.  
  3368. (*
  3369.  * Uses the dwDDFX field in the TDDBltFX structure to specify the effects
  3370.  * to use for the blt.
  3371.  *)
  3372.   DDBLT_DDFX                              = $00000800;
  3373.  
  3374. (*
  3375.  * Uses the dwDDROPS field in the TDDBltFX structure to specify the ROPS
  3376.  * that are not part of the Win32 API.
  3377.  *)
  3378.   DDBLT_DDROPS                            = $00001000;
  3379.  
  3380. (*
  3381.  * Use the color key associated with the destination surface.
  3382.  *)
  3383.   DDBLT_KEYDEST                           = $00002000;
  3384.  
  3385. (*
  3386.  * Use the dckDestColorkey field in the TDDBltFX structure as the color key
  3387.  * for the destination surface.
  3388.  *)
  3389.   DDBLT_KEYDESTOVERRIDE                   = $00004000;
  3390.  
  3391. (*
  3392.  * Use the color key associated with the source surface.
  3393.  *)
  3394.   DDBLT_KEYSRC                            = $00008000;
  3395.  
  3396. (*
  3397.  * Use the dckSrcColorkey field in the TDDBltFX structure as the color key
  3398.  * for the source surface.
  3399.  *)
  3400.   DDBLT_KEYSRCOVERRIDE                    = $00010000;
  3401.  
  3402. (*
  3403.  * Use the dwROP field in the TDDBltFX structure for the raster operation
  3404.  * for this blt.  These ROPs are the same as the ones defined in the Win32 API.
  3405.  *)
  3406.   DDBLT_ROP                               = $00020000;
  3407.  
  3408. (*
  3409.  * Use the dwRotationAngle field in the TDDBltFX structure as the angle
  3410.  * (specified in 1/100th of a degree) to rotate the surface.
  3411.  *)
  3412.   DDBLT_ROTATIONANGLE                     = $00040000;
  3413.  
  3414. (*
  3415.  * Z-buffered blt using the z-buffers attached to the source and destination
  3416.  * surfaces and the dwZBufferOpCode field in the TDDBltFX structure as the
  3417.  * z-buffer opcode.
  3418.  *)
  3419.   DDBLT_ZBUFFER                           = $00080000;
  3420.  
  3421. (*
  3422.  * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field
  3423.  * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
  3424.  * for the destination.
  3425.  *)
  3426.   DDBLT_ZBUFFERDESTCONSTOVERRIDE          = $00100000;
  3427.  
  3428. (*
  3429.  * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode
  3430.  * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
  3431.  * respectively for the destination.
  3432.  *)
  3433.   DDBLT_ZBUFFERDESTOVERRIDE               = $00200000;
  3434.  
  3435. (*
  3436.  * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field
  3437.  * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
  3438.  * for the source.
  3439.  *)
  3440.   DDBLT_ZBUFFERSRCCONSTOVERRIDE           = $00400000;
  3441.  
  3442. (*
  3443.  * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode
  3444.  * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
  3445.  * respectively for the source.
  3446.  *)
  3447.    DDBLT_ZBUFFERSRCOVERRIDE                = $00800000;
  3448.  
  3449. (*
  3450.  * wait until the device is ready to handle the blt
  3451.  * this will cause blt to not return DDERR_WASSTILLDRAWING
  3452.  *)
  3453.   DDBLT_WAIT                              = $01000000;
  3454.  
  3455. (*
  3456.  * Uses the dwFillDepth field in the TDDBltFX structure as the depth value
  3457.  * to fill the destination rectangle on the destination Z-buffer surface
  3458.  * with.
  3459.  *)
  3460.   DDBLT_DEPTHFILL                         = $02000000;
  3461.  
  3462. (*
  3463.  * wait until the device is ready to handle the blt
  3464.  * this will cause blt to not return DDERR_WASSTILLDRAWING
  3465.  *)
  3466.   DDBLT_DONOTWAIT                         = $08000000;
  3467.  
  3468. (****************************************************************************
  3469.  *
  3470.  * BLTFAST FLAGS
  3471.  *
  3472.  ****************************************************************************)
  3473.  
  3474.   DDBLTFAST_NOCOLORKEY                    = $00000000;
  3475.   DDBLTFAST_SRCCOLORKEY                   = $00000001;
  3476.   DDBLTFAST_DESTCOLORKEY                  = $00000002;
  3477.   DDBLTFAST_WAIT                          = $00000010;
  3478.   DDBLTFAST_DONOTWAIT                     = $00000020;
  3479.  
  3480. (****************************************************************************
  3481.  *
  3482.  * FLIP FLAGS
  3483.  *
  3484.  ****************************************************************************)
  3485.  
  3486.  
  3487.   DDFLIP_WAIT                          = $00000001;
  3488.  
  3489. (*
  3490.  * Indicates that the target surface contains the even field of video data.
  3491.  * This flag is only valid with an overlay surface.
  3492.  *)
  3493.   DDFLIP_EVEN                          = $00000002;
  3494.  
  3495. (*
  3496.  * Indicates that the target surface contains the odd field of video data.
  3497.  * This flag is only valid with an overlay surface.
  3498.  *)
  3499.   DDFLIP_ODD                           = $00000004;
  3500.  
  3501. (*
  3502.  * Causes DirectDraw to perform the physical flip immediately and return
  3503.  * to the application. Typically, what was the front buffer but is now the back
  3504.  * buffer will still be visible (depending on timing) until the next vertical
  3505.  * retrace. Subsequent operations involving the two flipped surfaces will
  3506.  * not check to see if the physical flip has finished (i.e. will not return
  3507.  * DDERR_WASSTILLDRAWING for that reason (but may for other reasons)).
  3508.  * This allows an application to perform Flips at a higher frequency than the
  3509.  * monitor refresh rate, but may introduce visible artifacts.
  3510.  * Only effective if DDCAPS2_FLIPNOVSYNC is set. If that bit is not set,
  3511.  * DDFLIP_NOVSYNC has no effect.
  3512.  *)
  3513.   DDFLIP_NOVSYNC                       = $00000008;
  3514.  
  3515.  
  3516. (*
  3517.  * Flip Interval Flags. These flags indicate how many vertical retraces to wait between
  3518.  * each flip. The default is one. DirectDraw will return DDERR_WASSTILLDRAWING for each
  3519.  * surface involved in the flip until the specified number of vertical retraces has
  3520.  * ocurred. Only effective if DDCAPS2_FLIPINTERVAL is set. If that bit is not set,
  3521.  * DDFLIP_INTERVALn has no effect.
  3522.  *)
  3523.  
  3524. (*
  3525.  * DirectDraw will flip on every other vertical sync
  3526.  *)
  3527.   DDFLIP_INTERVAL2                     = $02000000;
  3528.  
  3529.  
  3530. (*
  3531.  * DirectDraw will flip on every third vertical sync
  3532.  *)
  3533.   DDFLIP_INTERVAL3                     = $03000000;
  3534.  
  3535.  
  3536. (*
  3537.  * DirectDraw will flip on every fourth vertical sync
  3538.  *)
  3539.   DDFLIP_INTERVAL4                     = $04000000;
  3540.  
  3541. (*
  3542.  * DirectDraw will flip and display a main stereo surface
  3543.  *)
  3544.   DDFLIP_STEREO                        = $00000010;
  3545.  
  3546. (*
  3547.  * On IDirectDrawSurface7 and higher interfaces, the default is DDFLIP_WAIT. If you wish
  3548.  * to override the default and use time when the accelerator is busy (as denoted by
  3549.  * the DDERR_WASSTILLDRAWING return code) then use DDFLIP_DONOTWAIT.
  3550.  *)
  3551.   DDFLIP_DONOTWAIT                     = $00000020;
  3552.  
  3553. (****************************************************************************
  3554.  *
  3555.  * DIRECTDRAW SURFACE OVERLAY FLAGS
  3556.  *
  3557.  ****************************************************************************)
  3558.  
  3559. (*
  3560.  * Use the alpha information in the pixel format or the alpha channel surface
  3561.  * attached to the destination surface as the alpha channel for the
  3562.  * destination overlay.
  3563.  *)
  3564.   DDOVER_ALPHADEST                        = $00000001;
  3565.  
  3566. (*
  3567.  * Use the dwConstAlphaDest field in the TDDOverlayFX structure as the
  3568.  * destination alpha channel for this overlay.
  3569.  *)
  3570.   DDOVER_ALPHADESTCONSTOVERRIDE           = $00000002;
  3571.  
  3572. (*
  3573.  * The NEG suffix indicates that the destination surface becomes more
  3574.  * transparent as the alpha value increases.
  3575.  *)
  3576.   DDOVER_ALPHADESTNEG                     = $00000004;
  3577.  
  3578. (*
  3579.  * Use the lpDDSAlphaDest field in the TDDOverlayFX structure as the alpha
  3580.  * channel destination for this overlay.
  3581.  *)
  3582.   DDOVER_ALPHADESTSURFACEOVERRIDE         = $00000008;
  3583.  
  3584. (*
  3585.  * Use the dwAlphaEdgeBlend field in the TDDOverlayFX structure as the alpha
  3586.  * channel for the edges of the image that border the color key colors.
  3587.  *)
  3588.   DDOVER_ALPHAEDGEBLEND                   = $00000010;
  3589.  
  3590. (*
  3591.  * Use the alpha information in the pixel format or the alpha channel surface
  3592.  * attached to the source surface as the source alpha channel for this overlay.
  3593.  *)
  3594.   DDOVER_ALPHASRC                         = $00000020;
  3595.  
  3596. (*
  3597.  * Use the dwConstAlphaSrc field in the TDDOverlayFX structure as the source
  3598.  * alpha channel for this overlay.
  3599.  *)
  3600.   DDOVER_ALPHASRCCONSTOVERRIDE            = $00000040;
  3601.  
  3602. (*
  3603.  * The NEG suffix indicates that the source surface becomes more transparent
  3604.  * as the alpha value increases.
  3605.  *)
  3606.   DDOVER_ALPHASRCNEG                      = $00000080;
  3607.  
  3608. (*
  3609.  * Use the lpDDSAlphaSrc field in the TDDOverlayFX structure as the alpha channel
  3610.  * source for this overlay.
  3611.  *)
  3612.   DDOVER_ALPHASRCSURFACEOVERRIDE          = $00000100;
  3613.  
  3614. (*
  3615.  * Turn this overlay off.
  3616.  *)
  3617.   DDOVER_HIDE                             = $00000200;
  3618.  
  3619. (*
  3620.  * Use the color key associated with the destination surface.
  3621.  *)
  3622.   DDOVER_KEYDEST                          = $00000400;
  3623.  
  3624. (*
  3625.  * Use the dckDestColorkey field in the TDDOverlayFX structure as the color key
  3626.  * for the destination surface
  3627.  *)
  3628.   DDOVER_KEYDESTOVERRIDE                  = $00000800;
  3629.  
  3630. (*
  3631.  * Use the color key associated with the source surface.
  3632.  *)
  3633.   DDOVER_KEYSRC                           = $00001000;
  3634.  
  3635. (*
  3636.  * Use the dckSrcColorkey field in the TDDOverlayFX structure as the color key
  3637.  * for the source surface.
  3638.  *)
  3639.   DDOVER_KEYSRCOVERRIDE                   = $00002000;
  3640.  
  3641. (*
  3642.  * Turn this overlay on.
  3643.  *)
  3644.   DDOVER_SHOW                             = $00004000;
  3645.  
  3646. (*
  3647.  * Add a dirty rect to an emulated overlayed surface.
  3648.  *)
  3649.   DDOVER_ADDDIRTYRECT                     = $00008000;
  3650.  
  3651. (*
  3652.  * Redraw all dirty rects on an emulated overlayed surface.
  3653.  *)
  3654.   DDOVER_REFRESHDIRTYRECTS                = $00010000;
  3655.  
  3656. (*
  3657.  * Redraw the entire surface on an emulated overlayed surface.
  3658.  *)
  3659.   DDOVER_REFRESHALL                      = $00020000;
  3660.  
  3661. (*
  3662.  * Use the overlay FX flags to define special overlay FX
  3663.  *)
  3664.   DDOVER_DDFX                             = $00080000;
  3665.  
  3666. (*
  3667.  * Autoflip the overlay when ever the video port autoflips
  3668.  *)
  3669.   DDOVER_AUTOFLIP                         = $00100000;
  3670.  
  3671. (*
  3672.  * Display each field of video port data individually without
  3673.  * causing any jittery artifacts
  3674.  *)
  3675.   DDOVER_BOB                              = $00200000;
  3676.  
  3677. (*
  3678.  * Indicates that bob/weave decisions should not be overridden by other
  3679.  * interfaces.
  3680.  *)
  3681.   DDOVER_OVERRIDEBOBWEAVE                 = $00400000;
  3682.  
  3683. (*
  3684.  * Indicates that the surface memory is composed of interleaved fields.
  3685.  *)
  3686.   DDOVER_INTERLEAVED                      = $00800000;
  3687.  
  3688. (*
  3689.  * Indicates that bob will be performed using hardware rather than
  3690.  * software or emulated.
  3691.  *)
  3692.   DDOVER_BOBHARDWARE                    = $01000000;
  3693.  
  3694. (*
  3695.  * Indicates that overlay FX structure contains valid ARGB scaling factors.
  3696.  *)
  3697.   DDOVER_ARGBSCALEFACTORS                 = $02000000;
  3698.  
  3699. (*
  3700.  * Indicates that ARGB scaling factors can be degraded to fit driver capabilities.
  3701.  *)
  3702.   DDOVER_DEGRADEARGBSCALING               = $04000000;
  3703.  
  3704. (****************************************************************************
  3705.  *
  3706.  * DIRECTDRAWSURFACE LOCK FLAGS
  3707.  *
  3708.  ****************************************************************************)
  3709.  
  3710. (*
  3711.  * The default.  Set to indicate that Lock should return a valid memory pointer
  3712.  * to the top of the specified rectangle.  If no rectangle is specified then a
  3713.  * pointer to the top of the surface is returned.
  3714.  *)
  3715.   DDLOCK_SURFACEMEMORYPTR                 = $00000000;    // = default
  3716.  
  3717. (*
  3718.  * Set to indicate that Lock should wait until it can obtain a valid memory
  3719.  * pointer before returning.  If this bit is set, Lock will never return
  3720.  * DDERR_WASSTILLDRAWING.
  3721.  *)
  3722.   DDLOCK_WAIT                             = $00000001;
  3723.  
  3724. (*
  3725.  * Set if an event handle is being passed to Lock.  Lock will trigger the event
  3726.  * when it can return the surface memory pointer requested.
  3727.  *)
  3728.   DDLOCK_EVENT                            = $00000002;
  3729.  
  3730. (*
  3731.  * Indicates that the surface being locked will only be read from.
  3732.  *)
  3733.   DDLOCK_READONLY                         = $00000010;
  3734.  
  3735. (*
  3736.  * Indicates that the surface being locked will only be written to
  3737.  *)
  3738.   DDLOCK_WRITEONLY                        = $00000020;
  3739.  
  3740. (*
  3741.  * Indicates that a system wide lock should not be taken when this surface
  3742.  * is locked. This has several advantages (cursor responsiveness, ability
  3743.  * to call more Windows functions, easier debugging) when locking video
  3744.  * memory surfaces. However, an application specifying this flag must
  3745.  * comply with a number of conditions documented in the help file.
  3746.  * Furthermore, this flag cannot be specified when locking the primary.
  3747.  *)
  3748.   DDLOCK_NOSYSLOCK                        = $00000800;
  3749.  
  3750. (*
  3751.  * Used only with Direct3D Vertex Buffer Locks. Indicates that no vertices
  3752.  * that were referred to in Draw*PrimtiveVB calls since the start of the
  3753.  * frame (or the last lock without this flag) will be modified during the
  3754.  * lock. This can be useful when one is only appending data to the vertex
  3755.  * buffer
  3756.  *)
  3757.   DDLOCK_NOOVERWRITE                      = $00001000;
  3758.  
  3759. (*
  3760.  * Indicates that no assumptions will be made about the contents of the
  3761.  * surface or vertex buffer during this lock.
  3762.  * This enables two things:
  3763.  * -    Direct3D or the driver may provide an alternative memory
  3764.  *      area as the vertex buffer. This is useful when one plans to clear the
  3765.  *      contents of the vertex buffer and fill in new data.
  3766.  * -    Drivers sometimes store surface data in a re-ordered format.
  3767.  *      When the application locks the surface, the driver is forced to un-re-order
  3768.  *      the surface data before allowing the application to see the surface contents.
  3769.  *      This flag is a hint to the driver that it can skip the un-re-ordering process
  3770.  *      since the application plans to overwrite every single pixel in the surface
  3771.  *      or locked rectangle (and so erase any un-re-ordered pixels anyway).
  3772.  *      Applications should always set this flag when they intend to overwrite the entire
  3773.  *      surface or locked rectangle.
  3774.  *)
  3775.   DDLOCK_DISCARDCONTENTS                  = $00002000;
  3776.  (*
  3777.   * DDLOCK_OKTOSWAP is an older, less informative name for DDLOCK_DISCARDCONTENTS
  3778.   *)
  3779.   DDLOCK_OKTOSWAP                         = $00002000;
  3780.  
  3781. (*
  3782.  * On IDirectDrawSurface7 and higher interfaces, the default is DDLOCK_WAIT. If you wish
  3783.  * to override the default and use time when the accelerator is busy (as denoted by
  3784.  * the DDERR_WASSTILLDRAWING return code) then use DDLOCK_DONOTWAIT.
  3785.  *)
  3786.   DDLOCK_DONOTWAIT                        = $00004000;
  3787.  
  3788.  
  3789. (****************************************************************************
  3790.  *
  3791.  * DIRECTDRAWSURFACE PAGELOCK FLAGS
  3792.  *
  3793.  ****************************************************************************)
  3794.  
  3795. (*
  3796.  * No flags defined at present
  3797.  *)
  3798.  
  3799.  
  3800. (****************************************************************************
  3801.  *
  3802.  * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS
  3803.  *
  3804.  ****************************************************************************)
  3805.  
  3806. (*
  3807.  * No flags defined at present
  3808.  *)
  3809.  
  3810.  
  3811. (****************************************************************************
  3812.  *
  3813.  * DIRECTDRAWSURFACE BLT FX FLAGS
  3814.  *
  3815.  ****************************************************************************)
  3816.  
  3817. (*
  3818.  * If stretching, use arithmetic stretching along the Y axis for this blt.
  3819.  *)
  3820.   DDBLTFX_ARITHSTRETCHY                   = $00000001;
  3821.  
  3822. (*
  3823.  * Do this blt mirroring the surface left to right.  Spin the
  3824.  * surface around its y-axis.
  3825.  *)
  3826.   DDBLTFX_MIRRORLEFTRIGHT                 = $00000002;
  3827.  
  3828. (*
  3829.  * Do this blt mirroring the surface up and down.  Spin the surface
  3830.  * around its x-axis.
  3831.  *)
  3832.   DDBLTFX_MIRRORUPDOWN                    = $00000004;
  3833.  
  3834. (*
  3835.  * Schedule this blt to avoid tearing.
  3836.  *)
  3837.   DDBLTFX_NOTEARING                       = $00000008;
  3838.  
  3839. (*
  3840.  * Do this blt rotating the surface one hundred and eighty degrees.
  3841.  *)
  3842.   DDBLTFX_ROTATE180                       = $00000010;
  3843.  
  3844. (*
  3845.  * Do this blt rotating the surface two hundred and seventy degrees.
  3846.  *)
  3847.   DDBLTFX_ROTATE270                       = $00000020;
  3848.  
  3849. (*
  3850.  * Do this blt rotating the surface ninety degrees.
  3851.  *)
  3852.   DDBLTFX_ROTATE90                        = $00000040;
  3853.  
  3854. (*
  3855.  * Do this z blt using dwZBufferLow and dwZBufferHigh as  range values
  3856.  * specified to limit the bits copied from the source surface.
  3857.  *)
  3858.   DDBLTFX_ZBUFFERRANGE                    = $00000080;
  3859.  
  3860. (*
  3861.  * Do this z blt adding the dwZBufferBaseDest to each of the sources z values
  3862.  * before comparing it with the desting z values.
  3863.  *)
  3864.   DDBLTFX_ZBUFFERBASEDEST                 = $00000100;
  3865.  
  3866. (****************************************************************************
  3867.  *
  3868.  * DIRECTDRAWSURFACE OVERLAY FX FLAGS
  3869.  *
  3870.  ****************************************************************************)
  3871.  
  3872. (*
  3873.  * If stretching, use arithmetic stretching along the Y axis for this overlay.
  3874.  *)
  3875.   DDOVERFX_ARITHSTRETCHY                  = $00000001;
  3876.  
  3877. (*
  3878.  * Mirror the overlay across the vertical axis
  3879.  *)
  3880.   DDOVERFX_MIRRORLEFTRIGHT                = $00000002;
  3881.  
  3882. (*
  3883.  * Mirror the overlay across the horizontal axis
  3884.  *)
  3885.   DDOVERFX_MIRRORUPDOWN                   = $00000004;
  3886.  
  3887. (****************************************************************************
  3888.  *
  3889.  * Flags for dwDDFX member of DDSPRITEFX structure
  3890.  *
  3891.  ****************************************************************************)
  3892. (*
  3893.  * Use affine transformation matrix in fTransform member.
  3894.  *)
  3895.   DDSPRITEFX_AFFINETRANSFORM            = $00000001;
  3896.  
  3897. (*
  3898.  * Use RGBA scaling factors in ddrgbaScaleFactors member.
  3899.  *)
  3900.   DDSPRITEFX_RGBASCALING                        = $00000002;
  3901.  
  3902. (*
  3903.  * Degrade RGBA scaling factors to accommodate driver's capabilities.
  3904.  *)
  3905.   DDSPRITEFX_DEGRADERGBASCALING         = $00000004;
  3906.  
  3907. (*
  3908.  * Do bilinear filtering of stretched or warped sprite.
  3909.  *)
  3910.   DDSPRITEFX_BILINEARFILTER                     = $00000008;
  3911.  
  3912. (*
  3913.  * Do "blur" filtering of stretched or warped sprite.
  3914.  *)
  3915.   DDSPRITEFX_BLURFILTER                         = $00000010;
  3916.  
  3917. (*
  3918.  * Do "flat" filtering of stretched or warped sprite.
  3919.  *)
  3920.   DDSPRITEFX_FLATFILTER                         = $00000020;
  3921.  
  3922. (*
  3923.  * Degrade filtering operation to accommodate driver's capabilities.
  3924.  *)
  3925.   DDSPRITEFX_DEGRADEFILTER              = $00000040;
  3926.  
  3927. (****************************************************************************
  3928.  *
  3929.  * DIRECTDRAW WAITFORVERTICALBLANK FLAGS
  3930.  *
  3931.  ****************************************************************************)
  3932.  
  3933. (*
  3934.  * return when the vertical blank interval begins
  3935.  *)
  3936.   DDWAITVB_BLOCKBEGIN                     = $00000001;
  3937.  
  3938. (*
  3939.  * set up an event to trigger when the vertical blank begins
  3940.  *)
  3941.   DDWAITVB_BLOCKBEGINEVENT                = $00000002;
  3942.  
  3943. (*
  3944.  * return when the vertical blank interval ends and display begins
  3945.  *)
  3946.   DDWAITVB_BLOCKEND                       = $00000004;
  3947.  
  3948. (****************************************************************************
  3949.  *
  3950.  * DIRECTDRAW GETFLIPSTATUS FLAGS
  3951.  *
  3952.  ****************************************************************************)
  3953.  
  3954. (*
  3955.  * is it OK to flip now?
  3956.  *)
  3957.   DDGFS_CANFLIP                   = $00000001;
  3958.  
  3959. (*
  3960.  * is the last flip finished?
  3961.  *)
  3962.   DDGFS_ISFLIPDONE                = $00000002;
  3963.  
  3964. (****************************************************************************
  3965.  *
  3966.  * DIRECTDRAW GETBLTSTATUS FLAGS
  3967.  *
  3968.  ****************************************************************************)
  3969.  
  3970. (*
  3971.  * is it OK to blt now?
  3972.  *)
  3973.   DDGBS_CANBLT                    = $00000001;
  3974.  
  3975. (*
  3976.  * is the blt to the surface finished?
  3977.  *)
  3978.   DDGBS_ISBLTDONE                 = $00000002;
  3979.  
  3980.  
  3981. (****************************************************************************
  3982.  *
  3983.  * DIRECTDRAW ENUMOVERLAYZORDER FLAGS
  3984.  *
  3985.  ****************************************************************************)
  3986.  
  3987. (*
  3988.  * Enumerate overlays back to front.
  3989.  *)
  3990.   DDENUMOVERLAYZ_BACKTOFRONT      = $00000000;
  3991.  
  3992. (*
  3993.  * Enumerate overlays front to back
  3994.  *)
  3995.   DDENUMOVERLAYZ_FRONTTOBACK      = $00000001;
  3996.  
  3997. (****************************************************************************
  3998.  *
  3999.  * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS
  4000.  *
  4001.  ****************************************************************************)
  4002.  
  4003. (*
  4004.  * Send overlay to front
  4005.  *)
  4006.   DDOVERZ_SENDTOFRONT             = $00000000;
  4007.  
  4008. (*
  4009.  * Send overlay to back
  4010.  *)
  4011.   DDOVERZ_SENDTOBACK              = $00000001;
  4012.  
  4013. (*
  4014.  * Move Overlay forward
  4015.  *)
  4016.   DDOVERZ_MOVEFORWARD             = $00000002;
  4017.  
  4018. (*
  4019.  * Move Overlay backward
  4020.  *)
  4021.   DDOVERZ_MOVEBACKWARD            = $00000003;
  4022.  
  4023. (*
  4024.  * Move Overlay in front of relative surface
  4025.  *)
  4026.   DDOVERZ_INSERTINFRONTOF         = $00000004;
  4027.  
  4028. (*
  4029.  * Move Overlay in back of relative surface
  4030.  *)
  4031.   DDOVERZ_INSERTINBACKOF          = $00000005;
  4032.  
  4033. (****************************************************************************
  4034.  *
  4035.  * DIRECTDRAW SETGAMMARAMP FLAGS
  4036.  *
  4037.  ****************************************************************************)
  4038.  
  4039. (*
  4040.  * Request calibrator to adjust the gamma ramp according to the physical
  4041.  * properties of the display so that the result should appear identical
  4042.  * on all systems.
  4043.  *)
  4044.   DDSGR_CALIBRATE                        = $00000001;
  4045.  
  4046. (****************************************************************************
  4047.  *
  4048.  * DIRECTDRAW STARTMODETEST FLAGS
  4049.  *
  4050.  ****************************************************************************)
  4051.  
  4052. (*
  4053.  * Indicates that the mode being tested has passed
  4054.  *)
  4055.  DDSMT_ISTESTREQUIRED                   = $00000001;
  4056.  
  4057.  
  4058. (****************************************************************************
  4059.  *
  4060.  * DIRECTDRAW EVALUATEMODE FLAGS
  4061.  *
  4062.  ****************************************************************************)
  4063.  
  4064. (*
  4065.  * Indicates that the mode being tested has passed
  4066.  *)
  4067.  DDEM_MODEPASSED                        = $00000001;
  4068.  
  4069. (*
  4070.  * Indicates that the mode being tested has failed
  4071.  *)
  4072.  DDEM_MODEFAILED                        = $00000002;
  4073.  
  4074. (*===========================================================================
  4075.  *
  4076.  *
  4077.  * DIRECTDRAW RETURN CODES
  4078.  *
  4079.  * The return values from DirectDraw Commands and Surface that return an HResult
  4080.  * are codes from DirectDraw concerning the results of the action
  4081.  * requested by DirectDraw.
  4082.  *
  4083.  *==========================================================================*)
  4084.  
  4085. (*
  4086.  * Status is OK
  4087.  *
  4088.  * Issued by: DirectDraw Commands and all callbacks
  4089.  *)
  4090.   DD_OK                                   = 0;
  4091.   DD_FALSE                                = S_FALSE;
  4092.  
  4093. (****************************************************************************
  4094.  *
  4095.  * DIRECTDRAW ENUMCALLBACK RETURN VALUES
  4096.  *
  4097.  * EnumCallback returns are used to control the flow of the DIRECTDRAW and
  4098.  * DIRECTDRAWSURFACE object enumerations.   They can only be returned by
  4099.  * enumeration callback routines.
  4100.  *
  4101.  ****************************************************************************)
  4102.  
  4103. (*
  4104.  * stop the enumeration
  4105.  *)
  4106.   DDENUMRET_CANCEL                        = 0;
  4107.  
  4108. (*
  4109.  * continue the enumeration
  4110.  *)
  4111.   DDENUMRET_OK                            = 1;
  4112.  
  4113. (****************************************************************************
  4114.  *
  4115.  * DIRECTDRAW ERRORS
  4116.  *
  4117.  * Errors are represented by negative values and cannot be combined.
  4118.  *
  4119.  ****************************************************************************)
  4120.  
  4121.   _FACDD = $876;
  4122.   MAKE_DDHRESULT = HResult(1 shl 31) or HResult(_FACDD shl 16);
  4123.  
  4124.  
  4125. (*
  4126.  * This object is already initialized
  4127.  *)
  4128.   DDERR_ALREADYINITIALIZED                = MAKE_DDHRESULT + 5;
  4129.  
  4130. (*
  4131.  * This surface can not be attached to the requested surface.
  4132.  *)
  4133.   DDERR_CANNOTATTACHSURFACE               = MAKE_DDHRESULT + 10;
  4134.  
  4135. (*
  4136.  * This surface can not be detached from the requested surface.
  4137.  *)
  4138.   DDERR_CANNOTDETACHSURFACE               = MAKE_DDHRESULT + 20;
  4139.  
  4140. (*
  4141.  * Support is currently not available.
  4142.  *)
  4143.   DDERR_CURRENTLYNOTAVAIL                 = MAKE_DDHRESULT + 40;
  4144.  
  4145. (*
  4146.  * An exception was encountered while performing the requested operation
  4147.  *)
  4148.   DDERR_EXCEPTION                         = MAKE_DDHRESULT + 55;
  4149.  
  4150. (*
  4151.  * Generic failure.
  4152.  *)
  4153.   DDERR_GENERIC                           = E_FAIL;
  4154.  
  4155. (*
  4156.  * Height of rectangle provided is not a multiple of reqd alignment
  4157.  *)
  4158.   DDERR_HEIGHTALIGN                       = MAKE_DDHRESULT + 90;
  4159.  
  4160. (*
  4161.  * Unable to match primary surface creation request with existing
  4162.  * primary surface.
  4163.  *)
  4164.   DDERR_INCOMPATIBLEPRIMARY               = MAKE_DDHRESULT + 95;
  4165.  
  4166. (*
  4167.  * One or more of the caps bits passed to the callback are incorrect.
  4168.  *)
  4169.   DDERR_INVALIDCAPS                       = MAKE_DDHRESULT + 100;
  4170.  
  4171. (*
  4172.  * DirectDraw does not support provided Cliplist.
  4173.  *)
  4174.   DDERR_INVALIDCLIPLIST                   = MAKE_DDHRESULT + 110;
  4175.  
  4176. (*
  4177.  * DirectDraw does not support the requested mode
  4178.  *)
  4179.   DDERR_INVALIDMODE                       = MAKE_DDHRESULT + 120;
  4180.  
  4181. (*
  4182.  * DirectDraw received a pointer that was an invalid DIRECTDRAW object.
  4183.  *)
  4184.   DDERR_INVALIDOBJECT                     = MAKE_DDHRESULT + 130;
  4185.  
  4186. (*
  4187.  * One or more of the parameters passed to the callback function are
  4188.  * incorrect.
  4189.  *)
  4190.   DDERR_INVALIDPARAMS                     = E_INVALIDARG;
  4191.  
  4192. (*
  4193.  * pixel format was invalid as specified
  4194.  *)
  4195.   DDERR_INVALIDPIXELFORMAT                = MAKE_DDHRESULT + 145;
  4196.  
  4197. (*
  4198.  * Rectangle provided was invalid.
  4199.  *)
  4200.   DDERR_INVALIDRECT                       = MAKE_DDHRESULT + 150;
  4201.  
  4202. (*
  4203.  * Operation could not be carried out because one or more surfaces are locked
  4204.  *)
  4205.   DDERR_LOCKEDSURFACES                    = MAKE_DDHRESULT + 160;
  4206.  
  4207. (*
  4208.  * There is no 3D present.
  4209.  *)
  4210.   DDERR_NO3D                              = MAKE_DDHRESULT + 170;
  4211.  
  4212. (*
  4213.  * Operation could not be carried out because there is no alpha accleration
  4214.  * hardware present or available.
  4215.  *)
  4216.   DDERR_NOALPHAHW                         = MAKE_DDHRESULT + 180;
  4217.  
  4218. (*
  4219.  * Operation could not be carried out because there is no stereo
  4220.  * hardware present or available.
  4221.  *)
  4222.   DDERR_NOSTEREOHARDWARE          = MAKE_DDHRESULT + 181;
  4223.  
  4224. (*
  4225.  * Operation could not be carried out because there is no hardware
  4226.  * present which supports stereo surfaces
  4227.  *)
  4228.   DDERR_NOSURFACELEFT             = MAKE_DDHRESULT + 182;
  4229.  
  4230. (*
  4231.  * no clip list available
  4232.  *)
  4233.   DDERR_NOCLIPLIST                        = MAKE_DDHRESULT + 205;
  4234.  
  4235. (*
  4236.  * Operation could not be carried out because there is no color conversion
  4237.  * hardware present or available.
  4238.  *)
  4239.   DDERR_NOCOLORCONVHW                     = MAKE_DDHRESULT + 210;
  4240.  
  4241. (*
  4242.  * Create function called without DirectDraw object method SetCooperativeLevel
  4243.  * being called.
  4244.  *)
  4245.   DDERR_NOCOOPERATIVELEVELSET             = MAKE_DDHRESULT + 212;
  4246.  
  4247. (*
  4248.  * Surface doesn't currently have a color key
  4249.  *)
  4250.   DDERR_NOCOLORKEY                        = MAKE_DDHRESULT + 215;
  4251.  
  4252. (*
  4253.  * Operation could not be carried out because there is no hardware support
  4254.  * of the dest color key.
  4255.  *)
  4256.   DDERR_NOCOLORKEYHW                      = MAKE_DDHRESULT + 220;
  4257.  
  4258. (*
  4259.  * No DirectDraw support possible with current display driver
  4260.  *)
  4261.   DDERR_NODIRECTDRAWSUPPORT               = MAKE_DDHRESULT + 222;
  4262.  
  4263. (*
  4264.  * Operation requires the application to have exclusive mode but the
  4265.  * application does not have exclusive mode.
  4266.  *)
  4267.   DDERR_NOEXCLUSIVEMODE                   = MAKE_DDHRESULT + 225;
  4268.  
  4269. (*
  4270.  * Flipping visible surfaces is not supported.
  4271.  *)
  4272.   DDERR_NOFLIPHW                          = MAKE_DDHRESULT + 230;
  4273.  
  4274. (*
  4275.  * There is no GDI present.
  4276.  *)
  4277.   DDERR_NOGDI                             = MAKE_DDHRESULT + 240;
  4278.  
  4279. (*
  4280.  * Operation could not be carried out because there is no hardware present
  4281.  * or available.
  4282.  *)
  4283.   DDERR_NOMIRRORHW                        = MAKE_DDHRESULT + 250;
  4284.  
  4285. (*
  4286.  * Requested item was not found
  4287.  *)
  4288.   DDERR_NOTFOUND                          = MAKE_DDHRESULT + 255;
  4289.  
  4290. (*
  4291.  * Operation could not be carried out because there is no overlay hardware
  4292.  * present or available.
  4293.  *)
  4294.   DDERR_NOOVERLAYHW                       = MAKE_DDHRESULT + 260;
  4295.  
  4296. (*
  4297.  * Operation could not be carried out because the source and destination
  4298.  * rectangles are on the same surface and overlap each other.
  4299.  *)
  4300.   DDERR_OVERLAPPINGRECTS                = MAKE_DDHRESULT + 270;
  4301.  
  4302. (*
  4303.  * Operation could not be carried out because there is no appropriate raster
  4304.  * op hardware present or available.
  4305.  *)
  4306.   DDERR_NORASTEROPHW                      = MAKE_DDHRESULT + 280;
  4307.  
  4308. (*
  4309.  * Operation could not be carried out because there is no rotation hardware
  4310.  * present or available.
  4311.  *)
  4312.   DDERR_NOROTATIONHW                      = MAKE_DDHRESULT + 290;
  4313.  
  4314. (*
  4315.  * Operation could not be carried out because there is no hardware support
  4316.  * for stretching
  4317.  *)
  4318.   DDERR_NOSTRETCHHW                       = MAKE_DDHRESULT + 310;
  4319.  
  4320. (*
  4321.  * DirectDrawSurface is not in 4 bit color palette and the requested operation
  4322.  * requires 4 bit color palette.
  4323.  *)
  4324.   DDERR_NOT4BITCOLOR                      = MAKE_DDHRESULT + 316;
  4325.  
  4326. (*
  4327.  * DirectDrawSurface is not in 4 bit color index palette and the requested
  4328.  * operation requires 4 bit color index palette.
  4329.  *)
  4330.   DDERR_NOT4BITCOLORINDEX                 = MAKE_DDHRESULT + 317;
  4331.  
  4332. (*
  4333.  * DirectDraw Surface is not in 8 bit color mode and the requested operation
  4334.  * requires 8 bit color.
  4335.  *)
  4336.   DDERR_NOT8BITCOLOR                      = MAKE_DDHRESULT + 320;
  4337.  
  4338. (*
  4339.  * Operation could not be carried out because there is no texture mapping
  4340.  * hardware present or available.
  4341.  *)
  4342.   DDERR_NOTEXTUREHW                       = MAKE_DDHRESULT + 330;
  4343.  
  4344. (*
  4345.  * Operation could not be carried out because there is no hardware support
  4346.  * for vertical blank synchronized operations.
  4347.  *)
  4348.   DDERR_NOVSYNCHW                         = MAKE_DDHRESULT + 335;
  4349.  
  4350. (*
  4351.  * Operation could not be carried out because there is no hardware support
  4352.  * for zbuffer blting.
  4353.  *)
  4354.   DDERR_NOZBUFFERHW                       = MAKE_DDHRESULT + 340;
  4355.  
  4356. (*
  4357.  * Overlay surfaces could not be z layered based on their BltOrder because
  4358.  * the hardware does not support z layering of overlays.
  4359.  *)
  4360.   DDERR_NOZOVERLAYHW                      = MAKE_DDHRESULT + 350;
  4361.  
  4362. (*
  4363.  * The hardware needed for the requested operation has already been
  4364.  * allocated.
  4365.  *)
  4366.   DDERR_OUTOFCAPS                         = MAKE_DDHRESULT + 360;
  4367.  
  4368. (*
  4369.  * DirectDraw does not have enough memory to perform the operation.
  4370.  *)
  4371.   DDERR_OUTOFMEMORY                       = E_OUTOFMEMORY;
  4372.  
  4373. (*
  4374.  * DirectDraw does not have enough memory to perform the operation.
  4375.  *)
  4376.   DDERR_OUTOFVIDEOMEMORY                  = MAKE_DDHRESULT + 380;
  4377.  
  4378. (*
  4379.  * hardware does not support clipped overlays
  4380.  *)
  4381.   DDERR_OVERLAYCANTCLIP                   = MAKE_DDHRESULT + 382;
  4382.  
  4383. (*
  4384.  * Can only have ony color key active at one time for overlays
  4385.  *)
  4386.   DDERR_OVERLAYCOLORKEYONLYONEACTIVE      = MAKE_DDHRESULT + 384;
  4387.  
  4388. (*
  4389.  * Access to this palette is being refused because the palette is already
  4390.  * locked by another thread.
  4391.  *)
  4392.   DDERR_PALETTEBUSY                       = MAKE_DDHRESULT + 387;
  4393.  
  4394. (*
  4395.  * No src color key specified for this operation.
  4396.  *)
  4397.   DDERR_COLORKEYNOTSET                    = MAKE_DDHRESULT + 400;
  4398.  
  4399. (*
  4400.  * This surface is already attached to the surface it is being attached to.
  4401.  *)
  4402.   DDERR_SURFACEALREADYATTACHED            = MAKE_DDHRESULT + 410;
  4403.  
  4404. (*
  4405.  * This surface is already a dependency of the surface it is being made a
  4406.  * dependency of.
  4407.  *)
  4408.   DDERR_SURFACEALREADYDEPENDENT           = MAKE_DDHRESULT + 420;
  4409.  
  4410. (*
  4411.  * Access to this surface is being refused because the surface is already
  4412.  * locked by another thread.
  4413.  *)
  4414.   DDERR_SURFACEBUSY                       = MAKE_DDHRESULT + 430;
  4415.  
  4416. (*
  4417.  * Access to this surface is being refused because no driver exists
  4418.  * which can supply a pointer to the surface.
  4419.  * This is most likely to happen when attempting to lock the primary
  4420.  * surface when no DCI provider is present.
  4421.  * Will also happen on attempts to lock an optimized surface.
  4422.  *)
  4423.   DDERR_CANTLOCKSURFACE                   = MAKE_DDHRESULT + 435;
  4424.  
  4425. (*
  4426.  * Access to Surface refused because Surface is obscured.
  4427.  *)
  4428.   DDERR_SURFACEISOBSCURED                 = MAKE_DDHRESULT + 440;
  4429.  
  4430. (*
  4431.  * Access to this surface is being refused because the surface is gone.
  4432.  * The DIRECTDRAWSURFACE object representing this surface should
  4433.  * have Restore called on it.
  4434.  *)
  4435.   DDERR_SURFACELOST                       = MAKE_DDHRESULT + 450;
  4436.  
  4437. (*
  4438.  * The requested surface is not attached.
  4439.  *)
  4440.   DDERR_SURFACENOTATTACHED                = MAKE_DDHRESULT + 460;
  4441.  
  4442. (*
  4443.  * Height requested by DirectDraw is too large.
  4444.  *)
  4445.   DDERR_TOOBIGHEIGHT                      = MAKE_DDHRESULT + 470;
  4446.  
  4447. (*
  4448.  * Size requested by DirectDraw is too large --  The individual height and
  4449.  * width are OK.
  4450.  *)
  4451.   DDERR_TOOBIGSIZE                        = MAKE_DDHRESULT + 480;
  4452.  
  4453. (*
  4454.  * Width requested by DirectDraw is too large.
  4455.  *)
  4456.   DDERR_TOOBIGWIDTH                       = MAKE_DDHRESULT + 490;
  4457.  
  4458. (*
  4459.  * Action not supported.
  4460.  *)
  4461.   DDERR_UNSUPPORTED                       = E_NOTIMPL;
  4462.  
  4463. (*
  4464.  * FOURCC format requested is unsupported by DirectDraw
  4465.  *)
  4466.   DDERR_UNSUPPORTEDFORMAT                 = MAKE_DDHRESULT + 510;
  4467.  
  4468. (*
  4469.  * Bitmask in the pixel format requested is unsupported by DirectDraw
  4470.  *)
  4471.   DDERR_UNSUPPORTEDMASK                   = MAKE_DDHRESULT + 520;
  4472.  
  4473. (*
  4474.  * The specified stream contains invalid data
  4475.  *)
  4476.   DDERR_INVALIDSTREAM                     = MAKE_DDHRESULT + 521;
  4477.  
  4478. (*
  4479.  * vertical blank is in progress
  4480.  *)
  4481.   DDERR_VERTICALBLANKINPROGRESS           = MAKE_DDHRESULT + 537;
  4482.  
  4483. (*
  4484.  * Informs DirectDraw that the previous Blt which is transfering information
  4485.  * to or from this Surface is incomplete.
  4486.  *)
  4487.   DDERR_WASSTILLDRAWING                   = MAKE_DDHRESULT + 540;
  4488.  
  4489. (*
  4490.  * The specified surface type requires specification of the COMPLEX flag
  4491.  *)
  4492.   DDERR_DDSCAPSCOMPLEXREQUIRED            = MAKE_DDHRESULT + 542;
  4493.  
  4494. (*
  4495.  * Rectangle provided was not horizontally aligned on reqd. boundary
  4496.  *)
  4497.   DDERR_XALIGN                            = MAKE_DDHRESULT + 560;
  4498.  
  4499. (*
  4500.  * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver
  4501.  * identifier.
  4502.  *)
  4503.   DDERR_INVALIDDIRECTDRAWGUID             = MAKE_DDHRESULT + 561;
  4504.  
  4505. (*
  4506.  * A DirectDraw object representing this driver has already been created
  4507.  * for this process.
  4508.  *)
  4509.   DDERR_DIRECTDRAWALREADYCREATED          = MAKE_DDHRESULT + 562;
  4510.  
  4511. (*
  4512.  * A hardware only DirectDraw object creation was attempted but the driver
  4513.  * did not support any hardware.
  4514.  *)
  4515.   DDERR_NODIRECTDRAWHW                    = MAKE_DDHRESULT + 563;
  4516.  
  4517. (*
  4518.  * this process already has created a primary surface
  4519.  *)
  4520.   DDERR_PRIMARYSURFACEALREADYEXISTS       = MAKE_DDHRESULT + 564;
  4521.  
  4522. (*
  4523.  * software emulation not available.
  4524.  *)
  4525.   DDERR_NOEMULATION                       = MAKE_DDHRESULT + 565;
  4526.  
  4527. (*
  4528.  * region passed to Clipper::GetClipList is too small.
  4529.  *)
  4530.   DDERR_REGIONTOOSMALL                    = MAKE_DDHRESULT + 566;
  4531.  
  4532. (*
  4533.  * an attempt was made to set a clip list for a clipper objec that
  4534.  * is already monitoring an hwnd.
  4535.  *)
  4536.   DDERR_CLIPPERISUSINGHWND                = MAKE_DDHRESULT + 567;
  4537.  
  4538. (*
  4539.  * No clipper object attached to surface object
  4540.  *)
  4541.   DDERR_NOCLIPPERATTACHED                 = MAKE_DDHRESULT + 568;
  4542.  
  4543. (*
  4544.  * Clipper notification requires an HWND or
  4545.  * no HWND has previously been set as the CooperativeLevel HWND.
  4546.  *)
  4547.   DDERR_NOHWND                            = MAKE_DDHRESULT + 569;
  4548.  
  4549. (*
  4550.  * HWND used by DirectDraw CooperativeLevel has been subclassed,
  4551.  * this prevents DirectDraw from restoring state.
  4552.  *)
  4553.   DDERR_HWNDSUBCLASSED                    = MAKE_DDHRESULT + 570;
  4554.  
  4555. (*
  4556.  * The CooperativeLevel HWND has already been set.
  4557.  * It can not be reset while the process has surfaces or palettes created.
  4558.  *)
  4559.   DDERR_HWNDALREADYSET                    = MAKE_DDHRESULT + 571;
  4560.  
  4561. (*
  4562.  * No palette object attached to this surface.
  4563.  *)
  4564.   DDERR_NOPALETTEATTACHED                 = MAKE_DDHRESULT + 572;
  4565.  
  4566. (*
  4567.  * No hardware support for 16 or 256 color palettes.
  4568.  *)
  4569.   DDERR_NOPALETTEHW                       = MAKE_DDHRESULT + 573;
  4570.  
  4571. (*
  4572.  * If a clipper object is attached to the source surface passed into a
  4573.  * BltFast call.
  4574.  *)
  4575.   DDERR_BLTFASTCANTCLIP                   = MAKE_DDHRESULT + 574;
  4576.  
  4577. (*
  4578.  * No blter.
  4579.  *)
  4580.   DDERR_NOBLTHW                           = MAKE_DDHRESULT + 575;
  4581.  
  4582. (*
  4583.  * No DirectDraw ROP hardware.
  4584.  *)
  4585.   DDERR_NODDROPSHW                        = MAKE_DDHRESULT + 576;
  4586.  
  4587. (*
  4588.  * returned when GetOverlayPosition is called on a hidden overlay
  4589.  *)
  4590.   DDERR_OVERLAYNOTVISIBLE                 = MAKE_DDHRESULT + 577;
  4591.  
  4592. (*
  4593.  * returned when GetOverlayPosition is called on a overlay that UpdateOverlay
  4594.  * has never been called on to establish a destionation.
  4595.  *)
  4596.   DDERR_NOOVERLAYDEST                     = MAKE_DDHRESULT + 578;
  4597.  
  4598. (*
  4599.  * returned when the position of the overlay on the destionation is no longer
  4600.  * legal for that destionation.
  4601.  *)
  4602.   DDERR_INVALIDPOSITION                   = MAKE_DDHRESULT + 579;
  4603.  
  4604. (*
  4605.  * returned when an overlay member is called for a non-overlay surface
  4606.  *)
  4607.   DDERR_NOTAOVERLAYSURFACE                = MAKE_DDHRESULT + 580;
  4608.  
  4609. (*
  4610.  * An attempt was made to set the cooperative level when it was already
  4611.  * set to exclusive.
  4612.  *)
  4613.   DDERR_EXCLUSIVEMODEALREADYSET           = MAKE_DDHRESULT + 581;
  4614.  
  4615. (*
  4616.  * An attempt has been made to flip a surface that is not flippable.
  4617.  *)
  4618.   DDERR_NOTFLIPPABLE                      = MAKE_DDHRESULT + 582;
  4619.  
  4620. (*
  4621.  * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly
  4622.  * created.
  4623.  *)
  4624.   DDERR_CANTDUPLICATE                     = MAKE_DDHRESULT + 583;
  4625.  
  4626. (*
  4627.  * Surface was not locked.  An attempt to unlock a surface that was not
  4628.  * locked at all, or by this process, has been attempted.
  4629.  *)
  4630.   DDERR_NOTLOCKED                         = MAKE_DDHRESULT + 584;
  4631.  
  4632. (*
  4633.  * Windows can not create any more DCs, or a DC was requested for a paltte-indexed
  4634.  * surface when the surface had no palette AND the display mode was not palette-indexed
  4635.  * (in this case DirectDraw cannot select a proper palette into the DC)
  4636.  *)
  4637.   DDERR_CANTCREATEDC                      = MAKE_DDHRESULT + 585;
  4638.  
  4639. (*
  4640.  * No DC was ever created for this surface.
  4641.  *)
  4642.   DDERR_NODC                              = MAKE_DDHRESULT + 586;
  4643.  
  4644. (*
  4645.  * This surface can not be restored because it was created in a different
  4646.  * mode.
  4647.  *)
  4648.   DDERR_WRONGMODE                         = MAKE_DDHRESULT + 587;
  4649.  
  4650. (*
  4651.  * This surface can not be restored because it is an implicitly created
  4652.  * surface.
  4653.  *)
  4654.   DDERR_IMPLICITLYCREATED                 = MAKE_DDHRESULT + 588;
  4655.  
  4656. (*
  4657.  * The surface being used is not a palette-based surface
  4658.  *)
  4659.   DDERR_NOTPALETTIZED                     = MAKE_DDHRESULT + 589;
  4660.  
  4661. (*
  4662.  * The display is currently in an unsupported mode
  4663.  *)
  4664.   DDERR_UNSUPPORTEDMODE                   = MAKE_DDHRESULT + 590;
  4665.  
  4666. (*
  4667.  * Operation could not be carried out because there is no mip-map
  4668.  * texture mapping hardware present or available.
  4669.  *)
  4670.   DDERR_NOMIPMAPHW                        = MAKE_DDHRESULT + 591;
  4671.  
  4672. (*
  4673.  * The requested action could not be performed because the surface was of
  4674.  * the wrong type.
  4675.  *)
  4676.   DDERR_INVALIDSURFACETYPE                = MAKE_DDHRESULT + 592;
  4677.  
  4678. (*
  4679.  * Device does not support optimized surfaces, therefore no video memory optimized surfaces
  4680.  *)
  4681.   DDERR_NOOPTIMIZEHW                      = MAKE_DDHRESULT + 600;
  4682.  
  4683. (*
  4684.  * Surface is an optimized surface, but has not yet been allocated any memory
  4685.  *)
  4686.   DDERR_NOTLOADED                         = MAKE_DDHRESULT + 601;
  4687.  
  4688. (*
  4689.  * Attempt was made to create or set a device window without first setting
  4690.  * the focus window
  4691.  *)
  4692.   DDERR_NOFOCUSWINDOW                     = MAKE_DDHRESULT + 602;
  4693.  
  4694. (*
  4695.  * Attempt was made to set a palette on a mipmap sublevel
  4696.  *)
  4697.   DDERR_NOTONMIPMAPSUBLEVEL               = MAKE_DDHRESULT + 603;
  4698.  
  4699. (*
  4700.  * A DC has already been returned for this surface. Only one DC can be
  4701.  * retrieved per surface.
  4702.  *)
  4703.   DDERR_DCALREADYCREATED                  = MAKE_DDHRESULT + 620;
  4704.  
  4705. (*
  4706.  * An attempt was made to allocate non-local video memory from a device
  4707.  * that does not support non-local video memory.
  4708.  *)
  4709.   DDERR_NONONLOCALVIDMEM                  = MAKE_DDHRESULT + 630;
  4710.  
  4711. (*
  4712.  * The attempt to page lock a surface failed.
  4713.  *)
  4714.   DDERR_CANTPAGELOCK                      = MAKE_DDHRESULT + 640;
  4715.  
  4716. (*
  4717.  * The attempt to page unlock a surface failed.
  4718.  *)
  4719.   DDERR_CANTPAGEUNLOCK                    = MAKE_DDHRESULT + 660;
  4720.  
  4721. (*
  4722.  * An attempt was made to page unlock a surface with no outstanding page locks.
  4723.  *)
  4724.   DDERR_NOTPAGELOCKED                     = MAKE_DDHRESULT + 680;
  4725.  
  4726. (*
  4727.  * There is more data available than the specified buffer size could hold
  4728.  *)
  4729.   DDERR_MOREDATA                                = MAKE_DDHRESULT + 690;
  4730.  
  4731. (*
  4732.  * The data has expired and is therefore no longer valid.
  4733.  *)
  4734.   DDERR_EXPIRED                           = MAKE_DDHRESULT + 691;
  4735.  
  4736. (*
  4737.  * The mode test has finished executing.
  4738.  *)
  4739.  DDERR_TESTFINISHED                      = MAKE_DDHRESULT + 692;
  4740.  
  4741. (*
  4742.  * The mode test has switched to a new mode.
  4743.  *)
  4744.  DDERR_NEWMODE                           = MAKE_DDHRESULT + 693;
  4745.  
  4746. (*
  4747.  * D3D has not yet been initialized.
  4748.  *)
  4749.  DDERR_D3DNOTINITIALIZED                 = MAKE_DDHRESULT + 694;
  4750.  
  4751. (*
  4752.  * The video port is not active
  4753.  *)
  4754.   DDERR_VIDEONOTACTIVE                          = MAKE_DDHRESULT + 695;
  4755.  
  4756. (*
  4757.  * The monitor does not have EDID data.
  4758.  *)
  4759.  DDERR_NOMONITORINFORMATION             = MAKE_DDHRESULT + 696;
  4760.  
  4761. (*
  4762.  * The driver does not enumerate display mode refresh rates.
  4763.  *)
  4764.  DDERR_NODRIVERSUPPORT                  = MAKE_DDHRESULT + 697;
  4765.  
  4766. (*
  4767.  * Surfaces created by one direct draw device cannot be used directly by
  4768.  * another direct draw device.
  4769.  *)
  4770.   DDERR_DEVICEDOESNTOWNSURFACE                  = MAKE_DDHRESULT + 699;
  4771.  
  4772. (*
  4773.  * An attempt was made to invoke an interface member of a DirectDraw object
  4774.  * created by CoCreateInstance() before it was initialized.
  4775.  *)
  4776.   DDERR_NOTINITIALIZED                    = CO_E_NOTINITIALIZED;
  4777.  
  4778. (* Alpha bit depth constants *)
  4779.  
  4780. (*
  4781.  * API's
  4782.  *)
  4783.  
  4784. type
  4785.   HMonitor = THandle;
  4786.  
  4787.   TDDEnumCallbackA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
  4788.       lpDriverName: PAnsiChar; lpContext: Pointer) : BOOL; stdcall;
  4789.   TDDEnumCallbackW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
  4790.       lpDriverName: PWideChar; lpContext: Pointer) : BOOL; stdcall;
  4791. {$IFDEF UNICODE}
  4792.   TDDEnumCallback = TDDEnumCallbackW;
  4793. {$ELSE}
  4794.   TDDEnumCallback = TDDEnumCallbackA;
  4795. {$ENDIF}
  4796.  
  4797.   TDDEnumCallbackExA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
  4798.       lpDriverName: PAnsiChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
  4799.       stdcall;
  4800.   TDDEnumCallbackExW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
  4801.       lpDriverName: PWideChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
  4802.       stdcall;
  4803.      
  4804. {$IFDEF UNICODE}
  4805.   TDDEnumCallbackEx = TDDEnumCallbackExW;
  4806. {$ELSE}
  4807.   TDDEnumCallbackEx = TDDEnumCallbackExA;
  4808. {$ENDIF}
  4809.  
  4810. var
  4811.   DirectDrawEnumerateA : function (lpCallback: TDDEnumCallbackA;
  4812.        lpContext: Pointer) : HResult; stdcall;
  4813.   DirectDrawEnumerateW : function (lpCallback: TDDEnumCallbackW;
  4814.        lpContext: Pointer) : HResult; stdcall;
  4815.   DirectDrawEnumerate : function (lpCallback: TDDEnumCallback;
  4816.        lpContext: Pointer) : HResult; stdcall;
  4817.  
  4818.   DirectDrawEnumerateExA : function (lpCallback: TDDEnumCallbackExA;
  4819.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4820.   DirectDrawEnumerateExW : function (lpCallback: TDDEnumCallbackExW;
  4821.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4822.   DirectDrawEnumerateEx : function (lpCallback: TDDEnumCallbackEx;
  4823.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4824.  
  4825.   DirectDrawCreate : function (lpGUID: PGUID;
  4826.        out lplpDD: IDirectDraw;
  4827.        pUnkOuter: IUnknown) : HResult; stdcall;
  4828.   DirectDrawCreateEx : function  (lpGUID: PGUID;
  4829.        out lplpDD: IDirectDraw7; const iid: TGUID;
  4830.        pUnkOuter: IUnknown) : HResult; stdcall;
  4831.   DirectDrawCreateClipper : function (dwFlags: DWORD;
  4832.        out lplpDDClipper: IDirectDrawClipper;
  4833.        pUnkOuter: IUnknown) : HResult; stdcall;
  4834.  
  4835. const
  4836. (*
  4837.  * Flags for DirectDrawEnumerateEx
  4838.  * DirectDrawEnumerateEx supercedes DirectDrawEnumerate. You must use GetProcAddress to
  4839.  * obtain a function pointer (of type LPDIRECTDRAWENUMERATEEX) to DirectDrawEnumerateEx.
  4840.  * By default, only the primary display device is enumerated.
  4841.  * DirectDrawEnumerate is equivalent to DirectDrawEnumerate(,,DDENUM_NONDISPLAYDEVICES)
  4842.  *)
  4843.  
  4844. (*
  4845.  * This flag causes enumeration of any GDI display devices which are part of
  4846.  * the Windows Desktop
  4847.  *)
  4848.   DDENUM_ATTACHEDSECONDARYDEVICES     = $00000001;
  4849.  
  4850. (*
  4851.  * This flag causes enumeration of any GDI display devices which are not
  4852.  * part of the Windows Desktop
  4853.  *)
  4854.   DDENUM_DETACHEDSECONDARYDEVICES     = $00000002;
  4855.  
  4856. (*
  4857.  * This flag causes enumeration of non-display devices
  4858.  *)
  4859.   DDENUM_NONDISPLAYDEVICES            = $00000004;
  4860.  
  4861.   REGSTR_KEY_DDHW_DESCRIPTION = 'Description';
  4862.   REGSTR_KEY_DDHW_DRIVERNAME  = 'DriverName';
  4863.   REGSTR_PATH_DDHW            = 'Hardware\DirectDrawDrivers';
  4864.  
  4865.   DDCREATE_HARDWAREONLY       = $00000001;
  4866.   DDCREATE_EMULATIONONLY      = $00000002;
  4867.  
  4868. (*
  4869.  * Macros for interpretting DDEVICEIDENTIFIER2.dwWHQLLevel
  4870.  *)
  4871. function GET_WHQL_YEAR(dwWHQLLevel: DWORD) : DWORD;
  4872. function GET_WHQL_MONTH(dwWHQLLevel: DWORD) : DWORD;
  4873. function GET_WHQL_DAY(dwWHQLLevel: DWORD) : DWORD;
  4874.  
  4875.  
  4876. (*==========================================================================;
  4877.  *
  4878.  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
  4879.  *
  4880.  *  File:       dvp.h
  4881.  *  Content:    DirectDrawVideoPort include file
  4882.  *
  4883.  ***************************************************************************)
  4884.  
  4885. const
  4886. (*
  4887.  * GUIDS used by DirectDrawVideoPort objects
  4888.  *)
  4889.   DDVPTYPE_E_HREFH_VREFH: TGUID =
  4890.       (D1:$54F39980;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4891.   DDVPTYPE_E_HREFH_VREFL: TGUID =
  4892.       (D1:$92783220;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4893.   DDVPTYPE_E_HREFL_VREFH: TGUID =
  4894.       (D1:$A07A02E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4895.   DDVPTYPE_E_HREFL_VREFL: TGUID =
  4896.       (D1:$E09C77E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4897.   DDVPTYPE_CCIR656: TGUID =
  4898.       (D1:$FCA326A0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4899.   DDVPTYPE_BROOKTREE: TGUID =
  4900.       (D1:$1352A560;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4901.   DDVPTYPE_PHILIPS: TGUID =
  4902.       (D1:$332CF160;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4903.  
  4904. (*
  4905.  * GUIDS used to describe connections
  4906.  *)
  4907.  
  4908. (*============================================================================
  4909.  *
  4910.  * DirectDraw Structures
  4911.  *
  4912.  * Various structures used to invoke DirectDraw.
  4913.  *
  4914.  *==========================================================================*)
  4915.  
  4916. type
  4917.  
  4918. (*
  4919.  * TDDVideoPortConnect
  4920.  *)
  4921.   PDDVideoPortConnect = ^TDDVideoPortConnect;
  4922.   TDDVideoPortConnect = packed record
  4923.     dwSize: DWORD;        // size of the TDDVideoPortConnect structure
  4924.     dwPortWidth: DWORD;   // Width of the video port
  4925.     guidTypeID: TGUID;    // Description of video port connection
  4926.     dwFlags: DWORD;       // Connection flags
  4927.     dwReserved1: DWORD;   // Reserved, set to zero.
  4928.   end;
  4929.  
  4930. (*
  4931.  * TDDVideoPortCaps
  4932.  *)
  4933.   PDDVideoPortCaps = ^TDDVideoPortCaps;
  4934.   TDDVideoPortCaps = packed record
  4935.     dwSize: DWORD;                          // size of the TDDVideoPortCaps structure
  4936.     dwFlags: DWORD;                         // indicates which fields contain data
  4937.     dwMaxWidth: DWORD;                      // max width of the video port field
  4938.     dwMaxVBIWidth: DWORD;                   // max width of the VBI data
  4939.     dwMaxHeight: DWORD;                     // max height of the video port field
  4940.     dwVideoPortID: DWORD;                   // Video port ID (0 - (dwMaxVideoPorts -1))
  4941.     dwCaps: DWORD;                          // Video port capabilities
  4942.     dwFX: DWORD;                            // More video port capabilities
  4943.     dwNumAutoFlipSurfaces: DWORD;           // Number of autoflippable surfaces
  4944.     dwAlignVideoPortBoundary: DWORD;        // Byte restriction of placement within the surface
  4945.     dwAlignVideoPortPrescaleWidth: DWORD;   // Byte restriction of width after prescaling
  4946.     dwAlignVideoPortCropBoundary: DWORD;    // Byte restriction of left cropping
  4947.     dwAlignVideoPortCropWidth: DWORD;       // Byte restriction of cropping width
  4948.     dwPreshrinkXStep: DWORD;                // Width can be shrunk in steps of 1/x
  4949.     dwPreshrinkYStep: DWORD;                // Height can be shrunk in steps of 1/x
  4950.     dwNumVBIAutoFlipSurfaces: DWORD;        // Number of VBI autoflippable surfaces
  4951.     dwNumPreferredAutoflip: DWORD;      // Optimal number of autoflippable surfaces for hardware
  4952.     wNumFilterTapsX: WORD;              // Number of taps the prescaler uses in the X direction (0 - no prescale, 1 - replication, etc.)
  4953.     wNumFilterTapsY: WORD;              // Number of taps the prescaler uses in the Y direction (0 - no prescale, 1 - replication, etc.)
  4954.   end;
  4955.  
  4956. const
  4957. (*
  4958.  * The dwMaxWidth and dwMaxVBIWidth members are valid
  4959.  *)
  4960.   DDVPD_WIDTH = $00000001;
  4961.  
  4962. (*
  4963.  * The dwMaxHeight member is valid
  4964.  *)
  4965.   DDVPD_HEIGHT = $00000002;
  4966.  
  4967. (*
  4968.  * The dwVideoPortID member is valid
  4969.  *)
  4970.   DDVPD_ID = $00000004;
  4971.  
  4972. (*
  4973.  * The dwCaps member is valid
  4974.  *)
  4975.   DDVPD_CAPS = $00000008;
  4976.  
  4977. (*
  4978.  * The dwFX member is valid
  4979.  *)
  4980.   DDVPD_FX = $00000010;
  4981.  
  4982. (*
  4983.  * The dwNumAutoFlipSurfaces member is valid
  4984.  *)
  4985.   DDVPD_AUTOFLIP = $00000020;
  4986.  
  4987. (*
  4988.  * All of the alignment members are valid
  4989.  *)
  4990.   DDVPD_ALIGN = $00000040;
  4991.  
  4992. (*
  4993.  * The dwNumPreferredAutoflip member is valid
  4994.  *)
  4995.   DDVPD_PREFERREDAUTOFLIP = $00000080;
  4996.  
  4997. (*
  4998.  * The wNumFilterTapsX and wNumFilterTapsY fields are valid
  4999.  *)
  5000.   DDVPD_FILTERQUALITY     = $00000100;
  5001.  
  5002. type
  5003. (*
  5004.  * TDDVideoPortDesc
  5005.  *)
  5006.   PDDVideoPortDesc = ^TDDVideoPortDesc;
  5007.   TDDVideoPortDesc = packed record
  5008.     dwSize: DWORD;                       // size of the TDDVideoPortDesc structure
  5009.     dwFieldWidth: DWORD;                 // width of the video port field
  5010.     dwVBIWidth: DWORD;                   // width of the VBI data
  5011.     dwFieldHeight: DWORD;                // height of the video port field
  5012.     dwMicrosecondsPerField: DWORD;       // Microseconds per video field
  5013.     dwMaxPixelsPerSecond: DWORD;         // Maximum pixel rate per second
  5014.     dwVideoPortID: DWORD;                // Video port ID (0 - (dwMaxVideoPorts -1))
  5015.     dwReserved1: DWORD;                  // Reserved for future use - set to zero
  5016.     VideoPortType: TDDVideoPortConnect;  // Description of video port connection
  5017.     dwReserved2: DWORD;                  // Reserved for future use - set to zero
  5018.     dwReserved3: DWORD;                  // Reserved for future use - set to zero
  5019.   end;
  5020.  
  5021. (*
  5022.  * TDDVideoPortInfo
  5023.  *)
  5024.   PDDVideoPortInfo = ^TDDVideoPortInfo;
  5025.   TDDVideoPortInfo = packed record
  5026.     dwSize: DWORD;                            // Size of the structure
  5027.     dwOriginX: DWORD;                         // Placement of the video data within the surface.
  5028.     dwOriginY: DWORD;                         // Placement of the video data within the surface.
  5029.     dwVPFlags: DWORD;                         // Video port options
  5030.     rCrop: TRect;                             // Cropping rectangle (optional).
  5031.     dwPrescaleWidth: DWORD;                   // Determines pre-scaling/zooming in the X direction (optional).
  5032.     dwPrescaleHeight: DWORD;                  // Determines pre-scaling/zooming in the Y direction (optional).
  5033.     lpddpfInputFormat: PDDPixelFormat;       // Video format written to the video port
  5034.     lpddpfVBIInputFormat: PDDPixelFormat;    // Input format of the VBI data
  5035.     lpddpfVBIOutputFormat: PDDPixelFormat;   // Output format of the data
  5036.     dwVBIHeight: DWORD;                       // Specifies the number of lines of data within the vertical blanking interval.
  5037.     dwReserved1: DWORD;                       // Reserved for future use - set to zero
  5038.     dwReserved2: DWORD;                       // Reserved for future use - set to zero
  5039.   end;
  5040.  
  5041. (*
  5042.  * TDDVideoPortBandWidth
  5043.  *)
  5044.   PDDVideoPortBandWidth = ^TDDVideoPortBandWidth;
  5045.   TDDVideoPortBandWidth = packed record
  5046.     dwSize: DWORD;                 // Size of the structure
  5047.     dwCaps: DWORD;
  5048.     dwOverlay: DWORD;              // Zoom factor at which overlay is supported
  5049.     dwColorkey: DWORD;             // Zoom factor at which overlay w/ colorkey is supported
  5050.     dwYInterpolate: DWORD;         // Zoom factor at which overlay w/ Y interpolation is supported
  5051.     dwYInterpAndColorkey: DWORD;   // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported
  5052.     dwReserved1: DWORD;            // Reserved for future use - set to zero
  5053.     dwReserved2: DWORD;            // Reserved for future use - set to zero
  5054.   end;
  5055.  
  5056. (*
  5057.  * TDDVideoPortStatus
  5058.  *)
  5059.   PDDVideoPortStatus = ^TDDVideoPortStatus;
  5060.   TDDVideoPortStatus = record
  5061.     dwSize: DWORD;                       // Size of the structure
  5062.     bInUse: BOOL;                        // TRUE if video port is currently being used
  5063.     dwFlags: DWORD;                      // Currently not used
  5064.     dwReserved1: DWORD;                  // Reserved for future use
  5065.     VideoPortType: TDDVideoPortConnect;  // Information about the connection
  5066.     dwReserved2: DWORD;                  // Reserved for future use
  5067.     dwReserved3: DWORD;                  // Reserved for future use
  5068.   end;
  5069.  
  5070. const
  5071. (*============================================================================
  5072.  *
  5073.  * Video Port Flags
  5074.  *
  5075.  * All flags are bit flags.
  5076.  *
  5077.  *==========================================================================*)
  5078.  
  5079. (****************************************************************************
  5080.  *
  5081.  * VIDEOPORT TDDVideoPortConnect FLAGS
  5082.  *
  5083.  ****************************************************************************)
  5084.  
  5085. (*
  5086.  * When this is set by the driver and passed to the client, this
  5087.  * indicates that the video port is capable of double clocking the data.
  5088.  * When this is set by the client, this indicates that the video port
  5089.  * should enable double clocking.  This flag is only valid with external
  5090.  * syncs.
  5091.  *)
  5092.   DDVPCONNECT_DOUBLECLOCK = $00000001;
  5093.  
  5094. (*
  5095.  * When this is set by the driver and passed to the client, this
  5096.  * indicates that the video port is capable of using an external VACT
  5097.  * signal. When this is set by the client, this indicates that the
  5098.  * video port should use the external VACT signal.
  5099.  *)
  5100.   DDVPCONNECT_VACT = $00000002;
  5101.  
  5102. (*
  5103.  * When this is set by the driver and passed to the client, this
  5104.  * indicates that the video port is capable of treating even fields
  5105.  * like odd fields and visa versa.  When this is set by the client,
  5106.  * this indicates that the video port should treat even fields like odd
  5107.  * fields.
  5108.  *)
  5109.   DDVPCONNECT_INVERTPOLARITY = $00000004;
  5110.  
  5111. (*
  5112.  * Indicates that any data written to the video port during the VREF
  5113.  * period will not be written into the frame buffer. This flag is read only.
  5114.  *)
  5115.   DDVPCONNECT_DISCARDSVREFDATA = $00000008;
  5116.  
  5117. (*
  5118.  * When this is set be the driver and passed to the client, this
  5119.  * indicates that the device will write half lines into the frame buffer
  5120.  * if half lines are provided by the decoder.  If this is set by the client,
  5121.  * this indicates that the decoder will be supplying half lines.
  5122.  *)
  5123.   DDVPCONNECT_HALFLINE = $00000010;
  5124.  
  5125. (*
  5126.  * Indicates that the signal is interlaced. This flag is only
  5127.  * set by the client.
  5128.  *)
  5129.   DDVPCONNECT_INTERLACED = $00000020;
  5130.  
  5131. (*
  5132.  * Indicates that video port is shareable and that this video port
  5133.  * will use the even fields.  This flag is only set by the client.
  5134.  *)
  5135.   DDVPCONNECT_SHAREEVEN = $00000040;
  5136.  
  5137. (*
  5138.  * Indicates that video port is shareable and that this video port
  5139.  * will use the odd fields.  This flag is only set by the client.
  5140.  *)
  5141.   DDVPCONNECT_SHAREODD = $00000080;
  5142.  
  5143. (****************************************************************************
  5144.  *
  5145.  * VIDEOPORT TDDVideoPortDesc CAPS
  5146.  *
  5147.  ****************************************************************************)
  5148.  
  5149. (*
  5150.  * Flip can be performed automatically to avoid tearing.
  5151.  *)
  5152.   DDVPCAPS_AUTOFLIP = $00000001;
  5153.  
  5154. (*
  5155.  * Supports interlaced video
  5156.  *)
  5157.   DDVPCAPS_INTERLACED = $00000002;
  5158.  
  5159. (*
  5160.  * Supports non-interlaced video
  5161.  *)
  5162.   DDVPCAPS_NONINTERLACED = $00000004;
  5163.  
  5164. (*
  5165.  * Indicates that the device can return whether the current field
  5166.  * of an interlaced signal is even or odd.
  5167.  *)
  5168.   DDVPCAPS_READBACKFIELD = $00000008;
  5169.  
  5170. (*
  5171.  * Indicates that the device can return the current line of video
  5172.  * being written into the frame buffer.
  5173.  *)
  5174.   DDVPCAPS_READBACKLINE = $00000010;
  5175.  
  5176. (*
  5177.  * Allows two gen-locked video streams to share a single video port,
  5178.  * where one stream uses the even fields and the other uses the odd
  5179.  * fields. Separate parameters (including address, scaling,
  5180.  * cropping, etc.) are maintained for both fields.)
  5181.  *)
  5182.   DDVPCAPS_SHAREABLE = $00000020;
  5183.  
  5184. (*
  5185.  * Even fields of video can be automatically discarded.
  5186.  *)
  5187.   DDVPCAPS_SKIPEVENFIELDS = $00000040;
  5188.  
  5189. (*
  5190.  * Odd fields of video can be automatically discarded.
  5191.  *)
  5192.   DDVPCAPS_SKIPODDFIELDS = $00000080;
  5193.  
  5194. (*
  5195.  * Indicates that the device is capable of driving the graphics
  5196.  * VSYNC with the video port VSYNC.
  5197.  *)
  5198.   DDVPCAPS_SYNCMASTER = $00000100;
  5199.  
  5200. (*
  5201.  * Indicates that data within the vertical blanking interval can
  5202.  * be written to a different surface.
  5203.  *)
  5204.   DDVPCAPS_VBISURFACE = $00000200;
  5205.  
  5206. (*
  5207.  * Indicates that the video port can perform color operations
  5208.  * on the incoming data before it is written to the frame buffer.
  5209.  *)
  5210.   DDVPCAPS_COLORCONTROL = $00000400;
  5211.  
  5212. (*
  5213.  * Indicates that the video port can accept VBI data in a different
  5214.  * width or format than the regular video data.
  5215.  *)
  5216.   DDVPCAPS_OVERSAMPLEDVBI = $00000800;
  5217.  
  5218. (*
  5219.  * Indicates that the video port can write data directly to system memory
  5220.  *)
  5221.   DDVPCAPS_SYSTEMMEMORY = $00001000;
  5222.  
  5223. (*
  5224.  * Indicates that the VBI and video portions of the video stream can
  5225.  * be controlled by an independent processes.
  5226.  *)
  5227.   DDVPCAPS_VBIANDVIDEOINDEPENDENT       = $00002000;
  5228.  
  5229. (*
  5230.  * Indicates that the video port contains high quality hardware
  5231.  * de-interlacing hardware that should be used instead of the
  5232.  * bob/weave algorithms.
  5233.  *)
  5234.   DDVPCAPS_HARDWAREDEINTERLACE          = $00004000;
  5235.  
  5236. (****************************************************************************
  5237.  *
  5238.  * VIDEOPORT TDDVideoPortDesc FX
  5239.  *
  5240.  ****************************************************************************)
  5241.  
  5242. (*
  5243.  * Limited cropping is available to crop out the vertical interval data.
  5244.  *)
  5245.   DDVPFX_CROPTOPDATA = $00000001;
  5246.  
  5247. (*
  5248.  * Incoming data can be cropped in the X direction before it is written
  5249.  * to the surface.
  5250.  *)
  5251.   DDVPFX_CROPX = $00000002;
  5252.  
  5253. (*
  5254.  * Incoming data can be cropped in the Y direction before it is written
  5255.  * to the surface.
  5256.  *)
  5257.   DDVPFX_CROPY = $00000004;
  5258.  
  5259. (*
  5260.  * Supports interleaving interlaced fields in memory.
  5261.  *)
  5262.   DDVPFX_INTERLEAVE = $00000008;
  5263.  
  5264. (*
  5265.  * Supports mirroring left to right as the video data is written
  5266.  * into the frame buffer.
  5267.  *)
  5268.   DDVPFX_MIRRORLEFTRIGHT = $00000010;
  5269.  
  5270. (*
  5271.  * Supports mirroring top to bottom as the video data is written
  5272.  * into the frame buffer.
  5273.  *)
  5274.   DDVPFX_MIRRORUPDOWN = $00000020;
  5275.  
  5276. (*
  5277.  * Data can be arbitrarily shrunk in the X direction before it
  5278.  * is written to the surface.
  5279.  *)
  5280.   DDVPFX_PRESHRINKX = $00000040;
  5281.  
  5282. (*
  5283.  * Data can be arbitrarily shrunk in the Y direction before it
  5284.  * is written to the surface.
  5285.  *)
  5286.   DDVPFX_PRESHRINKY = $00000080;
  5287.  
  5288. (*
  5289.  * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the X
  5290.  * direction before it is written to the surface.
  5291.  *)
  5292.   DDVPFX_PRESHRINKXB = $00000100;
  5293.  
  5294. (*
  5295.  * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the Y
  5296.  * direction before it is written to the surface.
  5297.  *)
  5298.   DDVPFX_PRESHRINKYB = $00000200;
  5299.  
  5300. (*
  5301.  * Data can be shrunk in increments of 1/x in the X direction
  5302.  * (where X is specified in the TDDVideoPortCaps.dwPreshrinkXStep)
  5303.  * before it is written to the surface.
  5304.  *)
  5305.   DDVPFX_PRESHRINKXS = $00000400;
  5306.  
  5307. (*
  5308.  * Data can be shrunk in increments of 1/x in the Y direction
  5309.  * (where X is specified in the TDDVideoPortCaps.dwPreshrinkYStep)
  5310.  * before it is written to the surface.
  5311.  *)
  5312.   DDVPFX_PRESHRINKYS = $00000800;
  5313.  
  5314. (*
  5315.  * Data can be arbitrarily stretched in the X direction before
  5316.  * it is written to the surface.
  5317.  *)
  5318.   DDVPFX_PRESTRETCHX = $00001000;
  5319.  
  5320. (*
  5321.  * Data can be arbitrarily stretched in the Y direction before
  5322.  * it is written to the surface.
  5323.  *)
  5324.   DDVPFX_PRESTRETCHY = $00002000;
  5325.  
  5326. (*
  5327.  * Data can be integer stretched in the X direction before it is
  5328.  * written to the surface.
  5329.  *)
  5330.   DDVPFX_PRESTRETCHXN = $00004000;
  5331.  
  5332. (*
  5333.  * Data can be integer stretched in the Y direction before it is
  5334.  * written to the surface.
  5335.  *)
  5336.   DDVPFX_PRESTRETCHYN = $00008000;
  5337.  
  5338. (*
  5339.  * Indicates that data within the vertical blanking interval can
  5340.  * be converted independently of the remaining video data.
  5341.  *)
  5342.   DDVPFX_VBICONVERT = $00010000;
  5343.  
  5344. (*
  5345.  * Indicates that scaling can be disabled for data within the
  5346.  * vertical blanking interval.
  5347.  *)
  5348.   DDVPFX_VBINOSCALE = $00020000;
  5349.  
  5350. (*
  5351.  * Indicates that the video data can ignore the left and right
  5352.  * cropping coordinates when cropping oversampled VBI data.
  5353.  *)
  5354.   DDVPFX_IGNOREVBIXCROP = $00040000;
  5355.  
  5356. (*
  5357.  * Indicates that interleaving can be disabled for data within the
  5358.  * vertical blanking interval.
  5359.  *)
  5360.   DDVPFX_VBINOINTERLEAVE     = $00080000;
  5361.  
  5362. (****************************************************************************
  5363.  *
  5364.  * VIDEOPORT TDDVideoPortInfo FLAGS
  5365.  *
  5366.  ****************************************************************************)
  5367.  
  5368. (*
  5369.  * Perform automatic flipping.   Auto-flipping is performed between
  5370.  * the overlay surface that was attached to the video port using
  5371.  * IDirectDrawVideoPort::AttachSurface and the overlay surfaces that
  5372.  * are attached to the surface via the IDirectDrawSurface::AttachSurface
  5373.  * method.  The flip order is the order in which the overlay surfaces
  5374.  * were. attached.
  5375.  *)
  5376.   DDVP_AUTOFLIP = $00000001;
  5377.  
  5378. (*
  5379.  * Perform conversion using the ddpfOutputFormat information.
  5380.  *)
  5381.   DDVP_CONVERT = $00000002;
  5382.  
  5383. (*
  5384.  * Perform cropping using the specified rectangle.
  5385.  *)
  5386.   DDVP_CROP = $00000004;
  5387.  
  5388. (*
  5389.  * Indicates that interlaced fields should be interleaved in memory.
  5390.  *)
  5391.   DDVP_INTERLEAVE = $00000008;
  5392.  
  5393. (*
  5394.  * Indicates that the data should be mirrored left to right as it's
  5395.  * written into the frame buffer.
  5396.  *)
  5397.   DDVP_MIRRORLEFTRIGHT = $00000010;
  5398.  
  5399. (*
  5400.  * Indicates that the data should be mirrored top to bottom as it's
  5401.  * written into the frame buffer.
  5402.  *)
  5403.   DDVP_MIRRORUPDOWN = $00000020;
  5404.  
  5405. (*
  5406.  * Perform pre-scaling/zooming based on the pre-scale parameters.
  5407.  *)
  5408.   DDVP_PRESCALE = $00000040;
  5409.  
  5410. (*
  5411.  * Ignore input of even fields.
  5412.  *)
  5413.   DDVP_SKIPEVENFIELDS = $00000080;
  5414.  
  5415. (*
  5416.  * Ignore input of odd fields.
  5417.  *)
  5418.   DDVP_SKIPODDFIELDS = $00000100;
  5419.  
  5420. (*
  5421.  * Drive the graphics VSYNCs using the video port VYSNCs.
  5422.  *)
  5423.   DDVP_SYNCMASTER = $00000200;
  5424.  
  5425. (*
  5426.  * The ddpfVBIOutputFormatFormat member contains data that should be used
  5427.  * to convert the data within the vertical blanking interval.
  5428.  *)
  5429.   DDVP_VBICONVERT = $00000400;
  5430.  
  5431. (*
  5432.  * Indicates that data within the vertical blanking interval
  5433.  * should not be scaled.
  5434.  *)
  5435.   DDVP_VBINOSCALE = $00000800;
  5436.  
  5437. (*
  5438.  * Indicates that these bob/weave decisions should not be
  5439.  * overriden by other interfaces.
  5440.  *)
  5441.   DDVP_OVERRIDEBOBWEAVE = $00001000;
  5442.  
  5443. (*
  5444.  * Indicates that the video data should ignore the left and right
  5445.  * cropping coordinates when cropping the VBI data.
  5446.  *)
  5447.   DDVP_IGNOREVBIXCROP = $00002000;
  5448.  
  5449. (*
  5450.  * Indicates that interleaving can be disabled for data within the
  5451.  * vertical blanking interval.
  5452.  *)
  5453.   DDVP_VBINOINTERLEAVE                  = $00004000;
  5454.  
  5455. (*
  5456.  * Indicates that the video port should use the hardware
  5457.  * de-interlacing hardware.
  5458.  *)
  5459.   DDVP_HARDWAREDEINTERLACE              = $00008000;
  5460.  
  5461. (****************************************************************************
  5462.  *
  5463.  * DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS
  5464.  *
  5465.  ****************************************************************************)
  5466.  
  5467. (*
  5468.  * Return formats for the video data
  5469.  *)
  5470.   DDVPFORMAT_VIDEO = $00000001;
  5471.  
  5472. (*
  5473.  * Return formats for the VBI data
  5474.  *)
  5475.   DDVPFORMAT_VBI = $00000002;
  5476.  
  5477. (****************************************************************************
  5478.  *
  5479.  * DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS
  5480.  *
  5481.  ****************************************************************************)
  5482.  
  5483. (*
  5484.  * Surface should receive video data (and VBI data if a surface
  5485.  * is not explicitly attached for that purpose)
  5486.  *)
  5487.   DDVPTARGET_VIDEO = $00000001;
  5488.  
  5489. (*
  5490.  * Surface should receive VBI data
  5491.  *)
  5492.   DDVPTARGET_VBI = $00000002;
  5493.  
  5494. (****************************************************************************
  5495.  *
  5496.  * DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS
  5497.  *
  5498.  ****************************************************************************)
  5499.  
  5500. (*
  5501.  * Waits until the beginning of the next VSYNC
  5502.  *)
  5503.   DDVPWAIT_BEGIN = $00000001;
  5504.  
  5505. (*
  5506.  * Waits until the end of the next/current VSYNC
  5507.  *)
  5508.   DDVPWAIT_END = $00000002;
  5509.  
  5510. (*
  5511.  * Waits until the beginning of the specified line
  5512.  *)
  5513.   DDVPWAIT_LINE = $00000003;
  5514.  
  5515. (****************************************************************************
  5516.  *
  5517.  * DIRECTDRAWVIDEOPORT FLIP FLAGS
  5518.  *
  5519.  ****************************************************************************)
  5520.  
  5521. (*
  5522.  * Flips the normal video surface
  5523.  *)
  5524.   DDVPFLIP_VIDEO = $00000001;
  5525.  
  5526. (*
  5527.  * Flips the VBI surface
  5528.  *)
  5529.   DDVPFLIP_VBI = $00000002;
  5530.  
  5531. (****************************************************************************
  5532.  *
  5533.  * DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES
  5534.  *
  5535.  ****************************************************************************)
  5536.  
  5537. (*
  5538.  * No video signal is present at the video port
  5539.  *)
  5540.   DDVPSQ_NOSIGNAL = $00000001;
  5541.  
  5542. (*
  5543.  * A valid video signal is present at the video port
  5544.  *)
  5545.   DDVPSQ_SIGNALOK = $00000002;
  5546.  
  5547. (****************************************************************************
  5548.  *
  5549.  * VIDEOPORTBANDWIDTH Flags
  5550.  *
  5551.  ****************************************************************************)
  5552.  
  5553. (*
  5554.  * The specified height/width refer to the size of the video port data
  5555.  * written into memory, after prescaling has occured.
  5556.  *)
  5557.   DDVPB_VIDEOPORT = $00000001;
  5558.  
  5559. (*
  5560.  * The specified height/width refer to the source size of the overlay.
  5561.  *)
  5562.   DDVPB_OVERLAY = $00000002;
  5563.  
  5564. (*
  5565.  * This is a query for the device to return which caps this device requires.
  5566.  *)
  5567.   DDVPB_TYPE = $00000004;
  5568.  
  5569. (****************************************************************************
  5570.  *
  5571.  * VIDEOPORTBANDWIDTH Caps
  5572.  *
  5573.  ****************************************************************************)
  5574.  
  5575. (*
  5576.  * The bandwidth for this device is dependant on the overlay source size.
  5577.  *)
  5578.   DDVPBCAPS_SOURCE = $00000001;
  5579.  
  5580. (*
  5581.  * The bandwidth for this device is dependant on the overlay destination
  5582.  * size.
  5583.  *)
  5584.   DDVPBCAPS_DESTINATION = $00000002;
  5585.  
  5586. (****************************************************************************
  5587.  *
  5588.  * DDVIDEOPORTCONTAINER CreateVideoPort flags
  5589.  *
  5590.  ****************************************************************************)
  5591.  
  5592. (*
  5593.  * The process only wants to control the VBI portion of the video stream.
  5594.  *)
  5595.   DDVPCREATE_VBIONLY                    = $00000001;
  5596.  
  5597. (*
  5598.  * The process only wants to control the non-VBI (video) portion of
  5599.  * the video stream.
  5600.  *)
  5601.   DDVPCREATE_VIDEOONLY                  = $00000002;
  5602.  
  5603. (****************************************************************************
  5604.  *
  5605.  * DDVIDEOPORTSTATUS flags
  5606.  *
  5607.  ****************************************************************************)
  5608.  
  5609. (*
  5610.  * The video port interface is only controlling the VBI portion of the
  5611.  * video stream
  5612.  *)
  5613.   DDVPSTATUS_VBIONLY                    = $00000001;
  5614.  
  5615. (*
  5616.  * The video port interface is only controlling the video portion of the
  5617.  * video stream
  5618.  *)
  5619.   DDVPSTATUS_VIDEOONLY                  = $00000002;
  5620.  
  5621.  
  5622. type
  5623. (*
  5624.  * API's
  5625.  *)
  5626.  
  5627.   TDDEnumVideoCallback = function (lpTDDVideoPortCaps: PDDVideoPortCaps;
  5628.       lpContext: Pointer) : HResult; stdcall;
  5629.  
  5630. (*
  5631.  * INTERACES FOLLOW:
  5632.  *      IDirectDrawVideoPort
  5633.  *      IVideoPort
  5634.  *)
  5635.  
  5636.  
  5637. (*
  5638.  * IDirectDrawVideoPort
  5639.  *)
  5640.   IDirectDrawVideoPort = interface (IUnknown)
  5641.     ['{B36D93E0-2B43-11CF-A2DE-00AA00B93356}']
  5642.     (*** IDirectDrawVideoPort methods ***)
  5643.     function Flip(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) : HResult; stdcall;
  5644.     function GetBandwidthInfo(var lpddpfFormat: TDDPixelFormat;
  5645.         dwWidth: DWORD; dwHeight: DWORD; dwFlags: DWORD;
  5646.         var lpBandwidth: TDDVideoPortBandWidth) : HResult; stdcall;
  5647.     function GetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
  5648.     function GetInputFormats(var lpNumFormats: DWORD; var lpFormats:
  5649.         TDDPixelFormat; dwFlags: DWORD) : HResult; stdcall;
  5650.     function GetOutputFormats(var lpInputFormat: TDDPixelFormat;
  5651.         var lpNumFormats: DWORD; lpFormats: PDDPixelFormat; dwFlags: DWORD)
  5652.         : HResult; stdcall;
  5653.     function GetFieldPolarity(var lpbVideoField: BOOL) : HResult; stdcall;
  5654.     function GetVideoLine(var lpdwLine: DWORD) : HResult; stdcall;
  5655.     function GetVideoSignalStatus(varlpdwStatus: DWORD) : HResult; stdcall;
  5656.     function SetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
  5657.     function SetTargetSurface(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) :
  5658.         HResult; stdcall;
  5659.     function StartVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
  5660.     function StopVideo: HResult; stdcall;
  5661.     function UpdateVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
  5662.     function WaitForSync(dwFlags: DWORD; dwLine: DWORD; dwTimeout: DWORD) :
  5663.         HResult; stdcall;
  5664.   end;
  5665.  
  5666. (*
  5667.  * IDirectDrawVideoPortContainer
  5668.  *)
  5669.   IDDVideoPortContainer = interface (IUnknown)
  5670.     ['{6C142760-A733-11CE-A521-0020AF0BE560}']
  5671.     (*** IDDVideoPortContainer methods ***)
  5672.     function CreateVideoPort(dwFlags: DWORD; var lpTDDVideoPortDesc:
  5673.         TDDVideoPortDesc; var lplpDDVideoPort: IDirectDrawVideoPort;
  5674.         pUnkOuter: IUnknown) : HResult; stdcall;
  5675.     function EnumVideoPorts(dwFlags: DWORD;
  5676.         lpTDDVideoPortCaps: PDDVideoPortCaps; lpContext: Pointer;
  5677.         lpEnumVideoCallback: TDDEnumVideoCallback) : HResult; stdcall;
  5678.     function GetVideoPortConnectInfo(dwPortId: DWORD; var lpNumEntries: DWORD;
  5679.         lpConnectInfo: PDDVideoPortConnect) : HResult; stdcall;
  5680.     function QueryVideoPortStatus(dwPortId: DWORD;
  5681.         var lpVPStatus: TDDVideoPortStatus) : HResult; stdcall;
  5682.   end;
  5683.  
  5684.   IID_IDDVideoPortContainer = IDDVideoPortContainer;
  5685.   IID_IDirectDrawVideoPort = IDirectDrawVideoPort;
  5686.  
  5687.  
  5688. //Direct3D file
  5689. (*==========================================================================;
  5690.  *
  5691.  *  Copyright (C) 1995-1998 Microsoft Corporation.  All Rights Reserved.
  5692.  *
  5693.  *  Files:   d3dtypes.h d3dcaps.h d3d.h
  5694.  *
  5695.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  5696.  *
  5697.  *  Modyfied: 26-Jun-2000
  5698.  *
  5699.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  5700.  *  E-Mail: DelphiDirectX@next-reality.com
  5701.  *
  5702.  ***************************************************************************)
  5703.  
  5704. (* TD3DValue is the fundamental Direct3D fractional data type *)
  5705.  
  5706. type
  5707.   TRefClsID = TGUID;
  5708.  
  5709. type
  5710.   TD3DValue = Single;
  5711.   TD3DFixed = LongInt;
  5712.   float = TD3DValue;
  5713.   PD3DColor = ^TD3DColor;
  5714.   TD3DColor = DWORD;
  5715.  
  5716. function D3DVal(val: variant) : float;
  5717. function D3DDivide(a,b: double) : float;
  5718. function D3DMultiply(a,b: double) : float;
  5719.  
  5720. (*
  5721.  * Format of CI colors is
  5722.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5723.  *  |    alpha      |         color index           |   fraction    |
  5724.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5725.  *)
  5726.  
  5727. // #define CI_GETALPHA(ci)    ((ci) >> 24)
  5728. function CI_GETALPHA(ci: DWORD) : DWORD;
  5729.  
  5730. // #define CI_GETINDEX(ci)    (((ci) >> 8) & 0xffff)
  5731. function CI_GETINDEX(ci: DWORD) : DWORD;
  5732.  
  5733. // #define CI_GETFRACTION(ci) ((ci) & 0xff)
  5734. function CI_GETFRACTION(ci: DWORD) : DWORD;
  5735.  
  5736. // #define CI_ROUNDINDEX(ci)  CI_GETINDEX((ci) + 0x80)
  5737. function CI_ROUNDINDEX(ci: DWORD) : DWORD;
  5738.  
  5739. // #define CI_MASKALPHA(ci)   ((ci) & 0xffffff)
  5740. function CI_MASKALPHA(ci: DWORD) : DWORD;
  5741.  
  5742. // #define CI_MAKE(a, i, f)    (((a) << 24) | ((i) << 8) | (f))
  5743. function CI_MAKE(a,i,f: DWORD) : DWORD;
  5744.  
  5745. (*
  5746.  * Format of RGBA colors is
  5747.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5748.  *  |    alpha      |      red      |     green     |     blue      |
  5749.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5750.  *)
  5751.  
  5752. // #define RGBA_GETALPHA(rgb)      ((rgb) >> 24)
  5753. function RGBA_GETALPHA(rgb: TD3DColor) : DWORD;
  5754.  
  5755. // #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
  5756. function RGBA_GETRED(rgb: TD3DColor) : DWORD;
  5757.  
  5758. // #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
  5759. function RGBA_GETGREEN(rgb: TD3DColor) : DWORD;
  5760.  
  5761. // #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
  5762. function RGBA_GETBLUE(rgb: TD3DColor) : DWORD;
  5763.  
  5764. // #define RGBA_MAKE(r, g, b, a)   ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
  5765. function RGBA_MAKE(r, g, b, a: DWORD) : TD3DColor;
  5766.  
  5767. (* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs
  5768.  * The float values must be in the range 0..1
  5769.  *)
  5770.  
  5771. // #define D3DRGB(r, g, b) \
  5772. //     (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
  5773. function D3DRGB(r, g, b: float) : TD3DColor;
  5774.  
  5775. // #define D3DRGBA(r, g, b, a) \
  5776. //     (  (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
  5777. //     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) \
  5778. //    )
  5779. function D3DRGBA(r, g, b, a: float) : TD3DColor;
  5780.  
  5781. (*
  5782.  * Format of RGB colors is
  5783.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5784.  *  |    ignored    |      red      |     green     |     blue      |
  5785.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5786.  *)
  5787.  
  5788. // #define RGB_GETRED(rgb)         (((rgb) >> 16) & 0xff)
  5789. function RGB_GETRED(rgb: TD3DColor) : DWORD;
  5790.  
  5791. // #define RGB_GETGREEN(rgb)       (((rgb) >> 8) & 0xff)
  5792. function RGB_GETGREEN(rgb: TD3DColor) : DWORD;
  5793.  
  5794. // #define RGB_GETBLUE(rgb)        ((rgb) & 0xff)
  5795. function RGB_GETBLUE(rgb: TD3DColor) : DWORD;
  5796.  
  5797. // #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
  5798. function RGBA_SETALPHA(rgba: TD3DColor; x: DWORD) : TD3DColor;
  5799.  
  5800. // #define RGB_MAKE(r, g, b)       ((TD3DColor) (((r) << 16) | ((g) << 8) | (b)))
  5801. function RGB_MAKE(r, g, b: DWORD) : TD3DColor;
  5802.  
  5803. // #define RGBA_TORGB(rgba)       ((TD3DColor) ((rgba) & 0xffffff))
  5804. function RGBA_TORGB(rgba: TD3DColor) : TD3DColor;
  5805.  
  5806. // #define RGB_TORGBA(rgb)        ((TD3DColor) ((rgb) | 0xff000000))
  5807. function RGB_TORGBA(rgb: TD3DColor) : TD3DColor;
  5808.  
  5809. (*
  5810.  * Flags for Enumerate functions
  5811.  *)
  5812. const
  5813.  
  5814. (*
  5815.  * Stop the enumeration
  5816.  *)
  5817.  
  5818.   D3DENUMRET_CANCEL                        = DDENUMRET_CANCEL;
  5819.  
  5820. (*
  5821.  * Continue the enumeration
  5822.  *)
  5823.  
  5824.   D3DENUMRET_OK                            = DDENUMRET_OK;
  5825.  
  5826. type
  5827.   TD3DValidateCallback = function (lpUserArg: Pointer;
  5828.       dwOffset: DWORD): HResult; stdcall;
  5829.   TD3DEnumTextureFormatsCallback = function (var lpDdsd: TDDSurfaceDesc;
  5830.       lpContext: Pointer): HResult; stdcall;
  5831.   TD3DEnumPixelFormatsCallback = function (var lpDDPixFmt: TDDPixelFormat;
  5832.       lpContext: Pointer): HResult; stdcall;
  5833.  
  5834.  
  5835.   PD3DMaterialHandle = ^TD3DMaterialHandle;
  5836.   TD3DMaterialHandle = DWORD;
  5837.  
  5838.   PD3DTextureHandle = ^TD3DTextureHandle;
  5839.   TD3DTextureHandle = DWORD;
  5840.  
  5841.   PD3DMatrixHandle = ^TD3DMatrixHandle;
  5842.   TD3DMatrixHandle = DWORD;
  5843.  
  5844.   PD3DColorValue = ^TD3DColorValue;
  5845.   TD3DColorValue = packed record
  5846.     case Integer of
  5847.     0: (
  5848.       r: TD3DValue;
  5849.       g: TD3DValue;
  5850.       b: TD3DValue;
  5851.       a: TD3DValue;
  5852.      );
  5853.     1: (
  5854.       dvR: TD3DValue;
  5855.       dvG: TD3DValue;
  5856.       dvB: TD3DValue;
  5857.       dvA: TD3DValue;
  5858.      );
  5859.   end;
  5860.  
  5861.   PD3DRect = ^TD3DRect;
  5862.   TD3DRect = packed record
  5863.     case Integer of
  5864.     0: (
  5865.       x1: LongInt;
  5866.       y1: LongInt;
  5867.       x2: LongInt;
  5868.       y2: LongInt;
  5869.      );
  5870.     1: (
  5871.       lX1: LongInt;
  5872.       lY1: LongInt;
  5873.       lX2: LongInt;
  5874.       lY2: LongInt;
  5875.      );
  5876.      2: (
  5877.        a: array[0..3] of LongInt;
  5878.      );
  5879.   end;
  5880.  
  5881.   PD3DVector = ^TD3DVector;
  5882.   TD3DVector = packed record
  5883.     case Integer of
  5884.     0: (
  5885.       x: TD3DValue;
  5886.       y: TD3DValue;
  5887.       z: TD3DValue;
  5888.      );
  5889.     1: (
  5890.       dvX: TD3DValue;
  5891.       dvY: TD3DValue;
  5892.       dvZ: TD3DValue;
  5893.      );
  5894.   end;
  5895.  
  5896. (******************************************************************
  5897.  *                                                                *
  5898.  *   D3DVec.inl                                                   *
  5899.  *                                                                *
  5900.  *   Float-valued 3D vector class for Direct3D.                   *
  5901.  *                                                                *
  5902.  *   Copyright (c) 1996-1998 Microsoft Corp. All rights reserved. *
  5903.  *                                                                *
  5904.  ******************************************************************)
  5905.  
  5906.     // Addition and subtraction
  5907.   function VectorAdd(const v1, v2: TD3DVector) : TD3DVector;
  5908.   function VectorSub(const v1, v2: TD3DVector) : TD3DVector;
  5909.     // Scalar multiplication and division
  5910.   function VectorMulS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
  5911.   function VectorDivS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
  5912.     // Memberwise multiplication and division
  5913.   function VectorMul(const v1, v2: TD3DVector) : TD3DVector;
  5914.   function VectorDiv(const v1, v2: TD3DVector) : TD3DVector;
  5915.     // Vector dominance
  5916.   function VectorSmaller(v1, v2: TD3DVector) : boolean;
  5917.   function VectorSmallerEquel(v1, v2: TD3DVector) : boolean;
  5918.     // Bitwise equality
  5919.   function VectorEquel(v1, v2: TD3DVector) : boolean;
  5920.     // Length-related functions
  5921.   function VectorSquareMagnitude(v: TD3DVector) : TD3DValue;
  5922.   function VectorMagnitude(v: TD3DVector) : TD3DValue;
  5923.     // Returns vector with same direction and unit length
  5924.   function VectorNormalize(const v: TD3DVector) : TD3DVector;
  5925.     // Return min/max component of the input vector
  5926.   function VectorMin(v: TD3DVector) : TD3DValue;
  5927.   function VectorMax(v: TD3DVector) : TD3DValue;
  5928.     // Return memberwise min/max of input vectors
  5929.   function VectorMinimize(const v1, v2: TD3DVector) : TD3DVector;
  5930.   function VectorMaximize(const v1, v2: TD3DVector) : TD3DVector;
  5931.     // Dot and cross product
  5932.   function VectorDotProduct(v1, v2: TD3DVector) : TD3DValue;
  5933.   function VectorCrossProduct(const v1, v2: TD3DVector) : TD3DVector;
  5934.  
  5935. type
  5936. (*
  5937.  * Vertex data types supported in an ExecuteBuffer.
  5938.  *)
  5939.  
  5940. (*
  5941.  * Homogeneous vertices
  5942.  *)
  5943.  
  5944.   PD3DHVertex = ^TD3DHVertex;
  5945.   TD3DHVertex = packed record
  5946.     dwFlags: DWORD;        (* Homogeneous clipping flags *)
  5947.     case Integer of
  5948.     0: (
  5949.       hx: TD3DValue;
  5950.       hy: TD3DValue;
  5951.       hz: TD3DValue;
  5952.      );
  5953.     1: (
  5954.       dvHX: TD3DValue;
  5955.       dvHY: TD3DValue;
  5956.       dvHZ: TD3DValue;
  5957.      );
  5958.   end;
  5959.  
  5960. (*
  5961.  * Transformed/lit vertices
  5962.  *)
  5963.  
  5964.   PD3DTLVertex = ^TD3DTLVertex;
  5965.   TD3DTLVertex = packed record
  5966.     case Integer of
  5967.     0: (
  5968.       sx: TD3DValue;             (* Screen coordinates *)
  5969.       sy: TD3DValue;
  5970.       sz: TD3DValue;
  5971.       rhw: TD3DValue;            (* Reciprocal of homogeneous w *)
  5972.       color: TD3DColor;          (* Vertex color *)
  5973.       specular: TD3DColor;       (* Specular component of vertex *)
  5974.       tu: TD3DValue;             (* Texture coordinates *)
  5975.       tv: TD3DValue;
  5976.      );
  5977.     1: (
  5978.       dvSX: TD3DValue;
  5979.       dvSY: TD3DValue;
  5980.       dvSZ: TD3DValue;
  5981.       dvRHW: TD3DValue;
  5982.       dcColor: TD3DColor;
  5983.       dcSpecular: TD3DColor;
  5984.       dvTU: TD3DValue;
  5985.       dvTV: TD3DValue;
  5986.      );
  5987.   end;
  5988.  
  5989. (*
  5990.  * Untransformed/lit vertices
  5991.  *)
  5992.  
  5993.   PD3DLVertex = ^TD3DLVertex;
  5994.   TD3DLVertex = packed record
  5995.     case Integer of
  5996.     0: (
  5997.       x: TD3DValue;             (* Homogeneous coordinates *)
  5998.       y: TD3DValue;
  5999.       z: TD3DValue;
  6000.       dwReserved: DWORD;
  6001.       color: TD3DColor;         (* Vertex color *)
  6002.       specular: TD3DColor;      (* Specular component of vertex *)
  6003.       tu: TD3DValue;            (* Texture coordinates *)
  6004.       tv: TD3DValue;
  6005.      );
  6006.     1: (
  6007.       dvX: TD3DValue;
  6008.       dvY: TD3DValue;
  6009.       dvZ: TD3DValue;
  6010.       UNIONFILLER1d: DWORD;
  6011.       dcColor: TD3DColor;
  6012.       dcSpecular: TD3DColor;
  6013.       dvTU: TD3DValue;
  6014.       dvTV: TD3DValue;
  6015.      );
  6016.   end;
  6017.  
  6018. (*
  6019.  * Untransformed/unlit vertices
  6020.  *)
  6021.  
  6022.   PD3DVertex = ^TD3DVertex;
  6023.   TD3DVertex = packed record
  6024.     case Integer of
  6025.     0: (
  6026.       x: TD3DValue;             (* Homogeneous coordinates *)
  6027.       y: TD3DValue;
  6028.       z: TD3DValue;
  6029.       nx: TD3DValue;            (* Normal *)
  6030.       ny: TD3DValue;
  6031.       nz: TD3DValue;
  6032.       tu: TD3DValue;            (* Texture coordinates *)
  6033.       tv: TD3DValue;
  6034.      );
  6035.     1: (
  6036.       dvX: TD3DValue;
  6037.       dvY: TD3DValue;
  6038.       dvZ: TD3DValue;
  6039.       dvNX: TD3DValue;
  6040.       dvNY: TD3DValue;
  6041.       dvNZ: TD3DValue;
  6042.       dvTU: TD3DValue;
  6043.       dvTV: TD3DValue;
  6044.      );
  6045.   end;
  6046.  
  6047. (*
  6048.  * Matrix, viewport, and tranformation structures and definitions.
  6049.  *)
  6050.  
  6051.   PD3DMatrix = ^TD3DMatrix;
  6052.   TD3DMatrix = packed record
  6053.     case integer of
  6054.       0 : (_11, _12, _13, _14: TD3DValue;
  6055.            _21, _22, _23, _24: TD3DValue;
  6056.            _31, _32, _33, _34: TD3DValue;
  6057.            _41, _42, _43, _44: TD3DValue);
  6058.       1 : (m : array [0..3, 0..3] of TD3DValue);
  6059.   end;
  6060.  
  6061.   PD3DViewport = ^TD3DViewport;
  6062.   TD3DViewport = packed record
  6063.     dwSize: DWORD;
  6064.     dwX: DWORD;
  6065.     dwY: DWORD;                (* Top left *)
  6066.     dwWidth: DWORD;
  6067.     dwHeight: DWORD;           (* Dimensions *)
  6068.     dvScaleX: TD3DValue;       (* Scale homogeneous to screen *)
  6069.     dvScaleY: TD3DValue;       (* Scale homogeneous to screen *)
  6070.     dvMaxX: TD3DValue;         (* Min/max homogeneous x coord *)
  6071.     dvMaxY: TD3DValue;         (* Min/max homogeneous y coord *)
  6072.     dvMinZ: TD3DValue;
  6073.     dvMaxZ: TD3DValue;         (* Min/max homogeneous z coord *)
  6074.   end;
  6075.  
  6076.   PD3DViewport2 = ^TD3DViewport2;
  6077.   TD3DViewport2 = packed record
  6078.     dwSize: DWORD;
  6079.     dwX: DWORD;
  6080.     dwY: DWORD;                (* Viewport Top left *)
  6081.     dwWidth: DWORD;
  6082.     dwHeight: DWORD;           (* Viewport Dimensions *)
  6083.     dvClipX: TD3DValue;        (* Top left of clip volume *)
  6084.     dvClipY: TD3DValue;
  6085.     dvClipWidth: TD3DValue;    (* Clip Volume Dimensions *)
  6086.     dvClipHeight: TD3DValue;
  6087.     dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
  6088.     dvMaxZ: TD3DValue;
  6089.   end;
  6090.  
  6091.   PD3DViewport7 = ^TD3DViewport7;
  6092.   TD3DViewport7 = packed record
  6093.     dwX: DWORD;
  6094.     dwY: DWORD;                (* Viewport Top left *)
  6095.     dwWidth: DWORD;
  6096.     dwHeight: DWORD;           (* Viewport Dimensions *)
  6097.     dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
  6098.     dvMaxZ: TD3DValue;
  6099.   end;
  6100.  
  6101. (*
  6102.  * Values for clip fields.
  6103.  *)
  6104.  
  6105. const
  6106. // Max number of user clipping planes, supported in D3D.
  6107.   D3DMAXUSERCLIPPLANES  = 32;
  6108.  
  6109. // These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE
  6110. //
  6111.   D3DCLIPPLANE0 = (1 shl 0);
  6112.   D3DCLIPPLANE1 = (1 shl 1);
  6113.   D3DCLIPPLANE2 = (1 shl 2);
  6114.   D3DCLIPPLANE3 = (1 shl 3);
  6115.   D3DCLIPPLANE4 = (1 shl 4);
  6116.   D3DCLIPPLANE5 = (1 shl 5);
  6117.  
  6118. const
  6119.   D3DCLIP_LEFT                            = $00000001;
  6120.   D3DCLIP_RIGHT                           = $00000002;
  6121.   D3DCLIP_TOP                             = $00000004;
  6122.   D3DCLIP_BOTTOM                          = $00000008;
  6123.   D3DCLIP_FRONT                           = $00000010;
  6124.   D3DCLIP_BACK                            = $00000020;
  6125.   D3DCLIP_GEN0                            = $00000040;
  6126.   D3DCLIP_GEN1                            = $00000080;
  6127.   D3DCLIP_GEN2                            = $00000100;
  6128.   D3DCLIP_GEN3                            = $00000200;
  6129.   D3DCLIP_GEN4                            = $00000400;
  6130.   D3DCLIP_GEN5                            = $00000800;
  6131.  
  6132. (*
  6133.  * Values for d3d status.
  6134.  *)
  6135.  
  6136.   D3DSTATUS_CLIPUNIONLEFT                 = D3DCLIP_LEFT;
  6137.   D3DSTATUS_CLIPUNIONRIGHT                = D3DCLIP_RIGHT;
  6138.   D3DSTATUS_CLIPUNIONTOP                  = D3DCLIP_TOP;
  6139.   D3DSTATUS_CLIPUNIONBOTTOM               = D3DCLIP_BOTTOM;
  6140.   D3DSTATUS_CLIPUNIONFRONT                = D3DCLIP_FRONT;
  6141.   D3DSTATUS_CLIPUNIONBACK                 = D3DCLIP_BACK;
  6142.   D3DSTATUS_CLIPUNIONGEN0                 = D3DCLIP_GEN0;
  6143.   D3DSTATUS_CLIPUNIONGEN1                 = D3DCLIP_GEN1;
  6144.   D3DSTATUS_CLIPUNIONGEN2                 = D3DCLIP_GEN2;
  6145.   D3DSTATUS_CLIPUNIONGEN3                 = D3DCLIP_GEN3;
  6146.   D3DSTATUS_CLIPUNIONGEN4                 = D3DCLIP_GEN4;
  6147.   D3DSTATUS_CLIPUNIONGEN5                 = D3DCLIP_GEN5;
  6148.  
  6149.   D3DSTATUS_CLIPINTERSECTIONLEFT          = $00001000;
  6150.   D3DSTATUS_CLIPINTERSECTIONRIGHT         = $00002000;
  6151.   D3DSTATUS_CLIPINTERSECTIONTOP           = $00004000;
  6152.   D3DSTATUS_CLIPINTERSECTIONBOTTOM        = $00008000;
  6153.   D3DSTATUS_CLIPINTERSECTIONFRONT         = $00010000;
  6154.   D3DSTATUS_CLIPINTERSECTIONBACK          = $00020000;
  6155.   D3DSTATUS_CLIPINTERSECTIONGEN0          = $00040000;
  6156.   D3DSTATUS_CLIPINTERSECTIONGEN1          = $00080000;
  6157.   D3DSTATUS_CLIPINTERSECTIONGEN2          = $00100000;
  6158.   D3DSTATUS_CLIPINTERSECTIONGEN3          = $00200000;
  6159.   D3DSTATUS_CLIPINTERSECTIONGEN4          = $00400000;
  6160.   D3DSTATUS_CLIPINTERSECTIONGEN5          = $00800000;
  6161.   D3DSTATUS_ZNOTVISIBLE                   = $01000000;
  6162. (* Do not use 0x80000000 for any status flags in future as it is reserved *)
  6163.  
  6164.   D3DSTATUS_CLIPUNIONALL = (
  6165.             D3DSTATUS_CLIPUNIONLEFT or
  6166.             D3DSTATUS_CLIPUNIONRIGHT or
  6167.             D3DSTATUS_CLIPUNIONTOP or
  6168.             D3DSTATUS_CLIPUNIONBOTTOM or
  6169.             D3DSTATUS_CLIPUNIONFRONT or
  6170.             D3DSTATUS_CLIPUNIONBACK or
  6171.             D3DSTATUS_CLIPUNIONGEN0 or
  6172.             D3DSTATUS_CLIPUNIONGEN1 or
  6173.             D3DSTATUS_CLIPUNIONGEN2 or
  6174.             D3DSTATUS_CLIPUNIONGEN3 or
  6175.             D3DSTATUS_CLIPUNIONGEN4 or
  6176.             D3DSTATUS_CLIPUNIONGEN5);
  6177.  
  6178.   D3DSTATUS_CLIPINTERSECTIONALL = (
  6179.             D3DSTATUS_CLIPINTERSECTIONLEFT or
  6180.             D3DSTATUS_CLIPINTERSECTIONRIGHT or
  6181.             D3DSTATUS_CLIPINTERSECTIONTOP or
  6182.             D3DSTATUS_CLIPINTERSECTIONBOTTOM or
  6183.             D3DSTATUS_CLIPINTERSECTIONFRONT or
  6184.             D3DSTATUS_CLIPINTERSECTIONBACK or
  6185.             D3DSTATUS_CLIPINTERSECTIONGEN0 or
  6186.             D3DSTATUS_CLIPINTERSECTIONGEN1 or
  6187.             D3DSTATUS_CLIPINTERSECTIONGEN2 or
  6188.             D3DSTATUS_CLIPINTERSECTIONGEN3 or
  6189.             D3DSTATUS_CLIPINTERSECTIONGEN4 or
  6190.             D3DSTATUS_CLIPINTERSECTIONGEN5);
  6191.  
  6192.   D3DSTATUS_DEFAULT = (
  6193.             D3DSTATUS_CLIPINTERSECTIONALL or
  6194.             D3DSTATUS_ZNOTVISIBLE);
  6195.  
  6196. (*
  6197.  * Options for direct transform calls
  6198.  *)
  6199.  
  6200.   D3DTRANSFORM_CLIPPED       = $00000001;
  6201.   D3DTRANSFORM_UNCLIPPED     = $00000002;
  6202.  
  6203. type
  6204.   PD3DTransformData = ^TD3DTransformData;
  6205.   TD3DTransformData = packed record
  6206.     dwSize: DWORD;
  6207.     lpIn: Pointer;             (* Input vertices *)
  6208.     dwInSize: DWORD;           (* Stride of input vertices *)
  6209.     lpOut: Pointer;            (* Output vertices *)
  6210.     dwOutSize: DWORD;          (* Stride of output vertices *)
  6211.     lpHOut: ^TD3DHVertex;       (* Output homogeneous vertices *)
  6212.     dwClip: DWORD;             (* Clipping hint *)
  6213.     dwClipIntersection: DWORD;
  6214.     dwClipUnion: DWORD;        (* Union of all clip flags *)
  6215.     drExtent: TD3DRect;         (* Extent of transformed vertices *)
  6216.   end;
  6217.  
  6218. (*
  6219.  * Structure defining position and direction properties for lighting.
  6220.  *)
  6221.  
  6222.   PD3DLightingElement = ^TD3DLightingElement;
  6223.   TD3DLightingElement = packed record
  6224.     dvPosition: TD3DVector;           (* Lightable point in model space *)
  6225.     dvNormal: TD3DVector;             (* Normalised unit vector *)
  6226.   end;
  6227.  
  6228. (*
  6229.  * Structure defining material properties for lighting.
  6230.  *)
  6231.  
  6232.   PD3DMaterial = ^TD3DMaterial;
  6233.   TD3DMaterial = packed record
  6234.     dwSize: DWORD;
  6235.     case Integer of
  6236.     0: (
  6237.       diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
  6238.       ambient: TD3DColorValue;        (* Ambient color RGB *)
  6239.       specular: TD3DColorValue;       (* Specular 'shininess' *)
  6240.       emissive: TD3DColorValue;       (* Emissive color RGB *)
  6241.       power: TD3DValue;               (* Sharpness if specular highlight *)
  6242.       hTexture: TD3DTextureHandle;    (* Handle to texture map *)
  6243.       dwRampSize: DWORD;
  6244.      );
  6245.     1: (
  6246.       dcvDiffuse: TD3DColorValue;
  6247.       dcvAmbient: TD3DColorValue;
  6248.       dcvSpecular: TD3DColorValue;
  6249.       dcvEmissive: TD3DColorValue;
  6250.       dvPower: TD3DValue;
  6251.      );
  6252.   end;
  6253.  
  6254.   PD3DMaterial7 = ^TD3DMaterial7;
  6255.   TD3DMaterial7 = packed record
  6256.     case Integer of
  6257.     0: (
  6258.       diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
  6259.       ambient: TD3DColorValue;        (* Ambient color RGB *)
  6260.       specular: TD3DColorValue;       (* Specular 'shininess' *)
  6261.       emissive: TD3DColorValue;       (* Emissive color RGB *)
  6262.       power: TD3DValue;               (* Sharpness if specular highlight *)
  6263.      );
  6264.     1: (
  6265.       dcvDiffuse: TD3DColorValue;
  6266.       dcvAmbient: TD3DColorValue;
  6267.       dcvSpecular: TD3DColorValue;
  6268.       dcvEmissive: TD3DColorValue;
  6269.       dvPower: TD3DValue;
  6270.      );
  6271.   end;
  6272.  
  6273.   PD3DLightType = ^TD3DLightType;
  6274.   TD3DLightType = (
  6275.     D3DLIGHT_INVALID_0,
  6276.     D3DLIGHT_POINT,
  6277.     D3DLIGHT_SPOT,
  6278.     D3DLIGHT_DIRECTIONAL,
  6279. // Note: The following light type (D3DLIGHT_PARALLELPOINT)
  6280. // is no longer supported from D3D for DX7 onwards.
  6281.     D3DLIGHT_PARALLELPOINT,
  6282.     D3DLIGHT_GLSPOT);
  6283.  
  6284. (*
  6285.  * Structure defining a light source and its properties.
  6286.  *)
  6287.  
  6288.   PD3DLight = ^TD3DLight;
  6289.   TD3DLight = packed record
  6290.     dwSize: DWORD;
  6291.     dltType: TD3DLightType;     (* Type of light source *)
  6292.     dcvColor: TD3DColorValue;   (* Color of light *)
  6293.     dvPosition: TD3DVector;     (* Position in world space *)
  6294.     dvDirection: TD3DVector;    (* Direction in world space *)
  6295.     dvRange: TD3DValue;         (* Cutoff range *)
  6296.     dvFalloff: TD3DValue;       (* Falloff *)
  6297.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6298.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6299.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6300.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6301.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6302.   end;
  6303.  
  6304.   PD3DLight7 = ^TD3DLight7;
  6305.   TD3DLight7 = packed record
  6306.     dltType: TD3DLightType;     (* Type of light source *)
  6307.     dcvDiffuse: TD3DColorValue; (* Diffuse color of light *)
  6308.     dcvSpecular: TD3DColorValue;(* Specular color of light *)
  6309.     dcvAmbient: TD3DColorValue; (* Ambient color of light *)
  6310.     dvPosition: TD3DVector;     (* Position in world space *)
  6311.     dvDirection: TD3DVector;    (* Direction in world space *)
  6312.     dvRange: TD3DValue;         (* Cutoff range *)
  6313.     dvFalloff: TD3DValue;       (* Falloff *)
  6314.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6315.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6316.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6317.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6318.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6319.   end;
  6320.  
  6321. (*
  6322.  * Structure defining a light source and its properties.
  6323.  *)
  6324.  
  6325. (* flags bits *)
  6326. const
  6327.   D3DLIGHT_ACTIVE                       = $00000001;
  6328.   D3DLIGHT_NO_SPECULAR  = $00000002;
  6329.   D3DLIGHT_ALL = D3DLIGHT_ACTIVE or D3DLIGHT_ACTIVE;
  6330.  
  6331. (* maximum valid light range *)
  6332.   D3DLIGHT_RANGE_MAX            = 1.8439088915e+18; //sqrt(FLT_MAX);
  6333.  
  6334. type
  6335.   PD3DLight2 = ^TD3DLight2;
  6336.   TD3DLight2 = packed record
  6337.     dwSize: DWORD;
  6338.     dltType: TD3DLightType;     (* Type of light source *)
  6339.     dcvColor: TD3DColorValue;   (* Color of light *)
  6340.     dvPosition: TD3DVector;     (* Position in world space *)
  6341.     dvDirection: TD3DVector;    (* Direction in world space *)
  6342.     dvRange: TD3DValue;         (* Cutoff range *)
  6343.     dvFalloff: TD3DValue;       (* Falloff *)
  6344.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6345.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6346.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6347.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6348.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6349.     dwFlags: DWORD;
  6350.   end;
  6351.  
  6352.   PD3DLightData = ^TD3DLightData;
  6353.   TD3DLightData = packed record
  6354.     dwSize: DWORD;
  6355.     lpIn: ^TD3DLightingElement;   (* Input positions and normals *)
  6356.     dwInSize: DWORD;             (* Stride of input elements *)
  6357.     lpOut: ^TD3DTLVertex;         (* Output colors *)
  6358.     dwOutSize: DWORD;            (* Stride of output colors *)
  6359.   end;
  6360.  
  6361. (*
  6362.  * Before DX5, these values were in an enum called
  6363.  * TD3DColorModel. This was not correct, since they are
  6364.  * bit flags. A driver can surface either or both flags
  6365.  * in the dcmColorModel member of D3DDEVICEDESC.
  6366.  *)
  6367.  
  6368. type
  6369.   TD3DColorModel = DWORD;
  6370.  
  6371. const
  6372.   D3DCOLOR_MONO = 1;
  6373.   D3DCOLOR_RGB  = 2;
  6374.  
  6375. (*
  6376.  * Options for clearing
  6377.  *)
  6378.  
  6379. const
  6380.   D3DCLEAR_TARGET            = $00000001; (* Clear target surface *)
  6381.   D3DCLEAR_ZBUFFER           = $00000002; (* Clear target z buffer *)
  6382.   D3DCLEAR_STENCIL           = $00000004; (* Clear stencil planes *)
  6383.  
  6384. (*
  6385.  * Execute buffers are allocated via Direct3D.  These buffers may then
  6386.  * be filled by the application with instructions to execute along with
  6387.  * vertex data.
  6388.  *)
  6389.  
  6390. (*
  6391.  * Supported op codes for execute instructions.
  6392.  *)
  6393.  
  6394. type
  6395.   PD3DOpcode = ^TD3DOpcode;
  6396.   TD3DOpcode = (
  6397.     D3DOP_INVALID_0,
  6398.     D3DOP_POINT,
  6399.     D3DOP_LINE,
  6400.     D3DOP_TRIANGLE,
  6401.     D3DOP_MATRIXLOAD,
  6402.     D3DOP_MATRIXMULTIPLY,
  6403.     D3DOP_STATETRANSFORM,
  6404.     D3DOP_STATELIGHT,
  6405.     D3DOP_STATERENDER,
  6406.     D3DOP_PROCESSVERTICES,
  6407.     D3DOP_TEXTURELOAD,
  6408.     D3DOP_EXIT,
  6409.     D3DOP_BRANCHFORWARD,
  6410.     D3DOP_SPAN,
  6411.     D3DOP_SETSTATUS);
  6412.  
  6413.   PD3DInstruction = ^TD3DInstruction;
  6414.   TD3DInstruction = packed record
  6415.     bOpcode: BYTE;   (* Instruction opcode *)
  6416.     bSize: BYTE;     (* Size of each instruction data unit *)
  6417.     wCount: WORD;    (* Count of instruction data units to follow *)
  6418.   end;
  6419.  
  6420. (*
  6421.  * Structure for texture loads
  6422.  *)
  6423.  
  6424.   PD3DTextureLoad = ^TD3DTextureLoad;
  6425.   TD3DTextureLoad = packed record
  6426.     hDestTexture: TD3DTextureHandle;
  6427.     hSrcTexture: TD3DTextureHandle;
  6428.   end;
  6429.  
  6430. (*
  6431.  * Structure for picking
  6432.  *)
  6433.  
  6434.   PD3DPickRecord = ^TD3DPickRecord;
  6435.   TD3DPickRecord = packed record
  6436.     bOpcode: BYTE;
  6437.     bPad: BYTE;
  6438.     dwOffset: DWORD;
  6439.     dvZ: TD3DValue;
  6440.   end;
  6441.  
  6442. (*
  6443.  * The following defines the rendering states which can be set in the
  6444.  * execute buffer.
  6445.  *)
  6446.  
  6447.   PD3DShadeMode = ^TD3DShadeMode;
  6448.   TD3DShadeMode = (
  6449.     D3DSHADE_INVALID_0,
  6450.     D3DSHADE_FLAT,
  6451.     D3DSHADE_GOURAUD,
  6452.     D3DSHADE_PHONG);
  6453.  
  6454.   PD3DFillMode = ^TD3DFillMode;
  6455.   TD3DFillMode = (
  6456.     D3DFILL_INVALID_0,
  6457.     D3DFILL_POINT,
  6458.     D3DFILL_WIREFRAME,
  6459.     D3DFILL_SOLID);
  6460.  
  6461.   PD3DLinePattern = ^TD3DLinePattern;
  6462.   TD3DLinePattern = packed record
  6463.     wRepeatFactor: WORD;
  6464.     wLinePattern: WORD;
  6465.   end;
  6466.  
  6467.   PD3DTextureFilter = ^TD3DTextureFilter;
  6468.   TD3DTextureFilter = (
  6469.     D3DFILTER_INVALID_0,
  6470.     D3DFILTER_NEAREST,
  6471.     D3DFILTER_LINEAR,
  6472.     D3DFILTER_MIPNEAREST,
  6473.     D3DFILTER_MIPLINEAR,
  6474.     D3DFILTER_LINEARMIPNEAREST,
  6475.     D3DFILTER_LINEARMIPLINEAR);
  6476.  
  6477.   PD3DBlend = ^TD3DBlend;
  6478.   TD3DBlend = (
  6479.     D3DBLEND_INVALID_0,
  6480.     D3DBLEND_ZERO,
  6481.     D3DBLEND_ONE,
  6482.     D3DBLEND_SRCCOLOR,
  6483.     D3DBLEND_INVSRCCOLOR,
  6484.     D3DBLEND_SRCALPHA,
  6485.     D3DBLEND_INVSRCALPHA,
  6486.     D3DBLEND_DESTALPHA,
  6487.     D3DBLEND_INVDESTALPHA,
  6488.     D3DBLEND_DESTCOLOR,
  6489.     D3DBLEND_INVDESTCOLOR,
  6490.     D3DBLEND_SRCALPHASAT,
  6491.     D3DBLEND_BOTHSRCALPHA,
  6492.     D3DBLEND_BOTHINVSRCALPHA);
  6493.  
  6494.   PD3DTextureBlend = ^TD3DTextureBlend;
  6495.   TD3DTextureBlend = (
  6496.     D3DTBLEND_INVALID_0,
  6497.     D3DTBLEND_DECAL,
  6498.     D3DTBLEND_MODULATE,
  6499.     D3DTBLEND_DECALALPHA,
  6500.     D3DTBLEND_MODULATEALPHA,
  6501.     D3DTBLEND_DECALMASK,
  6502.     D3DTBLEND_MODULATEMASK,
  6503.     D3DTBLEND_COPY,
  6504.     D3DTBLEND_ADD);
  6505.  
  6506.   PD3DTextureAddress = ^TD3DTextureAddress;
  6507.   TD3DTextureAddress = (
  6508.     D3DTADDRESS_INVALID_0,
  6509.     D3DTADDRESS_WRAP,
  6510.     D3DTADDRESS_MIRROR,
  6511.     D3DTADDRESS_CLAMP,
  6512.     D3DTADDRESS_BORDER);
  6513.  
  6514.   PD3DCull = ^TD3DCull;
  6515.   TD3DCull = (
  6516.     D3DCULL_INVALID_0,
  6517.     D3DCULL_NONE,
  6518.     D3DCULL_CW,
  6519.     D3DCULL_CCW);
  6520.  
  6521.   PD3DCmpFunc = ^TD3DCmpFunc;
  6522.   TD3DCmpFunc = (
  6523.     D3DCMP_INVALID_0,
  6524.     D3DCMP_NEVER,
  6525.     D3DCMP_LESS,
  6526.     D3DCMP_EQUAL,
  6527.     D3DCMP_LESSEQUAL,
  6528.     D3DCMP_GREATER,
  6529.     D3DCMP_NOTEQUAL,
  6530.     D3DCMP_GREATEREQUAL,
  6531.     D3DCMP_ALWAYS);
  6532.  
  6533.   PD3DStencilOp = ^TD3DStencilOp;
  6534.   TD3DStencilOp = (
  6535.     D3DSTENCILOP_INVALID_0,
  6536.     D3DSTENCILOP_KEEP,
  6537.     D3DSTENCILOP_ZERO,
  6538.     D3DSTENCILOP_REPLACE,
  6539.     D3DSTENCILOP_INCRSAT,
  6540.     D3DSTENCILOP_DECRSAT,
  6541.     D3DSTENCILOP_INVERT,
  6542.     D3DSTENCILOP_INCR,
  6543.     D3DSTENCILOP_DECR);
  6544.    
  6545.   PD3DFogMode = ^TD3DFogMode;
  6546.   TD3DFogMode = (
  6547.     D3DFOG_NONE,
  6548.     D3DFOG_EXP,
  6549.     D3DFOG_EXP2,
  6550.     D3DFOG_LINEAR);
  6551.  
  6552.   PD3DZBufferType = ^TD3DZBufferType;
  6553.   TD3DZBufferType = (
  6554.     D3DZB_FALSE,
  6555.     D3DZB_TRUE,   // Z buffering
  6556.     D3DZB_USEW);  // W buffering
  6557.  
  6558.   PD3DAntialiasMode = ^TD3DAntialiasMode;
  6559.   TD3DAntialiasMode = (
  6560.     D3DANTIALIAS_NONE,
  6561.     D3DANTIALIAS_SORTDEPENDENT,
  6562.     D3DANTIALIAS_SORTINDEPENDENT);
  6563.  
  6564. // Vertex types supported by Direct3D
  6565.   PD3DVertexType = ^TD3DVertexType;
  6566.   TD3DVertexType = (
  6567.     D3DVT_INVALID_0,
  6568.     D3DVT_VERTEX,
  6569.     D3DVT_LVERTEX,
  6570.     D3DVT_TLVERTEX);
  6571.  
  6572. // Primitives supported by draw-primitive API
  6573.   PD3DPrimitiveType = ^TD3DPrimitiveType;
  6574.   TD3DPrimitiveType = (
  6575.     D3DPT_INVALID_0,
  6576.     D3DPT_POINTLIST,
  6577.     D3DPT_LINELIST,
  6578.     D3DPT_LINESTRIP,
  6579.     D3DPT_TRIANGLELIST,
  6580.     D3DPT_TRIANGLESTRIP,
  6581.     D3DPT_TRIANGLEFAN);
  6582.  
  6583. (*
  6584.  * Amount to add to a state to generate the override for that state.
  6585.  *)
  6586.  
  6587. const
  6588.   D3DSTATE_OVERRIDE_BIAS          = 256;
  6589.  
  6590. (*
  6591.  * A state which sets the override flag for the specified state type.
  6592.  *)
  6593.  
  6594. function D3DSTATE_OVERRIDE(StateType: DWORD) : DWORD;
  6595.  
  6596. type
  6597.   PD3DTransformStateType = ^TD3DTransformStateType;
  6598.   TD3DTransformStateType = DWORD;
  6599. const
  6600.   D3DTRANSFORMSTATE_WORLD         = 1;
  6601.   D3DTRANSFORMSTATE_VIEW          = 2;
  6602.   D3DTRANSFORMSTATE_PROJECTION    = 3;
  6603.   D3DTRANSFORMSTATE_WORLD1        = 4;  // 2nd matrix to blend
  6604.   D3DTRANSFORMSTATE_WORLD2        = 5;  // 3rd matrix to blend
  6605.   D3DTRANSFORMSTATE_WORLD3        = 6;  // 4th matrix to blend
  6606.   D3DTRANSFORMSTATE_TEXTURE0      = 16;
  6607.   D3DTRANSFORMSTATE_TEXTURE1      = 17;
  6608.   D3DTRANSFORMSTATE_TEXTURE2      = 18;
  6609.   D3DTRANSFORMSTATE_TEXTURE3      = 19;
  6610.   D3DTRANSFORMSTATE_TEXTURE4      = 20;
  6611.   D3DTRANSFORMSTATE_TEXTURE5      = 21;
  6612.   D3DTRANSFORMSTATE_TEXTURE6      = 22;
  6613.   D3DTRANSFORMSTATE_TEXTURE7      = 23;
  6614.  
  6615. type
  6616.   PD3DLightStateType = ^TD3DLightStateType;
  6617.   TD3DLightStateType = (
  6618.     D3DLIGHTSTATE_INVALID_0,
  6619.     D3DLIGHTSTATE_MATERIAL,
  6620.     D3DLIGHTSTATE_AMBIENT,
  6621.     D3DLIGHTSTATE_COLORMODEL,
  6622.     D3DLIGHTSTATE_FOGMODE,
  6623.     D3DLIGHTSTATE_FOGSTART,
  6624.     D3DLIGHTSTATE_FOGEND,
  6625.     D3DLIGHTSTATE_FOGDENSITY,
  6626.     D3DLIGHTSTATE_COLORVERTEX);
  6627.  
  6628.   PD3DRenderStateType = ^TD3DRenderStateType;
  6629.   TD3DRenderStateType = DWORD;
  6630. const
  6631.     D3DRENDERSTATE_ANTIALIAS          = 2;    (* D3DANTIALIASMODE *)
  6632.     D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4;    (* TRUE for perspective correction *)
  6633.     D3DRENDERSTATE_ZENABLE            = 7;    (* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) *)
  6634.     D3DRENDERSTATE_FILLMODE           = 8;    (* D3DFILL_MODE        *)
  6635.     D3DRENDERSTATE_SHADEMODE          = 9;    (* D3DSHADEMODE *)
  6636.     D3DRENDERSTATE_LINEPATTERN        = 10;   (* D3DLINEPATTERN *)
  6637.     D3DRENDERSTATE_ZWRITEENABLE       = 14;   (* TRUE to enable z writes *)
  6638.     D3DRENDERSTATE_ALPHATESTENABLE    = 15;   (* TRUE to enable alpha tests *)
  6639.     D3DRENDERSTATE_LASTPIXEL          = 16;   (* TRUE for last-pixel on lines *)
  6640.     D3DRENDERSTATE_SRCBLEND           = 19;   (* D3DBLEND *)
  6641.     D3DRENDERSTATE_DESTBLEND          = 20;   (* D3DBLEND *)
  6642.     D3DRENDERSTATE_CULLMODE           = 22;   (* D3DCULL *)
  6643.     D3DRENDERSTATE_ZFUNC              = 23;   (* D3DCMPFUNC *)
  6644.     D3DRENDERSTATE_ALPHAREF           = 24;   (* D3DFIXED *)
  6645.     D3DRENDERSTATE_ALPHAFUNC          = 25;   (* D3DCMPFUNC *)
  6646.     D3DRENDERSTATE_DITHERENABLE       = 26;   (* TRUE to enable dithering *)
  6647.     D3DRENDERSTATE_ALPHABLENDENABLE   = 27;   (* TRUE to enable alpha blending *)
  6648.     D3DRENDERSTATE_FOGENABLE          = 28;   (* TRUE to enable fog blending *)
  6649.     D3DRENDERSTATE_SPECULARENABLE     = 29;   (* TRUE to enable specular *)
  6650.     D3DRENDERSTATE_ZVISIBLE           = 30;   (* TRUE to enable z checking *)
  6651.     D3DRENDERSTATE_STIPPLEDALPHA      = 33;   (* TRUE to enable stippled alpha (RGB device only) *)
  6652.     D3DRENDERSTATE_FOGCOLOR           = 34;   (* D3DCOLOR *)
  6653.     D3DRENDERSTATE_FOGTABLEMODE       = 35;   (* D3DFOGMODE *)
  6654.     D3DRENDERSTATE_FOGSTART           = 36;   (* Fog start (for both vertex and pixel fog) *)
  6655.     D3DRENDERSTATE_FOGEND             = 37;   (* Fog end      *)
  6656.     D3DRENDERSTATE_FOGDENSITY         = 38;   (* Fog density  *)
  6657.     D3DRENDERSTATE_EDGEANTIALIAS      = 40;   (* TRUE to enable edge antialiasing *)
  6658.     D3DRENDERSTATE_COLORKEYENABLE     = 41;   (* TRUE to enable source colorkeyed textures *)
  6659.     D3DRENDERSTATE_ZBIAS              = 47;   (* LONG Z bias *)
  6660.     D3DRENDERSTATE_RANGEFOGENABLE     = 48;   (* Enables range-based fog *)
  6661.  
  6662.     D3DRENDERSTATE_STENCILENABLE      = 52;   (* BOOL enable/disable stenciling *)
  6663.     D3DRENDERSTATE_STENCILFAIL        = 53;   (* D3DSTENCILOP to do if stencil test fails *)
  6664.     D3DRENDERSTATE_STENCILZFAIL       = 54;   (* D3DSTENCILOP to do if stencil test passes and Z test fails *)
  6665.     D3DRENDERSTATE_STENCILPASS        = 55;   (* D3DSTENCILOP to do if both stencil and Z tests pass *)
  6666.     D3DRENDERSTATE_STENCILFUNC        = 56;   (* D3DCMPFUNC fn.  Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *)
  6667.     D3DRENDERSTATE_STENCILREF         = 57;   (* Reference value used in stencil test *)
  6668.     D3DRENDERSTATE_STENCILMASK        = 58;   (* Mask value used in stencil test *)
  6669.     D3DRENDERSTATE_STENCILWRITEMASK   = 59;   (* Write mask applied to values written to stencil buffer *)
  6670.     D3DRENDERSTATE_TEXTUREFACTOR      = 60;   (* D3DCOLOR used for multi-texture blend *)
  6671.  
  6672.     (*
  6673.      * 128 values [128; 255] are reserved for texture coordinate wrap flags.
  6674.      * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using
  6675.      * a flags word preserves forward compatibility with texture coordinates
  6676.      * that are >2D.
  6677.      *)
  6678.     D3DRENDERSTATE_WRAP0              = 128;  (* wrap for 1st texture coord. set *)
  6679.     D3DRENDERSTATE_WRAP1              = 129;  (* wrap for 2nd texture coord. set *)
  6680.     D3DRENDERSTATE_WRAP2              = 130;  (* wrap for 3rd texture coord. set *)
  6681.     D3DRENDERSTATE_WRAP3              = 131;  (* wrap for 4th texture coord. set *)
  6682.     D3DRENDERSTATE_WRAP4              = 132;  (* wrap for 5th texture coord. set *)
  6683.     D3DRENDERSTATE_WRAP5              = 133;  (* wrap for 6th texture coord. set *)
  6684.     D3DRENDERSTATE_WRAP6              = 134;  (* wrap for 7th texture coord. set *)
  6685.     D3DRENDERSTATE_WRAP7              = 135;  (* wrap for 8th texture coord. set *)
  6686.     D3DRENDERSTATE_CLIPPING            = 136;
  6687.     D3DRENDERSTATE_LIGHTING            = 137;
  6688.     D3DRENDERSTATE_EXTENTS             = 138;
  6689.     D3DRENDERSTATE_AMBIENT             = 139;
  6690.     D3DRENDERSTATE_FOGVERTEXMODE       = 140;
  6691.     D3DRENDERSTATE_COLORVERTEX         = 141;
  6692.     D3DRENDERSTATE_LOCALVIEWER         = 142;
  6693.     D3DRENDERSTATE_NORMALIZENORMALS    = 143;
  6694.     D3DRENDERSTATE_COLORKEYBLENDENABLE = 144;
  6695.     D3DRENDERSTATE_DIFFUSEMATERIALSOURCE    = 145;
  6696.     D3DRENDERSTATE_SPECULARMATERIALSOURCE   = 146;
  6697.     D3DRENDERSTATE_AMBIENTMATERIALSOURCE    = 147;
  6698.     D3DRENDERSTATE_EMISSIVEMATERIALSOURCE   = 148;
  6699.     D3DRENDERSTATE_VERTEXBLEND              = 151;
  6700.     D3DRENDERSTATE_CLIPPLANEENABLE          = 152;
  6701.  
  6702. //
  6703. // retired renderstates - not supported for DX7 interfaces
  6704. //
  6705.     D3DRENDERSTATE_TEXTUREHANDLE      = 1;    (* Texture handle for legacy interfaces (Texture;Texture2) *)
  6706.     D3DRENDERSTATE_TEXTUREADDRESS     = 3;    (* D3DTEXTUREADDRESS  *)
  6707.     D3DRENDERSTATE_WRAPU              = 5;    (* TRUE for wrapping in u *)
  6708.     D3DRENDERSTATE_WRAPV              = 6;    (* TRUE for wrapping in v *)
  6709.     D3DRENDERSTATE_MONOENABLE         = 11;   (* TRUE to enable mono rasterization *)
  6710.     D3DRENDERSTATE_ROP2               = 12;   (* ROP2 *)
  6711.     D3DRENDERSTATE_PLANEMASK          = 13;   (* DWORD physical plane mask *)
  6712.     D3DRENDERSTATE_TEXTUREMAG         = 17;   (* D3DTEXTUREFILTER *)
  6713.     D3DRENDERSTATE_TEXTUREMIN         = 18;   (* D3DTEXTUREFILTER *)
  6714.     D3DRENDERSTATE_TEXTUREMAPBLEND    = 21;   (* D3DTEXTUREBLEND *)
  6715.     D3DRENDERSTATE_SUBPIXEL           = 31;   (* TRUE to enable subpixel correction *)
  6716.     D3DRENDERSTATE_SUBPIXELX          = 32;   (* TRUE to enable correction in X only *)
  6717.     D3DRENDERSTATE_STIPPLEENABLE      = 39;   (* TRUE to enable stippling *)
  6718.     D3DRENDERSTATE_BORDERCOLOR        = 43;   (* Border color for texturing w/border *)
  6719.     D3DRENDERSTATE_TEXTUREADDRESSU    = 44;   (* Texture addressing mode for U coordinate *)
  6720.     D3DRENDERSTATE_TEXTUREADDRESSV    = 45;   (* Texture addressing mode for V coordinate *)
  6721.     D3DRENDERSTATE_MIPMAPLODBIAS      = 46;   (* D3DVALUE Mipmap LOD bias *)
  6722.     D3DRENDERSTATE_ANISOTROPY         = 49;   (* Max. anisotropy. 1 = no anisotropy *)
  6723.     D3DRENDERSTATE_FLUSHBATCH         = 50;   (* Explicit flush for DP batching (DX5 Only) *)
  6724.     D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51; (* BOOL enable sort-independent transparency *)
  6725.     D3DRENDERSTATE_STIPPLEPATTERN00   = 64;   (* Stipple pattern 01...  *)
  6726.     D3DRENDERSTATE_STIPPLEPATTERN01   = 65;
  6727.     D3DRENDERSTATE_STIPPLEPATTERN02   = 66;
  6728.     D3DRENDERSTATE_STIPPLEPATTERN03   = 67;
  6729.     D3DRENDERSTATE_STIPPLEPATTERN04   = 68;
  6730.     D3DRENDERSTATE_STIPPLEPATTERN05   = 69;
  6731.     D3DRENDERSTATE_STIPPLEPATTERN06   = 70;
  6732.     D3DRENDERSTATE_STIPPLEPATTERN07   = 71;
  6733.     D3DRENDERSTATE_STIPPLEPATTERN08   = 72;
  6734.     D3DRENDERSTATE_STIPPLEPATTERN09   = 73;
  6735.     D3DRENDERSTATE_STIPPLEPATTERN10   = 74;
  6736.     D3DRENDERSTATE_STIPPLEPATTERN11   = 75;
  6737.     D3DRENDERSTATE_STIPPLEPATTERN12   = 76;
  6738.     D3DRENDERSTATE_STIPPLEPATTERN13   = 77;
  6739.     D3DRENDERSTATE_STIPPLEPATTERN14   = 78;
  6740.     D3DRENDERSTATE_STIPPLEPATTERN15   = 79;
  6741.     D3DRENDERSTATE_STIPPLEPATTERN16   = 80;
  6742.     D3DRENDERSTATE_STIPPLEPATTERN17   = 81;
  6743.     D3DRENDERSTATE_STIPPLEPATTERN18   = 82;
  6744.     D3DRENDERSTATE_STIPPLEPATTERN19   = 83;
  6745.     D3DRENDERSTATE_STIPPLEPATTERN20   = 84;
  6746.     D3DRENDERSTATE_STIPPLEPATTERN21   = 85;
  6747.     D3DRENDERSTATE_STIPPLEPATTERN22   = 86;
  6748.     D3DRENDERSTATE_STIPPLEPATTERN23   = 87;
  6749.     D3DRENDERSTATE_STIPPLEPATTERN24   = 88;
  6750.     D3DRENDERSTATE_STIPPLEPATTERN25   = 89;
  6751.     D3DRENDERSTATE_STIPPLEPATTERN26   = 90;
  6752.     D3DRENDERSTATE_STIPPLEPATTERN27   = 91;
  6753.     D3DRENDERSTATE_STIPPLEPATTERN28   = 92;
  6754.     D3DRENDERSTATE_STIPPLEPATTERN29   = 93;
  6755.     D3DRENDERSTATE_STIPPLEPATTERN30   = 94;
  6756.     D3DRENDERSTATE_STIPPLEPATTERN31   = 95;
  6757.  
  6758. //
  6759. // retired renderstate names - the values are still used under new naming conventions
  6760. //
  6761.     D3DRENDERSTATE_FOGTABLESTART      = 36;   (* Fog table start    *)
  6762.     D3DRENDERSTATE_FOGTABLEEND        = 37;   (* Fog table end      *)
  6763.     D3DRENDERSTATE_FOGTABLEDENSITY    = 38;   (* Fog table density  *)
  6764.  
  6765. type
  6766. // Values for material source
  6767.   PD3DMateralColorSource = ^TD3DMateralColorSource;
  6768.   TD3DMateralColorSource = (
  6769.     D3DMCS_MATERIAL,              // Color from material is used
  6770.     D3DMCS_COLOR1,                // Diffuse vertex color is used
  6771.     D3DMCS_COLOR2                 // Specular vertex color is used
  6772.   );
  6773.  
  6774. const
  6775.   // For back-compatibility with legacy compilations
  6776.   D3DRENDERSTATE_BLENDENABLE = D3DRENDERSTATE_ALPHABLENDENABLE;
  6777.  
  6778.  
  6779. // Bias to apply to the texture coordinate set to apply a wrap to.
  6780.    D3DRENDERSTATE_WRAPBIAS                = 128;
  6781.  
  6782. (* Flags to construct the WRAP render states *)
  6783.   D3DWRAP_U   = $00000001;
  6784.   D3DWRAP_V   = $00000002;
  6785.  
  6786. (* Flags to construct the WRAP render states for 1D thru 4D texture coordinates *)
  6787.   D3DWRAPCOORD_0   = $00000001;    // same as D3DWRAP_U
  6788.   D3DWRAPCOORD_1   = $00000002;    // same as D3DWRAP_V
  6789.   D3DWRAPCOORD_2   = $00000004;
  6790.   D3DWRAPCOORD_3   = $00000008;
  6791.  
  6792. function D3DRENDERSTATE_STIPPLEPATTERN(y: integer) : TD3DRenderStateType;
  6793.  
  6794. type
  6795.   PD3DState = ^TD3DState;
  6796.   TD3DState = packed record
  6797.     case Integer of
  6798.     0: (
  6799.       dtstTransformStateType: TD3DTransformStateType;
  6800.       dwArg: Array [ 0..0 ] of DWORD;
  6801.      );
  6802.     1: (
  6803.       dlstLightStateType: TD3DLightStateType;
  6804.       dvArg: Array [ 0..0 ] of TD3DValue;
  6805.      );
  6806.     2: (
  6807.       drstRenderStateType: TD3DRenderStateType;
  6808.      );
  6809.   end;
  6810.  
  6811. (*
  6812.  * Operation used to load matrices
  6813.  * hDstMat = hSrcMat
  6814.  *)
  6815.   PD3DMatrixLoad = ^TD3DMatrixLoad;
  6816.   TD3DMatrixLoad = packed record
  6817.     hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
  6818.     hSrcMatrix: TD3DMatrixHandle;    (* Source matrix *)
  6819.   end;
  6820.  
  6821. (*
  6822.  * Operation used to multiply matrices
  6823.  * hDstMat = hSrcMat1 * hSrcMat2
  6824.  *)
  6825.   PD3DMatrixMultiply = ^TD3DMatrixMultiply;
  6826.   TD3DMatrixMultiply = packed record
  6827.     hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
  6828.     hSrcMatrix1: TD3DMatrixHandle;   (* First source matrix *)
  6829.     hSrcMatrix2: TD3DMatrixHandle;   (* Second source matrix *)
  6830.   end;
  6831.  
  6832. (*
  6833.  * Operation used to transform and light vertices.
  6834.  *)
  6835.   PD3DProcessVertices = ^TD3DProcessVertices;
  6836.   TD3DProcessVertices = packed record
  6837.     dwFlags: DWORD;           (* Do we transform or light or just copy? *)
  6838.     wStart: WORD;             (* Index to first vertex in source *)
  6839.     wDest: WORD;              (* Index to first vertex in local buffer *)
  6840.     dwCount: DWORD;           (* Number of vertices to be processed *)
  6841.     dwReserved: DWORD;        (* Must be zero *)
  6842.   end;
  6843.  
  6844. const
  6845.   D3DPROCESSVERTICES_TRANSFORMLIGHT       = $00000000;
  6846.   D3DPROCESSVERTICES_TRANSFORM            = $00000001;
  6847.   D3DPROCESSVERTICES_COPY                 = $00000002;
  6848.   D3DPROCESSVERTICES_OPMASK               = $00000007;
  6849.  
  6850.   D3DPROCESSVERTICES_UPDATEEXTENTS        = $00000008;
  6851.   D3DPROCESSVERTICES_NOCOLOR              = $00000010;
  6852.  
  6853.  
  6854. (*
  6855.  * State enumerants for per-stage texture processing.
  6856.  *)
  6857. type
  6858.   PD3DTextureStageStateType = ^TD3DTextureStageStateType;
  6859.   TD3DTextureStageStateType = DWORD;
  6860. const
  6861.   D3DTSS_COLOROP        =  1; (* D3DTEXTUREOP - per-stage blending controls for color channels *)
  6862.   D3DTSS_COLORARG1      =  2; (* D3DTA_* (texture arg) *)
  6863.   D3DTSS_COLORARG2      =  3; (* D3DTA_* (texture arg) *)
  6864.   D3DTSS_ALPHAOP        =  4; (* D3DTEXTUREOP - per-stage blending controls for alpha channel *)
  6865.   D3DTSS_ALPHAARG1      =  5; (* D3DTA_* (texture arg) *)
  6866.   D3DTSS_ALPHAARG2      =  6; (* D3DTA_* (texture arg) *)
  6867.   D3DTSS_BUMPENVMAT00   =  7; (* D3DVALUE (bump mapping matrix) *)
  6868.   D3DTSS_BUMPENVMAT01   =  8; (* D3DVALUE (bump mapping matrix) *)
  6869.   D3DTSS_BUMPENVMAT10   =  9; (* D3DVALUE (bump mapping matrix) *)
  6870.   D3DTSS_BUMPENVMAT11   = 10; (* D3DVALUE (bump mapping matrix) *)
  6871.   D3DTSS_TEXCOORDINDEX  = 11; (* identifies which set of texture coordinates index this texture *)
  6872.   D3DTSS_ADDRESS        = 12; (* D3DTEXTUREADDRESS for both coordinates *)
  6873.   D3DTSS_ADDRESSU       = 13; (* D3DTEXTUREADDRESS for U coordinate *)
  6874.   D3DTSS_ADDRESSV       = 14; (* D3DTEXTUREADDRESS for V coordinate *)
  6875.   D3DTSS_BORDERCOLOR    = 15; (* D3DCOLOR *)
  6876.   D3DTSS_MAGFILTER      = 16; (* D3DTEXTUREMAGFILTER filter to use for magnification *)
  6877.   D3DTSS_MINFILTER      = 17; (* D3DTEXTUREMINFILTER filter to use for minification *)
  6878.   D3DTSS_MIPFILTER      = 18; (* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification *)
  6879.   D3DTSS_MIPMAPLODBIAS  = 19; (* D3DVALUE Mipmap LOD bias *)
  6880.   D3DTSS_MAXMIPLEVEL    = 20; (* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) *)
  6881.   D3DTSS_MAXANISOTROPY  = 21; (* DWORD maximum anisotropy *)
  6882.   D3DTSS_BUMPENVLSCALE  = 22; (* D3DVALUE scale for bump map luminance *)
  6883.   D3DTSS_BUMPENVLOFFSET = 23; (* D3DVALUE offset for bump map luminance *)
  6884.   D3DTSS_TEXTURETRANSFORMFLAGS = 24; (* D3DTEXTURETRANSFORMFLAGS controls texture transform *)
  6885.  
  6886. // Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position
  6887. // and normal in the camera space) should be taken as texture coordinates
  6888. // Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from
  6889. //
  6890.   D3DTSS_TCI_PASSTHRU                             = $00000000;
  6891.   D3DTSS_TCI_CAMERASPACENORMAL                    = $00010000;
  6892.   D3DTSS_TCI_CAMERASPACEPOSITION                  = $00020000;
  6893.   D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR          = $00030000;
  6894.  
  6895. type
  6896. (*
  6897.  * Enumerations for COLOROP and ALPHAOP texture blending operations set in
  6898.  * texture processing stage controls in D3DRENDERSTATE.
  6899.  *)
  6900.   PD3DTextureOp = ^TD3DTextureOp;
  6901.   TD3DTextureOp = (
  6902.     D3DTOP_INVALID_0,
  6903. // Control
  6904.     D3DTOP_DISABLE   ,      // disables stage
  6905.     D3DTOP_SELECTARG1,      // the default
  6906.     D3DTOP_SELECTARG2,
  6907.  
  6908. // Modulate
  6909.     D3DTOP_MODULATE  ,      // multiply args together
  6910.     D3DTOP_MODULATE2X,      // multiply and  1 bit
  6911.     D3DTOP_MODULATE4X,      // multiply and  2 bits
  6912.  
  6913. // Add
  6914.     D3DTOP_ADD        ,   // add arguments together
  6915.     D3DTOP_ADDSIGNED  ,   // add with -0.5 bias
  6916.     D3DTOP_ADDSIGNED2X,   // as above but left  1 bit
  6917.     D3DTOP_SUBTRACT   ,   // Arg1 - Arg2, with no saturation
  6918.     D3DTOP_ADDSMOOTH  ,   // add 2 args, subtract product
  6919.                           // Arg1 + Arg2 - Arg1*Arg2
  6920.                           // = Arg1 + (1-Arg1)*Arg2
  6921.  
  6922. // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
  6923.     D3DTOP_BLENDDIFFUSEALPHA  , // iterated alpha
  6924.     D3DTOP_BLENDTEXTUREALPHA  , // texture alpha
  6925.     D3DTOP_BLENDFACTORALPHA   , // alpha from D3DRENDERSTATE_TEXTUREFACTOR
  6926.     // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
  6927.     D3DTOP_BLENDTEXTUREALPHAPM, // texture alpha
  6928.     D3DTOP_BLENDCURRENTALPHA  , // by alpha of current color
  6929.  
  6930. // Specular mapping
  6931.     D3DTOP_PREMODULATE           ,     // modulate with next texture before use
  6932.     D3DTOP_MODULATEALPHA_ADDCOLOR,     // Arg1.RGB + Arg1.A*Arg2.RGB
  6933.                                        // COLOROP only
  6934.     D3DTOP_MODULATECOLOR_ADDALPHA,     // Arg1.RGB*Arg2.RGB + Arg1.A
  6935.                                             // COLOROP only
  6936.     D3DTOP_MODULATEINVALPHA_ADDCOLOR,  // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
  6937.                                        // COLOROP only
  6938.     D3DTOP_MODULATEINVCOLOR_ADDALPHA,  // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
  6939.                                             // COLOROP only
  6940.  
  6941. // Bump mapping
  6942.     D3DTOP_BUMPENVMAP         , // per pixel env map perturbation
  6943.     D3DTOP_BUMPENVMAPLUMINANCE, // with luminance channel
  6944.     // This can do either diffuse or specular bump mapping with correct input.
  6945.     // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
  6946.     // where each component has been scaled and offset to make it signed.
  6947.     // The result is replicated into all four (including alpha) channels.
  6948.     // This is a valid COLOROP only.
  6949.     D3DTOP_DOTPRODUCT3
  6950.   );
  6951.  
  6952. (*
  6953.  * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations
  6954.  * set in texture processing stage controls in D3DRENDERSTATE.
  6955.  *)
  6956. const
  6957.   D3DTA_SELECTMASK        = $0000000f;  // mask for arg selector
  6958.   D3DTA_DIFFUSE           = $00000000;  // select diffuse color
  6959.   D3DTA_CURRENT           = $00000001;  // select result of previous stage
  6960.   D3DTA_TEXTURE           = $00000002;  // select texture color
  6961.   D3DTA_TFACTOR           = $00000003;  // select RENDERSTATE_TEXTUREFACTOR
  6962.   D3DTA_SPECULAR          = $00000004;  // select specular color
  6963.   D3DTA_COMPLEMENT        = $00000010;  // take 1.0 - x
  6964.   D3DTA_ALPHAREPLICATE    = $00000020;  // replicate alpha to color components
  6965.  
  6966. (*
  6967.  *  IDirect3DTexture2 State Filter Types
  6968.  *)
  6969. type
  6970.   PD3DTextureMagFilter = ^TD3DTextureMagFilter;
  6971.   TD3DTextureMagFilter = (
  6972.     D3DTFG_INVALID_0,
  6973.     D3DTFG_POINT        ,    // nearest
  6974.     D3DTFG_LINEAR       ,    // linear interpolation
  6975.     D3DTFG_FLATCUBIC    ,    // cubic
  6976.     D3DTFG_GAUSSIANCUBIC,    // different cubic kernel
  6977.     D3DTFG_ANISOTROPIC
  6978.   );
  6979.  
  6980.   PD3DTextureMinFilter = ^TD3DTextureMinFilter;
  6981.   TD3DTextureMinFilter = (
  6982.     D3DTFN_INVALID_0,
  6983.     D3DTFN_POINT      ,    // nearest
  6984.     D3DTFN_LINEAR     ,    // linear interpolation
  6985.     D3DTFN_ANISOTROPIC
  6986.   );
  6987.  
  6988.   PD3DTextureMipFilter = ^TD3DTextureMipFilter;
  6989.   TD3DTextureMipFilter = (
  6990.     D3DTFP_INVALID_0,
  6991.     D3DTFP_NONE   ,    // mipmapping disabled (use MAG filter)
  6992.     D3DTFP_POINT  ,    // nearest
  6993.     D3DTFP_LINEAR      // linear interpolation
  6994.   );
  6995.  
  6996.  
  6997. (*
  6998.  * Triangle flags
  6999.  *)
  7000.  
  7001. (*
  7002.  * Tri strip and fan flags.
  7003.  * START loads all three vertices
  7004.  * EVEN and ODD load just v3 with even or odd culling
  7005.  * START_FLAT contains a count from 0 to 29 that allows the
  7006.  * whole strip or fan to be culled in one hit.
  7007.  * e.g. for a quad len = 1
  7008.  *)
  7009. const
  7010.   D3DTRIFLAG_START                        = $00000000;
  7011. // #define D3DTRIFLAG_STARTFLAT(len) (len)         (* 0 < len < 30 *)
  7012. function D3DTRIFLAG_STARTFLAT(len: DWORD) : DWORD;
  7013.  
  7014. const
  7015.   D3DTRIFLAG_ODD                          = $0000001e;
  7016.   D3DTRIFLAG_EVEN                         = $0000001f;
  7017.  
  7018. (*
  7019.  * Triangle edge flags
  7020.  * enable edges for wireframe or antialiasing
  7021.  *)
  7022.   D3DTRIFLAG_EDGEENABLE1                  = $00000100; (* v0-v1 edge *)
  7023.   D3DTRIFLAG_EDGEENABLE2                  = $00000200; (* v1-v2 edge *)
  7024.   D3DTRIFLAG_EDGEENABLE3                  = $00000400; (* v2-v0 edge *)
  7025.   D3DTRIFLAG_EDGEENABLETRIANGLE = (
  7026.       D3DTRIFLAG_EDGEENABLE1 or D3DTRIFLAG_EDGEENABLE2 or D3DTRIFLAG_EDGEENABLE3);
  7027.  
  7028. (*
  7029.  * Primitive structures and related defines.  Vertex offsets are to types
  7030.  * TD3DVertex, TD3DLVertex, or TD3DTLVertex.
  7031.  *)
  7032.  
  7033. (*
  7034.  * Triangle list primitive structure
  7035.  *)
  7036. type
  7037.   PD3DTriangle = ^TD3DTriangle;
  7038.   TD3DTriangle = packed record
  7039.     case Integer of
  7040.     0: (
  7041.       v1: WORD;            (* Vertex indices *)
  7042.       v2: WORD;
  7043.       v3: WORD;
  7044.       wFlags: WORD;        (* Edge (and other) flags *)
  7045.      );
  7046.     1: (
  7047.       wV1: WORD;
  7048.       wV2: WORD;
  7049.       wV3: WORD;
  7050.      );
  7051.   end;
  7052.  
  7053. (*
  7054.  * Line strip structure.
  7055.  * The instruction count - 1 defines the number of line segments.
  7056.  *)
  7057.   PD3DLine = ^TD3DLine;
  7058.   TD3DLine = packed record
  7059.     case Integer of
  7060.     0: (
  7061.       v1: WORD;            (* Vertex indices *)
  7062.       v2: WORD;
  7063.      );
  7064.     1: (
  7065.       wV1: WORD;
  7066.       wV2: WORD;
  7067.      );
  7068.   end;
  7069.  
  7070. (*
  7071.  * Span structure
  7072.  * Spans join a list of points with the same y value.
  7073.  * If the y value changes, a new span is started.
  7074.  *)
  7075.   PD3DSpan = ^TD3DSpan;
  7076.   TD3DSpan = packed record
  7077.     wCount: WORD;        (* Number of spans *)
  7078.     wFirst: WORD;        (* Index to first vertex *)
  7079.   end;
  7080.  
  7081. (*
  7082.  * Point structure
  7083.  *)
  7084.   PD3DPoint = ^TD3DPoint;
  7085.   TD3DPoint = packed record
  7086.     wCount: WORD;        (* number of points         *)
  7087.     wFirst: WORD;        (* index to first vertex    *)
  7088.   end;
  7089.  
  7090. (*
  7091.  * Forward branch structure.
  7092.  * Mask is logically anded with the driver status mask
  7093.  * if the result equals 'value', the branch is taken.
  7094.  *)
  7095.   PD3DBranch = ^TD3DBranch;
  7096.   TD3DBranch = packed record
  7097.     dwMask: DWORD;         (* Bitmask against D3D status *)
  7098.     dwValue: DWORD;
  7099.     bNegate: BOOL;         (* TRUE to negate comparison *)
  7100.     dwOffset: DWORD;       (* How far to branch forward (0 for exit)*)
  7101.   end;
  7102.  
  7103. (*
  7104.  * Status used for set status instruction.
  7105.  * The D3D status is initialised on device creation
  7106.  * and is modified by all execute calls.
  7107.  *)
  7108.   PD3DStatus = ^TD3DStatus;
  7109.   TD3DStatus = packed record
  7110.     dwFlags: DWORD;        (* Do we set extents or status *)
  7111.     dwStatus: DWORD;       (* D3D status *)
  7112.     drExtent: TD3DRect;
  7113.   end;
  7114.  
  7115. const
  7116.   D3DSETSTATUS_STATUS    = $00000001;
  7117.   D3DSETSTATUS_EXTENTS   = $00000002;
  7118.   D3DSETSTATUS_ALL      = (D3DSETSTATUS_STATUS or D3DSETSTATUS_EXTENTS);
  7119.  
  7120. type
  7121.   PD3DClipStatus = ^TD3DClipStatus;
  7122.   TD3DClipStatus = packed record
  7123.     dwFlags : DWORD; (* Do we set 2d extents, 3D extents or status *)
  7124.     dwStatus : DWORD; (* Clip status *)
  7125.     minx, maxx : float; (* X extents *)
  7126.     miny, maxy : float; (* Y extents *)
  7127.     minz, maxz : float; (* Z extents *)
  7128.   end;
  7129.  
  7130. const
  7131.   D3DCLIPSTATUS_STATUS        = $00000001;
  7132.   D3DCLIPSTATUS_EXTENTS2      = $00000002;
  7133.   D3DCLIPSTATUS_EXTENTS3      = $00000004;
  7134.  
  7135. (*
  7136.  * Statistics structure
  7137.  *)
  7138. type
  7139.   PD3DStats = ^TD3DStats;
  7140.   TD3DStats = packed record
  7141.     dwSize: DWORD;
  7142.     dwTrianglesDrawn: DWORD;
  7143.     dwLinesDrawn: DWORD;
  7144.     dwPointsDrawn: DWORD;
  7145.     dwSpansDrawn: DWORD;
  7146.     dwVerticesProcessed: DWORD;
  7147.   end;
  7148.  
  7149. (*
  7150.  * Execute options.
  7151.  * When calling using D3DEXECUTE_UNCLIPPED all the primitives
  7152.  * inside the buffer must be contained within the viewport.
  7153.  *)
  7154. const
  7155.   D3DEXECUTE_CLIPPED       = $00000001;
  7156.   D3DEXECUTE_UNCLIPPED     = $00000002;
  7157.  
  7158. type
  7159.   PD3DExecuteData = ^TD3DExecuteData;
  7160.   TD3DExecuteData = packed record
  7161.     dwSize: DWORD;
  7162.     dwVertexOffset: DWORD;
  7163.     dwVertexCount: DWORD;
  7164.     dwInstructionOffset: DWORD;
  7165.     dwInstructionLength: DWORD;
  7166.     dwHVertexOffset: DWORD;
  7167.     dsStatus: TD3DStatus;       (* Status after execute *)
  7168.   end;
  7169.  
  7170. (*
  7171.  * Palette flags.
  7172.  * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw.
  7173.  *)
  7174.  
  7175. const
  7176.   D3DPAL_FREE     = $00;    (* Renderer may use this entry freely *)
  7177.   D3DPAL_READONLY = $40;    (* Renderer may not set this entry *)
  7178.   D3DPAL_RESERVED = $80;    (* Renderer may not use this entry *)
  7179.  
  7180.  
  7181. type
  7182.   PD3DVertexBufferDesc = ^TD3DVertexBufferDesc;
  7183.   TD3DVertexBufferDesc = packed record
  7184.     dwSize : DWORD;
  7185.     dwCaps : DWORD;
  7186.     dwFVF : DWORD;
  7187.     dwNumVertices : DWORD;
  7188.   end;
  7189.  
  7190. const
  7191. (* These correspond to DDSCAPS_* flags *)
  7192.   D3DVBCAPS_SYSTEMMEMORY      = $00000800;
  7193.   D3DVBCAPS_WRITEONLY         = $00010000;
  7194.   D3DVBCAPS_OPTIMIZED         = $80000000;
  7195.   D3DVBCAPS_DONOTCLIP         = $00000001;
  7196.  
  7197. (* Vertex Operations for ProcessVertices *)
  7198.   D3DVOP_LIGHT      = (1 shl 10);
  7199.   D3DVOP_TRANSFORM  = (1 shl 0);
  7200.   D3DVOP_CLIP       = (1 shl 2);
  7201.   D3DVOP_EXTENTS    = (1 shl 3);
  7202.  
  7203. (* The maximum number of vertices user can pass to any d3d
  7204.    drawing function or to create vertex buffer with
  7205. *)
  7206.   D3DMAXNUMVERTICES  =  ((1 shl 16) - 1);
  7207. (* The maximum number of primitives user can pass to any d3d
  7208.    drawing function.
  7209. *)
  7210.   D3DMAXNUMPRIMITIVES = ((1 shl 16) - 1);
  7211.  
  7212. (* Bits for dwFlags in ProcessVertices call *)
  7213.   D3DPV_DONOTCOPYDATA = (1 shl 0);
  7214.  
  7215. //-------------------------------------------------------------------
  7216.  
  7217. // Flexible vertex format bits
  7218. //
  7219.   D3DFVF_RESERVED0        = $001;
  7220.   D3DFVF_POSITION_MASK    = $00E;
  7221.   D3DFVF_XYZ              = $002;
  7222.   D3DFVF_XYZRHW           = $004;
  7223.   D3DFVF_XYZB1            = $006;
  7224.   D3DFVF_XYZB2            = $008;
  7225.   D3DFVF_XYZB3            = $00a;
  7226.   D3DFVF_XYZB4            = $00c;
  7227.   D3DFVF_XYZB5            = $00e;
  7228.  
  7229.   D3DFVF_NORMAL           = $010;
  7230.   D3DFVF_RESERVED1        = $020;
  7231.   D3DFVF_DIFFUSE          = $040;
  7232.   D3DFVF_SPECULAR         = $080;
  7233.  
  7234.   D3DFVF_TEXCOUNT_MASK    = $f00;
  7235.   D3DFVF_TEXCOUNT_SHIFT   = 8;
  7236.   D3DFVF_TEX0             = $000;
  7237.   D3DFVF_TEX1             = $100;
  7238.   D3DFVF_TEX2             = $200;
  7239.   D3DFVF_TEX3             = $300;
  7240.   D3DFVF_TEX4             = $400;
  7241.   D3DFVF_TEX5             = $500;
  7242.   D3DFVF_TEX6             = $600;
  7243.   D3DFVF_TEX7             = $700;
  7244.   D3DFVF_TEX8             = $800;
  7245.  
  7246.   D3DFVF_RESERVED2        = $f000;  // 4 reserved bits
  7247.  
  7248.   D3DFVF_VERTEX = ( D3DFVF_XYZ or D3DFVF_NORMAL or D3DFVF_TEX1 );
  7249.   D3DFVF_LVERTEX = ( D3DFVF_XYZ or D3DFVF_RESERVED1 or D3DFVF_DIFFUSE or
  7250.                          D3DFVF_SPECULAR or D3DFVF_TEX1 );
  7251.   D3DFVF_TLVERTEX = ( D3DFVF_XYZRHW or D3DFVF_DIFFUSE or D3DFVF_SPECULAR or
  7252.                           D3DFVF_TEX1 );
  7253.  
  7254. type
  7255.   PD3DDP_PtrStride = ^TD3DDP_PtrStride;
  7256.   TD3DDP_PtrStride = packed record
  7257.     lpvData : pointer;
  7258.     dwStride : DWORD;
  7259.   end;
  7260.  
  7261. const
  7262.   D3DDP_MAXTEXCOORD = 8;
  7263.  
  7264. type
  7265.   PD3DDrawPrimitiveStridedData = ^TD3DDrawPrimitiveStridedData;
  7266.   TD3DDrawPrimitiveStridedData = packed record
  7267.     position : TD3DDP_PtrStride;
  7268.     normal : TD3DDP_PtrStride;
  7269.     diffuse : TD3DDP_PtrStride;
  7270.     specular : TD3DDP_PtrStride;
  7271.     textureCoords : array [0..D3DDP_MAXTEXCOORD-1] of TD3DDP_PtrStride;
  7272.   end;
  7273.  
  7274. //---------------------------------------------------------------------
  7275. // ComputeSphereVisibility return values
  7276. //
  7277. const
  7278.   D3DVIS_INSIDE_FRUSTUM      = 0;
  7279.   D3DVIS_INTERSECT_FRUSTUM   = 1;
  7280.   D3DVIS_OUTSIDE_FRUSTUM     = 2;
  7281.   D3DVIS_INSIDE_LEFT         = 0;
  7282.   D3DVIS_INTERSECT_LEFT      = (1 shl 2);
  7283.   D3DVIS_OUTSIDE_LEFT        = (2 shl 2);
  7284.   D3DVIS_INSIDE_RIGHT        = 0;
  7285.   D3DVIS_INTERSECT_RIGHT     = (1 shl 4);
  7286.   D3DVIS_OUTSIDE_RIGHT       = (2 shl 4);
  7287.   D3DVIS_INSIDE_TOP          = 0;
  7288.   D3DVIS_INTERSECT_TOP       = (1 shl 6);
  7289.   D3DVIS_OUTSIDE_TOP         = (2 shl 6);
  7290.   D3DVIS_INSIDE_BOTTOM       = 0;
  7291.   D3DVIS_INTERSECT_BOTTOM    = (1 shl 8);
  7292.   D3DVIS_OUTSIDE_BOTTOM      = (2 shl 8);
  7293.   D3DVIS_INSIDE_NEAR         = 0;
  7294.   D3DVIS_INTERSECT_NEAR      = (1 shl 10);
  7295.   D3DVIS_OUTSIDE_NEAR        = (2 shl 10);
  7296.   D3DVIS_INSIDE_FAR          = 0;
  7297.   D3DVIS_INTERSECT_FAR       = (1 shl 12);
  7298.   D3DVIS_OUTSIDE_FAR         = (2 shl 12);
  7299.  
  7300.   D3DVIS_MASK_FRUSTUM        = (3 shl 0);
  7301.   D3DVIS_MASK_LEFT           = (3 shl 2);
  7302.   D3DVIS_MASK_RIGHT          = (3 shl 4);
  7303.   D3DVIS_MASK_TOP            = (3 shl 6);
  7304.   D3DVIS_MASK_BOTTOM         = (3 shl 8);
  7305.   D3DVIS_MASK_NEAR           = (3 shl 10);
  7306.   D3DVIS_MASK_FAR            = (3 shl 12);
  7307.  
  7308. // To be used with GetInfo()
  7309.   D3DDEVINFOID_TEXTUREMANAGER    = 1;
  7310.   D3DDEVINFOID_D3DTEXTUREMANAGER = 2;
  7311.   D3DDEVINFOID_TEXTURING         = 3;
  7312.  
  7313. type
  7314.   PD3DStateBlockType = ^TD3DStateBlockType;
  7315.   TD3DStateBlockType = (
  7316.     D3DSBT_INVALID_0   ,
  7317.     D3DSBT_ALL         , // capture all state
  7318.     D3DSBT_PIXELSTATE  , // capture pixel state
  7319.     D3DSBT_VERTEXSTATE   // capture vertex state
  7320.   );
  7321.  
  7322. // The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state.
  7323. //
  7324.   PD3DVertexBlendFlags = ^TD3DVertexBlendFlags;
  7325.   TD3DVertexBlendFlags = (
  7326.     D3DVBLEND_DISABLE , // Disable vertex blending
  7327.     D3DVBLEND_1WEIGHT , // blend between 2 matrices
  7328.     D3DVBLEND_2WEIGHTS, // blend between 3 matrices
  7329.     D3DVBLEND_3WEIGHTS  // blend between 4 matrices
  7330.   );
  7331.  
  7332.   PD3DTextureTransformFlags = ^TD3DTextureTransformFlags;
  7333.   TD3DTextureTransformFlags = (
  7334.     D3DTTFF_DISABLE ,    // texture coordinates are passed directly
  7335.     D3DTTFF_COUNT1  ,    // rasterizer should expect 1-D texture coords
  7336.     D3DTTFF_COUNT2  ,    // rasterizer should expect 2-D texture coords
  7337.     D3DTTFF_COUNT3  ,    // rasterizer should expect 3-D texture coords
  7338.     D3DTTFF_COUNT4       // rasterizer should expect 4-D texture coords
  7339.   );
  7340.  
  7341. const
  7342.   D3DTTFF_PROJECTED       = TD3DTextureTransformFlags(256); // texcoords to be divided by COUNTth element
  7343.  
  7344. // Macros to set texture coordinate format bits in the FVF id
  7345.  
  7346. D3DFVF_TEXTUREFORMAT2 = 0;         // Two floating point values
  7347. D3DFVF_TEXTUREFORMAT1 = 3;         // One floating point value
  7348. D3DFVF_TEXTUREFORMAT3 = 1;         // Three floating point values
  7349. D3DFVF_TEXTUREFORMAT4 = 2;         // Four floating point values
  7350.  
  7351. function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD) : DWORD;
  7352. function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD) : DWORD;
  7353. function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD) : DWORD;
  7354. function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD) : DWORD;
  7355.  
  7356. (*==========================================================================;
  7357.  *
  7358.  *
  7359.  *  File:       d3dcaps.h
  7360.  *  Content:    Direct3D capabilities include file
  7361.  *
  7362.  ***************************************************************************)
  7363.  
  7364. (* Description of capabilities of transform *)
  7365.  
  7366. type
  7367.   PD3DTransformCaps = ^TD3DTransformCaps;
  7368.   TD3DTransformCaps = packed record
  7369.     dwSize: DWORD;
  7370.     dwCaps: DWORD;
  7371.   end;
  7372.  
  7373. const
  7374.   D3DTRANSFORMCAPS_CLIP         = $00000001; (* Will clip whilst transforming *)
  7375.  
  7376. (* Description of capabilities of lighting *)
  7377.  
  7378. type
  7379.   PD3DLightingCaps = ^TD3DLightingCaps;
  7380.   TD3DLightingCaps = packed record
  7381.     dwSize: DWORD;
  7382.     dwCaps: DWORD;                   (* Lighting caps *)
  7383.     dwLightingModel: DWORD;          (* Lighting model - RGB or mono *)
  7384.     dwNumLights: DWORD;              (* Number of lights that can be handled *)
  7385.   end;
  7386.  
  7387. const
  7388.   D3DLIGHTINGMODEL_RGB            = $00000001;
  7389.   D3DLIGHTINGMODEL_MONO           = $00000002;
  7390.  
  7391.   D3DLIGHTCAPS_POINT              = $00000001; (* Point lights supported *)
  7392.   D3DLIGHTCAPS_SPOT               = $00000002; (* Spot lights supported *)
  7393.   D3DLIGHTCAPS_DIRECTIONAL        = $00000004; (* Directional lights supported *)
  7394.   D3DLIGHTCAPS_PARALLELPOINT      = $00000008; (* Parallel point lights supported *)
  7395.   D3DLIGHTCAPS_GLSPOT             = $00000010; (* GL syle spot lights supported *)
  7396.  
  7397. (* Description of capabilities for each primitive type *)
  7398.  
  7399. type
  7400.   PD3DPrimCaps = ^TD3DPrimCaps;
  7401.   TD3DPrimCaps = packed record
  7402.     dwSize: DWORD;
  7403.     dwMiscCaps: DWORD;                 (* Capability flags *)
  7404.     dwRasterCaps: DWORD;
  7405.     dwZCmpCaps: DWORD;
  7406.     dwSrcBlendCaps: DWORD;
  7407.     dwDestBlendCaps: DWORD;
  7408.     dwAlphaCmpCaps: DWORD;
  7409.     dwShadeCaps: DWORD;
  7410.     dwTextureCaps: DWORD;
  7411.     dwTextureFilterCaps: DWORD;
  7412.     dwTextureBlendCaps: DWORD;
  7413.     dwTextureAddressCaps: DWORD;
  7414.     dwStippleWidth: DWORD;             (* maximum width and height of *)
  7415.     dwStippleHeight: DWORD;            (* of supported stipple (up to 32x32) *)
  7416.   end;
  7417.  
  7418. const
  7419. (* TD3DPrimCaps dwMiscCaps *)
  7420.  
  7421.   D3DPMISCCAPS_MASKPLANES         = $00000001;
  7422.   D3DPMISCCAPS_MASKZ              = $00000002;
  7423.   D3DPMISCCAPS_LINEPATTERNREP     = $00000004;
  7424.   D3DPMISCCAPS_CONFORMANT         = $00000008;
  7425.   D3DPMISCCAPS_CULLNONE           = $00000010;
  7426.   D3DPMISCCAPS_CULLCW             = $00000020;
  7427.   D3DPMISCCAPS_CULLCCW            = $00000040;
  7428.  
  7429. (* TD3DPrimCaps dwRasterCaps *)
  7430.  
  7431.   D3DPRASTERCAPS_DITHER           = $00000001;
  7432.   D3DPRASTERCAPS_ROP2             = $00000002;
  7433.   D3DPRASTERCAPS_XOR              = $00000004;
  7434.   D3DPRASTERCAPS_PAT              = $00000008;
  7435.   D3DPRASTERCAPS_ZTEST            = $00000010;
  7436.   D3DPRASTERCAPS_SUBPIXEL         = $00000020;
  7437.   D3DPRASTERCAPS_SUBPIXELX        = $00000040;
  7438.   D3DPRASTERCAPS_FOGVERTEX        = $00000080;
  7439.   D3DPRASTERCAPS_FOGTABLE         = $00000100;
  7440.   D3DPRASTERCAPS_STIPPLE          = $00000200;
  7441.   D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT   = $00000400;
  7442.   D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT = $00000800;
  7443.   D3DPRASTERCAPS_ANTIALIASEDGES           = $00001000;
  7444.   D3DPRASTERCAPS_MIPMAPLODBIAS            = $00002000;
  7445.   D3DPRASTERCAPS_ZBIAS                    = $00004000;
  7446.   D3DPRASTERCAPS_ZBUFFERLESSHSR           = $00008000;
  7447.   D3DPRASTERCAPS_FOGRANGE                 = $00010000;
  7448.   D3DPRASTERCAPS_ANISOTROPY               = $00020000;
  7449.   D3DPRASTERCAPS_WBUFFER                      = $00040000;
  7450.   D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT   = $00080000;
  7451.   D3DPRASTERCAPS_WFOG                         = $00100000;
  7452.   D3DPRASTERCAPS_ZFOG                         = $00200000;
  7453.  
  7454. (* TD3DPrimCaps dwZCmpCaps, dwAlphaCmpCaps *)
  7455.  
  7456. const
  7457.   D3DPCMPCAPS_NEVER               = $00000001;
  7458.   D3DPCMPCAPS_LESS                = $00000002;
  7459.   D3DPCMPCAPS_EQUAL               = $00000004;
  7460.   D3DPCMPCAPS_LESSEQUAL           = $00000008;
  7461.   D3DPCMPCAPS_GREATER             = $00000010;
  7462.   D3DPCMPCAPS_NOTEQUAL            = $00000020;
  7463.   D3DPCMPCAPS_GREATEREQUAL        = $00000040;
  7464.   D3DPCMPCAPS_ALWAYS              = $00000080;
  7465.  
  7466. (* TD3DPrimCaps dwSourceBlendCaps, dwDestBlendCaps *)
  7467.  
  7468.   D3DPBLENDCAPS_ZERO              = $00000001;
  7469.   D3DPBLENDCAPS_ONE               = $00000002;
  7470.   D3DPBLENDCAPS_SRCCOLOR          = $00000004;
  7471.   D3DPBLENDCAPS_INVSRCCOLOR       = $00000008;
  7472.   D3DPBLENDCAPS_SRCALPHA          = $00000010;
  7473.   D3DPBLENDCAPS_INVSRCALPHA       = $00000020;
  7474.   D3DPBLENDCAPS_DESTALPHA         = $00000040;
  7475.   D3DPBLENDCAPS_INVDESTALPHA      = $00000080;
  7476.   D3DPBLENDCAPS_DESTCOLOR         = $00000100;
  7477.   D3DPBLENDCAPS_INVDESTCOLOR      = $00000200;
  7478.   D3DPBLENDCAPS_SRCALPHASAT       = $00000400;
  7479.   D3DPBLENDCAPS_BOTHSRCALPHA      = $00000800;
  7480.   D3DPBLENDCAPS_BOTHINVSRCALPHA   = $00001000;
  7481.  
  7482. (* TD3DPrimCaps dwShadeCaps *)
  7483.  
  7484.   D3DPSHADECAPS_COLORFLATMONO             = $00000001;
  7485.   D3DPSHADECAPS_COLORFLATRGB              = $00000002;
  7486.   D3DPSHADECAPS_COLORGOURAUDMONO          = $00000004;
  7487.   D3DPSHADECAPS_COLORGOURAUDRGB           = $00000008;
  7488.   D3DPSHADECAPS_COLORPHONGMONO            = $00000010;
  7489.   D3DPSHADECAPS_COLORPHONGRGB             = $00000020;
  7490.  
  7491.   D3DPSHADECAPS_SPECULARFLATMONO          = $00000040;
  7492.   D3DPSHADECAPS_SPECULARFLATRGB           = $00000080;
  7493.   D3DPSHADECAPS_SPECULARGOURAUDMONO       = $00000100;
  7494.   D3DPSHADECAPS_SPECULARGOURAUDRGB        = $00000200;
  7495.   D3DPSHADECAPS_SPECULARPHONGMONO         = $00000400;
  7496.   D3DPSHADECAPS_SPECULARPHONGRGB          = $00000800;
  7497.  
  7498.   D3DPSHADECAPS_ALPHAFLATBLEND            = $00001000;
  7499.   D3DPSHADECAPS_ALPHAFLATSTIPPLED         = $00002000;
  7500.   D3DPSHADECAPS_ALPHAGOURAUDBLEND         = $00004000;
  7501.   D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED      = $00008000;
  7502.   D3DPSHADECAPS_ALPHAPHONGBLEND           = $00010000;
  7503.   D3DPSHADECAPS_ALPHAPHONGSTIPPLED        = $00020000;
  7504.  
  7505.   D3DPSHADECAPS_FOGFLAT                   = $00040000;
  7506.   D3DPSHADECAPS_FOGGOURAUD                = $00080000;
  7507.   D3DPSHADECAPS_FOGPHONG                  = $00100000;
  7508.  
  7509. (* TD3DPrimCaps dwTextureCaps *)
  7510.  
  7511. (*
  7512.  * Perspective-correct texturing is supported
  7513.  *)
  7514.   D3DPTEXTURECAPS_PERSPECTIVE     = $00000001;
  7515.  
  7516. (*
  7517.  * Power-of-2 texture dimensions are required
  7518.  *)
  7519.   D3DPTEXTURECAPS_POW2            = $00000002;
  7520.  
  7521. (*
  7522.  * Alpha in texture pixels is supported
  7523.  *)
  7524.   D3DPTEXTURECAPS_ALPHA           = $00000004;
  7525.  
  7526. (*
  7527.  * Color-keyed textures are supported
  7528.  *)
  7529.   D3DPTEXTURECAPS_TRANSPARENCY    = $00000008;
  7530.  
  7531. (*
  7532.  * obsolete, see D3DPTADDRESSCAPS_BORDER
  7533.  *)
  7534.   D3DPTEXTURECAPS_BORDER          = $00000010;
  7535.  
  7536. (*
  7537.  * Only square textures are supported
  7538.  *)
  7539.   D3DPTEXTURECAPS_SQUAREONLY      = $00000020;
  7540.  
  7541. (*
  7542.  * Texture indices are not scaled by the texture size prior
  7543.  * to interpolation.
  7544.  *)
  7545.   D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040;
  7546.  
  7547. (*
  7548.  * Device can draw alpha from texture palettes
  7549.  *)
  7550.   D3DPTEXTURECAPS_ALPHAPALETTE    = $00000080;
  7551.  
  7552. (*
  7553.  * Device can use non-POW2 textures if:
  7554.  *  1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
  7555.  *  2) D3DRS_WRAP(N) is zero for this texture's coordinates
  7556.  *  3) mip mapping is not enabled (use magnification filter only)
  7557.  *)
  7558.   D3DPTEXTURECAPS_NONPOW2CONDITIONAL  = $00000100;
  7559.  
  7560. // 0x00000200L unused
  7561.  
  7562. (*
  7563.  * Device can divide transformed texture coordinates by the
  7564.  * COUNTth texture coordinate (can do D3DTTFF_PROJECTED)
  7565.  *)
  7566.   D3DPTEXTURECAPS_PROJECTED  = $00000400;
  7567.  
  7568. (*
  7569.  * Device can do cubemap textures
  7570.  *)
  7571.   D3DPTEXTURECAPS_CUBEMAP           = $00000800;
  7572.  
  7573.   D3DPTEXTURECAPS_COLORKEYBLEND     = $00001000;
  7574.  
  7575.  
  7576. (* TD3DPrimCaps dwTextureFilterCaps *)
  7577.  
  7578.   D3DPTFILTERCAPS_NEAREST         = $00000001;
  7579.   D3DPTFILTERCAPS_LINEAR          = $00000002;
  7580.   D3DPTFILTERCAPS_MIPNEAREST      = $00000004;
  7581.   D3DPTFILTERCAPS_MIPLINEAR       = $00000008;
  7582.   D3DPTFILTERCAPS_LINEARMIPNEAREST = $00000010;
  7583.   D3DPTFILTERCAPS_LINEARMIPLINEAR = $00000020;
  7584.  
  7585. (* Device3 Min Filter *)
  7586.   D3DPTFILTERCAPS_MINFPOINT       = $00000100;
  7587.   D3DPTFILTERCAPS_MINFLINEAR      = $00000200;
  7588.   D3DPTFILTERCAPS_MINFANISOTROPIC = $00000400;
  7589.  
  7590. (* Device3 Mip Filter *)
  7591.   D3DPTFILTERCAPS_MIPFPOINT       = $00010000;
  7592.   D3DPTFILTERCAPS_MIPFLINEAR      = $00020000;
  7593.  
  7594. (* Device3 Mag Filter *)
  7595.   D3DPTFILTERCAPS_MAGFPOINT         = $01000000;
  7596.   D3DPTFILTERCAPS_MAGFLINEAR        = $02000000;
  7597.   D3DPTFILTERCAPS_MAGFANISOTROPIC   = $04000000;
  7598.   D3DPTFILTERCAPS_MAGFAFLATCUBIC    = $08000000;
  7599.   D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC = $10000000;
  7600.  
  7601. (* TD3DPrimCaps dwTextureBlendCaps *)
  7602.  
  7603.   D3DPTBLENDCAPS_DECAL            = $00000001;
  7604.   D3DPTBLENDCAPS_MODULATE         = $00000002;
  7605.   D3DPTBLENDCAPS_DECALALPHA       = $00000004;
  7606.   D3DPTBLENDCAPS_MODULATEALPHA    = $00000008;
  7607.   D3DPTBLENDCAPS_DECALMASK        = $00000010;
  7608.   D3DPTBLENDCAPS_MODULATEMASK     = $00000020;
  7609.   D3DPTBLENDCAPS_COPY             = $00000040;
  7610.   D3DPTBLENDCAPS_ADD                      = $00000080;
  7611.  
  7612. (* TD3DPrimCaps dwTextureAddressCaps *)
  7613.   D3DPTADDRESSCAPS_WRAP           = $00000001;
  7614.   D3DPTADDRESSCAPS_MIRROR         = $00000002;
  7615.   D3DPTADDRESSCAPS_CLAMP          = $00000004;
  7616.   D3DPTADDRESSCAPS_BORDER         = $00000008;
  7617.   D3DPTADDRESSCAPS_INDEPENDENTUV  = $00000010;
  7618.  
  7619. (* D3DDEVICEDESC dwStencilCaps *)
  7620.  
  7621.   D3DSTENCILCAPS_KEEP     = $00000001;
  7622.   D3DSTENCILCAPS_ZERO     = $00000002;
  7623.   D3DSTENCILCAPS_REPLACE  = $00000004;
  7624.   D3DSTENCILCAPS_INCRSAT  = $00000008;
  7625.   D3DSTENCILCAPS_DECRSAT  = $00000010;
  7626.   D3DSTENCILCAPS_INVERT   = $00000020;
  7627.   D3DSTENCILCAPS_INCR     = $00000040;
  7628.   D3DSTENCILCAPS_DECR     = $00000080;
  7629.  
  7630. (* D3DDEVICEDESC dwTextureOpCaps *)
  7631.  
  7632.   D3DTEXOPCAPS_DISABLE                    = $00000001;
  7633.   D3DTEXOPCAPS_SELECTARG1                 = $00000002;
  7634.   D3DTEXOPCAPS_SELECTARG2                 = $00000004;
  7635.   D3DTEXOPCAPS_MODULATE                   = $00000008;
  7636.   D3DTEXOPCAPS_MODULATE2X                 = $00000010;
  7637.   D3DTEXOPCAPS_MODULATE4X                 = $00000020;
  7638.   D3DTEXOPCAPS_ADD                        = $00000040;
  7639.   D3DTEXOPCAPS_ADDSIGNED                  = $00000080;
  7640.   D3DTEXOPCAPS_ADDSIGNED2X                = $00000100;
  7641.   D3DTEXOPCAPS_SUBTRACT                   = $00000200;
  7642.   D3DTEXOPCAPS_ADDSMOOTH                  = $00000400;
  7643.   D3DTEXOPCAPS_BLENDDIFFUSEALPHA          = $00000800;
  7644.   D3DTEXOPCAPS_BLENDTEXTUREALPHA          = $00001000;
  7645.   D3DTEXOPCAPS_BLENDFACTORALPHA           = $00002000;
  7646.   D3DTEXOPCAPS_BLENDTEXTUREALPHAPM        = $00004000;
  7647.   D3DTEXOPCAPS_BLENDCURRENTALPHA          = $00008000;
  7648.   D3DTEXOPCAPS_PREMODULATE                = $00010000;
  7649.   D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR     = $00020000;
  7650.   D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA     = $00040000;
  7651.   D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR  = $00080000;
  7652.   D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA  = $00100000;
  7653.   D3DTEXOPCAPS_BUMPENVMAP                 = $00200000;
  7654.   D3DTEXOPCAPS_BUMPENVMAPLUMINANCE        = $00400000;
  7655.   D3DTEXOPCAPS_DOTPRODUCT3                = $00800000;
  7656.  
  7657. (* D3DDEVICEDESC dwFVFCaps flags *)
  7658.  
  7659.   D3DFVFCAPS_TEXCOORDCOUNTMASK    = $0000ffff; (* mask for texture coordinate count field *)
  7660.   D3DFVFCAPS_DONOTSTRIPELEMENTS   = $00080000; (* Device prefers that vertex elements not be stripped *)
  7661.  
  7662. (*
  7663.  * Description for a device.
  7664.  * This is used to describe a device that is to be created or to query
  7665.  * the current device.
  7666.  *)
  7667.  
  7668. type
  7669.   PD3DDeviceDesc = ^TD3DDeviceDesc;
  7670.   TD3DDeviceDesc = packed record
  7671.     dwSize: DWORD;                       (* Size of TD3DDeviceDesc structure *)
  7672.     dwFlags: DWORD;                      (* Indicates which fields have valid data *)
  7673.     dcmColorModel: TD3DColorModel;        (* Color model of device *)
  7674.     dwDevCaps: DWORD;                    (* Capabilities of device *)
  7675.     dtcTransformCaps: TD3DTransformCaps;  (* Capabilities of transform *)
  7676.     bClipping: BOOL;                     (* Device can do 3D clipping *)
  7677.     dlcLightingCaps: TD3DLightingCaps;    (* Capabilities of lighting *)
  7678.     dpcLineCaps: TD3DPrimCaps;
  7679.     dpcTriCaps: TD3DPrimCaps;
  7680.     dwDeviceRenderBitDepth: DWORD;       (* One of DDBB_8, 16, etc.. *)
  7681.     dwDeviceZBufferBitDepth: DWORD;      (* One of DDBD_16, 32, etc.. *)
  7682.     dwMaxBufferSize: DWORD;              (* Maximum execute buffer size *)
  7683.     dwMaxVertexCount: DWORD;             (* Maximum vertex count *)
  7684.     // *** New fields for DX5 *** //
  7685.  
  7686.     // Width and height caps are 0 for legacy HALs.
  7687.     dwMinTextureWidth, dwMinTextureHeight  : DWORD;
  7688.     dwMaxTextureWidth, dwMaxTextureHeight  : DWORD;
  7689.     dwMinStippleWidth, dwMaxStippleWidth   : DWORD;
  7690.     dwMinStippleHeight, dwMaxStippleHeight : DWORD;
  7691.  
  7692.     // New fields for DX6
  7693.     dwMaxTextureRepeat : DWORD;
  7694.     dwMaxTextureAspectRatio : DWORD;
  7695.     dwMaxAnisotropy : DWORD;
  7696.  
  7697.     // Guard band that the rasterizer can accommodate
  7698.     // Screen-space vertices inside this space but outside the viewport
  7699.     // will get clipped properly.
  7700.     dvGuardBandLeft : TD3DValue;
  7701.     dvGuardBandTop : TD3DValue;
  7702.     dvGuardBandRight : TD3DValue;
  7703.     dvGuardBandBottom : TD3DValue;
  7704.  
  7705.     dvExtentsAdjust : TD3DValue;
  7706.     dwStencilCaps : DWORD;
  7707.  
  7708.     dwFVFCaps : DWORD;  (* low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware *)
  7709.     dwTextureOpCaps : DWORD;
  7710.     wMaxTextureBlendStages : WORD;
  7711.     wMaxSimultaneousTextures : WORD;
  7712.   end;
  7713.  
  7714.   PD3DDeviceDesc7 = ^TD3DDeviceDesc7;
  7715.   TD3DDeviceDesc7 = packed record
  7716.     dwDevCaps:               DWORD;             (* Capabilities of device *)
  7717.     dpcLineCaps:             TD3DPrimCaps;
  7718.     dpcTriCaps:              TD3DPrimCaps;
  7719.     dwDeviceRenderBitDepth:  DWORD;             (* One of DDBB_8, 16, etc.. *)
  7720.     dwDeviceZBufferBitDepth: DWORD;             (* One of DDBD_16, 32, etc.. *)
  7721.  
  7722.     dwMinTextureWidth, dwMinTextureHeight: DWORD;
  7723.     dwMaxTextureWidth, dwMaxTextureHeight: DWORD;
  7724.  
  7725.     dwMaxTextureRepeat:                    DWORD;
  7726.     dwMaxTextureAspectRatio:               DWORD;
  7727.     dwMaxAnisotropy:                       DWORD;
  7728.  
  7729.     dvGuardBandLeft:                       TD3DValue;
  7730.     dvGuardBandTop:                        TD3DValue;
  7731.     dvGuardBandRight:                      TD3DValue;
  7732.     dvGuardBandBottom:                     TD3DValue;
  7733.  
  7734.     dvExtentsAdjust:                       TD3DValue;
  7735.     dwStencilCaps:                         DWORD;
  7736.  
  7737.     dwFVFCaps:                             DWORD;
  7738.     dwTextureOpCaps:                       DWORD;
  7739.     wMaxTextureBlendStages:                WORD;
  7740.     wMaxSimultaneousTextures:              WORD;
  7741.  
  7742.     dwMaxActiveLights:                     DWORD;
  7743.     dvMaxVertexW:                          TD3DValue;
  7744.     deviceGUID:                            TGUID;
  7745.  
  7746.     wMaxUserClipPlanes:                    WORD;
  7747.     wMaxVertexBlendMatrices:               WORD;
  7748.  
  7749.     dwVertexProcessingCaps:                DWORD;
  7750.  
  7751.     dwReserved1:                           DWORD;
  7752.     dwReserved2:                           DWORD;
  7753.     dwReserved3:                           DWORD;
  7754.     dwReserved4:                           DWORD;
  7755.   end;
  7756.  
  7757. const
  7758.   D3DDEVICEDESCSIZE = sizeof(TD3DDeviceDesc);
  7759.   D3DDEVICEDESC7SIZE = sizeof(TD3DDeviceDesc7);
  7760.  
  7761. type
  7762.   TD3DEnumDevicesCallbackA = function (lpGuid: PGUID; // nil for the default device
  7763.       lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
  7764.       var lpD3DHWDeviceDesc: TD3DDeviceDesc;
  7765.       var lpD3DHELDeviceDesc: TD3DDeviceDesc;
  7766.       lpContext : pointer) : HResult; stdcall;
  7767.   TD3DEnumDevicesCallback = TD3DEnumDevicesCallbackA;
  7768.  
  7769.   TD3DEnumDevicesCallback7A = function (
  7770.       lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
  7771.       const lpD3DDeviceDesc: TD3DDeviceDesc7; lpContext: Pointer) : HResult; stdcall;
  7772.   TD3DEnumDevicesCallback7 = TD3DEnumDevicesCallback7A;
  7773.  
  7774. (* TD3DDeviceDesc dwFlags indicating valid fields *)
  7775.  
  7776. const
  7777.   D3DDD_COLORMODEL            = $00000001; (* dcmColorModel is valid *)
  7778.   D3DDD_DEVCAPS               = $00000002; (* dwDevCaps is valid *)
  7779.   D3DDD_TRANSFORMCAPS         = $00000004; (* dtcTransformCaps is valid *)
  7780.   D3DDD_LIGHTINGCAPS          = $00000008; (* dlcLightingCaps is valid *)
  7781.   D3DDD_BCLIPPING             = $00000010; (* bClipping is valid *)
  7782.   D3DDD_LINECAPS              = $00000020; (* dpcLineCaps is valid *)
  7783.   D3DDD_TRICAPS               = $00000040; (* dpcTriCaps is valid *)
  7784.   D3DDD_DEVICERENDERBITDEPTH  = $00000080; (* dwDeviceRenderBitDepth is valid *)
  7785.   D3DDD_DEVICEZBUFFERBITDEPTH = $00000100; (* dwDeviceZBufferBitDepth is valid *)
  7786.   D3DDD_MAXBUFFERSIZE         = $00000200; (* dwMaxBufferSize is valid *)
  7787.   D3DDD_MAXVERTEXCOUNT        = $00000400; (* dwMaxVertexCount is valid *)
  7788.  
  7789. (* TD3DDeviceDesc dwDevCaps flags *)
  7790.  
  7791.   D3DDEVCAPS_FLOATTLVERTEX        = $00000001; (* Device accepts floating point *)
  7792.                                                     (* for post-transform vertex data *)
  7793.   D3DDEVCAPS_SORTINCREASINGZ      = $00000002; (* Device needs data sorted for increasing Z*)
  7794.   D3DDEVCAPS_SORTDECREASINGZ      = $00000004; (* Device needs data sorted for decreasing Z*)
  7795.   D3DDEVCAPS_SORTEXACT            = $00000008; (* Device needs data sorted exactly *)
  7796.  
  7797.   D3DDEVCAPS_EXECUTESYSTEMMEMORY  = $00000010; (* Device can use execute buffers from system memory *)
  7798.   D3DDEVCAPS_EXECUTEVIDEOMEMORY   = $00000020; (* Device can use execute buffers from video memory *)
  7799.   D3DDEVCAPS_TLVERTEXSYSTEMMEMORY = $00000040; (* Device can use TL buffers from system memory *)
  7800.   D3DDEVCAPS_TLVERTEXVIDEOMEMORY  = $00000080; (* Device can use TL buffers from video memory *)
  7801.   D3DDEVCAPS_TEXTURESYSTEMMEMORY  = $00000100; (* Device can texture from system memory *)
  7802.   D3DDEVCAPS_TEXTUREVIDEOMEMORY   = $00000200; (* Device can texture from device memory *)
  7803.   D3DDEVCAPS_DRAWPRIMTLVERTEX     = $00000400; (* Device can draw TLVERTEX primitives *)
  7804.   D3DDEVCAPS_CANRENDERAFTERFLIP   = $00000800; (* Device can render without waiting for flip to complete *)
  7805.   D3DDEVCAPS_TEXTURENONLOCALVIDMEM   = $00001000; (* Device can texture from nonlocal video memory *)
  7806.   D3DDEVCAPS_DRAWPRIMITIVES2         = $00002000; (* Device can support DrawPrimitives2 *)
  7807.   D3DDEVCAPS_SEPARATETEXTUREMEMORIES = $00004000; (* Device is texturing from separate memory pools *)
  7808.   D3DDEVCAPS_DRAWPRIMITIVES2EX       = $00008000; (* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*)
  7809.   D3DDEVCAPS_HWTRANSFORMANDLIGHT     = $00010000; (* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also *)
  7810.   D3DDEVCAPS_CANBLTSYSTONONLOCAL     = $00020000; (* Device supports a Tex Blt from system memory to non-local vidmem *)
  7811.   D3DDEVCAPS_HWRASTERIZATION         = $00080000; (* Device has HW acceleration for rasterization *)
  7812.  
  7813. (*
  7814.  * These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field
  7815.  *)
  7816.  
  7817. (* device can do texgen *)
  7818.   D3DVTXPCAPS_TEXGEN              = $00000001;
  7819. (* device can do IDirect3DDevice7 colormaterialsource ops *)
  7820.   D3DVTXPCAPS_MATERIALSOURCE7     = $00000002;
  7821. (* device can do vertex fog *)
  7822.   D3DVTXPCAPS_VERTEXFOG           = $00000004;
  7823. (* device can do directional lights *)
  7824.   D3DVTXPCAPS_DIRECTIONALLIGHTS   = $00000008;
  7825. (* device can do positional lights (includes point and spot) *)
  7826.   D3DVTXPCAPS_POSITIONALLIGHTS    = $00000010;
  7827. (* device can do local viewer *)
  7828.   D3DVTXPCAPS_LOCALVIEWER         = $00000020;
  7829.  
  7830.   D3DFDS_COLORMODEL        = $00000001; (* Match color model *)
  7831.   D3DFDS_GUID              = $00000002; (* Match guid *)
  7832.   D3DFDS_HARDWARE          = $00000004; (* Match hardware/software *)
  7833.   D3DFDS_TRIANGLES         = $00000008; (* Match in triCaps *)
  7834.   D3DFDS_LINES             = $00000010; (* Match in lineCaps  *)
  7835.   D3DFDS_MISCCAPS          = $00000020; (* Match primCaps.dwMiscCaps *)
  7836.   D3DFDS_RASTERCAPS        = $00000040; (* Match primCaps.dwRasterCaps *)
  7837.   D3DFDS_ZCMPCAPS          = $00000080; (* Match primCaps.dwZCmpCaps *)
  7838.   D3DFDS_ALPHACMPCAPS      = $00000100; (* Match primCaps.dwAlphaCmpCaps *)
  7839.   D3DFDS_SRCBLENDCAPS      = $00000200; (* Match primCaps.dwSourceBlendCaps *)
  7840.   D3DFDS_DSTBLENDCAPS      = $00000400; (* Match primCaps.dwDestBlendCaps *)
  7841.   D3DFDS_SHADECAPS         = $00000800; (* Match primCaps.dwShadeCaps *)
  7842.   D3DFDS_TEXTURECAPS       = $00001000; (* Match primCaps.dwTextureCaps *)
  7843.   D3DFDS_TEXTUREFILTERCAPS = $00002000; (* Match primCaps.dwTextureFilterCaps *)
  7844.   D3DFDS_TEXTUREBLENDCAPS  = $00004000; (* Match primCaps.dwTextureBlendCaps *)
  7845.   D3DFDS_TEXTUREADDRESSCAPS  = $00008000; (* Match primCaps.dwTextureBlendCaps *)
  7846.  
  7847. (*
  7848.  * FindDevice arguments
  7849.  *)
  7850. type
  7851.   PD3DFindDeviceSearch = ^TD3DFindDeviceSearch;
  7852.   TD3DFindDeviceSearch = packed record
  7853.     dwSize: DWORD;
  7854.     dwFlags: DWORD;
  7855.     bHardware: BOOL;
  7856.     dcmColorModel: TD3DColorModel;
  7857.     guid: TGUID;
  7858.     dwCaps: DWORD;
  7859.     dpcPrimCaps: TD3DPrimCaps;
  7860.   end;
  7861.  
  7862.   PD3DFindDeviceResult = ^TD3DFindDeviceResult;
  7863.   TD3DFindDeviceResult = packed record
  7864.     dwSize: DWORD;
  7865.     guid: TGUID;               (* guid which matched *)
  7866.     ddHwDesc: TD3DDeviceDesc;   (* hardware TD3DDeviceDesc *)
  7867.     ddSwDesc: TD3DDeviceDesc;   (* software TD3DDeviceDesc *)
  7868.   end;
  7869.  
  7870. (*
  7871.  * Description of execute buffer.
  7872.  *)
  7873.   PD3DExecuteBufferDesc = ^TD3DExecuteBufferDesc;
  7874.   TD3DExecuteBufferDesc = packed record
  7875.     dwSize: DWORD;         (* size of this structure *)
  7876.     dwFlags: DWORD;        (* flags indicating which fields are valid *)
  7877.     dwCaps: DWORD;         (* capabilities of execute buffer *)
  7878.     dwBufferSize: DWORD;   (* size of execute buffer data *)
  7879.     lpData: Pointer;       (* pointer to actual data *)
  7880.   end;
  7881.  
  7882. (* D3DEXECUTEBUFFER dwFlags indicating valid fields *)
  7883.  
  7884. const
  7885.   D3DDEB_BUFSIZE          = $00000001;     (* buffer size valid *)
  7886.   D3DDEB_CAPS             = $00000002;     (* caps valid *)
  7887.   D3DDEB_LPDATA           = $00000004;     (* lpData valid *)
  7888.  
  7889. (* D3DEXECUTEBUFFER dwCaps *)
  7890.  
  7891.   D3DDEBCAPS_SYSTEMMEMORY = $00000001;     (* buffer in system memory *)
  7892.   D3DDEBCAPS_VIDEOMEMORY  = $00000002;     (* buffer in device memory *)
  7893.   D3DDEBCAPS_MEM          = (D3DDEBCAPS_SYSTEMMEMORY or D3DDEBCAPS_VIDEOMEMORY);
  7894.  
  7895. type
  7896.   PD3DDevInfo_TextureManager = ^TD3DDevInfo_TextureManager;
  7897.   TD3DDevInfo_TextureManager = packed record
  7898.     bThrashing:              BOOL;       (* indicates if thrashing *)
  7899.     dwApproxBytesDownloaded: DWORD;      (* Approximate number of bytes downloaded by texture manager *)
  7900.     dwNumEvicts:             DWORD;      (* number of textures evicted *)
  7901.     dwNumVidCreates:         DWORD;      (* number of textures created in video memory *)
  7902.     dwNumTexturesUsed:       DWORD;      (* number of textures used *)
  7903.     dwNumUsedTexInVid:       DWORD;      (* number of used textures present in video memory *)
  7904.     dwWorkingSet:            DWORD;      (* number of textures in video memory *)
  7905.     dwWorkingSetBytes:       DWORD;      (* number of bytes in video memory *)
  7906.     dwTotalManaged:          DWORD;      (* total number of managed textures *)
  7907.     dwTotalBytes:            DWORD;      (* total number of bytes of managed textures *)
  7908.     dwLastPri:               DWORD;      (* priority of last texture evicted *)
  7909.   end;
  7910.  
  7911.   PD3DDevInfo_Texturing = ^TD3DDevInfo_Texturing;
  7912.   TD3DDevInfo_Texturing = packed record
  7913.     dwNumLoads:          DWORD;          (* counts Load() API calls *)
  7914.     dwApproxBytesLoaded: DWORD;          (* Approximate number bytes loaded via Load() *)
  7915.     dwNumPreLoads:       DWORD;          (* counts PreLoad() API calls *)
  7916.     dwNumSet:            DWORD;          (* counts SetTexture() API calls *)
  7917.     dwNumCreates:        DWORD;          (* counts texture creates *)
  7918.     dwNumDestroys:       DWORD;          (* counts texture destroys *)
  7919.     dwNumSetPriorities:  DWORD;          (* counts SetPriority() API calls *)
  7920.     dwNumSetLODs:        DWORD;          (* counts SetLOD() API calls *)
  7921.     dwNumLocks:          DWORD;          (* counts number of texture locks *)
  7922.     dwNumGetDCs:         DWORD;          (* counts number of GetDCs to textures *)
  7923.   end;
  7924.  
  7925. (*==========================================================================;
  7926.  *
  7927.  *
  7928.  *  File:   d3d.h
  7929.  *  Content:    Direct3D include file
  7930.  *
  7931.  ****************************************************************************)
  7932.  
  7933. function D3DErrorString(Value: HResult) : string;
  7934.  
  7935. (*
  7936.  * Interface IID's
  7937.  *)
  7938.  
  7939. const
  7940. (*
  7941.  * Internal Guid to distinguish requested MMX from MMX being used as an RGB rasterizer
  7942.  *)
  7943.   IID_IDirect3DRampDevice: TGUID =
  7944.       (D1:$F2086B20;D2:$259F;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
  7945.   IID_IDirect3DRGBDevice: TGUID =
  7946.       (D1:$A4665C60;D2:$2673;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
  7947.   IID_IDirect3DHALDevice: TGUID =
  7948.       (D1:$84E63dE0;D2:$46AA;D3:$11CF;D4:($81,$6F,$00,$00,$C0,$20,$15,$6E));
  7949.   IID_IDirect3DMMXDevice: TGUID =
  7950.       (D1:$881949a1;D2:$d6f3;D3:$11d0;D4:($89,$ab,$00,$a0,$c9,$05,$41,$29));
  7951.  
  7952.   IID_IDirect3DRefDevice: TGUID =
  7953.       (D1:$50936643;D2:$13e9;D3:$11d1;D4:($89,$aa,$00,$a0,$c9,$05,$41,$29));
  7954.   IID_IDirect3DNullDevice: TGUID =
  7955.       (D1:$8767df22;D2:$bacc;D3:$11d1;D4:($89,$69,$00,$a0,$c9,$06,$29,$a8));
  7956.  
  7957.   IID_IDirect3DTnLHalDevice: TGUID = '{f5049e78-4861-11d2-a407-00a0c90629a8}';
  7958.  
  7959. type
  7960.   IDirect3D = interface;
  7961.   IDirect3D2 = interface;
  7962.   IDirect3D3 = interface;
  7963.   IDirect3D7 = interface;
  7964.   IDirect3DDevice = interface;
  7965.   IDirect3DDevice2 = interface;
  7966.   IDirect3DDevice3 = interface;
  7967.   IDirect3DDevice7 = interface;
  7968.   IDirect3DExecuteBuffer = interface;
  7969.   IDirect3DLight = interface;
  7970.   IDirect3DMaterial = interface;
  7971.   IDirect3DMaterial2 = interface;
  7972.   IDirect3DMaterial3 = interface;
  7973.   IDirect3DTexture = interface;
  7974.   IDirect3DTexture2 = interface;
  7975.   IDirect3DViewport = interface;
  7976.   IDirect3DViewport2 = interface;
  7977.   IDirect3DViewport3 = interface;
  7978.   IDirect3DVertexBuffer = interface;
  7979.   IDirect3DVertexBuffer7 = interface;
  7980.  
  7981. (*
  7982.  * Direct3D interfaces
  7983.  *)
  7984.  
  7985.   IDirect3D = interface (IUnknown)
  7986.     ['{3BBA0080-2421-11CF-A31A-00AA00B93356}']
  7987.     (*** IDirect3D methods ***)
  7988.     function Initialize (lpREFIID: {REFIID} PGUID) : HResult; stdcall;
  7989.     function EnumDevices (lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  7990.         lpUserArg: Pointer) : HResult; stdcall;
  7991.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  7992.         pUnkOuter: IUnknown) : HResult; stdcall;
  7993.     function CreateMaterial (var lplpDirect3DMaterial: IDirect3DMaterial;
  7994.         pUnkOuter: IUnknown) : HResult; stdcall;
  7995.     function CreateViewport (var lplpD3DViewport: IDirect3DViewport;
  7996.         pUnkOuter: IUnknown) : HResult; stdcall;
  7997.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  7998.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  7999.   end;
  8000.  
  8001.   IDirect3D2 = interface (IUnknown)
  8002.     ['{6aae1ec1-662a-11d0-889d-00aa00bbb76a}']
  8003.     (*** IDirect3D2 methods ***)
  8004.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  8005.         lpUserArg: pointer) : HResult; stdcall;
  8006.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  8007.         pUnkOuter: IUnknown) : HResult; stdcall;
  8008.     function CreateMaterial (var lplpDirect3DMaterial2: IDirect3DMaterial2;
  8009.         pUnkOuter: IUnknown) : HResult; stdcall;
  8010.     function CreateViewport (var lplpD3DViewport2: IDirect3DViewport2;
  8011.         pUnkOuter: IUnknown) : HResult; stdcall;
  8012.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  8013.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  8014.     function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface;
  8015.         out lplpD3DDevice2: IDirect3DDevice2) : HResult; stdcall;
  8016.   end;
  8017.  
  8018.   IDirect3D3 = interface (IUnknown)
  8019.     ['{bb223240-e72b-11d0-a9b4-00aa00c0993e}']
  8020.     (*** IDirect3D3 methods ***)
  8021.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  8022.         lpUserArg: pointer) : HResult; stdcall;
  8023.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  8024.         pUnkOuter: IUnknown) : HResult; stdcall;
  8025.     function CreateMaterial (var lplpDirect3DMaterial3: IDirect3DMaterial3;
  8026.         pUnkOuter: IUnknown) : HResult; stdcall;
  8027.     function CreateViewport (var lplpD3DViewport3: IDirect3DViewport3;
  8028.         pUnkOuter: IUnknown) : HResult; stdcall;
  8029.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  8030.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  8031.     function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface4;
  8032.         out lplpD3DDevice: IDirect3DDevice3; pUnkOuter: IUnknown) : HResult; stdcall;
  8033.     function CreateVertexBuffer (var lpVBDesc: TD3DVertexBufferDesc;
  8034.         var lpD3DVertexBuffer: IDirect3DVertexBuffer;
  8035.         dwFlags: DWORD; pUnkOuter: IUnknown) : HResult; stdcall;
  8036.     function EnumZBufferFormats (const riidDevice: TRefClsID; lpEnumCallback:
  8037.         TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
  8038.     function EvictManagedTextures : HResult; stdcall;
  8039.   end;
  8040.  
  8041.   IDirect3D7 = interface (IUnknown)
  8042.     ['{f5049e77-4861-11d2-a407-00a0c90629a8}']
  8043.     (*** IDirect3D7 methods ***)
  8044.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback7;
  8045.         lpUserArg: pointer) : HResult; stdcall;
  8046.     function CreateDevice (const rclsid: TGUID; lpDDS: IDirectDrawSurface7;
  8047.         out lplpD3DDevice: IDirect3DDevice7) : HResult; stdcall;
  8048.     function CreateVertexBuffer (const lpVBDesc: TD3DVertexBufferDesc;
  8049.         out lplpD3DVertexBuffer: IDirect3DVertexBuffer7;
  8050.         dwFlags: DWORD) : HResult; stdcall;
  8051.     function EnumZBufferFormats (const riidDevice: TGUID; lpEnumCallback:
  8052.         TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
  8053.     function EvictManagedTextures : HResult; stdcall;
  8054.   end;
  8055.  
  8056. (*
  8057.  * Direct3D Device interfaces
  8058.  *)
  8059.  
  8060.   IDirect3DDevice = interface (IUnknown)
  8061.     ['{64108800-957d-11d0-89ab-00a0c9054129}']
  8062.     (*** IDirect3DDevice methods ***)
  8063.     function Initialize (lpd3d: IDirect3D; lpGUID: PGUID;
  8064.         var lpd3ddvdesc: TD3DDeviceDesc) : HResult; stdcall;
  8065.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8066.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8067.     function SwapTextureHandles (lpD3DTex1: IDirect3DTexture;
  8068.         lpD3DTex2: IDirect3DTexture) : HResult; stdcall;
  8069.     function CreateExecuteBuffer (var lpDesc: TD3DExecuteBufferDesc ;
  8070.         var lplpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8071.         pUnkOuter: IUnknown) : HResult; stdcall;
  8072.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8073.     function Execute (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8074.         lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
  8075.     function AddViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
  8076.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
  8077.     function NextViewport (lpDirect3DViewport: IDirect3DViewport;
  8078.         var lplpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
  8079.     function Pick (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8080.         lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD;
  8081.         var lpRect: TD3DRect) : HResult; stdcall;
  8082.     function GetPickRecords (var lpCount: DWORD;
  8083.         var lpD3DPickRec: TD3DPickRecord) : HResult; stdcall;
  8084.     function EnumTextureFormats (lpd3dEnumTextureProc:
  8085.         TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
  8086.         HResult; stdcall;
  8087.     function CreateMatrix (var lpD3DMatHandle: TD3DMatrixHandle) : HResult; stdcall;
  8088.     function SetMatrix (d3dMatHandle: TD3DMatrixHandle;
  8089.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8090.     function GetMatrix (var lpD3DMatHandle: TD3DMatrixHandle;
  8091.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8092.     function DeleteMatrix (d3dMatHandle: TD3DMatrixHandle) : HResult; stdcall;
  8093.     function BeginScene: HResult; stdcall;
  8094.     function EndScene: HResult; stdcall;
  8095.     function GetDirect3D (var lpD3D: IDirect3D) : HResult; stdcall;
  8096.   end;
  8097.  
  8098.   IDirect3DDevice2 = interface (IUnknown)
  8099.     ['{93281501-8cf8-11d0-89ab-00a0c9054129}']
  8100.     (*** IDirect3DDevice2 methods ***)
  8101.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8102.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8103.     function SwapTextureHandles (lpD3DTex1: IDirect3DTexture2;
  8104.         lpD3DTex2: IDirect3DTexture2) : HResult; stdcall;
  8105.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8106.     function AddViewport (lpDirect3DViewport2: IDirect3DViewport2) : HResult; stdcall;
  8107.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport2) : HResult; stdcall;
  8108.     function NextViewport (lpDirect3DViewport: IDirect3DViewport2;
  8109.         var lplpDirect3DViewport: IDirect3DViewport2; dwFlags: DWORD) :
  8110.         HResult; stdcall;
  8111.     function EnumTextureFormats (
  8112.         lpd3dEnumTextureProc: TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
  8113.         HResult; stdcall;
  8114.     function BeginScene: HResult; stdcall;
  8115.     function EndScene: HResult; stdcall;
  8116.     function GetDirect3D (var lpD3D: IDirect3D2) : HResult; stdcall;
  8117.  
  8118.     (*** DrawPrimitive API ***)
  8119.     function SetCurrentViewport (lpd3dViewport2: IDirect3DViewport2)
  8120.         : HResult; stdcall;
  8121.     function GetCurrentViewport (var lplpd3dViewport2: IDirect3DViewport2)
  8122.         : HResult; stdcall;
  8123.  
  8124.     function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface)
  8125.         : HResult; stdcall;
  8126.     function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface)
  8127.         : HResult; stdcall;
  8128.  
  8129.     function Begin_ (d3dpt: TD3DPrimitiveType; d3dvt: TD3DVertexType;
  8130.         dwFlags: DWORD) : HResult; stdcall;
  8131.     function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType; dvtVertexType:
  8132.         TD3DVertexType; lpvVertices: pointer; dwNumVertices: DWORD;
  8133.         dwFlags: DWORD) : HResult; stdcall;
  8134.     function Vertex (lpVertexType: pointer) : HResult;  stdcall;
  8135.     function Index (wVertexIndex: WORD) : HResult;  stdcall;
  8136.     function End_ (dwFlags: DWORD) : HResult; stdcall;
  8137.  
  8138.     function GetRenderState (dwRenderStateType: TD3DRenderStateType;
  8139.         var lpdwRenderState) : HResult; stdcall;
  8140.     function SetRenderState (dwRenderStateType: TD3DRenderStateType;
  8141.         dwRenderState: DWORD) : HResult; stdcall;
  8142.     function GetLightState (dwLightStateType: TD3DLightStateType;
  8143.         var lpdwLightState) : HResult; stdcall;
  8144.     function SetLightState (dwLightStateType: TD3DLightStateType;
  8145.         dwLightState: DWORD) : HResult; stdcall;
  8146.     function SetTransform (dtstTransformStateType: TD3DTransformStateType;
  8147.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8148.     function GetTransform (dtstTransformStateType: TD3DTransformStateType;
  8149.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8150.     function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
  8151.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8152.  
  8153.     function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8154.         dvtVertexType: TD3DVertexType; var lpvVertices; dwVertexCount,
  8155.         dwFlags: DWORD) : HResult; stdcall;
  8156.     function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8157.         dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwVertexCount: DWORD;
  8158.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8159.     function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8160.     function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8161.   end;
  8162.  
  8163.   IDirect3DDevice3 = interface (IUnknown)
  8164.     ['{b0ab3b60-33d7-11d1-a981-00c04fd7b174}']
  8165.     (*** IDirect3DDevice2 methods ***)
  8166.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8167.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8168.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8169.     function AddViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
  8170.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
  8171.     function NextViewport (lpDirect3DViewport: IDirect3DViewport3;
  8172.         var lplpAnotherViewport: IDirect3DViewport3; dwFlags: DWORD) : HResult; stdcall;
  8173.     function EnumTextureFormats (
  8174.         lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) :
  8175.         HResult; stdcall;
  8176.     function BeginScene: HResult; stdcall;
  8177.     function EndScene: HResult; stdcall;
  8178.     function GetDirect3D (var lpD3D: IDirect3D3) : HResult; stdcall;
  8179.     function SetCurrentViewport (lpd3dViewport: IDirect3DViewport3)
  8180.         : HResult; stdcall;
  8181.     function GetCurrentViewport (var lplpd3dViewport: IDirect3DViewport3)
  8182.         : HResult; stdcall;
  8183.     function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface4)
  8184.         : HResult; stdcall;
  8185.     function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface4)
  8186.         : HResult; stdcall;
  8187.     function Begin_ (d3dpt: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
  8188.         dwFlags: DWORD) : HResult; stdcall;
  8189.     function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType;
  8190.         dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwNumVertices: DWORD;
  8191.         dwFlags: DWORD) : HResult; stdcall;
  8192.     function Vertex (lpVertex: pointer) : HResult;  stdcall;
  8193.     function Index (wVertexIndex: WORD) : HResult;  stdcall;
  8194.     function End_ (dwFlags: DWORD) : HResult; stdcall;
  8195.     function GetRenderState (dwRenderStateType: TD3DRenderStateType;
  8196.         var lpdwRenderState) : HResult; stdcall;
  8197.     function SetRenderState (dwRenderStateType: TD3DRenderStateType;
  8198.         dwRenderState: DWORD) : HResult; stdcall;
  8199.     function GetLightState (dwLightStateType: TD3DLightStateType;
  8200.         var lpdwLightState) : HResult; stdcall;
  8201.     function SetLightState (dwLightStateType: TD3DLightStateType;
  8202.         dwLightState: DWORD) : HResult; stdcall;
  8203.     function SetTransform (dtstTransformStateType: TD3DTransformStateType;
  8204.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8205.     function GetTransform (dtstTransformStateType: TD3DTransformStateType;
  8206.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8207.     function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
  8208.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8209.     function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8210.         dwVertexTypeDesc: DWORD; const lpvVertices;
  8211.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8212.     function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8213.         dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
  8214.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8215.     function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8216.     function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8217.     function DrawPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
  8218.         dwVertexTypeDesc : DWORD;
  8219.         var lpVertexArray: TD3DDrawPrimitiveStridedData;
  8220.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8221.     function DrawIndexedPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
  8222.         dwVertexTypeDesc : DWORD;
  8223.         var lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
  8224.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8225.     function DrawPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
  8226.         lpd3dVertexBuffer: IDirect3DVertexBuffer;
  8227.         dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
  8228.     function DrawIndexedPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
  8229.         lpd3dVertexBuffer: IDirect3DVertexBuffer; var lpwIndices: WORD;
  8230.         dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8231.     function ComputeSphereVisibility (var lpCenters: TD3DVector;
  8232.         var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
  8233.         var lpdwReturnValues: DWORD) : HResult; stdcall;
  8234.     function GetTexture (dwStage: DWORD; var lplpTexture: IDirect3DTexture2)
  8235.         : HResult; stdcall;
  8236.     function SetTexture (dwStage: DWORD; lplpTexture: IDirect3DTexture2)
  8237.         : HResult; stdcall;
  8238.     function GetTextureStageState (dwStage: DWORD;
  8239.         dwState: TD3DTextureStageStateType; var lpdwValue: DWORD) : HResult; stdcall;
  8240.     function SetTextureStageState (dwStage: DWORD;
  8241.         dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
  8242.     function ValidateDevice (var lpdwExtraPasses: DWORD) : HResult; stdcall;
  8243.   end;
  8244.  
  8245.   IDirect3DDevice7 = interface (IUnknown)
  8246.     ['{f5049e79-4861-11d2-a407-00a0c90629a8}']
  8247.     (*** IDirect3DDevice7 methods ***)
  8248.     function GetCaps(out lpD3DDevDesc: TD3DDeviceDesc7) : HResult; stdcall;
  8249.     function EnumTextureFormats(lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) : HResult; stdcall;
  8250.     function BeginScene: HResult; stdcall;
  8251.     function EndScene: HResult; stdcall;
  8252.     function GetDirect3D(out lpD3D: IDirect3D7) : HResult; stdcall;
  8253.     function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface7; dwFlags: DWORD) : HResult; stdcall;
  8254.     function GetRenderTarget(out lplpRenderTarget: IDirectDrawSurface7) : HResult; stdcall;
  8255.     function Clear(dwCount: DWORD; lpRects: PD3DRect; dwFlags, dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
  8256.     function SetTransform(dtstTransformStateType: TD3DTransformStateType;
  8257.         const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8258.     function GetTransform(dtstTransformStateType: TD3DTransformStateType;
  8259.         out lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8260.     function SetViewport(const lpViewport: TD3DViewport7) : HResult; stdcall;
  8261.     function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType;
  8262.         const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8263.     function GetViewport(out lpViewport: TD3DViewport7) : HResult; stdcall;
  8264.     function SetMaterial(const lpMaterial: TD3DMaterial7) : HResult; stdcall;
  8265.     function GetMaterial(out lpMaterial: TD3DMaterial7) : HResult; stdcall;
  8266.     function SetLight(dwLightIndex: DWORD; const lpLight: TD3DLight7) : HResult; stdcall;
  8267.     function GetLight(dwLightIndex: DWORD; out lpLight: TD3DLight7) : HResult; stdcall;
  8268.     function SetRenderState(dwRenderStateType: TD3DRenderStateType; dwRenderState: DWORD) : HResult; stdcall;
  8269.     function GetRenderState(dwRenderStateType: TD3DRenderStateType; out dwRenderState: DWORD) : HResult; stdcall;
  8270.     function BeginStateBlock : HResult; stdcall;
  8271.     function EndStateBlock(out lpdwBlockHandle: DWORD) : HResult; stdcall;
  8272.     function PreLoad(lpddsTexture: IDirectDrawSurface7) : HResult; stdcall;
  8273.     function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  8274.         dwVertexTypeDesc: DWORD; const lpvVertices;
  8275.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8276.     function DrawIndexedPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  8277.         dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
  8278.         const lpwIndices; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8279.     function SetClipStatus(const lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8280.     function GetClipStatus(out lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8281.     function DrawPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
  8282.         dwVertexTypeDesc : DWORD;
  8283.         const lpVertexArray: TD3DDrawPrimitiveStridedData;
  8284.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8285.     function DrawIndexedPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
  8286.         dwVertexTypeDesc : DWORD;
  8287.         const lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
  8288.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8289.     function DrawPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
  8290.         lpd3dVertexBuffer: IDirect3DVertexBuffer7;
  8291.         dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
  8292.     function DrawIndexedPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
  8293.         lpd3dVertexBuffer: IDirect3DVertexBuffer7; dwStartVertex, dwNumVertices: DWORD;
  8294.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8295.     function ComputeSphereVisibility(const lpCenters: TD3DVector;
  8296.         var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
  8297.         var lpdwReturnValues: DWORD) : HResult; stdcall;
  8298.     function GetTexture(dwStage: DWORD; out lplpTexture: IDirectDrawSurface7) : HResult; stdcall;
  8299.     function SetTexture(dwStage: DWORD; lpTexture: IDirectDrawSurface7) : HResult; stdcall;
  8300.     function GetTextureStageState(dwStage: DWORD;
  8301.         dwState: TD3DTextureStageStateType; out lpdwValue: DWORD) : HResult; stdcall;
  8302.     function SetTextureStageState(dwStage: DWORD;
  8303.         dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
  8304.     function ValidateDevice(out lpdwExtraPasses: DWORD) : HResult; stdcall;
  8305.     function ApplyStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8306.     function CaptureStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8307.     function DeleteStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8308.     function CreateStateBlock(d3dsbType: TD3DStateBlockType; out lpdwBlockHandle: DWORD) : HResult; stdcall;
  8309.     function Load(lpDestTex: IDirectDrawSurface7; lpDestPoint: PPoint;
  8310.         lpSrcTex: IDirectDrawSurface7; lprcSrcRect: PRect; dwFlags: DWORD) : HResult; stdcall;
  8311.     function LightEnable(dwLightIndex: DWORD; bEnable: BOOL) : HResult; stdcall;
  8312.     function GetLightEnable(dwLightIndex: DWORD; out bEnable: BOOL) : HResult; stdcall;
  8313.     function SetClipPlane(dwIndex: DWORD; var pPlaneEquation: TD3DValue) : HResult; stdcall;
  8314.     function GetClipPlane(dwIndex: DWORD; out pPlaneEquation: TD3DValue) : HResult; stdcall;
  8315.     function GetInfo(dwDevInfoID: DWORD; pDevInfoStruct: Pointer; dwSize: DWORD) : HResult; stdcall;
  8316.   end;
  8317.  
  8318. (*
  8319.  * Execute Buffer interface
  8320.  *)
  8321.  
  8322.   IDirect3DExecuteBuffer = interface (IUnknown)
  8323.     ['{4417C145-33AD-11CF-816F-0000C020156E}']
  8324.     (*** IDirect3DExecuteBuffer methods ***)
  8325.     function Initialize (lpDirect3DDevice: IDirect3DDevice;
  8326.         var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
  8327.     function Lock (var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
  8328.     function Unlock: HResult; stdcall;
  8329.     function SetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
  8330.     function GetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
  8331.     function Validate (var lpdwOffset: DWORD; lpFunc: TD3DValidateCallback;
  8332.         lpUserArg: Pointer; dwReserved: DWORD) : HResult; stdcall;
  8333.     (*** Warning!  Optimize is defined differently in the header files
  8334.          and the online documentation ***)
  8335.     function Optimize (dwFlags: DWORD) : HResult; stdcall;
  8336.   end;
  8337.  
  8338. (*
  8339.  * Light interfaces
  8340.  *)
  8341.  
  8342.   IDirect3DLight = interface (IUnknown)
  8343.     ['{4417C142-33AD-11CF-816F-0000C020156E}']
  8344.     (*** IDirect3DLight methods ***)
  8345.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8346.     function SetLight (var lpLight: TD3DLight2) : HResult; stdcall;
  8347.     function GetLight (var lpLight: TD3DLight2) : HResult; stdcall;
  8348.   end;
  8349.  
  8350. (*
  8351.  * Material interfaces
  8352.  *)
  8353.  
  8354.   IDirect3DMaterial = interface (IUnknown)
  8355.     ['{4417C144-33AD-11CF-816F-0000C020156E}']
  8356.     (*** IDirect3DMaterial methods ***)
  8357.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8358.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8359.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8360.     function GetHandle (lpDirect3DDevice: IDirect3DDevice;
  8361.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8362.     function Reserve: HResult; stdcall;
  8363.     function Unreserve: HResult; stdcall;
  8364.   end;
  8365.  
  8366.   IDirect3DMaterial2 = interface (IUnknown)
  8367.     ['{93281503-8cf8-11d0-89ab-00a0c9054129}']
  8368.     (*** IDirect3DMaterial2 methods ***)
  8369.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8370.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8371.     function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
  8372.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8373.   end;
  8374.  
  8375.   IDirect3DMaterial3 = interface (IUnknown)
  8376.     ['{ca9c46f4-d3c5-11d1-b75a-00600852b312}']
  8377.     (*** IDirect3DMaterial2 methods ***)
  8378.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8379.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8380.     function GetHandle (lpDirect3DDevice: IDirect3DDevice3;
  8381.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8382.   end;
  8383.  
  8384. (*
  8385.  * Texture interfaces
  8386.  *)
  8387.  
  8388.   IDirect3DTexture = interface (IUnknown)
  8389.     ['{2CDCD9E0-25A0-11CF-A31A-00AA00B93356}']
  8390.     (*** IDirect3DTexture methods ***)
  8391.     function Initialize (lpD3DDevice: IDirect3DDevice;
  8392.         lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  8393.     function GetHandle (lpDirect3DDevice: IDirect3DDevice;
  8394.         var lpHandle: TD3DTextureHandle) : HResult; stdcall;
  8395.     function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
  8396.     function Load (lpD3DTexture: IDirect3DTexture) : HResult; stdcall;
  8397.     function Unload: HResult; stdcall;
  8398.   end;
  8399.  
  8400.   IDirect3DTexture2 = interface (IUnknown)
  8401.     ['{93281502-8cf8-11d0-89ab-00a0c9054129}']
  8402.     (*** IDirect3DTexture2 methods ***)
  8403.     function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
  8404.         var lpHandle: TD3DTextureHandle) : HResult; stdcall;
  8405.     function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
  8406.     function Load (lpD3DTexture: IDirect3DTexture2) : HResult; stdcall;
  8407.   end;
  8408.  
  8409. (*
  8410.  * Viewport interfaces
  8411.  *)
  8412.  
  8413.   IDirect3DViewport = interface (IUnknown)
  8414.     ['{4417C146-33AD-11CF-816F-0000C020156E}']
  8415.     (*** IDirect3DViewport methods ***)
  8416.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8417.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8418.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8419.     function TransformVertices (dwVertexCount: DWORD;
  8420.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8421.         out lpOffscreen: DWORD) : HResult; stdcall;
  8422.     function LightElements (dwElementCount: DWORD;
  8423.         var lpData: TD3DLightData) : HResult; stdcall;
  8424.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8425.     function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
  8426.     function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
  8427.         HResult; stdcall;
  8428.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8429.         out lpValid: BOOL) : HResult; stdcall;
  8430.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8431.         HResult; stdcall;
  8432.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8433.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8434.      function NextLight (lpDirect3DLight: IDirect3DLight;
  8435.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8436.   end;
  8437.  
  8438.   IDirect3DViewport2 = interface (IUnknown)
  8439.     ['{93281500-8cf8-11d0-89ab-00a0c9054129}']
  8440.     (*** IDirect3DViewport2 methods ***)
  8441.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8442.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8443.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8444.     function TransformVertices (dwVertexCount: DWORD;
  8445.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8446.         out lpOffscreen: DWORD) : HResult; stdcall;
  8447.     function LightElements (dwElementCount: DWORD;
  8448.         var lpData: TD3DLightData) : HResult; stdcall;
  8449.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8450.     function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
  8451.     function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
  8452.         HResult; stdcall;
  8453.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8454.         out lpValid: BOOL) : HResult; stdcall;
  8455.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8456.         HResult; stdcall;
  8457.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8458.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8459.     function NextLight (lpDirect3DLight: IDirect3DLight;
  8460.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8461.     (*** IDirect3DViewport2 methods ***)
  8462.     function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
  8463.     function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
  8464.   end;
  8465.  
  8466.   IDirect3DViewport3 = interface (IUnknown)
  8467.     ['{b0ab3b61-33d7-11d1-a981-00c04fd7b174}']
  8468.     (*** IDirect3DViewport3 methods ***)
  8469.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8470.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8471.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8472.     function TransformVertices (dwVertexCount: DWORD;
  8473.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8474.         out lpOffscreen: DWORD) : HResult; stdcall;
  8475.     function LightElements (dwElementCount: DWORD;
  8476.         var lpData: TD3DLightData) : HResult; stdcall;
  8477.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8478.     function GetBackground (var hMat: TD3DMaterialHandle) : HResult; stdcall;
  8479.     function SetBackgroundDepth (
  8480.         lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  8481.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8482.         out lpValid: BOOL) : HResult; stdcall;
  8483.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8484.         HResult; stdcall;
  8485.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8486.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8487.     function NextLight (lpDirect3DLight: IDirect3DLight;
  8488.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8489.     function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
  8490.     function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
  8491.     function SetBackgroundDepth2 (
  8492.         lpDDSurface: IDirectDrawSurface4) : HResult; stdcall;
  8493.     function GetBackgroundDepth2 (out lplpDDSurface: IDirectDrawSurface4;
  8494.         out lpValid: BOOL) : HResult; stdcall;
  8495.     function Clear2 (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD;
  8496.         dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
  8497.   end;
  8498.  
  8499.   IDirect3DVertexBuffer = interface (IUnknown)
  8500.     ['{7a503555-4a83-11d1-a5db-00a0c90367f8}']
  8501.     (*** IDirect3DVertexBuffer methods ***)
  8502.     function Lock (dwFlags: DWORD; var lplpData: pointer; var lpdwSize: DWORD)
  8503.         : HResult; stdcall;
  8504.     function Unlock : HResult; stdcall;
  8505.     function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
  8506.         lpSrcBuffer: IDirect3DVertexBuffer; dwSrcIndex: DWORD;
  8507.         lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
  8508.     function GetVertexBufferDesc (var lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
  8509.     function Optimize(lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
  8510.   end;
  8511.  
  8512.   IDirect3DVertexBuffer7 = interface (IUnknown)
  8513.     ['{f5049e7d-4861-11d2-a407-00a0c90629a8}']
  8514.     (*** IDirect3DVertexBuffer methods ***)
  8515.     function Lock (dwFlags: DWORD; out lplpData: Pointer; out lpdwSize: DWORD) : HResult; stdcall;
  8516.     function Unlock : HResult; stdcall;
  8517.     function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
  8518.         lpSrcBuffer: IDirect3DVertexBuffer7; dwSrcIndex: DWORD;
  8519.         lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8520.     function GetVertexBufferDesc (out lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
  8521.     function Optimize(lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8522.     function ProcessVerticesStrided(dwVertexOp, dwDestIndex, dwCount: DWORD;
  8523.       lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexTypeDesc: DWORD;
  8524.       lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8525.   end;
  8526.  
  8527. type
  8528.   IID_IDirect3D = IDirect3D;
  8529.   IID_IDirect3D2 = IDirect3D2;
  8530.   IID_IDirect3D3 = IDirect3D3;
  8531.   IID_IDirect3D7 = IDirect3D7;
  8532.  
  8533.   IID_IDirect3DDevice = IDirect3DDevice;
  8534.   IID_IDirect3DDevice2 = IDirect3DDevice2;
  8535.   IID_IDirect3DDevice3 = IDirect3DDevice3;
  8536.   IID_IDirect3DDevice7 = IDirect3DDevice7;
  8537.  
  8538.   IID_IDirect3DTexture = IDirect3DTexture;
  8539.   IID_IDirect3DTexture2 = IDirect3DTexture2;
  8540.   IID_IDirect3DLight = IDirect3DLight;
  8541.   IID_IDirect3DMaterial = IDirect3DMaterial;
  8542.   IID_IDirect3DMaterial2 = IDirect3DMaterial2;
  8543.   IID_IDirect3DMaterial3 = IDirect3DMaterial3;
  8544.   IID_IDirect3DExecuteBuffer = IDirect3DExecuteBuffer;
  8545.   IID_IDirect3DViewport = IDirect3DViewport;
  8546.   IID_IDirect3DViewport2 = IDirect3DViewport2;
  8547.   IID_IDirect3DViewport3 = IDirect3DViewport3;
  8548.   IID_IDirect3DVertexBuffer = IDirect3DVertexBuffer;
  8549.   IID_IDirect3DVertexBuffer7 = IDirect3DVertexBuffer7;
  8550.  
  8551.  
  8552. const
  8553. (****************************************************************************
  8554.  *
  8555.  * Flags for IDirect3DDevice::NextViewport
  8556.  *
  8557.  ****************************************************************************)
  8558.  
  8559. (*
  8560.  * Return the next viewport
  8561.  *)
  8562.   D3DNEXT_NEXT =        $00000001;
  8563.  
  8564. (*
  8565.  * Return the first viewport
  8566.  *)
  8567.   D3DNEXT_HEAD =        $00000002;
  8568.  
  8569. (*
  8570.  * Return the last viewport
  8571.  *)
  8572.   D3DNEXT_TAIL =        $00000004;
  8573.  
  8574.  
  8575. (****************************************************************************
  8576.  *
  8577.  * Flags for DrawPrimitive/DrawIndexedPrimitive
  8578.  *   Also valid for Begin/BeginIndexed
  8579.  *   Also valid for VertexBuffer::CreateVertexBuffer
  8580.  ****************************************************************************)
  8581.  
  8582. (*
  8583.  * Wait until the device is ready to draw the primitive
  8584.  * This will cause DP to not return DDERR_WASSTILLDRAWING
  8585.  *)
  8586.   D3DDP_WAIT =                                  $00000001;
  8587.  
  8588. (*
  8589.  * Hint that it is acceptable to render the primitive out of order.
  8590.  *)
  8591.   D3DDP_OUTOFORDER            = $00000002;
  8592.  
  8593. (*
  8594.  * Hint that the primitives have been clipped by the application.
  8595.  *)
  8596.   D3DDP_DONOTCLIP =                             $00000004;
  8597.  
  8598. (*
  8599.  * Hint that the extents need not be updated.
  8600.  *)
  8601.   D3DDP_DONOTUPDATEEXTENTS =    $00000008;
  8602.  
  8603. (*
  8604.  * Hint that the lighting should not be applied on vertices.
  8605.  *)
  8606.  
  8607.   D3DDP_DONOTLIGHT            = $00000010;
  8608.  
  8609.  
  8610. (*
  8611.  * Direct3D Errors
  8612.  * DirectDraw error codes are used when errors not specified here.
  8613.  *)
  8614.  
  8615. const
  8616.   MAKE_D3DHRESULT = HResult($88760000);
  8617.  
  8618.   D3D_OK                          = DD_OK;
  8619.   D3DERR_BADMAJORVERSION          = MAKE_D3DHRESULT + 700;
  8620.   D3DERR_BADMINORVERSION          = MAKE_D3DHRESULT + 701;
  8621.  
  8622. (*
  8623.  * An invalid device was requested by the application.
  8624.  *)
  8625.   D3DERR_INVALID_DEVICE   = MAKE_D3DHRESULT + 705;
  8626.   D3DERR_INITFAILED       = MAKE_D3DHRESULT + 706;
  8627.  
  8628. (*
  8629.  * SetRenderTarget attempted on a device that was
  8630.  * QI'd off the render target.
  8631.  *)
  8632.   D3DERR_DEVICEAGGREGATED = MAKE_D3DHRESULT + 707;
  8633.  
  8634.   D3DERR_EXECUTE_CREATE_FAILED    = MAKE_D3DHRESULT + 710;
  8635.   D3DERR_EXECUTE_DESTROY_FAILED   = MAKE_D3DHRESULT + 711;
  8636.   D3DERR_EXECUTE_LOCK_FAILED      = MAKE_D3DHRESULT + 712;
  8637.   D3DERR_EXECUTE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 713;
  8638.   D3DERR_EXECUTE_LOCKED           = MAKE_D3DHRESULT + 714;
  8639.   D3DERR_EXECUTE_NOT_LOCKED       = MAKE_D3DHRESULT + 715;
  8640.  
  8641.   D3DERR_EXECUTE_FAILED           = MAKE_D3DHRESULT + 716;
  8642.   D3DERR_EXECUTE_CLIPPED_FAILED   = MAKE_D3DHRESULT + 717;
  8643.  
  8644.   D3DERR_TEXTURE_NO_SUPPORT       = MAKE_D3DHRESULT + 720;
  8645.   D3DERR_TEXTURE_CREATE_FAILED    = MAKE_D3DHRESULT + 721;
  8646.   D3DERR_TEXTURE_DESTROY_FAILED   = MAKE_D3DHRESULT + 722;
  8647.   D3DERR_TEXTURE_LOCK_FAILED      = MAKE_D3DHRESULT + 723;
  8648.   D3DERR_TEXTURE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 724;
  8649.   D3DERR_TEXTURE_LOAD_FAILED      = MAKE_D3DHRESULT + 725;
  8650.   D3DERR_TEXTURE_SWAP_FAILED      = MAKE_D3DHRESULT + 726;
  8651.   D3DERR_TEXTURE_LOCKED           = MAKE_D3DHRESULT + 727;
  8652.   D3DERR_TEXTURE_NOT_LOCKED       = MAKE_D3DHRESULT + 728;
  8653.   D3DERR_TEXTURE_GETSURF_FAILED   = MAKE_D3DHRESULT + 729;
  8654.  
  8655.   D3DERR_MATRIX_CREATE_FAILED     = MAKE_D3DHRESULT + 730;
  8656.   D3DERR_MATRIX_DESTROY_FAILED    = MAKE_D3DHRESULT + 731;
  8657.   D3DERR_MATRIX_SETDATA_FAILED    = MAKE_D3DHRESULT + 732;
  8658.   D3DERR_MATRIX_GETDATA_FAILED    = MAKE_D3DHRESULT + 733;
  8659.   D3DERR_SETVIEWPORTDATA_FAILED   = MAKE_D3DHRESULT + 734;
  8660.  
  8661.   D3DERR_INVALIDCURRENTVIEWPORT   = MAKE_D3DHRESULT + 735;
  8662.   D3DERR_INVALIDPRIMITIVETYPE     = MAKE_D3DHRESULT + 736;
  8663.   D3DERR_INVALIDVERTEXTYPE        = MAKE_D3DHRESULT + 737;
  8664.   D3DERR_TEXTURE_BADSIZE          = MAKE_D3DHRESULT + 738;
  8665.   D3DERR_INVALIDRAMPTEXTURE       = MAKE_D3DHRESULT + 739;
  8666.  
  8667.   D3DERR_MATERIAL_CREATE_FAILED   = MAKE_D3DHRESULT + 740;
  8668.   D3DERR_MATERIAL_DESTROY_FAILED  = MAKE_D3DHRESULT + 741;
  8669.   D3DERR_MATERIAL_SETDATA_FAILED  = MAKE_D3DHRESULT + 742;
  8670.   D3DERR_MATERIAL_GETDATA_FAILED  = MAKE_D3DHRESULT + 743;
  8671.  
  8672.   D3DERR_INVALIDPALETTE           = MAKE_D3DHRESULT + 744;
  8673.  
  8674.   D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY = MAKE_D3DHRESULT + 745;
  8675.   D3DERR_ZBUFF_NEEDS_VIDEOMEMORY  = MAKE_D3DHRESULT + 746;
  8676.   D3DERR_SURFACENOTINVIDMEM       = MAKE_D3DHRESULT + 747;
  8677.  
  8678.   D3DERR_LIGHT_SET_FAILED         = MAKE_D3DHRESULT + 750;
  8679.   D3DERR_LIGHTHASVIEWPORT         = MAKE_D3DHRESULT + 751;
  8680.   D3DERR_LIGHTNOTINTHISVIEWPORT   = MAKE_D3DHRESULT + 752;
  8681.  
  8682.   D3DERR_SCENE_IN_SCENE           = MAKE_D3DHRESULT + 760;
  8683.   D3DERR_SCENE_NOT_IN_SCENE       = MAKE_D3DHRESULT + 761;
  8684.   D3DERR_SCENE_BEGIN_FAILED       = MAKE_D3DHRESULT + 762;
  8685.   D3DERR_SCENE_END_FAILED         = MAKE_D3DHRESULT + 763;
  8686.  
  8687.   D3DERR_INBEGIN                  = MAKE_D3DHRESULT + 770;
  8688.   D3DERR_NOTINBEGIN               = MAKE_D3DHRESULT + 771;
  8689.   D3DERR_NOVIEWPORTS              = MAKE_D3DHRESULT + 772;
  8690.   D3DERR_VIEWPORTDATANOTSET       = MAKE_D3DHRESULT + 773;
  8691.   D3DERR_VIEWPORTHASNODEVICE      = MAKE_D3DHRESULT + 774;
  8692.   D3DERR_NOCURRENTVIEWPORT        = MAKE_D3DHRESULT + 775;
  8693.  
  8694.   D3DERR_INVALIDVERTEXFORMAT      = MAKE_D3DHRESULT + 2048;
  8695.  
  8696. (*
  8697.  * Attempted to CreateTexture on a surface that had a color key
  8698.  *)
  8699.   D3DERR_COLORKEYATTACHED                 = MAKE_D3DHRESULT + 2050;
  8700.  
  8701.   D3DERR_VERTEXBUFFEROPTIMIZED            = MAKE_D3DHRESULT + 2060;
  8702.   D3DERR_VBUF_CREATE_FAILED               = MAKE_D3DHRESULT + 2061;
  8703.   D3DERR_VERTEXBUFFERLOCKED               = MAKE_D3DHRESULT + 2062;
  8704.  
  8705.   D3DERR_ZBUFFER_NOTPRESENT               = MAKE_D3DHRESULT + 2070;
  8706.   D3DERR_STENCILBUFFER_NOTPRESENT         = MAKE_D3DHRESULT + 2071;
  8707.  
  8708.   D3DERR_WRONGTEXTUREFORMAT               = MAKE_D3DHRESULT + 2072;
  8709.   D3DERR_UNSUPPORTEDCOLOROPERATION        = MAKE_D3DHRESULT + 2073;
  8710.   D3DERR_UNSUPPORTEDCOLORARG              = MAKE_D3DHRESULT + 2074;
  8711.   D3DERR_UNSUPPORTEDALPHAOPERATION        = MAKE_D3DHRESULT + 2075;
  8712.   D3DERR_UNSUPPORTEDALPHAARG              = MAKE_D3DHRESULT + 2076;
  8713.   D3DERR_TOOMANYOPERATIONS                = MAKE_D3DHRESULT + 2077;
  8714.   D3DERR_CONFLICTINGTEXTUREFILTER         = MAKE_D3DHRESULT + 2078;
  8715.   D3DERR_UNSUPPORTEDFACTORVALUE           = MAKE_D3DHRESULT + 2079;
  8716.   D3DERR_CONFLICTINGRENDERSTATE           = MAKE_D3DHRESULT + 2081;
  8717.   D3DERR_UNSUPPORTEDTEXTUREFILTER         = MAKE_D3DHRESULT + 2082;
  8718.   D3DERR_TOOMANYPRIMITIVES                = MAKE_D3DHRESULT + 2083;
  8719.   D3DERR_INVALIDMATRIX                    = MAKE_D3DHRESULT + 2084;
  8720.   D3DERR_TOOMANYVERTICES                  = MAKE_D3DHRESULT + 2085;
  8721.   D3DERR_CONFLICTINGTEXTUREPALETTE        = MAKE_D3DHRESULT + 2086;
  8722.  
  8723.   D3DERR_INVALIDSTATEBLOCK        = MAKE_D3DHRESULT + 2100;
  8724.   D3DERR_INBEGINSTATEBLOCK        = MAKE_D3DHRESULT + 2101;
  8725.   D3DERR_NOTINBEGINSTATEBLOCK     = MAKE_D3DHRESULT + 2102;
  8726.  
  8727. procedure DisableFPUExceptions;
  8728. procedure EnableFPUExceptions;
  8729.  
  8730. (***************************************************************************
  8731.  *
  8732.  *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
  8733.  *
  8734.  *  File:       dxfile.h
  8735.  *
  8736.  *  Content:    DirectX File public header file
  8737.  *
  8738.  ***************************************************************************)
  8739.  
  8740. var
  8741.   DXFileDLL : HMODULE;
  8742.  
  8743. function DXFileErrorString(Value: HResult) : string;
  8744.  
  8745. type
  8746.   TDXFileFormat = (
  8747.     DXFILEFORMAT_BINARY,
  8748.     DXFILEFORMAT_TEXT,
  8749.     DXFILEFORMAT_COMPRESSED
  8750.   );
  8751.  
  8752.   TDXFileLoadOptions = (
  8753.     DXFILELOAD_FROMFILE,
  8754.     DXFILELOAD_FROMRESOURCE,
  8755.     DXFILELOAD_FROMMEMORY,
  8756.     DXFILELOAD_INVALID_3,
  8757.     DXFILELOAD_FROMSTREAM,
  8758.     DXFILELOAD_INVALID_5,
  8759.     DXFILELOAD_INVALID_6,
  8760.     DXFILELOAD_INVALID_7,
  8761.     DXFILELOAD_FROMURL
  8762.   );
  8763.  
  8764.   PDXFileLoadResource = ^TDXFileLoadResource;
  8765.   TDXFileLoadResource = packed record
  8766.     hModule: HModule;
  8767.     lpName: PAnsiChar;
  8768.     lpType: PAnsiChar;
  8769.   end;
  8770.  
  8771.   PDXFileLoadMemory = ^TDXFileLoadMemory;
  8772.   TDXFileLoadMemory = packed record
  8773.     lpMemory: Pointer;
  8774.     dSize: DWORD;
  8775.   end;
  8776.  
  8777. (*
  8778.  * DirectX File object types.
  8779.  *)
  8780.  
  8781.   IDirectXFile = interface;
  8782.   IDirectXFileEnumObject = interface;
  8783.   IDirectXFileSaveObject = interface;
  8784.   IDirectXFileObject = interface;
  8785.   IDirectXFileData = interface;
  8786.   IDirectXFileDataReference = interface;
  8787.   IDirectXFileBinary = interface;
  8788.  
  8789. (*
  8790.  * DirectX File interfaces.
  8791.  *)
  8792.  
  8793.   IDirectXFile = interface (IUnknown)
  8794.     ['{3d82ab40-62da-11cf-ab39-0020af71e433}']
  8795.     function CreateEnumObject (pvSource: Pointer;
  8796.         dwLoadOptions: TDXFileLoadOptions;
  8797.         var ppEnumObj: IDirectXFileEnumObject) : HResult; stdcall;
  8798.     function CreateSaveObject (szFileName: PChar; dwFileFormat: TDXFileFormat;
  8799.         var ppSaveObj: IDirectXFileSaveObject) : HResult; stdcall;
  8800.     function RegisterTemplates (pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
  8801.   end;
  8802.  
  8803.   IDirectXFileEnumObject = interface (IUnknown)
  8804.     ['{3d82ab41-62da-11cf-ab39-0020af71e433}']
  8805.     function GetNextDataObject (var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8806.     function GetDataObjectById
  8807.         (const rguid: TGUID; var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8808.     function GetDataObjectByName
  8809.         (szName: PChar; var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8810.   end;
  8811.  
  8812.   IDirectXFileSaveObject = interface (IUnknown)
  8813.     ['{3d82ab42-62da-11cf-ab39-0020af71e433}']
  8814.     function SaveTemplates
  8815.         (cTemplates: DWORD; var ppguidTemplates: PGUID) : HResult; stdcall;
  8816.     function CreateDataObject (const rguidTemplate: TGUID; szName: PChar;
  8817.         pguid: PGUID; cbSize: DWORD; pvData: Pointer;
  8818.         var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8819.     function SaveData (pDataObj: IDirectXFileData) : HResult; stdcall;
  8820.   end;
  8821.  
  8822.   IDirectXFileObject = interface (IUnknown)
  8823.     ['{3d82ab43-62da-11cf-ab39-0020af71e433}']
  8824.     function GetName (pstrNameBuf: PChar; var dwBufLen: DWORD) : HResult; stdcall;
  8825.     function GetId (var pGuidBuf: TGUID) : HResult; stdcall;
  8826.   end;
  8827.  
  8828.   IDirectXFileData = interface (IDirectXFileObject)
  8829.     ['{3d82ab44-62da-11cf-ab39-0020af71e433}']
  8830.     function GetData
  8831.         (szMember: PChar; var pcbSize: DWORD; var ppvData: Pointer) : HResult; stdcall;
  8832.     function GetType (var ppguid: PGUID) : HResult; stdcall;
  8833.     function GetNextObject (var ppChildObj: IDirectXFileObject) : HResult; stdcall;
  8834.     function AddDataObject (pDataObj: IDirectXFileData) : HResult; stdcall;
  8835.     function AddDataReference (szRef: PChar; pguidRef: PGUID) : HResult; stdcall;
  8836.     function AddBinaryObject (szName: PChar; pguid: PGUID; szMimeType: PChar;
  8837.         pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
  8838.   end;
  8839.  
  8840.   IDirectXFileDataReference = interface (IDirectXFileObject)
  8841.     ['{3d82ab45-62da-11cf-ab39-0020af71e433}']
  8842.     function Resolve (var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8843.   end;
  8844.  
  8845.   IDirectXFileBinary = interface (IDirectXFileObject)
  8846.     ['{3d82ab46-62da-11cf-ab39-0020af71e433}']
  8847.     function GetSize (var pcbSize: DWORD) : HResult; stdcall;
  8848.     function GetMimeType (var pszMimeType: PChar) : HResult; stdcall;
  8849.     function Read(pvData: Pointer; cbSize: DWORD; pcbRead: PDWORD{?}) : HResult; stdcall;
  8850.   end;
  8851.  
  8852. const
  8853.  
  8854. (*
  8855.  * DirectXFile Object Class Id (for CoCreateInstance())
  8856.  *)
  8857.  
  8858.    CLSID_CDirectXFile: TGUID =
  8859.        (D1:$4516ec43;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  8860.  
  8861. (*
  8862.  * DirectX File Interface GUIDs.
  8863.  *)
  8864.  
  8865. type
  8866.   IID_IDirectXFile = IDirectXFile;
  8867.   IID_IDirectXFileEnumObject = IDirectXFileEnumObject;
  8868.   IID_IDirectXFileSaveObject = IDirectXFileSaveObject;
  8869.   IID_IDirectXFileObject = IDirectXFileObject;
  8870.   IID_IDirectXFileData = IDirectXFileData;
  8871.   IID_IDirectXFileDataReference = IDirectXFileDataReference;
  8872.   IID_IDirectXFileBinary = IDirectXFileBinary;
  8873.  
  8874. (*
  8875.  * DirectX File Header template's GUID.
  8876.  *)
  8877. const
  8878.   TID_DXFILEHeader: TGUID =
  8879.       (D1:$3d82ab43;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  8880.  
  8881. (*
  8882.  * DirectX File errors.
  8883.  *)
  8884.  
  8885. const
  8886.   DXFILE_OK = 0;
  8887.  
  8888.   DXFILEERR_BADOBJECT                 = MAKE_D3DHRESULT or 850;
  8889.   DXFILEERR_BADVALUE                  = MAKE_D3DHRESULT or 851;
  8890.   DXFILEERR_BADTYPE                   = MAKE_D3DHRESULT or 852;
  8891.   DXFILEERR_BADSTREAMHANDLE           = MAKE_D3DHRESULT or 853;
  8892.   DXFILEERR_BADALLOC                  = MAKE_D3DHRESULT or 854;
  8893.   DXFILEERR_NOTFOUND                  = MAKE_D3DHRESULT or 855;
  8894.   DXFILEERR_NOTDONEYET                = MAKE_D3DHRESULT or 856;
  8895.   DXFILEERR_FILENOTFOUND              = MAKE_D3DHRESULT or 857;
  8896.   DXFILEERR_RESOURCENOTFOUND          = MAKE_D3DHRESULT or 858;
  8897.   DXFILEERR_URLNOTFOUND               = MAKE_D3DHRESULT or 859;
  8898.   DXFILEERR_BADRESOURCE               = MAKE_D3DHRESULT or 860;
  8899.   DXFILEERR_BADFILETYPE               = MAKE_D3DHRESULT or 861;
  8900.   DXFILEERR_BADFILEVERSION            = MAKE_D3DHRESULT or 862;
  8901.   DXFILEERR_BADFILEFLOATSIZE          = MAKE_D3DHRESULT or 863;
  8902.   DXFILEERR_BADFILECOMPRESSIONTYPE    = MAKE_D3DHRESULT or 864;
  8903.   DXFILEERR_BADFILE                   = MAKE_D3DHRESULT or 865;
  8904.   DXFILEERR_PARSEERROR                = MAKE_D3DHRESULT or 866;
  8905.   DXFILEERR_NOTEMPLATE                = MAKE_D3DHRESULT or 867;
  8906.   DXFILEERR_BADARRAYSIZE              = MAKE_D3DHRESULT or 868;
  8907.   DXFILEERR_BADDATAREFERENCE          = MAKE_D3DHRESULT or 869;
  8908.   DXFILEERR_INTERNALERROR             = MAKE_D3DHRESULT or 870;
  8909.   DXFILEERR_NOMOREOBJECTS             = MAKE_D3DHRESULT or 871;
  8910.   DXFILEERR_BADINTRINSICS             = MAKE_D3DHRESULT or 872;
  8911.   DXFILEERR_NOMORESTREAMHANDLES       = MAKE_D3DHRESULT or 873;
  8912.   DXFILEERR_NOMOREDATA                = MAKE_D3DHRESULT or 874;
  8913.   DXFILEERR_BADCACHEFILE              = MAKE_D3DHRESULT or 875;
  8914.   DXFILEERR_NOINTERNET                = MAKE_D3DHRESULT or 876;
  8915.  
  8916. {$IFDEF D3DRM}
  8917. (*
  8918.  * API for creating IDirectXFile interface.
  8919.  *)
  8920.  
  8921. var
  8922.   DirectXFileCreate : function
  8923.     (out lplpDirectXFile: IDirectXFile) : HResult; stdcall;
  8924.  
  8925. (* D3DRM XFile templates in binary form *)
  8926. const
  8927.   D3DRM_XTEMPLATE_BYTES = 3215;
  8928.   D3DRM_XTEMPLATES: array [0..D3DRM_XTEMPLATE_BYTES-1] of byte = (
  8929.         $78, $6f, $66, $20, $30, $33, $30, $32, $62,
  8930.         $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
  8931.         0, $6, 0, 0, 0, $48, $65, $61, $64, $65,
  8932.         $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
  8933.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
  8934.         $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
  8935.         $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0,
  8936.         $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
  8937.         0, $29, 0, $1, 0, $5, 0, 0, 0, $66,
  8938.         $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
  8939.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  8940.         $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
  8941.         $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71,
  8942.         $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
  8943.         $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0,
  8944.         0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
  8945.         0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1,
  8946.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  8947.         $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2,
  8948.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  8949.         $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0,
  8950.         0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
  8951.         0, 0, $76, $14, 0, $b, 0, $1f, 0, $1,
  8952.         0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  8953.         $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f,
  8954.         $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  8955.         $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0,
  8956.         $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
  8957.         $e, 0, $3, 0, $10, 0, 0, 0, $f, 0,
  8958.         $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
  8959.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  8960.         $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
  8961.         $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94,
  8962.         $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
  8963.         $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0,
  8964.         0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
  8965.         0, $1, 0, $4, 0, 0, 0, $62, $6c, $75,
  8966.         $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
  8967.         0, $61, $6c, $70, $68, $61, $14, 0, $b, 0,
  8968.         $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
  8969.         $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0,
  8970.         $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
  8971.         0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0,
  8972.         $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
  8973.         0, $1, 0, $5, 0, 0, 0, $67, $72, $65,
  8974.         $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
  8975.         0, 0, $62, $6c, $75, $65, $14, 0, $b, 0,
  8976.         $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
  8977.         $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72,
  8978.         $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
  8979.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  8980.         $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
  8981.         $64, $65, $78, $14, 0, $1, 0, $9, 0, 0,
  8982.         0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
  8983.         $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65,
  8984.         $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
  8985.         $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f,
  8986.         $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
  8987.         $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0,
  8988.         $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
  8989.         0, 0, 0, $74, $72, $75, $65, $66, $61, $6c,
  8990.         $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
  8991.         $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61,
  8992.         $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
  8993.         $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33,
  8994.         $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
  8995.         $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0,
  8996.         0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
  8997.         0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0,
  8998.         $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
  8999.         0, $1, 0, $c, 0, 0, 0, $4d, $61, $74,
  9000.         $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
  9001.         0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf,
  9002.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  9003.         0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65,
  9004.         $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
  9005.         0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f,
  9006.         $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
  9007.         $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f,
  9008.         0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
  9009.         $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0,
  9010.         $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
  9011.         $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0,
  9012.         $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
  9013.         $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0,
  9014.         $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
  9015.         $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab,
  9016.         $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
  9017.         $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0,
  9018.         $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
  9019.         0, $9, 0, 0, 0, $66, $61, $63, $65, $43,
  9020.         $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
  9021.         $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14,
  9022.         0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
  9023.         $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0,
  9024.         0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
  9025.         $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0,
  9026.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  9027.         $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73,
  9028.         $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
  9029.         0, $e, 0, $12, 0, $12, 0, $12, 0, $f,
  9030.         0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
  9031.         0, $4d, $65, $73, $68, $46, $61, $63, $65, $a,
  9032.         0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
  9033.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  9034.         0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
  9035.         $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e,
  9036.         $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
  9037.         0, $1, 0, $11, 0, 0, 0, $66, $61, $63,
  9038.         $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
  9039.         $69, $63, $65, $73, $e, 0, $1, 0, $12, 0,
  9040.         0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
  9041.         $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73,
  9042.         $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  9043.         $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61,
  9044.         $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
  9045.         0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94,
  9046.         $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
  9047.         0, $f, 0, 0, 0, $6e, $46, $61, $63, $65,
  9048.         $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
  9049.         $14, 0, $34, 0, $1, 0, $9, 0, 0, 0,
  9050.         $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
  9051.         0, $e, 0, 0, 0, $66, $61, $63, $65, $57,
  9052.         $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
  9053.         0, $1, 0, $f, 0, 0, 0, $6e, $46, $61,
  9054.         $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
  9055.         $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
  9056.         $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
  9057.         $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f,
  9058.         $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
  9059.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  9060.         $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
  9061.         0, $6e, $54, $65, $78, $74, $75, $72, $65, $43,
  9062.         $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
  9063.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  9064.         $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
  9065.         $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72,
  9066.         $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
  9067.         $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f,
  9068.         $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
  9069.         $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65,
  9070.         $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
  9071.         $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f,
  9072.         $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  9073.         $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0,
  9074.         0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
  9075.         $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0,
  9076.         0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
  9077.         $65, $78, $65, $73, $14, 0, $34, 0, $29, 0,
  9078.         $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
  9079.         $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1,
  9080.         0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
  9081.         $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14,
  9082.         0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
  9083.         $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b,
  9084.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
  9085.         $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73,
  9086.         $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
  9087.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  9088.         $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
  9089.         $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0,
  9090.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  9091.         $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f,
  9092.         $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
  9093.         0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c,
  9094.         $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
  9095.         0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f,
  9096.         $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
  9097.         0, $8, 0, 0, 0, $4d, $65, $73, $68, $46,
  9098.         $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
  9099.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
  9100.         $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
  9101.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
  9102.         $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  9103.         $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65,
  9104.         $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
  9105.         $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78,
  9106.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  9107.         $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56,
  9108.         $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  9109.         $73, $14, 0, $34, 0, $1, 0, $c, 0, 0,
  9110.         0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
  9111.         $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76,
  9112.         $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  9113.         $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e,
  9114.         $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
  9115.         $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
  9116.         $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
  9117.         $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62,
  9118.         $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  9119.         $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56,
  9120.         $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
  9121.         0, $1, 0, $6, 0, 0, 0, $56, $65, $63,
  9122.         $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
  9123.         $65, $72, $74, $69, $63, $65, $73, $e, 0, $1,
  9124.         0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
  9125.         $69, $63, $65, $73, $f, 0, $14, 0, $29, 0,
  9126.         $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
  9127.         $65, $73, $14, 0, $34, 0, $1, 0, $8, 0,
  9128.         0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
  9129.         $1, 0, $5, 0, 0, 0, $66, $61, $63, $65,
  9130.         $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
  9131.         $46, $61, $63, $65, $73, $f, 0, $14, 0, $e,
  9132.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  9133.         0, $1f, 0, $1, 0, $14, 0, 0, 0, $46,
  9134.         $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
  9135.         $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a,
  9136.         0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
  9137.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  9138.         0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  9139.         $78, $34, $78, $34, $1, 0, $b, 0, 0, 0,
  9140.         $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
  9141.         $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5,
  9142.         0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
  9143.         $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11,
  9144.         $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
  9145.         $12, 0, $12, 0, $12, 0, $f, 0, $b, 0,
  9146.         $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
  9147.         $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5,
  9148.         0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
  9149.         $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1,
  9150.         0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
  9151.         $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0,
  9152.         $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
  9153.         $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56,
  9154.         $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
  9155.         0, $1f, 0, $1, 0, $e, 0, 0, 0, $54,
  9156.         $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
  9157.         $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6,
  9158.         $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
  9159.         $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0,
  9160.         0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
  9161.         0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65,
  9162.         $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
  9163.         $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0,
  9164.         $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
  9165.         $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0,
  9166.         $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
  9167.         $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0,
  9168.         $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
  9169.         $79, $70, $65, $14, 0, $29, 0, $1, 0, $5,
  9170.         0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
  9171.         $34, 0, $1, 0, $e, 0, 0, 0, $54, $69,
  9172.         $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
  9173.         $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65,
  9174.         $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
  9175.         $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b,
  9176.         0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
  9177.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70,
  9178.         $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
  9179.         $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0,
  9180.         $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
  9181.         0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f,
  9182.         $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
  9183.         0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f,
  9184.         $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
  9185.         $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0,
  9186.         $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
  9187.         0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf,
  9188.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
  9189.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  9190.         0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
  9191.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65,
  9192.         $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
  9193.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
  9194.         $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
  9195.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0,
  9196.         $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
  9197.         $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61,
  9198.         $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
  9199.         $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  9200.         $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
  9201.         $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0,
  9202.         $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
  9203.         0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0,
  9204.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  9205.         0, $1, 0, $5, 0, 0, 0, $6e, $55, $72,
  9206.         $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
  9207.         $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0,
  9208.         $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
  9209.         $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1,
  9210.         0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
  9211.         $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68,
  9212.         $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
  9213.         $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b,
  9214.         $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
  9215.         $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49,
  9216.         $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
  9217.         0, $b, 0, $1f, 0, $1, 0, $4, 0, 0,
  9218.         0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
  9219.         $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0,
  9220.         $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
  9221.         0, 0, 0, $64, $61, $74, $61, $31, $14, 0,
  9222.         $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
  9223.         $74, $61, $32, $14, 0, $28, 0, $1, 0, $5,
  9224.         0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
  9225.         $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0,
  9226.         $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
  9227.         0, 0, 0, $f, 0, $14, 0, $b, 0, $1f,
  9228.         0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
  9229.         $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74,
  9230.         $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
  9231.         $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72,
  9232.         $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
  9233.         $65, $79, $14, 0, $31, 0, $1, 0, $5, 0,
  9234.         0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
  9235.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $50,
  9236.         $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
  9237.         $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf,
  9238.         $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
  9239.         $e, 0, $1, 0, $e, 0, 0, 0, $53, $74,
  9240.         $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
  9241.         $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0,
  9242.         $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
  9243.         $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0,
  9244.         $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
  9245.         $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0,
  9246.         $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
  9247.         $12, 0, 0, 0, $67, $75, $69, $64, $45, $78,
  9248.         $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
  9249.         $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0,
  9250.         $12, 0, $f, 0, $b, 0);
  9251.  
  9252. //---------------
  9253.  
  9254. //Direct3DRM file
  9255. (*==========================================================================;
  9256.  *
  9257.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  9258.  *
  9259.  *  Files:      D3DRMDef.h D3DRMObj.h D3DRM.h D3DRMWin.h RMXFGUID.h RMXFTmpl.h
  9260.  *  Content:    Direct3D Retained Mode include files
  9261.  *
  9262.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  9263.  *
  9264.  *  Modified: 10-Sep-2000
  9265.  *
  9266.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  9267.  *  E-Mail: DelphiDirectX@next-reality.com
  9268.  *
  9269.  *
  9270.  ***************************************************************************)
  9271.  
  9272. var
  9273.   D3DRMDLL : HMODULE = 0;
  9274.  
  9275. (*==========================================================================;
  9276.  *
  9277.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  9278.  *
  9279.  *  File:       d3drmdef.h
  9280.  *  Content:    Direct3DRM include file
  9281.  *
  9282.  ***************************************************************************)
  9283.  
  9284. type
  9285.   PD3DRMVector4D = ^TD3DRMVector4D;
  9286.   TD3DRMVector4D = packed record
  9287.     x, y, z, w: TD3DValue;
  9288.   end;
  9289.  
  9290.   PD3DRMMatrix4D = ^TD3DRMMatrix4D;
  9291.   TD3DRMMatrix4D = array [0..3, 0..3] of TD3DValue;
  9292.  
  9293.   PD3DRMQuaternion = ^TD3DRMQuaternion;
  9294.   TD3DRMQuaternion = packed record
  9295.     s: TD3DValue;
  9296.     v: TD3DVector;
  9297.   end;
  9298.  
  9299.   PD3DRMRay = ^TD3DRMRay;
  9300.   TD3DRMRay = packed record
  9301.     dvDir: TD3DVector;
  9302.     dvPos: TD3DVector;
  9303.   end;
  9304.  
  9305.   PD3DRMBox = ^TD3DRMBox;
  9306.   TD3DRMBox = packed record
  9307.     min, max: TD3DVector;
  9308.   end;
  9309.  
  9310.   TD3DRMWrapCallback = procedure (var lpD3DVector: TD3DVector;
  9311.       var lpU, lpV: Integer; var lpD3DRMVA, lpD3DRMVB: TD3DVector; lpArg:
  9312.       Pointer); stdcall; // unused ?
  9313.  
  9314.   PD3DRMLightType = ^TD3DRMLightType; // is it 16 or 32 bit ?
  9315.   TD3DRMLightType = (
  9316.     D3DRMLIGHT_AMBIENT,
  9317.     D3DRMLIGHT_POINT,
  9318.     D3DRMLIGHT_SPOT,
  9319.     D3DRMLIGHT_DIRECTIONAL,
  9320.     D3DRMLIGHT_PARALLELPOINT
  9321.   );
  9322.  
  9323.   PD3DRMShadeMode = ^TD3DRMShadeMode;
  9324.   TD3DRMShadeMode = WORD;
  9325.  
  9326. const
  9327.   D3DRMSHADE_FLAT = 0;
  9328.   D3DRMSHADE_GOURAUD = 1;
  9329.   D3DRMSHADE_PHONG = 2;
  9330.   D3DRMSHADE_MASK = 7;
  9331.   D3DRMSHADE_MAX = 8;
  9332.  
  9333. type
  9334.   PD3DRMLightMode = ^TD3DRMLightMode;
  9335.   TD3DRMLightMode = WORD;
  9336.  
  9337. const
  9338.   D3DRMLIGHT_OFF  = 0 * D3DRMSHADE_MAX;
  9339.   D3DRMLIGHT_ON   = 1 * D3DRMSHADE_MAX;
  9340.   D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX;
  9341.   D3DRMLIGHT_MAX  = 8 * D3DRMSHADE_MAX;
  9342.  
  9343. type
  9344.   PD3DRMFillMode = ^TD3DRMFillMode;
  9345.   TD3DRMFillMode = WORD;
  9346.  
  9347. const
  9348.   D3DRMFILL_POINTS    = 0 * D3DRMLIGHT_MAX;
  9349.   D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX;
  9350.   D3DRMFILL_SOLID     = 2 * D3DRMLIGHT_MAX;
  9351.   D3DRMFILL_MASK      = 7 * D3DRMLIGHT_MAX;
  9352.   D3DRMFILL_MAX       = 8 * D3DRMLIGHT_MAX;
  9353.  
  9354. type
  9355.   PD3DRMRenderQuality = ^TD3DRMRenderQuality;
  9356.   TD3DRMRenderQuality = DWORD;
  9357.  
  9358. const
  9359.   D3DRMRENDER_WIREFRAME   =
  9360.       (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_WIREFRAME);
  9361.   D3DRMRENDER_UNLITFLAT   =
  9362.       (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_SOLID);
  9363.   D3DRMRENDER_FLAT        =
  9364.       (D3DRMSHADE_FLAT + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9365.   D3DRMRENDER_GOURAUD     =
  9366.       (D3DRMSHADE_GOURAUD + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9367.   D3DRMRENDER_PHONG       =
  9368.       (D3DRMSHADE_PHONG + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9369.  
  9370.   D3DRMRENDERMODE_BLENDEDTRANSPARENCY   =  1;
  9371.   D3DRMRENDERMODE_SORTEDTRANSPARENCY    =  2;
  9372.   D3DRMRENDERMODE_LIGHTINMODELSPACE     =  8;
  9373.   D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR = 16;
  9374.  
  9375. type
  9376.   PD3DRMTextureQuality = ^TD3DRMTextureQuality;
  9377.   TD3DRMTextureQuality = (
  9378.     D3DRMTEXTURE_NEAREST,               (* choose nearest texel *)
  9379.     D3DRMTEXTURE_LINEAR,                (* interpolate 4 texels *)
  9380.     D3DRMTEXTURE_MIPNEAREST,            (* nearest texel in nearest mipmap  *)
  9381.     D3DRMTEXTURE_MIPLINEAR,             (* interpolate 2 texels from 2 mipmaps *)
  9382.     D3DRMTEXTURE_LINEARMIPNEAREST,      (* interpolate 4 texels in nearest mipmap *)
  9383.     D3DRMTEXTURE_LINEARMIPLINEAR        (* interpolate 8 texels from 2 mipmaps *)
  9384.   );
  9385.  
  9386. const
  9387. (*
  9388.  * Texture flags
  9389.  *)
  9390.   D3DRMTEXTURE_FORCERESIDENT          = $00000001; (* texture should be kept in video memory *)
  9391.   D3DRMTEXTURE_STATIC                 = $00000002; (* texture will not change *)
  9392.   D3DRMTEXTURE_DOWNSAMPLEPOINT        = $00000004; (* point filtering should be used when downsampling *)
  9393.   D3DRMTEXTURE_DOWNSAMPLEBILINEAR     = $00000008; (* bilinear filtering should be used when downsampling *)
  9394.   D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH  = $00000010; (* reduce bit depth when downsampling *)
  9395.   D3DRMTEXTURE_DOWNSAMPLENONE         = $00000020; (* texture should never be downsampled *)
  9396.   D3DRMTEXTURE_CHANGEDPIXELS          = $00000040; (* pixels have changed *)
  9397.   D3DRMTEXTURE_CHANGEDPALETTE         = $00000080; (* palette has changed *)
  9398.   D3DRMTEXTURE_INVALIDATEONLY         = $00000100; (* dirty regions are invalid *)
  9399.  
  9400. (*
  9401.  * Shadow flags
  9402.  *)
  9403.    D3DRMSHADOW_TRUEALPHA               = $00000001; (* shadow should render without artifacts when true alpha is on *)
  9404.  
  9405. type
  9406.   PD3DRMCombineType = ^TD3DRMCombineType;
  9407.   TD3DRMCombineType = (
  9408.     D3DRMCOMBINE_REPLACE,
  9409.     D3DRMCOMBINE_BEFORE,
  9410.     D3DRMCOMBINE_AFTER
  9411.   );
  9412.  
  9413.   PD3DRMColorModel = ^TD3DRMColorModel;
  9414.   TD3DRMColorModel = TD3DColorModel;
  9415.  
  9416.   PD3DRMPaletteFlags = ^TD3DRMPaletteFlags;
  9417.   TD3DRMPaletteFlags = (
  9418.     D3DRMPALETTE_FREE,                  (* renderer may use this entry freely *)
  9419.     D3DRMPALETTE_READONLY,              (* fixed but may be used by renderer *)
  9420.     D3DRMPALETTE_RESERVED               (* may not be used by renderer *)
  9421.   );
  9422.  
  9423.   PD3DRMPaletteEntry = ^TD3DRMPaletteEntry;
  9424.   TD3DRMPaletteEntry = packed record
  9425.     red: Byte;          (* 0 .. 255 *)
  9426.     green: Byte;        (* 0 .. 255 *)
  9427.     blue: Byte;         (* 0 .. 255 *)
  9428.     flags: Byte;        (* one of D3DRMPALETTEFLAGS *)
  9429.   end;
  9430.  
  9431.   PD3DRMImage = ^TD3DRMImage;
  9432.   TD3DRMImage = packed record
  9433.     width, height: Integer;    (* width and height in pixels *)
  9434.     aspectx, aspecty: Integer; (* aspect ratio for non-square pixels *)
  9435.     depth: Integer;            (* bits per pixel *)
  9436.     rgb: Integer;              (* if false, pixels are indices into a
  9437.                                    palette otherwise, pixels encode
  9438.                                    RGB values. *)
  9439.     bytes_per_line: Integer;   (* number of bytes of memory for a
  9440.                                    scanline. This must be a multiple
  9441.                                    of 4. *)
  9442.     buffer1: Pointer;          (* memory to render into (first buffer). *)
  9443.     buffer2: Pointer;          (* second rendering buffer for double
  9444.                                    buffering, set to NULL for single
  9445.                                    buffering. *)
  9446.     red_mask: DWORD;
  9447.     green_mask: DWORD;
  9448.     blue_mask: DWORD;
  9449.     alpha_mask: DWORD;        (* if rgb is true, these are masks for
  9450.                                    the red, green and blue parts of a
  9451.                                    pixel.  Otherwise, these are masks
  9452.                                    for the significant bits of the
  9453.                                    red, green and blue elements in the
  9454.                                    palette.  For instance, most SVGA
  9455.                                    displays use 64 intensities of red,
  9456.                                    green and blue, so the masks should
  9457.                                    all be set to = $fc. *)
  9458.     palette_size: Integer;     (* number of entries in palette *)
  9459.     palette: PD3DRMPaletteEntry; (* description of the palette (only if
  9460.                                    rgb is false).  Must be (1<<depth)
  9461.                                    elements. *)
  9462.   end;
  9463.  
  9464.   PD3DRMWrapType = ^TD3DRMWrapType;
  9465.   TD3DRMWrapType = (
  9466.     D3DRMWRAP_FLAT,
  9467.     D3DRMWRAP_CYLINDER,
  9468.     D3DRMWRAP_SPHERE,
  9469.     D3DRMWRAP_CHROME,
  9470.     D3DRMWRAP_SHEET,
  9471.     D3DRMWRAP_BOX
  9472.   );
  9473.  
  9474. const
  9475.   D3DRMWIREFRAME_CULL             = 1; (* cull backfaces *)
  9476.   D3DRMWIREFRAME_HIDDENLINE       = 2; (* lines are obscured by closer objects *)
  9477.  
  9478. type
  9479. (*
  9480.  * Do not use righthanded perspective in Viewport2::SetProjection().
  9481.  * Set up righthanded mode by using IDirect3DRM3::SetOptions().
  9482.  *)
  9483.   PD3DRMProjectionType = ^TD3DRMProjectionType;
  9484.   TD3DRMProjectionType = (
  9485.     D3DRMPROJECT_PERSPECTIVE,
  9486.     D3DRMPROJECT_ORTHOGRAPHIC,
  9487.     D3DRMPROJECT_RIGHTHANDPERSPECTIVE, (* Only valid pre-DX6 *)
  9488.     D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC (* Only valid pre-DX6 *)
  9489.   );
  9490.  
  9491. const
  9492.   D3DRMOPTIONS_LEFTHANDED  = 00000001; (* Default *)
  9493.   D3DRMOPTIONS_RIGHTHANDED = 00000002;
  9494.  
  9495. type
  9496.   PD3DRMXOFFormat = ^TD3DRMXOFFormat;
  9497.   TD3DRMXOFFormat = (
  9498.     D3DRMXOF_BINARY,
  9499.     D3DRMXOF_COMPRESSED,
  9500.     D3DRMXOF_TEXT
  9501.   );
  9502.  
  9503.   TD3DRMSaveOptions = DWORD;
  9504. const
  9505.   D3DRMXOFSAVE_NORMALS = 1;
  9506.   D3DRMXOFSAVE_TEXTURECOORDINATES = 2;
  9507.   D3DRMXOFSAVE_MATERIALS = 4;
  9508.   D3DRMXOFSAVE_TEXTURENAMES = 8;
  9509.   D3DRMXOFSAVE_ALL = 15;
  9510.   D3DRMXOFSAVE_TEMPLATES = 16;
  9511.   D3DRMXOFSAVE_TEXTURETOPOLOGY = 32;
  9512.  
  9513. type
  9514.   PD3DRMColorSource = ^TD3DRMColorSource;
  9515.   TD3DRMColorSource = (
  9516.     D3DRMCOLOR_FROMFACE,
  9517.     D3DRMCOLOR_FROMVERTEX
  9518.   );
  9519.  
  9520.   PD3DRMFrameConstraint = ^TD3DRMFrameConstraint;
  9521.   TD3DRMFrameConstraint = (
  9522.     D3DRMCONSTRAIN_Z,           (* use only X and Y rotations *)
  9523.     D3DRMCONSTRAIN_Y,           (* use only X and Z rotations *)
  9524.     D3DRMCONSTRAIN_X            (* use only Y and Z rotations *)
  9525.   );
  9526.  
  9527.   PD3DRMMaterialMode = ^TD3DRMMaterialMode;
  9528.   TD3DRMMaterialMode = (
  9529.     D3DRMMATERIAL_FROMMESH,
  9530.     D3DRMMATERIAL_FROMPARENT,
  9531.     D3DRMMATERIAL_FROMFRAME
  9532.   );
  9533.  
  9534.   PD3DRMFogMode = ^TD3DRMFogMode;
  9535.   TD3DRMFogMode = (
  9536.     D3DRMFOG_LINEAR,            (* linear between start and end *)
  9537.     D3DRMFOG_EXPONENTIAL,       (* density * exp(-distance) *)
  9538.     D3DRMFOG_EXPONENTIALSQUARED (* density * exp(-distance*distance) *)
  9539.   );
  9540.  
  9541.   PD3DRMZBufferMode = ^TD3DRMZBufferMode;
  9542.   TD3DRMZBufferMode = (
  9543.     D3DRMZBUFFER_FROMPARENT,    (* default *)
  9544.     D3DRMZBUFFER_ENABLE,        (* enable zbuffering *)
  9545.     D3DRMZBUFFER_DISABLE        (* disable zbuffering *)
  9546.   );
  9547.  
  9548.   PD3DRMSortMode = ^TD3DRMSortMode;
  9549.   TD3DRMSortMode = (
  9550.     D3DRMSORT_FROMPARENT,       (* default *)
  9551.     D3DRMSORT_NONE,             (* don't sort child frames *)
  9552.     D3DRMSORT_FRONTTOBACK,      (* sort child frames front-to-back *)
  9553.     D3DRMSORT_BACKTOFRONT       (* sort child frames back-to-front *)
  9554.   );
  9555.  
  9556.   TD3DRMMaterialOverride = packed record
  9557.     dwSize : DWORD;       (* Size of this structure *)
  9558.     dwFlags : DWORD;      (* Indicate which fields are valid *)
  9559.     dcDiffuse : TD3DColorValue;    (* RGBA *)
  9560.     dcAmbient : TD3DColorValue;    (* RGB *)
  9561.     dcEmissive : TD3DColorValue;   (* RGB *)
  9562.     dcSpecular : TD3DColorValue;   (* RGB *)
  9563.     dvPower : TD3DValue;
  9564.     lpD3DRMTex : IUnknown;
  9565.   end;
  9566.  
  9567. const
  9568.   D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY     = $00000001;
  9569.   D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY       = $00000002;
  9570.   D3DRMMATERIALOVERRIDE_DIFFUSE               = $00000003;
  9571.   D3DRMMATERIALOVERRIDE_AMBIENT               = $00000004;
  9572.   D3DRMMATERIALOVERRIDE_EMISSIVE              = $00000008;
  9573.   D3DRMMATERIALOVERRIDE_SPECULAR              = $00000010;
  9574.   D3DRMMATERIALOVERRIDE_POWER                 = $00000020;
  9575.   D3DRMMATERIALOVERRIDE_TEXTURE               = $00000040;
  9576.   D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY = $00000080;
  9577.   D3DRMMATERIALOVERRIDE_ALL                   = $000000FF;
  9578.  
  9579.   D3DRMFPTF_ALPHA                           = $00000001;
  9580.   D3DRMFPTF_NOALPHA                         = $00000002;
  9581.   D3DRMFPTF_PALETTIZED                      = $00000004;
  9582.   D3DRMFPTF_NOTPALETTIZED                   = $00000008;
  9583.  
  9584.   D3DRMSTATECHANGE_UPDATEONLY               = $000000001;
  9585.   D3DRMSTATECHANGE_VOLATILE                 = $000000002;
  9586.   D3DRMSTATECHANGE_NONVOLATILE              = $000000004;
  9587.   D3DRMSTATECHANGE_RENDER                   = $000000020;
  9588.   D3DRMSTATECHANGE_LIGHT                    = $000000040;
  9589.  
  9590. (*
  9591.  * Values for flags in RM3::CreateDeviceFromSurface
  9592.  *)
  9593.   D3DRMDEVICE_NOZBUFFER           = $00000001;
  9594.  
  9595. (*
  9596.  * Values for flags in Object2::SetClientData
  9597.  *)
  9598.   D3DRMCLIENTDATA_NONE            = $00000001;
  9599.   D3DRMCLIENTDATA_LOCALFREE       = $00000002;
  9600.   D3DRMCLIENTDATA_IUNKNOWN        = $00000004;
  9601.  
  9602. (*
  9603.  * Values for flags in Frame2::AddMoveCallback.
  9604.  *)
  9605.   D3DRMCALLBACK_PREORDER                = 0;
  9606.   D3DRMCALLBACK_POSTORDER               = 1;
  9607.  
  9608. (*
  9609.  * Values for flags in MeshBuilder2::RayPick.
  9610.  *)
  9611.   D3DRMRAYPICK_ONLYBOUNDINGBOXES        = 1;
  9612.   D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES  = 2;
  9613.   D3DRMRAYPICK_INTERPOLATEUV            = 4;
  9614.   D3DRMRAYPICK_INTERPOLATECOLOR         = 8;
  9615.   D3DRMRAYPICK_INTERPOLATENORMAL        = $10;
  9616.  
  9617. (*
  9618.  * Values for flags in MeshBuilder3::AddFacesIndexed.
  9619.  *)
  9620.   D3DRMADDFACES_VERTICESONLY             = 1;
  9621.  
  9622. (*
  9623.  * Values for flags in MeshBuilder2::GenerateNormals.
  9624.  *)
  9625.   D3DRMGENERATENORMALS_PRECOMPACT       = 1;
  9626.   D3DRMGENERATENORMALS_USECREASEANGLE   = 2;
  9627.  
  9628. (*
  9629.  * Values for MeshBuilder3::GetParentMesh
  9630.  *)
  9631.   D3DRMMESHBUILDER_DIRECTPARENT          = 1;
  9632.   D3DRMMESHBUILDER_ROOTMESH              = 2;
  9633.  
  9634. (*
  9635.  * Flags for MeshBuilder3::Enable
  9636.  *)
  9637.   D3DRMMESHBUILDER_RENDERENABLE   = $00000001;
  9638.   D3DRMMESHBUILDER_PICKENABLE     = $00000002;
  9639.  
  9640. (*
  9641.  * Flags for Object2::GetAge when used with MeshBuilders
  9642.  *)
  9643.   D3DRMMESHBUILDERAGE_GEOMETRY    = $00000001;
  9644.   D3DRMMESHBUILDERAGE_MATERIALS   = $00000002;
  9645.   D3DRMMESHBUILDERAGE_TEXTURES    = $00000004;
  9646.  
  9647. (*
  9648.  * Format flags for MeshBuilder3::AddTriangles.
  9649.  *)
  9650.   D3DRMFVF_TYPE                   = $00000001;
  9651.   D3DRMFVF_NORMAL                 = $00000002;
  9652.   D3DRMFVF_COLOR                  = $00000004;
  9653.   D3DRMFVF_TEXTURECOORDS          = $00000008;
  9654.  
  9655.   D3DRMVERTEX_STRIP               = $00000001;
  9656.   D3DRMVERTEX_FAN                 = $00000002;
  9657.   D3DRMVERTEX_LIST                = $00000004;
  9658.  
  9659. (*
  9660.  * Values for flags in Viewport2::Clear2
  9661.  *)
  9662.   D3DRMCLEAR_TARGET               = $00000001;
  9663.   D3DRMCLEAR_ZBUFFER              = $00000002;
  9664.   D3DRMCLEAR_DIRTYRECTS           = $00000004;
  9665.   D3DRMCLEAR_ALL                  = (D3DRMCLEAR_TARGET or
  9666.                                          D3DRMCLEAR_ZBUFFER or
  9667.                                          D3DRMCLEAR_DIRTYRECTS);
  9668.  
  9669. (*
  9670.  * Values for flags in Frame3::SetSceneFogMethod
  9671.  *)
  9672.   D3DRMFOGMETHOD_VERTEX          = $00000001;
  9673.   D3DRMFOGMETHOD_TABLE           = $00000002;
  9674.   D3DRMFOGMETHOD_ANY             = $00000004;
  9675.  
  9676. (*
  9677.  * Values for flags in Frame3::SetTraversalOptions
  9678.  *)
  9679.   D3DRMFRAME_RENDERENABLE        = $00000001;
  9680.   D3DRMFRAME_PICKENABLE          = $00000002;
  9681.  
  9682. type
  9683.   TD3DRMAnimationOptions = DWORD;
  9684.  
  9685. const
  9686.   D3DRMANIMATION_OPEN = $01;
  9687.   D3DRMANIMATION_CLOSED = $02;
  9688.   D3DRMANIMATION_LINEARPOSITION = $04;
  9689.   D3DRMANIMATION_SPLINEPOSITION = $08;
  9690.   D3DRMANIMATION_SCALEANDROTATION = $00000010;
  9691.   D3DRMANIMATION_POSITION = $00000020;
  9692.  
  9693. type
  9694.   TD3DRMInterpolationOptions = DWORD;
  9695. const
  9696.   D3DRMINTERPOLATION_OPEN = $01;
  9697.   D3DRMINTERPOLATION_CLOSED = $02;
  9698.   D3DRMINTERPOLATION_NEAREST = $0100;
  9699.   D3DRMINTERPOLATION_LINEAR = $04;
  9700.   D3DRMINTERPOLATION_SPLINE = $08;
  9701.   D3DRMINTERPOLATION_VERTEXCOLOR = $40;
  9702.   D3DRMINTERPOLATION_SLERPNORMALS = $80;
  9703.  
  9704. type
  9705.   TD3DRMLoadOptions = DWORD;
  9706.  
  9707. const
  9708.   D3DRMLOAD_FROMFILE  = $00;
  9709.   D3DRMLOAD_FROMRESOURCE = $01;
  9710.   D3DRMLOAD_FROMMEMORY = $02;
  9711.   D3DRMLOAD_FROMSTREAM = $04;
  9712.   D3DRMLOAD_FROMURL = $08;
  9713.  
  9714.   D3DRMLOAD_BYNAME = $10;
  9715.   D3DRMLOAD_BYPOSITION = $20;
  9716.   D3DRMLOAD_BYGUID = $40;
  9717.   D3DRMLOAD_FIRST = $80;
  9718.  
  9719.   D3DRMLOAD_INSTANCEBYREFERENCE = $100;
  9720.   D3DRMLOAD_INSTANCEBYCOPYING = $200;
  9721.  
  9722.   D3DRMLOAD_ASYNCHRONOUS = $400;
  9723.  
  9724. type
  9725.   PD3DRMLoadResource = ^TD3DRMLoadResource;
  9726.   TD3DRMLoadResource = packed record
  9727.     hModule: HMODULE;
  9728.     lpName: PAnsiChar;
  9729.     lpType: PAnsiChar;
  9730.   end;
  9731.  
  9732.   PD3DRMLoadMemory = ^TD3DRMLoadMemory;
  9733.   TD3DRMLoadMemory = packed record
  9734.     lpMemory: Pointer;
  9735.     dwSize: DWORD;
  9736.   end;
  9737.  
  9738. const
  9739.   D3DRMPMESHSTATUS_VALID = $01;
  9740.   D3DRMPMESHSTATUS_INTERRUPTED = $02;
  9741.   D3DRMPMESHSTATUS_BASEMESHCOMPLETE = $04;
  9742.   D3DRMPMESHSTATUS_COMPLETE = $08;
  9743.   D3DRMPMESHSTATUS_RENDERABLE = $10;
  9744.  
  9745.   D3DRMPMESHEVENT_BASEMESH = $01;
  9746.   D3DRMPMESHEVENT_COMPLETE = $02;
  9747.  
  9748. type
  9749.   PD3DRMPMeshLoadStatus = ^TD3DRMPMeshLoadStatus;
  9750.   TD3DRMPMeshLoadStatus = packed record
  9751.     dwSize,            // Size of this structure
  9752.     dwPMeshSize,       // Total Size (bytes)
  9753.     dwBaseMeshSize,    // Total Size of the Base Mesh
  9754.     dwBytesLoaded,     // Total bytes loaded
  9755.     dwVerticesLoaded,  // Number of vertices loaded
  9756.     dwFacesLoaded : DWORD;     // Number of faces loaded
  9757.     dwLoadResult : HResult;    // Result of the load operation
  9758.     dwFlags : DWORD;
  9759.   end;
  9760.  
  9761.   PD3DRMUserVisualReason = ^TD3DRMUserVisualReason;
  9762.   TD3DRMUserVisualReason = (
  9763.     D3DRMUSERVISUAL_CANSEE,
  9764.     D3DRMUSERVISUAL_RENDER
  9765.   );
  9766.  
  9767.   PD3DRMAnimationKey = ^TD3DRMAnimationKey;
  9768.   TD3DRMAnimationKey = packed record
  9769.     dwSize : DWORD;
  9770.     dwKeyType : DWORD;
  9771.     dvTime : TD3DValue;
  9772.     dwID : DWORD;
  9773.     case integer of
  9774.       0 : (dqRotateKey : TD3DRMQuaternion);
  9775.       1 : (dvScaleKey : TD3DVector);
  9776.       2 : (dvPositionKey : TD3DVector);
  9777.       3 : (dvK : array [0..3] of TD3DValue);
  9778.     end;
  9779.  
  9780. procedure D3DRMAnimationGetRotateKey
  9781.     (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  9782.  
  9783. procedure D3DRMAnimationGetScaleKey
  9784.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9785.  
  9786. procedure D3DRMAnimationGetPositionKey
  9787.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9788.  
  9789. procedure D3DRMAnimatioSetRotateKey
  9790.     (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  9791.  
  9792. procedure D3DRMAnimationSetScaleKey
  9793.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9794.  
  9795. procedure D3DRMAnimationSetPositionKey
  9796.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9797.  
  9798. const
  9799.   D3DRMANIMATION_ROTATEKEY = 01;
  9800.   D3DRMANIMATION_SCALEKEY = 02;
  9801.   D3DRMANIMATION_POSITIONKEY = 03;
  9802.  
  9803. type
  9804.   TD3DRMMapping = DWORD;
  9805.   PD3DRMMappingFlag = ^TD3DRMMappingFlag;
  9806.   TD3DRMMappingFlag = DWORD;
  9807.  
  9808. const
  9809.   D3DRMMAP_WRAPU = 1;
  9810.   D3DRMMAP_WRAPV = 2;
  9811.   D3DRMMAP_PERSPCORRECT = 4;
  9812.  
  9813. type
  9814.   PD3DRMVertex = ^TD3DRMVertex;
  9815.   TD3DRMVertex = packed record
  9816.     position: TD3DVector;
  9817.     normal: TD3DVector;
  9818.     tu, tv: TD3DValue;
  9819.     color: TD3DColor;
  9820.   end;
  9821.  
  9822.   TD3DRMGroupIndex = LongInt; (* group indexes begin a 0 *)
  9823.  
  9824. const
  9825.   D3DRMGROUP_ALLGROUPS = -1;
  9826.  
  9827. var
  9828. (*
  9829.  * Create a color from three components in the range 0-1 inclusive.
  9830.  *)
  9831.   D3DRMCreateColorRGB : function (red, green, blue: TD3DValue) : TD3DColor;
  9832.       stdcall;
  9833.  
  9834. (*
  9835.  * Create a color from four components in the range 0-1 inclusive.
  9836.  *)
  9837.   D3DRMCreateColorRGBA : function (red, green, blue, alpha: TD3DValue)
  9838.       : TD3DColor; stdcall;
  9839.  
  9840. (*
  9841.  * Get the red component of a color.
  9842.  *)
  9843.   D3DRMColorGetRed : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9844.  
  9845. (*
  9846.  * Get the green component of a color.
  9847.  *)
  9848.   D3DRMColorGetGreen : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9849.  
  9850. (*
  9851.  * Get the blue component of a color.
  9852.  *)
  9853.   D3DRMColorGetBlue : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9854.  
  9855. (*
  9856.  * Get the alpha component of a color.
  9857.  *)
  9858.   D3DRMColorGetAlpha : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9859.  
  9860. (*
  9861.  * Add two vectors.  Returns its first argument.
  9862.  *)
  9863.   D3DRMVectorAdd : function (var d, s1, s2: TD3DVector) : PD3DVector; stdcall;
  9864.  
  9865. (*
  9866.  * Subtract two vectors.  Returns its first argument.
  9867.  *)
  9868.   D3DRMVectorSubtract : function (var d, s1, s2: TD3DVector) : PD3DVector;
  9869.       stdcall;
  9870.  
  9871. (*
  9872.  * Reflect a ray about a given normal.  Returns its first argument.
  9873.  *)
  9874.   D3DRMVectorReflect : function (var d, ray, norm: TD3DVector) : PD3DVector;
  9875.       stdcall;
  9876.  
  9877. (*
  9878.  * Calculate the vector cross product.  Returns its first argument.
  9879.  *)
  9880.   D3DRMVectorCrossProduct : function (var d, s1, s2: TD3DVector) : PD3DVector;
  9881.       stdcall;
  9882.  
  9883. (*
  9884.  * Return the vector dot product.
  9885.  *)
  9886.   D3DRMVectorDotProduct : function (var s1, s2: TD3DVector) : TD3DValue;
  9887.       stdcall;
  9888.  
  9889. (*
  9890.  * Scale a vector so that its modulus is 1.  Returns its argument or
  9891.  * NULL if there was an error (e.g. a zero vector was passed).
  9892.  *)
  9893.   D3DRMVectorNormalize : function (var lpv: TD3DVector) : PD3DVector; stdcall;
  9894.  
  9895. (*
  9896.  * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
  9897.  *)
  9898.   D3DRMVectorModulus : function (var v: TD3DVector) : TD3DValue; stdcall;
  9899.  
  9900. (*
  9901.  * Set the rotation part of a matrix to be a rotation of theta radians
  9902.  * around the given axis.
  9903.  *)
  9904.   D3DRMVectorRotate : function (var r, v, axis: TD3DVector; theta: TD3DValue) :
  9905.       PD3DVector; stdcall;
  9906.  
  9907. (*
  9908.  * Scale a vector uniformly in all three axes
  9909.  *)
  9910.   D3DRMVectorScale : function (var d, s: TD3DVector; factor: TD3DValue) :
  9911.       PD3DVector; stdcall;
  9912.  
  9913. (*
  9914.  * Return a random unit vector
  9915.  *)
  9916.   D3DRMVectorRandom : function (var d: TD3DVector) : PD3DVector; stdcall;
  9917.  
  9918. (*
  9919.  * Returns a unit quaternion that represents a rotation of theta radians
  9920.  * around the given axis.
  9921.  *)
  9922.  
  9923.   D3DRMQuaternionFromRotation : function (var quat: TD3DRMQuaternion;
  9924.       var v: TD3DVector; theta: TD3DValue) : PD3DRMQuaternion; stdcall;
  9925.  
  9926. (*
  9927.  * Calculate the product of two quaternions
  9928.  *)
  9929.   D3DRMQuaternionMultiply : function (var q, a, b: TD3DRMQuaternion) :
  9930.       PD3DRMQuaternion; stdcall;
  9931.  
  9932. (*
  9933.  * Interpolate between two quaternions
  9934.  *)
  9935.   D3DRMQuaternionSlerp : function (var q, a, b: TD3DRMQuaternion;
  9936.       alpha: TD3DValue) : PD3DRMQuaternion; stdcall;
  9937.  
  9938. (*
  9939.  * Calculate the matrix for the rotation that a unit quaternion represents
  9940.  *)
  9941.   D3DRMMatrixFromQuaternion : procedure (dmMat: TD3DRMMatrix4D; var lpDqQuat:
  9942.       TD3DRMQuaternion); stdcall;
  9943.  
  9944. (*
  9945.  * Calculate the quaternion that corresponds to a rotation matrix
  9946.  *)
  9947.   D3DRMQuaternionFromMatrix : function (var lpQuat: TD3DRMQuaternion;
  9948.       Mat: TD3DRMMatrix4D) : PD3DRMQuaternion; stdcall;
  9949.  
  9950. (*==========================================================================;
  9951.  *
  9952.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  9953.  *
  9954.  *  File:       d3drmobj.h
  9955.  *  Content:    Direct3DRM include file
  9956.  *
  9957.  ***************************************************************************)
  9958.  
  9959. (*
  9960.  * Direct3DRM Object classes
  9961.  *)
  9962.  
  9963. const
  9964.   CLSID_CDirect3DRMDevice: TGUID =
  9965.       (D1:$4fa3568e;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9966.   CLSID_CDirect3DRMViewport: TGUID =
  9967.       (D1:$4fa3568f;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9968.   CLSID_CDirect3DRMFrame: TGUID =
  9969.       (D1:$4fa35690;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9970.   CLSID_CDirect3DRMMesh: TGUID =
  9971.       (D1:$4fa35691;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9972.   CLSID_CDirect3DRMMeshBuilder: TGUID =
  9973.       (D1:$4fa35692;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9974.   CLSID_CDirect3DRMFace: TGUID =
  9975.       (D1:$4fa35693;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9976.   CLSID_CDirect3DRMLight: TGUID =
  9977.       (D1:$4fa35694;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9978.   CLSID_CDirect3DRMTexture: TGUID =
  9979.       (D1:$4fa35695;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9980.   CLSID_CDirect3DRMWrap: TGUID =
  9981.       (D1:$4fa35696;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9982.   CLSID_CDirect3DRMMaterial: TGUID =
  9983.       (D1:$4fa35697;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9984.   CLSID_CDirect3DRMAnimation: TGUID =
  9985.       (D1:$4fa35698;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9986.   CLSID_CDirect3DRMAnimationSet: TGUID =
  9987.       (D1:$4fa35699;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9988.   CLSID_CDirect3DRMUserVisual: TGUID =
  9989.       (D1:$4fa3569a;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9990.   CLSID_CDirect3DRMShadow: TGUID =
  9991.       (D1:$4fa3569b;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9992.   CLSID_CDirect3DRMViewportInterpolator: TGUID =
  9993.       (D1:$0de9eaa1;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  9994.   CLSID_CDirect3DRMFrameInterpolator: TGUID =
  9995.       (D1:$0de9eaa2;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  9996.   CLSID_CDirect3DRMMeshInterpolator: TGUID =
  9997.       (D1:$0de9eaa3;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  9998.   CLSID_CDirect3DRMLightInterpolator: TGUID =
  9999.       (D1:$0de9eaa6;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10000.   CLSID_CDirect3DRMMaterialInterpolator: TGUID =
  10001.       (D1:$0de9eaa7;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10002.   CLSID_CDirect3DRMTextureInterpolator: TGUID =
  10003.       (D1:$0de9eaa8;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10004.   CLSID_CDirect3DRMProgressiveMesh: TGUID =
  10005.       (D1:$4516ec40;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10006.   CLSID_CDirect3DRMClippedVisual: TGUID =
  10007.       (D1:$5434e72d;D2:$6d66;D3:$11d1;D4:($bb,$0b,$00,$00,$f8,$75,$86,$5a));
  10008.  
  10009.  
  10010.  
  10011. type
  10012.   IDirect3DRMObject = interface;
  10013.   IDirect3DRMDevice = interface;
  10014.   IDirect3DRMDevice2 = interface;
  10015.   IDirect3DRMDevice3 = interface;
  10016.   IDirect3DRMViewport = interface;
  10017.   IDirect3DRMViewport2 = interface;
  10018.   IDirect3DRMFrame = interface;
  10019.   IDirect3DRMFrame2 = interface;
  10020.   IDirect3DRMFrame3 = interface;
  10021.   IDirect3DRMVisual = interface;
  10022.   IDirect3DRMMesh = interface;
  10023.   IDirect3DRMMeshBuilder = interface;
  10024.   IDirect3DRMMeshBuilder2 = interface;
  10025.   IDirect3DRMMeshBuilder3 = interface;
  10026.   IDirect3DRMFace = interface;
  10027.   IDirect3DRMFace2 = interface;
  10028.   IDirect3DRMLight = interface;
  10029.   IDirect3DRMTexture = interface;
  10030.   IDirect3DRMTexture2 = interface;
  10031.   IDirect3DRMTexture3 = interface;
  10032.   IDirect3DRMWrap = interface;
  10033.   IDirect3DRMMaterial = interface;
  10034.   IDirect3DRMMaterial2 = interface;
  10035.   IDirect3DRMAnimation = interface;
  10036.   IDirect3DRMAnimation2 = interface;
  10037.   IDirect3DRMAnimationSet = interface;
  10038.   IDirect3DRMAnimationSet2 = interface;
  10039.   IDirect3DRMArray = interface;
  10040.   IDirect3DRMObjectArray = interface;
  10041.   IDirect3DRMDeviceArray = interface;
  10042.   IDirect3DRMViewportArray = interface;
  10043.   IDirect3DRMFrameArray = interface;
  10044.   IDirect3DRMVisualArray = interface;
  10045.   IDirect3DRMLightArray = interface;
  10046.   IDirect3DRMPickedArray = interface;
  10047.   IDirect3DRMFaceArray = interface;
  10048.   IDirect3DRMAnimationArray = interface;
  10049.   IDirect3DRMUserVisual = interface;
  10050.   IDirect3DRMShadow = interface;
  10051.   IDirect3DRMShadow2 = interface;
  10052.   IDirect3DRMInterpolator = interface;
  10053.   IDirect3DRMProgressiveMesh = interface;
  10054.   IDirect3DRMPicked2Array = interface;
  10055.   IDirect3DRMClippedVisual = interface;
  10056.  
  10057. (*
  10058.  * Direct3DRM Object interfaces
  10059.  *)
  10060.   IID_IDirect3DRMObject =          IDirect3DRMObject;
  10061.   IID_IDirect3DRMDevice =          IDirect3DRMDevice;
  10062.   IID_IDirect3DRMDevice2 =         IDirect3DRMDevice2;
  10063.   IID_IDirect3DRMDevice3 =         IDirect3DRMDevice3;
  10064.   IID_IDirect3DRMViewport =        IDirect3DRMViewport;
  10065.   IID_IDirect3DRMViewport2 =       IDirect3DRMViewport2;
  10066.   IID_IDirect3DRMFrame =           IDirect3DRMFrame;
  10067.   IID_IDirect3DRMFrame2 =          IDirect3DRMFrame2;
  10068.   IID_IDirect3DRMFrame3 =          IDirect3DRMFrame3;
  10069.   IID_IDirect3DRMVisual =          IDirect3DRMVisual;
  10070.   IID_IDirect3DRMMesh =            IDirect3DRMMesh;
  10071.   IID_IDirect3DRMMeshBuilder =     IDirect3DRMMeshBuilder;
  10072.   IID_IDirect3DRMMeshBuilder2 =    IDirect3DRMMeshBuilder2;
  10073.   IID_IDirect3DRMMeshBuilder3 =    IDirect3DRMMeshBuilder3;
  10074.   IID_IDirect3DRMFace =            IDirect3DRMFace;
  10075.   IID_IDirect3DRMFace2 =           IDirect3DRMFace2;
  10076.   IID_IDirect3DRMLight =           IDirect3DRMLight;
  10077.   IID_IDirect3DRMTexture =         IDirect3DRMTexture;
  10078.   IID_IDirect3DRMTexture2 =        IDirect3DRMTexture2;
  10079.   IID_IDirect3DRMTexture3 =        IDirect3DRMTexture3;
  10080.   IID_IDirect3DRMWrap =            IDirect3DRMWrap;
  10081.   IID_IDirect3DRMMaterial =        IDirect3DRMMaterial;
  10082.   IID_IDirect3DRMMaterial2 =       IDirect3DRMMaterial2;
  10083.   IID_IDirect3DRMAnimation =       IDirect3DRMAnimation;
  10084.   IID_IDirect3DRMAnimation2 =      IDirect3DRMAnimation2;
  10085.   IID_IDirect3DRMAnimationSet =    IDirect3DRMAnimationSet;
  10086.   IID_IDirect3DRMAnimationSet2 =   IDirect3DRMAnimationSet2;
  10087.   IID_IDirect3DRMObjectArray =     IDirect3DRMObjectArray;
  10088.   IID_IDirect3DRMDeviceArray =     IDirect3DRMDeviceArray;
  10089.   IID_IDirect3DRMViewportArray =   IDirect3DRMViewportArray;
  10090.   IID_IDirect3DRMFrameArray =      IDirect3DRMFrameArray;
  10091.   IID_IDirect3DRMVisualArray =     IDirect3DRMVisualArray;
  10092.   IID_IDirect3DRMLightArray =      IDirect3DRMLightArray;
  10093.   IID_IDirect3DRMPickedArray =     IDirect3DRMPickedArray;
  10094.   IID_IDirect3DRMFaceArray =       IDirect3DRMFaceArray;
  10095.   IID_IDirect3DRMAnimationArray =  IDirect3DRMAnimationArray;
  10096.   IID_IDirect3DRMUserVisual =      IDirect3DRMUserVisual;
  10097.   IID_IDirect3DRMShadow =          IDirect3DRMShadow;
  10098.   IID_IDirect3DRMShadow2 =         IDirect3DRMShadow2;
  10099.   IID_IDirect3DRMInterpolator =    IDirect3DRMInterpolator;
  10100.   IID_IDirect3DRMProgressiveMesh = IDirect3DRMProgressiveMesh;
  10101.   IID_IDirect3DRMPicked2Array =    IDirect3DRMPicked2Array;
  10102.   IID_IDirect3DRMClippedVisual =   IDirect3DRMClippedVisual;
  10103.  
  10104.  
  10105.  
  10106.  
  10107.  
  10108.   PIDirect3DRMFaceArray = ^IDirect3DRMFaceArray;
  10109.  
  10110.   TD3DRMObjectCallback = procedure (lpD3DRMobj: IDirect3DRMObject;
  10111.       lpArg: Pointer); cdecl;
  10112.   TD3DRMFrameMoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame;
  10113.       lpArg: Pointer; delta: TD3DValue); cdecl;
  10114.   TD3DRMFrame3MoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame3;
  10115.       lpArg: Pointer; delta: TD3DValue); cdecl;
  10116.   TD3DRMUpdateCallback = procedure (lpobj: IDirect3DRMDevice; lpArg: Pointer;
  10117.       iRectCount: Integer; const d3dRectUpdate: TD3DRect); cdecl;
  10118.   TD3DRMDevice3UpdateCallback = procedure (lpobj: IDirect3DRMDevice3;
  10119.       lpArg: Pointer; iRectCount: Integer; const d3dRectUpdate: TD3DRect);cdecl;
  10120.   TD3DRMUserVisualCallback = function (lpD3DRMUV: IDirect3DRMUserVisual;
  10121.       lpArg: Pointer; lpD3DRMUVreason: TD3DRMUserVisualReason;
  10122.       lpD3DRMDev: IDirect3DRMDevice;
  10123.       lpD3DRMview: IDirect3DRMViewport) : Integer; cdecl;
  10124.   TD3DRMLoadTextureCallback = function (tex_name: PAnsiChar; lpArg: Pointer;
  10125.       out lpD3DRMTex: IDirect3DRMTexture) : HResult; cdecl;
  10126.   TD3DRMLoadTexture3Callback = function (tex_name: PAnsiChar; lpArg: Pointer;
  10127.       out lpD3DRMTex: IDirect3DRMTexture3) : HResult; cdecl;
  10128.   TD3DRMLoadCallback = procedure (lpObject: IDirect3DRMObject;
  10129.       const ObjectGuid: TGUID; lpArg: Pointer); cdecl;
  10130.   TD3DRMDownSampleCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
  10131.       pArg: pointer; pDDSSrc, pDDSDst: IDirectDrawSurface) : HResult; cdecl;
  10132.   TD3DRMValidationCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
  10133.       pArg: pointer; dwFlags, DWcRects: DWORD; const pRects: TRect) : HResult; cdecl;
  10134.  
  10135.   PD3DRMPickDesc = ^TD3DRMPickDesc;
  10136.   TD3DRMPickDesc = packed record
  10137.     ulFaceIdx: DWORD;
  10138.     lGroupIdx: LongInt;
  10139.     vPosition: TD3DVector;
  10140.   end;
  10141.  
  10142.   PD3DRMPickDesc2 = ^TD3DRMPickDesc2;
  10143.   TD3DRMPickDesc2 = packed record
  10144.     ulFaceIdx: DWORD;
  10145.     lGroupIdx: LongInt;
  10146.     dvPosition: TD3DVector;
  10147.     tu, tv: TD3DValue;
  10148.     dvNormal: TD3DVector;
  10149.     dcColor: TD3DColor;
  10150.   end;
  10151.  
  10152. (*
  10153.  * Base class
  10154.  *)
  10155. {$IFDEF D2COM}
  10156.   IDirect3DRMObject = class (IUnknown)
  10157. {$ELSE}
  10158.   IDirect3DRMObject = interface (IUnknown)
  10159.     ['{eb16cb00-d271-11ce-ac48-0000c03825a1}']
  10160. {$ENDIF}
  10161.     (*
  10162.      * The methods for IDirect3DRMObject
  10163.      *)
  10164.     function Clone (pUnkOuter: IUnknown; riid: TGUID;
  10165.         var ppvObj: Pointer) : HResult; stdcall;
  10166.     function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
  10167.         lpArg: Pointer) : HResult; stdcall;
  10168.     function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
  10169.         lpArg: Pointer) : HResult; stdcall;
  10170.     function SetAppData (ulData: DWORD) : HResult; stdcall;
  10171.     function GetAppData: DWORD; stdcall;
  10172.     function SetName (lpName: PAnsiChar) : HResult; stdcall;
  10173.     function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  10174.     function GetClassName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  10175.   end;
  10176.  
  10177.   IDirect3DRMVisual = interface (IDirect3DRMObject)
  10178.   end;
  10179.  
  10180.   IDirect3DRMDevice = interface (IDirect3DRMObject)
  10181.     ['{e9e19280-6e05-11cf-ac4a-0000c03825a1}']
  10182.     (*
  10183.      * IDirect3DRMDevice methods
  10184.      *)
  10185.     function Init (width: LongInt; height: LongInt) : HResult; stdcall;
  10186.     function InitFromD3D (lpD3D: IDirect3D; lpD3DIMDev: IDirect3DDevice) : HResult; stdcall;
  10187.     function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
  10188.         width: Integer; height: Integer) : HResult; stdcall;
  10189.     function Update: HResult; stdcall;
  10190.     function AddUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
  10191.         arg: Pointer) : HResult; stdcall;
  10192.     function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
  10193.         arg: Pointer) : HResult; stdcall;
  10194.     function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
  10195.     function GetBufferCount: DWORD; stdcall;
  10196.     function SetDither (bDither: BOOL) : HResult; stdcall;
  10197.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10198.     function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
  10199.     function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
  10200.     function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
  10201.     function GetDither: BOOL; stdcall;
  10202.     function GetShades: DWORD; stdcall;
  10203.     function GetHeight: DWORD; stdcall;
  10204.     function GetWidth: DWORD; stdcall;
  10205.     function GetTrianglesDrawn: DWORD; stdcall;
  10206.     function GetWireframeOptions: DWORD; stdcall;
  10207.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10208.     function GetColorModel: TD3DColorModel; stdcall;
  10209.     function GetTextureQuality: TD3DRMTextureQuality; stdcall;
  10210.     function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
  10211.   end;
  10212.  
  10213.   IDirect3DRMDevice2 = interface (IDirect3DRMDevice)
  10214.     ['{4516ec78-8f20-11d0-9b6d-0000c0781bc3}']
  10215.     (*
  10216.      * IDirect3DRMDevice2 methods
  10217.      *)
  10218.     function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10219.     function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw; lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
  10220.     function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
  10221.     function GetRenderMode : DWORD; stdcall;
  10222.     function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
  10223.   end;
  10224.  
  10225.   IDirect3DRMDevice3 = interface (IDirect3DRMObject)
  10226.     ['{549f498b-bfeb-11d1-8ed8-00a0c967a482}']
  10227.     (*
  10228.      * IDirect3DRMDevice methods
  10229.      *)
  10230.     function Init (width: LongInt; height: LongInt) : HResult; stdcall;
  10231.     function InitFromD3D (lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10232.     function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
  10233.         width: Integer; height: Integer) : HResult; stdcall;
  10234.     function Update: HResult; stdcall;
  10235.     function AddUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
  10236.         arg: Pointer) : HResult; stdcall;
  10237.     function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
  10238.         arg: Pointer) : HResult; stdcall;
  10239.     function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
  10240.     function GetBufferCount: DWORD; stdcall;
  10241.     function SetDither (bDither: BOOL) : HResult; stdcall;
  10242.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10243.     function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
  10244.     function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
  10245.     function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
  10246.     function GetDither: BOOL; stdcall;
  10247.     function GetShades: DWORD; stdcall;
  10248.     function GetHeight: DWORD; stdcall;
  10249.     function GetWidth: DWORD; stdcall;
  10250.     function GetTrianglesDrawn: DWORD; stdcall;
  10251.     function GetWireframeOptions: DWORD; stdcall;
  10252.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10253.     function GetColorModel: TD3DColorModel; stdcall;
  10254.     function GetTextureQuality: TD3DRMTextureQuality; stdcall;
  10255.     function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
  10256.     (*
  10257.      * IDirect3DRMDevice2 methods
  10258.      *)
  10259.     function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10260.     function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw;
  10261.             lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
  10262.     function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
  10263.     function GetRenderMode : DWORD; stdcall;
  10264.     function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
  10265.     (*
  10266.      * IDirect3DRMDevice3 methods
  10267.      *)
  10268.     function FindPreferredTextureFormat (dwBitDepths, dwFlags: DWORD;
  10269.         out lpDDPF: TDDPixelFormat) : HResult; stdcall;
  10270.     function RenderStateChange (dwStateNum, dwVal, dwFlags: DWORD) : HResult; stdcall;
  10271.  
  10272.     function LightStateChange (drsType: TD3DLightStateType; // defined different in header and help
  10273.         dwVal, dwFlags: DWORD) : HResult; stdcall;
  10274.     function GetStateChangeOptions (dwStateClass, dwStateNum: DWORD;
  10275.         var pdwFlags: DWORD) : HResult; stdcall;
  10276.     function SetStateChangeOptions ( dwStateClass, dwStateNum, dwFlags: DWORD) : HResult; stdcall;
  10277.   end;
  10278.  
  10279.   IDirect3DRMViewport = interface (IDirect3DRMObject)
  10280.     ['{eb16cb02-d271-11ce-ac48-0000c03825a1}']
  10281.     (*
  10282.      * IDirect3DRMViewport methods
  10283.      *)
  10284.     function Init (lpD3DRMDevice: IDirect3DRMDevice;
  10285.         lpD3DRMFrameCamera: IDirect3DRMFrame; xpos, ypos,
  10286.         width, height: DWORD) : HResult; stdcall;
  10287.     function Clear: HResult; stdcall;
  10288.     function Render (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  10289.     function SetFront (rvFront: TD3DValue) : HResult; stdcall;
  10290.     function SetBack (rvBack: TD3DValue) : HResult; stdcall;
  10291.     function SetField (rvField: TD3DValue) : HResult; stdcall;
  10292.     function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
  10293.     function SetCamera (lpCamera: IDirect3DRMFrame) : HResult; stdcall;
  10294.     function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
  10295.     function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
  10296.     function InverseTransform (out lprvDst: TD3DVector;
  10297.         const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
  10298.     function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
  10299.     function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
  10300.     function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
  10301.     function GetCamera (out lpCamera: IDirect3DRMFrame) : HResult; stdcall;
  10302.     function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
  10303.     function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
  10304.         TD3DValue) : HResult; stdcall;
  10305.     function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
  10306.     function GetUniformScaling: BOOL;  stdcall;
  10307.     function GetX: LongInt; stdcall;
  10308.     function GetY: LongInt; stdcall;
  10309.     function GetWidth: DWORD; stdcall;
  10310.     function GetHeight: DWORD; stdcall;
  10311.     function GetField: TD3DValue; stdcall;
  10312.     function GetBack: TD3DValue; stdcall;
  10313.     function GetFront: TD3DValue; stdcall;
  10314.     function GetProjection: TD3DRMProjectionType; stdcall;
  10315.     function GetDirect3DViewport (out lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
  10316.   end;
  10317.  
  10318.   IDirect3DRMViewport2 = interface (IDirect3DRMObject)
  10319.     ['{4a1b1be6-bfed-11d1-8ed8-00a0c967a482}']
  10320.     (*
  10321.      * IDirect3DRMViewport2 methods
  10322.      *)
  10323.     function Init (lpD3DRMDevice: IDirect3DRMDevice3;
  10324.         lpD3DRMFrameCamera: IDirect3DRMFrame3; xpos, ypos,
  10325.         width, height: DWORD) : HResult; stdcall;
  10326.     function Clear (dwFlags: DWORD): HResult; stdcall;
  10327.     function Render (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  10328.     function SetFront (rvFront: TD3DValue) : HResult; stdcall;
  10329.     function SetBack (rvBack: TD3DValue) : HResult; stdcall;
  10330.     function SetField (rvField: TD3DValue) : HResult; stdcall;
  10331.     function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
  10332.     function SetCamera (lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
  10333.     function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
  10334.     function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
  10335.     function InverseTransform (out lprvDst: TD3DVector;
  10336.         const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
  10337.     function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
  10338.     function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
  10339.     function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
  10340.     function GetCamera (out lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
  10341.     function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  10342.     function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
  10343.         TD3DValue) : HResult; stdcall;
  10344.     function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
  10345.     function GetUniformScaling: BOOL; stdcall;
  10346.     function GetX: LongInt; stdcall;
  10347.     function GetY: LongInt; stdcall;
  10348.     function GetWidth: DWORD; stdcall;
  10349.     function GetHeight: DWORD; stdcall;
  10350.     function GetField: TD3DValue; stdcall;
  10351.     function GetBack: TD3DValue; stdcall;
  10352.     function GetFront: TD3DValue; stdcall;
  10353.     function GetProjection: TD3DRMProjectionType; stdcall;
  10354.     function GetDirect3DViewport (var lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
  10355.     function TransformVectors (dwNumVectors: DWORD; out lpDstVectors:
  10356.         TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10357.     function InverseTransformVectors (dwNumVectors: DWORD; out lpDstVectors:
  10358.         TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10359.   end;
  10360.  
  10361.   IDirect3DRMFrame = interface (IDirect3DRMVisual)
  10362.     ['{eb16cb03-d271-11ce-ac48-0000c03825a1}']
  10363.     (*
  10364.      * IDirect3DRMFrame methods
  10365.      *)
  10366.     function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame) : HResult; stdcall;
  10367.     function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10368.     function AddMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
  10369.         lpArg: Pointer) : HResult; stdcall;
  10370.     function AddTransform (rctCombine: TD3DRMCombineType;
  10371.         rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10372.     function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
  10373.         TD3DValue) : HResult; stdcall;
  10374.     function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10375.     function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
  10376.         rvTheta: TD3DValue) : HResult; stdcall;
  10377.     function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10378.     function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
  10379.     function GetColor: TD3DColor; stdcall;
  10380.     function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
  10381.     function GetMaterialMode: TD3DRMMaterialMode; stdcall;
  10382.     function GetParent (out lplpParent: IDirect3DRMFrame) : HResult; stdcall;
  10383.     function GetPosition (lpRef: IDirect3DRMFrame; out lprvPos: TD3DVector) : HResult; stdcall;
  10384.     function GetRotation (lpRef: IDirect3DRMFrame; out lprvAxis: TD3DVector;
  10385.         out lprvTheta: TD3DValue) : HResult; stdcall;
  10386.     function GetScene (out lplpRoot: IDirect3DRMFrame) : HResult; stdcall;
  10387.     function GetSortMode: TD3DRMSortMode; stdcall;
  10388.     function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10389.     function GetTransform (out rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10390.     function GetVelocity (lpRef: IDirect3DRMFrame; var lprvVel: TD3DVector;
  10391.         fRotVel: BOOL) : HResult; stdcall;
  10392.     function GetOrientation (lpRef: IDirect3DRMFrame; var lprvDir: TD3DVector;
  10393.         var lprvUp: TD3DVector) : HResult; stdcall;
  10394.     function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
  10395.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10396.     function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
  10397.     function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
  10398.         d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
  10399.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer) : HResult; stdcall;
  10400.     function LookAt (lpTarget, lpRef: IDirect3DRMFrame;
  10401.         rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
  10402.     function Move (delta: TD3DValue) : HResult; stdcall;
  10403.     function DeleteChild (lpChild: IDirect3DRMFrame) : HResult; stdcall;
  10404.     function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10405.     function DeleteMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
  10406.         lpArg: Pointer) : HResult; stdcall;
  10407.     function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10408.     function GetSceneBackground: TD3DColor; stdcall;
  10409.     function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  10410.     function GetSceneFogColor: TD3DColor; stdcall;
  10411.     function GetSceneFogEnable: BOOL; stdcall;
  10412.     function GetSceneFogMode: TD3DRMFogMode; stdcall;
  10413.     function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
  10414.     function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
  10415.     function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10416.     function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
  10417.     function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10418.     function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
  10419.     function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
  10420.     function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
  10421.     function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
  10422.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10423.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10424.     function GetZbufferMode: TD3DRMZBufferMode; stdcall;
  10425.     function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
  10426.     function SetOrientation (lpRef: IDirect3DRMFrame; rvDx, rvDy, rvDz, rvUx,
  10427.         rvUy, rvUz: TD3DValue) : HResult; stdcall;
  10428.     function SetPosition (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10429.     function SetRotation (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ,
  10430.         rvTheta: TD3DValue) : HResult; stdcall;
  10431.     function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
  10432.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10433.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10434.     function SetVelocity (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue;
  10435.         fRotVel: BOOL) : HResult; stdcall;
  10436.     function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
  10437.     function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
  10438.   end;
  10439.  
  10440.   IDirect3DRMFrame2 = interface (IDirect3DRMFrame)
  10441.     ['{c3dfbd60-3988-11d0-9ec2-0000c0291ac3}']
  10442.     (*
  10443.      * IDirect3DRMFrame2 methods
  10444.      *)
  10445.     function AddMoveCallback2 (d3drmFMC: TD3DRMFrameMoveCallback; lpArg:
  10446.         Pointer; dwFlags: DWORD) : HResult; stdcall;
  10447.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10448.     function GetBoxEnable : boolean; stdcall;
  10449.     function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
  10450.     function GetMaterial (out lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10451.     function GetInheritAxes : boolean; stdcall;
  10452.     function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10453.     function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10454.     function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
  10455.     function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
  10456.     function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
  10457.     function SetMaterial (var lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10458.     function SetQuaternion (lpRef: IDirect3DRMFrame;
  10459.         const quat: TD3DRMQuaternion) : HResult; stdcall;
  10460.     function RayPick (lpRefFrame: IDirect3DRMFrame; var ray: TD3DRMRay;
  10461.         dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) :
  10462.         HResult; stdcall;
  10463.     function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
  10464.         d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
  10465.   end;
  10466.  
  10467.   IDirect3DRMFrame3 = interface (IDirect3DRMVisual)
  10468.     ['{ff6b7f70-a40e-11d1-91f9-0000f8758e66}']
  10469.     (*
  10470.      * IDirect3DRMFrame3 methods
  10471.      *)
  10472.     function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame3) : HResult; stdcall;
  10473.     function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10474.     function AddMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback;
  10475.         lpArg: Pointer; dwFlags: DWORD) : HResult; stdcall;
  10476.     function AddTransform (rctCombine: TD3DRMCombineType;
  10477.         rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10478.     function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
  10479.         TD3DValue) : HResult; stdcall;
  10480.     function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10481.     function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
  10482.         rvTheta: TD3DValue) : HResult; stdcall;
  10483.     function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10484.     function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
  10485.     function GetColor: TD3DColor; stdcall;
  10486.     function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
  10487.     function GetMaterialMode: TD3DRMMaterialMode; stdcall;
  10488.     function GetParent (out lplpParent: IDirect3DRMFrame3) : HResult; stdcall;
  10489.     function GetPosition (lpRef: IDirect3DRMFrame3; out lprvPos: TD3DVector) : HResult; stdcall;
  10490.     function GetRotation (lpRef: IDirect3DRMFrame3; out lprvAxis: TD3DVector;
  10491.         out lprvTheta: TD3DValue) : HResult; stdcall;
  10492.     function GetScene (out lplpRoot: IDirect3DRMFrame3) : HResult; stdcall;
  10493.     function GetSortMode: TD3DRMSortMode; stdcall;
  10494.     function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10495.     function GetTransform (lpRefFrame: IDirect3DRMFrame3;
  10496.         var rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10497.     function GetVelocity (lpRef: IDirect3DRMFrame3; out lprvVel: TD3DVector;
  10498.         fRotVel: BOOL) : HResult; stdcall;
  10499.     function GetOrientation (lpRef: IDirect3DRMFrame3; out lprvDir: TD3DVector;
  10500.         out lprvUp: TD3DVector) : HResult; stdcall;
  10501.     function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
  10502.     function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
  10503.     function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
  10504.         d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
  10505.         TD3DRMLoadTexture3Callback; lpArgLTP: Pointer) : HResult; stdcall;
  10506.     function LookAt (lpTarget, lpRef: IDirect3DRMFrame3;
  10507.         rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
  10508.     function Move (delta: TD3DValue) : HResult; stdcall;
  10509.     function DeleteChild (lpChild: IDirect3DRMFrame3) : HResult; stdcall;
  10510.     function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10511.     function DeleteMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback; lpArg: Pointer) : HResult; stdcall;
  10512.     function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10513.     function GetSceneBackground: TD3DColor; stdcall;
  10514.     function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  10515.     function GetSceneFogColor: TD3DColor; stdcall;
  10516.     function GetSceneFogEnable: BOOL; stdcall;
  10517.     function GetSceneFogMode: TD3DRMFogMode; stdcall;
  10518.     function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
  10519.     function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
  10520.     function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10521.     function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
  10522.     function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10523.     function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
  10524.     function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
  10525.     function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
  10526.     function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
  10527.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10528.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10529.     function GetZbufferMode: TD3DRMZBufferMode; stdcall;
  10530.     function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
  10531.     function SetOrientation (lpRef: IDirect3DRMFrame3; rvDx, rvDy, rvDz, rvUx,
  10532.         rvUy, rvUz: TD3DValue) : HResult; stdcall;
  10533.     function SetPosition (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue) :
  10534.         HResult; stdcall;
  10535.     function SetRotation (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ,
  10536.         rvTheta: TD3DValue) : HResult; stdcall;
  10537.     function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
  10538.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10539.     function SetVelocity (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue;
  10540.         fRotVel: BOOL) : HResult; stdcall;
  10541.     function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
  10542.     function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
  10543.  
  10544.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10545.     function GetBoxEnable : boolean; stdcall;
  10546.     function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
  10547.     function GetMaterial (out lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10548.     function GetInheritAxes : boolean; stdcall;
  10549.     function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10550.     function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10551.     function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
  10552.     function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
  10553.     function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
  10554.     function SetMaterial (var lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10555.     function SetQuaternion (lpRef: IDirect3DRMFrame3;
  10556.         const quat: TD3DRMQuaternion) : HResult; stdcall;
  10557.     function RayPick (lpRefFrame: IDirect3DRMFrame3; var ray: TD3DRMRay;
  10558.         dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) : HResult; stdcall;
  10559.     function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
  10560.         d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
  10561.     function TransformVectors (lpRefFrame: IDirect3DRMFrame3;
  10562.         dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
  10563.         const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10564.     function InverseTransformVectors (lpRefFrame: IDirect3DRMFrame3;
  10565.         dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
  10566.         const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10567.     function SetTraversalOptions (dwFlags: DWORD) : HResult; stdcall;
  10568.     function GetTraversalOptions (out lpdwFlags: DWORD) : HResult; stdcall;
  10569.     function SetSceneFogMethod (dwFlags: DWORD) : HResult; stdcall;
  10570.     function GetSceneFogMethod (out lpdwFlags: DWORD) : HResult; stdcall;
  10571.     function SetMaterialOverride (
  10572.         const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
  10573.     function GetMaterialOverride (
  10574.         const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
  10575.   end;
  10576.  
  10577.  
  10578.   IDirect3DRMMesh = interface (IDirect3DRMVisual)
  10579.     ['{a3a80d01-6e12-11cf-ac4a-0000c03825a1}']
  10580.     (*
  10581.      * IDirect3DRMMesh methods
  10582.      *)
  10583.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10584.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10585.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10586.     function AddGroup (vCount, fCount, vPerFace: DWORD; var fData: DWORD;
  10587.         var returnId: TD3DRMGroupIndex) : HResult; stdcall;
  10588.     function SetVertices (id: TD3DRMGroupIndex; index, count: DWORD;
  10589.         var values: TD3DRMVertex) : HResult; stdcall;
  10590.     function SetGroupColor (id: TD3DRMGroupIndex; value: TD3DColor) : HResult; stdcall;
  10591.     function SetGroupColorRGB (id: TD3DRMGroupIndex; red, green,
  10592.         blue: TD3DValue) : HResult; stdcall;
  10593.     function SetGroupMapping (id: TD3DRMGroupIndex;
  10594.         value: TD3DRMMapping) : HResult; stdcall;
  10595.     function SetGroupQuality (id: TD3DRMGroupIndex;
  10596.         value: TD3DRMRenderQuality) : HResult; stdcall;
  10597.     function SetGroupMaterial (id: TD3DRMGroupIndex; value:
  10598.         IDirect3DRMMaterial) : HResult; stdcall;
  10599.     function SetGroupTexture (id: TD3DRMGroupIndex; value: IDirect3DRMTexture) : HResult; stdcall;
  10600.     function GetGroupCount: DWORD; stdcall;
  10601.     function GetGroup (id: TD3DRMGroupIndex; vCount, fCount, vPerFace : PDWORD;
  10602.         var fDataSize: DWORD; fData: PDWORD) : HResult; stdcall;
  10603.     function GetVertices (id: TD3DRMGroupIndex; index, count : DWORD;
  10604.         out returnPtr : TD3DRMVertex) : HResult; stdcall;
  10605.     function GetGroupColor (id: TD3DRMGroupIndex) : TD3DColor; stdcall;
  10606.     function GetGroupMapping (id: TD3DRMGroupIndex) : TD3DRMMapping; stdcall;
  10607.     function GetGroupQuality (id: TD3DRMGroupIndex) : TD3DRMRenderQuality; stdcall;
  10608.     function GetGroupMaterial (id: TD3DRMGroupIndex;
  10609.         out returnPtr: IDirect3DRMMaterial) : HResult; stdcall;
  10610.     function GetGroupTexture (id: TD3DRMGroupIndex;
  10611.         out returnPtr: IDirect3DRMTexture) : HResult; stdcall;
  10612.   end;
  10613.  
  10614.   IDirect3DRMProgressiveMesh = interface (IDirect3DRMVisual)
  10615.     ['{4516ec79-8f20-11d0-9b6d-0000c0781bc3}']
  10616.     (*
  10617.      * IDirect3DRMProgressiveMesh methods
  10618.      *)
  10619.     function Load (lpSource, lpObjID: pointer; dloLoadflags : TD3DRMLoadOptions;
  10620.         lpCallback: TD3DRMLoadTextureCallback; lpArg: pointer) : HResult; stdcall;
  10621.     function GetLoadStatus (out lpStatus: TD3DRMPMeshLoadStatus) : HResult; stdcall;
  10622.     function SetMinRenderDetail (d3dVal: TD3DValue) : HResult; stdcall;
  10623.     function Abort (dwFlags: DWORD) : HResult; stdcall;
  10624.     function GetFaceDetail (out lpdwCount: DWORD) : HResult; stdcall;
  10625.     function GetVertexDetail (out lpdwCount: DWORD) : HResult; stdcall;
  10626.     function SetFaceDetail (dwCount: DWORD) : HResult; stdcall;
  10627.     function SetVertexDetail (dwCount: DWORD) : HResult; stdcall;
  10628.     function GetFaceDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
  10629.     function GetVertexDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
  10630.     function GetDetail (out lpdvVal: TD3DValue) : HResult; stdcall;
  10631.     function SetDetail (lpdvVal: TD3DValue) : HResult; stdcall;
  10632.     function RegisterEvents (hEvent: THANDLE; dwFlags, dwReserved: DWORD) : HResult; stdcall;
  10633.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10634.     function Duplicate (out lplpD3DRMPMesh: IDirect3DRMProgressiveMesh) : HResult; stdcall;
  10635.     function GetBox (out lpBBox: TD3DRMBox) : HResult; stdcall;
  10636.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10637.     function GetQuality (out lpdwquality: TD3DRMRenderQuality) : HResult; stdcall;
  10638.   end;
  10639.  
  10640.   IDirect3DRMShadow = interface (IDirect3DRMVisual)
  10641.     ['{af359780-6ba3-11cf-ac4a-0000c03825a1}']
  10642.     (*
  10643.      * IDirect3DRMShadow methods
  10644.      *)
  10645.     function Init (lpD3DRMVisual: IDirect3DRMVisual;
  10646.         lpD3DRMLight: IDirect3DRMLight;
  10647.         px, py, pz, nx, ny, nz: TD3DValue) : HResult; stdcall;
  10648.   end;
  10649.  
  10650.   IDirect3DRMShadow2 = interface (IDirect3DRMShadow)
  10651.     ['{86b44e25-9c82-11d1-bb0b-00a0c981a0a6}']
  10652.     (*
  10653.      * IDirect3DRMShadow2 methods
  10654.      *)
  10655.     function GetVisual (out lplpDirect3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10656.     function SetVisual (lpDirect3DRMVisual: IDirect3DRMVisual;
  10657.         dwFlags: DWORD) : HResult; stdcall;
  10658.     function GetLight (out lplpDirect3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10659.     function SetLight (lplpDirect3DRMLight: IDirect3DRMLight;
  10660.         dwFlags: DWORD) : HResult; stdcall;
  10661.     function GetPlane (
  10662.         var pdvPX, pdvPY, pdvPZ, pdvNX, pdvNY, pdvNZ: TD3DValue) : HResult; stdcall;
  10663.     function SetPlane (px, py, pz, nx, ny, nz: TD3DValue;
  10664.         dwFlags: DWORD) : HResult; stdcall;
  10665.     function GetOptions (out pdwOptions: DWORD) : HResult; stdcall;
  10666.     function SetOptions (dwOptions: DWORD) : HResult; stdcall;
  10667.  
  10668.   end;
  10669.  
  10670.   IDirect3DRMFace = interface (IDirect3DRMObject)
  10671.     ['{eb16cb07-d271-11ce-ac48-0000c03825a1}']
  10672.     (*
  10673.      * IDirect3DRMFace methods
  10674.      *)
  10675.     function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
  10676.     function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
  10677.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10678.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10679.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10680.     function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10681.     function SetMaterial (lpMat: IDirect3DRMMaterial) : HResult; stdcall;
  10682.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10683.     function GetVertex (index: DWORD; out lpPosition: TD3DVector;
  10684.         out lpNormal: TD3DVector) : HResult; stdcall;
  10685.     function GetVertices (var lpdwVertexCount: DWORD;
  10686.         out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
  10687.     function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
  10688.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10689.     function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
  10690.     function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10691.     function GetMaterial (out lpMat: IDirect3DRMMaterial) : HResult; stdcall;
  10692.     function GetVertexCount: Integer; stdcall;
  10693.     function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
  10694.     function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
  10695.     function GetColor: TD3DColor; stdcall;
  10696.   end;
  10697.  
  10698.   IDirect3DRMFace2 = interface (IDirect3DRMObject)
  10699.     ['{4516ec81-8f20-11d0-9b6d-0000c0781bc3}']
  10700.     (*
  10701.      * IDirect3DRMFace2 methods
  10702.      *)
  10703.     function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
  10704.     function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
  10705.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10706.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10707.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10708.     function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10709.     function SetMaterial (lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
  10710.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10711.     function GetVertex (index: DWORD; out lpPosition: TD3DVector;
  10712.         out lpNormal: TD3DVector) : HResult; stdcall;
  10713.     function GetVertices (var lpdwVertexCount: DWORD;
  10714.         out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
  10715.     function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
  10716.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10717.     function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
  10718.     function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10719.     function GetMaterial (out lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
  10720.     function GetVertexCount: Integer; stdcall;
  10721.     function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
  10722.     function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
  10723.     function GetColor: TD3DColor; stdcall;
  10724.   end;
  10725.  
  10726.   IDirect3DRMMeshBuilder = interface (IDirect3DRMVisual)
  10727.     ['{a3a80d02-6e12-11cf-ac4a-0000c03825a1}']
  10728.     (*
  10729.      * IDirect3DRMMeshBuilder methods
  10730.      *)
  10731.     function Load (lpvObjSource, lpvObjID: Pointer; d3drmLOFlags:
  10732.         TD3DRMLoadOptions; d3drmLoadTextureProc: TD3DRMLoadTextureCallback;
  10733.         lpvArg: Pointer) : HResult; stdcall;
  10734.     function Save (lpFilename: PChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
  10735.         d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
  10736.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10737.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10738.     function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
  10739.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10740.     function GenerateNormals : HResult; stdcall;
  10741.     function GetColorSource: TD3DRMColorSource; stdcall;
  10742.     function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10743.     function AddMeshBuilder (lpD3DRMMeshBuild: IDirect3DRMMeshBuilder) : HResult; stdcall;
  10744.     function AddFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  10745.     function AddFace (lpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10746.     function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
  10747.         normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
  10748.         lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
  10749.     function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
  10750.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10751.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10752.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10753.     function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10754.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10755.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10756.     function SetPerspective (perspective: BOOL) : HResult; stdcall;
  10757.     function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10758.     function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10759.     function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10760.     function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
  10761.     function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
  10762.     function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
  10763.     function GetVertices (var vcount: DWORD; var vertices : TD3DVector;
  10764.         var ncount : DWORD;
  10765.         var normals : TD3DVector;
  10766.         var face_data_size, face_data : DWORD) : HResult; stdcall;
  10767.     function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
  10768.     function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
  10769.     function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
  10770.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  10771.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10772.     function GetPerspective: BOOL; stdcall;
  10773.     function GetFaceCount: Integer; stdcall;
  10774.     function GetVertexCount: Integer; stdcall;
  10775.     function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
  10776.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10777.   end;
  10778.  
  10779.   IDirect3DRMMeshBuilder2 = interface (IDirect3DRMMeshBuilder)
  10780.     ['{4516ec77-8f20-11d0-9b6d-0000c0781bc3}']
  10781.     (*
  10782.      * IDirect3DRMMeshBuilder2 methods
  10783.      *)
  10784.     function GenerateNormals2 (
  10785.         dvCreaseAngle: TD3DValue; dwFlags: DWORD) : HResult; stdcall;
  10786.     function GetFace (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10787.   end;
  10788.  
  10789.   IDirect3DRMMeshBuilder3 = interface (IDirect3DRMVisual)
  10790.     ['{ff6b7f71-a40e-11d1-91f9-0000f8758e66}']
  10791.     (*
  10792.      * IDirect3DRMMeshBuilder3 methods
  10793.      *)
  10794.     function Load (lpvObjSource, lpvObjID: Pointer;
  10795.         d3drmLOFlags: TD3DRMLoadOptions;
  10796.         d3drmLoadTextureProc: TD3DRMLoadTexture3Callback;
  10797.         lpvArg: Pointer) : HResult; stdcall;
  10798.     function Save (lpFilename: PAnsiChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
  10799.         d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
  10800.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10801.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10802.     function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
  10803.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10804.     function GenerateNormals (
  10805.         dvCreaseAngle: TD3DValue; dwFlags: DWORD): HResult; stdcall;
  10806.     function GetColorSource: TD3DRMColorSource; stdcall;
  10807.     function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10808.     function AddMeshBuilder (
  10809.         lpD3DRMMeshBuild: IDirect3DRMMeshBuilder3) : HResult; stdcall;
  10810.     function AddFrame (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  10811.     function AddFace (lpD3DRMFace: IDirect3DRMFace2) : HResult; stdcall;
  10812.     function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
  10813.         normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
  10814.         lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
  10815.     function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
  10816.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10817.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10818.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10819.     function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10820.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10821.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10822.     function SetPerspective (perspective: BOOL) : HResult; stdcall;
  10823.     function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10824.     function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10825.     function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10826.     function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
  10827.     function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
  10828.     function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
  10829.     function GetGeometry (var vcount: DWORD; var vertices : TD3DVector;
  10830.         var ncount : DWORD; var normals : TD3DVector;
  10831.         var face_data_size, face_data : DWORD) : HResult; stdcall;
  10832.     function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
  10833.     function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
  10834.     function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
  10835.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
  10836.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10837.     function GetPerspective: BOOL; stdcall;
  10838.     function GetFaceCount: Integer; stdcall;
  10839.     function GetVertexCount: Integer; stdcall;
  10840.     function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
  10841.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10842.     function GetFace
  10843.         (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10844.     function GetVertex (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
  10845.     function GetNormal (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
  10846.     function DeleteVertices (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
  10847.     function DeleteNormals (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
  10848.     function DeleteFace (lpFace: IDirect3DRMFace2) : HResult; stdcall;
  10849.     function Empty (dwFlags: DWORD) : HResult; stdcall;
  10850.     function Optimize (dwFlags: DWORD) : HResult; stdcall;
  10851.     function AddFacesIndexed (dwFlags: DWORD; var lpdwvIndices: DWORD;
  10852.         lpdwIndexFirst, lpdwCount: PDWORD) : HResult; stdcall;
  10853.     function CreateSubMesh (out lplpUnk: IUnknown) : HResult; stdcall;
  10854.     function GetParentMesh (dwFlags: DWORD; out lplpUnk: IUnknown) : HResult; stdcall;
  10855.     function GetSubMeshes (lpdwCount: PDWORD; lpUnk: IUnknown) : HResult; stdcall;
  10856.     function DeleteSubMesh (lplpUnk: IUnknown) : HResult; stdcall;
  10857.     function Enable (dwFlags: DWORD) : HResult; stdcall;
  10858.     function GetEnable (out lpdwFlags: DWORD) : HResult; stdcall;
  10859.     function AddTriangles (dwFlags, dwFormat, dwVertexCount:  DWORD;
  10860.         lpData: pointer) : HResult; stdcall;
  10861.     function SetVertices
  10862.         (dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
  10863.     function GetVertices(dwFirst: DWORD; var lpdwCount: DWORD;
  10864.         lpdvVector: PD3DVector) : HResult; stdcall;
  10865.     function SetNormals(dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
  10866.     function GetNormals (dwFirst: DWORD; lpdwCount: PDWORD;
  10867.         var lpdvVector: TD3DVector) : HResult; stdcall;
  10868.     function GetNormalCount : integer; stdcall;
  10869.   end;
  10870.  
  10871.   IDirect3DRMLight = interface (IDirect3DRMObject)
  10872.     ['{eb16cb08-d271-11ce-ac48-0000c03825a1}']
  10873.     (*
  10874.      * IDirect3DRMLight methods
  10875.      *)
  10876.     function SetType (d3drmtType: TD3DRMLightType) : HResult; stdcall;
  10877.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10878.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10879.     function SetRange (rvRange: TD3DValue) : HResult; stdcall;
  10880.     function SetUmbra (rvAngle: TD3DValue) : HResult; stdcall;
  10881.     function SetPenumbra (rvAngle: TD3DValue) : HResult; stdcall;
  10882.     function SetConstantAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10883.     function SetLinearAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10884.     function SetQuadraticAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10885.     function GetRange: TD3DValue; stdcall;
  10886.     function GetUmbra: TD3DValue; stdcall;
  10887.     function GetPenumbra: TD3DValue; stdcall;
  10888.     function GetConstantAttenuation: TD3DValue; stdcall;
  10889.     function GetLinearAttenuation: TD3DValue; stdcall;
  10890.     function GetQuadraticAttenuation: TD3DValue; stdcall;
  10891.     function GetColor: TD3DColor; stdcall;
  10892.     function GetType: TD3DRMLightType; stdcall;
  10893.     function SetEnableFrame (lpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
  10894.     function GetEnableFrame (out lplpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
  10895.   end;
  10896.  
  10897.   IDirect3DRMTexture = interface (IDirect3DRMVisual)
  10898.     ['{eb16cb09-d271-11ce-ac48-0000c03825a1}']
  10899.     (*
  10900.      * IDirect3DRMTexture methods
  10901.      *)
  10902.     function InitFromFile (filename: PAnsiChar) : HResult; stdcall;
  10903.     function InitFromSurface (lpDDS: IDirectDrawSurface) : HResult; stdcall;
  10904.     function InitFromResource (rs: HRSRC) : HResult; stdcall;
  10905.     function Changed (bPixels, bPalette: BOOL) : HResult; stdcall;
  10906.     function SetColors (ulColors: DWORD) : HResult; stdcall;
  10907.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10908.     function SetDecalSize (rvWidth, rvHeight: TD3DValue) : HResult; stdcall;
  10909.     function SetDecalOrigin (lX, lY: LongInt) : HResult; stdcall;
  10910.     function SetDecalScale (dwScale: DWORD) : HResult; stdcall;
  10911.     function SetDecalTransparency (bTransp: BOOL) : HResult; stdcall;
  10912.     function SetDecalTransparentColor (rcTransp: TD3DColor) : HResult; stdcall;
  10913.     function GetDecalSize (out lprvWidth, lprvHeight: TD3DValue) : HResult; stdcall;
  10914.     function GetDecalOrigin (out lplX, lplY: LongInt) : HResult; stdcall;
  10915.     function GetImage: PD3DRMImage; stdcall;
  10916.     function GetShades: DWORD; stdcall;
  10917.     function GetColors: DWORD; stdcall;
  10918.     function GetDecalScale: DWORD; stdcall;
  10919.     function GetDecalTransparency: BOOL; stdcall;
  10920.     function GetDecalTransparentColor: TD3DColor; stdcall;
  10921.   end;
  10922.  
  10923.   IDirect3DRMTexture2 = interface (IDirect3DRMTexture)
  10924.     ['{120f30c0-1629-11d0-941c-0080c80cfa7b}']
  10925.     (*
  10926.      * IDirect3DRMTexture2 methods
  10927.      *)
  10928.     function InitFromImage (const lpImage: TD3DRMImage) : HResult; stdcall;
  10929.     function InitFromResource2 (hModule: HModule;
  10930.         strName, strType: PAnsiChar) : HResult; stdcall;
  10931.     function GenerateMIPMap (dwFlags: DWORD) : HResult; stdcall;
  10932.   end;
  10933.  
  10934.   IDirect3DRMTexture3 = interface (IDirect3DRMTexture2)
  10935.     ['{ff6b7f73-a40e-11d1-91f9-0000f8758e66}']
  10936.     (*
  10937.      * IDirect3DRMTexture3 methods
  10938.      *)
  10939.     function GetSurface
  10940.         (dwFlags: DWORD; out lplpDDS: IDirectDrawSurface) : HResult; stdcall;
  10941.     function SetCacheOptions (lImportance: integer; dwFlags: DWORD) : HResult; stdcall;
  10942.     function GetCacheOptions (var lplImportance: integer; var lpdwFlags: DWORD) : HResult; stdcall;
  10943.     function SetDownsampleCallback (
  10944.         pCallback: TD3DRMDownSampleCallback; pArg: pointer) : HResult; stdcall;
  10945.     function SetValidationCallback (
  10946.         pCallback: TD3DRMValidationCallback; pArg: pointer) : HResult; stdcall;
  10947.   end;
  10948.  
  10949.   IDirect3DRMWrap = interface (IDirect3DRMObject)
  10950.     ['{eb16cb0a-d271-11ce-ac48-0000c03825a1}']
  10951.     (*
  10952.      * IDirect3DRMWrap methods
  10953.      *)
  10954.     function Init (d3drmwt: TD3DRMWrapType; lpd3drmfRef: IDirect3DRMFrame;
  10955.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue)
  10956.         : HResult; stdcall;
  10957.     function Apply (lpObject: IDirect3DRMObject) : HResult; stdcall;
  10958.     function ApplyRelative(frame: IDirect3DRMFrame; mesh: IDirect3DRMObject) : HResult; stdcall;
  10959.   end;
  10960.  
  10961.   IDirect3DRMMaterial = interface (IDirect3DRMObject)
  10962.     ['{eb16cb0b-d271-11ce-ac48-0000c03825a1}']
  10963.     (*
  10964.      * IDirect3DRMMaterial methods
  10965.      *)
  10966.     function SetPower (rvPower: TD3DValue) : HResult; stdcall;
  10967.     function SetSpecular (r, g, b: TD3DValue) : HResult; stdcall;
  10968.     function SetEmissive (r, g, b: TD3DValue) : HResult; stdcall;
  10969.     function GetPower: TD3DValue; stdcall;
  10970.     function GetSpecular (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
  10971.     function GetEmissive (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
  10972.   end;
  10973.  
  10974.   IDirect3DRMMaterial2 = interface (IDirect3DRMMaterial)
  10975.     ['{ff6b7f75-a40e-11d1-91f9-0000f8758e66}']
  10976.     (*
  10977.      * IDirect3DRMMaterial2 methods
  10978.      *)
  10979.     function GetAmbient(out r,g,b: TD3DValue) : HResult; stdcall;
  10980.     function SetAmbient(r,g,b: TD3DValue) : HResult; stdcall;
  10981.   end;
  10982.  
  10983.   IDirect3DRMAnimation = interface (IDirect3DRMObject)
  10984.     ['{eb16cb0d-d271-11ce-ac48-0000c03825a1}']
  10985.     (*
  10986.      * IDirect3DRMAnimation methods
  10987.      *)
  10988.     function SetOptions (d3drmanimFlags: TD3DRMAnimationOptions) : HResult; stdcall;
  10989.     function AddRotateKey (rvTime: TD3DValue; const rqQuat: TD3DRMQuaternion) : HResult; stdcall;
  10990.     function AddPositionKey (rvTime, rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10991.     function AddScaleKey (time, x, y, z: TD3DValue) : HResult; stdcall;
  10992.     function DeleteKey (time: TD3DValue) : HResult; stdcall;
  10993.     function SetFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  10994.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  10995.     function GetOptions: TD3DRMAnimationOptions; stdcall;
  10996.   end;
  10997.  
  10998.   IDirect3DRMAnimation2 = interface (IDirect3DRMAnimation)
  10999.     ['{ff6b7f77-a40e-11d1-91f9-0000f8758e66}']
  11000.     (*
  11001.      * IDirect3DRMAnimation methods
  11002.      *)
  11003.     function GetFrame (out lpD3DFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11004.     function DeleteKeyByID (dwID: DWORD) : HResult; stdcall;
  11005.     function AddKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
  11006.     function ModifyKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
  11007.     function GetKeys (dvTimeMin, dvTimeMax: TD3DValue; var lpdwNumKeys: DWORD;
  11008.         lpKey: PD3DRMAnimationKey) : HResult; stdcall;
  11009.   end;
  11010.  
  11011.   IDirect3DRMAnimationSet = interface (IDirect3DRMObject)
  11012.     ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
  11013.     (*
  11014.      * IDirect3DRMAnimationSet methods
  11015.      *)
  11016.     function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11017.     function Load (lpvObjSource, lpvObjID: Pointer;
  11018.         d3drmLOFlags: TD3DRMLoadOptions;
  11019.         d3drmLoadTextureProc: TD3DRMLoadTextureCallback; lpArgLTP: Pointer;
  11020.         lpParentFrame: IDirect3DRMFrame) : HResult; stdcall;
  11021.     function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11022.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  11023.   end;
  11024.  
  11025.   IDirect3DRMAnimationSet2 = interface (IDirect3DRMObject)
  11026.     ['{ff6b7f79-a40e-11d1-91f9-0000f8758e66}']
  11027.     (*
  11028.      * IDirect3DRMAnimationSet methods
  11029.      *)
  11030.     function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11031.     function Load (lpvObjSource, lpvObjID: Pointer;
  11032.         d3drmLOFlags: TD3DRMLoadOptions;
  11033.         d3drmLoadTextureProc: TD3DRMLoadTexture3Callback; lpArgLTP: Pointer;
  11034.         lpParentFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11035.     function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11036.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  11037.     function GetAnimations(out lplpArray: IDirect3DRMAnimationArray) : HResult; stdcall;
  11038.   end;
  11039.  
  11040.   IDirect3DRMUserVisual = interface (IDirect3DRMVisual)
  11041.     ['{59163de0-6d43-11cf-ac4a-0000c03825a1}']
  11042.     (*
  11043.      * IDirect3DRMUserVisual methods
  11044.      *)
  11045.     function Init (d3drmUVProc: TD3DRMUserVisualCallback;
  11046.         lpArg: Pointer) : HResult; stdcall;
  11047.   end;
  11048.  
  11049.   IDirect3DRMArray = interface (IUnknown)
  11050.     function GetSize: DWORD; stdcall;
  11051.     (* No GetElement method as it would get overloaded
  11052.      * in derived classes, and overloading is
  11053.      * a no-no in COM
  11054.      *)
  11055.   end;
  11056.  
  11057.   IDirect3DRMObjectArray = interface (IDirect3DRMArray)
  11058.         ['{242f6bc2-3849-11d0-9b6d-0000c0781bc3}']
  11059.     function GetElement (index: DWORD; out lplpD3DRMObject:
  11060.         IDirect3DRMObject) : HResult; stdcall;
  11061.   end;
  11062.  
  11063.   IDirect3DRMDeviceArray = interface (IDirect3DRMArray)
  11064.     ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
  11065.     function GetElement (index: DWORD; out lplpD3DRMDevice:
  11066.         IDirect3DRMDevice) : HResult; stdcall;
  11067.   end;
  11068.  
  11069.   IDirect3DRMFrameArray = interface (IDirect3DRMArray)
  11070.     ['{eb16cb12-d271-11ce-ac48-0000c03825a1}']
  11071.     function GetElement (index: DWORD; out lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  11072.   end;
  11073.  
  11074.   IDirect3DRMViewportArray = interface (IDirect3DRMArray)
  11075.     ['{eb16cb11-d271-11ce-ac48-0000c03825a1}']
  11076.     function GetElement (index: DWORD; out lplpD3DRMViewport:
  11077.         IDirect3DRMViewport) : HResult; stdcall;
  11078.   end;
  11079.  
  11080.   IDirect3DRMVisualArray = interface (IDirect3DRMArray)
  11081.     ['{eb16cb13-d271-11ce-ac48-0000c03825a1}']
  11082.     function GetElement (index: DWORD; out lplpD3DRMVisual:
  11083.         IDirect3DRMVisual) : HResult; stdcall;
  11084.   end;
  11085.  
  11086.   IDirect3DRMAnimationArray = interface (IDirect3DRMArray)
  11087.     ['{d5f1cae0-4bd7-11d1-b974-0060083e45f3}']
  11088.     function GetElement (index: DWORD; out lplpD3DRMAnimation2:
  11089.         IDirect3DRMAnimation2) : HResult; stdcall;
  11090.   end;
  11091.  
  11092.   IDirect3DRMPickedArray = interface (IDirect3DRMArray)
  11093.     ['{eb16cb16-d271-11ce-ac48-0000c03825a1}']
  11094.     function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
  11095.         out lplpFrameArray: IDirect3DRMFrameArray;
  11096.         const lpD3DRMPickDesc: TD3DRMPickDesc) : HResult; stdcall;
  11097.  
  11098.   end;
  11099.  
  11100.   IDirect3DRMLightArray = interface (IDirect3DRMArray)
  11101.     ['{eb16cb14-d271-11ce-ac48-0000c03825a1}']
  11102.     function GetElement (index: DWORD; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11103.   end;
  11104.  
  11105.  
  11106.   IDirect3DRMFaceArray = interface (IDirect3DRMArray)
  11107.     ['{eb16cb17-d271-11ce-ac48-0000c03825a1}']
  11108.     function GetElement (index: DWORD; out lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  11109.   end;
  11110.  
  11111.   IDirect3DRMPicked2Array = interface (IDirect3DRMArray)
  11112.     ['{4516ec7b-8f20-11d0-9b6d-0000c0781bc3}']
  11113.     function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
  11114.         out lplpFrameArray: IDirect3DRMFrameArray; const lpD3DRMPickDesc2:
  11115.         TD3DRMPickDesc2) : HResult; stdcall;
  11116.   end;
  11117.  
  11118.   IDirect3DRMInterpolator = interface (IDirect3DRMObject)
  11119.     ['{242f6bc1-3849-11d0-9b6d-0000c0781bc3}']
  11120.     (*
  11121.      * IDirect3DRMInterpolator methods
  11122.      *)
  11123.     function AttachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11124.     function GetAttachedObjects
  11125.         (lpD3DRMObjectArray: IDirect3DRMObjectArray) : HResult; stdcall;
  11126.     function DetachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11127.     function SetIndex (d3dVal: TD3DValue) : HResult; stdcall;
  11128.     function GetIndex : TD3DValue; stdcall;
  11129.     function Interpolate (d3dVal: TD3DValue; lpD3DRMObject: IDirect3DRMObject;
  11130.         d3drmInterpFlags: TD3DRMInterpolationOptions) : HResult; stdcall;
  11131.   end;
  11132.  
  11133.   IDirect3DRMClippedVisual = interface (IDirect3DRMObject)
  11134.     ['{5434e733-6d66-11d1-bb0b-0000f875865a}']
  11135.     (*
  11136.      * IDirect3DRMClippedVisual methods
  11137.      *)
  11138.     function Init (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  11139.     function AddPlane (lpRef: IDirect3DRMFrame3;
  11140.         const lpdvPoint, lpdvNormal: TD3DVector;
  11141.         dwFlags: DWORD; out lpdwReturnID: DWORD) : HResult; stdcall;
  11142.     function DeletePlane (dwID, dwFlags: DWORD) : HResult; stdcall;
  11143.     function GetPlaneIDs (var lpdwCount: DWORD; out lpdwID: DWORD; dwFlags: DWORD) : HResult; stdcall;
  11144.     function GetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
  11145.         out lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
  11146.     function SetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
  11147.         const lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
  11148.   end;
  11149.  
  11150. (*==========================================================================;
  11151.  *
  11152.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11153.  *
  11154.  *  File:       d3drm.h
  11155.  *  Content:    Direct3DRM include file
  11156.  *
  11157.  ***************************************************************************)
  11158.  
  11159. function D3DRMErrorString(Value: HResult) : string;
  11160.  
  11161. //type
  11162.   //TRefClsID = TGUID;
  11163.  
  11164. type
  11165.   TD3DRMDevicePaletteCallback = procedure (lpDirect3DRMDev: IDirect3DRMDevice;
  11166.       lpArg: Pointer; dwIndex: DWORD; red, green, blue: LongInt); cdecl;
  11167.  
  11168. (*
  11169.  * Direct3DRM Object Class (for CoCreateInstance())
  11170.  *)
  11171. const
  11172.   CLSID_CDirect3DRM: TGUID =
  11173.       (D1:$4516ec41;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  11174.  
  11175. type
  11176.   IDirect3DRM = interface (IUnknown)
  11177.     ['{2bc49361-8327-11cf-ac4a-0000c03825a1}']
  11178.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11179.         const riid: TGUID; out ppv) : HResult; stdcall;
  11180.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame;
  11181.         var lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  11182.     function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11183.     function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
  11184.         IDirect3DRMMeshBuilder) : HResult; stdcall;
  11185.     function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  11186.     function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11187.     function CreateAnimationSet (var lplpD3DRMAnimationSet:
  11188.         IDirect3DRMAnimationSet) : HResult; stdcall;
  11189.     function CreateTexture (var lpImage: TD3DRMImage;
  11190.         var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  11191.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11192.         cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11193.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11194.         vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11195.     function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
  11196.         IDirect3DRMMaterial) : HResult; stdcall;
  11197.     function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
  11198.         IDirect3DRMDevice) : HResult; stdcall;
  11199.  
  11200.     (* Create a Windows Device using DirectDraw surfaces *)
  11201.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11202.         lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice) :
  11203.         HResult; stdcall;
  11204.  
  11205.       (* Create a Windows Device using D3D objects *)
  11206.     function CreateDeviceFromD3D (lpD3D: IDirect3D; lpD3DDev: IDirect3DDevice;
  11207.         var lplpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
  11208.  
  11209.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11210.         lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
  11211.         IDirect3DRMDevice) : HResult; stdcall;
  11212.  
  11213.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11214.         var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  11215.  
  11216.     function CreateShadow (lpVisual: IDirect3DRMVisual;
  11217.         lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
  11218.         var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
  11219.     function CreateViewport (lpDev: IDirect3DRMDevice;
  11220.         lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11221.         var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
  11222.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
  11223.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11224.         var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11225.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11226.         var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11227.     function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
  11228.         IDirect3DRMTexture) : HResult; stdcall;
  11229.     function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
  11230.         IDirect3DRMTexture) : HResult; stdcall;
  11231.  
  11232.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11233.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11234.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11235.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11236.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11237.  
  11238.     function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11239.     function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11240.  
  11241.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11242.  
  11243.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11244.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11245.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11246.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
  11247.         IDirect3DRMFrame) : HResult; stdcall;
  11248.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11249.   end;
  11250.  
  11251. // Moved from D3DRMObj, to avoid circular unit reference:
  11252.  
  11253.   IDirect3DRMObject2 = interface (IUnknown)
  11254.     ['{4516ec7c-8f20-11d0-9b6d-0000c0781bc3}']
  11255.     (*
  11256.      * IDirect3DRMObject2 methods
  11257.      *)
  11258.     function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
  11259.         lpArg: Pointer) : HResult; stdcall;
  11260.     function Clone (pUnkOuter: IUnknown; const riid: TGUID;
  11261.         out ppvObj) : HResult; stdcall;
  11262.     function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
  11263.         lpArg: Pointer) : HResult; stdcall;
  11264.     function GetClientData (dwID: DWORD; out lplpvData: Pointer) : HResult; stdcall;
  11265.     function GetDirect3DRM (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
  11266.     function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  11267.     function SetClientData (dwID: DWORD; lpvData: pointer; dwFlags: DWORD) : HResult; stdcall;
  11268.     function SetName (lpName: PAnsiChar) : HResult; stdcall;
  11269.     function GetAge (dwFlags: DWORD; out pdwAge: DWORD) : HResult; stdcall;
  11270.   end;
  11271.  
  11272.   IID_IDirect3DRMObject2 = IDirect3DRMObject2;
  11273.  
  11274.   IDirect3DRM2 = interface (IUnknown)
  11275.     ['{4516ecc8-8f20-11d0-9b6d-0000c0781bc3}']
  11276.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11277.         const riid: TGUID; out ppv) : HResult; stdcall;
  11278.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame2;
  11279.         var lplpD3DRMFrame: IDirect3DRMFrame2) : HResult; stdcall;
  11280.     function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11281.     function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
  11282.         IDirect3DRMMeshBuilder2) : HResult; stdcall;
  11283.     function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  11284.     function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11285.     function CreateAnimationSet (var lplpD3DRMAnimationSet:
  11286.         IDirect3DRMAnimationSet) : HResult; stdcall;
  11287.     function CreateTexture (var lpImage: TD3DRMImage;
  11288.         var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
  11289.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11290.         cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11291.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11292.         vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11293.     function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
  11294.         IDirect3DRMMaterial) : HResult; stdcall;
  11295.     function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
  11296.         IDirect3DRMDevice2) : HResult; stdcall;
  11297.  
  11298.     (* Create a Windows Device using DirectDraw surfaces *)
  11299.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11300.         lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice2) :
  11301.         HResult; stdcall;
  11302.  
  11303.       (* Create a Windows Device using D3D objects *)
  11304.     function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
  11305.         var lplpD3DRMDevice: IDirect3DRMDevice2) : HResult; stdcall;
  11306.  
  11307.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11308.         lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
  11309.         IDirect3DRMDevice2) : HResult; stdcall;
  11310.  
  11311.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11312.         var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
  11313.  
  11314.     function CreateShadow (lpVisual: IDirect3DRMVisual;
  11315.         lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
  11316.         var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
  11317.     function CreateViewport (lpDev: IDirect3DRMDevice;
  11318.         lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11319.         var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
  11320.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
  11321.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11322.         var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11323.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11324.         var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11325.     function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
  11326.         IDirect3DRMTexture2) : HResult; stdcall;
  11327.     function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
  11328.         IDirect3DRMTexture2) : HResult; stdcall;
  11329.  
  11330.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11331.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11332.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11333.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11334.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11335.  
  11336.     function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11337.     function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject:
  11338.         IDirect3DRMObject) : HResult; stdcall;
  11339.  
  11340.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11341.  
  11342.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11343.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11344.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11345.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
  11346.         IDirect3DRMFrame) : HResult; stdcall;
  11347.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11348.     function CreateProgressiveMesh (var lplpD3DRMProgressiveMesh:
  11349.         IDirect3DRMProgressiveMesh) : HResult; stdcall;
  11350.   end;
  11351.  
  11352.   IDirect3DRM3 = interface (IUnknown)
  11353.     ['{4516ec83-8f20-11d0-9b6d-0000c0781bc3}']
  11354.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11355.         const riid: TGUID; out ppv) : HResult; stdcall;
  11356.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame3;
  11357.         out lplpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11358.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11359.     function CreateMeshBuilder (out lplpD3DRMMeshBuilder:
  11360.         IDirect3DRMMeshBuilder3) : HResult; stdcall;
  11361.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
  11362.     function CreateAnimation (out lplpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11363.     function CreateAnimationSet (out lplpD3DRMAnimationSet:
  11364.         IDirect3DRMAnimationSet2) : HResult; stdcall;
  11365.     function CreateTexture (const lpImage: TD3DRMImage;
  11366.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11367.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11368.         cColor: TD3DColor; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11369.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11370.         vGreen, vBlue: TD3DValue; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11371.     function CreateMaterial (vPower: TD3DValue; out lplpD3DRMMaterial:
  11372.         IDirect3DRMMaterial2) : HResult; stdcall;
  11373.     function CreateDevice (dwWidth, dwHeight: DWORD; out lplpD3DRMDevice:
  11374.         IDirect3DRMDevice3) : HResult; stdcall;
  11375.  
  11376.     (* Create a Windows Device using DirectDraw surfaces *)
  11377.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11378.         lpDDSBack: IDirectDrawSurface; dwFlags: DWORD;
  11379.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11380.  
  11381.       (* Create a Windows Device using D3D objects *)
  11382.     function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
  11383.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11384.  
  11385.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11386.         lpGUID: PGUID; width, height: Integer;
  11387.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11388.  
  11389.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11390.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11391.  
  11392.     function CreateShadow (pUnk: IUnknown; lpLight: IDirect3DRMLight;
  11393.         px, py, pz, nx, ny, nz: TD3DValue;
  11394.         out lplpShadow: IDirect3DRMShadow2) : HResult; stdcall;
  11395.     function CreateViewport (lpDev: IDirect3DRMDevice3;
  11396.         lpCamera: IDirect3DRMFrame3; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11397.         out lplpD3DRMViewport: IDirect3DRMViewport2) : HResult; stdcall;
  11398.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame3;
  11399.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11400.         out lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11401.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11402.         out lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11403.     function LoadTexture (lpFileName: PAnsiChar; out lplpD3DRMTexture:
  11404.         IDirect3DRMTexture3) : HResult; stdcall;
  11405.     function LoadTextureFromResource (hModule: HMODULE;
  11406.         strName, strType: PAnsiChar;
  11407.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11408.  
  11409.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11410.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11411.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11412.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11413.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11414.  
  11415.     function GetDevices (out lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11416.     function GetNamedObject (lpName: PAnsiChar; out lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11417.  
  11418.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11419.  
  11420.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11421.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11422.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11423.         TD3DRMLoadTexture3Callback; lpArgLTP: Pointer; lpParentFrame:
  11424.         IDirect3DRMFrame3) : HResult; stdcall;
  11425.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11426.     function CreateProgressiveMesh (out lplpD3DRMProgressiveMesh:
  11427.         IDirect3DRMProgressiveMesh) : HResult; stdcall;
  11428.  
  11429.     (* Used with IDirect3DRMObject2 *)
  11430.     function RegisterClient (const rguid: TGUID; out lpdwID: DWORD) : HResult; stdcall;
  11431.     function UnregisterClient (const rguid: TGUID) : HResult; stdcall;
  11432.  
  11433.     function CreateClippedVisual (lpVisual: IDirect3DRMVisual;
  11434.         lpClippedVisual: IDirect3DRMClippedVisual) : HResult; stdcall;
  11435.     function SetOptions (dwOptions: DWORD) : HResult; stdcall;
  11436.     function GetOptions (out lpdwOptions: DWORD) : HResult; stdcall;
  11437.   end;
  11438.  
  11439.   IID_IDirect3DRM =  IDirect3DRM;
  11440.   IID_IDirect3DRM2 = IDirect3DRM2;
  11441.   IID_IDirect3DRM3 = IDirect3DRM3;
  11442.  
  11443. const
  11444.   MAKE_D3RMDHRESULT = HResult($88760000);
  11445.  
  11446.   D3DRM_OK                        = DD_OK;
  11447.   D3DRMERR_BADOBJECT              = MAKE_D3RMDHRESULT + 781;
  11448.   D3DRMERR_BADTYPE                = MAKE_D3RMDHRESULT + 782;
  11449.   D3DRMERR_BADALLOC               = MAKE_D3RMDHRESULT + 783;
  11450.   D3DRMERR_FACEUSED               = MAKE_D3RMDHRESULT + 784;
  11451.   D3DRMERR_NOTFOUND               = MAKE_D3RMDHRESULT + 785;
  11452.   D3DRMERR_NOTDONEYET             = MAKE_D3RMDHRESULT + 786;
  11453.   D3DRMERR_FILENOTFOUND           = MAKE_D3RMDHRESULT + 787;
  11454.   D3DRMERR_BADFILE                = MAKE_D3RMDHRESULT + 788;
  11455.   D3DRMERR_BADDEVICE              = MAKE_D3RMDHRESULT + 789;
  11456.   D3DRMERR_BADVALUE               = MAKE_D3RMDHRESULT + 790;
  11457.   D3DRMERR_BADMAJORVERSION        = MAKE_D3RMDHRESULT + 791;
  11458.   D3DRMERR_BADMINORVERSION        = MAKE_D3RMDHRESULT + 792;
  11459.   D3DRMERR_UNABLETOEXECUTE        = MAKE_D3RMDHRESULT + 793;
  11460.   D3DRMERR_LIBRARYNOTFOUND        = MAKE_D3RMDHRESULT + 794;
  11461.   D3DRMERR_INVALIDLIBRARY         = MAKE_D3RMDHRESULT + 795;
  11462.   D3DRMERR_PENDING                = MAKE_D3RMDHRESULT + 796;
  11463.   D3DRMERR_NOTENOUGHDATA          = MAKE_D3RMDHRESULT + 797;
  11464.   D3DRMERR_REQUESTTOOLARGE        = MAKE_D3RMDHRESULT + 798;
  11465.   D3DRMERR_REQUESTTOOSMALL        = MAKE_D3RMDHRESULT + 799;
  11466.   D3DRMERR_CONNECTIONLOST         = MAKE_D3RMDHRESULT + 800;
  11467.   D3DRMERR_LOADABORTED            = MAKE_D3RMDHRESULT + 801;
  11468.   D3DRMERR_NOINTERNET             = MAKE_D3RMDHRESULT + 802;
  11469.   D3DRMERR_BADCACHEFILE           = MAKE_D3RMDHRESULT + 803;
  11470.   D3DRMERR_BOXNOTSET              = MAKE_D3RMDHRESULT + 804;
  11471.   D3DRMERR_BADPMDATA              = MAKE_D3RMDHRESULT + 805;
  11472.   D3DRMERR_CLIENTNOTREGISTERED    = MAKE_D3RMDHRESULT + 806;
  11473.   D3DRMERR_NOTCREATEDFROMDDS      = MAKE_D3RMDHRESULT + 807;
  11474.   D3DRMERR_NOSUCHKEY              = MAKE_D3RMDHRESULT + 808;
  11475.   D3DRMERR_INCOMPATABLEKEY        = MAKE_D3RMDHRESULT + 809;
  11476.   D3DRMERR_ELEMENTINUSE           = MAKE_D3RMDHRESULT + 810;
  11477.   D3DRMERR_TEXTUREFORMATNOTFOUND  = MAKE_D3RMDHRESULT + 811;
  11478.  
  11479. (* Create a Direct3DRM API *)
  11480. var
  11481.   Direct3DRMCreate : function (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
  11482.  
  11483. (*==========================================================================;
  11484.  *
  11485.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11486.  *
  11487.  *  File:       d3drmwin.h
  11488.  *  Content:    Direct3DRM include file
  11489.  *
  11490.  ***************************************************************************)
  11491.  
  11492. type
  11493.   IDirect3DRMWinDevice = interface (IDirect3DRMObject)
  11494.     ['{c5016cc0-d273-11ce-ac48-0000c03825a1}']
  11495.     (*
  11496.      * IDirect3DRMWinDevice methods
  11497.      *)
  11498.  
  11499.     (* Repaint the window with the last frame which was rendered. *)
  11500.     function HandlePaint (hDC: HDC) : HResult; stdcall;
  11501.  
  11502.     (* Respond to a WM_ACTIVATE message. *)
  11503.     function HandleActivate (wparam: WORD) : HResult; stdcall;
  11504.   end;
  11505.  
  11506. (*
  11507.  * GUIDS used by Direct3DRM Windows interface
  11508.  *)
  11509.   IID_IDirect3DRMWinDevice = IDirect3DRMWinDevice;
  11510.  
  11511. (***************************************************************************
  11512.  *
  11513.  *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
  11514.  *
  11515.  *  File:       rmxfguid.h
  11516.  *
  11517.  *  Content:    Defines GUIDs of D3DRM's templates.
  11518.  *
  11519.  ***************************************************************************)
  11520.  
  11521. const
  11522. (* {2B957100-9E9A-11cf-AB39-0020AF71E433} *)
  11523.   TID_D3DRMInfo: TGUID =
  11524.       (D1:$2b957100;D2:$9e9a;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11525.  
  11526. (* {3D82AB44-62DA-11cf-AB39-0020AF71E433} *)
  11527.   TID_D3DRMMesh: TGUID =
  11528.       (D1:$3d82ab44;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11529.  
  11530. (* {3D82AB5E-62DA-11cf-AB39-0020AF71E433} *)
  11531.   TID_D3DRMVector: TGUID =
  11532.       (D1:$3d82ab5e;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11533.  
  11534. (* {3D82AB5F-62DA-11cf-AB39-0020AF71E433} *)
  11535.   TID_D3DRMMeshFace: TGUID =
  11536.       (D1:$3d82ab5f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11537.  
  11538. (* {3D82AB4D-62DA-11cf-AB39-0020AF71E433} *)
  11539.   TID_D3DRMMaterial: TGUID =
  11540.       (D1:$3d82ab4d;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11541.  
  11542. (* {35FF44E1-6C7C-11cf-8F52-0040333594A3} *)
  11543.   TID_D3DRMMaterialArray: TGUID =
  11544.       (D1:$35ff44e1;D2:$6c7c;D3:$11cf;D4:($8F,$52,$00,$40,$33,$35,$94,$a3));
  11545.  
  11546. (* {3D82AB46-62DA-11cf-AB39-0020AF71E433} *)
  11547.   TID_D3DRMFrame: TGUID =
  11548.       (D1:$3d82ab46;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11549.  
  11550. (* {F6F23F41-7686-11cf-8F52-0040333594A3} *)
  11551.   TID_D3DRMFrameTransformMatrix: TGUID =
  11552.       (D1:$f6f23f41;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11553.  
  11554. (* {F6F23F42-7686-11cf-8F52-0040333594A3} *)
  11555.   TID_D3DRMMeshMaterialList: TGUID =
  11556.       (D1:$f6f23f42;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11557.  
  11558. (* {F6F23F40-7686-11cf-8F52-0040333594A3} *)
  11559.   TID_D3DRMMeshTextureCoords: TGUID =
  11560.       (D1:$f6f23f40;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11561.  
  11562. (* {F6F23F43-7686-11cf-8F52-0040333594A3} *)
  11563.   TID_D3DRMMeshNormals: TGUID =
  11564.       (D1:$f6f23f43;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11565.  
  11566. (* {F6F23F44-7686-11cf-8F52-0040333594A3} *)
  11567.   TID_D3DRMCoords2d: TGUID =
  11568.       (D1:$f6f23f44;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11569.  
  11570. (* {F6F23F45-7686-11cf-8F52-0040333594A3} *)
  11571.   TID_D3DRMMatrix4x4: TGUID =
  11572.       (D1:$f6f23f45;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11573.  
  11574. (* {3D82AB4F-62DA-11cf-AB39-0020AF71E433} *)
  11575.   TID_D3DRMAnimation: TGUID =
  11576.       (D1:$3d82ab4f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11577.  
  11578. (* {3D82AB50-62DA-11cf-AB39-0020AF71E433} *)
  11579.   TID_D3DRMAnimationSet: TGUID =
  11580.       (D1:$3d82ab50;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11581.  
  11582. (* {10DD46A8-775B-11cf-8F52-0040333594A3} *)
  11583.   TID_D3DRMAnimationKey: TGUID =
  11584.       (D1:$10dd46a8;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11585.  
  11586. (* {10DD46A9-775B-11cf-8F52-0040333594A3} *)
  11587.   TID_D3DRMFloatKeys: TGUID =
  11588.       (D1:$10dd46a9;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11589.  
  11590. (* {01411840-7786-11cf-8F52-0040333594A3} *)
  11591.   TID_D3DRMMaterialAmbientColor: TGUID =
  11592.       (D1:$01411840;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11593.  
  11594. (* {01411841-7786-11cf-8F52-0040333594A3} *)
  11595.   TID_D3DRMMaterialDiffuseColor: TGUID =
  11596.       (D1:$01411841;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11597.  
  11598. (* {01411842-7786-11cf-8F52-0040333594A3} *)
  11599.   TID_D3DRMMaterialSpecularColor: TGUID =
  11600.       (D1:$01411842;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11601.  
  11602. (* {D3E16E80-7835-11cf-8F52-0040333594A3} *)
  11603.   TID_D3DRMMaterialEmissiveColor: TGUID =
  11604.       (D1:$d3e16e80;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11605.  
  11606. (* {01411843-7786-11cf-8F52-0040333594A3} *)
  11607.   TID_D3DRMMaterialPower: TGUID =
  11608.       (D1:$01411843;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11609.  
  11610. (* {35FF44E0-6C7C-11cf-8F52-0040333594A3} *)
  11611.   TID_D3DRMColorRGBA: TGUID =
  11612.       (D1:$35ff44e0;D2:$6c7c;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11613.  
  11614. (* {D3E16E81-7835-11cf-8F52-0040333594A3} *)
  11615.   TID_D3DRMColorRGB: TGUID =
  11616.       (D1:$d3e16e81;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11617.  
  11618. (* {A42790E0-7810-11cf-8F52-0040333594A3} *)
  11619.   TID_D3DRMGuid: TGUID =
  11620.       (D1:$a42790e0;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11621.  
  11622. (* {A42790E1-7810-11cf-8F52-0040333594A3} *)
  11623.   TID_D3DRMTextureFilename: TGUID =
  11624.       (D1:$a42790e1;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11625.  
  11626. (* {A42790E2-7810-11cf-8F52-0040333594A3} *)
  11627.   TID_D3DRMTextureReference: TGUID =
  11628.       (D1:$a42790e2;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11629.  
  11630. (* {1630B820-7842-11cf-8F52-0040333594A3} *)
  11631.   TID_D3DRMIndexedColor: TGUID =
  11632.       (D1:$1630b820;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11633.  
  11634. (* {1630B821-7842-11cf-8F52-0040333594A3} *)
  11635.   TID_D3DRMMeshVertexColors: TGUID =
  11636.       (D1:$1630b821;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11637.  
  11638. (* {4885AE60-78E8-11cf-8F52-0040333594A3} *)
  11639.   TID_D3DRMMaterialWrap: TGUID =
  11640.       (D1:$4885ae60;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11641.  
  11642. (* {537DA6A0-CA37-11d0-941C-0080C80CFA7B} *)
  11643.   TID_D3DRMBoolean: TGUID =
  11644.       (D1:$537da6a0;D2:$ca37;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
  11645.  
  11646. (* {ED1EC5C0-C0A8-11d0-941C-0080C80CFA7B} *)
  11647.   TID_D3DRMMeshFaceWraps: TGUID =
  11648.       (D1:$ed1ec5c0;D2:$c0a8;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
  11649.  
  11650. (* {4885AE63-78E8-11cf-8F52-0040333594A3} *)
  11651.   TID_D3DRMBoolean2d: TGUID =
  11652.       (D1:$4885ae63;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11653.  
  11654. (* {F406B180-7B3B-11cf-8F52-0040333594A3} *)
  11655.   TID_D3DRMTimedFloatKeys: TGUID =
  11656.       (D1:$f406b180;D2:$7b3b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11657.  
  11658. (* {E2BF56C0-840F-11cf-8F52-0040333594A3} *)
  11659.   TID_D3DRMAnimationOptions: TGUID =
  11660.       (D1:$e2bf56c0;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11661.  
  11662. (* {E2BF56C1-840F-11cf-8F52-0040333594A3} *)
  11663.   TID_D3DRMFramePosition: TGUID =
  11664.       (D1:$e2bf56c1;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11665.  
  11666. (* {E2BF56C2-840F-11cf-8F52-0040333594A3} *)
  11667.   TID_D3DRMFrameVelocity: TGUID =
  11668.       (D1:$e2bf56c2;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11669.  
  11670. (* {E2BF56C3-840F-11cf-8F52-0040333594A3} *)
  11671.   TID_D3DRMFrameRotation: TGUID =
  11672.       (D1:$e2bf56c3;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11673.  
  11674. (* {3D82AB4A-62DA-11cf-AB39-0020AF71E433} *)
  11675.   TID_D3DRMLight: TGUID =
  11676.       (D1:$3d82ab4a;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11677.  
  11678. (* {3D82AB51-62DA-11cf-AB39-0020AF71E433} *)
  11679.   TID_D3DRMCamera: TGUID =
  11680.       (D1:$3d82ab51;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11681.  
  11682. (* {E5745280-B24F-11cf-9DD5-00AA00A71A2F} *)
  11683.   TID_D3DRMAppData: TGUID =
  11684.       (D1:$e5745280;D2:$b24f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11685.  
  11686. (* {AED22740-B31F-11cf-9DD5-00AA00A71A2F} *)
  11687.   TID_D3DRMLightUmbra: TGUID =
  11688.       (D1:$aed22740;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11689.  
  11690. (* {AED22742-B31F-11cf-9DD5-00AA00A71A2F} *)
  11691.   TID_D3DRMLightRange: TGUID =
  11692.       (D1:$aed22742;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11693.  
  11694. (* {AED22741-B31F-11cf-9DD5-00AA00A71A2F} *)
  11695.   TID_D3DRMLightPenumbra: TGUID =
  11696.       (D1:$aed22741;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11697.  
  11698. (* {A8A98BA0-C5E5-11cf-B941-0080C80CFA7B} *)
  11699.   TID_D3DRMLightAttenuation: TGUID =
  11700.       (D1:$a8a98ba0;D2:$c5e5;D3:$11cf;D4:($b9,$41,$00,$80,$c8,$0c,$fa,$7b));
  11701.  
  11702. (* {3A23EEA0-94B1-11d0-AB39-0020AF71E433} *)
  11703.   TID_D3DRMInlineData: TGUID =
  11704.       (D1:$3a23eea0;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11705.  
  11706. (* {3A23EEA1-94B1-11d0-AB39-0020AF71E433} *)
  11707.   TID_D3DRMUrl: TGUID =
  11708.       (D1:$3a23eea1;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11709.  
  11710. (* {8A63C360-997D-11d0-941C-0080C80CFA7B} *)
  11711.   TID_D3DRMProgressiveMesh: TGUID =
  11712.       (D1:$8A63C360;D2:$997D;D3:$11d0;D4:($94,$1C,$00,$80,$C8,$0C,$FA,$7B));
  11713.  
  11714. (* {98116AA0-BDBA-11d1-82C0-00A0C9697271} *)
  11715.   TID_D3DRMExternalVisual: TGUID =
  11716.       (D1:$98116AA0;D2:$BDBA;D3:$11d1;D4:($82,$C0,$00,$A0,$C9,$69,$72,$71));
  11717.  
  11718. (* {7F0F21E0-BFE1-11d1-82C0-00A0C9697271} *)
  11719.   TID_D3DRMStringProperty: TGUID =
  11720.       (D1:$7f0f21e0;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11721.  
  11722. (* {7F0F21E1-BFE1-11d1-82C0-00A0C9697271} *)
  11723.   TID_D3DRMPropertyBag: TGUID =
  11724.       (D1:$7f0f21e1;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11725.  
  11726. // {7F5D5EA0-D53A-11d1-82C0-00A0C9697271}
  11727.   TID_D3DRMRightHanded: TGUID =
  11728.       (D1:$7f5d5ea0;D2:$d53a;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11729.  
  11730. (*==========================================================================;
  11731.  *
  11732.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11733.  *
  11734.  *  File:       rmxftmpl.h
  11735.  *  Content:    D3DRM XFile templates in binary form
  11736.  *
  11737.  ***************************************************************************)
  11738.  
  11739. const
  11740.   D3DRM_XTEMPLATE_BYTES_2  = 3278;
  11741.  
  11742.   D3DRM_XTEMPLATES_2: array [0..D3DRM_XTEMPLATE_BYTES_2-1] of byte = (
  11743.         $78, $6f, $66, $20, $30, $33, $30, $32, $62, $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
  11744.         0, $6, 0, 0, 0, $48, $65, $61, $64, $65, $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
  11745.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
  11746.         $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
  11747.         0, $29, 0, $1, 0, $5, 0, 0, 0, $66, $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
  11748.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
  11749.         $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
  11750.         $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0, 0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
  11751.         0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  11752.         $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  11753.         $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0, 0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
  11754.         0, 0, $76, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  11755.         $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  11756.         $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
  11757.         $e, 0, $3, 0, $10, 0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
  11758.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
  11759.         $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
  11760.         $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
  11761.         0, $1, 0, $4, 0, 0, 0, $62, $6c, $75, $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
  11762.         0, $61, $6c, $70, $68, $61, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
  11763.         $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0, $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
  11764.         0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
  11765.         0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
  11766.         0, 0, $62, $6c, $75, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
  11767.         $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72, $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
  11768.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
  11769.         $64, $65, $78, $14, 0, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
  11770.         $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65, $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
  11771.         $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
  11772.         $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
  11773.         0, 0, 0, $74, $72, $75, $65, $66, $61, $6c, $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
  11774.         $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
  11775.         $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
  11776.         $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
  11777.         0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
  11778.         0, $1, 0, $c, 0, 0, 0, $4d, $61, $74, $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
  11779.         0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  11780.         0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
  11781.         0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
  11782.         $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
  11783.         $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0, $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
  11784.         $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0, $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
  11785.         $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
  11786.         $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
  11787.         $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
  11788.         0, $9, 0, 0, 0, $66, $61, $63, $65, $43, $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
  11789.         $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
  11790.         $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0, 0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
  11791.         $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  11792.         $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73, $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
  11793.         0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
  11794.         0, $4d, $65, $73, $68, $46, $61, $63, $65, $a, 0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
  11795.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
  11796.         $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
  11797.         0, $1, 0, $11, 0, 0, 0, $66, $61, $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
  11798.         $69, $63, $65, $73, $e, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
  11799.         $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  11800.         $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
  11801.         0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
  11802.         0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
  11803.         $14, 0, $34, 0, $1, 0, $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
  11804.         0, $e, 0, 0, 0, $66, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
  11805.         0, $1, 0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
  11806.         $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
  11807.         $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
  11808.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
  11809.         0, $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
  11810.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64, $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
  11811.         $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
  11812.         $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
  11813.         $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65, $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
  11814.         $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  11815.         $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0, 0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
  11816.         $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
  11817.         $65, $78, $65, $73, $14, 0, $34, 0, $29, 0, $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
  11818.         $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
  11819.         $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14, 0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
  11820.         $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b, 0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
  11821.         $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73, $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
  11822.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
  11823.         $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  11824.         $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
  11825.         0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
  11826.         0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
  11827.         0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
  11828.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
  11829.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  11830.         $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
  11831.         $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  11832.         $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  11833.         $73, $14, 0, $34, 0, $1, 0, $c, 0, 0, 0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
  11834.         $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  11835.         $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
  11836.         $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
  11837.         $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  11838.         $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
  11839.         0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
  11840.         $65, $72, $74, $69, $63, $65, $73, $e, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
  11841.         $69, $63, $65, $73, $f, 0, $14, 0, $29, 0, $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
  11842.         $65, $73, $14, 0, $34, 0, $1, 0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
  11843.         $1, 0, $5, 0, 0, 0, $66, $61, $63, $65, $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
  11844.         $46, $61, $63, $65, $73, $f, 0, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  11845.         0, $1f, 0, $1, 0, $14, 0, 0, 0, $46, $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
  11846.         $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a, 0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
  11847.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  11848.         $78, $34, $78, $34, $1, 0, $b, 0, 0, 0, $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
  11849.         $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5, 0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
  11850.         $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
  11851.         $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
  11852.         $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5, 0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
  11853.         $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
  11854.         $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
  11855.         $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
  11856.         0, $1f, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
  11857.         $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6, $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
  11858.         $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0, 0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
  11859.         0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65, $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
  11860.         $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
  11861.         $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0, $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
  11862.         $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
  11863.         $79, $70, $65, $14, 0, $29, 0, $1, 0, $5, 0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
  11864.         $34, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
  11865.         $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65, $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
  11866.         $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
  11867.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70, $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
  11868.         $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
  11869.         0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f, $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
  11870.         0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f, $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
  11871.         $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
  11872.         0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
  11873.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
  11874.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65, $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
  11875.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
  11876.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0, $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
  11877.         $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
  11878.         $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
  11879.         $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0, $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
  11880.         0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  11881.         0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
  11882.         $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
  11883.         $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
  11884.         $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68, $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
  11885.         $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
  11886.         $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
  11887.         0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
  11888.         $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
  11889.         0, 0, 0, $64, $61, $74, $61, $31, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
  11890.         $74, $61, $32, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
  11891.         $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
  11892.         0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
  11893.         $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74, $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
  11894.         $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
  11895.         $65, $79, $14, 0, $31, 0, $1, 0, $5, 0, 0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
  11896.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $50, $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
  11897.         $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
  11898.         $e, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
  11899.         $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
  11900.         $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0, $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
  11901.         $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
  11902.         $12, 0, 0, 0, $67, $75, $69, $64, $45, $78, $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
  11903.         $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0,
  11904.         $b, 0, 0, 0, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $a, 0, $5, 0, $a0,
  11905.         $5e, $5d, $7f, $3a, $d5, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $29, 0, $1, 0, $c,
  11906.         0, 0, 0, $62, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $14, 0, $b, 0);
  11907.  
  11908. //---------------
  11909. {$ENDIF}
  11910. //DirectInput file
  11911. (*==========================================================================;
  11912.  *
  11913.  *  Copyright (C) 1996-1999 Microsoft Corporation.  All Rights Reserved.
  11914.  *
  11915.  *  File:       dinput.h
  11916.  *  Content:    DirectInput include file
  11917.  *
  11918.  *  DirectX 7.0 Delphi adaptation by Erik Unger, input format
  11919.  *  variable structure & other fixups by Arne Schäpers (as)
  11920.  *
  11921.  *  Modified: 10-Sep-2000
  11922.  *
  11923.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  11924.  *  E-Mail: DelphiDirectX@next-reality.com
  11925.  *          a.schaepers@digitalpublishing.de            
  11926.  *
  11927.  ***************************************************************************)
  11928.  
  11929. { Some notes from as:
  11930.   1. DirectInput Enum callback functions which are documented with result
  11931.   type BOOL in the SDK had to be changed to result type integer because the debug
  11932.   version of DINPUT.DLL (which is the same for SDK versions 5.0, 5.2, 6.0, and 6.1)
  11933.   explicitely checks for two possible return values:
  11934.  
  11935.   0 - FALSE in C and in Delphi
  11936.   1 - TRUE in C, defined as DIENUM_CONTINUE
  11937.  
  11938.   In Delphi, TRUE means $FFFFFFFF (= -1) for the LongBool (= BOOL) data
  11939.   type, and AL = 1 (upper three bytes undefined) for the Boolean data type.
  11940.   The debug version of DINPUT.DLL will throw an external exception
  11941.   ("invalid return value for callback") when fed with either value.
  11942.  
  11943.   This change affects the following methods:
  11944.   EnumDevices, EnumObjects, EnumEffects, EnumCreatedEffectObjects
  11945.  
  11946.   2. Windows 98 and DX6 debug versions DInput and DSound
  11947.  
  11948.   Under Windows 98, the "debug" setup of the DirectX SDK 6.x skips DInput.DLL
  11949.   and DSound.DLL, i.e. makes you end up with the retail version of these two
  11950.   files without any notice.
  11951.   The debug versions of DInput.DLL and DSound.DLL can be found in the
  11952.   \extras\Win98\Win98Dbg folder of the SDK CD; they need to be installed
  11953.   "manually".
  11954.  
  11955.   This problem has been fixed with DX7 where the SDK installs the debug versions
  11956.   of DInput and DSound without any "manual" help.
  11957.  
  11958. }
  11959.  
  11960.  
  11961. var
  11962.   DInputDLL : HMODULE;
  11963.  
  11964. {$IFDEF DIRECTX3}
  11965. const DIRECTINPUT_VERSION = $0300;
  11966. {$ELSE}
  11967. const DIRECTINPUT_VERSION = $0700;
  11968. {$ENDIF}
  11969.  
  11970. function DIErrorString(Value: HResult) : string;
  11971.  
  11972. //type
  11973. //  TRefGUID = packed record
  11974. //    case integer of
  11975. //    1: (guid : PGUID);
  11976. //    2: (dwFlags : DWORD);
  11977. //  end;
  11978.  
  11979. (****************************************************************************
  11980.  *
  11981.  *      Class IDs
  11982.  *
  11983.  ****************************************************************************)
  11984. const
  11985.   CLSID_DirectInput: TGUID =
  11986.       (D1:$25E609E0;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  11987.   CLSID_DirectInputDevice: TGUID =
  11988.       (D1:$25E609E1;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  11989.  
  11990. (****************************************************************************
  11991.  *
  11992.  *      Predefined object types
  11993.  *
  11994.  ****************************************************************************)
  11995.  
  11996.   GUID_XAxis: TGUID =
  11997.       (D1:$A36D02E0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  11998.   GUID_YAxis: TGUID =
  11999.       (D1:$A36D02E1;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12000.   GUID_ZAxis: TGUID =
  12001.       (D1:$A36D02E2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12002.   GUID_RxAxis: TGUID =
  12003.       (D1:$A36D02F4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12004.   GUID_RyAxis: TGUID =
  12005.       (D1:$A36D02F5;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12006.   GUID_RzAxis: TGUID =
  12007.       (D1:$A36D02E3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12008.   GUID_Slider: TGUID =
  12009.       (D1:$A36D02E4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12010.  
  12011.   GUID_Button: TGUID =
  12012.       (D1:$A36D02F0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12013.   GUID_Key: TGUID =
  12014.       (D1:$55728220;D2:$D33C;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12015.  
  12016.   GUID_POV: TGUID =
  12017.       (D1:$A36D02F2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12018.  
  12019.   GUID_Unknown: TGUID =
  12020.       (D1:$A36D02F3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12021.  
  12022. (****************************************************************************
  12023.  *
  12024.  *      Predefined product GUIDs
  12025.  *
  12026.  ****************************************************************************)
  12027.  
  12028.   GUID_SysMouse: TGUID =
  12029.       (D1:$6F1D2B60;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12030.   GUID_SysKeyboard: TGUID =
  12031.       (D1:$6F1D2B61;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12032.   GUID_Joystick: TGUID =
  12033.       (D1:$6F1D2B70;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12034.   GUID_SysMouseEm: TGUID = '{6F1D2B80-D5A0-11CF-BFC7-444553540000}';
  12035.   GUID_SysMouseEm2: TGUID = '{6F1D2B81-D5A0-11CF-BFC7-444553540000}';
  12036.   GUID_SysKeyboardEm: TGUID = '{6F1D2B82-D5A0-11CF-BFC7-444553540000}';
  12037.   GUID_SysKeyboardEm2: TGUID = '{6F1D2B83-D5A0-11CF-BFC7-444553540000}';
  12038.  
  12039. (****************************************************************************
  12040.  *
  12041.  *      Predefined force feedback effects
  12042.  *
  12043.  ****************************************************************************)
  12044.  
  12045.   GUID_ConstantForce: TGUID =
  12046.       (D1:$13541C20;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12047.   GUID_RampForce: TGUID =
  12048.       (D1:$13541C21;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12049.   GUID_Square: TGUID =
  12050.       (D1:$13541C22;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12051.   GUID_Sine: TGUID =
  12052.       (D1:$13541C23;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12053.   GUID_Triangle: TGUID =
  12054.       (D1:$13541C24;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12055.   GUID_SawtoothUp: TGUID =
  12056.       (D1:$13541C25;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12057.   GUID_SawtoothDown: TGUID =
  12058.       (D1:$13541C26;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12059.   GUID_Spring: TGUID =
  12060.       (D1:$13541C27;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12061.   GUID_Damper: TGUID =
  12062.       (D1:$13541C28;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12063.   GUID_Inertia: TGUID =
  12064.       (D1:$13541C29;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12065.   GUID_Friction: TGUID =
  12066.       (D1:$13541C2A;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12067.   GUID_CustomForce: TGUID =
  12068.       (D1:$13541C2B;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12069.  
  12070.  
  12071.  
  12072. (****************************************************************************
  12073.  *
  12074.  *      Interfaces and Structures...
  12075.  *
  12076.  ****************************************************************************)
  12077.  
  12078. (****************************************************************************
  12079.  *
  12080.  *      IDirectInputEffect
  12081.  *
  12082.  ****************************************************************************)
  12083.  
  12084. const
  12085.   DIEFT_ALL                   = $00000000;
  12086.  
  12087.   DIEFT_CONSTANTFORCE         = $00000001;
  12088.   DIEFT_RAMPFORCE             = $00000002;
  12089.   DIEFT_PERIODIC              = $00000003;
  12090.   DIEFT_CONDITION             = $00000004;
  12091.   DIEFT_CUSTOMFORCE           = $00000005;
  12092.   DIEFT_HARDWARE              = $000000FF;
  12093.  
  12094.   DIEFT_FFATTACK              = $00000200;
  12095.   DIEFT_FFFADE                = $00000400;
  12096.   DIEFT_SATURATION            = $00000800;
  12097.   DIEFT_POSNEGCOEFFICIENTS    = $00001000;
  12098.   DIEFT_POSNEGSATURATION      = $00002000;
  12099.   DIEFT_DEADBAND              = $00004000;
  12100.   DIEFT_STARTDELAY            = $00008000;
  12101.  
  12102. function DIEFT_GETTYPE(n: variant) : byte;
  12103.  
  12104. const
  12105.   DI_DEGREES                  =     100;
  12106.   DI_FFNOMINALMAX             =   10000;
  12107.   DI_SECONDS                  = 1000000;
  12108.  
  12109. type
  12110.   PDIConstantForce = ^TDIConstantForce;
  12111.   TDIConstantForce = packed record
  12112.     lMagnitude : LongInt;
  12113.   end;
  12114.  
  12115.   PDIRampForce = ^TDIRampForce;
  12116.   TDIRampForce = packed record
  12117.     lStart : LongInt;
  12118.     lEnd : LongInt;
  12119.   end;
  12120.  
  12121.   PDIPeriodic = ^TDIPeriodic;
  12122.   TDIPeriodic = packed record
  12123.     dwMagnitude : DWORD;
  12124.     lOffset : LongInt;
  12125.     dwPhase : DWORD;
  12126.     dwPeriod : DWORD;
  12127.   end;
  12128.  
  12129.   PDICondition = ^TDICondition;
  12130.   TDICondition = packed record
  12131.     lOffset : LongInt;
  12132.     lPositiveCoefficient : LongInt;
  12133.     lNegativeCoefficient : LongInt;
  12134.     dwPositiveSaturation : DWORD;
  12135.     dwNegativeSaturation : DWORD;
  12136.     lDeadBand : LongInt;
  12137.   end;
  12138.  
  12139.   PDICustomForce = ^TDICustomForce;
  12140.   TDICustomForce = packed record
  12141.     cChannels : DWORD;
  12142.     dwSamplePeriod : DWORD;
  12143.     cSamples : DWORD;
  12144.     rglForceData : PLongInt;
  12145.   end;
  12146.  
  12147.   PDIEnvelope = ^TDIEnvelope;
  12148.   TDIEnvelope = packed record
  12149.     dwSize : DWORD;                   (* sizeof(DIENVELOPE)   *)
  12150.     dwAttackLevel : DWORD;
  12151.     dwAttackTime : DWORD;             (* Microseconds         *)
  12152.     dwFadeLevel : DWORD;
  12153.     dwFadeTime : DWORD;               (* Microseconds         *)
  12154.   end;
  12155.  
  12156.   PDIEffect_DX5 = ^TDIEffect_DX5;
  12157.   TDIEffect_DX5 = packed record
  12158.     dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
  12159.     dwFlags : DWORD;                  (* DIEFF_*              *)
  12160.     dwDuration : DWORD;               (* Microseconds         *)
  12161.     dwSamplePeriod : DWORD;           (* Microseconds         *)
  12162.     dwGain : DWORD;
  12163.     dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
  12164.     dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
  12165.     cAxes : DWORD;                    (* Number of axes       *)
  12166.     rgdwAxes : PDWORD;                (* Array of axes        *)
  12167.     rglDirection : PLongInt;          (* Array of directions  *)
  12168.     lpEnvelope : PDIEnvelope;         (* Optional             *)
  12169.     cbTypeSpecificParams : DWORD;     (* Size of params       *)
  12170.     lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
  12171.   end;
  12172.  
  12173.   PDIEffect_DX6 = ^TDIEffect_DX6;
  12174.   TDIEffect_DX6 = packed record
  12175.     dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
  12176.     dwFlags : DWORD;                  (* DIEFF_*              *)
  12177.     dwDuration : DWORD;               (* Microseconds         *)
  12178.     dwSamplePeriod : DWORD;           (* Microseconds         *)
  12179.     dwGain : DWORD;
  12180.     dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
  12181.     dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
  12182.     cAxes : DWORD;                    (* Number of axes       *)
  12183.     rgdwAxes : PDWORD;                (* Array of axes        *)
  12184.     rglDirection : PLongInt;          (* Array of directions  *)
  12185.     lpEnvelope : PDIEnvelope;         (* Optional             *)
  12186.     cbTypeSpecificParams : DWORD;     (* Size of params       *)
  12187.     lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
  12188.     dwStartDelay: DWORD;              (* Microseconds         *)
  12189.   end;
  12190.  
  12191.   PDIEffect = ^TDIEffect;
  12192. {$IFDEF DIRECTX5}
  12193.   TDIEffect = TDIEffect_DX5;
  12194. {$ELSE}
  12195.   TDIEffect = TDIEffect_DX6;
  12196. {$ENDIF}
  12197.  
  12198.   PDIFileEffect = ^TDIFileEffect;
  12199.   TDIFileEffect = packed record
  12200.     dwSize : DWORD;
  12201.     GuidEffect: TGUID;
  12202.     lpDiEffect: PDIEffect;
  12203.     szFriendlyName : array [0..MAX_PATH-1] of AnsiChar;
  12204.   end;
  12205.  
  12206. const
  12207.   DIEFF_OBJECTIDS             = $00000001;
  12208.   DIEFF_OBJECTOFFSETS         = $00000002;
  12209.   DIEFF_CARTESIAN             = $00000010;
  12210.   DIEFF_POLAR                 = $00000020;
  12211.   DIEFF_SPHERICAL             = $00000040;
  12212.  
  12213.   DIEP_DURATION               = $00000001;
  12214.   DIEP_SAMPLEPERIOD           = $00000002;
  12215.   DIEP_GAIN                   = $00000004;
  12216.   DIEP_TRIGGERBUTTON          = $00000008;
  12217.   DIEP_TRIGGERREPEATINTERVAL  = $00000010;
  12218.   DIEP_AXES                   = $00000020;
  12219.   DIEP_DIRECTION              = $00000040;
  12220.   DIEP_ENVELOPE               = $00000080;
  12221.   DIEP_TYPESPECIFICPARAMS     = $00000100;
  12222. {$IFDEF DIRECTX5}
  12223.   DIEP_ALLPARAMS              = $000001FF;
  12224. {$ELSE}
  12225.   DIEP_STARTDELAY             = $00000200;
  12226.   DIEP_ALLPARAMS_DX5          = $000001FF;
  12227.   DIEP_ALLPARAMS              = $000003FF;
  12228. {$ENDIF}
  12229.   DIEP_START                  = $20000000;
  12230.   DIEP_NORESTART              = $40000000;
  12231.   DIEP_NODOWNLOAD             = $80000000;
  12232.   DIEB_NOTRIGGER              = $FFFFFFFF;
  12233.  
  12234.   DIES_SOLO                   = $00000001;
  12235.   DIES_NODOWNLOAD             = $80000000;
  12236.  
  12237.   DIEGES_PLAYING              = $00000001;
  12238.   DIEGES_EMULATED             = $00000002;
  12239.  
  12240.  
  12241. type
  12242.   PDIEffEscape = ^TDIEffEscape;
  12243.   TDIEffEscape = packed record
  12244.     dwSize : DWORD;
  12245.     dwCommand : DWORD;
  12246.     lpvInBuffer : pointer;
  12247.     cbInBuffer : DWORD;
  12248.     lpvOutBuffer : pointer;
  12249.     cbOutBuffer : DWORD;
  12250.   end;
  12251.  
  12252.  
  12253. //
  12254. // IDirectSoundCapture  // as: ???
  12255. //
  12256.   IDirectInputEffect = interface (IUnknown)
  12257.     ['{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}']
  12258.     (** IDirectInputEffect methods ***)
  12259.     function Initialize(hinst: THandle; dwVersion: DWORD;
  12260.         const rguid: TGUID) : HResult;  stdcall;
  12261.     function GetEffectGuid(var pguid: TGUID) : HResult;  stdcall;
  12262.     function GetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
  12263.     function SetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
  12264.     function Start(dwIterations: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12265.     function Stop : HResult;  stdcall;
  12266.     function GetEffectStatus(var pdwFlags : DWORD) : HResult;  stdcall;
  12267.     function Download : HResult;  stdcall;
  12268.     function Unload : HResult;  stdcall;
  12269.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12270.   end;
  12271.  
  12272. (****************************************************************************
  12273.  *
  12274.  *      IDirectInputDevice
  12275.  *
  12276.  ****************************************************************************)
  12277.  
  12278. const
  12279.   DIDEVTYPE_DEVICE = 1;
  12280.   DIDEVTYPE_MOUSE = 2;
  12281.   DIDEVTYPE_KEYBOARD = 3;
  12282.   DIDEVTYPE_JOYSTICK = 4;
  12283.   DIDEVTYPE_HID = $00010000;
  12284.  
  12285.   DIDEVTYPEMOUSE_UNKNOWN = 1;
  12286.   DIDEVTYPEMOUSE_TRADITIONAL = 2;
  12287.   DIDEVTYPEMOUSE_FINGERSTICK = 3;
  12288.   DIDEVTYPEMOUSE_TOUCHPAD = 4;
  12289.   DIDEVTYPEMOUSE_TRACKBALL = 5;
  12290.  
  12291.   DIDEVTYPEKEYBOARD_UNKNOWN = 0;
  12292.   DIDEVTYPEKEYBOARD_PCXT = 1;
  12293.   DIDEVTYPEKEYBOARD_OLIVETTI = 2;
  12294.   DIDEVTYPEKEYBOARD_PCAT = 3;
  12295.   DIDEVTYPEKEYBOARD_PCENH = 4;
  12296.   DIDEVTYPEKEYBOARD_NOKIA1050 = 5;
  12297.   DIDEVTYPEKEYBOARD_NOKIA9140 = 6;
  12298.   DIDEVTYPEKEYBOARD_NEC98 = 7;
  12299.   DIDEVTYPEKEYBOARD_NEC98LAPTOP = 8;
  12300.   DIDEVTYPEKEYBOARD_NEC98106 = 9;
  12301.   DIDEVTYPEKEYBOARD_JAPAN106 = 10;
  12302.   DIDEVTYPEKEYBOARD_JAPANAX = 11;
  12303.   DIDEVTYPEKEYBOARD_J3100 = 12;
  12304.  
  12305.   DIDEVTYPEJOYSTICK_UNKNOWN = 1;
  12306.   DIDEVTYPEJOYSTICK_TRADITIONAL = 2;
  12307.   DIDEVTYPEJOYSTICK_FLIGHTSTICK = 3;
  12308.   DIDEVTYPEJOYSTICK_GAMEPAD = 4;
  12309.   DIDEVTYPEJOYSTICK_RUDDER = 5;
  12310.   DIDEVTYPEJOYSTICK_WHEEL = 6;
  12311.   DIDEVTYPEJOYSTICK_HEADTRACKER = 7;
  12312.  
  12313. function GET_DIDEVICE_TYPE(dwDevType: variant) : byte;
  12314. function GET_DIDEVICE_SUBTYPE(dwDevType: variant) : byte;
  12315.  
  12316. type
  12317.   PDIDevCaps_DX3 = ^TDIDevCaps_DX3;
  12318.   TDIDevCaps_DX3 = packed record
  12319.     dwSize: DWORD;
  12320.     dwFlags: DWORD;
  12321.     dwDevType: DWORD;
  12322.     dwAxes: DWORD;
  12323.     dwButtons: DWORD;
  12324.     dwPOVs: DWORD;
  12325.   end;
  12326.  
  12327.   PDIDevCaps_DX5 = ^TDIDevCaps_DX5;
  12328.   TDIDevCaps_DX5 = packed record
  12329.     dwSize: DWORD;
  12330.     dwFlags: DWORD;
  12331.     dwDevType: DWORD;
  12332.     dwAxes: DWORD;
  12333.     dwButtons: DWORD;
  12334.     dwPOVs: DWORD;
  12335.     dwFFSamplePeriod: DWORD;
  12336.     dwFFMinTimeResolution: DWORD;
  12337.     dwFirmwareRevision: DWORD;
  12338.     dwHardwareRevision: DWORD;
  12339.     dwFFDriverVersion: DWORD;
  12340.   end;
  12341.  
  12342.   PDIDevCaps = ^TDIDevCaps;
  12343. {$IFDEF DIRECTX3}
  12344.   TDIDevCaps = TDIDevCaps_DX3;
  12345. {$ELSE}
  12346.   TDIDevCaps = TDIDevCaps_DX5;
  12347. {$ENDIF}
  12348.  
  12349. const
  12350.   DIDC_ATTACHED           = $00000001;
  12351.   DIDC_POLLEDDEVICE       = $00000002;
  12352.   DIDC_EMULATED           = $00000004;
  12353.   DIDC_POLLEDDATAFORMAT   = $00000008;
  12354.   DIDC_FORCEFEEDBACK      = $00000100;
  12355.   DIDC_FFATTACK           = $00000200;
  12356.   DIDC_FFFADE             = $00000400;
  12357.   DIDC_SATURATION         = $00000800;
  12358.   DIDC_POSNEGCOEFFICIENTS = $00001000;
  12359.   DIDC_POSNEGSATURATION   = $00002000;
  12360.   DIDC_DEADBAND           = $00004000;
  12361.   DIDC_STARTDELAY         = $00008000;
  12362.   DIDC_ALIAS              = $00010000;
  12363.   DIDC_PHANTOM            = $00020000;
  12364.  
  12365.   DIDFT_ALL = $00000000;
  12366.  
  12367.   DIDFT_RELAXIS = $00000001;
  12368.   DIDFT_ABSAXIS = $00000002;
  12369.   DIDFT_AXIS    = $00000003;
  12370.  
  12371.   DIDFT_PSHBUTTON = $00000004;
  12372.   DIDFT_TGLBUTTON = $00000008;
  12373.   DIDFT_BUTTON    = $0000000C;
  12374.  
  12375.   DIDFT_POV        = $00000010;
  12376.   DIDFT_COLLECTION = $00000040;
  12377.   DIDFT_NODATA     = $00000080;
  12378.  
  12379.   DIDFT_ANYINSTANCE = $00FFFF00;
  12380.   DIDFT_INSTANCEMASK = DIDFT_ANYINSTANCE;
  12381. function DIDFT_MAKEINSTANCE(n: variant) : DWORD;
  12382. function DIDFT_GETTYPE(n: variant) : byte;
  12383. function DIDFT_GETINSTANCE(n: variant) : DWORD;
  12384. const
  12385.   DIDFT_FFACTUATOR        = $01000000;
  12386.   DIDFT_FFEFFECTTRIGGER   = $02000000;
  12387.   DIDFT_OUTPUT            = $10000000;
  12388.   DIDFT_VENDORDEFINED     = $04000000;
  12389.   DIDFT_ALIAS             = $08000000;
  12390.  
  12391. function DIDFT_ENUMCOLLECTION(n: variant) : DWORD;
  12392. const
  12393.   DIDFT_NOCOLLECTION = $00FFFF00;
  12394.  
  12395.  
  12396.  
  12397. type
  12398.   PDIObjectDataFormat = ^TDIObjectDataFormat;
  12399.   TDIObjectDataFormat = packed record
  12400.     pguid: PGUID;
  12401.     dwOfs: DWORD;
  12402.     dwType: DWORD;
  12403.     dwFlags: DWORD;
  12404.   end;
  12405.  
  12406.   PDIDataFormat = ^TDIDataFormat;
  12407.   TDIDataFormat = packed record
  12408.     dwSize: DWORD;  
  12409.     dwObjSize: DWORD;
  12410.     dwFlags: DWORD;  
  12411.     dwDataSize: DWORD;  
  12412.     dwNumObjs: DWORD;  
  12413.     rgodf: PDIObjectDataFormat;
  12414.   end;
  12415.  
  12416. const
  12417.   DIDF_ABSAXIS = $00000001;
  12418.   DIDF_RELAXIS = $00000002;
  12419.  
  12420. type
  12421.   PDIDeviceObjectInstance_DX3A = ^TDIDeviceObjectInstance_DX3A;
  12422.   TDIDeviceObjectInstance_DX3A = packed record
  12423.     dwSize: DWORD;
  12424.     guidType: TGUID;
  12425.     dwOfs: DWORD;
  12426.     dwType: DWORD;
  12427.     dwFlags: DWORD;
  12428.     tszName: Array [0..MAX_PATH-1] of CHAR;
  12429.   end;
  12430.  
  12431.   PDIDeviceObjectInstance_DX3W = ^TDIDeviceObjectInstance_DX3W;
  12432.   TDIDeviceObjectInstance_DX3W = packed record
  12433.     dwSize: DWORD;
  12434.     guidType: TGUID;
  12435.     dwOfs: DWORD;
  12436.     dwType: DWORD;
  12437.     dwFlags: DWORD;
  12438.     tszName: Array [0..MAX_PATH-1] of WCHAR;
  12439.   end;
  12440.  
  12441.   PDIDeviceObjectInstance_DX3 = ^TDIDeviceObjectInstance_DX3;
  12442. {$IFDEF UNICODE}
  12443.   TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3W;
  12444. {$ELSE}
  12445.   TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3A;
  12446. {$ENDIF}
  12447.  
  12448.   PDIDeviceObjectInstance_DX5A = ^TDIDeviceObjectInstance_DX5A;
  12449.   TDIDeviceObjectInstance_DX5A = packed record
  12450.     dwSize: DWORD;
  12451.     guidType: TGUID;
  12452.     dwOfs: DWORD;
  12453.     dwType: DWORD;
  12454.     dwFlags: DWORD;
  12455.     tszName: Array [0..MAX_PATH-1] of CHAR;
  12456.     dwFFMaxForce: DWORD;
  12457.     dwFFForceResolution: DWORD;
  12458.     wCollectionNumber: WORD;
  12459.     wDesignatorIndex: WORD;
  12460.     wUsagePage: WORD;
  12461.     wUsage: WORD;
  12462.     dwDimension: DWORD;
  12463.     wExponent: WORD;
  12464.     wReserved: WORD;
  12465.   end;
  12466.  
  12467.   PDIDeviceObjectInstance_DX5W = ^TDIDeviceObjectInstance_DX5W;
  12468.   TDIDeviceObjectInstance_DX5W = packed record
  12469.     dwSize: DWORD;
  12470.     guidType: TGUID;
  12471.     dwOfs: DWORD;
  12472.     dwType: DWORD;
  12473.     dwFlags: DWORD;
  12474.     tszName: Array [0..MAX_PATH-1] of WCHAR;
  12475.     dwFFMaxForce: DWORD;
  12476.     dwFFForceResolution: DWORD;
  12477.     wCollectionNumber: WORD;
  12478.     wDesignatorIndex: WORD;
  12479.     wUsagePage: WORD;
  12480.     wUsage: WORD;
  12481.     dwDimension: DWORD;
  12482.     wExponent: WORD;
  12483.     wReserved: WORD;
  12484.   end;
  12485.  
  12486.   PDIDeviceObjectInstance_DX5 = ^TDIDeviceObjectInstance_DX5;
  12487. {$IFDEF UNICODE}
  12488.   TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5W;
  12489. {$ELSE}
  12490.   TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5A;
  12491. {$ENDIF}
  12492.  
  12493.   PDIDeviceObjectInstanceA = ^TDIDeviceObjectInstanceA;
  12494.   PDIDeviceObjectInstanceW = ^TDIDeviceObjectInstanceA;
  12495.   PDIDeviceObjectInstance = ^TDIDeviceObjectInstance;
  12496. {$IFDEF DIRECTX3}
  12497.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX3A;
  12498.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX3W;
  12499.   TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX3;
  12500. {$ELSE}
  12501.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX5A;
  12502.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX5W;
  12503.   TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX5;
  12504. {$ENDIF}
  12505.  
  12506.   // Bug fix (and deviation from the SDK). Callback *must* return
  12507.   // DIENUM_STOP (= 0) or DIENUM_CONTINUE (=1) in order to work
  12508.   // with the debug version of DINPUT.DLL
  12509.   TDIEnumDeviceObjectsCallbackA = function (
  12510.       var lpddoi: TDIDeviceObjectInstanceA; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12511.   TDIEnumDeviceObjectsCallbackW = function (
  12512.       var lpddoi: TDIDeviceObjectInstanceW; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12513.   TDIEnumDeviceObjectsCallback = function (
  12514.       var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12515.  
  12516.   TDIEnumDeviceObjectsProc = function (
  12517.       var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12518.  
  12519. const
  12520.   DIDOI_FFACTUATOR        = $00000001;
  12521.   DIDOI_FFEFFECTTRIGGER   = $00000002;
  12522.   DIDOI_POLLED            = $00008000;
  12523.   DIDOI_ASPECTPOSITION    = $00000100;
  12524.   DIDOI_ASPECTVELOCITY    = $00000200;
  12525.   DIDOI_ASPECTACCEL       = $00000300;
  12526.   DIDOI_ASPECTFORCE       = $00000400;
  12527.   DIDOI_ASPECTMASK        = $00000F00;
  12528.   DIDOI_GUIDISUSAGE       = $00010000;
  12529.  
  12530. type
  12531.   PDIPropHeader = ^TDIPropHeader;
  12532.   TDIPropHeader = packed record
  12533.     dwSize: DWORD;
  12534.     dwHeaderSize: DWORD;
  12535.     dwObj: DWORD;
  12536.     dwHow: DWORD;
  12537.   end;
  12538.  
  12539. const
  12540.   DIPH_DEVICE = 0;
  12541.   DIPH_BYOFFSET = 1;
  12542.   DIPH_BYID = 2;
  12543.   DIPH_BYUSAGE = 3;
  12544.  
  12545. function DIMAKEUSAGEDWORD(UsagePage, Usage: WORD) : DWORD;
  12546.  
  12547. type
  12548.   PDIPropDWord = ^TDIPropDWord;
  12549.   TDIPropDWord = packed record
  12550.     diph: TDIPropHeader;
  12551.     dwData: DWORD;
  12552.   end;
  12553.  
  12554.   PDIPropRange = ^TDIPropRange;
  12555.   TDIPropRange = packed record
  12556.     diph: TDIPropHeader;
  12557.     lMin: Longint;
  12558.     lMax: Longint;
  12559.   end;
  12560.  
  12561. const
  12562.   DIPROPRANGE_NOMIN = $80000000;
  12563.   DIPROPRANGE_NOMAX = $7FFFFFFF;
  12564.  
  12565. type
  12566.   PDIPropCal = ^TDIPropCal;
  12567.   TDIPropCal = packed record
  12568.     diph: TDIPropHeader;
  12569.     lMin:    LongInt;
  12570.     lCenter: LongInt;
  12571.     lMax:    LongInt;
  12572.   end;
  12573.  
  12574.   PDIPropGUIDAndPath = ^TDIPropGUIDAndPath;
  12575.   TDIPropGUIDAndPath = packed record
  12576.     diph: TDIPropHeader;
  12577.     guidClass: TGUID;
  12578.     wszPath: array [0..MAX_PATH-1] of WideChar;
  12579.   end;
  12580.  
  12581.   PDIPropString = ^TDIPropString;
  12582.   TDIPropString = packed record
  12583.     diph: TDIPropHeader;
  12584.     wsz: array [0..MAX_PATH-1] of WideChar;
  12585.   end;
  12586.  
  12587. type
  12588.   MAKEDIPROP = PGUID;
  12589.  
  12590. const
  12591.   DIPROP_BUFFERSIZE = MAKEDIPROP(1);
  12592.  
  12593.   DIPROP_AXISMODE = MAKEDIPROP(2);
  12594.  
  12595.   DIPROPAXISMODE_ABS = 0;
  12596.   DIPROPAXISMODE_REL = 1;
  12597.  
  12598.   DIPROP_GRANULARITY = MAKEDIPROP(3);
  12599.  
  12600.   DIPROP_RANGE = MAKEDIPROP(4);
  12601.  
  12602.   DIPROP_DEADZONE = MAKEDIPROP(5);
  12603.  
  12604.   DIPROP_SATURATION = MAKEDIPROP(6);
  12605.  
  12606.   DIPROP_FFGAIN = MAKEDIPROP(7);
  12607.  
  12608.   DIPROP_FFLOAD = MAKEDIPROP(8);
  12609.  
  12610.   DIPROP_AUTOCENTER = MAKEDIPROP(9);
  12611.  
  12612.   DIPROPAUTOCENTER_OFF = 0;
  12613.   DIPROPAUTOCENTER_ON = 1;
  12614.  
  12615.   DIPROP_CALIBRATIONMODE = MAKEDIPROP(10);
  12616.  
  12617.   DIPROPCALIBRATIONMODE_COOKED = 0;
  12618.   DIPROPCALIBRATIONMODE_RAW = 1;
  12619.  
  12620.   DIPROP_CALIBRATION      = MAKEDIPROP(11);
  12621.  
  12622.   DIPROP_GUIDANDPATH      = MAKEDIPROP(12);
  12623.  
  12624.   DIPROP_INSTANCENAME     = MAKEDIPROP(13);
  12625.  
  12626.   DIPROP_PRODUCTNAME      = MAKEDIPROP(14);
  12627.  
  12628.   DIPROP_JOYSTICKID       = MAKEDIPROP(15);
  12629.  
  12630.   DIPROP_GETPORTDISPLAYNAME       = MAKEDIPROP(16);
  12631.  
  12632.  
  12633.   DIPROP_ENABLEREPORTID       = MAKEDIPROP(17);
  12634.  
  12635.  
  12636.   DIPROP_GETPHYSICALRANGE            = MAKEDIPROP(18);
  12637.  
  12638.   DIPROP_GETLOGICALRANGE            = MAKEDIPROP(19);
  12639.  
  12640.  
  12641. type
  12642.   PDIDeviceObjectData = ^TDIDeviceObjectData;
  12643.   TDIDeviceObjectData = packed record
  12644.     dwOfs: DWORD;
  12645.     dwData: DWORD;
  12646.     dwTimeStamp: DWORD;
  12647.     dwSequence: DWORD;
  12648.   end;
  12649.  
  12650. const
  12651.   DIGDD_PEEK = $00000001;
  12652. {
  12653. #define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \
  12654.                          (int) ((dwSequence1) - (dwSequence2))  cmp 0
  12655. }
  12656.  
  12657.   DISCL_EXCLUSIVE  = $00000001;
  12658.   DISCL_NONEXCLUSIVE = $00000002;
  12659.   DISCL_FOREGROUND = $00000004;
  12660.   DISCL_BACKGROUND = $00000008;
  12661.   DISCL_NOWINKEY   = $00000010;
  12662.  
  12663.  
  12664. type
  12665.  
  12666.   PDIDeviceInstance_DX3A = ^TDIDeviceInstance_DX3A;
  12667.   TDIDeviceInstance_DX3A = packed record
  12668.     dwSize: DWORD;
  12669.     guidInstance: TGUID;
  12670.     guidProduct: TGUID;
  12671.     dwDevType: DWORD;
  12672.     tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
  12673.     tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
  12674.   end;
  12675.  
  12676.   PDIDeviceInstance_DX3W = ^TDIDeviceInstance_DX3W;
  12677.   TDIDeviceInstance_DX3W = packed record
  12678.     dwSize: DWORD;
  12679.     guidInstance: TGUID;
  12680.     guidProduct: TGUID;
  12681.     dwDevType: DWORD;
  12682.     tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
  12683.     tszProductName: Array [0..MAX_PATH-1] of WideChar;
  12684.   end;
  12685.  
  12686.   PDIDeviceInstance_DX3 = ^TDIDeviceInstance_DX3;
  12687. {$IFDEF UNICODE}
  12688.   TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3W;
  12689. {$ELSE}
  12690.   TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3A;
  12691. {$ENDIF}
  12692.  
  12693.   PDIDeviceInstance_DX5A = ^TDIDeviceInstance_DX5A;
  12694.   TDIDeviceInstance_DX5A = packed record
  12695.     dwSize: DWORD;
  12696.     guidInstance: TGUID;
  12697.     guidProduct: TGUID;
  12698.     dwDevType: DWORD;
  12699.     tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
  12700.     tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
  12701.     guidFFDriver: TGUID;
  12702.     wUsagePage: WORD;
  12703.     wUsage: WORD;
  12704.   end;
  12705.  
  12706.   PDIDeviceInstance_DX5W = ^TDIDeviceInstance_DX5W;
  12707.   TDIDeviceInstance_DX5W = packed record
  12708.     dwSize: DWORD;
  12709.     guidInstance: TGUID;
  12710.     guidProduct: TGUID;
  12711.     dwDevType: DWORD;
  12712.     tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
  12713.     tszProductName: Array [0..MAX_PATH-1] of WideChar;
  12714.     guidFFDriver: TGUID;
  12715.     wUsagePage: WORD;
  12716.     wUsage: WORD;
  12717.   end;
  12718.  
  12719.   PDIDeviceInstance_DX5 = ^TDIDeviceInstance_DX5;
  12720. {$IFDEF UNICODE}
  12721.   TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5W;
  12722. {$ELSE}
  12723.   TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5A;
  12724. {$ENDIF}
  12725.  
  12726.   PDIDeviceInstanceA = ^TDIDeviceInstanceA;
  12727.   PDIDeviceInstanceW = ^TDIDeviceInstanceW;
  12728.   PDIDeviceInstance = ^TDIDeviceInstance;
  12729. {$IFDEF DIRECTX3}
  12730.   TDIDeviceInstanceA = TDIDeviceInstance_DX3A;
  12731.   TDIDeviceInstanceW = TDIDeviceInstance_DX3W;
  12732.   TDIDeviceInstance = TDIDeviceInstance_DX3;
  12733. {$ELSE}
  12734.   TDIDeviceInstanceA = TDIDeviceInstance_DX5A;
  12735.   TDIDeviceInstanceW = TDIDeviceInstance_DX5W;
  12736.   TDIDeviceInstance = TDIDeviceInstance_DX5;
  12737. {$ENDIF}
  12738.  
  12739.   IDirectInputDeviceA = interface (IUnknown)
  12740.     ['{5944E680-C92E-11CF-BFC7-444553540000}']
  12741.     (*** IDirectInputDeviceA methods ***)
  12742.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
  12743.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackA;
  12744.         pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
  12745.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12746.         HResult;  stdcall;
  12747.     function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader) :
  12748.         HResult;  stdcall;
  12749.     function Acquire : HResult;  stdcall;
  12750.     function Unacquire : HResult;  stdcall;
  12751.     function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
  12752.     function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
  12753.         var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12754.     function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
  12755.     function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
  12756.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12757.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceA; dwObj: DWORD;
  12758.         dwHow: DWORD) : HResult;  stdcall;
  12759.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceA) : HResult;  stdcall;
  12760.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12761.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
  12762.   end;
  12763.  
  12764.   IDirectInputDeviceW = interface (IUnknown)
  12765.     ['{5944E681-C92E-11CF-BFC7-444553540000}']
  12766.     (*** IDirectInputDeviceW methods ***)
  12767.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
  12768.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackW;
  12769.         pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
  12770.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12771.         HResult;  stdcall;
  12772.     function SetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12773.         HResult;  stdcall;
  12774.     function Acquire : HResult;  stdcall;
  12775.     function Unacquire : HResult;  stdcall;
  12776.     function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
  12777.     function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
  12778.         var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12779.     function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
  12780.     function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
  12781.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12782.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceW; dwObj: DWORD;
  12783.         dwHow: DWORD) : HResult;  stdcall;
  12784.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceW) : HResult;  stdcall;
  12785.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12786.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
  12787.   end;
  12788.  
  12789. {$IFDEF UNICODE}
  12790.   IDirectInputDevice = IDirectInputDeviceW;
  12791. {$ELSE}
  12792.   IDirectInputDevice = IDirectInputDeviceA;
  12793. {$ENDIF}
  12794.  
  12795. const
  12796.   DISFFC_RESET            = $00000001;
  12797.   DISFFC_STOPALL          = $00000002;
  12798.   DISFFC_PAUSE            = $00000004;
  12799.   DISFFC_CONTINUE         = $00000008;
  12800.   DISFFC_SETACTUATORSON   = $00000010;
  12801.   DISFFC_SETACTUATORSOFF  = $00000020;
  12802.  
  12803.   DIGFFS_EMPTY            = $00000001;
  12804.   DIGFFS_STOPPED          = $00000002;
  12805.   DIGFFS_PAUSED           = $00000004;
  12806.   DIGFFS_ACTUATORSON      = $00000010;
  12807.   DIGFFS_ACTUATORSOFF     = $00000020;
  12808.   DIGFFS_POWERON          = $00000040;
  12809.   DIGFFS_POWEROFF         = $00000080;
  12810.   DIGFFS_SAFETYSWITCHON   = $00000100;
  12811.   DIGFFS_SAFETYSWITCHOFF  = $00000200;
  12812.   DIGFFS_USERFFSWITCHON   = $00000400;
  12813.   DIGFFS_USERFFSWITCHOFF  = $00000800;
  12814.   DIGFFS_DEVICELOST       = $80000000;
  12815.  
  12816. type
  12817.   PDIEffectInfoA = ^TDIEffectInfoA;
  12818.   TDIEffectInfoA = packed record
  12819.     dwSize : DWORD;
  12820.     guid : TGUID;
  12821.     dwEffType : DWORD;
  12822.     dwStaticParams : DWORD;
  12823.     dwDynamicParams : DWORD;
  12824.     tszName : array [0..MAX_PATH-1] of CHAR;
  12825.   end;
  12826.  
  12827.   PDIEffectInfoW = ^TDIEffectInfoW;
  12828.   TDIEffectInfoW = packed record
  12829.     dwSize : DWORD;
  12830.     guid : TGUID;
  12831.     dwEffType : DWORD;
  12832.     dwStaticParams : DWORD;
  12833.     dwDynamicParams : DWORD;
  12834.     tszName : array [0..MAX_PATH-1] of WCHAR;
  12835.   end;
  12836.  
  12837.   PDIEffectInfo = ^TDIEffectInfo;
  12838. {$IFDEF UNICODE}
  12839.   TDIEffectInfo = TDIEffectInfoW;
  12840. {$ELSE}
  12841.   TDIEffectInfo = TDIEffectInfoA;
  12842. {$ENDIF}
  12843.  
  12844. const
  12845.   DISDD_CONTINUE          = $00000001;
  12846.  
  12847.   // Bug fix & deviation from the SDK: Must return DIENUM_STOP or
  12848.   // DIENUM_CONTINUE (=1) in order to work with the debug version of DINPUT.DLL
  12849. type
  12850.   TDIEnumEffectsCallbackA =
  12851.       function(var pdei: TDIEffectInfoA; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
  12852.   TDIEnumEffectsCallbackW =
  12853.       function(var pdei: TDIEffectInfoW; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
  12854.   TDIEnumEffectsCallback =
  12855.       function(var pdei: TDIEffectInfo; pvRef: pointer) : Integer; stdcall; // BOOL; stdcall;
  12856.   TDIEnumEffectsProc = TDIEnumEffectsCallback;
  12857.  
  12858.   TDIEnumCreatedEffectObjectsCallback =
  12859.       function(peff: IDirectInputEffect; pvRev: pointer): Integer; stdcall; // BOOL; stdcall;
  12860.   TDIEnumCreatedEffectObjectsProc = TDIEnumCreatedEffectObjectsCallback;
  12861.  
  12862.   IDirectInputDevice2A = interface (IDirectInputDeviceA)
  12863.     ['{5944E682-C92E-11CF-BFC7-444553540000}']
  12864.     (*** IDirectInputDevice2A methods ***)
  12865.     function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
  12866.         var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
  12867.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackA;
  12868.         pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
  12869.     function GetEffectInfo(pdei: TDIEffectInfoA; const rguid: TGUID) : HResult;  stdcall;
  12870.     function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
  12871.     function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
  12872.     function EnumCreatedEffectObjects(lpCallback:
  12873.         TDIEnumCreatedEffectObjectsCallback;
  12874.         pvRef: pointer; fl: DWORD) : HResult;  stdcall;
  12875.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12876.     function Poll : HResult;  stdcall;
  12877.     function SendDeviceData
  12878.         (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
  12879.         var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
  12880.   end;
  12881.  
  12882.   IDirectInputDevice2W = interface (IDirectInputDeviceW)
  12883.     ['{5944E683-C92E-11CF-BFC7-444553540000}']
  12884.     (*** IDirectInputDevice2W methods ***)
  12885.     function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
  12886.         var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
  12887.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackW;
  12888.         pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
  12889.     function GetEffectInfo(pdei: TDIEffectInfoW; const rguid: TGUID) : HResult;  stdcall;
  12890.     function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
  12891.     function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
  12892.     function EnumCreatedEffectObjects(lpCallback:
  12893.         TDIEnumCreatedEffectObjectsCallback;
  12894.         pvRef: pointer; fl: DWORD) : HResult;  stdcall;
  12895.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12896.     function Poll : HResult;  stdcall;
  12897.     function SendDeviceData
  12898.         (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
  12899.         var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
  12900.   end;
  12901.  
  12902. {$IFDEF UNICODE}
  12903.   IDirectInputDevice2 = IDirectInputDevice2W;
  12904. {$ELSE}
  12905.   IDirectInputDevice2 = IDirectInputDevice2A;
  12906. {$ENDIF}
  12907.  
  12908. const
  12909.   DIFEF_DEFAULT               = $00000000;
  12910.   DIFEF_INCLUDENONSTANDARD    = $00000001;
  12911.   DIFEF_MODIFYIFNEEDED          = $00000010;
  12912.  
  12913. ///Weitermachen:  (as: nur die Deklarationen eingefüllt, die ich zum Testen gebraucht habe)
  12914.  
  12915. type
  12916.   TEnumEffectsInFileCallback = function(gaga, huhu: Integer): HResult;
  12917.  
  12918. type
  12919.   IDirectInputDevice7W = interface (IDirectInputDevice2W)
  12920.     ['{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}']
  12921.     (*** IDirectInputDevice7A methods ***)
  12922.     function EnumEffectsInFile(const lpszFileName: PChar;
  12923.       pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
  12924.     function WriteEffectToFile(const lpszFileName: PChar;
  12925.       dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
  12926.   end;
  12927.  
  12928.   IDirectInputDevice7A = interface (IDirectInputDevice2A)
  12929.     ['{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}']
  12930.     function EnumEffectsInFile(const lpszFileName: PChar;
  12931.       pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
  12932.     function WriteEffectToFile(const lpszFileName: PChar;
  12933.       dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
  12934.   end;
  12935.  
  12936. {$IFDEF UNICODE}
  12937.   IDirectInputDevice7 = IDirectInputDevice7W;
  12938. {$ELSE}
  12939.   IDirectInputDevice7 = IDirectInputDevice7A;
  12940. {$ENDIF}
  12941.  
  12942. (****************************************************************************
  12943.  *
  12944.  *      Mouse
  12945.  *
  12946.  ****************************************************************************)
  12947.  
  12948. type
  12949.   PDIMouseState = ^TDIMouseState;
  12950.   TDIMouseState = packed record
  12951.     lX: Longint;
  12952.     lY: Longint;
  12953.     lZ: Longint;
  12954.     rgbButtons: Array [0..3] of BYTE;  // up to 4 buttons
  12955.   end;
  12956.  
  12957.   PDIMouseState2 = ^TDIMouseState2;
  12958.   TDIMouseState2 = packed record
  12959.     lX: Longint;
  12960.     lY: Longint;
  12961.     lZ: Longint;
  12962.     rgbButtons: Array [0..7] of BYTE;  // up to 8 buttons
  12963.   end;
  12964.  
  12965. const
  12966.   DIMOFS_X       = 0;
  12967.   DIMOFS_Y       = 4;
  12968.   DIMOFS_Z       = 8;
  12969.   DIMOFS_BUTTON0 = 12;
  12970.   DIMOFS_BUTTON1 = 13;
  12971.   DIMOFS_BUTTON2 = 14;
  12972.   DIMOFS_BUTTON3 = 15;
  12973.   // DX7 supports up to 8 mouse buttons
  12974.   DIMOFS_BUTTON4 = DIMOFS_BUTTON0+4;
  12975.   DIMOFS_BUTTON5 = DIMOFS_BUTTON0+5;
  12976.   DIMOFS_BUTTON6 = DIMOFS_BUTTON0+6;
  12977.   DIMOFS_BUTTON7 = DIMOFS_BUTTON0+7;
  12978.  
  12979.  
  12980. const
  12981.   _c_dfDIMouse_Objects: array[0