Subversion Repositories spacemission

Rev

Rev 1 | Rev 10 | 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.  
  31. Join in order:
  32.   1) DirectDraw
  33.   2) Direct3D
  34.   3) Direct3DRM
  35.   4) DirectInput
  36.   5) DirectPlay
  37.   6) DirectSetup
  38.   7) DirectSound
  39.   8) DirectMusic
  40. }
  41. Unit DirectX;
  42.  
  43. Interface
  44.  
  45. {Delphi version marks}
  46.  
  47. {$I DelphiXcfg.inc}
  48.  
  49. {$MINENUMSIZE 4}
  50. {$ALIGN ON}
  51.  
  52. uses
  53.   Windows, MMSystem;
  54. //DirectDraw file
  55. (*==========================================================================;
  56.  *
  57.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  58.  *
  59.  *  Files:      ddraw.h dvp.h
  60.  *  Content:    DirectDraw and DirectDrawVideoPort include files
  61.  *
  62.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  63.  *
  64.  *  Modified: 10-Sep-2000
  65.  *
  66.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  67.  *  E-Mail: DelphiDirectX@next-reality.com
  68.  *
  69.  *
  70.  ***************************************************************************)
  71.  
  72. var
  73.   DDrawDLL : HMODULE = 0;
  74.  
  75. function DDErrorString(Value: HResult) : string;
  76.  
  77. function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
  78.  
  79. (*
  80.  * FOURCC codes for DX compressed-texture pixel formats
  81.  *)
  82. const
  83.   FOURCC_DXT1 = 'DXT1';
  84.   FOURCC_DXT2 = 'DXT2';
  85.   FOURCC_DXT3 = 'DXT3';
  86.   FOURCC_DXT4 = 'DXT4';
  87.   FOURCC_DXT5 = 'DXT5';
  88.  
  89. (*
  90.  * GUIDS used by DirectDraw objects
  91.  *)
  92. const
  93.   CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}';
  94.   CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}';
  95.   CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}';
  96.  
  97. const
  98.   DD_ROP_SPACE = (256 div 32);       // space required to store ROP array
  99.  
  100.   MAX_DDDEVICEID_STRING = 512;
  101.  
  102. (*
  103.  * Flags for the IDirectDraw4::GetDeviceIdentifier method
  104.  *)
  105.  
  106. (*
  107.  * This flag causes GetDeviceIdentifier to return information about the host (typically 2D) adapter in a system equipped
  108.  * with a stacked secondary 3D adapter. Such an adapter appears to the application as if it were part of the
  109.  * host adapter, but is typically physcially located on a separate card. The stacked secondary's information is
  110.  * returned when GetDeviceIdentifier's dwFlags field is zero, since this most accurately reflects the qualities
  111.  * of the DirectDraw object involved.
  112.  *)
  113.   DDGDI_GETHOSTIDENTIFIER         = $00000001;
  114.  
  115. (*============================================================================
  116.  *
  117.  * DirectDraw Structures
  118.  *
  119.  * Various structures used to invoke DirectDraw.
  120.  *
  121.  *==========================================================================*)
  122.  
  123. var
  124.   NilGUID : TGUID{$IfNDef VER6UP} absolute 0{$EndIf};
  125.  
  126. type
  127.   TRefGUID = packed record
  128.     case integer of
  129.     1: (guid : PGUID);
  130.     2: (dwFlags : DWORD);
  131.   end;
  132.  
  133.   IDirectDraw = interface;
  134.   IDirectDraw2 = interface;
  135.   IDirectDraw4 = interface;
  136.   IDirectDraw7 = interface;
  137.   IDirectDrawSurface = interface;
  138.   IDirectDrawSurface2 = interface;
  139.   IDirectDrawSurface3 = interface;
  140.   IDirectDrawSurface4 = interface;
  141.   IDirectDrawSurface7 = interface;
  142.  
  143.   IDirectDrawPalette = interface;
  144.   IDirectDrawClipper = interface;
  145.   IDirectDrawColorControl = interface;
  146.   IDirectDrawGammaControl = interface;
  147.  
  148. (*
  149.  * Generic pixel format with 8-bit RGB and alpha components
  150.  *)
  151.   PDDARGB = ^TDDARGB;
  152.   TDDARGB = packed record
  153.     blue:     BYTE;
  154.     green:    BYTE;
  155.     red:      BYTE;
  156.     alpha:    BYTE;
  157.   end;
  158.  
  159. (*
  160.  * This version of the structure remains for backwards source compatibility.
  161.  * The DDARGB structure is the one that should be used for all DirectDraw APIs.
  162.  *)
  163.   PDDRGBA = ^TDDRGBA;
  164.   TDDRGBA = packed record
  165.     red   : BYTE;
  166.     green : BYTE;
  167.     blue  : BYTE;
  168.     alpha : BYTE;
  169.   end;
  170.  
  171. (*
  172.  * TDDColorKey
  173.  *)
  174.   PDDColorKey = ^TDDColorKey;
  175.   TDDColorKey = packed record
  176.     dwColorSpaceLowValue: DWORD;   // low boundary of color space that is to
  177.                                    // be treated as Color Key, inclusive
  178.     dwColorSpaceHighValue: DWORD;  // high boundary of color space that is
  179.                                    // to be treated as Color Key, inclusive
  180.   end;
  181.  
  182. // Delphi 5 can't handle interface in variant records
  183. // so we have to use pointers instead (which can be type-casted into interfaces):
  184.  
  185. {$IFDEF VER5UP}
  186.   PDirectDrawSurface = Pointer;              
  187. {$ELSE}
  188.   PDirectDrawSurface = IDirectDrawSurface;
  189. {$ENDIF}
  190.  
  191. (*
  192.  * TDDBltFX
  193.  * Used to pass override information to the DIRECTDRAWSURFACE callback Blt.
  194.  *)
  195.   PDDBltFX = ^TDDBltFX;
  196.   TDDBltFX = packed record
  197.     dwSize                        : DWORD;     // size of structure
  198.     dwDDFX                        : DWORD;     // FX operations
  199.     dwROP                         : DWORD;     // Win32 raster operations
  200.     dwDDROP                       : DWORD;     // Raster operations new for DirectDraw
  201.     dwRotationAngle               : DWORD;     // Rotation angle for blt
  202.     dwZBufferOpCode               : DWORD;     // ZBuffer compares
  203.     dwZBufferLow                  : DWORD;     // Low limit of Z buffer
  204.     dwZBufferHigh                 : DWORD;     // High limit of Z buffer
  205.     dwZBufferBaseDest             : DWORD;     // Destination base value
  206.     dwZDestConstBitDepth          : DWORD;     // Bit depth used to specify Z constant for destination
  207.     case integer of
  208.     0: (
  209.       dwZDestConst                : DWORD      // Constant to use as Z buffer for dest
  210.      );
  211.     1: (
  212.       lpDDSZBufferDest            : PDirectDrawSurface; // Surface to use as Z buffer for dest
  213.       dwZSrcConstBitDepth         : DWORD;     // Bit depth used to specify Z constant for source
  214.       case integer of
  215.       0: (
  216.         dwZSrcConst               : DWORD;     // Constant to use as Z buffer for src
  217.        );
  218.       1: (
  219.         lpDDSZBufferSrc           : PDirectDrawSurface; // Surface to use as Z buffer for src
  220.         dwAlphaEdgeBlendBitDepth  : DWORD;     // Bit depth used to specify constant for alpha edge blend
  221.         dwAlphaEdgeBlend          : DWORD;     // Alpha for edge blending
  222.         dwReserved                : DWORD;
  223.         dwAlphaDestConstBitDepth  : DWORD;     // Bit depth used to specify alpha constant for destination
  224.         case integer of
  225.         0: (
  226.           dwAlphaDestConst        : DWORD;     // Constant to use as Alpha Channel
  227.          );
  228.         1: (
  229.           lpDDSAlphaDest          : PDirectDrawSurface; // Surface to use as Alpha Channel
  230.           dwAlphaSrcConstBitDepth : DWORD;     // Bit depth used to specify alpha constant for source
  231.           case integer of
  232.           0: (
  233.             dwAlphaSrcConst       : DWORD;     // Constant to use as Alpha Channel
  234.           );
  235.           1: (
  236.             lpDDSAlphaSrc         : PDirectDrawSurface; // Surface to use as Alpha Channel
  237.             case integer of
  238.             0: (
  239.               dwFillColor         : DWORD;     // color in RGB or Palettized
  240.             );
  241.             1: (
  242.               dwFillDepth         : DWORD;     // depth value for z-buffer
  243.             );
  244.             2: (
  245.               dwFillPixel         : DWORD;     // pixel value
  246.             );
  247.             3: (
  248.               lpDDSPattern        : PDirectDrawSurface; // Surface to use as pattern
  249.               ddckDestColorkey    : TDDColorKey; // DestColorkey override
  250.               ddckSrcColorkey     : TDDColorKey; // SrcColorkey override
  251.             )
  252.         )
  253.       )
  254.     )
  255.   )
  256.   end;
  257.  
  258. (*
  259.  * TDDSCaps
  260.  *)
  261.   PDDSCaps = ^TDDSCaps;
  262.   TDDSCaps = packed record
  263.     dwCaps: DWORD;         // capabilities of surface wanted
  264.   end;
  265.  
  266. (*
  267.  * TDDOSCaps
  268.  *)
  269.   PDDOSCaps = ^TDDOSCaps;
  270.   TDDOSCaps = packed record
  271.     dwCaps: DWORD;         // capabilities of surface wanted
  272.   end;
  273.  
  274. (*
  275.  * This structure is used internally by DirectDraw.
  276.  *)
  277.   PDDSCapsEx = ^TDDSCapsEx;
  278.   TDDSCapsEx = packed record
  279.     dwCaps2 : DWORD;
  280.     dwCaps3 : DWORD;
  281.     dwCaps4 : DWORD;
  282.   end;
  283.  
  284. (*
  285.  * TDDSCaps2
  286.  *)
  287.   PDDSCaps2 = ^TDDSCaps2;
  288.   TDDSCaps2 = packed record
  289.     dwCaps: DWORD;         // capabilities of surface wanted
  290.     dwCaps2 : DWORD;
  291.     dwCaps3 : DWORD;
  292.     dwCaps4 : DWORD;
  293.   end;
  294.  
  295. (*
  296.  * TDDCaps
  297.  *)
  298. (*
  299.  * This structure is the TDDCaps structure as it was in version 2 and 3 of Direct X.
  300.  * It is present for back compatability.
  301.  *)
  302.   PDDCaps_DX3 = ^TDDCaps_DX3;
  303.   TDDCaps_DX3 = packed record
  304.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  305.     dwCaps: DWORD;                 // driver specific capabilities
  306.     dwCaps2: DWORD;                // more driver specific capabilites
  307.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  308.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  309.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  310.     dwPalCaps: DWORD;              // palette capabilities
  311.     dwSVCaps: DWORD;               // stereo vision capabilities
  312.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  313.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  314.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  315.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  316.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  317.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  318.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  319.     dwVidMemTotal: DWORD;          // total amount of video memory
  320.     dwVidMemFree: DWORD;           // amount of free video memory
  321.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  322.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  323.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  324.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  325.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  326.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  327.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  328.     dwAlignStrideAlign: DWORD;     // stride alignment
  329.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  330.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  331.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  332.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  333.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  334.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  335.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  336.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  337.     dwReserved1: DWORD;            // reserved
  338.     dwReserved2: DWORD;            // reserved
  339.     dwReserved3: DWORD;            // reserved
  340.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  341.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  342.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  343.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  344.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  345.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  346.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  347.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  348.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  349.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  350.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  351.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  352.     dwReserved4 : DWORD;
  353.     dwReserved5 : DWORD;
  354.     dwReserved6 : DWORD;
  355.   end;
  356.  
  357. (*
  358.  * This structure is the TDDCaps structure as it was in version 5 of Direct X.
  359.  * It is present for back compatability.
  360.  *)
  361.   PDDCaps_DX5 = ^TDDCaps_DX5;
  362.   TDDCaps_DX5 = packed record
  363.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  364.     dwCaps: DWORD;                 // driver specific capabilities
  365.     dwCaps2: DWORD;                // more driver specific capabilites
  366.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  367.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  368.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  369.     dwPalCaps: DWORD;              // palette capabilities
  370.     dwSVCaps: DWORD;               // stereo vision capabilities
  371.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  372.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  373.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  374.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  375.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  376.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  377.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  378.     dwVidMemTotal: DWORD;          // total amount of video memory
  379.     dwVidMemFree: DWORD;           // amount of free video memory
  380.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  381.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  382.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  383.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  384.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  385.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  386.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  387.     dwAlignStrideAlign: DWORD;     // stride alignment
  388.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  389.     ddsCaps: TDDSCaps;             // TDDSCaps structure has all the general capabilities
  390.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  391.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  392.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  393.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  394.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  395.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  396.     dwReserved1: DWORD;            // reserved
  397.     dwReserved2: DWORD;            // reserved
  398.     dwReserved3: DWORD;            // reserved
  399.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  400.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  401.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  402.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  403.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  404.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  405.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  406.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  407.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  408.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  409.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  410.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  411.     // Members added for DX5:
  412.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  413.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  414.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  415.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  416.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  417.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  418.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  419.     dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  420.   end;
  421.  
  422.   PDDCaps_DX6 = ^TDDCaps_DX6;
  423.   TDDCaps_DX6 = packed record
  424.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  425.     dwCaps: DWORD;                 // driver specific capabilities
  426.     dwCaps2: DWORD;                // more driver specific capabilites
  427.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  428.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  429.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  430.     dwPalCaps: DWORD;              // palette capabilities
  431.     dwSVCaps: DWORD;               // stereo vision capabilities
  432.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  433.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  434.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  435.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  436.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  437.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  438.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  439.     dwVidMemTotal: DWORD;          // total amount of video memory
  440.     dwVidMemFree: DWORD;           // amount of free video memory
  441.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  442.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  443.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  444.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  445.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  446.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  447.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  448.     dwAlignStrideAlign: DWORD;     // stride alignment
  449.     dwRops: Array [0..DD_ROP_SPACE-1] of DWORD;   // ROPS supported
  450.     ddsOldCaps: TDDSCaps;          // Was dssCaps: TDDSCaps. ddsCaps is of type TDDScaps2 for DX6
  451.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  452.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  453.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  454.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  455.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  456.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  457.     dwReserved1: DWORD;            // reserved
  458.     dwReserved2: DWORD;            // reserved
  459.     dwReserved3: DWORD;            // reserved
  460.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  461.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  462.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  463.     dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts
  464.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  465.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  466.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  467.     dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts
  468.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  469.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  470.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  471.     dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts
  472.     // Members added for DX5:
  473.     dwMaxVideoPorts: DWORD;        // maximum number of usable video ports
  474.     dwCurrVideoPorts: DWORD;       // current number of video ports used
  475.     dwSVBCaps2: DWORD;             // more driver specific capabilities for System->Vmem blts
  476.     dwNLVBCaps: DWORD;             // driver specific capabilities for non-local->local vidmem blts
  477.     dwNLVBCaps2: DWORD;            // more driver specific capabilities non-local->local vidmem blts
  478.     dwNLVBCKeyCaps: DWORD;         // driver color key capabilities for non-local->local vidmem blts
  479.     dwNLVBFXCaps: DWORD;           // driver FX capabilities for non-local->local blts
  480.     dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts
  481.     // Members added for DX6 release
  482.     ddsCaps : TDDSCaps2 ;          // Surface Caps
  483.   end;
  484.  
  485.   TDDCaps_DX7 = TDDCaps_DX6;
  486.  
  487.   PDDCaps = ^TDDCaps;
  488.  
  489. {$IFDEF DIRECTX3}
  490.   TDDCaps = TDDCaps_DX3;
  491. {$ELSE}
  492.   {$IFDEF DIRECTX5}
  493.     TDDCaps = TDDCaps_DX5;
  494.   {$ELSE}
  495.     {$IFDEF DIRECTX6}
  496.       TDDCaps = TDDCaps_DX6;
  497.     {$ELSE}
  498.       TDDCaps = TDDCaps_DX7;
  499.     {$ENDIF}
  500.   {$ENDIF}
  501. {$ENDIF}
  502.  
  503.  
  504.  
  505.  
  506. (*
  507.  * TDDPixelFormat
  508.  *)
  509.   PDDPixelFormat_DX5 = ^TDDPixelFormat_DX5;
  510.   TDDPixelFormat_DX5 = packed record
  511.     dwSize: DWORD;                 // size of structure
  512.     dwFlags: DWORD;                // pixel format flags
  513.     dwFourCC: DWORD;               // (FOURCC code)
  514.     case Integer of
  515.     0: (
  516.       dwZBufferBitDepth: DWORD;      // how many bits for z buffers
  517.      );
  518.     1: (
  519.       dwAlphaBitDepth: DWORD;        // how many bits for alpha channels
  520.      );
  521.     2: (
  522.       dwRGBBitCount: DWORD;          // how many bits per pixel
  523.       dwRBitMask: DWORD;             // mask for red bit
  524.       dwGBitMask: DWORD;             // mask for green bits
  525.       dwBBitMask: DWORD;             // mask for blue bits
  526.       dwRGBAlphaBitMask: DWORD;      // mask for alpha channel
  527.      );
  528.     3: (
  529.       dwYUVBitCount: DWORD;          // how many bits per pixel
  530.       dwYBitMask: DWORD;             // mask for Y bits
  531.       dwUBitMask: DWORD;             // mask for U bits
  532.       dwVBitMask: DWORD;             // mask for V bits
  533.       case Integer of
  534.       0: (
  535.         dwYUVAlphaBitMask: DWORD;      // mask for alpha channel
  536.        );
  537.       1: (
  538.         dwRGBZBitMask: DWORD;
  539.        );
  540.       2: (
  541.         dwYUVZBitMask: DWORD;
  542.        );
  543.      );
  544.   end;
  545.  
  546.   PDDPixelFormat_DX6 = ^TDDPixelFormat_DX6;
  547.   TDDPixelFormat_DX6 = packed record
  548.     dwSize: DWORD;                 // size of structure
  549.     dwFlags: DWORD;                // pixel format flags
  550.     dwFourCC: DWORD;               // (FOURCC code)
  551.     case Integer of
  552.       1: (
  553.           dwRGBBitCount : DWORD;  // how many bits per pixel
  554.           dwRBitMask : DWORD;  // mask for red bit
  555.           dwGBitMask : DWORD;  // mask for green bits
  556.           dwBBitMask : DWORD;  // mask for blue bits
  557.           dwRGBAlphaBitMask : DWORD; // mask for alpha channel
  558.           );
  559.       2: (
  560.           dwYUVBitCount : DWORD;  // how many bits per pixel
  561.           dwYBitMask : DWORD;  // mask for Y bits
  562.           dwUBitMask : DWORD;  // mask for U bits
  563.           dwVBitMask : DWORD;  // mask for V bits
  564.           dwYUVAlphaBitMask : DWORD; // mask for alpha channel
  565.           );
  566.       3: (
  567.           dwZBufferBitDepth : DWORD; // how many total bits/pixel in z buffer (including any stencil bits)
  568.           dwStencilBitDepth : DWORD; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)
  569.           dwZBitMask : DWORD;  // mask for Z bits
  570.           dwStencilBitMask : DWORD; // mask for stencil bits
  571.           dwLuminanceAlphaBitMask : DWORD;// mask for alpha channel
  572.           );
  573.       4: (
  574.           dwAlphaBitDepth : DWORD; // how many bits for alpha channels
  575.           dwLuminanceBitMask : DWORD; // mask for luminance bits
  576.           dwBumpDvBitMask : DWORD;        // mask for bump map V delta bits
  577.           dwBumpLuminanceBitMask : DWORD; // mask for luminance in bump map
  578.           dwRGBZBitMask : DWORD;  // mask for Z channel
  579.           );
  580.       5: (
  581.            dwLuminanceBitCount : DWORD; // how many bits per pixel
  582.            dwBumpDuBitMask : DWORD;       // mask for bump map U delta bits
  583.            Fill1, Fill2    : DWORD;
  584.            dwYUVZBitMask   : DWORD;  // mask for Z channel
  585.          );
  586.       6: ( dwBumpBitCount  : DWORD;         // how many bits per "buxel", total
  587.          );
  588.   end;
  589.  
  590.   TDDPixelFormat_DX3 = TDDPixelFormat_DX5;
  591.   TDDPixelFormat_DX7 = TDDPixelFormat_DX6;
  592.  
  593.   PDDPixelFormat = ^TDDPixelFormat;
  594. {$IFDEF DIRECTX3}
  595.   TDDPixelFormat = TDDPixelFormat_DX3;
  596. {$ELSE}
  597.   {$IFDEF DIRECTX5}
  598.     TDDPixelFormat = TDDPixelFormat_DX5;
  599.   {$ELSE}
  600.     {$IFDEF DIRECTX6}
  601.       TDDPixelFormat = TDDPixelFormat_DX6;
  602.     {$ELSE}
  603.       TDDPixelFormat = TDDPixelFormat_DX7;
  604.     {$ENDIF}
  605.   {$ENDIF}
  606. {$ENDIF}
  607.  
  608. (*
  609.  * TDDOverlayFX
  610.  *)
  611.   PDDOverlayFX = ^TDDOverlayFX;
  612.   TDDOverlayFX = packed record
  613.     dwSize: DWORD;                         // size of structure
  614.     dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
  615.     dwAlphaEdgeBlend: DWORD;               // Constant to use as alpha for edge blend
  616.     dwReserved: DWORD;
  617.     dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
  618.     case Integer of
  619.     0: (
  620.       dwAlphaDestConst: DWORD;               // Constant to use as alpha channel for dest
  621.       dwAlphaSrcConstBitDepth: DWORD;        // Bit depth used to specify alpha constant for source
  622.       dwAlphaSrcConst: DWORD;                // Constant to use as alpha channel for src
  623.       dckDestColorkey: TDDColorKey;                // DestColorkey override
  624.       dckSrcColorkey: TDDColorKey;                 // DestColorkey override
  625.       dwDDFX: DWORD;                         // Overlay FX
  626.       dwFlags: DWORD;                        // flags
  627.      );
  628.     1: (
  629.       lpDDSAlphaDest: PDirectDrawSurface;     // Surface to use as alpha channel for dest
  630.       filler: DWORD;
  631.       lpDDSAlphaSrc: PDirectDrawSurface;      // Surface to use as alpha channel for src
  632.      );
  633.   end;
  634.  
  635. (*
  636.  * TDDBltBatch: BltBatch entry structure
  637.  *)
  638.   PDDBltBatch = ^TDDBltBatch;
  639.   TDDBltBatch = packed record
  640.     lprDest: PRect;
  641.     lpDDSSrc: IDirectDrawSurface;
  642.     lprSrc: PRect;
  643.     dwFlags: DWORD;
  644.     lpDDBltFx: TDDBltFX;
  645.   end;
  646.  
  647. (*
  648.  * TDDGammaRamp
  649.  *)
  650.   PDDGammaRamp = ^TDDGammaRamp;
  651.   TDDGammaRamp = packed record
  652.     red   : array[0..255] of WORD;
  653.     green : array[0..255] of WORD;
  654.     blue  : array[0..255] of WORD;
  655.   end;
  656.  
  657. (*
  658.  *  This is the structure within which DirectDraw returns data about the current graphics driver and chipset
  659.  *)
  660.  
  661.   PDDDeviceIdentifier = ^TDDDeviceIdentifier;
  662.   TDDDeviceIdentifier = packed record
  663.     //
  664.     // These elements are for presentation to the user only. They should not be used to identify particular
  665.     // drivers, since this is unreliable and many different strings may be associated with the same
  666.     // device, and the same driver from different vendors.
  667.     //
  668.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  669.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  670.  
  671.     //
  672.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  673.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  674.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  675.     //
  676.     // This version has the form:
  677.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  678.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  679.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  680.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  681.     //
  682.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  683.  
  684.     //
  685.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  686.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  687.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  688.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  689.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  690.     //
  691.     dwVendorId: DWORD;
  692.     dwDeviceId: DWORD;
  693.     dwSubSysId: DWORD;
  694.     dwRevision: DWORD;
  695.  
  696.     //
  697.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  698.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  699.     // reprofile the graphics subsystem.
  700.     // This element can also be used to identify particular problematic drivers.
  701.     //
  702.     guidDeviceIdentifier: TGUID;
  703.   end;
  704.  
  705.   PDDDeviceIdentifier2 = ^TDDDeviceIdentifier2;
  706.   TDDDeviceIdentifier2 = packed record
  707.     //
  708.     // These elements are for presentation to the user only. They should not be used to identify particular
  709.     // drivers, since this is unreliable and many different strings may be associated with the same
  710.     // device, and the same driver from different vendors.
  711.     //
  712.     szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  713.     szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
  714.  
  715.     //
  716.     // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
  717.     // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
  718.     // drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
  719.     //
  720.     // This version has the form:
  721.     //  wProduct = HIWORD(liDriverVersion.HighPart)
  722.     //  wVersion = LOWORD(liDriverVersion.HighPart)
  723.     //  wSubVersion = HIWORD(liDriverVersion.LowPart)
  724.     //  wBuild = LOWORD(liDriverVersion.LowPart)
  725.     //
  726.     liDriverVersion: TLargeInteger;     // Defined for applications and other 32 bit components
  727.  
  728.     //
  729.     // These elements can be used to identify particular chipsets. Use with extreme caution.
  730.     //   dwVendorId     Identifies the manufacturer. May be zero if unknown.
  731.     //   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
  732.     //   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
  733.     //   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
  734.     //
  735.     dwVendorId: DWORD;
  736.     dwDeviceId: DWORD;
  737.     dwSubSysId: DWORD;
  738.     dwRevision: DWORD;
  739.  
  740.     //
  741.     // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
  742.     // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
  743.     // reprofile the graphics subsystem.
  744.     // This element can also be used to identify particular problematic drivers.
  745.     //
  746.     guidDeviceIdentifier: TGUID;
  747.  
  748.     (*
  749.      * This element is used to determine the Windows Hardware Quality Lab (WHQL)
  750.      * certification level for this driver/device pair.
  751.      *)
  752.     dwWHQLLevel: DWORD;
  753.   end;
  754.  
  755. (*
  756.  * callbacks
  757.  *)
  758.   TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND;
  759.       Code: DWORD; lpContext: Pointer): HResult; stdcall;
  760.   TSurfacesStreamingCallback = function(Arg: DWORD): HResult; stdcall;
  761.  
  762. (*
  763.  * TDDSurfaceDesc
  764.  *)
  765.   PDDSurfaceDesc_DX5 = ^TDDSurfaceDesc_DX5;
  766.   TDDSurfaceDesc_DX5 = packed record
  767.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  768.     dwFlags: DWORD;                // determines what fields are valid
  769.     dwHeight: DWORD;               // height of surface to be created
  770.     dwWidth: DWORD;                // width of input surface
  771.     case Integer of
  772.     0: (
  773.       dwLinearSize : DWORD;       // unused at the moment
  774.      );
  775.     1: (
  776.       lPitch: LongInt;                 // distance to start of next line (return value only)
  777.       dwBackBufferCount: DWORD;      // number of back buffers requested
  778.       case Integer of
  779.       0: (
  780.         dwMipMapCount: DWORD;          // number of mip-map levels requested
  781.         dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  782.         dwReserved: DWORD;             // reserved
  783.         lpSurface: Pointer;              // pointer to the associated surface memory
  784.         ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
  785.         ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
  786.         ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
  787.         ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
  788.         ddpfPixelFormat: TDDPixelFormat_DX5; // pixel format description of the surface
  789.         ddsCaps: TDDSCaps;                // direct draw surface capabilities
  790.        );
  791.       1: (
  792.         dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
  793.        );
  794.       2: (
  795.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  796.        );
  797.      );
  798.   end;
  799.  
  800.   PDDSurfaceDesc_DX6 = ^TDDSurfaceDesc_DX6;
  801.   TDDSurfaceDesc_DX6 = packed record
  802.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  803.     dwFlags: DWORD;                // determines what fields are valid
  804.     dwHeight: DWORD;               // height of surface to be created
  805.     dwWidth: DWORD;                // width of input surface
  806.     case Integer of
  807.     0: (
  808.       dwLinearSize : DWORD;       // unused at the moment
  809.      );
  810.     1: (
  811.       lPitch: LongInt;                 // distance to start of next line (return value only)
  812.       dwBackBufferCount: DWORD;      // number of back buffers requested
  813.       case Integer of
  814.       0: (
  815.         dwMipMapCount: DWORD;          // number of mip-map levels requested
  816.         dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  817.         dwReserved: DWORD;             // reserved
  818.         lpSurface: Pointer;              // pointer to the associated surface memory
  819.         ddckCKDestOverlay: TDDColorKey;      // color key for destination overlay use
  820.         ddckCKDestBlt: TDDColorKey;          // color key for destination blt use
  821.         ddckCKSrcOverlay: TDDColorKey;       // color key for source overlay use
  822.         ddckCKSrcBlt: TDDColorKey;           // color key for source blt use
  823.         ddpfPixelFormat: TDDPixelFormat_DX6; // pixel format description of the surface
  824.         ddsCaps: TDDSCaps;                // direct draw surface capabilities
  825.        );
  826.       1: (
  827.         dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
  828.        );
  829.       2: (
  830.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  831.        );
  832.      );
  833.   end;
  834.  
  835.   PDDSurfaceDesc = ^TDDSurfaceDesc;
  836. {$IFDEF DIRECTX5}
  837.   TDDSurfaceDesc = TDDSurfaceDesc_DX5;
  838. {$ELSE}
  839.   TDDSurfaceDesc = TDDSurfaceDesc_DX6;
  840. {$ENDIF}
  841.  
  842.  
  843. (*
  844.  * TDDSurfaceDesc2
  845.  *)
  846.   PDDSurfaceDesc2 = ^TDDSurfaceDesc2;
  847.   TDDSurfaceDesc2 = packed record
  848.     dwSize: DWORD;                 // size of the TDDSurfaceDesc structure
  849.     dwFlags: DWORD;                // determines what fields are valid
  850.     dwHeight: DWORD;               // height of surface to be created
  851.     dwWidth: DWORD;                // width of input surface
  852.     case Integer of
  853.     0: (
  854.       lPitch : LongInt;                  // distance to start of next line (return value only)
  855.      );
  856.     1: (
  857.       dwLinearSize : DWORD;              // Formless late-allocated optimized surface size
  858.       dwBackBufferCount: DWORD;          // number of back buffers requested
  859.       case Integer of
  860.       0: (
  861.         dwMipMapCount: DWORD;            // number of mip-map levels requested
  862.         dwAlphaBitDepth: DWORD;          // depth of alpha buffer requested
  863.         dwReserved: DWORD;               // reserved
  864.         lpSurface: Pointer;              // pointer to the associated surface memory
  865.         ddckCKDestOverlay: TDDColorKey;  // color key for destination overlay use
  866.         ddckCKDestBlt: TDDColorKey;      // color key for destination blt use
  867.         ddckCKSrcOverlay: TDDColorKey;   // color key for source overlay use
  868.         ddckCKSrcBlt: TDDColorKey;       // color key for source blt use
  869.         ddpfPixelFormat: TDDPixelFormat; // pixel format description of the surface
  870.         ddsCaps: TDDSCaps2;              // direct draw surface capabilities
  871.         dwTextureStage: DWORD;           // stage in multitexture cascade
  872.        );
  873.       1: (
  874.         dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  875.        );
  876.      );
  877.   end;
  878.  
  879. (*
  880.  * TDDOptSurfaceDesc
  881.  *)
  882.  
  883.   PDDOptSurfaceDesc = ^TDDOptSurfaceDesc;
  884.   TDDOptSurfaceDesc = packed record
  885.     dwSize : DWORD;             // size of the DDOPTSURFACEDESC structure
  886.     dwFlags : DWORD;            // determines what fields are valid
  887.     ddSCaps : TDDSCaps2;        // Common caps like: Memory type
  888.     ddOSCaps : TDDOSCaps;       // Common caps like: Memory type
  889.     guid : TGUID;               // Compression technique GUID
  890.     dwCompressionRatio : DWORD; // Compression ratio
  891.   end;
  892.  
  893. (*
  894.  * DDCOLORCONTROL
  895.  *)
  896.   PDDColorControl = ^TDDColorControl;
  897.   TDDColorControl = packed record
  898.     dwSize: DWORD;
  899.     dwFlags: DWORD;
  900.     lBrightness: LongInt;
  901.     lContrast: LongInt;
  902.     lHue: LongInt;
  903.     lSaturation: LongInt;
  904.     lSharpness: LongInt;
  905.     lGamma: LongInt;
  906.     lColorEnable: LongInt;
  907.     dwReserved1: DWORD;
  908.   end;
  909.  
  910. (*
  911.  * callbacks
  912.  *)
  913.  
  914. {$IFNDEF WINNT}
  915.   TDDEnumModesCallback = function (const lpDDSurfaceDesc: TDDSurfaceDesc;
  916.       lpContext: Pointer) : HResult; stdcall;
  917.   TDDEnumModesCallback2 = function (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  918.       lpContext: Pointer) : HResult; stdcall;
  919.   TDDEnumSurfacesCallback = function (lpDDSurface: IDirectDrawSurface;
  920.       const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer) : HResult; stdcall;
  921.   TDDEnumSurfacesCallback2 = function (lpDDSurface: IDirectDrawSurface4;
  922.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
  923.   TDDEnumSurfacesCallback7 = function (lpDDSurface: IDirectDrawSurface7;
  924.       const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer) : HResult; stdcall;
  925. {$ENDIF}
  926.  
  927. (*
  928.  * INTERACES FOLLOW:
  929.  *      IDirectDraw
  930.  *      IDirectDrawClipper
  931.  *      IDirectDrawPalette
  932.  *      IDirectDrawSurface
  933.  *)
  934.  
  935. (*
  936.  * IDirectDraw
  937.  *)
  938.  
  939.   IDirectDraw = interface (IUnknown)
  940.     ['{6C14DB80-A733-11CE-A521-0020AF0BE560}']
  941.     (*** IDirectDraw methods ***)
  942.     function Compact: HResult; stdcall;
  943.     function CreateClipper (dwFlags: DWORD;
  944.         out lplpDDClipper: IDirectDrawClipper;
  945.         pUnkOuter: IUnknown) : HResult; stdcall;
  946.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  947.         out lplpDDPalette: IDirectDrawPalette;
  948.         pUnkOuter: IUnknown) : HResult; stdcall;
  949.     function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
  950.         out lplpDDSurface: IDirectDrawSurface;
  951.         pUnkOuter: IUnknown) : HResult; stdcall;
  952.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
  953.         out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
  954.     function EnumDisplayModes (dwFlags: DWORD;
  955.         lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
  956.         lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
  957.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc;
  958.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
  959.         HResult; stdcall;
  960.     function FlipToGDISurface: HResult; stdcall;
  961.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  962.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  963.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  964.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) :
  965.         HResult; stdcall;
  966.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  967.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  968.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  969.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  970.     function RestoreDisplayMode: HResult; stdcall;
  971.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  972.     (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  973.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD;
  974.         dwBpp: DWORD) : HResult; stdcall;
  975.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  976.         HResult; stdcall;
  977.   end;
  978.  
  979.   IDirectDraw2 = interface (IUnknown)
  980.     ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}']
  981.     (*** IDirectDraw methods ***)
  982.     function Compact: HResult; stdcall;
  983.     function CreateClipper (dwFlags: DWORD;
  984.         out lplpDDClipper: IDirectDrawClipper;
  985.         pUnkOuter: IUnknown) : HResult; stdcall;
  986.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  987.         out lplpDDPalette: IDirectDrawPalette;
  988.         pUnkOuter: IUnknown) : HResult; stdcall;
  989.     function CreateSurface (var lpDDSurfaceDesc: TDDSurfaceDesc;
  990.         out lplpDDSurface: IDirectDrawSurface;
  991.         pUnkOuter: IUnknown) : HResult; stdcall;
  992.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface;
  993.         out lplpDupDDSurface: IDirectDrawSurface) : HResult; stdcall;
  994.     function EnumDisplayModes (dwFlags: DWORD;
  995.         lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer;
  996.         lpEnumModesCallback: TDDEnumModesCallback) : HResult; stdcall;
  997.     function EnumSurfaces (dwFlags: DWORD; var lpDDSD: TDDSurfaceDesc;
  998.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) :
  999.         HResult; stdcall;
  1000.     function FlipToGDISurface: HResult; stdcall;
  1001.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1002.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1003.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1004.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface) : HResult; stdcall;
  1005.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1006.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1007.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1008.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1009.     function RestoreDisplayMode: HResult; stdcall;
  1010.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1011. (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  1012.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1013.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1014.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1015.         HResult; stdcall;
  1016.     (*** Added in the v2 interface ***)
  1017.     function GetAvailableVidMem (var lpDDSCaps: TDDSCaps;
  1018.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1019.   end;
  1020.  
  1021.   IDirectDraw4 = interface (IUnknown)
  1022.     ['{9c59509a-39bd-11d1-8c4a-00c04fd930c5}']
  1023.     (*** IDirectDraw methods ***)
  1024.     function Compact: HResult; stdcall;
  1025.     function CreateClipper (dwFlags: DWORD;
  1026.         out lplpDDClipper: IDirectDrawClipper;
  1027.         pUnkOuter: IUnknown) : HResult; stdcall;
  1028.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  1029.         out lplpDDPalette: IDirectDrawPalette;
  1030.         pUnkOuter: IUnknown) : HResult; stdcall;
  1031.     function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1032.         out lplpDDSurface: IDirectDrawSurface4;
  1033.         pUnkOuter: IUnknown) : HResult; stdcall;
  1034.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface4;
  1035.         out lplpDupDDSurface: IDirectDrawSurface4) : HResult; stdcall;
  1036.     function EnumDisplayModes (dwFlags: DWORD;
  1037.         lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
  1038.         lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
  1039.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1040.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback2) :
  1041.         HResult; stdcall;
  1042.     function FlipToGDISurface: HResult; stdcall;
  1043.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1044.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1045.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1046.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface4) :
  1047.         HResult; stdcall;
  1048.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1049.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1050.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1051.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1052.     function RestoreDisplayMode: HResult; stdcall;
  1053.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1054. (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  1055.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1056.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1057.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1058.         HResult; stdcall;
  1059.     (*** Added in the v2 interface ***)
  1060.     function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
  1061.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1062.     (*** Added in the V4 Interface ***)
  1063.     function GetSurfaceFromDC (hdc : Windows.HDC;
  1064.         out lpDDS4: IDirectDrawSurface4) : HResult; stdcall;
  1065.     function RestoreAllSurfaces : HResult; stdcall;
  1066.     function TestCooperativeLevel : HResult; stdcall;
  1067.     function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier;
  1068.         dwFlags: DWORD) : HResult; stdcall;
  1069.   end;
  1070.  
  1071.   IDirectDraw7 = interface (IUnknown)
  1072.     ['{15e65ec0-3b9c-11d2-b92f-00609797ea5b}']
  1073.     (*** IDirectDraw methods ***)
  1074.     function Compact: HResult; stdcall;
  1075.     function CreateClipper (dwFlags: DWORD;
  1076.         out lplpDDClipper: IDirectDrawClipper;
  1077.         pUnkOuter: IUnknown) : HResult; stdcall;
  1078.     function CreatePalette (dwFlags: DWORD; lpColorTable: pointer;
  1079.         out lplpDDPalette: IDirectDrawPalette;
  1080.         pUnkOuter: IUnknown) : HResult; stdcall;
  1081.     function CreateSurface (const lpDDSurfaceDesc: TDDSurfaceDesc2;
  1082.         out lplpDDSurface: IDirectDrawSurface7;
  1083.         pUnkOuter: IUnknown) : HResult; stdcall;
  1084.     function DuplicateSurface (lpDDSurface: IDirectDrawSurface7;
  1085.         out lplpDupDDSurface: IDirectDrawSurface7) : HResult; stdcall;
  1086.     function EnumDisplayModes (dwFlags: DWORD;
  1087.         lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer;
  1088.         lpEnumModesCallback: TDDEnumModesCallback2) : HResult; stdcall;
  1089.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2;
  1090.         lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback7) :
  1091.         HResult; stdcall;
  1092.     function FlipToGDISurface: HResult; stdcall;
  1093.     function GetCaps (lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps) : HResult; stdcall;
  1094.     function GetDisplayMode (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1095.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: PDWORD) : HResult; stdcall;
  1096.     function GetGDISurface (out lplpGDIDDSSurface: IDirectDrawSurface7) :
  1097.         HResult; stdcall;
  1098.     function GetMonitorFrequency (out lpdwFrequency: DWORD) : HResult; stdcall;
  1099.     function GetScanLine (out lpdwScanLine: DWORD) : HResult; stdcall;
  1100.     function GetVerticalBlankStatus (out lpbIsInVB: BOOL) : HResult; stdcall;
  1101.     function Initialize (lpGUID: PGUID) : HResult; stdcall;
  1102.     function RestoreDisplayMode: HResult; stdcall;
  1103.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD) : HResult; stdcall;
  1104.     function SetDisplayMode (dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD;
  1105.         dwRefreshRate: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1106.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle) :
  1107.         HResult; stdcall;
  1108.     (*** Added in the v2 interface ***)
  1109.     function GetAvailableVidMem (const lpDDSCaps: TDDSCaps2;
  1110.         out lpdwTotal, lpdwFree: DWORD) : HResult; stdcall;
  1111.     (*** Added in the V4 Interface ***)
  1112.     function GetSurfaceFromDC (hdc : Windows.HDC;
  1113.         out lpDDS: IDirectDrawSurface7) : HResult; stdcall;
  1114.     function RestoreAllSurfaces : HResult; stdcall;
  1115.     function TestCooperativeLevel : HResult; stdcall;
  1116.     function GetDeviceIdentifier (out lpdddi: TDDDeviceIdentifier2;
  1117.         dwFlags: DWORD) : HResult; stdcall;
  1118.     function StartModeTest(const lpModesToTest; dwNumEntries, dwFlags: DWORD) : HResult; stdcall;
  1119.     function EvaluateMode(dwFlags: DWORD; out pSecondsUntilTimeout: DWORD) : HResult; stdcall;
  1120.   end;
  1121.  
  1122.  
  1123.  
  1124. (*
  1125.  * IDirectDrawPalette
  1126.  *)
  1127.  
  1128.   IDirectDrawPalette = interface (IUnknown)
  1129.     ['{6C14DB84-A733-11CE-A521-0020AF0BE560}']
  1130.     (*** IDirectDrawPalette methods ***)
  1131.     function GetCaps (out lpdwCaps: DWORD) : HResult; stdcall;
  1132.     function GetEntries (dwFlags: DWORD; dwBase: DWORD; dwNumEntries: DWORD;
  1133.         lpEntries: pointer) : HResult; stdcall;
  1134.     function Initialize (lpDD: IDirectDraw; dwFlags: DWORD;
  1135.         lpDDColorTable: pointer) : HResult; stdcall;
  1136.     function SetEntries (dwFlags: DWORD; dwStartingEntry: DWORD;
  1137.         dwCount: DWORD; lpEntries: pointer) : HResult; stdcall;
  1138.   end;
  1139.  
  1140. (*
  1141.  * IDirectDrawClipper
  1142.  *)
  1143.  
  1144.   IDirectDrawClipper = interface (IUnknown)
  1145.     ['{6C14DB85-A733-11CE-A521-0020AF0BE560}']
  1146.     (*** IDirectDrawClipper methods ***)
  1147.     function GetClipList (lpRect: PRect; lpClipList: PRgnData;
  1148.         var lpdwSize: DWORD) : HResult; stdcall;
  1149.     function GetHWnd (out lphWnd: HWND) : HResult; stdcall;
  1150.     function Initialize (lpDD: IDirectDraw; dwFlags: DWORD) : HResult; stdcall;
  1151.     function IsClipListChanged (out lpbChanged: BOOL) : HResult; stdcall;
  1152.     function SetClipList (lpClipList: PRgnData; dwFlags: DWORD) : HResult; stdcall;
  1153.     function SetHWnd (dwFlags: DWORD; hWnd: HWND) : HResult; stdcall;
  1154.   end;
  1155.  
  1156. (*
  1157.  * IDirectDrawSurface and related interfaces
  1158.  *)
  1159.  
  1160.   IDirectDrawSurface = interface (IUnknown)
  1161.     ['{6C14DB81-A733-11CE-A521-0020AF0BE560}']
  1162.     (*** IDirectDrawSurface methods ***)
  1163.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface) :
  1164.         HResult; stdcall;
  1165.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1166.     function Blt (lpDestRect: PRect;
  1167.         lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
  1168.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1169.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1170.         dwFlags: DWORD) : HResult; stdcall;
  1171.     function BltFast (dwX: DWORD; dwY: DWORD;
  1172.         lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect;
  1173.         dwTrans: DWORD) : HResult; stdcall;
  1174.     function DeleteAttachedSurface (dwFlags: DWORD;
  1175.         lpDDSAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
  1176.     function EnumAttachedSurfaces (lpContext: Pointer;
  1177.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1178.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1179.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1180.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface;
  1181.         dwFlags: DWORD) : HResult; stdcall;
  1182.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1183.         (*out*)var lplpDDAttachedSurface: IDirectDrawSurface) : HResult; stdcall;
  1184.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1185.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1186.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1187.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1188.         HResult; stdcall;
  1189.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1190.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1191.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1192.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1193.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1194.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1195.     function Initialize (lpDD: IDirectDraw;
  1196.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1197.     function IsLost: HResult; stdcall;
  1198.     function Lock (lpDestRect: PRect; out lpDDSurfaceDesc:
  1199.         TDDSurfaceDesc; dwFlags: DWORD; hEvent: THandle) : HResult; stdcall;
  1200.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1201.     function _Restore: HResult; stdcall;
  1202.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1203.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1204.         HResult; stdcall;
  1205.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1206.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1207.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1208.     function UpdateOverlay (lpSrcRect: PRect;
  1209.         lpDDDestSurface: IDirectDrawSurface; lpDestRect: PRect;
  1210.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1211.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1212.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1213.         lpDDSReference: IDirectDrawSurface) : HResult; stdcall;
  1214.   end;
  1215.  
  1216. (*
  1217.  * IDirectDrawSurface2 and related interfaces
  1218.  *)
  1219.  
  1220.   IDirectDrawSurface2 = interface (IUnknown)
  1221.     ['{57805885-6eec-11cf-9441-a82303c10e27}']
  1222.     (*** IDirectDrawSurface methods ***)
  1223.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface2) :
  1224.         HResult; stdcall;
  1225.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1226.     function Blt (lpDestRect: PRect;
  1227.         lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
  1228.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1229.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1230.         dwFlags: DWORD) : HResult; stdcall;
  1231.     function BltFast (dwX: DWORD; dwY: DWORD;
  1232.         lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect;
  1233.         dwTrans: DWORD) : HResult; stdcall;
  1234.     function DeleteAttachedSurface (dwFlags: DWORD;
  1235.         lpDDSAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
  1236.     function EnumAttachedSurfaces (lpContext: Pointer;
  1237.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1238.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1239.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1240.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface2;
  1241.         dwFlags: DWORD) : HResult; stdcall;
  1242.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1243.         out lplpDDAttachedSurface: IDirectDrawSurface2) : HResult; stdcall;
  1244.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1245.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1246.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1247.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1248.         HResult; stdcall;
  1249.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1250.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1251.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1252.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1253.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1254.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1255.     function Initialize (lpDD: IDirectDraw;
  1256.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1257.     function IsLost: HResult; stdcall;
  1258.     function Lock (lpDestRect: PRect;
  1259.         out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
  1260.         hEvent: THandle) : HResult; stdcall;
  1261.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1262.     function _Restore: HResult; stdcall;
  1263.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1264.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1265.         HResult; stdcall;
  1266.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1267.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1268.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1269.     function UpdateOverlay (lpSrcRect: PRect;
  1270.         lpDDDestSurface: IDirectDrawSurface2; lpDestRect: PRect;
  1271.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1272.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1273.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1274.         lpDDSReference: IDirectDrawSurface2) : HResult; stdcall;
  1275.     (*** Added in the v2 interface ***)
  1276.     function GetDDInterface (var lplpDD: IDirectDraw) : HResult; stdcall;
  1277.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1278.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1279.   end;
  1280.  
  1281.   IDirectDrawSurface3 = interface (IUnknown)
  1282.     ['{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}']
  1283.     (*** IDirectDrawSurface methods ***)
  1284.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface3) :
  1285.         HResult; stdcall;
  1286.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1287.     function Blt (lpDestRect: PRect;
  1288.         lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
  1289.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1290.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1291.         dwFlags: DWORD) : HResult; stdcall;
  1292.     function BltFast (dwX: DWORD; dwY: DWORD;
  1293.         lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect;
  1294.         dwTrans: DWORD) : HResult; stdcall;
  1295.     function DeleteAttachedSurface (dwFlags: DWORD;
  1296.         lpDDSAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
  1297.     function EnumAttachedSurfaces (lpContext: Pointer;
  1298.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1299.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1300.         lpfnCallback: TDDEnumSurfacesCallback) : HResult; stdcall;
  1301.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface3;
  1302.         dwFlags: DWORD) : HResult; stdcall;
  1303.     function GetAttachedSurface (var lpDDSCaps: TDDSCaps;
  1304.         out lplpDDAttachedSurface: IDirectDrawSurface3) : HResult; stdcall;
  1305.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1306.     function GetCaps (out lpDDSCaps: TDDSCaps) : HResult; stdcall;
  1307.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1308.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1309.         HResult; stdcall;
  1310.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1311.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1312.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1313.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1314.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1315.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1316.     function Initialize (lpDD: IDirectDraw;
  1317.         out lpDDSurfaceDesc: TDDSurfaceDesc) : HResult; stdcall;
  1318.     function IsLost: HResult; stdcall;
  1319.     function Lock (lpDestRect: PRect;
  1320.         out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD;
  1321.         hEvent: THandle) : HResult; stdcall;
  1322.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1323.     function _Restore: HResult; stdcall;
  1324.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1325.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1326.         HResult; stdcall;
  1327.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1328.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1329.     function Unlock (lpSurfaceData: Pointer) : HResult; stdcall;
  1330.     function UpdateOverlay (lpSrcRect: PRect;
  1331.         lpDDDestSurface: IDirectDrawSurface3; lpDestRect: PRect;
  1332.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1333.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1334.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1335.         lpDDSReference: IDirectDrawSurface3) : HResult; stdcall;
  1336.     (*** Added in the v2 interface ***)
  1337.     function GetDDInterface (out lplpDD: IDirectDraw) : HResult; stdcall;
  1338.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1339.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1340.     (*** Added in the V3 interface ***)
  1341.     function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc; dwFlags: DWORD) : HResult; stdcall;
  1342.   end;
  1343.  
  1344. (*
  1345.  * IDirectDrawSurface4 and related interfaces
  1346.  *)
  1347.   IDirectDrawSurface4 = interface (IUnknown)
  1348.     ['{0B2B8630-AD35-11D0-8EA6-00609797EA5B}']
  1349.     (*** IDirectDrawSurface methods ***)
  1350.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface4) :
  1351.         HResult; stdcall;
  1352.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1353.     function Blt (lpDestRect: PRect;
  1354.         lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
  1355.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1356.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1357.         dwFlags: DWORD) : HResult; stdcall;
  1358.     function BltFast (dwX: DWORD; dwY: DWORD;
  1359.         lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect;
  1360.         dwTrans: DWORD) : HResult; stdcall;
  1361.     function DeleteAttachedSurface (dwFlags: DWORD;
  1362.         lpDDSAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
  1363.     function EnumAttachedSurfaces (lpContext: Pointer;
  1364.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
  1365.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1366.         lpfnCallback: TDDEnumSurfacesCallback2) : HResult; stdcall;
  1367.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface4;
  1368.         dwFlags: DWORD) : HResult; stdcall;
  1369.     function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
  1370.         out lplpDDAttachedSurface: IDirectDrawSurface4) : HResult; stdcall;
  1371.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1372.     function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
  1373.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1374.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1375.         HResult; stdcall;
  1376.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1377.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1378.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1379.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1380.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1381.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1382.     function Initialize (lpDD: IDirectDraw;
  1383.         out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1384.     function IsLost: HResult; stdcall;
  1385.     function Lock (lpDestRect: PRect;
  1386.         out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
  1387.         hEvent: THandle) : HResult; stdcall;
  1388.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1389.     function _Restore: HResult; stdcall;
  1390.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1391.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1392.         HResult; stdcall;
  1393.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1394.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1395.     function Unlock (lpRect: PRect) : HResult; stdcall;
  1396.     function UpdateOverlay (lpSrcRect: PRect;
  1397.         lpDDDestSurface: IDirectDrawSurface4; lpDestRect: PRect;
  1398.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1399.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1400.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1401.         lpDDSReference: IDirectDrawSurface4) : HResult; stdcall;
  1402.     (*** Added in the v2 interface ***)
  1403.     function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
  1404.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1405.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1406.     (*** Added in the V3 interface ***)
  1407.     function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
  1408.     (*** Added in the v4 interface ***)
  1409.     function SetPrivateData(const guidTag: TGUID; lpData: pointer;
  1410.         cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1411.     function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
  1412.         var lpcbBufferSize: DWORD) : HResult; stdcall;
  1413.     function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
  1414.     function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
  1415.     function ChangeUniquenessValue : HResult; stdcall;
  1416.   end;
  1417.  
  1418.   IDirectDrawSurface7 = interface (IUnknown)
  1419.     ['{06675a80-3b9b-11d2-b92f-00609797ea5b}']
  1420.     (*** IDirectDrawSurface methods ***)
  1421.     function AddAttachedSurface (lpDDSAttachedSurface: IDirectDrawSurface7) :
  1422.         HResult; stdcall;
  1423.     function AddOverlayDirtyRect (const lpRect: TRect) : HResult; stdcall;
  1424.     function Blt (lpDestRect: PRect;
  1425.         lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
  1426.         dwFlags: DWORD; lpDDBltFx: PDDBltFX) : HResult; stdcall;
  1427.     function BltBatch (const lpDDBltBatch: TDDBltBatch; dwCount: DWORD;
  1428.         dwFlags: DWORD) : HResult; stdcall;
  1429.     function BltFast (dwX: DWORD; dwY: DWORD;
  1430.         lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect;
  1431.         dwTrans: DWORD) : HResult; stdcall;
  1432.     function DeleteAttachedSurface (dwFlags: DWORD;
  1433.         lpDDSAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
  1434.     function EnumAttachedSurfaces (lpContext: Pointer;
  1435.         lpEnumSurfacesCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
  1436.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  1437.         lpfnCallback: TDDEnumSurfacesCallback7) : HResult; stdcall;
  1438.     function Flip (lpDDSurfaceTargetOverride: IDirectDrawSurface7;
  1439.         dwFlags: DWORD) : HResult; stdcall;
  1440.     function GetAttachedSurface (const lpDDSCaps: TDDSCaps2;
  1441.         out lplpDDAttachedSurface: IDirectDrawSurface7) : HResult; stdcall;
  1442.     function GetBltStatus (dwFlags: DWORD) : HResult; stdcall;
  1443.     function GetCaps (out lpDDSCaps: TDDSCaps2) : HResult; stdcall;
  1444.     function GetClipper (out lplpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1445.     function GetColorKey (dwFlags: DWORD; out lpDDColorKey: TDDColorKey) :
  1446.         HResult; stdcall;
  1447.     function GetDC (out lphDC: HDC) : HResult; stdcall;
  1448.     function GetFlipStatus (dwFlags: DWORD) : HResult; stdcall;
  1449.     function GetOverlayPosition (out lplX, lplY: LongInt) : HResult; stdcall;
  1450.     function GetPalette (out lplpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1451.     function GetPixelFormat (out lpDDPixelFormat: TDDPixelFormat) : HResult; stdcall;
  1452.     function GetSurfaceDesc (out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1453.     function Initialize (lpDD: IDirectDraw;
  1454.         out lpDDSurfaceDesc: TDDSurfaceDesc2) : HResult; stdcall;
  1455.     function IsLost: HResult; stdcall;
  1456.     function Lock (lpDestRect: PRect;
  1457.         out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD;
  1458.         hEvent: THandle) : HResult; stdcall;
  1459.     function ReleaseDC (hDC: Windows.HDC) : HResult; stdcall;
  1460.     function _Restore: HResult; stdcall;
  1461.     function SetClipper (lpDDClipper: IDirectDrawClipper) : HResult; stdcall;
  1462.     function SetColorKey (dwFlags: DWORD; lpDDColorKey: PDDColorKey) :
  1463.         HResult; stdcall;
  1464.     function SetOverlayPosition (lX, lY: LongInt) : HResult; stdcall;
  1465.     function SetPalette (lpDDPalette: IDirectDrawPalette) : HResult; stdcall;
  1466.     function Unlock (lpRect: PRect) : HResult; stdcall;
  1467.     function UpdateOverlay (lpSrcRect: PRect;
  1468.         lpDDDestSurface: IDirectDrawSurface7; lpDestRect: PRect;
  1469.         dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX) : HResult; stdcall;
  1470.     function UpdateOverlayDisplay (dwFlags: DWORD) : HResult; stdcall;
  1471.     function UpdateOverlayZOrder (dwFlags: DWORD;
  1472.         lpDDSReference: IDirectDrawSurface7) : HResult; stdcall;
  1473.     (*** Added in the v2 interface ***)
  1474.     function GetDDInterface (out lplpDD: IUnknown) : HResult; stdcall;
  1475.     function PageLock (dwFlags: DWORD) : HResult; stdcall;
  1476.     function PageUnlock (dwFlags: DWORD) : HResult; stdcall;
  1477.     (*** Added in the V3 interface ***)
  1478.     function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD) : HResult; stdcall;
  1479.     (*** Added in the v4 interface ***)
  1480.     function SetPrivateData(const guidTag: TGUID; lpData: pointer;
  1481.         cbSize: DWORD; dwFlags: DWORD) : HResult; stdcall;
  1482.     function GetPrivateData(const guidTag: TGUID; lpBuffer: pointer;
  1483.         var lpcbBufferSize: DWORD) : HResult; stdcall;
  1484.     function FreePrivateData(const guidTag: TGUID) : HResult; stdcall;
  1485.     function GetUniquenessValue(out lpValue: DWORD) : HResult; stdcall;
  1486.     function ChangeUniquenessValue : HResult; stdcall;
  1487.     (*** Moved Texture7 methods here ***)
  1488.     function SetPriority(dwPriority: DWORD) : HResult; stdcall;
  1489.     function GetPriority(out lpdwPriority: DWORD) : HResult; stdcall;
  1490.     function SetLOD(dwMaxLOD: DWORD) : HResult; stdcall;
  1491.     function GetLOD(out lpdwMaxLOD: DWORD) : HResult; stdcall;
  1492.   end;
  1493.  
  1494.   IDirectDrawColorControl = interface (IUnknown)
  1495.     ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}']
  1496.     function GetColorControls(out lpColorControl: TDDColorControl) : HResult; stdcall;
  1497.     function SetColorControls(const lpColorControl: TDDColorControl) : HResult; stdcall;
  1498.   end;
  1499.  
  1500. (*
  1501.  * IDirectDrawGammaControl
  1502.  *)
  1503.   IDirectDrawGammaControl = interface (IUnknown)
  1504.     ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}']
  1505.     function GetGammaRamp (dwFlags: DWORD; out lpRampData: TDDGammaRamp)
  1506.         : HResult; stdcall;
  1507.     function SetGammaRamp (dwFlags: DWORD; const lpRampData: TDDGammaRamp)
  1508.         : HResult; stdcall;
  1509.   end;
  1510.  
  1511. type
  1512.   IID_IDirectDraw = IDirectDraw;
  1513.   IID_IDirectDraw2 = IDirectDraw2;
  1514.   IID_IDirectDraw4 = IDirectDraw4;
  1515.   IID_IDirectDraw7 = IDirectDraw7;
  1516.   IID_IDirectDrawSurface = IDirectDrawSurface;
  1517.   IID_IDirectDrawSurface2 = IDirectDrawSurface2;
  1518.   IID_IDirectDrawSurface3 = IDirectDrawSurface3;
  1519.   IID_IDirectDrawSurface4 = IDirectDrawSurface4;
  1520.   IID_IDirectDrawSurface7 = IDirectDrawSurface7;
  1521.  
  1522.   IID_IDirectDrawPalette = IDirectDrawPalette;
  1523.   IID_IDirectDrawClipper = IDirectDrawClipper;
  1524.   IID_IDirectDrawColorControl = IDirectDrawColorControl;
  1525.   IID_IDirectDrawGammaControl = IDirectDrawGammaControl;
  1526.  
  1527. const  
  1528. (*
  1529.  * ddsCaps field is valid.
  1530.  *)
  1531.   DDSD_CAPS               = $00000001;     // default
  1532.  
  1533. (*
  1534.  * dwHeight field is valid.
  1535.  *)
  1536.   DDSD_HEIGHT             = $00000002;
  1537.  
  1538. (*
  1539.  * dwWidth field is valid.
  1540.  *)
  1541.   DDSD_WIDTH              = $00000004;
  1542.  
  1543. (*
  1544.  * lPitch is valid.
  1545.  *)
  1546.   DDSD_PITCH              = $00000008;
  1547.  
  1548. (*
  1549.  * dwBackBufferCount is valid.
  1550.  *)
  1551.   DDSD_BACKBUFFERCOUNT    = $00000020;
  1552.  
  1553. (*
  1554.  * dwZBufferBitDepth is valid.  (shouldnt be used in DDSURFACEDESC2)
  1555.  *)
  1556.   DDSD_ZBUFFERBITDEPTH    = $00000040;
  1557.  
  1558. (*
  1559.  * dwAlphaBitDepth is valid.
  1560.  *)
  1561.    DDSD_ALPHABITDEPTH      = $00000080;
  1562.  
  1563. (*
  1564.  * lpSurface is valid.
  1565.  *)
  1566.   DDSD_LPSURFACE           = $00000800;
  1567.  
  1568. (*
  1569.  * ddpfPixelFormat is valid.
  1570.  *)
  1571.   DDSD_PIXELFORMAT        = $00001000;
  1572.  
  1573. (*
  1574.  * ddckCKDestOverlay is valid.
  1575.  *)
  1576.   DDSD_CKDESTOVERLAY      = $00002000;
  1577.  
  1578. (*
  1579.  * ddckCKDestBlt is valid.
  1580.  *)
  1581.   DDSD_CKDESTBLT          = $00004000;
  1582.  
  1583. (*
  1584.  * ddckCKSrcOverlay is valid.
  1585.  *)
  1586.   DDSD_CKSRCOVERLAY       = $00008000;
  1587.  
  1588. (*
  1589.  * ddckCKSrcBlt is valid.
  1590.  *)
  1591.   DDSD_CKSRCBLT           = $00010000;
  1592.  
  1593. (*
  1594.  * dwMipMapCount is valid.
  1595.  *)
  1596.   DDSD_MIPMAPCOUNT        = $00020000;
  1597.  
  1598.  (*
  1599.   * dwRefreshRate is valid
  1600.   *)
  1601.   DDSD_REFRESHRATE        = $00040000;
  1602.  
  1603. (*
  1604.  * dwLinearSize is valid
  1605.  *)
  1606.   DDSD_LINEARSIZE         = $00080000;
  1607.  
  1608. (*
  1609.  * dwTextureStage is valid
  1610.  *)
  1611.   DDSD_TEXTURESTAGE       = $00100000;
  1612.  
  1613. (*
  1614.  * All input fields are valid.
  1615.  *)
  1616.   DDSD_ALL                = $001ff9ee;
  1617.  
  1618.  
  1619. (*
  1620.  * guid field is valid.
  1621.  *)
  1622.   DDOSD_GUID                  = $00000001;
  1623.  
  1624. (*
  1625.  * dwCompressionRatio field is valid.
  1626.  *)
  1627.   DDOSD_COMPRESSION_RATIO     = $00000002;
  1628.  
  1629. (*
  1630.  * ddSCaps field is valid.
  1631.  *)
  1632.   DDOSD_SCAPS                 = $00000004;
  1633.  
  1634. (*
  1635.  * ddOSCaps field is valid.
  1636.  *)
  1637.   DDOSD_OSCAPS                = $00000008;
  1638.  
  1639. (*
  1640.  * All input fields are valid.
  1641.  *)
  1642.   DDOSD_ALL                   = $0000000f;
  1643.  
  1644. (*
  1645.  * The surface's optimized pixelformat is compressed
  1646.  *)
  1647.   DDOSDCAPS_OPTCOMPRESSED                       = $00000001;
  1648.  
  1649. (*
  1650.  * The surface's optimized pixelformat is reordered
  1651.  *)
  1652.   DDOSDCAPS_OPTREORDERED                        = $00000002;
  1653.  
  1654. (*
  1655.  * The opt surface is a monolithic mipmap
  1656.  *)
  1657.   DDOSDCAPS_MONOLITHICMIPMAP            = $00000004;
  1658.  
  1659. (*
  1660.  * The valid Surf caps:
  1661.  *   DDSCAPS_SYSTEMMEMORY       = $00000800;
  1662.  *   DDSCAPS_VIDEOMEMORY        = $00004000;
  1663.  *   DDSCAPS_LOCALVIDMEM        = $10000000;
  1664.  *   DDSCAPS_NONLOCALVIDMEM     = $20000000;
  1665.  *)
  1666.   DDOSDCAPS_VALIDSCAPS          = $30004800;
  1667.  
  1668. (*
  1669.  * The valid OptSurf caps
  1670.  *)
  1671.   DDOSDCAPS_VALIDOSCAPS                 = $00000007;
  1672.  
  1673.  
  1674. (*
  1675.  * DDCOLORCONTROL
  1676.  *)
  1677.  
  1678. (*
  1679.  * lBrightness field is valid.
  1680.  *)
  1681.   DDCOLOR_BRIGHTNESS            = $00000001;
  1682.  
  1683. (*
  1684.  * lContrast field is valid.
  1685.  *)
  1686.   DDCOLOR_CONTRAST              = $00000002;
  1687.  
  1688. (*
  1689.  * lHue field is valid.
  1690.  *)
  1691.   DDCOLOR_HUE                   = $00000004;
  1692.  
  1693. (*
  1694.  * lSaturation field is valid.
  1695.  *)
  1696.   DDCOLOR_SATURATION            = $00000008;
  1697.  
  1698. (*
  1699.  * lSharpness field is valid.
  1700.  *)
  1701.   DDCOLOR_SHARPNESS             = $00000010;
  1702.  
  1703. (*
  1704.  * lGamma field is valid.
  1705.  *)
  1706.   DDCOLOR_GAMMA                 = $00000020;
  1707.  
  1708. (*
  1709.  * lColorEnable field is valid.
  1710.  *)
  1711.   DDCOLOR_COLORENABLE           = $00000040;
  1712.  
  1713.  
  1714.  
  1715. (*============================================================================
  1716.  *
  1717.  * Direct Draw Capability Flags
  1718.  *
  1719.  * These flags are used to describe the capabilities of a given Surface.
  1720.  * All flags are bit flags.
  1721.  *
  1722.  *==========================================================================*)
  1723.  
  1724. (****************************************************************************
  1725.  *
  1726.  * DIRECTDRAWSURFACE CAPABILITY FLAGS
  1727.  *
  1728.  ****************************************************************************)
  1729. (*
  1730.  * This bit currently has no meaning.
  1731.  *)
  1732.   DDSCAPS_RESERVED1                       = $00000001;
  1733.  
  1734. (*
  1735.  * Indicates that this surface contains alpha-only information.
  1736.  * (To determine if a surface is RGBA/YUVA, the pixel format must be
  1737.  * interrogated.)
  1738.  *)
  1739.   DDSCAPS_ALPHA                           = $00000002;
  1740.  
  1741. (*
  1742.  * Indicates that this surface is a backbuffer.  It is generally
  1743.  * set by CreateSurface when the DDSCAPS_FLIP capability bit is set.
  1744.  * It indicates that this surface is THE back buffer of a surface
  1745.  * flipping structure.  DirectDraw supports N surfaces in a
  1746.  * surface flipping structure.  Only the surface that immediately
  1747.  * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set.
  1748.  * The other surfaces are identified as back buffers by the presence
  1749.  * of the DDSCAPS_FLIP capability, their attachment order, and the
  1750.  * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER
  1751.  * capabilities.  The bit is sent to CreateSurface when a standalone
  1752.  * back buffer is being created.  This surface could be attached to
  1753.  * a front buffer and/or back buffers to form a flipping surface
  1754.  * structure after the CreateSurface call.  See AddAttachments for
  1755.  * a detailed description of the behaviors in this case.
  1756.  *)
  1757.   DDSCAPS_BACKBUFFER                      = $00000004;
  1758.  
  1759. (*
  1760.  * Indicates a complex surface structure is being described.  A
  1761.  * complex surface structure results in the creation of more than
  1762.  * one surface.  The additional surfaces are attached to the root
  1763.  * surface.  The complex structure can only be destroyed by
  1764.  * destroying the root.
  1765.  *)
  1766.   DDSCAPS_COMPLEX                         = $00000008;
  1767.  
  1768. (*
  1769.  * Indicates that this surface is a part of a surface flipping structure.
  1770.  * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and
  1771.  * DDSCAP_BACKBUFFER bits are not set.  They are set by CreateSurface
  1772.  * on the resulting creations.  The dwBackBufferCount field in the
  1773.  * TDDSurfaceDesc structure must be set to at least 1 in order for
  1774.  * the CreateSurface call to succeed.  The DDSCAPS_COMPLEX capability
  1775.  * must always be set with creating multiple surfaces through CreateSurface.
  1776.  *)
  1777.   DDSCAPS_FLIP                            = $00000010;
  1778.  
  1779. (*
  1780.  * Indicates that this surface is THE front buffer of a surface flipping
  1781.  * structure.  It is generally set by CreateSurface when the DDSCAPS_FLIP
  1782.  * capability bit is set.
  1783.  * If this capability is sent to CreateSurface then a standalonw front buffer
  1784.  * is created.  This surface will not have the DDSCAPS_FLIP capability.
  1785.  * It can be attached to other back buffers to form a flipping structure.
  1786.  * See AddAttachments for a detailed description of the behaviors in this
  1787.  * case.
  1788.  *)
  1789.   DDSCAPS_FRONTBUFFER                     = $00000020;
  1790.  
  1791. (*
  1792.  * Indicates that this surface is any offscreen surface that is not an overlay,
  1793.  * texture, zbuffer, front buffer, back buffer, or alpha surface.  It is used
  1794.  * to identify plain vanilla surfaces.
  1795.  *)
  1796.   DDSCAPS_OFFSCREENPLAIN                  = $00000040;
  1797.  
  1798. (*
  1799.  * Indicates that this surface is an overlay.  It may or may not be directly visible
  1800.  * depending on whether or not it is currently being overlayed onto the primary
  1801.  * surface.  DDSCAPS_VISIBLE can be used to determine whether or not it is being
  1802.  * overlayed at the moment.
  1803.  *)
  1804.   DDSCAPS_OVERLAY                         = $00000080;
  1805.  
  1806. (*
  1807.  * Indicates that unique DirectDrawPalette objects can be created and
  1808.  * attached to this surface.
  1809.  *)
  1810.   DDSCAPS_PALETTE                         = $00000100;
  1811.  
  1812. (*
  1813.  * Indicates that this surface is the primary surface.  The primary
  1814.  * surface represents what the user is seeing at the moment.
  1815.  *)
  1816.   DDSCAPS_PRIMARYSURFACE                  = $00000200;
  1817.  
  1818. (*
  1819.  * This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now
  1820.  * obsolete.
  1821.  *)
  1822.   DDSCAPS_RESERVED3              = $00000400;
  1823. (*
  1824.  * Indicates that this surface is the primary surface for the left eye.
  1825.  * The primary surface for the left eye represents what the user is seeing
  1826.  * at the moment with the users left eye.  When this surface is created the
  1827.  * DDSCAPS_PRIMARYSURFACE represents what the user is seeing with the users
  1828.  * right eye.
  1829.  *)
  1830.   DDSCAPS_PRIMARYSURFACELEFT = DDSCAPS_RESERVED3;
  1831.  
  1832. (*
  1833.  * Indicates that this surface memory was allocated in system memory
  1834.  *)
  1835.   DDSCAPS_SYSTEMMEMORY                    = $00000800;
  1836.  
  1837. (*
  1838.  * Indicates that this surface can be used as a 3D texture.  It does not
  1839.  * indicate whether or not the surface is being used for that purpose.
  1840.  *)
  1841.   DDSCAPS_TEXTURE                         = $00001000;
  1842.  
  1843. (*
  1844.  * Indicates that a surface may be a destination for 3D rendering.  This
  1845.  * bit must be set in order to query for a Direct3D Device Interface
  1846.  * from this surface.
  1847.  *)
  1848.   DDSCAPS_3DDEVICE                        = $00002000;
  1849.  
  1850. (*
  1851.  * Indicates that this surface exists in video memory.
  1852.  *)
  1853.   DDSCAPS_VIDEOMEMORY                     = $00004000;
  1854.  
  1855. (*
  1856.  * Indicates that changes made to this surface are immediately visible.
  1857.  * It is always set for the primary surface and is set for overlays while
  1858.  * they are being overlayed and texture maps while they are being textured.
  1859.  *)
  1860.   DDSCAPS_VISIBLE                         = $00008000;
  1861.  
  1862. (*
  1863.  * Indicates that only writes are permitted to the surface.  Read accesses
  1864.  * from the surface may or may not generate a protection fault, but the
  1865.  * results of a read from this surface will not be meaningful.  READ ONLY.
  1866.  *)
  1867.   DDSCAPS_WRITEONLY                       = $00010000;
  1868.  
  1869. (*
  1870.  * Indicates that this surface is a z buffer. A z buffer does not contain
  1871.  * displayable information.  Instead it contains bit depth information that is
  1872.  * used to determine which pixels are visible and which are obscured.
  1873.  *)
  1874.   DDSCAPS_ZBUFFER                         = $00020000;
  1875.  
  1876. (*
  1877.  * Indicates surface will have a DC associated long term
  1878.  *)
  1879.   DDSCAPS_OWNDC                           = $00040000;
  1880.  
  1881. (*
  1882.  * Indicates surface should be able to receive live video
  1883.  *)
  1884.   DDSCAPS_LIVEVIDEO                       = $00080000;
  1885.  
  1886. (*
  1887.  * Indicates surface should be able to have a stream decompressed
  1888.  * to it by the hardware.
  1889.  *)
  1890.   DDSCAPS_HWCODEC                         = $00100000;
  1891.  
  1892. (*
  1893.  * Surface is a ModeX surface.
  1894.  *
  1895.  *)
  1896.   DDSCAPS_MODEX                           = $00200000;
  1897.  
  1898. (*
  1899.  * Indicates surface is one level of a mip-map. This surface will
  1900.  * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map.
  1901.  * This can be done explicitly, by creating a number of surfaces and
  1902.  * attaching them with AddAttachedSurface or by implicitly by CreateSurface.
  1903.  * If this bit is set then DDSCAPS_TEXTURE must also be set.
  1904.  *)
  1905.   DDSCAPS_MIPMAP                          = $00400000;
  1906.  
  1907. (*
  1908.  * This bit is reserved. It should not be specified.
  1909.  *)
  1910.   DDSCAPS_RESERVED2                       = $00800000;
  1911.  
  1912. (*
  1913.  * Indicates that memory for the surface is not allocated until the surface
  1914.  * is loaded (via the Direct3D texture Load() function).
  1915.  *)
  1916.   DDSCAPS_ALLOCONLOAD                     = $04000000;
  1917.  
  1918. (*
  1919.  * Indicates that the surface will recieve data from a video port.
  1920.  *)
  1921.   DDSCAPS_VIDEOPORT                       = $08000000;
  1922.  
  1923. (*
  1924.  * Indicates that a video memory surface is resident in true, local video
  1925.  * memory rather than non-local video memory. If this flag is specified then
  1926.  * so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
  1927.  * DDSCAPS_NONLOCALVIDMEM.
  1928.  *)
  1929.   DDSCAPS_LOCALVIDMEM                     = $10000000;
  1930.  
  1931. (*
  1932.  * Indicates that a video memory surface is resident in non-local video
  1933.  * memory rather than true, local video memory. If this flag is specified
  1934.  * then so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with
  1935.  * DDSCAPS_LOCALVIDMEM.
  1936.  *)
  1937.   DDSCAPS_NONLOCALVIDMEM                  = $20000000;
  1938.  
  1939. (*
  1940.  * Indicates that this surface is a standard VGA mode surface, and not a
  1941.  * ModeX surface. (This flag will never be set in combination with the
  1942.  * DDSCAPS_MODEX flag).
  1943.  *)
  1944.   DDSCAPS_STANDARDVGAMODE                 = $40000000;
  1945.  
  1946. (*
  1947.  * Indicates that this surface will be an optimized surface. This flag is
  1948.  * currently only valid in conjunction with the DDSCAPS_TEXTURE flag. The surface
  1949.  * will be created without any underlying video memory until loaded.
  1950.  *)
  1951.   DDSCAPS_OPTIMIZED                       = $80000000;
  1952.  
  1953.  
  1954.  
  1955. (*
  1956.  * Indicates that this surface will receive data from a video port using
  1957.  * the de-interlacing hardware.  This allows the driver to allocate memory
  1958.  * for any extra buffers that may be required.  The DDSCAPS_VIDEOPORT and
  1959.  * DDSCAPS_OVERLAY flags must also be set.
  1960.  *)
  1961.   DDSCAPS2_HARDWAREDEINTERLACE            = $00000002;
  1962.  
  1963. (*
  1964.  * Indicates to the driver that this surface will be locked very frequently
  1965.  * (for procedural textures, dynamic lightmaps, etc). Surfaces with this cap
  1966.  * set must also have DDSCAPS_TEXTURE. This cap cannot be used with
  1967.  * DDSCAPS2_HINTSTATIC and DDSCAPS2_OPAQUE.
  1968.  *)
  1969.   DDSCAPS2_HINTDYNAMIC                  = $00000004;
  1970.  
  1971. (*
  1972.  * Indicates to the driver that this surface can be re-ordered/retiled on
  1973.  * load. This operation will not change the size of the texture. It is
  1974.  * relatively fast and symmetrical, since the application may lock these
  1975.  * bits (although it will take a performance hit when doing so). Surfaces
  1976.  * with this cap set must also have DDSCAPS_TEXTURE. This cap cannot be
  1977.  * used with DDSCAPS2_HINTDYNAMIC and DDSCAPS2_OPAQUE.
  1978.  *)
  1979.   DDSCAPS2_HINTSTATIC                   = $00000008;
  1980.  
  1981. (*
  1982.  * Indicates that the client would like this texture surface to be managed by the
  1983.  * DirectDraw/Direct3D runtime. Surfaces with this cap set must also have
  1984.  * DDSCAPS_TEXTURE and DDSCAPS_SYSTEMMEMORY.
  1985.  *)
  1986.   DDSCAPS2_TEXTUREMANAGE                  = $00000010;
  1987.  
  1988. (*
  1989.  * These bits are reserved for internal use *)
  1990.   DDSCAPS2_RESERVED1                      = $00000020;
  1991.   DDSCAPS2_RESERVED2                      = $00000040;
  1992.  
  1993. (*
  1994.  * Indicates to the driver that this surface will never be locked again.
  1995.  * The driver is free to optimize this surface via retiling and actual compression.
  1996.  * All calls to Lock() or Blts from this surface will fail. Surfaces with this
  1997.  * cap set must also have DDSCAPS_TEXTURE. This cap cannot be used with
  1998.  * DDSCAPS2_HINTDYNAMIC and DDSCAPS2_HINTSTATIC.
  1999.  *)
  2000.   DDSCAPS2_OPAQUE                         = $00000080;
  2001.  
  2002. (*
  2003.  * Applications should set this bit at CreateSurface time to indicate that they
  2004.  * intend to use antialiasing. Only valid if DDSCAPS_3DDEVICE is also set.
  2005.  *)
  2006.   DDSCAPS2_HINTANTIALIASING               = $00000100;
  2007.  
  2008. (*
  2009.  * This flag is used at CreateSurface time to indicate that this set of
  2010.  * surfaces is a cubic environment map
  2011.  *)
  2012.   DDSCAPS2_CUBEMAP                        = $00000200;
  2013.  
  2014. (*
  2015.  * These flags preform two functions:
  2016.  * - At CreateSurface time, they define which of the six cube faces are
  2017.  *   required by the application.
  2018.  * - After creation, each face in the cubemap will have exactly one of these
  2019.  *   bits set.
  2020.  *)
  2021.   DDSCAPS2_CUBEMAP_POSITIVEX              = $00000400;
  2022.   DDSCAPS2_CUBEMAP_NEGATIVEX              = $00000800;
  2023.   DDSCAPS2_CUBEMAP_POSITIVEY              = $00001000;
  2024.   DDSCAPS2_CUBEMAP_NEGATIVEY              = $00002000;
  2025.   DDSCAPS2_CUBEMAP_POSITIVEZ              = $00004000;
  2026.   DDSCAPS2_CUBEMAP_NEGATIVEZ              = $00008000;
  2027.  
  2028. (*
  2029.  * This macro may be used to specify all faces of a cube map at CreateSurface time
  2030.  *)
  2031.   DDSCAPS2_CUBEMAP_ALLFACES = ( DDSCAPS2_CUBEMAP_POSITIVEX or
  2032.                                 DDSCAPS2_CUBEMAP_NEGATIVEX or
  2033.                                 DDSCAPS2_CUBEMAP_POSITIVEY or
  2034.                                 DDSCAPS2_CUBEMAP_NEGATIVEY or
  2035.                                 DDSCAPS2_CUBEMAP_POSITIVEZ or
  2036.                                 DDSCAPS2_CUBEMAP_NEGATIVEZ );
  2037.  
  2038.  
  2039. (*
  2040.  * This flag is an additional flag which is present on mipmap sublevels from DX7 onwards
  2041.  * It enables easier use of GetAttachedSurface rather than EnumAttachedSurfaces for surface
  2042.  * constructs such as Cube Maps, wherein there are more than one mipmap surface attached
  2043.  * to the root surface.
  2044.  * This caps bit is ignored by CreateSurface
  2045.  *)
  2046.   DDSCAPS2_MIPMAPSUBLEVEL                 = $00010000;
  2047.  
  2048. (* This flag indicates that the texture should be managed by D3D only *)
  2049.   DDSCAPS2_D3DTEXTUREMANAGE               = $00020000;
  2050.  
  2051. (* This flag indicates that the managed surface can be safely lost *)
  2052.   DDSCAPS2_DONOTPERSIST                   = $00040000;
  2053.  
  2054. (* indicates that this surface is part of a stereo flipping chain *)
  2055.   DDSCAPS2_STEREOSURFACELEFT              = $00080000;
  2056.  
  2057.  
  2058.  
  2059.  (****************************************************************************
  2060.  *
  2061.  * DIRECTDRAW DRIVER CAPABILITY FLAGS
  2062.  *
  2063.  ****************************************************************************)
  2064.  
  2065. (*
  2066.  * Display hardware has 3D acceleration.
  2067.  *)
  2068.   DDCAPS_3D                       = $00000001;
  2069.  
  2070. (*
  2071.  * Indicates that DirectDraw will support only dest rectangles that are aligned
  2072.  * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively.
  2073.  * READ ONLY.
  2074.  *)
  2075.   DDCAPS_ALIGNBOUNDARYDEST        = $00000002;
  2076.  
  2077. (*
  2078.  * Indicates that DirectDraw will support only source rectangles  whose sizes in
  2079.  * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively.  READ ONLY.
  2080.  *)
  2081.   DDCAPS_ALIGNSIZEDEST            = $00000004;
  2082. (*
  2083.  * Indicates that DirectDraw will support only source rectangles that are aligned
  2084.  * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively.
  2085.  * READ ONLY.
  2086.  *)
  2087.   DDCAPS_ALIGNBOUNDARYSRC         = $00000008;
  2088.  
  2089. (*
  2090.  * Indicates that DirectDraw will support only source rectangles  whose sizes in
  2091.  * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively.  READ ONLY.
  2092.  *)
  2093.   DDCAPS_ALIGNSIZESRC             = $00000010;
  2094.  
  2095. (*
  2096.  * Indicates that DirectDraw will create video memory surfaces that have a stride
  2097.  * alignment equal to DIRECTDRAWCAPS.dwAlignStride.  READ ONLY.
  2098.  *)
  2099.   DDCAPS_ALIGNSTRIDE              = $00000020;
  2100.  
  2101. (*
  2102.  * Display hardware is capable of blt operations.
  2103.  *)
  2104.   DDCAPS_BLT                      = $00000040;
  2105.  
  2106. (*
  2107.  * Display hardware is capable of asynchronous blt operations.
  2108.  *)
  2109.   DDCAPS_BLTQUEUE                 = $00000080;
  2110.  
  2111. (*
  2112.  * Display hardware is capable of color space conversions during the blt operation.
  2113.  *)
  2114.   DDCAPS_BLTFOURCC                = $00000100;
  2115.  
  2116. (*
  2117.  * Display hardware is capable of stretching during blt operations.
  2118.  *)
  2119.   DDCAPS_BLTSTRETCH               = $00000200;
  2120.  
  2121. (*
  2122.  * Display hardware is shared with GDI.
  2123.  *)
  2124.   DDCAPS_GDI                      = $00000400;
  2125.  
  2126. (*
  2127.  * Display hardware can overlay.
  2128.  *)
  2129.   DDCAPS_OVERLAY                  = $00000800;
  2130.  
  2131. (*
  2132.  * Set if display hardware supports overlays but can not clip them.
  2133.  *)
  2134.   DDCAPS_OVERLAYCANTCLIP          = $00001000;
  2135.  
  2136. (*
  2137.  * Indicates that overlay hardware is capable of color space conversions during
  2138.  * the overlay operation.
  2139.  *)
  2140.   DDCAPS_OVERLAYFOURCC            = $00002000;
  2141.  
  2142. (*
  2143.  * Indicates that stretching can be done by the overlay hardware.
  2144.  *)
  2145.   DDCAPS_OVERLAYSTRETCH           = $00004000;
  2146.  
  2147. (*
  2148.  * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces
  2149.  * other than the primary surface.
  2150.  *)
  2151.   DDCAPS_PALETTE                  = $00008000;
  2152.  
  2153. (*
  2154.  * Indicates that palette changes can be syncd with the veritcal refresh.
  2155.  *)
  2156.   DDCAPS_PALETTEVSYNC             = $00010000;
  2157.  
  2158. (*
  2159.  * Display hardware can return the current scan line.
  2160.  *)
  2161.   DDCAPS_READSCANLINE             = $00020000;
  2162.  
  2163. (*
  2164.  * Display hardware has stereo vision capabilities.  DDSCAPS_PRIMARYSURFACELEFT
  2165.  * can be created.
  2166.  *)
  2167.   DDCAPS_STEREOVIEW               = $00040000;
  2168.  
  2169. (*
  2170.  * Display hardware is capable of generating a vertical blank interrupt.
  2171.  *)
  2172.   DDCAPS_VBI                      = $00080000;
  2173.  
  2174. (*
  2175.  * Supports the use of z buffers with blt operations.
  2176.  *)
  2177.   DDCAPS_ZBLTS                    = $00100000;
  2178.  
  2179. (*
  2180.  * Supports Z Ordering of overlays.
  2181.  *)
  2182.   DDCAPS_ZOVERLAYS                = $00200000;
  2183.  
  2184. (*
  2185.  * Supports color key
  2186.  *)
  2187.   DDCAPS_COLORKEY                 = $00400000;
  2188.  
  2189. (*
  2190.  * Supports alpha surfaces
  2191.  *)
  2192.   DDCAPS_ALPHA                    = $00800000;
  2193.  
  2194. (*
  2195.  * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set)
  2196.  *)
  2197.   DDCAPS_COLORKEYHWASSIST         = $01000000;
  2198.  
  2199. (*
  2200.  * no hardware support at all
  2201.  *)
  2202.   DDCAPS_NOHARDWARE               = $02000000;
  2203.  
  2204. (*
  2205.  * Display hardware is capable of color fill with bltter
  2206.  *)
  2207.   DDCAPS_BLTCOLORFILL             = $04000000;
  2208.  
  2209. (*
  2210.  * Display hardware is bank switched, and potentially very slow at
  2211.  * random access to VRAM.
  2212.  *)
  2213.   DDCAPS_BANKSWITCHED             = $08000000;
  2214.  
  2215. (*
  2216.  * Display hardware is capable of depth filling Z-buffers with bltter
  2217.  *)
  2218.   DDCAPS_BLTDEPTHFILL             = $10000000;
  2219.  
  2220. (*
  2221.  * Display hardware is capable of clipping while bltting.
  2222.  *)
  2223.   DDCAPS_CANCLIP                  = $20000000;
  2224.  
  2225. (*
  2226.  * Display hardware is capable of clipping while stretch bltting.
  2227.  *)
  2228.   DDCAPS_CANCLIPSTRETCHED         = $40000000;
  2229.  
  2230. (*
  2231.  * Display hardware is capable of bltting to or from system memory
  2232.  *)
  2233.   DDCAPS_CANBLTSYSMEM             = $80000000;
  2234.  
  2235.  
  2236.  (****************************************************************************
  2237.  *
  2238.  * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2)
  2239.  *
  2240.  ****************************************************************************)
  2241.  
  2242. (*
  2243.  * Display hardware is certified
  2244.  *)
  2245.   DDCAPS2_CERTIFIED               = $00000001;
  2246.  
  2247. (*
  2248.  * Driver cannot interleave 2D operations (lock and blt) to surfaces with
  2249.  * Direct3D rendering operations between calls to BeginScene() and EndScene()
  2250.  *)
  2251.   DDCAPS2_NO2DDURING3DSCENE       = $00000002;
  2252.  
  2253. (*
  2254.  * Display hardware contains a video port
  2255.  *)
  2256.   DDCAPS2_VIDEOPORT               = $00000004;
  2257.  
  2258. (*
  2259.  * The overlay can be automatically flipped according to the video port
  2260.  * VSYNCs, providing automatic doubled buffered display of video port
  2261.  * data using an overlay
  2262.  *)
  2263.   DDCAPS2_AUTOFLIPOVERLAY         = $00000008;
  2264.  
  2265. (*
  2266.  * Overlay can display each field of interlaced data individually while
  2267.  * it is interleaved in memory without causing jittery artifacts.
  2268.  *)
  2269.   DDCAPS2_CANBOBINTERLEAVED     = $00000010;
  2270.  
  2271. (*
  2272.  * Overlay can display each field of interlaced data individually while
  2273.  * it is not interleaved in memory without causing jittery artifacts.
  2274.  *)
  2275.   DDCAPS2_CANBOBNONINTERLEAVED  = $00000020;
  2276.  
  2277. (*
  2278.  * The overlay surface contains color controls (brightness, sharpness, etc.)
  2279.  *)
  2280.   DDCAPS2_COLORCONTROLOVERLAY   = $00000040;
  2281.  
  2282. (*
  2283.  * The primary surface contains color controls (gamma, etc.)
  2284.  *)
  2285.   DDCAPS2_COLORCONTROLPRIMARY   = $00000080;
  2286.  
  2287. (*
  2288.  * RGBZ -> RGB supported for 16:16 RGB:Z
  2289.  *)
  2290.   DDCAPS2_CANDROPZ16BIT         = $00000100;
  2291.  
  2292. (*
  2293.  * Driver supports non-local video memory.
  2294.  *)
  2295.   DDCAPS2_NONLOCALVIDMEM          = $00000200;
  2296.  
  2297. (*
  2298.  * Dirver supports non-local video memory but has different capabilities for
  2299.  * non-local video memory surfaces. If this bit is set then so must
  2300.  * DDCAPS2_NONLOCALVIDMEM.
  2301.  *)
  2302.   DDCAPS2_NONLOCALVIDMEMCAPS      = $00000400;
  2303.  
  2304. (*
  2305.  * Driver neither requires nor prefers surfaces to be pagelocked when performing
  2306.  * blts involving system memory surfaces
  2307.  *)
  2308.   DDCAPS2_NOPAGELOCKREQUIRED      = $00000800;
  2309.  
  2310. (*
  2311.  * Driver can create surfaces which are wider than the primary surface
  2312.  *)
  2313.   DDCAPS2_WIDESURFACES            = $00001000;
  2314.  
  2315. (*
  2316.  * Driver supports bob without using a video port by handling the
  2317.  * DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip.
  2318.  *)
  2319.   DDCAPS2_CANFLIPODDEVEN          = $00002000;
  2320.  
  2321. (*
  2322.  * Driver supports bob using hardware
  2323.  *)
  2324.   DDCAPS2_CANBOBHARDWARE          = $00004000;
  2325.  
  2326. (*
  2327.  * Driver supports bltting any FOURCC surface to another surface of the same FOURCC
  2328.  *)
  2329.   DDCAPS2_COPYFOURCC              = $00008000;
  2330.  
  2331.  
  2332. (*
  2333.  * Driver supports loadable gamma ramps for the primary surface
  2334.  *)
  2335.   DDCAPS2_PRIMARYGAMMA            = $00020000;
  2336.  
  2337. (*
  2338.  * Driver can render in windowed mode.
  2339.  *)
  2340.   DDCAPS2_CANRENDERWINDOWED       = $00080000;
  2341.  
  2342. (*
  2343.  * A calibrator is available to adjust the gamma ramp according to the
  2344.  * physical display properties so that the result will be identical on
  2345.  * all calibrated systems.
  2346.  *)
  2347.   DDCAPS2_CANCALIBRATEGAMMA       = $00100000;
  2348.  
  2349. (*
  2350.  * Indicates that the driver will respond to DDFLIP_INTERVALn flags
  2351.  *)
  2352.   DDCAPS2_FLIPINTERVAL            = $00200000;
  2353.  
  2354. (*
  2355.  * Indicates that the driver will respond to DDFLIP_NOVSYNC
  2356.  *)
  2357.    DDCAPS2_FLIPNOVSYNC             = $00400000;
  2358.  
  2359. (*
  2360.  * Driver supports management of video memory, if this flag is ON,
  2361.  * driver manages the texture if requested with DDSCAPS2_TEXTUREMANAGE on
  2362.  * DirectX manages the texture if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on
  2363.  *)
  2364.   DDCAPS2_CANMANAGETEXTURE        = $00800000;
  2365.  
  2366. (*
  2367.  * The Direct3D texture manager uses this cap to decide whether to put managed
  2368.  * surfaces in non-local video memory. If the cap is set, the texture manager will
  2369.  * put managed surfaces in non-local vidmem. Drivers that cannot texture from
  2370.  * local vidmem SHOULD NOT set this cap.
  2371.  *)
  2372.   DDCAPS2_TEXMANINNONLOCALVIDMEM  = $01000000;
  2373.  
  2374. (*
  2375.  * Indicates that the driver supports DX7 type of stereo in at least one mode (which may
  2376.  * not necessarily be the current mode). Applications should use IDirectDraw7 (or higher)
  2377.  * ::EnumDisplayModes and check the DDSURFACEDESC.ddsCaps.dwCaps2 field for the presence of
  2378.  * DDSCAPS2_STEREOSURFACELEFT to check if a particular mode supports stereo. The application
  2379.  * can also use IDirectDraw7(or higher)::GetDisplayMode to check the current mode.
  2380.  *)
  2381.   DDCAPS2_STEREO                  = $02000000;
  2382.  
  2383. (*
  2384.  * This caps bit is intended for internal DirectDraw use.
  2385.  * -It is only valid if DDCAPS2_NONLOCALVIDMEMCAPS is set.
  2386.  * -If this bit is set, then DDCAPS_CANBLTSYSMEM MUST be set by the driver (and
  2387.  *  all the assoicated system memory blt caps must be correct).
  2388.  * -It implies that the system->video blt caps in DDCAPS also apply to system to
  2389.  *  nonlocal blts. I.e. the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops
  2390.  *  members of DDCAPS (DDCORECAPS) are filled in correctly.
  2391.  * -Any blt from system to nonlocal memory that matches these caps bits will
  2392.  *  be passed to the driver.
  2393.  *
  2394.  * NOTE: This is intended to enable the driver itself to do efficient reordering
  2395.  * of textures. This is NOT meant to imply that hardware can write into AGP memory.
  2396.  * This operation is not currently supported.
  2397.  *)
  2398.   DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL   = $04000000;
  2399.  
  2400. (****************************************************************************
  2401.  *
  2402.  * DIRECTDRAW FX ALPHA CAPABILITY FLAGS
  2403.  *
  2404.  ****************************************************************************)
  2405.  
  2406. (*
  2407.  * Supports alpha blending around the edge of a source color keyed surface.
  2408.  * For Blt.
  2409.  *)
  2410.   DDFXALPHACAPS_BLTALPHAEDGEBLEND         = $00000001;
  2411.  
  2412. (*
  2413.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2414.  * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
  2415.  * more opaque as the alpha value increases.  (0 is transparent.)
  2416.  * For Blt.
  2417.  *)
  2418.   DDFXALPHACAPS_BLTALPHAPIXELS            = $00000002;
  2419.  
  2420. (*
  2421.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2422.  * information in the pixel format can be 1,2,4, or 8.  The alpha value
  2423.  * becomes more transparent as the alpha value increases.  (0 is opaque.)
  2424.  * This flag can only be set if DDCAPS_ALPHA is set.
  2425.  * For Blt.
  2426.  *)
  2427.   DDFXALPHACAPS_BLTALPHAPIXELSNEG         = $00000004;
  2428.  
  2429. (*
  2430.  * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
  2431.  * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
  2432.  * (0 is transparent.)
  2433.  * For Blt.
  2434.  *)
  2435.   DDFXALPHACAPS_BLTALPHASURFACES          = $00000008;
  2436.  
  2437. (*
  2438.  * The depth of the alpha channel data can range can be 1,2,4, or 8.
  2439.  * The NEG suffix indicates that this alpha channel becomes more transparent
  2440.  * as the alpha value increases. (0 is opaque.)  This flag can only be set if
  2441.  * DDCAPS_ALPHA is set.
  2442.  * For Blt.
  2443.  *)
  2444.   DDFXALPHACAPS_BLTALPHASURFACESNEG       = $00000010;
  2445.  
  2446. (*
  2447.  * Supports alpha blending around the edge of a source color keyed surface.
  2448.  * For Overlays.
  2449.  *)
  2450.   DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND     = $00000020;
  2451.  
  2452. (*
  2453.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2454.  * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
  2455.  * more opaque as the alpha value increases.  (0 is transparent.)
  2456.  * For Overlays.
  2457.  *)
  2458.   DDFXALPHACAPS_OVERLAYALPHAPIXELS        = $00000040;
  2459.  
  2460. (*
  2461.  * Supports alpha information in the pixel format.  The bit depth of alpha
  2462.  * information in the pixel format can be 1,2,4, or 8.  The alpha value
  2463.  * becomes more transparent as the alpha value increases.  (0 is opaque.)
  2464.  * This flag can only be set if DDCAPS_ALPHA is set.
  2465.  * For Overlays.
  2466.  *)
  2467.   DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG     = $00000080;
  2468.  
  2469. (*
  2470.  * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
  2471.  * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
  2472.  * (0 is transparent.)
  2473.  * For Overlays.
  2474.  *)
  2475.   DDFXALPHACAPS_OVERLAYALPHASURFACES      = $00000100;
  2476.  
  2477. (*
  2478.  * The depth of the alpha channel data can range can be 1,2,4, or 8.  
  2479.  * The NEG suffix indicates that this alpha channel becomes more transparent
  2480.  * as the alpha value increases. (0 is opaque.)  This flag can only be set if
  2481.  * DDCAPS_ALPHA is set.
  2482.  * For Overlays.
  2483.  *)
  2484.   DDFXALPHACAPS_OVERLAYALPHASURFACESNEG   = $00000200;
  2485.  
  2486. (****************************************************************************
  2487.  *
  2488.  * DIRECTDRAW FX CAPABILITY FLAGS
  2489.  *
  2490.  ****************************************************************************)
  2491.  
  2492. (*
  2493.  * Uses arithmetic operations to stretch and shrink surfaces during blt
  2494.  * rather than pixel doubling techniques.  Along the Y axis.
  2495.  *)
  2496.   DDFXCAPS_BLTARITHSTRETCHY       = $00000020;
  2497.  
  2498. (*
  2499.  * Uses arithmetic operations to stretch during blt
  2500.  * rather than pixel doubling techniques.  Along the Y axis. Only
  2501.  * works for x1, x2, etc.
  2502.  *)
  2503.   DDFXCAPS_BLTARITHSTRETCHYN      = $00000010;
  2504.  
  2505. (*
  2506.  * Supports mirroring left to right in blt.
  2507.  *)
  2508.   DDFXCAPS_BLTMIRRORLEFTRIGHT     = $00000040;
  2509.  
  2510. (*
  2511.  * Supports mirroring top to bottom in blt.
  2512.  *)
  2513.   DDFXCAPS_BLTMIRRORUPDOWN        = $00000080;
  2514.  
  2515. (*
  2516.  * Supports arbitrary rotation for blts.
  2517.  *)
  2518.   DDFXCAPS_BLTROTATION            = $00000100;
  2519.  
  2520. (*
  2521.  * Supports 90 degree rotations for blts.
  2522.  *)
  2523.    DDFXCAPS_BLTROTATION90          = $00000200;
  2524.  
  2525. (*
  2526.  * DirectDraw supports arbitrary shrinking of a surface along the
  2527.  * x axis (horizontal direction) for blts.
  2528.  *)
  2529.   DDFXCAPS_BLTSHRINKX             = $00000400;
  2530.  
  2531. (*
  2532.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2533.  * along the x axis (horizontal direction) for blts.
  2534.  *)
  2535.   DDFXCAPS_BLTSHRINKXN            = $00000800;
  2536.  
  2537. (*
  2538.  * DirectDraw supports arbitrary shrinking of a surface along the
  2539.  * y axis (horizontal direction) for blts.  
  2540.  *)
  2541.   DDFXCAPS_BLTSHRINKY             = $00001000;
  2542.  
  2543. (*
  2544.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2545.  * along the y axis (vertical direction) for blts.
  2546.  *)
  2547.   DDFXCAPS_BLTSHRINKYN            = $00002000;
  2548.  
  2549. (*
  2550.  * DirectDraw supports arbitrary stretching of a surface along the
  2551.  * x axis (horizontal direction) for blts.
  2552.  *)
  2553.   DDFXCAPS_BLTSTRETCHX            = $00004000;
  2554.  
  2555. (*
  2556.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2557.  * along the x axis (horizontal direction) for blts.
  2558.  *)
  2559.   DDFXCAPS_BLTSTRETCHXN           = $00008000;
  2560.  
  2561. (*
  2562.  * DirectDraw supports arbitrary stretching of a surface along the
  2563.  * y axis (horizontal direction) for blts.  
  2564.  *)
  2565.   DDFXCAPS_BLTSTRETCHY            = $00010000;
  2566.  
  2567. (*
  2568.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2569.  * along the y axis (vertical direction) for blts.  
  2570.  *)
  2571.   DDFXCAPS_BLTSTRETCHYN           = $00020000;
  2572.  
  2573. (*
  2574.  * Uses arithmetic operations to stretch and shrink surfaces during
  2575.  * overlay rather than pixel doubling techniques.  Along the Y axis
  2576.  * for overlays.
  2577.  *)
  2578.   DDFXCAPS_OVERLAYARITHSTRETCHY   = $00040000;
  2579.  
  2580. (*
  2581.  * Uses arithmetic operations to stretch surfaces during
  2582.  * overlay rather than pixel doubling techniques.  Along the Y axis
  2583.  * for overlays. Only works for x1, x2, etc.
  2584.  *)
  2585.   DDFXCAPS_OVERLAYARITHSTRETCHYN  = $00000008;
  2586.  
  2587. (*
  2588.  * DirectDraw supports arbitrary shrinking of a surface along the
  2589.  * x axis (horizontal direction) for overlays.
  2590.  *)
  2591.   DDFXCAPS_OVERLAYSHRINKX         = $00080000;
  2592.  
  2593. (*
  2594.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2595.  * along the x axis (horizontal direction) for overlays.
  2596.  *)
  2597.   DDFXCAPS_OVERLAYSHRINKXN        = $00100000;
  2598.  
  2599. (*
  2600.  * DirectDraw supports arbitrary shrinking of a surface along the
  2601.  * y axis (horizontal direction) for overlays.
  2602.  *)
  2603.   DDFXCAPS_OVERLAYSHRINKY         = $00200000;
  2604.  
  2605. (*
  2606.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  2607.  * along the y axis (vertical direction) for overlays.  
  2608.  *)
  2609.   DDFXCAPS_OVERLAYSHRINKYN        = $00400000;
  2610.  
  2611. (*
  2612.  * DirectDraw supports arbitrary stretching of a surface along the
  2613.  * x axis (horizontal direction) for overlays.
  2614.  *)
  2615.   DDFXCAPS_OVERLAYSTRETCHX        = $00800000;
  2616.  
  2617. (*
  2618.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2619.  * along the x axis (horizontal direction) for overlays.
  2620.  *)
  2621.   DDFXCAPS_OVERLAYSTRETCHXN       = $01000000;
  2622.  
  2623. (*
  2624.  * DirectDraw supports arbitrary stretching of a surface along the
  2625.  * y axis (horizontal direction) for overlays.  
  2626.  *)
  2627.   DDFXCAPS_OVERLAYSTRETCHY        = $02000000;
  2628.  
  2629. (*
  2630.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  2631.  * along the y axis (vertical direction) for overlays.  
  2632.  *)
  2633.   DDFXCAPS_OVERLAYSTRETCHYN       = $04000000;
  2634.  
  2635. (*
  2636.  * DirectDraw supports mirroring of overlays across the vertical axis
  2637.  *)
  2638.   DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000;
  2639.  
  2640. (*
  2641.  * DirectDraw supports mirroring of overlays across the horizontal axis
  2642.  *)
  2643.   DDFXCAPS_OVERLAYMIRRORUPDOWN    = $10000000;
  2644.  
  2645. (*
  2646.  * Driver can do alpha blending for blits.
  2647.  *)
  2648.   DDFXCAPS_BLTALPHA             = $00000001;
  2649.  
  2650. (*
  2651.  * Driver can do geometric transformations (or warps) for blits.
  2652.  *)
  2653.   DDFXCAPS_BLTTRANSFORM         = $00000002;
  2654.  
  2655. (*
  2656.  * Driver can do surface-reconstruction filtering for warped blits.
  2657.  *)
  2658.   DDFXCAPS_BLTFILTER           = DDFXCAPS_BLTARITHSTRETCHY;
  2659.  
  2660. (*
  2661.  * Driver can do alpha blending for overlays.
  2662.  *)
  2663.   DDFXCAPS_OVERLAYALPHA                 = $00000004;
  2664.  
  2665. (*
  2666.  * Driver can do geometric transformations (or warps) for overlays.
  2667.  *)
  2668.   DDFXCAPS_OVERLAYTRANSFORM     = $20000000;
  2669.  
  2670. (*
  2671.  * Driver can do surface-reconstruction filtering for warped overlays.
  2672.  *)
  2673.   DDFXCAPS_OVERLAYFILTER              = DDFXCAPS_OVERLAYARITHSTRETCHY;
  2674.  
  2675. (****************************************************************************
  2676.  *
  2677.  * DIRECTDRAW STEREO VIEW CAPABILITIES
  2678.  *
  2679.  ****************************************************************************)
  2680.  
  2681. (*
  2682.  * This flag used to be DDSVCAPS_ENIGMA, which is now obsolete
  2683.  * The stereo view is accomplished via enigma encoding.
  2684.  *)
  2685.   DDSVCAPS_RESERVED1                 = $00000001;
  2686.   DDSVCAPS_ENIGMA                 = DDSVCAPS_RESERVED1;
  2687.  
  2688. (*
  2689.  * This flag used to be DDSVCAPS_FLICKER, which is now obsolete
  2690.  * The stereo view is accomplished via high frequency flickering.
  2691.  *)
  2692.   DDSVCAPS_RESERVED2                = $00000002;
  2693.   DDSVCAPS_FLICKER                = DDSVCAPS_RESERVED2;
  2694.  
  2695. (*
  2696.  * This flag used to be DDSVCAPS_REDBLUE, which is now obsolete
  2697.  * The stereo view is accomplished via red and blue filters applied
  2698.  * to the left and right eyes.  All images must adapt their colorspaces
  2699.  * for this process.
  2700.  *)
  2701.   DDSVCAPS_RESERVED3                = $00000004;
  2702.   DDSVCAPS_REDBLUE                = DDSVCAPS_RESERVED3;
  2703.  
  2704. (*
  2705.  * This flag used to be DDSVCAPS_SPLIT, which is now obsolete
  2706.  * The stereo view is accomplished with split screen technology.
  2707.  *)
  2708.   DDSVCAPS_RESERVED4                  = $00000008;
  2709.   DDSVCAPS_SPLIT                  = DDSVCAPS_RESERVED4;
  2710.  
  2711. (*
  2712.  * The stereo view is accomplished with switching technology
  2713.  *)
  2714.   DDSVCAPS_STEREOSEQUENTIAL       = $00000010;
  2715.  
  2716. (****************************************************************************
  2717.  *
  2718.  * DIRECTDRAWPALETTE CAPABILITIES
  2719.  *
  2720.  ****************************************************************************)
  2721.  
  2722. (*
  2723.  * Index is 4 bits.  There are sixteen color entries in the palette table.
  2724.  *)
  2725.   DDPCAPS_4BIT                    = $00000001;
  2726.  
  2727. (*
  2728.  * Index is onto a 8 bit color index.  This field is only valid with the
  2729.  * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target
  2730.  * surface is in 8bpp. Each color entry is one byte long and is an index
  2731.  * into destination surface's 8bpp palette.
  2732.  *)
  2733.   DDPCAPS_8BITENTRIES             = $00000002;
  2734.  
  2735. (*
  2736.  * Index is 8 bits.  There are 256 color entries in the palette table.
  2737.  *)
  2738.   DDPCAPS_8BIT                    = $00000004;
  2739.  
  2740. (*
  2741.  * Indicates that this DIRECTDRAWPALETTE should use the palette color array
  2742.  * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE
  2743.  * object.
  2744.  * This flag is obsolete. DirectDraw always initializes the color array from
  2745.  * the lpDDColorArray parameter. The definition remains for source-level
  2746.  * compatibility.
  2747.  *)
  2748.   DDPCAPS_INITIALIZE              = $00000008;
  2749.  
  2750. (*
  2751.  * This palette is the one attached to the primary surface.  Changing this
  2752.  * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified
  2753.  * and supported.
  2754.  *)
  2755.   DDPCAPS_PRIMARYSURFACE          = $00000010;
  2756.  
  2757. (*
  2758.  * This palette is the one attached to the primary surface left.  Changing
  2759.  * this table has immediate effect on the display for the left eye unless
  2760.  * DDPSETPAL_VSYNC is specified and supported.
  2761.  *)
  2762.   DDPCAPS_PRIMARYSURFACELEFT      = $00000020;
  2763.  
  2764. (*
  2765.  * This palette can have all 256 entries defined
  2766.  *)
  2767.   DDPCAPS_ALLOW256                = $00000040;
  2768.  
  2769. (*
  2770.  * This palette can have modifications to it synced with the monitors
  2771.  * refresh rate.
  2772.  *)
  2773.   DDPCAPS_VSYNC                   = $00000080;
  2774.  
  2775. (*
  2776.  * Index is 1 bit.  There are two color entries in the palette table.
  2777.  *)
  2778.   DDPCAPS_1BIT                    = $00000100;
  2779.  
  2780. (*
  2781.  * Index is 2 bit.  There are four color entries in the palette table.
  2782.  *)
  2783.   DDPCAPS_2BIT                    = $00000200;
  2784.  
  2785. (*
  2786.  * The peFlags member of PALETTEENTRY denotes an 8 bit alpha value
  2787.  *)
  2788.   DDPCAPS_ALPHA                 = $00000400;
  2789.  
  2790. (****************************************************************************
  2791.  *
  2792.  * DIRECTDRAWPALETTE SETENTRY CONSTANTS
  2793.  *
  2794.  ****************************************************************************)
  2795.  
  2796.  
  2797. (****************************************************************************
  2798.  *
  2799.  * DIRECTDRAWPALETTE GETENTRY CONSTANTS
  2800.  *
  2801.  ****************************************************************************)
  2802.  
  2803. (* 0 is the only legal value *)
  2804.  
  2805. (****************************************************************************
  2806.  *
  2807.  * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
  2808.  *
  2809.  ****************************************************************************)
  2810.  
  2811. (*
  2812.  * The passed pointer is an IUnknown ptr. The cbData argument to SetPrivateData
  2813.  * must be set to sizeof(IUnknown^). DirectDraw will call AddRef through this
  2814.  * pointer and Release when the private data is destroyed. This includes when
  2815.  * the surface or palette is destroyed before such priovate data is destroyed.
  2816.  *)
  2817.   DDSPD_IUNKNOWNPOINTER           = $00000001;
  2818.  
  2819. (*
  2820.  * Private data is only valid for the current state of the object,
  2821.  * as determined by the uniqueness value.
  2822.  *)
  2823.   DDSPD_VOLATILE                  = $00000002;
  2824.  
  2825. (****************************************************************************
  2826.  *
  2827.  * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
  2828.  *
  2829.  ****************************************************************************)
  2830.  
  2831.  
  2832. (****************************************************************************
  2833.  *
  2834.  * DIRECTDRAW BITDEPTH CONSTANTS
  2835.  *
  2836.  * NOTE:  These are only used to indicate supported bit depths.   These
  2837.  * are flags only, they are not to be used as an actual bit depth.   The
  2838.  * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual
  2839.  * bit depths in a surface or for changing the display mode.
  2840.  *
  2841.  ****************************************************************************)
  2842.  
  2843. (*
  2844.  * 1 bit per pixel.
  2845.  *)
  2846.   DDBD_1                  = $00004000;
  2847.  
  2848. (*
  2849.  * 2 bits per pixel.
  2850.  *)
  2851.   DDBD_2                  = $00002000;
  2852.  
  2853. (*
  2854.  * 4 bits per pixel.
  2855.  *)
  2856.   DDBD_4                  = $00001000;
  2857.  
  2858. (*
  2859.  * 8 bits per pixel.
  2860.  *)
  2861.   DDBD_8                  = $00000800;
  2862.  
  2863. (*
  2864.  * 16 bits per pixel.
  2865.  *)
  2866.   DDBD_16                 = $00000400;
  2867.  
  2868. (*
  2869.  * 24 bits per pixel.
  2870.  *)
  2871.   DDBD_24                 = $00000200;
  2872.  
  2873. (*
  2874.  * 32 bits per pixel.
  2875.  *)
  2876.   DDBD_32                 = $00000100;
  2877.  
  2878. (****************************************************************************
  2879.  *
  2880.  * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS
  2881.  *
  2882.  ****************************************************************************)
  2883.  
  2884. (*
  2885.  * Set if the structure contains a color space.  Not set if the structure
  2886.  * contains a single color key.
  2887.  *)
  2888.   DDCKEY_COLORSPACE       = $00000001;
  2889.  
  2890. (*
  2891.  * Set if the structure specifies a color key or color space which is to be
  2892.  * used as a destination color key for blt operations.
  2893.  *)
  2894.   DDCKEY_DESTBLT          = $00000002;
  2895.  
  2896. (*
  2897.  * Set if the structure specifies a color key or color space which is to be
  2898.  * used as a destination color key for overlay operations.
  2899.  *)
  2900.   DDCKEY_DESTOVERLAY      = $00000004;
  2901.  
  2902. (*
  2903.  * Set if the structure specifies a color key or color space which is to be
  2904.  * used as a source color key for blt operations.
  2905.  *)
  2906.   DDCKEY_SRCBLT           = $00000008;
  2907.  
  2908. (*
  2909.  * Set if the structure specifies a color key or color space which is to be
  2910.  * used as a source color key for overlay operations.
  2911.  *)
  2912.   DDCKEY_SRCOVERLAY       = $00000010;
  2913.  
  2914.  
  2915. (****************************************************************************
  2916.  *
  2917.  * DIRECTDRAW COLOR KEY CAPABILITY FLAGS
  2918.  *
  2919.  ****************************************************************************)
  2920.  
  2921. (*
  2922.  * Supports transparent blting using a color key to identify the replaceable
  2923.  * bits of the destination surface for RGB colors.
  2924.  *)
  2925.   DDCKEYCAPS_DESTBLT                      = $00000001;
  2926.  
  2927. (*
  2928.  * Supports transparent blting using a color space to identify the replaceable
  2929.  * bits of the destination surface for RGB colors.
  2930.  *)
  2931.   DDCKEYCAPS_DESTBLTCLRSPACE              = $00000002;
  2932.  
  2933. (*
  2934.  * Supports transparent blting using a color space to identify the replaceable
  2935.  * bits of the destination surface for YUV colors.
  2936.  *)
  2937.   DDCKEYCAPS_DESTBLTCLRSPACEYUV           = $00000004;
  2938.  
  2939. (*
  2940.  * Supports transparent blting using a color key to identify the replaceable
  2941.  * bits of the destination surface for YUV colors.
  2942.  *)
  2943.   DDCKEYCAPS_DESTBLTYUV                   = $00000008;
  2944.  
  2945. (*
  2946.  * Supports overlaying using colorkeying of the replaceable bits of the surface
  2947.  * being overlayed for RGB colors.
  2948.  *)
  2949.   DDCKEYCAPS_DESTOVERLAY                  = $00000010;
  2950.  
  2951. (*
  2952.  * Supports a color space as the color key for the destination for RGB colors.
  2953.  *)
  2954.   DDCKEYCAPS_DESTOVERLAYCLRSPACE          = $00000020;
  2955.  
  2956. (*
  2957.  * Supports a color space as the color key for the destination for YUV colors.
  2958.  *)
  2959.   DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV       = $00000040;
  2960.  
  2961. (*
  2962.  * Supports only one active destination color key value for visible overlay
  2963.  * surfaces.
  2964.  *)
  2965.   DDCKEYCAPS_DESTOVERLAYONEACTIVE         = $00000080;
  2966.  
  2967. (*
  2968.  * Supports overlaying using colorkeying of the replaceable bits of the
  2969.  * surface being overlayed for YUV colors.
  2970.  *)
  2971.   DDCKEYCAPS_DESTOVERLAYYUV               = $00000100;
  2972.  
  2973. (*
  2974.  * Supports transparent blting using the color key for the source with
  2975.  * this surface for RGB colors.
  2976.  *)
  2977.   DDCKEYCAPS_SRCBLT                       = $00000200;
  2978.  
  2979. (*
  2980.  * Supports transparent blting using a color space for the source with
  2981.  * this surface for RGB colors.
  2982.  *)
  2983.   DDCKEYCAPS_SRCBLTCLRSPACE               = $00000400;
  2984.  
  2985. (*
  2986.  * Supports transparent blting using a color space for the source with
  2987.  * this surface for YUV colors.
  2988.  *)
  2989.   DDCKEYCAPS_SRCBLTCLRSPACEYUV            = $00000800;
  2990.  
  2991. (*
  2992.  * Supports transparent blting using the color key for the source with
  2993.  * this surface for YUV colors.
  2994.  *)
  2995.   DDCKEYCAPS_SRCBLTYUV                    = $00001000;
  2996.  
  2997. (*
  2998.  * Supports overlays using the color key for the source with this
  2999.  * overlay surface for RGB colors.
  3000.  *)
  3001.   DDCKEYCAPS_SRCOVERLAY                   = $00002000;
  3002.  
  3003. (*
  3004.  * Supports overlays using a color space as the source color key for
  3005.  * the overlay surface for RGB colors.
  3006.  *)
  3007.   DDCKEYCAPS_SRCOVERLAYCLRSPACE           = $00004000;
  3008.  
  3009. (*
  3010.  * Supports overlays using a color space as the source color key for
  3011.  * the overlay surface for YUV colors.
  3012.  *)
  3013.   DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV        = $00008000;
  3014.  
  3015. (*
  3016.  * Supports only one active source color key value for visible
  3017.  * overlay surfaces.
  3018.  *)
  3019.   DDCKEYCAPS_SRCOVERLAYONEACTIVE          = $00010000;
  3020.  
  3021. (*
  3022.  * Supports overlays using the color key for the source with this
  3023.  * overlay surface for YUV colors.
  3024.  *)
  3025.   DDCKEYCAPS_SRCOVERLAYYUV                = $00020000;
  3026.  
  3027. (*
  3028.  * there are no bandwidth trade-offs for using colorkey with an overlay
  3029.  *)
  3030.   DDCKEYCAPS_NOCOSTOVERLAY                = $00040000;
  3031.  
  3032.  
  3033. (****************************************************************************
  3034.  *
  3035.  * DIRECTDRAW PIXELFORMAT FLAGS
  3036.  *
  3037.  ****************************************************************************)
  3038.  
  3039. (*
  3040.  * The surface has alpha channel information in the pixel format.
  3041.  *)
  3042.   DDPF_ALPHAPIXELS                        = $00000001;
  3043.  
  3044. (*
  3045.  * The pixel format contains alpha only information
  3046.  *)
  3047.   DDPF_ALPHA                              = $00000002;
  3048.  
  3049. (*
  3050.  * The FourCC code is valid.
  3051.  *)
  3052.   DDPF_FOURCC                             = $00000004;
  3053.  
  3054. (*
  3055.  * The surface is 4-bit color indexed.
  3056.  *)
  3057.   DDPF_PALETTEINDEXED4                    = $00000008;
  3058.  
  3059. (*
  3060.  * The surface is indexed into a palette which stores indices
  3061.  * into the destination surface's 8-bit palette.
  3062.  *)
  3063.   DDPF_PALETTEINDEXEDTO8                  = $00000010;
  3064.  
  3065. (*
  3066.  * The surface is 8-bit color indexed.
  3067.  *)
  3068.   DDPF_PALETTEINDEXED8                    = $00000020;
  3069.  
  3070. (*
  3071.  * The RGB data in the pixel format structure is valid.
  3072.  *)
  3073.   DDPF_RGB                                = $00000040;
  3074.  
  3075. (*
  3076.  * The surface will accept pixel data in the format specified
  3077.  * and compress it during the write.
  3078.  *)
  3079.   DDPF_COMPRESSED                         = $00000080;
  3080.  
  3081. (*
  3082.  * The surface will accept RGB data and translate it during
  3083.  * the write to YUV data.  The format of the data to be written
  3084.  * will be contained in the pixel format structure.  The DDPF_RGB
  3085.  * flag will be set.
  3086.  *)
  3087.   DDPF_RGBTOYUV                           = $00000100;
  3088.  
  3089. (*
  3090.  * pixel format is YUV - YUV data in pixel format struct is valid
  3091.  *)
  3092.   DDPF_YUV                                = $00000200;
  3093.  
  3094. (*
  3095.  * pixel format is a z buffer only surface
  3096.  *)
  3097.   DDPF_ZBUFFER                            = $00000400;
  3098.  
  3099. (*
  3100.  * The surface is 1-bit color indexed.
  3101.  *)
  3102.   DDPF_PALETTEINDEXED1                    = $00000800;
  3103.  
  3104. (*
  3105.  * The surface is 2-bit color indexed.
  3106.  *)
  3107.   DDPF_PALETTEINDEXED2                    = $00001000;
  3108.  
  3109. (*
  3110.  * The surface contains Z information in the pixels
  3111.  *)
  3112.   DDPF_ZPIXELS                          = $00002000;
  3113.  
  3114. (*
  3115.  * The surface contains stencil information along with Z
  3116.  *)
  3117.   DDPF_STENCILBUFFER                    = $00004000;
  3118.  
  3119. (*
  3120.  * Premultiplied alpha format -- the color components have been
  3121.  * premultiplied by the alpha component.
  3122.  *)
  3123.   DDPF_ALPHAPREMULT                     = $00008000;
  3124.  
  3125.  
  3126. (*
  3127.  * Luminance data in the pixel format is valid.
  3128.  * Use this flag for luminance-only or luminance+alpha surfaces,
  3129.  * the bit depth is then ddpf.dwLuminanceBitCount.
  3130.  *)
  3131.   DDPF_LUMINANCE                          = $00020000;
  3132.  
  3133. (*
  3134.  * Luminance data in the pixel format is valid.
  3135.  * Use this flag when hanging luminance off bumpmap surfaces,
  3136.  * the bit mask for the luminance portion of the pixel is then
  3137.  * ddpf.dwBumpLuminanceBitMask
  3138.  *)
  3139.   DDPF_BUMPLUMINANCE                      = $00040000;
  3140.  
  3141. (*
  3142.  * Bump map dUdV data in the pixel format is valid.
  3143.  *)
  3144.   DDPF_BUMPDUDV                           = $00080000;
  3145.  
  3146. (*===========================================================================
  3147.  *
  3148.  *
  3149.  * DIRECTDRAW CALLBACK FLAGS
  3150.  *
  3151.  *
  3152.  *==========================================================================*)
  3153.  
  3154. (****************************************************************************
  3155.  *
  3156.  * DIRECTDRAW ENUMSURFACES FLAGS
  3157.  *
  3158.  ****************************************************************************)
  3159.  
  3160. (*
  3161.  * Enumerate all of the surfaces that meet the search criterion.
  3162.  *)
  3163.   DDENUMSURFACES_ALL                      = $00000001;
  3164.  
  3165. (*
  3166.  * A search hit is a surface that matches the surface description.
  3167.  *)
  3168.   DDENUMSURFACES_MATCH                    = $00000002;
  3169.  
  3170. (*
  3171.  * A search hit is a surface that does not match the surface description.
  3172.  *)
  3173.   DDENUMSURFACES_NOMATCH                  = $00000004;
  3174.  
  3175. (*
  3176.  * Enumerate the first surface that can be created which meets the search criterion.
  3177.  *)
  3178.   DDENUMSURFACES_CANBECREATED             = $00000008;
  3179.  
  3180. (*
  3181.  * Enumerate the surfaces that already exist that meet the search criterion.
  3182.  *)
  3183.   DDENUMSURFACES_DOESEXIST                = $00000010;
  3184.  
  3185. (****************************************************************************
  3186.  *
  3187.  * DIRECTDRAW SETDISPLAYMODE FLAGS
  3188.  *
  3189.  ****************************************************************************)
  3190.  
  3191. (*
  3192.  * The desired mode is a standard VGA mode
  3193.  *)
  3194.   DDSDM_STANDARDVGAMODE                   = $00000001;
  3195.  
  3196. (****************************************************************************
  3197.  *
  3198.  * DIRECTDRAW ENUMDISPLAYMODES FLAGS
  3199.  *
  3200.  ****************************************************************************)
  3201.  
  3202. (*
  3203.  * Enumerate Modes with different refresh rates.  EnumDisplayModes guarantees
  3204.  * that a particular mode will be enumerated only once.  This flag specifies whether
  3205.  * the refresh rate is taken into account when determining if a mode is unique.
  3206.  *)
  3207.   DDEDM_REFRESHRATES                      = $00000001;
  3208.  
  3209. (*
  3210.  * Enumerate VGA modes. Specify this flag if you wish to enumerate supported VGA
  3211.  * modes such as mode 0x13 in addition to the usual ModeX modes (which are always
  3212.  * enumerated if the application has previously called SetCooperativeLevel with the
  3213.  * DDSCL_ALLOWMODEX flag set).
  3214.  *)
  3215.   DDEDM_STANDARDVGAMODES                  = $00000002;
  3216.  
  3217.  
  3218. (****************************************************************************
  3219.  *
  3220.  * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS
  3221.  *
  3222.  ****************************************************************************)
  3223.  
  3224. (*
  3225.  * Exclusive mode owner will be responsible for the entire primary surface.
  3226.  * GDI can be ignored. used with DD
  3227.  *)
  3228.   DDSCL_FULLSCREEN                        = $00000001;
  3229.  
  3230. (*
  3231.  * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode
  3232.  *)
  3233.   DDSCL_ALLOWREBOOT                       = $00000002;
  3234.  
  3235. (*
  3236.  * prevents DDRAW from modifying the application window.
  3237.  * prevents DDRAW from minimize/restore the application window on activation.
  3238.  *)
  3239.   DDSCL_NOWINDOWCHANGES                   = $00000004;
  3240.  
  3241. (*
  3242.  * app wants to work as a regular Windows application
  3243.  *)
  3244.   DDSCL_NORMAL                            = $00000008;
  3245.  
  3246. (*
  3247.  * app wants exclusive access
  3248.  *)
  3249.   DDSCL_EXCLUSIVE                         = $00000010;
  3250.  
  3251.  
  3252. (*
  3253.  * app can deal with non-windows display modes
  3254.  *)
  3255.   DDSCL_ALLOWMODEX                        = $00000040;
  3256.  
  3257. (*
  3258.  * this window will receive the focus messages
  3259.  *)
  3260.   DDSCL_SETFOCUSWINDOW                    = $00000080;
  3261.  
  3262. (*
  3263.  * this window is associated with the DDRAW object and will
  3264.  * cover the screen in fullscreen mode
  3265.  *)
  3266.   DDSCL_SETDEVICEWINDOW                   = $00000100;
  3267.  
  3268. (*
  3269.  * app wants DDRAW to create a window to be associated with the
  3270.  * DDRAW object
  3271.  *)
  3272.   DDSCL_CREATEDEVICEWINDOW                = $00000200;
  3273.  
  3274. (*
  3275.  * App explicitly asks DDRAW/D3D to be multithread safe. This makes D3D
  3276.  * take the global crtisec more frequently.
  3277.  *)
  3278.   DDSCL_MULTITHREADED                     = $00000400;
  3279.  
  3280. (*
  3281.  * App hints that it would like to keep the FPU set up for optimal Direct3D
  3282.  * performance (single precision and exceptions disabled) so Direct3D
  3283.  * does not need to explicitly set the FPU each time
  3284.  *)
  3285.   DDSCL_FPUSETUP                          = $00000800;
  3286.  
  3287. (*
  3288.  * App specifies that it needs either double precision FPU or FPU exceptions
  3289.  * enabled. This makes Direct3D explicitly set the FPU state eah time it is
  3290.  * called. Setting the flag will reduce Direct3D performance. The flag is
  3291.  * assumed by default in DirectX 6 and earlier. See also DDSCL_FPUSETUP
  3292.  *)
  3293.   DDSCL_FPUPRESERVE                          = $00001000;
  3294.  
  3295. (****************************************************************************
  3296.  *
  3297.  * DIRECTDRAW BLT FLAGS
  3298.  *
  3299.  ****************************************************************************)
  3300.  
  3301. (*
  3302.  * Use the alpha information in the pixel format or the alpha channel surface
  3303.  * attached to the destination surface as the alpha channel for this blt.
  3304.  *)
  3305.   DDBLT_ALPHADEST                         = $00000001;
  3306.  
  3307. (*
  3308.  * Use the dwConstAlphaDest field in the TDDBltFX structure as the alpha channel
  3309.  * for the destination surface for this blt.
  3310.  *)
  3311.   DDBLT_ALPHADESTCONSTOVERRIDE            = $00000002;
  3312.  
  3313. (*
  3314.  * The NEG suffix indicates that the destination surface becomes more
  3315.  * transparent as the alpha value increases. (0 is opaque)
  3316.  *)
  3317.   DDBLT_ALPHADESTNEG                      = $00000004;
  3318.  
  3319. (*
  3320.  * Use the lpDDSAlphaDest field in the TDDBltFX structure as the alpha
  3321.  * channel for the destination for this blt.
  3322.  *)
  3323.   DDBLT_ALPHADESTSURFACEOVERRIDE          = $00000008;
  3324.  
  3325. (*
  3326.  * Use the dwAlphaEdgeBlend field in the TDDBltFX structure as the alpha channel
  3327.  * for the edges of the image that border the color key colors.
  3328.  *)
  3329.   DDBLT_ALPHAEDGEBLEND                    = $00000010;
  3330.  
  3331. (*
  3332.  * Use the alpha information in the pixel format or the alpha channel surface
  3333.  * attached to the source surface as the alpha channel for this blt.
  3334.  *)
  3335.   DDBLT_ALPHASRC                          = $00000020;
  3336.  
  3337. (*
  3338.  * Use the dwConstAlphaSrc field in the TDDBltFX structure as the alpha channel
  3339.  * for the source for this blt.
  3340.  *)
  3341.   DDBLT_ALPHASRCCONSTOVERRIDE             = $00000040;
  3342.  
  3343. (*
  3344.  * The NEG suffix indicates that the source surface becomes more transparent
  3345.  * as the alpha value increases. (0 is opaque)
  3346.  *)
  3347.   DDBLT_ALPHASRCNEG                       = $00000080;
  3348.  
  3349. (*
  3350.  * Use the lpDDSAlphaSrc field in the TDDBltFX structure as the alpha channel
  3351.  * for the source for this blt.
  3352.  *)
  3353.   DDBLT_ALPHASRCSURFACEOVERRIDE           = $00000100;
  3354.  
  3355. (*
  3356.  * Do this blt asynchronously through the FIFO in the order received.  If
  3357.  * there is no room in the hardware FIFO fail the call.
  3358.  *)
  3359.   DDBLT_ASYNC                             = $00000200;
  3360.  
  3361. (*
  3362.  * Uses the dwFillColor field in the TDDBltFX structure as the RGB color
  3363.  * to fill the destination rectangle on the destination surface with.
  3364.  *)
  3365.   DDBLT_COLORFILL                         = $00000400;
  3366.  
  3367. (*
  3368.  * Uses the dwDDFX field in the TDDBltFX structure to specify the effects
  3369.  * to use for the blt.
  3370.  *)
  3371.   DDBLT_DDFX                              = $00000800;
  3372.  
  3373. (*
  3374.  * Uses the dwDDROPS field in the TDDBltFX structure to specify the ROPS
  3375.  * that are not part of the Win32 API.
  3376.  *)
  3377.   DDBLT_DDROPS                            = $00001000;
  3378.  
  3379. (*
  3380.  * Use the color key associated with the destination surface.
  3381.  *)
  3382.   DDBLT_KEYDEST                           = $00002000;
  3383.  
  3384. (*
  3385.  * Use the dckDestColorkey field in the TDDBltFX structure as the color key
  3386.  * for the destination surface.
  3387.  *)
  3388.   DDBLT_KEYDESTOVERRIDE                   = $00004000;
  3389.  
  3390. (*
  3391.  * Use the color key associated with the source surface.
  3392.  *)
  3393.   DDBLT_KEYSRC                            = $00008000;
  3394.  
  3395. (*
  3396.  * Use the dckSrcColorkey field in the TDDBltFX structure as the color key
  3397.  * for the source surface.
  3398.  *)
  3399.   DDBLT_KEYSRCOVERRIDE                    = $00010000;
  3400.  
  3401. (*
  3402.  * Use the dwROP field in the TDDBltFX structure for the raster operation
  3403.  * for this blt.  These ROPs are the same as the ones defined in the Win32 API.
  3404.  *)
  3405.   DDBLT_ROP                               = $00020000;
  3406.  
  3407. (*
  3408.  * Use the dwRotationAngle field in the TDDBltFX structure as the angle
  3409.  * (specified in 1/100th of a degree) to rotate the surface.
  3410.  *)
  3411.   DDBLT_ROTATIONANGLE                     = $00040000;
  3412.  
  3413. (*
  3414.  * Z-buffered blt using the z-buffers attached to the source and destination
  3415.  * surfaces and the dwZBufferOpCode field in the TDDBltFX structure as the
  3416.  * z-buffer opcode.
  3417.  *)
  3418.   DDBLT_ZBUFFER                           = $00080000;
  3419.  
  3420. (*
  3421.  * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field
  3422.  * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
  3423.  * for the destination.
  3424.  *)
  3425.   DDBLT_ZBUFFERDESTCONSTOVERRIDE          = $00100000;
  3426.  
  3427. (*
  3428.  * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode
  3429.  * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
  3430.  * respectively for the destination.
  3431.  *)
  3432.   DDBLT_ZBUFFERDESTOVERRIDE               = $00200000;
  3433.  
  3434. (*
  3435.  * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field
  3436.  * in the TDDBltFX structure as the z-buffer and z-buffer opcode respectively
  3437.  * for the source.
  3438.  *)
  3439.   DDBLT_ZBUFFERSRCCONSTOVERRIDE           = $00400000;
  3440.  
  3441. (*
  3442.  * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode
  3443.  * field in the TDDBltFX structure as the z-buffer and z-buffer opcode
  3444.  * respectively for the source.
  3445.  *)
  3446.    DDBLT_ZBUFFERSRCOVERRIDE                = $00800000;
  3447.  
  3448. (*
  3449.  * wait until the device is ready to handle the blt
  3450.  * this will cause blt to not return DDERR_WASSTILLDRAWING
  3451.  *)
  3452.   DDBLT_WAIT                              = $01000000;
  3453.  
  3454. (*
  3455.  * Uses the dwFillDepth field in the TDDBltFX structure as the depth value
  3456.  * to fill the destination rectangle on the destination Z-buffer surface
  3457.  * with.
  3458.  *)
  3459.   DDBLT_DEPTHFILL                         = $02000000;
  3460.  
  3461. (*
  3462.  * wait until the device is ready to handle the blt
  3463.  * this will cause blt to not return DDERR_WASSTILLDRAWING
  3464.  *)
  3465.   DDBLT_DONOTWAIT                         = $08000000;
  3466.  
  3467. (****************************************************************************
  3468.  *
  3469.  * BLTFAST FLAGS
  3470.  *
  3471.  ****************************************************************************)
  3472.  
  3473.   DDBLTFAST_NOCOLORKEY                    = $00000000;
  3474.   DDBLTFAST_SRCCOLORKEY                   = $00000001;
  3475.   DDBLTFAST_DESTCOLORKEY                  = $00000002;
  3476.   DDBLTFAST_WAIT                          = $00000010;
  3477.   DDBLTFAST_DONOTWAIT                     = $00000020;
  3478.  
  3479. (****************************************************************************
  3480.  *
  3481.  * FLIP FLAGS
  3482.  *
  3483.  ****************************************************************************)
  3484.  
  3485.  
  3486.   DDFLIP_WAIT                          = $00000001;
  3487.  
  3488. (*
  3489.  * Indicates that the target surface contains the even field of video data.
  3490.  * This flag is only valid with an overlay surface.
  3491.  *)
  3492.   DDFLIP_EVEN                          = $00000002;
  3493.  
  3494. (*
  3495.  * Indicates that the target surface contains the odd field of video data.
  3496.  * This flag is only valid with an overlay surface.
  3497.  *)
  3498.   DDFLIP_ODD                           = $00000004;
  3499.  
  3500. (*
  3501.  * Causes DirectDraw to perform the physical flip immediately and return
  3502.  * to the application. Typically, what was the front buffer but is now the back
  3503.  * buffer will still be visible (depending on timing) until the next vertical
  3504.  * retrace. Subsequent operations involving the two flipped surfaces will
  3505.  * not check to see if the physical flip has finished (i.e. will not return
  3506.  * DDERR_WASSTILLDRAWING for that reason (but may for other reasons)).
  3507.  * This allows an application to perform Flips at a higher frequency than the
  3508.  * monitor refresh rate, but may introduce visible artifacts.
  3509.  * Only effective if DDCAPS2_FLIPNOVSYNC is set. If that bit is not set,
  3510.  * DDFLIP_NOVSYNC has no effect.
  3511.  *)
  3512.   DDFLIP_NOVSYNC                       = $00000008;
  3513.  
  3514.  
  3515. (*
  3516.  * Flip Interval Flags. These flags indicate how many vertical retraces to wait between
  3517.  * each flip. The default is one. DirectDraw will return DDERR_WASSTILLDRAWING for each
  3518.  * surface involved in the flip until the specified number of vertical retraces has
  3519.  * ocurred. Only effective if DDCAPS2_FLIPINTERVAL is set. If that bit is not set,
  3520.  * DDFLIP_INTERVALn has no effect.
  3521.  *)
  3522.  
  3523. (*
  3524.  * DirectDraw will flip on every other vertical sync
  3525.  *)
  3526.   DDFLIP_INTERVAL2                     = $02000000;
  3527.  
  3528.  
  3529. (*
  3530.  * DirectDraw will flip on every third vertical sync
  3531.  *)
  3532.   DDFLIP_INTERVAL3                     = $03000000;
  3533.  
  3534.  
  3535. (*
  3536.  * DirectDraw will flip on every fourth vertical sync
  3537.  *)
  3538.   DDFLIP_INTERVAL4                     = $04000000;
  3539.  
  3540. (*
  3541.  * DirectDraw will flip and display a main stereo surface
  3542.  *)
  3543.   DDFLIP_STEREO                        = $00000010;
  3544.  
  3545. (*
  3546.  * On IDirectDrawSurface7 and higher interfaces, the default is DDFLIP_WAIT. If you wish
  3547.  * to override the default and use time when the accelerator is busy (as denoted by
  3548.  * the DDERR_WASSTILLDRAWING return code) then use DDFLIP_DONOTWAIT.
  3549.  *)
  3550.   DDFLIP_DONOTWAIT                     = $00000020;
  3551.  
  3552. (****************************************************************************
  3553.  *
  3554.  * DIRECTDRAW SURFACE OVERLAY FLAGS
  3555.  *
  3556.  ****************************************************************************)
  3557.  
  3558. (*
  3559.  * Use the alpha information in the pixel format or the alpha channel surface
  3560.  * attached to the destination surface as the alpha channel for the
  3561.  * destination overlay.
  3562.  *)
  3563.   DDOVER_ALPHADEST                        = $00000001;
  3564.  
  3565. (*
  3566.  * Use the dwConstAlphaDest field in the TDDOverlayFX structure as the
  3567.  * destination alpha channel for this overlay.
  3568.  *)
  3569.   DDOVER_ALPHADESTCONSTOVERRIDE           = $00000002;
  3570.  
  3571. (*
  3572.  * The NEG suffix indicates that the destination surface becomes more
  3573.  * transparent as the alpha value increases.
  3574.  *)
  3575.   DDOVER_ALPHADESTNEG                     = $00000004;
  3576.  
  3577. (*
  3578.  * Use the lpDDSAlphaDest field in the TDDOverlayFX structure as the alpha
  3579.  * channel destination for this overlay.
  3580.  *)
  3581.   DDOVER_ALPHADESTSURFACEOVERRIDE         = $00000008;
  3582.  
  3583. (*
  3584.  * Use the dwAlphaEdgeBlend field in the TDDOverlayFX structure as the alpha
  3585.  * channel for the edges of the image that border the color key colors.
  3586.  *)
  3587.   DDOVER_ALPHAEDGEBLEND                   = $00000010;
  3588.  
  3589. (*
  3590.  * Use the alpha information in the pixel format or the alpha channel surface
  3591.  * attached to the source surface as the source alpha channel for this overlay.
  3592.  *)
  3593.   DDOVER_ALPHASRC                         = $00000020;
  3594.  
  3595. (*
  3596.  * Use the dwConstAlphaSrc field in the TDDOverlayFX structure as the source
  3597.  * alpha channel for this overlay.
  3598.  *)
  3599.   DDOVER_ALPHASRCCONSTOVERRIDE            = $00000040;
  3600.  
  3601. (*
  3602.  * The NEG suffix indicates that the source surface becomes more transparent
  3603.  * as the alpha value increases.
  3604.  *)
  3605.   DDOVER_ALPHASRCNEG                      = $00000080;
  3606.  
  3607. (*
  3608.  * Use the lpDDSAlphaSrc field in the TDDOverlayFX structure as the alpha channel
  3609.  * source for this overlay.
  3610.  *)
  3611.   DDOVER_ALPHASRCSURFACEOVERRIDE          = $00000100;
  3612.  
  3613. (*
  3614.  * Turn this overlay off.
  3615.  *)
  3616.   DDOVER_HIDE                             = $00000200;
  3617.  
  3618. (*
  3619.  * Use the color key associated with the destination surface.
  3620.  *)
  3621.   DDOVER_KEYDEST                          = $00000400;
  3622.  
  3623. (*
  3624.  * Use the dckDestColorkey field in the TDDOverlayFX structure as the color key
  3625.  * for the destination surface
  3626.  *)
  3627.   DDOVER_KEYDESTOVERRIDE                  = $00000800;
  3628.  
  3629. (*
  3630.  * Use the color key associated with the source surface.
  3631.  *)
  3632.   DDOVER_KEYSRC                           = $00001000;
  3633.  
  3634. (*
  3635.  * Use the dckSrcColorkey field in the TDDOverlayFX structure as the color key
  3636.  * for the source surface.
  3637.  *)
  3638.   DDOVER_KEYSRCOVERRIDE                   = $00002000;
  3639.  
  3640. (*
  3641.  * Turn this overlay on.
  3642.  *)
  3643.   DDOVER_SHOW                             = $00004000;
  3644.  
  3645. (*
  3646.  * Add a dirty rect to an emulated overlayed surface.
  3647.  *)
  3648.   DDOVER_ADDDIRTYRECT                     = $00008000;
  3649.  
  3650. (*
  3651.  * Redraw all dirty rects on an emulated overlayed surface.
  3652.  *)
  3653.   DDOVER_REFRESHDIRTYRECTS                = $00010000;
  3654.  
  3655. (*
  3656.  * Redraw the entire surface on an emulated overlayed surface.
  3657.  *)
  3658.   DDOVER_REFRESHALL                      = $00020000;
  3659.  
  3660. (*
  3661.  * Use the overlay FX flags to define special overlay FX
  3662.  *)
  3663.   DDOVER_DDFX                             = $00080000;
  3664.  
  3665. (*
  3666.  * Autoflip the overlay when ever the video port autoflips
  3667.  *)
  3668.   DDOVER_AUTOFLIP                         = $00100000;
  3669.  
  3670. (*
  3671.  * Display each field of video port data individually without
  3672.  * causing any jittery artifacts
  3673.  *)
  3674.   DDOVER_BOB                              = $00200000;
  3675.  
  3676. (*
  3677.  * Indicates that bob/weave decisions should not be overridden by other
  3678.  * interfaces.
  3679.  *)
  3680.   DDOVER_OVERRIDEBOBWEAVE                 = $00400000;
  3681.  
  3682. (*
  3683.  * Indicates that the surface memory is composed of interleaved fields.
  3684.  *)
  3685.   DDOVER_INTERLEAVED                      = $00800000;
  3686.  
  3687. (*
  3688.  * Indicates that bob will be performed using hardware rather than
  3689.  * software or emulated.
  3690.  *)
  3691.   DDOVER_BOBHARDWARE                    = $01000000;
  3692.  
  3693. (*
  3694.  * Indicates that overlay FX structure contains valid ARGB scaling factors.
  3695.  *)
  3696.   DDOVER_ARGBSCALEFACTORS                 = $02000000;
  3697.  
  3698. (*
  3699.  * Indicates that ARGB scaling factors can be degraded to fit driver capabilities.
  3700.  *)
  3701.   DDOVER_DEGRADEARGBSCALING               = $04000000;
  3702.  
  3703. (****************************************************************************
  3704.  *
  3705.  * DIRECTDRAWSURFACE LOCK FLAGS
  3706.  *
  3707.  ****************************************************************************)
  3708.  
  3709. (*
  3710.  * The default.  Set to indicate that Lock should return a valid memory pointer
  3711.  * to the top of the specified rectangle.  If no rectangle is specified then a
  3712.  * pointer to the top of the surface is returned.
  3713.  *)
  3714.   DDLOCK_SURFACEMEMORYPTR                 = $00000000;    // = default
  3715.  
  3716. (*
  3717.  * Set to indicate that Lock should wait until it can obtain a valid memory
  3718.  * pointer before returning.  If this bit is set, Lock will never return
  3719.  * DDERR_WASSTILLDRAWING.
  3720.  *)
  3721.   DDLOCK_WAIT                             = $00000001;
  3722.  
  3723. (*
  3724.  * Set if an event handle is being passed to Lock.  Lock will trigger the event
  3725.  * when it can return the surface memory pointer requested.
  3726.  *)
  3727.   DDLOCK_EVENT                            = $00000002;
  3728.  
  3729. (*
  3730.  * Indicates that the surface being locked will only be read from.
  3731.  *)
  3732.   DDLOCK_READONLY                         = $00000010;
  3733.  
  3734. (*
  3735.  * Indicates that the surface being locked will only be written to
  3736.  *)
  3737.   DDLOCK_WRITEONLY                        = $00000020;
  3738.  
  3739. (*
  3740.  * Indicates that a system wide lock should not be taken when this surface
  3741.  * is locked. This has several advantages (cursor responsiveness, ability
  3742.  * to call more Windows functions, easier debugging) when locking video
  3743.  * memory surfaces. However, an application specifying this flag must
  3744.  * comply with a number of conditions documented in the help file.
  3745.  * Furthermore, this flag cannot be specified when locking the primary.
  3746.  *)
  3747.   DDLOCK_NOSYSLOCK                        = $00000800;
  3748.  
  3749. (*
  3750.  * Used only with Direct3D Vertex Buffer Locks. Indicates that no vertices
  3751.  * that were referred to in Draw*PrimtiveVB calls since the start of the
  3752.  * frame (or the last lock without this flag) will be modified during the
  3753.  * lock. This can be useful when one is only appending data to the vertex
  3754.  * buffer
  3755.  *)
  3756.   DDLOCK_NOOVERWRITE                      = $00001000;
  3757.  
  3758. (*
  3759.  * Indicates that no assumptions will be made about the contents of the
  3760.  * surface or vertex buffer during this lock.
  3761.  * This enables two things:
  3762.  * -    Direct3D or the driver may provide an alternative memory
  3763.  *      area as the vertex buffer. This is useful when one plans to clear the
  3764.  *      contents of the vertex buffer and fill in new data.
  3765.  * -    Drivers sometimes store surface data in a re-ordered format.
  3766.  *      When the application locks the surface, the driver is forced to un-re-order
  3767.  *      the surface data before allowing the application to see the surface contents.
  3768.  *      This flag is a hint to the driver that it can skip the un-re-ordering process
  3769.  *      since the application plans to overwrite every single pixel in the surface
  3770.  *      or locked rectangle (and so erase any un-re-ordered pixels anyway).
  3771.  *      Applications should always set this flag when they intend to overwrite the entire
  3772.  *      surface or locked rectangle.
  3773.  *)
  3774.   DDLOCK_DISCARDCONTENTS                  = $00002000;
  3775.  (*
  3776.   * DDLOCK_OKTOSWAP is an older, less informative name for DDLOCK_DISCARDCONTENTS
  3777.   *)
  3778.   DDLOCK_OKTOSWAP                         = $00002000;
  3779.  
  3780. (*
  3781.  * On IDirectDrawSurface7 and higher interfaces, the default is DDLOCK_WAIT. If you wish
  3782.  * to override the default and use time when the accelerator is busy (as denoted by
  3783.  * the DDERR_WASSTILLDRAWING return code) then use DDLOCK_DONOTWAIT.
  3784.  *)
  3785.   DDLOCK_DONOTWAIT                        = $00004000;
  3786.  
  3787.  
  3788. (****************************************************************************
  3789.  *
  3790.  * DIRECTDRAWSURFACE PAGELOCK FLAGS
  3791.  *
  3792.  ****************************************************************************)
  3793.  
  3794. (*
  3795.  * No flags defined at present
  3796.  *)
  3797.  
  3798.  
  3799. (****************************************************************************
  3800.  *
  3801.  * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS
  3802.  *
  3803.  ****************************************************************************)
  3804.  
  3805. (*
  3806.  * No flags defined at present
  3807.  *)
  3808.  
  3809.  
  3810. (****************************************************************************
  3811.  *
  3812.  * DIRECTDRAWSURFACE BLT FX FLAGS
  3813.  *
  3814.  ****************************************************************************)
  3815.  
  3816. (*
  3817.  * If stretching, use arithmetic stretching along the Y axis for this blt.
  3818.  *)
  3819.   DDBLTFX_ARITHSTRETCHY                   = $00000001;
  3820.  
  3821. (*
  3822.  * Do this blt mirroring the surface left to right.  Spin the
  3823.  * surface around its y-axis.
  3824.  *)
  3825.   DDBLTFX_MIRRORLEFTRIGHT                 = $00000002;
  3826.  
  3827. (*
  3828.  * Do this blt mirroring the surface up and down.  Spin the surface
  3829.  * around its x-axis.
  3830.  *)
  3831.   DDBLTFX_MIRRORUPDOWN                    = $00000004;
  3832.  
  3833. (*
  3834.  * Schedule this blt to avoid tearing.
  3835.  *)
  3836.   DDBLTFX_NOTEARING                       = $00000008;
  3837.  
  3838. (*
  3839.  * Do this blt rotating the surface one hundred and eighty degrees.
  3840.  *)
  3841.   DDBLTFX_ROTATE180                       = $00000010;
  3842.  
  3843. (*
  3844.  * Do this blt rotating the surface two hundred and seventy degrees.
  3845.  *)
  3846.   DDBLTFX_ROTATE270                       = $00000020;
  3847.  
  3848. (*
  3849.  * Do this blt rotating the surface ninety degrees.
  3850.  *)
  3851.   DDBLTFX_ROTATE90                        = $00000040;
  3852.  
  3853. (*
  3854.  * Do this z blt using dwZBufferLow and dwZBufferHigh as  range values
  3855.  * specified to limit the bits copied from the source surface.
  3856.  *)
  3857.   DDBLTFX_ZBUFFERRANGE                    = $00000080;
  3858.  
  3859. (*
  3860.  * Do this z blt adding the dwZBufferBaseDest to each of the sources z values
  3861.  * before comparing it with the desting z values.
  3862.  *)
  3863.   DDBLTFX_ZBUFFERBASEDEST                 = $00000100;
  3864.  
  3865. (****************************************************************************
  3866.  *
  3867.  * DIRECTDRAWSURFACE OVERLAY FX FLAGS
  3868.  *
  3869.  ****************************************************************************)
  3870.  
  3871. (*
  3872.  * If stretching, use arithmetic stretching along the Y axis for this overlay.
  3873.  *)
  3874.   DDOVERFX_ARITHSTRETCHY                  = $00000001;
  3875.  
  3876. (*
  3877.  * Mirror the overlay across the vertical axis
  3878.  *)
  3879.   DDOVERFX_MIRRORLEFTRIGHT                = $00000002;
  3880.  
  3881. (*
  3882.  * Mirror the overlay across the horizontal axis
  3883.  *)
  3884.   DDOVERFX_MIRRORUPDOWN                   = $00000004;
  3885.  
  3886. (****************************************************************************
  3887.  *
  3888.  * Flags for dwDDFX member of DDSPRITEFX structure
  3889.  *
  3890.  ****************************************************************************)
  3891. (*
  3892.  * Use affine transformation matrix in fTransform member.
  3893.  *)
  3894.   DDSPRITEFX_AFFINETRANSFORM            = $00000001;
  3895.  
  3896. (*
  3897.  * Use RGBA scaling factors in ddrgbaScaleFactors member.
  3898.  *)
  3899.   DDSPRITEFX_RGBASCALING                        = $00000002;
  3900.  
  3901. (*
  3902.  * Degrade RGBA scaling factors to accommodate driver's capabilities.
  3903.  *)
  3904.   DDSPRITEFX_DEGRADERGBASCALING         = $00000004;
  3905.  
  3906. (*
  3907.  * Do bilinear filtering of stretched or warped sprite.
  3908.  *)
  3909.   DDSPRITEFX_BILINEARFILTER                     = $00000008;
  3910.  
  3911. (*
  3912.  * Do "blur" filtering of stretched or warped sprite.
  3913.  *)
  3914.   DDSPRITEFX_BLURFILTER                         = $00000010;
  3915.  
  3916. (*
  3917.  * Do "flat" filtering of stretched or warped sprite.
  3918.  *)
  3919.   DDSPRITEFX_FLATFILTER                         = $00000020;
  3920.  
  3921. (*
  3922.  * Degrade filtering operation to accommodate driver's capabilities.
  3923.  *)
  3924.   DDSPRITEFX_DEGRADEFILTER              = $00000040;
  3925.  
  3926. (****************************************************************************
  3927.  *
  3928.  * DIRECTDRAW WAITFORVERTICALBLANK FLAGS
  3929.  *
  3930.  ****************************************************************************)
  3931.  
  3932. (*
  3933.  * return when the vertical blank interval begins
  3934.  *)
  3935.   DDWAITVB_BLOCKBEGIN                     = $00000001;
  3936.  
  3937. (*
  3938.  * set up an event to trigger when the vertical blank begins
  3939.  *)
  3940.   DDWAITVB_BLOCKBEGINEVENT                = $00000002;
  3941.  
  3942. (*
  3943.  * return when the vertical blank interval ends and display begins
  3944.  *)
  3945.   DDWAITVB_BLOCKEND                       = $00000004;
  3946.  
  3947. (****************************************************************************
  3948.  *
  3949.  * DIRECTDRAW GETFLIPSTATUS FLAGS
  3950.  *
  3951.  ****************************************************************************)
  3952.  
  3953. (*
  3954.  * is it OK to flip now?
  3955.  *)
  3956.   DDGFS_CANFLIP                   = $00000001;
  3957.  
  3958. (*
  3959.  * is the last flip finished?
  3960.  *)
  3961.   DDGFS_ISFLIPDONE                = $00000002;
  3962.  
  3963. (****************************************************************************
  3964.  *
  3965.  * DIRECTDRAW GETBLTSTATUS FLAGS
  3966.  *
  3967.  ****************************************************************************)
  3968.  
  3969. (*
  3970.  * is it OK to blt now?
  3971.  *)
  3972.   DDGBS_CANBLT                    = $00000001;
  3973.  
  3974. (*
  3975.  * is the blt to the surface finished?
  3976.  *)
  3977.   DDGBS_ISBLTDONE                 = $00000002;
  3978.  
  3979.  
  3980. (****************************************************************************
  3981.  *
  3982.  * DIRECTDRAW ENUMOVERLAYZORDER FLAGS
  3983.  *
  3984.  ****************************************************************************)
  3985.  
  3986. (*
  3987.  * Enumerate overlays back to front.
  3988.  *)
  3989.   DDENUMOVERLAYZ_BACKTOFRONT      = $00000000;
  3990.  
  3991. (*
  3992.  * Enumerate overlays front to back
  3993.  *)
  3994.   DDENUMOVERLAYZ_FRONTTOBACK      = $00000001;
  3995.  
  3996. (****************************************************************************
  3997.  *
  3998.  * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS
  3999.  *
  4000.  ****************************************************************************)
  4001.  
  4002. (*
  4003.  * Send overlay to front
  4004.  *)
  4005.   DDOVERZ_SENDTOFRONT             = $00000000;
  4006.  
  4007. (*
  4008.  * Send overlay to back
  4009.  *)
  4010.   DDOVERZ_SENDTOBACK              = $00000001;
  4011.  
  4012. (*
  4013.  * Move Overlay forward
  4014.  *)
  4015.   DDOVERZ_MOVEFORWARD             = $00000002;
  4016.  
  4017. (*
  4018.  * Move Overlay backward
  4019.  *)
  4020.   DDOVERZ_MOVEBACKWARD            = $00000003;
  4021.  
  4022. (*
  4023.  * Move Overlay in front of relative surface
  4024.  *)
  4025.   DDOVERZ_INSERTINFRONTOF         = $00000004;
  4026.  
  4027. (*
  4028.  * Move Overlay in back of relative surface
  4029.  *)
  4030.   DDOVERZ_INSERTINBACKOF          = $00000005;
  4031.  
  4032. (****************************************************************************
  4033.  *
  4034.  * DIRECTDRAW SETGAMMARAMP FLAGS
  4035.  *
  4036.  ****************************************************************************)
  4037.  
  4038. (*
  4039.  * Request calibrator to adjust the gamma ramp according to the physical
  4040.  * properties of the display so that the result should appear identical
  4041.  * on all systems.
  4042.  *)
  4043.   DDSGR_CALIBRATE                        = $00000001;
  4044.  
  4045. (****************************************************************************
  4046.  *
  4047.  * DIRECTDRAW STARTMODETEST FLAGS
  4048.  *
  4049.  ****************************************************************************)
  4050.  
  4051. (*
  4052.  * Indicates that the mode being tested has passed
  4053.  *)
  4054.  DDSMT_ISTESTREQUIRED                   = $00000001;
  4055.  
  4056.  
  4057. (****************************************************************************
  4058.  *
  4059.  * DIRECTDRAW EVALUATEMODE FLAGS
  4060.  *
  4061.  ****************************************************************************)
  4062.  
  4063. (*
  4064.  * Indicates that the mode being tested has passed
  4065.  *)
  4066.  DDEM_MODEPASSED                        = $00000001;
  4067.  
  4068. (*
  4069.  * Indicates that the mode being tested has failed
  4070.  *)
  4071.  DDEM_MODEFAILED                        = $00000002;
  4072.  
  4073. (*===========================================================================
  4074.  *
  4075.  *
  4076.  * DIRECTDRAW RETURN CODES
  4077.  *
  4078.  * The return values from DirectDraw Commands and Surface that return an HResult
  4079.  * are codes from DirectDraw concerning the results of the action
  4080.  * requested by DirectDraw.
  4081.  *
  4082.  *==========================================================================*)
  4083.  
  4084. (*
  4085.  * Status is OK
  4086.  *
  4087.  * Issued by: DirectDraw Commands and all callbacks
  4088.  *)
  4089.   DD_OK                                   = 0;
  4090.   DD_FALSE                                = S_FALSE;
  4091.  
  4092. (****************************************************************************
  4093.  *
  4094.  * DIRECTDRAW ENUMCALLBACK RETURN VALUES
  4095.  *
  4096.  * EnumCallback returns are used to control the flow of the DIRECTDRAW and
  4097.  * DIRECTDRAWSURFACE object enumerations.   They can only be returned by
  4098.  * enumeration callback routines.
  4099.  *
  4100.  ****************************************************************************)
  4101.  
  4102. (*
  4103.  * stop the enumeration
  4104.  *)
  4105.   DDENUMRET_CANCEL                        = 0;
  4106.  
  4107. (*
  4108.  * continue the enumeration
  4109.  *)
  4110.   DDENUMRET_OK                            = 1;
  4111.  
  4112. (****************************************************************************
  4113.  *
  4114.  * DIRECTDRAW ERRORS
  4115.  *
  4116.  * Errors are represented by negative values and cannot be combined.
  4117.  *
  4118.  ****************************************************************************)
  4119.  
  4120.   _FACDD = $876;
  4121.   MAKE_DDHRESULT = HResult(1 shl 31) or HResult(_FACDD shl 16);
  4122.  
  4123.  
  4124. (*
  4125.  * This object is already initialized
  4126.  *)
  4127.   DDERR_ALREADYINITIALIZED                = MAKE_DDHRESULT + 5;
  4128.  
  4129. (*
  4130.  * This surface can not be attached to the requested surface.
  4131.  *)
  4132.   DDERR_CANNOTATTACHSURFACE               = MAKE_DDHRESULT + 10;
  4133.  
  4134. (*
  4135.  * This surface can not be detached from the requested surface.
  4136.  *)
  4137.   DDERR_CANNOTDETACHSURFACE               = MAKE_DDHRESULT + 20;
  4138.  
  4139. (*
  4140.  * Support is currently not available.
  4141.  *)
  4142.   DDERR_CURRENTLYNOTAVAIL                 = MAKE_DDHRESULT + 40;
  4143.  
  4144. (*
  4145.  * An exception was encountered while performing the requested operation
  4146.  *)
  4147.   DDERR_EXCEPTION                         = MAKE_DDHRESULT + 55;
  4148.  
  4149. (*
  4150.  * Generic failure.
  4151.  *)
  4152.   DDERR_GENERIC                           = E_FAIL;
  4153.  
  4154. (*
  4155.  * Height of rectangle provided is not a multiple of reqd alignment
  4156.  *)
  4157.   DDERR_HEIGHTALIGN                       = MAKE_DDHRESULT + 90;
  4158.  
  4159. (*
  4160.  * Unable to match primary surface creation request with existing
  4161.  * primary surface.
  4162.  *)
  4163.   DDERR_INCOMPATIBLEPRIMARY               = MAKE_DDHRESULT + 95;
  4164.  
  4165. (*
  4166.  * One or more of the caps bits passed to the callback are incorrect.
  4167.  *)
  4168.   DDERR_INVALIDCAPS                       = MAKE_DDHRESULT + 100;
  4169.  
  4170. (*
  4171.  * DirectDraw does not support provided Cliplist.
  4172.  *)
  4173.   DDERR_INVALIDCLIPLIST                   = MAKE_DDHRESULT + 110;
  4174.  
  4175. (*
  4176.  * DirectDraw does not support the requested mode
  4177.  *)
  4178.   DDERR_INVALIDMODE                       = MAKE_DDHRESULT + 120;
  4179.  
  4180. (*
  4181.  * DirectDraw received a pointer that was an invalid DIRECTDRAW object.
  4182.  *)
  4183.   DDERR_INVALIDOBJECT                     = MAKE_DDHRESULT + 130;
  4184.  
  4185. (*
  4186.  * One or more of the parameters passed to the callback function are
  4187.  * incorrect.
  4188.  *)
  4189.   DDERR_INVALIDPARAMS                     = E_INVALIDARG;
  4190.  
  4191. (*
  4192.  * pixel format was invalid as specified
  4193.  *)
  4194.   DDERR_INVALIDPIXELFORMAT                = MAKE_DDHRESULT + 145;
  4195.  
  4196. (*
  4197.  * Rectangle provided was invalid.
  4198.  *)
  4199.   DDERR_INVALIDRECT                       = MAKE_DDHRESULT + 150;
  4200.  
  4201. (*
  4202.  * Operation could not be carried out because one or more surfaces are locked
  4203.  *)
  4204.   DDERR_LOCKEDSURFACES                    = MAKE_DDHRESULT + 160;
  4205.  
  4206. (*
  4207.  * There is no 3D present.
  4208.  *)
  4209.   DDERR_NO3D                              = MAKE_DDHRESULT + 170;
  4210.  
  4211. (*
  4212.  * Operation could not be carried out because there is no alpha accleration
  4213.  * hardware present or available.
  4214.  *)
  4215.   DDERR_NOALPHAHW                         = MAKE_DDHRESULT + 180;
  4216.  
  4217. (*
  4218.  * Operation could not be carried out because there is no stereo
  4219.  * hardware present or available.
  4220.  *)
  4221.   DDERR_NOSTEREOHARDWARE          = MAKE_DDHRESULT + 181;
  4222.  
  4223. (*
  4224.  * Operation could not be carried out because there is no hardware
  4225.  * present which supports stereo surfaces
  4226.  *)
  4227.   DDERR_NOSURFACELEFT             = MAKE_DDHRESULT + 182;
  4228.  
  4229. (*
  4230.  * no clip list available
  4231.  *)
  4232.   DDERR_NOCLIPLIST                        = MAKE_DDHRESULT + 205;
  4233.  
  4234. (*
  4235.  * Operation could not be carried out because there is no color conversion
  4236.  * hardware present or available.
  4237.  *)
  4238.   DDERR_NOCOLORCONVHW                     = MAKE_DDHRESULT + 210;
  4239.  
  4240. (*
  4241.  * Create function called without DirectDraw object method SetCooperativeLevel
  4242.  * being called.
  4243.  *)
  4244.   DDERR_NOCOOPERATIVELEVELSET             = MAKE_DDHRESULT + 212;
  4245.  
  4246. (*
  4247.  * Surface doesn't currently have a color key
  4248.  *)
  4249.   DDERR_NOCOLORKEY                        = MAKE_DDHRESULT + 215;
  4250.  
  4251. (*
  4252.  * Operation could not be carried out because there is no hardware support
  4253.  * of the dest color key.
  4254.  *)
  4255.   DDERR_NOCOLORKEYHW                      = MAKE_DDHRESULT + 220;
  4256.  
  4257. (*
  4258.  * No DirectDraw support possible with current display driver
  4259.  *)
  4260.   DDERR_NODIRECTDRAWSUPPORT               = MAKE_DDHRESULT + 222;
  4261.  
  4262. (*
  4263.  * Operation requires the application to have exclusive mode but the
  4264.  * application does not have exclusive mode.
  4265.  *)
  4266.   DDERR_NOEXCLUSIVEMODE                   = MAKE_DDHRESULT + 225;
  4267.  
  4268. (*
  4269.  * Flipping visible surfaces is not supported.
  4270.  *)
  4271.   DDERR_NOFLIPHW                          = MAKE_DDHRESULT + 230;
  4272.  
  4273. (*
  4274.  * There is no GDI present.
  4275.  *)
  4276.   DDERR_NOGDI                             = MAKE_DDHRESULT + 240;
  4277.  
  4278. (*
  4279.  * Operation could not be carried out because there is no hardware present
  4280.  * or available.
  4281.  *)
  4282.   DDERR_NOMIRRORHW                        = MAKE_DDHRESULT + 250;
  4283.  
  4284. (*
  4285.  * Requested item was not found
  4286.  *)
  4287.   DDERR_NOTFOUND                          = MAKE_DDHRESULT + 255;
  4288.  
  4289. (*
  4290.  * Operation could not be carried out because there is no overlay hardware
  4291.  * present or available.
  4292.  *)
  4293.   DDERR_NOOVERLAYHW                       = MAKE_DDHRESULT + 260;
  4294.  
  4295. (*
  4296.  * Operation could not be carried out because the source and destination
  4297.  * rectangles are on the same surface and overlap each other.
  4298.  *)
  4299.   DDERR_OVERLAPPINGRECTS                = MAKE_DDHRESULT + 270;
  4300.  
  4301. (*
  4302.  * Operation could not be carried out because there is no appropriate raster
  4303.  * op hardware present or available.
  4304.  *)
  4305.   DDERR_NORASTEROPHW                      = MAKE_DDHRESULT + 280;
  4306.  
  4307. (*
  4308.  * Operation could not be carried out because there is no rotation hardware
  4309.  * present or available.
  4310.  *)
  4311.   DDERR_NOROTATIONHW                      = MAKE_DDHRESULT + 290;
  4312.  
  4313. (*
  4314.  * Operation could not be carried out because there is no hardware support
  4315.  * for stretching
  4316.  *)
  4317.   DDERR_NOSTRETCHHW                       = MAKE_DDHRESULT + 310;
  4318.  
  4319. (*
  4320.  * DirectDrawSurface is not in 4 bit color palette and the requested operation
  4321.  * requires 4 bit color palette.
  4322.  *)
  4323.   DDERR_NOT4BITCOLOR                      = MAKE_DDHRESULT + 316;
  4324.  
  4325. (*
  4326.  * DirectDrawSurface is not in 4 bit color index palette and the requested
  4327.  * operation requires 4 bit color index palette.
  4328.  *)
  4329.   DDERR_NOT4BITCOLORINDEX                 = MAKE_DDHRESULT + 317;
  4330.  
  4331. (*
  4332.  * DirectDraw Surface is not in 8 bit color mode and the requested operation
  4333.  * requires 8 bit color.
  4334.  *)
  4335.   DDERR_NOT8BITCOLOR                      = MAKE_DDHRESULT + 320;
  4336.  
  4337. (*
  4338.  * Operation could not be carried out because there is no texture mapping
  4339.  * hardware present or available.
  4340.  *)
  4341.   DDERR_NOTEXTUREHW                       = MAKE_DDHRESULT + 330;
  4342.  
  4343. (*
  4344.  * Operation could not be carried out because there is no hardware support
  4345.  * for vertical blank synchronized operations.
  4346.  *)
  4347.   DDERR_NOVSYNCHW                         = MAKE_DDHRESULT + 335;
  4348.  
  4349. (*
  4350.  * Operation could not be carried out because there is no hardware support
  4351.  * for zbuffer blting.
  4352.  *)
  4353.   DDERR_NOZBUFFERHW                       = MAKE_DDHRESULT + 340;
  4354.  
  4355. (*
  4356.  * Overlay surfaces could not be z layered based on their BltOrder because
  4357.  * the hardware does not support z layering of overlays.
  4358.  *)
  4359.   DDERR_NOZOVERLAYHW                      = MAKE_DDHRESULT + 350;
  4360.  
  4361. (*
  4362.  * The hardware needed for the requested operation has already been
  4363.  * allocated.
  4364.  *)
  4365.   DDERR_OUTOFCAPS                         = MAKE_DDHRESULT + 360;
  4366.  
  4367. (*
  4368.  * DirectDraw does not have enough memory to perform the operation.
  4369.  *)
  4370.   DDERR_OUTOFMEMORY                       = E_OUTOFMEMORY;
  4371.  
  4372. (*
  4373.  * DirectDraw does not have enough memory to perform the operation.
  4374.  *)
  4375.   DDERR_OUTOFVIDEOMEMORY                  = MAKE_DDHRESULT + 380;
  4376.  
  4377. (*
  4378.  * hardware does not support clipped overlays
  4379.  *)
  4380.   DDERR_OVERLAYCANTCLIP                   = MAKE_DDHRESULT + 382;
  4381.  
  4382. (*
  4383.  * Can only have ony color key active at one time for overlays
  4384.  *)
  4385.   DDERR_OVERLAYCOLORKEYONLYONEACTIVE      = MAKE_DDHRESULT + 384;
  4386.  
  4387. (*
  4388.  * Access to this palette is being refused because the palette is already
  4389.  * locked by another thread.
  4390.  *)
  4391.   DDERR_PALETTEBUSY                       = MAKE_DDHRESULT + 387;
  4392.  
  4393. (*
  4394.  * No src color key specified for this operation.
  4395.  *)
  4396.   DDERR_COLORKEYNOTSET                    = MAKE_DDHRESULT + 400;
  4397.  
  4398. (*
  4399.  * This surface is already attached to the surface it is being attached to.
  4400.  *)
  4401.   DDERR_SURFACEALREADYATTACHED            = MAKE_DDHRESULT + 410;
  4402.  
  4403. (*
  4404.  * This surface is already a dependency of the surface it is being made a
  4405.  * dependency of.
  4406.  *)
  4407.   DDERR_SURFACEALREADYDEPENDENT           = MAKE_DDHRESULT + 420;
  4408.  
  4409. (*
  4410.  * Access to this surface is being refused because the surface is already
  4411.  * locked by another thread.
  4412.  *)
  4413.   DDERR_SURFACEBUSY                       = MAKE_DDHRESULT + 430;
  4414.  
  4415. (*
  4416.  * Access to this surface is being refused because no driver exists
  4417.  * which can supply a pointer to the surface.
  4418.  * This is most likely to happen when attempting to lock the primary
  4419.  * surface when no DCI provider is present.
  4420.  * Will also happen on attempts to lock an optimized surface.
  4421.  *)
  4422.   DDERR_CANTLOCKSURFACE                   = MAKE_DDHRESULT + 435;
  4423.  
  4424. (*
  4425.  * Access to Surface refused because Surface is obscured.
  4426.  *)
  4427.   DDERR_SURFACEISOBSCURED                 = MAKE_DDHRESULT + 440;
  4428.  
  4429. (*
  4430.  * Access to this surface is being refused because the surface is gone.
  4431.  * The DIRECTDRAWSURFACE object representing this surface should
  4432.  * have Restore called on it.
  4433.  *)
  4434.   DDERR_SURFACELOST                       = MAKE_DDHRESULT + 450;
  4435.  
  4436. (*
  4437.  * The requested surface is not attached.
  4438.  *)
  4439.   DDERR_SURFACENOTATTACHED                = MAKE_DDHRESULT + 460;
  4440.  
  4441. (*
  4442.  * Height requested by DirectDraw is too large.
  4443.  *)
  4444.   DDERR_TOOBIGHEIGHT                      = MAKE_DDHRESULT + 470;
  4445.  
  4446. (*
  4447.  * Size requested by DirectDraw is too large --  The individual height and
  4448.  * width are OK.
  4449.  *)
  4450.   DDERR_TOOBIGSIZE                        = MAKE_DDHRESULT + 480;
  4451.  
  4452. (*
  4453.  * Width requested by DirectDraw is too large.
  4454.  *)
  4455.   DDERR_TOOBIGWIDTH                       = MAKE_DDHRESULT + 490;
  4456.  
  4457. (*
  4458.  * Action not supported.
  4459.  *)
  4460.   DDERR_UNSUPPORTED                       = E_NOTIMPL;
  4461.  
  4462. (*
  4463.  * FOURCC format requested is unsupported by DirectDraw
  4464.  *)
  4465.   DDERR_UNSUPPORTEDFORMAT                 = MAKE_DDHRESULT + 510;
  4466.  
  4467. (*
  4468.  * Bitmask in the pixel format requested is unsupported by DirectDraw
  4469.  *)
  4470.   DDERR_UNSUPPORTEDMASK                   = MAKE_DDHRESULT + 520;
  4471.  
  4472. (*
  4473.  * The specified stream contains invalid data
  4474.  *)
  4475.   DDERR_INVALIDSTREAM                     = MAKE_DDHRESULT + 521;
  4476.  
  4477. (*
  4478.  * vertical blank is in progress
  4479.  *)
  4480.   DDERR_VERTICALBLANKINPROGRESS           = MAKE_DDHRESULT + 537;
  4481.  
  4482. (*
  4483.  * Informs DirectDraw that the previous Blt which is transfering information
  4484.  * to or from this Surface is incomplete.
  4485.  *)
  4486.   DDERR_WASSTILLDRAWING                   = MAKE_DDHRESULT + 540;
  4487.  
  4488. (*
  4489.  * The specified surface type requires specification of the COMPLEX flag
  4490.  *)
  4491.   DDERR_DDSCAPSCOMPLEXREQUIRED            = MAKE_DDHRESULT + 542;
  4492.  
  4493. (*
  4494.  * Rectangle provided was not horizontally aligned on reqd. boundary
  4495.  *)
  4496.   DDERR_XALIGN                            = MAKE_DDHRESULT + 560;
  4497.  
  4498. (*
  4499.  * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver
  4500.  * identifier.
  4501.  *)
  4502.   DDERR_INVALIDDIRECTDRAWGUID             = MAKE_DDHRESULT + 561;
  4503.  
  4504. (*
  4505.  * A DirectDraw object representing this driver has already been created
  4506.  * for this process.
  4507.  *)
  4508.   DDERR_DIRECTDRAWALREADYCREATED          = MAKE_DDHRESULT + 562;
  4509.  
  4510. (*
  4511.  * A hardware only DirectDraw object creation was attempted but the driver
  4512.  * did not support any hardware.
  4513.  *)
  4514.   DDERR_NODIRECTDRAWHW                    = MAKE_DDHRESULT + 563;
  4515.  
  4516. (*
  4517.  * this process already has created a primary surface
  4518.  *)
  4519.   DDERR_PRIMARYSURFACEALREADYEXISTS       = MAKE_DDHRESULT + 564;
  4520.  
  4521. (*
  4522.  * software emulation not available.
  4523.  *)
  4524.   DDERR_NOEMULATION                       = MAKE_DDHRESULT + 565;
  4525.  
  4526. (*
  4527.  * region passed to Clipper::GetClipList is too small.
  4528.  *)
  4529.   DDERR_REGIONTOOSMALL                    = MAKE_DDHRESULT + 566;
  4530.  
  4531. (*
  4532.  * an attempt was made to set a clip list for a clipper objec that
  4533.  * is already monitoring an hwnd.
  4534.  *)
  4535.   DDERR_CLIPPERISUSINGHWND                = MAKE_DDHRESULT + 567;
  4536.  
  4537. (*
  4538.  * No clipper object attached to surface object
  4539.  *)
  4540.   DDERR_NOCLIPPERATTACHED                 = MAKE_DDHRESULT + 568;
  4541.  
  4542. (*
  4543.  * Clipper notification requires an HWND or
  4544.  * no HWND has previously been set as the CooperativeLevel HWND.
  4545.  *)
  4546.   DDERR_NOHWND                            = MAKE_DDHRESULT + 569;
  4547.  
  4548. (*
  4549.  * HWND used by DirectDraw CooperativeLevel has been subclassed,
  4550.  * this prevents DirectDraw from restoring state.
  4551.  *)
  4552.   DDERR_HWNDSUBCLASSED                    = MAKE_DDHRESULT + 570;
  4553.  
  4554. (*
  4555.  * The CooperativeLevel HWND has already been set.
  4556.  * It can not be reset while the process has surfaces or palettes created.
  4557.  *)
  4558.   DDERR_HWNDALREADYSET                    = MAKE_DDHRESULT + 571;
  4559.  
  4560. (*
  4561.  * No palette object attached to this surface.
  4562.  *)
  4563.   DDERR_NOPALETTEATTACHED                 = MAKE_DDHRESULT + 572;
  4564.  
  4565. (*
  4566.  * No hardware support for 16 or 256 color palettes.
  4567.  *)
  4568.   DDERR_NOPALETTEHW                       = MAKE_DDHRESULT + 573;
  4569.  
  4570. (*
  4571.  * If a clipper object is attached to the source surface passed into a
  4572.  * BltFast call.
  4573.  *)
  4574.   DDERR_BLTFASTCANTCLIP                   = MAKE_DDHRESULT + 574;
  4575.  
  4576. (*
  4577.  * No blter.
  4578.  *)
  4579.   DDERR_NOBLTHW                           = MAKE_DDHRESULT + 575;
  4580.  
  4581. (*
  4582.  * No DirectDraw ROP hardware.
  4583.  *)
  4584.   DDERR_NODDROPSHW                        = MAKE_DDHRESULT + 576;
  4585.  
  4586. (*
  4587.  * returned when GetOverlayPosition is called on a hidden overlay
  4588.  *)
  4589.   DDERR_OVERLAYNOTVISIBLE                 = MAKE_DDHRESULT + 577;
  4590.  
  4591. (*
  4592.  * returned when GetOverlayPosition is called on a overlay that UpdateOverlay
  4593.  * has never been called on to establish a destionation.
  4594.  *)
  4595.   DDERR_NOOVERLAYDEST                     = MAKE_DDHRESULT + 578;
  4596.  
  4597. (*
  4598.  * returned when the position of the overlay on the destionation is no longer
  4599.  * legal for that destionation.
  4600.  *)
  4601.   DDERR_INVALIDPOSITION                   = MAKE_DDHRESULT + 579;
  4602.  
  4603. (*
  4604.  * returned when an overlay member is called for a non-overlay surface
  4605.  *)
  4606.   DDERR_NOTAOVERLAYSURFACE                = MAKE_DDHRESULT + 580;
  4607.  
  4608. (*
  4609.  * An attempt was made to set the cooperative level when it was already
  4610.  * set to exclusive.
  4611.  *)
  4612.   DDERR_EXCLUSIVEMODEALREADYSET           = MAKE_DDHRESULT + 581;
  4613.  
  4614. (*
  4615.  * An attempt has been made to flip a surface that is not flippable.
  4616.  *)
  4617.   DDERR_NOTFLIPPABLE                      = MAKE_DDHRESULT + 582;
  4618.  
  4619. (*
  4620.  * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly
  4621.  * created.
  4622.  *)
  4623.   DDERR_CANTDUPLICATE                     = MAKE_DDHRESULT + 583;
  4624.  
  4625. (*
  4626.  * Surface was not locked.  An attempt to unlock a surface that was not
  4627.  * locked at all, or by this process, has been attempted.
  4628.  *)
  4629.   DDERR_NOTLOCKED                         = MAKE_DDHRESULT + 584;
  4630.  
  4631. (*
  4632.  * Windows can not create any more DCs, or a DC was requested for a paltte-indexed
  4633.  * surface when the surface had no palette AND the display mode was not palette-indexed
  4634.  * (in this case DirectDraw cannot select a proper palette into the DC)
  4635.  *)
  4636.   DDERR_CANTCREATEDC                      = MAKE_DDHRESULT + 585;
  4637.  
  4638. (*
  4639.  * No DC was ever created for this surface.
  4640.  *)
  4641.   DDERR_NODC                              = MAKE_DDHRESULT + 586;
  4642.  
  4643. (*
  4644.  * This surface can not be restored because it was created in a different
  4645.  * mode.
  4646.  *)
  4647.   DDERR_WRONGMODE                         = MAKE_DDHRESULT + 587;
  4648.  
  4649. (*
  4650.  * This surface can not be restored because it is an implicitly created
  4651.  * surface.
  4652.  *)
  4653.   DDERR_IMPLICITLYCREATED                 = MAKE_DDHRESULT + 588;
  4654.  
  4655. (*
  4656.  * The surface being used is not a palette-based surface
  4657.  *)
  4658.   DDERR_NOTPALETTIZED                     = MAKE_DDHRESULT + 589;
  4659.  
  4660. (*
  4661.  * The display is currently in an unsupported mode
  4662.  *)
  4663.   DDERR_UNSUPPORTEDMODE                   = MAKE_DDHRESULT + 590;
  4664.  
  4665. (*
  4666.  * Operation could not be carried out because there is no mip-map
  4667.  * texture mapping hardware present or available.
  4668.  *)
  4669.   DDERR_NOMIPMAPHW                        = MAKE_DDHRESULT + 591;
  4670.  
  4671. (*
  4672.  * The requested action could not be performed because the surface was of
  4673.  * the wrong type.
  4674.  *)
  4675.   DDERR_INVALIDSURFACETYPE                = MAKE_DDHRESULT + 592;
  4676.  
  4677. (*
  4678.  * Device does not support optimized surfaces, therefore no video memory optimized surfaces
  4679.  *)
  4680.   DDERR_NOOPTIMIZEHW                      = MAKE_DDHRESULT + 600;
  4681.  
  4682. (*
  4683.  * Surface is an optimized surface, but has not yet been allocated any memory
  4684.  *)
  4685.   DDERR_NOTLOADED                         = MAKE_DDHRESULT + 601;
  4686.  
  4687. (*
  4688.  * Attempt was made to create or set a device window without first setting
  4689.  * the focus window
  4690.  *)
  4691.   DDERR_NOFOCUSWINDOW                     = MAKE_DDHRESULT + 602;
  4692.  
  4693. (*
  4694.  * Attempt was made to set a palette on a mipmap sublevel
  4695.  *)
  4696.   DDERR_NOTONMIPMAPSUBLEVEL               = MAKE_DDHRESULT + 603;
  4697.  
  4698. (*
  4699.  * A DC has already been returned for this surface. Only one DC can be
  4700.  * retrieved per surface.
  4701.  *)
  4702.   DDERR_DCALREADYCREATED                  = MAKE_DDHRESULT + 620;
  4703.  
  4704. (*
  4705.  * An attempt was made to allocate non-local video memory from a device
  4706.  * that does not support non-local video memory.
  4707.  *)
  4708.   DDERR_NONONLOCALVIDMEM                  = MAKE_DDHRESULT + 630;
  4709.  
  4710. (*
  4711.  * The attempt to page lock a surface failed.
  4712.  *)
  4713.   DDERR_CANTPAGELOCK                      = MAKE_DDHRESULT + 640;
  4714.  
  4715. (*
  4716.  * The attempt to page unlock a surface failed.
  4717.  *)
  4718.   DDERR_CANTPAGEUNLOCK                    = MAKE_DDHRESULT + 660;
  4719.  
  4720. (*
  4721.  * An attempt was made to page unlock a surface with no outstanding page locks.
  4722.  *)
  4723.   DDERR_NOTPAGELOCKED                     = MAKE_DDHRESULT + 680;
  4724.  
  4725. (*
  4726.  * There is more data available than the specified buffer size could hold
  4727.  *)
  4728.   DDERR_MOREDATA                                = MAKE_DDHRESULT + 690;
  4729.  
  4730. (*
  4731.  * The data has expired and is therefore no longer valid.
  4732.  *)
  4733.   DDERR_EXPIRED                           = MAKE_DDHRESULT + 691;
  4734.  
  4735. (*
  4736.  * The mode test has finished executing.
  4737.  *)
  4738.  DDERR_TESTFINISHED                      = MAKE_DDHRESULT + 692;
  4739.  
  4740. (*
  4741.  * The mode test has switched to a new mode.
  4742.  *)
  4743.  DDERR_NEWMODE                           = MAKE_DDHRESULT + 693;
  4744.  
  4745. (*
  4746.  * D3D has not yet been initialized.
  4747.  *)
  4748.  DDERR_D3DNOTINITIALIZED                 = MAKE_DDHRESULT + 694;
  4749.  
  4750. (*
  4751.  * The video port is not active
  4752.  *)
  4753.   DDERR_VIDEONOTACTIVE                          = MAKE_DDHRESULT + 695;
  4754.  
  4755. (*
  4756.  * The monitor does not have EDID data.
  4757.  *)
  4758.  DDERR_NOMONITORINFORMATION             = MAKE_DDHRESULT + 696;
  4759.  
  4760. (*
  4761.  * The driver does not enumerate display mode refresh rates.
  4762.  *)
  4763.  DDERR_NODRIVERSUPPORT                  = MAKE_DDHRESULT + 697;
  4764.  
  4765. (*
  4766.  * Surfaces created by one direct draw device cannot be used directly by
  4767.  * another direct draw device.
  4768.  *)
  4769.   DDERR_DEVICEDOESNTOWNSURFACE                  = MAKE_DDHRESULT + 699;
  4770.  
  4771. (*
  4772.  * An attempt was made to invoke an interface member of a DirectDraw object
  4773.  * created by CoCreateInstance() before it was initialized.
  4774.  *)
  4775.   DDERR_NOTINITIALIZED                    = CO_E_NOTINITIALIZED;
  4776.  
  4777. (* Alpha bit depth constants *)
  4778.  
  4779. (*
  4780.  * API's
  4781.  *)
  4782.  
  4783. type
  4784.   HMonitor = THandle;
  4785.  
  4786.   TDDEnumCallbackA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
  4787.       lpDriverName: PAnsiChar; lpContext: Pointer) : BOOL; stdcall;
  4788.   TDDEnumCallbackW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
  4789.       lpDriverName: PWideChar; lpContext: Pointer) : BOOL; stdcall;
  4790. {$IFDEF UNICODE}
  4791.   TDDEnumCallback = TDDEnumCallbackW;
  4792. {$ELSE}
  4793.   TDDEnumCallback = TDDEnumCallbackA;
  4794. {$ENDIF}
  4795.  
  4796.   TDDEnumCallbackExA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar;
  4797.       lpDriverName: PAnsiChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
  4798.       stdcall;
  4799.   TDDEnumCallbackExW = function (lpGUID: PGUID; lpDriverDescription: PWideChar;
  4800.       lpDriverName: PWideChar; lpContext: Pointer; Monitor: HMonitor) : BOOL;
  4801.       stdcall;
  4802.      
  4803. {$IFDEF UNICODE}
  4804.   TDDEnumCallbackEx = TDDEnumCallbackExW;
  4805. {$ELSE}
  4806.   TDDEnumCallbackEx = TDDEnumCallbackExA;
  4807. {$ENDIF}
  4808.  
  4809. var
  4810.   DirectDrawEnumerateA : function (lpCallback: TDDEnumCallbackA;
  4811.        lpContext: Pointer) : HResult; stdcall;
  4812.   DirectDrawEnumerateW : function (lpCallback: TDDEnumCallbackW;
  4813.        lpContext: Pointer) : HResult; stdcall;
  4814.   DirectDrawEnumerate : function (lpCallback: TDDEnumCallback;
  4815.        lpContext: Pointer) : HResult; stdcall;
  4816.  
  4817.   DirectDrawEnumerateExA : function (lpCallback: TDDEnumCallbackExA;
  4818.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4819.   DirectDrawEnumerateExW : function (lpCallback: TDDEnumCallbackExW;
  4820.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4821.   DirectDrawEnumerateEx : function (lpCallback: TDDEnumCallbackEx;
  4822.        lpContext: Pointer; dwFlags: DWORD) : HResult; stdcall;
  4823.  
  4824.   DirectDrawCreate : function (lpGUID: PGUID;
  4825.        out lplpDD: IDirectDraw;
  4826.        pUnkOuter: IUnknown) : HResult; stdcall;
  4827.   DirectDrawCreateEx : function  (lpGUID: PGUID;
  4828.        out lplpDD: IDirectDraw7; const iid: TGUID;
  4829.        pUnkOuter: IUnknown) : HResult; stdcall;
  4830.   DirectDrawCreateClipper : function (dwFlags: DWORD;
  4831.        out lplpDDClipper: IDirectDrawClipper;
  4832.        pUnkOuter: IUnknown) : HResult; stdcall;
  4833.  
  4834. const
  4835. (*
  4836.  * Flags for DirectDrawEnumerateEx
  4837.  * DirectDrawEnumerateEx supercedes DirectDrawEnumerate. You must use GetProcAddress to
  4838.  * obtain a function pointer (of type LPDIRECTDRAWENUMERATEEX) to DirectDrawEnumerateEx.
  4839.  * By default, only the primary display device is enumerated.
  4840.  * DirectDrawEnumerate is equivalent to DirectDrawEnumerate(,,DDENUM_NONDISPLAYDEVICES)
  4841.  *)
  4842.  
  4843. (*
  4844.  * This flag causes enumeration of any GDI display devices which are part of
  4845.  * the Windows Desktop
  4846.  *)
  4847.   DDENUM_ATTACHEDSECONDARYDEVICES     = $00000001;
  4848.  
  4849. (*
  4850.  * This flag causes enumeration of any GDI display devices which are not
  4851.  * part of the Windows Desktop
  4852.  *)
  4853.   DDENUM_DETACHEDSECONDARYDEVICES     = $00000002;
  4854.  
  4855. (*
  4856.  * This flag causes enumeration of non-display devices
  4857.  *)
  4858.   DDENUM_NONDISPLAYDEVICES            = $00000004;
  4859.  
  4860.   REGSTR_KEY_DDHW_DESCRIPTION = 'Description';
  4861.   REGSTR_KEY_DDHW_DRIVERNAME  = 'DriverName';
  4862.   REGSTR_PATH_DDHW            = 'Hardware\DirectDrawDrivers';
  4863.  
  4864.   DDCREATE_HARDWAREONLY       = $00000001;
  4865.   DDCREATE_EMULATIONONLY      = $00000002;
  4866.  
  4867. (*
  4868.  * Macros for interpretting DDEVICEIDENTIFIER2.dwWHQLLevel
  4869.  *)
  4870. function GET_WHQL_YEAR(dwWHQLLevel: DWORD) : DWORD;
  4871. function GET_WHQL_MONTH(dwWHQLLevel: DWORD) : DWORD;
  4872. function GET_WHQL_DAY(dwWHQLLevel: DWORD) : DWORD;
  4873.  
  4874.  
  4875. (*==========================================================================;
  4876.  *
  4877.  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
  4878.  *
  4879.  *  File:       dvp.h
  4880.  *  Content:    DirectDrawVideoPort include file
  4881.  *
  4882.  ***************************************************************************)
  4883.  
  4884. const
  4885. (*
  4886.  * GUIDS used by DirectDrawVideoPort objects
  4887.  *)
  4888.   DDVPTYPE_E_HREFH_VREFH: TGUID =
  4889.       (D1:$54F39980;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4890.   DDVPTYPE_E_HREFH_VREFL: TGUID =
  4891.       (D1:$92783220;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4892.   DDVPTYPE_E_HREFL_VREFH: TGUID =
  4893.       (D1:$A07A02E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4894.   DDVPTYPE_E_HREFL_VREFL: TGUID =
  4895.       (D1:$E09C77E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4896.   DDVPTYPE_CCIR656: TGUID =
  4897.       (D1:$FCA326A0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4898.   DDVPTYPE_BROOKTREE: TGUID =
  4899.       (D1:$1352A560;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4900.   DDVPTYPE_PHILIPS: TGUID =
  4901.       (D1:$332CF160;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8));
  4902.  
  4903. (*
  4904.  * GUIDS used to describe connections
  4905.  *)
  4906.  
  4907. (*============================================================================
  4908.  *
  4909.  * DirectDraw Structures
  4910.  *
  4911.  * Various structures used to invoke DirectDraw.
  4912.  *
  4913.  *==========================================================================*)
  4914.  
  4915. type
  4916.  
  4917. (*
  4918.  * TDDVideoPortConnect
  4919.  *)
  4920.   PDDVideoPortConnect = ^TDDVideoPortConnect;
  4921.   TDDVideoPortConnect = packed record
  4922.     dwSize: DWORD;        // size of the TDDVideoPortConnect structure
  4923.     dwPortWidth: DWORD;   // Width of the video port
  4924.     guidTypeID: TGUID;    // Description of video port connection
  4925.     dwFlags: DWORD;       // Connection flags
  4926.     dwReserved1: DWORD;   // Reserved, set to zero.
  4927.   end;
  4928.  
  4929. (*
  4930.  * TDDVideoPortCaps
  4931.  *)
  4932.   PDDVideoPortCaps = ^TDDVideoPortCaps;
  4933.   TDDVideoPortCaps = packed record
  4934.     dwSize: DWORD;                          // size of the TDDVideoPortCaps structure
  4935.     dwFlags: DWORD;                         // indicates which fields contain data
  4936.     dwMaxWidth: DWORD;                      // max width of the video port field
  4937.     dwMaxVBIWidth: DWORD;                   // max width of the VBI data
  4938.     dwMaxHeight: DWORD;                     // max height of the video port field
  4939.     dwVideoPortID: DWORD;                   // Video port ID (0 - (dwMaxVideoPorts -1))
  4940.     dwCaps: DWORD;                          // Video port capabilities
  4941.     dwFX: DWORD;                            // More video port capabilities
  4942.     dwNumAutoFlipSurfaces: DWORD;           // Number of autoflippable surfaces
  4943.     dwAlignVideoPortBoundary: DWORD;        // Byte restriction of placement within the surface
  4944.     dwAlignVideoPortPrescaleWidth: DWORD;   // Byte restriction of width after prescaling
  4945.     dwAlignVideoPortCropBoundary: DWORD;    // Byte restriction of left cropping
  4946.     dwAlignVideoPortCropWidth: DWORD;       // Byte restriction of cropping width
  4947.     dwPreshrinkXStep: DWORD;                // Width can be shrunk in steps of 1/x
  4948.     dwPreshrinkYStep: DWORD;                // Height can be shrunk in steps of 1/x
  4949.     dwNumVBIAutoFlipSurfaces: DWORD;        // Number of VBI autoflippable surfaces
  4950.     dwNumPreferredAutoflip: DWORD;      // Optimal number of autoflippable surfaces for hardware
  4951.     wNumFilterTapsX: WORD;              // Number of taps the prescaler uses in the X direction (0 - no prescale, 1 - replication, etc.)
  4952.     wNumFilterTapsY: WORD;              // Number of taps the prescaler uses in the Y direction (0 - no prescale, 1 - replication, etc.)
  4953.   end;
  4954.  
  4955. const
  4956. (*
  4957.  * The dwMaxWidth and dwMaxVBIWidth members are valid
  4958.  *)
  4959.   DDVPD_WIDTH = $00000001;
  4960.  
  4961. (*
  4962.  * The dwMaxHeight member is valid
  4963.  *)
  4964.   DDVPD_HEIGHT = $00000002;
  4965.  
  4966. (*
  4967.  * The dwVideoPortID member is valid
  4968.  *)
  4969.   DDVPD_ID = $00000004;
  4970.  
  4971. (*
  4972.  * The dwCaps member is valid
  4973.  *)
  4974.   DDVPD_CAPS = $00000008;
  4975.  
  4976. (*
  4977.  * The dwFX member is valid
  4978.  *)
  4979.   DDVPD_FX = $00000010;
  4980.  
  4981. (*
  4982.  * The dwNumAutoFlipSurfaces member is valid
  4983.  *)
  4984.   DDVPD_AUTOFLIP = $00000020;
  4985.  
  4986. (*
  4987.  * All of the alignment members are valid
  4988.  *)
  4989.   DDVPD_ALIGN = $00000040;
  4990.  
  4991. (*
  4992.  * The dwNumPreferredAutoflip member is valid
  4993.  *)
  4994.   DDVPD_PREFERREDAUTOFLIP = $00000080;
  4995.  
  4996. (*
  4997.  * The wNumFilterTapsX and wNumFilterTapsY fields are valid
  4998.  *)
  4999.   DDVPD_FILTERQUALITY     = $00000100;
  5000.  
  5001. type
  5002. (*
  5003.  * TDDVideoPortDesc
  5004.  *)
  5005.   PDDVideoPortDesc = ^TDDVideoPortDesc;
  5006.   TDDVideoPortDesc = packed record
  5007.     dwSize: DWORD;                       // size of the TDDVideoPortDesc structure
  5008.     dwFieldWidth: DWORD;                 // width of the video port field
  5009.     dwVBIWidth: DWORD;                   // width of the VBI data
  5010.     dwFieldHeight: DWORD;                // height of the video port field
  5011.     dwMicrosecondsPerField: DWORD;       // Microseconds per video field
  5012.     dwMaxPixelsPerSecond: DWORD;         // Maximum pixel rate per second
  5013.     dwVideoPortID: DWORD;                // Video port ID (0 - (dwMaxVideoPorts -1))
  5014.     dwReserved1: DWORD;                  // Reserved for future use - set to zero
  5015.     VideoPortType: TDDVideoPortConnect;  // Description of video port connection
  5016.     dwReserved2: DWORD;                  // Reserved for future use - set to zero
  5017.     dwReserved3: DWORD;                  // Reserved for future use - set to zero
  5018.   end;
  5019.  
  5020. (*
  5021.  * TDDVideoPortInfo
  5022.  *)
  5023.   PDDVideoPortInfo = ^TDDVideoPortInfo;
  5024.   TDDVideoPortInfo = packed record
  5025.     dwSize: DWORD;                            // Size of the structure
  5026.     dwOriginX: DWORD;                         // Placement of the video data within the surface.
  5027.     dwOriginY: DWORD;                         // Placement of the video data within the surface.
  5028.     dwVPFlags: DWORD;                         // Video port options
  5029.     rCrop: TRect;                             // Cropping rectangle (optional).
  5030.     dwPrescaleWidth: DWORD;                   // Determines pre-scaling/zooming in the X direction (optional).
  5031.     dwPrescaleHeight: DWORD;                  // Determines pre-scaling/zooming in the Y direction (optional).
  5032.     lpddpfInputFormat: PDDPixelFormat;       // Video format written to the video port
  5033.     lpddpfVBIInputFormat: PDDPixelFormat;    // Input format of the VBI data
  5034.     lpddpfVBIOutputFormat: PDDPixelFormat;   // Output format of the data
  5035.     dwVBIHeight: DWORD;                       // Specifies the number of lines of data within the vertical blanking interval.
  5036.     dwReserved1: DWORD;                       // Reserved for future use - set to zero
  5037.     dwReserved2: DWORD;                       // Reserved for future use - set to zero
  5038.   end;
  5039.  
  5040. (*
  5041.  * TDDVideoPortBandWidth
  5042.  *)
  5043.   PDDVideoPortBandWidth = ^TDDVideoPortBandWidth;
  5044.   TDDVideoPortBandWidth = packed record
  5045.     dwSize: DWORD;                 // Size of the structure
  5046.     dwCaps: DWORD;
  5047.     dwOverlay: DWORD;              // Zoom factor at which overlay is supported
  5048.     dwColorkey: DWORD;             // Zoom factor at which overlay w/ colorkey is supported
  5049.     dwYInterpolate: DWORD;         // Zoom factor at which overlay w/ Y interpolation is supported
  5050.     dwYInterpAndColorkey: DWORD;   // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported
  5051.     dwReserved1: DWORD;            // Reserved for future use - set to zero
  5052.     dwReserved2: DWORD;            // Reserved for future use - set to zero
  5053.   end;
  5054.  
  5055. (*
  5056.  * TDDVideoPortStatus
  5057.  *)
  5058.   PDDVideoPortStatus = ^TDDVideoPortStatus;
  5059.   TDDVideoPortStatus = record
  5060.     dwSize: DWORD;                       // Size of the structure
  5061.     bInUse: BOOL;                        // TRUE if video port is currently being used
  5062.     dwFlags: DWORD;                      // Currently not used
  5063.     dwReserved1: DWORD;                  // Reserved for future use
  5064.     VideoPortType: TDDVideoPortConnect;  // Information about the connection
  5065.     dwReserved2: DWORD;                  // Reserved for future use
  5066.     dwReserved3: DWORD;                  // Reserved for future use
  5067.   end;
  5068.  
  5069. const
  5070. (*============================================================================
  5071.  *
  5072.  * Video Port Flags
  5073.  *
  5074.  * All flags are bit flags.
  5075.  *
  5076.  *==========================================================================*)
  5077.  
  5078. (****************************************************************************
  5079.  *
  5080.  * VIDEOPORT TDDVideoPortConnect FLAGS
  5081.  *
  5082.  ****************************************************************************)
  5083.  
  5084. (*
  5085.  * When this is set by the driver and passed to the client, this
  5086.  * indicates that the video port is capable of double clocking the data.
  5087.  * When this is set by the client, this indicates that the video port
  5088.  * should enable double clocking.  This flag is only valid with external
  5089.  * syncs.
  5090.  *)
  5091.   DDVPCONNECT_DOUBLECLOCK = $00000001;
  5092.  
  5093. (*
  5094.  * When this is set by the driver and passed to the client, this
  5095.  * indicates that the video port is capable of using an external VACT
  5096.  * signal. When this is set by the client, this indicates that the
  5097.  * video port should use the external VACT signal.
  5098.  *)
  5099.   DDVPCONNECT_VACT = $00000002;
  5100.  
  5101. (*
  5102.  * When this is set by the driver and passed to the client, this
  5103.  * indicates that the video port is capable of treating even fields
  5104.  * like odd fields and visa versa.  When this is set by the client,
  5105.  * this indicates that the video port should treat even fields like odd
  5106.  * fields.
  5107.  *)
  5108.   DDVPCONNECT_INVERTPOLARITY = $00000004;
  5109.  
  5110. (*
  5111.  * Indicates that any data written to the video port during the VREF
  5112.  * period will not be written into the frame buffer. This flag is read only.
  5113.  *)
  5114.   DDVPCONNECT_DISCARDSVREFDATA = $00000008;
  5115.  
  5116. (*
  5117.  * When this is set be the driver and passed to the client, this
  5118.  * indicates that the device will write half lines into the frame buffer
  5119.  * if half lines are provided by the decoder.  If this is set by the client,
  5120.  * this indicates that the decoder will be supplying half lines.
  5121.  *)
  5122.   DDVPCONNECT_HALFLINE = $00000010;
  5123.  
  5124. (*
  5125.  * Indicates that the signal is interlaced. This flag is only
  5126.  * set by the client.
  5127.  *)
  5128.   DDVPCONNECT_INTERLACED = $00000020;
  5129.  
  5130. (*
  5131.  * Indicates that video port is shareable and that this video port
  5132.  * will use the even fields.  This flag is only set by the client.
  5133.  *)
  5134.   DDVPCONNECT_SHAREEVEN = $00000040;
  5135.  
  5136. (*
  5137.  * Indicates that video port is shareable and that this video port
  5138.  * will use the odd fields.  This flag is only set by the client.
  5139.  *)
  5140.   DDVPCONNECT_SHAREODD = $00000080;
  5141.  
  5142. (****************************************************************************
  5143.  *
  5144.  * VIDEOPORT TDDVideoPortDesc CAPS
  5145.  *
  5146.  ****************************************************************************)
  5147.  
  5148. (*
  5149.  * Flip can be performed automatically to avoid tearing.
  5150.  *)
  5151.   DDVPCAPS_AUTOFLIP = $00000001;
  5152.  
  5153. (*
  5154.  * Supports interlaced video
  5155.  *)
  5156.   DDVPCAPS_INTERLACED = $00000002;
  5157.  
  5158. (*
  5159.  * Supports non-interlaced video
  5160.  *)
  5161.   DDVPCAPS_NONINTERLACED = $00000004;
  5162.  
  5163. (*
  5164.  * Indicates that the device can return whether the current field
  5165.  * of an interlaced signal is even or odd.
  5166.  *)
  5167.   DDVPCAPS_READBACKFIELD = $00000008;
  5168.  
  5169. (*
  5170.  * Indicates that the device can return the current line of video
  5171.  * being written into the frame buffer.
  5172.  *)
  5173.   DDVPCAPS_READBACKLINE = $00000010;
  5174.  
  5175. (*
  5176.  * Allows two gen-locked video streams to share a single video port,
  5177.  * where one stream uses the even fields and the other uses the odd
  5178.  * fields. Separate parameters (including address, scaling,
  5179.  * cropping, etc.) are maintained for both fields.)
  5180.  *)
  5181.   DDVPCAPS_SHAREABLE = $00000020;
  5182.  
  5183. (*
  5184.  * Even fields of video can be automatically discarded.
  5185.  *)
  5186.   DDVPCAPS_SKIPEVENFIELDS = $00000040;
  5187.  
  5188. (*
  5189.  * Odd fields of video can be automatically discarded.
  5190.  *)
  5191.   DDVPCAPS_SKIPODDFIELDS = $00000080;
  5192.  
  5193. (*
  5194.  * Indicates that the device is capable of driving the graphics
  5195.  * VSYNC with the video port VSYNC.
  5196.  *)
  5197.   DDVPCAPS_SYNCMASTER = $00000100;
  5198.  
  5199. (*
  5200.  * Indicates that data within the vertical blanking interval can
  5201.  * be written to a different surface.
  5202.  *)
  5203.   DDVPCAPS_VBISURFACE = $00000200;
  5204.  
  5205. (*
  5206.  * Indicates that the video port can perform color operations
  5207.  * on the incoming data before it is written to the frame buffer.
  5208.  *)
  5209.   DDVPCAPS_COLORCONTROL = $00000400;
  5210.  
  5211. (*
  5212.  * Indicates that the video port can accept VBI data in a different
  5213.  * width or format than the regular video data.
  5214.  *)
  5215.   DDVPCAPS_OVERSAMPLEDVBI = $00000800;
  5216.  
  5217. (*
  5218.  * Indicates that the video port can write data directly to system memory
  5219.  *)
  5220.   DDVPCAPS_SYSTEMMEMORY = $00001000;
  5221.  
  5222. (*
  5223.  * Indicates that the VBI and video portions of the video stream can
  5224.  * be controlled by an independent processes.
  5225.  *)
  5226.   DDVPCAPS_VBIANDVIDEOINDEPENDENT       = $00002000;
  5227.  
  5228. (*
  5229.  * Indicates that the video port contains high quality hardware
  5230.  * de-interlacing hardware that should be used instead of the
  5231.  * bob/weave algorithms.
  5232.  *)
  5233.   DDVPCAPS_HARDWAREDEINTERLACE          = $00004000;
  5234.  
  5235. (****************************************************************************
  5236.  *
  5237.  * VIDEOPORT TDDVideoPortDesc FX
  5238.  *
  5239.  ****************************************************************************)
  5240.  
  5241. (*
  5242.  * Limited cropping is available to crop out the vertical interval data.
  5243.  *)
  5244.   DDVPFX_CROPTOPDATA = $00000001;
  5245.  
  5246. (*
  5247.  * Incoming data can be cropped in the X direction before it is written
  5248.  * to the surface.
  5249.  *)
  5250.   DDVPFX_CROPX = $00000002;
  5251.  
  5252. (*
  5253.  * Incoming data can be cropped in the Y direction before it is written
  5254.  * to the surface.
  5255.  *)
  5256.   DDVPFX_CROPY = $00000004;
  5257.  
  5258. (*
  5259.  * Supports interleaving interlaced fields in memory.
  5260.  *)
  5261.   DDVPFX_INTERLEAVE = $00000008;
  5262.  
  5263. (*
  5264.  * Supports mirroring left to right as the video data is written
  5265.  * into the frame buffer.
  5266.  *)
  5267.   DDVPFX_MIRRORLEFTRIGHT = $00000010;
  5268.  
  5269. (*
  5270.  * Supports mirroring top to bottom as the video data is written
  5271.  * into the frame buffer.
  5272.  *)
  5273.   DDVPFX_MIRRORUPDOWN = $00000020;
  5274.  
  5275. (*
  5276.  * Data can be arbitrarily shrunk in the X direction before it
  5277.  * is written to the surface.
  5278.  *)
  5279.   DDVPFX_PRESHRINKX = $00000040;
  5280.  
  5281. (*
  5282.  * Data can be arbitrarily shrunk in the Y direction before it
  5283.  * is written to the surface.
  5284.  *)
  5285.   DDVPFX_PRESHRINKY = $00000080;
  5286.  
  5287. (*
  5288.  * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the X
  5289.  * direction before it is written to the surface.
  5290.  *)
  5291.   DDVPFX_PRESHRINKXB = $00000100;
  5292.  
  5293. (*
  5294.  * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the Y
  5295.  * direction before it is written to the surface.
  5296.  *)
  5297.   DDVPFX_PRESHRINKYB = $00000200;
  5298.  
  5299. (*
  5300.  * Data can be shrunk in increments of 1/x in the X direction
  5301.  * (where X is specified in the TDDVideoPortCaps.dwPreshrinkXStep)
  5302.  * before it is written to the surface.
  5303.  *)
  5304.   DDVPFX_PRESHRINKXS = $00000400;
  5305.  
  5306. (*
  5307.  * Data can be shrunk in increments of 1/x in the Y direction
  5308.  * (where X is specified in the TDDVideoPortCaps.dwPreshrinkYStep)
  5309.  * before it is written to the surface.
  5310.  *)
  5311.   DDVPFX_PRESHRINKYS = $00000800;
  5312.  
  5313. (*
  5314.  * Data can be arbitrarily stretched in the X direction before
  5315.  * it is written to the surface.
  5316.  *)
  5317.   DDVPFX_PRESTRETCHX = $00001000;
  5318.  
  5319. (*
  5320.  * Data can be arbitrarily stretched in the Y direction before
  5321.  * it is written to the surface.
  5322.  *)
  5323.   DDVPFX_PRESTRETCHY = $00002000;
  5324.  
  5325. (*
  5326.  * Data can be integer stretched in the X direction before it is
  5327.  * written to the surface.
  5328.  *)
  5329.   DDVPFX_PRESTRETCHXN = $00004000;
  5330.  
  5331. (*
  5332.  * Data can be integer stretched in the Y direction before it is
  5333.  * written to the surface.
  5334.  *)
  5335.   DDVPFX_PRESTRETCHYN = $00008000;
  5336.  
  5337. (*
  5338.  * Indicates that data within the vertical blanking interval can
  5339.  * be converted independently of the remaining video data.
  5340.  *)
  5341.   DDVPFX_VBICONVERT = $00010000;
  5342.  
  5343. (*
  5344.  * Indicates that scaling can be disabled for data within the
  5345.  * vertical blanking interval.
  5346.  *)
  5347.   DDVPFX_VBINOSCALE = $00020000;
  5348.  
  5349. (*
  5350.  * Indicates that the video data can ignore the left and right
  5351.  * cropping coordinates when cropping oversampled VBI data.
  5352.  *)
  5353.   DDVPFX_IGNOREVBIXCROP = $00040000;
  5354.  
  5355. (*
  5356.  * Indicates that interleaving can be disabled for data within the
  5357.  * vertical blanking interval.
  5358.  *)
  5359.   DDVPFX_VBINOINTERLEAVE     = $00080000;
  5360.  
  5361. (****************************************************************************
  5362.  *
  5363.  * VIDEOPORT TDDVideoPortInfo FLAGS
  5364.  *
  5365.  ****************************************************************************)
  5366.  
  5367. (*
  5368.  * Perform automatic flipping.   Auto-flipping is performed between
  5369.  * the overlay surface that was attached to the video port using
  5370.  * IDirectDrawVideoPort::AttachSurface and the overlay surfaces that
  5371.  * are attached to the surface via the IDirectDrawSurface::AttachSurface
  5372.  * method.  The flip order is the order in which the overlay surfaces
  5373.  * were. attached.
  5374.  *)
  5375.   DDVP_AUTOFLIP = $00000001;
  5376.  
  5377. (*
  5378.  * Perform conversion using the ddpfOutputFormat information.
  5379.  *)
  5380.   DDVP_CONVERT = $00000002;
  5381.  
  5382. (*
  5383.  * Perform cropping using the specified rectangle.
  5384.  *)
  5385.   DDVP_CROP = $00000004;
  5386.  
  5387. (*
  5388.  * Indicates that interlaced fields should be interleaved in memory.
  5389.  *)
  5390.   DDVP_INTERLEAVE = $00000008;
  5391.  
  5392. (*
  5393.  * Indicates that the data should be mirrored left to right as it's
  5394.  * written into the frame buffer.
  5395.  *)
  5396.   DDVP_MIRRORLEFTRIGHT = $00000010;
  5397.  
  5398. (*
  5399.  * Indicates that the data should be mirrored top to bottom as it's
  5400.  * written into the frame buffer.
  5401.  *)
  5402.   DDVP_MIRRORUPDOWN = $00000020;
  5403.  
  5404. (*
  5405.  * Perform pre-scaling/zooming based on the pre-scale parameters.
  5406.  *)
  5407.   DDVP_PRESCALE = $00000040;
  5408.  
  5409. (*
  5410.  * Ignore input of even fields.
  5411.  *)
  5412.   DDVP_SKIPEVENFIELDS = $00000080;
  5413.  
  5414. (*
  5415.  * Ignore input of odd fields.
  5416.  *)
  5417.   DDVP_SKIPODDFIELDS = $00000100;
  5418.  
  5419. (*
  5420.  * Drive the graphics VSYNCs using the video port VYSNCs.
  5421.  *)
  5422.   DDVP_SYNCMASTER = $00000200;
  5423.  
  5424. (*
  5425.  * The ddpfVBIOutputFormatFormat member contains data that should be used
  5426.  * to convert the data within the vertical blanking interval.
  5427.  *)
  5428.   DDVP_VBICONVERT = $00000400;
  5429.  
  5430. (*
  5431.  * Indicates that data within the vertical blanking interval
  5432.  * should not be scaled.
  5433.  *)
  5434.   DDVP_VBINOSCALE = $00000800;
  5435.  
  5436. (*
  5437.  * Indicates that these bob/weave decisions should not be
  5438.  * overriden by other interfaces.
  5439.  *)
  5440.   DDVP_OVERRIDEBOBWEAVE = $00001000;
  5441.  
  5442. (*
  5443.  * Indicates that the video data should ignore the left and right
  5444.  * cropping coordinates when cropping the VBI data.
  5445.  *)
  5446.   DDVP_IGNOREVBIXCROP = $00002000;
  5447.  
  5448. (*
  5449.  * Indicates that interleaving can be disabled for data within the
  5450.  * vertical blanking interval.
  5451.  *)
  5452.   DDVP_VBINOINTERLEAVE                  = $00004000;
  5453.  
  5454. (*
  5455.  * Indicates that the video port should use the hardware
  5456.  * de-interlacing hardware.
  5457.  *)
  5458.   DDVP_HARDWAREDEINTERLACE              = $00008000;
  5459.  
  5460. (****************************************************************************
  5461.  *
  5462.  * DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS
  5463.  *
  5464.  ****************************************************************************)
  5465.  
  5466. (*
  5467.  * Return formats for the video data
  5468.  *)
  5469.   DDVPFORMAT_VIDEO = $00000001;
  5470.  
  5471. (*
  5472.  * Return formats for the VBI data
  5473.  *)
  5474.   DDVPFORMAT_VBI = $00000002;
  5475.  
  5476. (****************************************************************************
  5477.  *
  5478.  * DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS
  5479.  *
  5480.  ****************************************************************************)
  5481.  
  5482. (*
  5483.  * Surface should receive video data (and VBI data if a surface
  5484.  * is not explicitly attached for that purpose)
  5485.  *)
  5486.   DDVPTARGET_VIDEO = $00000001;
  5487.  
  5488. (*
  5489.  * Surface should receive VBI data
  5490.  *)
  5491.   DDVPTARGET_VBI = $00000002;
  5492.  
  5493. (****************************************************************************
  5494.  *
  5495.  * DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS
  5496.  *
  5497.  ****************************************************************************)
  5498.  
  5499. (*
  5500.  * Waits until the beginning of the next VSYNC
  5501.  *)
  5502.   DDVPWAIT_BEGIN = $00000001;
  5503.  
  5504. (*
  5505.  * Waits until the end of the next/current VSYNC
  5506.  *)
  5507.   DDVPWAIT_END = $00000002;
  5508.  
  5509. (*
  5510.  * Waits until the beginning of the specified line
  5511.  *)
  5512.   DDVPWAIT_LINE = $00000003;
  5513.  
  5514. (****************************************************************************
  5515.  *
  5516.  * DIRECTDRAWVIDEOPORT FLIP FLAGS
  5517.  *
  5518.  ****************************************************************************)
  5519.  
  5520. (*
  5521.  * Flips the normal video surface
  5522.  *)
  5523.   DDVPFLIP_VIDEO = $00000001;
  5524.  
  5525. (*
  5526.  * Flips the VBI surface
  5527.  *)
  5528.   DDVPFLIP_VBI = $00000002;
  5529.  
  5530. (****************************************************************************
  5531.  *
  5532.  * DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES
  5533.  *
  5534.  ****************************************************************************)
  5535.  
  5536. (*
  5537.  * No video signal is present at the video port
  5538.  *)
  5539.   DDVPSQ_NOSIGNAL = $00000001;
  5540.  
  5541. (*
  5542.  * A valid video signal is present at the video port
  5543.  *)
  5544.   DDVPSQ_SIGNALOK = $00000002;
  5545.  
  5546. (****************************************************************************
  5547.  *
  5548.  * VIDEOPORTBANDWIDTH Flags
  5549.  *
  5550.  ****************************************************************************)
  5551.  
  5552. (*
  5553.  * The specified height/width refer to the size of the video port data
  5554.  * written into memory, after prescaling has occured.
  5555.  *)
  5556.   DDVPB_VIDEOPORT = $00000001;
  5557.  
  5558. (*
  5559.  * The specified height/width refer to the source size of the overlay.
  5560.  *)
  5561.   DDVPB_OVERLAY = $00000002;
  5562.  
  5563. (*
  5564.  * This is a query for the device to return which caps this device requires.
  5565.  *)
  5566.   DDVPB_TYPE = $00000004;
  5567.  
  5568. (****************************************************************************
  5569.  *
  5570.  * VIDEOPORTBANDWIDTH Caps
  5571.  *
  5572.  ****************************************************************************)
  5573.  
  5574. (*
  5575.  * The bandwidth for this device is dependant on the overlay source size.
  5576.  *)
  5577.   DDVPBCAPS_SOURCE = $00000001;
  5578.  
  5579. (*
  5580.  * The bandwidth for this device is dependant on the overlay destination
  5581.  * size.
  5582.  *)
  5583.   DDVPBCAPS_DESTINATION = $00000002;
  5584.  
  5585. (****************************************************************************
  5586.  *
  5587.  * DDVIDEOPORTCONTAINER CreateVideoPort flags
  5588.  *
  5589.  ****************************************************************************)
  5590.  
  5591. (*
  5592.  * The process only wants to control the VBI portion of the video stream.
  5593.  *)
  5594.   DDVPCREATE_VBIONLY                    = $00000001;
  5595.  
  5596. (*
  5597.  * The process only wants to control the non-VBI (video) portion of
  5598.  * the video stream.
  5599.  *)
  5600.   DDVPCREATE_VIDEOONLY                  = $00000002;
  5601.  
  5602. (****************************************************************************
  5603.  *
  5604.  * DDVIDEOPORTSTATUS flags
  5605.  *
  5606.  ****************************************************************************)
  5607.  
  5608. (*
  5609.  * The video port interface is only controlling the VBI portion of the
  5610.  * video stream
  5611.  *)
  5612.   DDVPSTATUS_VBIONLY                    = $00000001;
  5613.  
  5614. (*
  5615.  * The video port interface is only controlling the video portion of the
  5616.  * video stream
  5617.  *)
  5618.   DDVPSTATUS_VIDEOONLY                  = $00000002;
  5619.  
  5620.  
  5621. type
  5622. (*
  5623.  * API's
  5624.  *)
  5625.  
  5626.   TDDEnumVideoCallback = function (lpTDDVideoPortCaps: PDDVideoPortCaps;
  5627.       lpContext: Pointer) : HResult; stdcall;
  5628.  
  5629. (*
  5630.  * INTERACES FOLLOW:
  5631.  *      IDirectDrawVideoPort
  5632.  *      IVideoPort
  5633.  *)
  5634.  
  5635.  
  5636. (*
  5637.  * IDirectDrawVideoPort
  5638.  *)
  5639.   IDirectDrawVideoPort = interface (IUnknown)
  5640.     ['{B36D93E0-2B43-11CF-A2DE-00AA00B93356}']
  5641.     (*** IDirectDrawVideoPort methods ***)
  5642.     function Flip(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) : HResult; stdcall;
  5643.     function GetBandwidthInfo(var lpddpfFormat: TDDPixelFormat;
  5644.         dwWidth: DWORD; dwHeight: DWORD; dwFlags: DWORD;
  5645.         var lpBandwidth: TDDVideoPortBandWidth) : HResult; stdcall;
  5646.     function GetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
  5647.     function GetInputFormats(var lpNumFormats: DWORD; var lpFormats:
  5648.         TDDPixelFormat; dwFlags: DWORD) : HResult; stdcall;
  5649.     function GetOutputFormats(var lpInputFormat: TDDPixelFormat;
  5650.         var lpNumFormats: DWORD; lpFormats: PDDPixelFormat; dwFlags: DWORD)
  5651.         : HResult; stdcall;
  5652.     function GetFieldPolarity(var lpbVideoField: BOOL) : HResult; stdcall;
  5653.     function GetVideoLine(var lpdwLine: DWORD) : HResult; stdcall;
  5654.     function GetVideoSignalStatus(varlpdwStatus: DWORD) : HResult; stdcall;
  5655.     function SetColorControls(var lpColorControl: TDDColorControl) : HResult; stdcall;
  5656.     function SetTargetSurface(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD) :
  5657.         HResult; stdcall;
  5658.     function StartVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
  5659.     function StopVideo: HResult; stdcall;
  5660.     function UpdateVideo(var lpVideoInfo: TDDVideoPortInfo) : HResult; stdcall;
  5661.     function WaitForSync(dwFlags: DWORD; dwLine: DWORD; dwTimeout: DWORD) :
  5662.         HResult; stdcall;
  5663.   end;
  5664.  
  5665. (*
  5666.  * IDirectDrawVideoPortContainer
  5667.  *)
  5668.   IDDVideoPortContainer = interface (IUnknown)
  5669.     ['{6C142760-A733-11CE-A521-0020AF0BE560}']
  5670.     (*** IDDVideoPortContainer methods ***)
  5671.     function CreateVideoPort(dwFlags: DWORD; var lpTDDVideoPortDesc:
  5672.         TDDVideoPortDesc; var lplpDDVideoPort: IDirectDrawVideoPort;
  5673.         pUnkOuter: IUnknown) : HResult; stdcall;
  5674.     function EnumVideoPorts(dwFlags: DWORD;
  5675.         lpTDDVideoPortCaps: PDDVideoPortCaps; lpContext: Pointer;
  5676.         lpEnumVideoCallback: TDDEnumVideoCallback) : HResult; stdcall;
  5677.     function GetVideoPortConnectInfo(dwPortId: DWORD; var lpNumEntries: DWORD;
  5678.         lpConnectInfo: PDDVideoPortConnect) : HResult; stdcall;
  5679.     function QueryVideoPortStatus(dwPortId: DWORD;
  5680.         var lpVPStatus: TDDVideoPortStatus) : HResult; stdcall;
  5681.   end;
  5682.  
  5683.   IID_IDDVideoPortContainer = IDDVideoPortContainer;
  5684.   IID_IDirectDrawVideoPort = IDirectDrawVideoPort;
  5685.  
  5686.  
  5687. //Direct3D file
  5688. (*==========================================================================;
  5689.  *
  5690.  *  Copyright (C) 1995-1998 Microsoft Corporation.  All Rights Reserved.
  5691.  *
  5692.  *  Files:   d3dtypes.h d3dcaps.h d3d.h
  5693.  *
  5694.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  5695.  *
  5696.  *  Modyfied: 26-Jun-2000
  5697.  *
  5698.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  5699.  *  E-Mail: DelphiDirectX@next-reality.com
  5700.  *
  5701.  ***************************************************************************)
  5702.  
  5703. (* TD3DValue is the fundamental Direct3D fractional data type *)
  5704.  
  5705. type
  5706.   TRefClsID = TGUID;
  5707.  
  5708. type
  5709.   TD3DValue = Single;
  5710.   TD3DFixed = LongInt;
  5711.   float = TD3DValue;
  5712.   PD3DColor = ^TD3DColor;
  5713.   TD3DColor = DWORD;
  5714.  
  5715. function D3DVal(val: variant) : float;
  5716. function D3DDivide(a,b: double) : float;
  5717. function D3DMultiply(a,b: double) : float;
  5718.  
  5719. (*
  5720.  * Format of CI colors is
  5721.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5722.  *  |    alpha      |         color index           |   fraction    |
  5723.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5724.  *)
  5725.  
  5726. // #define CI_GETALPHA(ci)    ((ci) >> 24)
  5727. function CI_GETALPHA(ci: DWORD) : DWORD;
  5728.  
  5729. // #define CI_GETINDEX(ci)    (((ci) >> 8) & 0xffff)
  5730. function CI_GETINDEX(ci: DWORD) : DWORD;
  5731.  
  5732. // #define CI_GETFRACTION(ci) ((ci) & 0xff)
  5733. function CI_GETFRACTION(ci: DWORD) : DWORD;
  5734.  
  5735. // #define CI_ROUNDINDEX(ci)  CI_GETINDEX((ci) + 0x80)
  5736. function CI_ROUNDINDEX(ci: DWORD) : DWORD;
  5737.  
  5738. // #define CI_MASKALPHA(ci)   ((ci) & 0xffffff)
  5739. function CI_MASKALPHA(ci: DWORD) : DWORD;
  5740.  
  5741. // #define CI_MAKE(a, i, f)    (((a) << 24) | ((i) << 8) | (f))
  5742. function CI_MAKE(a,i,f: DWORD) : DWORD;
  5743.  
  5744. (*
  5745.  * Format of RGBA colors is
  5746.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5747.  *  |    alpha      |      red      |     green     |     blue      |
  5748.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5749.  *)
  5750.  
  5751. // #define RGBA_GETALPHA(rgb)      ((rgb) >> 24)
  5752. function RGBA_GETALPHA(rgb: TD3DColor) : DWORD;
  5753.  
  5754. // #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
  5755. function RGBA_GETRED(rgb: TD3DColor) : DWORD;
  5756.  
  5757. // #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
  5758. function RGBA_GETGREEN(rgb: TD3DColor) : DWORD;
  5759.  
  5760. // #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
  5761. function RGBA_GETBLUE(rgb: TD3DColor) : DWORD;
  5762.  
  5763. // #define RGBA_MAKE(r, g, b, a)   ((TD3DColor) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
  5764. function RGBA_MAKE(r, g, b, a: DWORD) : TD3DColor;
  5765.  
  5766. (* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs
  5767.  * The float values must be in the range 0..1
  5768.  *)
  5769.  
  5770. // #define D3DRGB(r, g, b) \
  5771. //     (0xff000000L | (((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
  5772. function D3DRGB(r, g, b: float) : TD3DColor;
  5773.  
  5774. // #define D3DRGBA(r, g, b, a) \
  5775. //     (  (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
  5776. //     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) \
  5777. //    )
  5778. function D3DRGBA(r, g, b, a: float) : TD3DColor;
  5779.  
  5780. (*
  5781.  * Format of RGB colors is
  5782.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5783.  *  |    ignored    |      red      |     green     |     blue      |
  5784.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5785.  *)
  5786.  
  5787. // #define RGB_GETRED(rgb)         (((rgb) >> 16) & 0xff)
  5788. function RGB_GETRED(rgb: TD3DColor) : DWORD;
  5789.  
  5790. // #define RGB_GETGREEN(rgb)       (((rgb) >> 8) & 0xff)
  5791. function RGB_GETGREEN(rgb: TD3DColor) : DWORD;
  5792.  
  5793. // #define RGB_GETBLUE(rgb)        ((rgb) & 0xff)
  5794. function RGB_GETBLUE(rgb: TD3DColor) : DWORD;
  5795.  
  5796. // #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
  5797. function RGBA_SETALPHA(rgba: TD3DColor; x: DWORD) : TD3DColor;
  5798.  
  5799. // #define RGB_MAKE(r, g, b)       ((TD3DColor) (((r) << 16) | ((g) << 8) | (b)))
  5800. function RGB_MAKE(r, g, b: DWORD) : TD3DColor;
  5801.  
  5802. // #define RGBA_TORGB(rgba)       ((TD3DColor) ((rgba) & 0xffffff))
  5803. function RGBA_TORGB(rgba: TD3DColor) : TD3DColor;
  5804.  
  5805. // #define RGB_TORGBA(rgb)        ((TD3DColor) ((rgb) | 0xff000000))
  5806. function RGB_TORGBA(rgb: TD3DColor) : TD3DColor;
  5807.  
  5808. (*
  5809.  * Flags for Enumerate functions
  5810.  *)
  5811. const
  5812.  
  5813. (*
  5814.  * Stop the enumeration
  5815.  *)
  5816.  
  5817.   D3DENUMRET_CANCEL                        = DDENUMRET_CANCEL;
  5818.  
  5819. (*
  5820.  * Continue the enumeration
  5821.  *)
  5822.  
  5823.   D3DENUMRET_OK                            = DDENUMRET_OK;
  5824.  
  5825. type
  5826.   TD3DValidateCallback = function (lpUserArg: Pointer;
  5827.       dwOffset: DWORD): HResult; stdcall;
  5828.   TD3DEnumTextureFormatsCallback = function (var lpDdsd: TDDSurfaceDesc;
  5829.       lpContext: Pointer): HResult; stdcall;
  5830.   TD3DEnumPixelFormatsCallback = function (var lpDDPixFmt: TDDPixelFormat;
  5831.       lpContext: Pointer): HResult; stdcall;
  5832.  
  5833.  
  5834.   PD3DMaterialHandle = ^TD3DMaterialHandle;
  5835.   TD3DMaterialHandle = DWORD;
  5836.  
  5837.   PD3DTextureHandle = ^TD3DTextureHandle;
  5838.   TD3DTextureHandle = DWORD;
  5839.  
  5840.   PD3DMatrixHandle = ^TD3DMatrixHandle;
  5841.   TD3DMatrixHandle = DWORD;
  5842.  
  5843.   PD3DColorValue = ^TD3DColorValue;
  5844.   TD3DColorValue = packed record
  5845.     case Integer of
  5846.     0: (
  5847.       r: TD3DValue;
  5848.       g: TD3DValue;
  5849.       b: TD3DValue;
  5850.       a: TD3DValue;
  5851.      );
  5852.     1: (
  5853.       dvR: TD3DValue;
  5854.       dvG: TD3DValue;
  5855.       dvB: TD3DValue;
  5856.       dvA: TD3DValue;
  5857.      );
  5858.   end;
  5859.  
  5860.   PD3DRect = ^TD3DRect;
  5861.   TD3DRect = packed record
  5862.     case Integer of
  5863.     0: (
  5864.       x1: LongInt;
  5865.       y1: LongInt;
  5866.       x2: LongInt;
  5867.       y2: LongInt;
  5868.      );
  5869.     1: (
  5870.       lX1: LongInt;
  5871.       lY1: LongInt;
  5872.       lX2: LongInt;
  5873.       lY2: LongInt;
  5874.      );
  5875.      2: (
  5876.        a: array[0..3] of LongInt;
  5877.      );
  5878.   end;
  5879.  
  5880.   PD3DVector = ^TD3DVector;
  5881.   TD3DVector = packed record
  5882.     case Integer of
  5883.     0: (
  5884.       x: TD3DValue;
  5885.       y: TD3DValue;
  5886.       z: TD3DValue;
  5887.      );
  5888.     1: (
  5889.       dvX: TD3DValue;
  5890.       dvY: TD3DValue;
  5891.       dvZ: TD3DValue;
  5892.      );
  5893.   end;
  5894.  
  5895. (******************************************************************
  5896.  *                                                                *
  5897.  *   D3DVec.inl                                                   *
  5898.  *                                                                *
  5899.  *   Float-valued 3D vector class for Direct3D.                   *
  5900.  *                                                                *
  5901.  *   Copyright (c) 1996-1998 Microsoft Corp. All rights reserved. *
  5902.  *                                                                *
  5903.  ******************************************************************)
  5904.  
  5905.     // Addition and subtraction
  5906.   function VectorAdd(const v1, v2: TD3DVector) : TD3DVector;
  5907.   function VectorSub(const v1, v2: TD3DVector) : TD3DVector;
  5908.     // Scalar multiplication and division
  5909.   function VectorMulS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
  5910.   function VectorDivS(const v: TD3DVector; s: TD3DValue) : TD3DVector;
  5911.     // Memberwise multiplication and division
  5912.   function VectorMul(const v1, v2: TD3DVector) : TD3DVector;
  5913.   function VectorDiv(const v1, v2: TD3DVector) : TD3DVector;
  5914.     // Vector dominance
  5915.   function VectorSmaller(v1, v2: TD3DVector) : boolean;
  5916.   function VectorSmallerEquel(v1, v2: TD3DVector) : boolean;
  5917.     // Bitwise equality
  5918.   function VectorEquel(v1, v2: TD3DVector) : boolean;
  5919.     // Length-related functions
  5920.   function VectorSquareMagnitude(v: TD3DVector) : TD3DValue;
  5921.   function VectorMagnitude(v: TD3DVector) : TD3DValue;
  5922.     // Returns vector with same direction and unit length
  5923.   function VectorNormalize(const v: TD3DVector) : TD3DVector;
  5924.     // Return min/max component of the input vector
  5925.   function VectorMin(v: TD3DVector) : TD3DValue;
  5926.   function VectorMax(v: TD3DVector) : TD3DValue;
  5927.     // Return memberwise min/max of input vectors
  5928.   function VectorMinimize(const v1, v2: TD3DVector) : TD3DVector;
  5929.   function VectorMaximize(const v1, v2: TD3DVector) : TD3DVector;
  5930.     // Dot and cross product
  5931.   function VectorDotProduct(v1, v2: TD3DVector) : TD3DValue;
  5932.   function VectorCrossProduct(const v1, v2: TD3DVector) : TD3DVector;
  5933.  
  5934. type
  5935. (*
  5936.  * Vertex data types supported in an ExecuteBuffer.
  5937.  *)
  5938.  
  5939. (*
  5940.  * Homogeneous vertices
  5941.  *)
  5942.  
  5943.   PD3DHVertex = ^TD3DHVertex;
  5944.   TD3DHVertex = packed record
  5945.     dwFlags: DWORD;        (* Homogeneous clipping flags *)
  5946.     case Integer of
  5947.     0: (
  5948.       hx: TD3DValue;
  5949.       hy: TD3DValue;
  5950.       hz: TD3DValue;
  5951.      );
  5952.     1: (
  5953.       dvHX: TD3DValue;
  5954.       dvHY: TD3DValue;
  5955.       dvHZ: TD3DValue;
  5956.      );
  5957.   end;
  5958.  
  5959. (*
  5960.  * Transformed/lit vertices
  5961.  *)
  5962.  
  5963.   PD3DTLVertex = ^TD3DTLVertex;
  5964.   TD3DTLVertex = packed record
  5965.     case Integer of
  5966.     0: (
  5967.       sx: TD3DValue;             (* Screen coordinates *)
  5968.       sy: TD3DValue;
  5969.       sz: TD3DValue;
  5970.       rhw: TD3DValue;            (* Reciprocal of homogeneous w *)
  5971.       color: TD3DColor;          (* Vertex color *)
  5972.       specular: TD3DColor;       (* Specular component of vertex *)
  5973.       tu: TD3DValue;             (* Texture coordinates *)
  5974.       tv: TD3DValue;
  5975.      );
  5976.     1: (
  5977.       dvSX: TD3DValue;
  5978.       dvSY: TD3DValue;
  5979.       dvSZ: TD3DValue;
  5980.       dvRHW: TD3DValue;
  5981.       dcColor: TD3DColor;
  5982.       dcSpecular: TD3DColor;
  5983.       dvTU: TD3DValue;
  5984.       dvTV: TD3DValue;
  5985.      );
  5986.   end;
  5987.  
  5988. (*
  5989.  * Untransformed/lit vertices
  5990.  *)
  5991.  
  5992.   PD3DLVertex = ^TD3DLVertex;
  5993.   TD3DLVertex = packed record
  5994.     case Integer of
  5995.     0: (
  5996.       x: TD3DValue;             (* Homogeneous coordinates *)
  5997.       y: TD3DValue;
  5998.       z: TD3DValue;
  5999.       dwReserved: DWORD;
  6000.       color: TD3DColor;         (* Vertex color *)
  6001.       specular: TD3DColor;      (* Specular component of vertex *)
  6002.       tu: TD3DValue;            (* Texture coordinates *)
  6003.       tv: TD3DValue;
  6004.      );
  6005.     1: (
  6006.       dvX: TD3DValue;
  6007.       dvY: TD3DValue;
  6008.       dvZ: TD3DValue;
  6009.       UNIONFILLER1d: DWORD;
  6010.       dcColor: TD3DColor;
  6011.       dcSpecular: TD3DColor;
  6012.       dvTU: TD3DValue;
  6013.       dvTV: TD3DValue;
  6014.      );
  6015.   end;
  6016.  
  6017. (*
  6018.  * Untransformed/unlit vertices
  6019.  *)
  6020.  
  6021.   PD3DVertex = ^TD3DVertex;
  6022.   TD3DVertex = packed record
  6023.     case Integer of
  6024.     0: (
  6025.       x: TD3DValue;             (* Homogeneous coordinates *)
  6026.       y: TD3DValue;
  6027.       z: TD3DValue;
  6028.       nx: TD3DValue;            (* Normal *)
  6029.       ny: TD3DValue;
  6030.       nz: TD3DValue;
  6031.       tu: TD3DValue;            (* Texture coordinates *)
  6032.       tv: TD3DValue;
  6033.      );
  6034.     1: (
  6035.       dvX: TD3DValue;
  6036.       dvY: TD3DValue;
  6037.       dvZ: TD3DValue;
  6038.       dvNX: TD3DValue;
  6039.       dvNY: TD3DValue;
  6040.       dvNZ: TD3DValue;
  6041.       dvTU: TD3DValue;
  6042.       dvTV: TD3DValue;
  6043.      );
  6044.   end;
  6045.  
  6046. (*
  6047.  * Matrix, viewport, and tranformation structures and definitions.
  6048.  *)
  6049.  
  6050.   PD3DMatrix = ^TD3DMatrix;
  6051.   TD3DMatrix = packed record
  6052.     case integer of
  6053.       0 : (_11, _12, _13, _14: TD3DValue;
  6054.            _21, _22, _23, _24: TD3DValue;
  6055.            _31, _32, _33, _34: TD3DValue;
  6056.            _41, _42, _43, _44: TD3DValue);
  6057.       1 : (m : array [0..3, 0..3] of TD3DValue);
  6058.   end;
  6059.  
  6060.   PD3DViewport = ^TD3DViewport;
  6061.   TD3DViewport = packed record
  6062.     dwSize: DWORD;
  6063.     dwX: DWORD;
  6064.     dwY: DWORD;                (* Top left *)
  6065.     dwWidth: DWORD;
  6066.     dwHeight: DWORD;           (* Dimensions *)
  6067.     dvScaleX: TD3DValue;       (* Scale homogeneous to screen *)
  6068.     dvScaleY: TD3DValue;       (* Scale homogeneous to screen *)
  6069.     dvMaxX: TD3DValue;         (* Min/max homogeneous x coord *)
  6070.     dvMaxY: TD3DValue;         (* Min/max homogeneous y coord *)
  6071.     dvMinZ: TD3DValue;
  6072.     dvMaxZ: TD3DValue;         (* Min/max homogeneous z coord *)
  6073.   end;
  6074.  
  6075.   PD3DViewport2 = ^TD3DViewport2;
  6076.   TD3DViewport2 = packed record
  6077.     dwSize: DWORD;
  6078.     dwX: DWORD;
  6079.     dwY: DWORD;                (* Viewport Top left *)
  6080.     dwWidth: DWORD;
  6081.     dwHeight: DWORD;           (* Viewport Dimensions *)
  6082.     dvClipX: TD3DValue;        (* Top left of clip volume *)
  6083.     dvClipY: TD3DValue;
  6084.     dvClipWidth: TD3DValue;    (* Clip Volume Dimensions *)
  6085.     dvClipHeight: TD3DValue;
  6086.     dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
  6087.     dvMaxZ: TD3DValue;
  6088.   end;
  6089.  
  6090.   PD3DViewport7 = ^TD3DViewport7;
  6091.   TD3DViewport7 = packed record
  6092.     dwX: DWORD;
  6093.     dwY: DWORD;                (* Viewport Top left *)
  6094.     dwWidth: DWORD;
  6095.     dwHeight: DWORD;           (* Viewport Dimensions *)
  6096.     dvMinZ: TD3DValue;         (* Min/max of clip Volume *)
  6097.     dvMaxZ: TD3DValue;
  6098.   end;
  6099.  
  6100. (*
  6101.  * Values for clip fields.
  6102.  *)
  6103.  
  6104. const
  6105. // Max number of user clipping planes, supported in D3D.
  6106.   D3DMAXUSERCLIPPLANES  = 32;
  6107.  
  6108. // These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE
  6109. //
  6110.   D3DCLIPPLANE0 = (1 shl 0);
  6111.   D3DCLIPPLANE1 = (1 shl 1);
  6112.   D3DCLIPPLANE2 = (1 shl 2);
  6113.   D3DCLIPPLANE3 = (1 shl 3);
  6114.   D3DCLIPPLANE4 = (1 shl 4);
  6115.   D3DCLIPPLANE5 = (1 shl 5);
  6116.  
  6117. const
  6118.   D3DCLIP_LEFT                            = $00000001;
  6119.   D3DCLIP_RIGHT                           = $00000002;
  6120.   D3DCLIP_TOP                             = $00000004;
  6121.   D3DCLIP_BOTTOM                          = $00000008;
  6122.   D3DCLIP_FRONT                           = $00000010;
  6123.   D3DCLIP_BACK                            = $00000020;
  6124.   D3DCLIP_GEN0                            = $00000040;
  6125.   D3DCLIP_GEN1                            = $00000080;
  6126.   D3DCLIP_GEN2                            = $00000100;
  6127.   D3DCLIP_GEN3                            = $00000200;
  6128.   D3DCLIP_GEN4                            = $00000400;
  6129.   D3DCLIP_GEN5                            = $00000800;
  6130.  
  6131. (*
  6132.  * Values for d3d status.
  6133.  *)
  6134.  
  6135.   D3DSTATUS_CLIPUNIONLEFT                 = D3DCLIP_LEFT;
  6136.   D3DSTATUS_CLIPUNIONRIGHT                = D3DCLIP_RIGHT;
  6137.   D3DSTATUS_CLIPUNIONTOP                  = D3DCLIP_TOP;
  6138.   D3DSTATUS_CLIPUNIONBOTTOM               = D3DCLIP_BOTTOM;
  6139.   D3DSTATUS_CLIPUNIONFRONT                = D3DCLIP_FRONT;
  6140.   D3DSTATUS_CLIPUNIONBACK                 = D3DCLIP_BACK;
  6141.   D3DSTATUS_CLIPUNIONGEN0                 = D3DCLIP_GEN0;
  6142.   D3DSTATUS_CLIPUNIONGEN1                 = D3DCLIP_GEN1;
  6143.   D3DSTATUS_CLIPUNIONGEN2                 = D3DCLIP_GEN2;
  6144.   D3DSTATUS_CLIPUNIONGEN3                 = D3DCLIP_GEN3;
  6145.   D3DSTATUS_CLIPUNIONGEN4                 = D3DCLIP_GEN4;
  6146.   D3DSTATUS_CLIPUNIONGEN5                 = D3DCLIP_GEN5;
  6147.  
  6148.   D3DSTATUS_CLIPINTERSECTIONLEFT          = $00001000;
  6149.   D3DSTATUS_CLIPINTERSECTIONRIGHT         = $00002000;
  6150.   D3DSTATUS_CLIPINTERSECTIONTOP           = $00004000;
  6151.   D3DSTATUS_CLIPINTERSECTIONBOTTOM        = $00008000;
  6152.   D3DSTATUS_CLIPINTERSECTIONFRONT         = $00010000;
  6153.   D3DSTATUS_CLIPINTERSECTIONBACK          = $00020000;
  6154.   D3DSTATUS_CLIPINTERSECTIONGEN0          = $00040000;
  6155.   D3DSTATUS_CLIPINTERSECTIONGEN1          = $00080000;
  6156.   D3DSTATUS_CLIPINTERSECTIONGEN2          = $00100000;
  6157.   D3DSTATUS_CLIPINTERSECTIONGEN3          = $00200000;
  6158.   D3DSTATUS_CLIPINTERSECTIONGEN4          = $00400000;
  6159.   D3DSTATUS_CLIPINTERSECTIONGEN5          = $00800000;
  6160.   D3DSTATUS_ZNOTVISIBLE                   = $01000000;
  6161. (* Do not use 0x80000000 for any status flags in future as it is reserved *)
  6162.  
  6163.   D3DSTATUS_CLIPUNIONALL = (
  6164.             D3DSTATUS_CLIPUNIONLEFT or
  6165.             D3DSTATUS_CLIPUNIONRIGHT or
  6166.             D3DSTATUS_CLIPUNIONTOP or
  6167.             D3DSTATUS_CLIPUNIONBOTTOM or
  6168.             D3DSTATUS_CLIPUNIONFRONT or
  6169.             D3DSTATUS_CLIPUNIONBACK or
  6170.             D3DSTATUS_CLIPUNIONGEN0 or
  6171.             D3DSTATUS_CLIPUNIONGEN1 or
  6172.             D3DSTATUS_CLIPUNIONGEN2 or
  6173.             D3DSTATUS_CLIPUNIONGEN3 or
  6174.             D3DSTATUS_CLIPUNIONGEN4 or
  6175.             D3DSTATUS_CLIPUNIONGEN5);
  6176.  
  6177.   D3DSTATUS_CLIPINTERSECTIONALL = (
  6178.             D3DSTATUS_CLIPINTERSECTIONLEFT or
  6179.             D3DSTATUS_CLIPINTERSECTIONRIGHT or
  6180.             D3DSTATUS_CLIPINTERSECTIONTOP or
  6181.             D3DSTATUS_CLIPINTERSECTIONBOTTOM or
  6182.             D3DSTATUS_CLIPINTERSECTIONFRONT or
  6183.             D3DSTATUS_CLIPINTERSECTIONBACK or
  6184.             D3DSTATUS_CLIPINTERSECTIONGEN0 or
  6185.             D3DSTATUS_CLIPINTERSECTIONGEN1 or
  6186.             D3DSTATUS_CLIPINTERSECTIONGEN2 or
  6187.             D3DSTATUS_CLIPINTERSECTIONGEN3 or
  6188.             D3DSTATUS_CLIPINTERSECTIONGEN4 or
  6189.             D3DSTATUS_CLIPINTERSECTIONGEN5);
  6190.  
  6191.   D3DSTATUS_DEFAULT = (
  6192.             D3DSTATUS_CLIPINTERSECTIONALL or
  6193.             D3DSTATUS_ZNOTVISIBLE);
  6194.  
  6195. (*
  6196.  * Options for direct transform calls
  6197.  *)
  6198.  
  6199.   D3DTRANSFORM_CLIPPED       = $00000001;
  6200.   D3DTRANSFORM_UNCLIPPED     = $00000002;
  6201.  
  6202. type
  6203.   PD3DTransformData = ^TD3DTransformData;
  6204.   TD3DTransformData = packed record
  6205.     dwSize: DWORD;
  6206.     lpIn: Pointer;             (* Input vertices *)
  6207.     dwInSize: DWORD;           (* Stride of input vertices *)
  6208.     lpOut: Pointer;            (* Output vertices *)
  6209.     dwOutSize: DWORD;          (* Stride of output vertices *)
  6210.     lpHOut: ^TD3DHVertex;       (* Output homogeneous vertices *)
  6211.     dwClip: DWORD;             (* Clipping hint *)
  6212.     dwClipIntersection: DWORD;
  6213.     dwClipUnion: DWORD;        (* Union of all clip flags *)
  6214.     drExtent: TD3DRect;         (* Extent of transformed vertices *)
  6215.   end;
  6216.  
  6217. (*
  6218.  * Structure defining position and direction properties for lighting.
  6219.  *)
  6220.  
  6221.   PD3DLightingElement = ^TD3DLightingElement;
  6222.   TD3DLightingElement = packed record
  6223.     dvPosition: TD3DVector;           (* Lightable point in model space *)
  6224.     dvNormal: TD3DVector;             (* Normalised unit vector *)
  6225.   end;
  6226.  
  6227. (*
  6228.  * Structure defining material properties for lighting.
  6229.  *)
  6230.  
  6231.   PD3DMaterial = ^TD3DMaterial;
  6232.   TD3DMaterial = packed record
  6233.     dwSize: DWORD;
  6234.     case Integer of
  6235.     0: (
  6236.       diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
  6237.       ambient: TD3DColorValue;        (* Ambient color RGB *)
  6238.       specular: TD3DColorValue;       (* Specular 'shininess' *)
  6239.       emissive: TD3DColorValue;       (* Emissive color RGB *)
  6240.       power: TD3DValue;               (* Sharpness if specular highlight *)
  6241.       hTexture: TD3DTextureHandle;    (* Handle to texture map *)
  6242.       dwRampSize: DWORD;
  6243.      );
  6244.     1: (
  6245.       dcvDiffuse: TD3DColorValue;
  6246.       dcvAmbient: TD3DColorValue;
  6247.       dcvSpecular: TD3DColorValue;
  6248.       dcvEmissive: TD3DColorValue;
  6249.       dvPower: TD3DValue;
  6250.      );
  6251.   end;
  6252.  
  6253.   PD3DMaterial7 = ^TD3DMaterial7;
  6254.   TD3DMaterial7 = packed record
  6255.     case Integer of
  6256.     0: (
  6257.       diffuse: TD3DColorValue;        (* Diffuse color RGBA *)
  6258.       ambient: TD3DColorValue;        (* Ambient color RGB *)
  6259.       specular: TD3DColorValue;       (* Specular 'shininess' *)
  6260.       emissive: TD3DColorValue;       (* Emissive color RGB *)
  6261.       power: TD3DValue;               (* Sharpness if specular highlight *)
  6262.      );
  6263.     1: (
  6264.       dcvDiffuse: TD3DColorValue;
  6265.       dcvAmbient: TD3DColorValue;
  6266.       dcvSpecular: TD3DColorValue;
  6267.       dcvEmissive: TD3DColorValue;
  6268.       dvPower: TD3DValue;
  6269.      );
  6270.   end;
  6271.  
  6272.   PD3DLightType = ^TD3DLightType;
  6273.   TD3DLightType = (
  6274.     D3DLIGHT_INVALID_0,
  6275.     D3DLIGHT_POINT,
  6276.     D3DLIGHT_SPOT,
  6277.     D3DLIGHT_DIRECTIONAL,
  6278. // Note: The following light type (D3DLIGHT_PARALLELPOINT)
  6279. // is no longer supported from D3D for DX7 onwards.
  6280.     D3DLIGHT_PARALLELPOINT,
  6281.     D3DLIGHT_GLSPOT);
  6282.  
  6283. (*
  6284.  * Structure defining a light source and its properties.
  6285.  *)
  6286.  
  6287.   PD3DLight = ^TD3DLight;
  6288.   TD3DLight = packed record
  6289.     dwSize: DWORD;
  6290.     dltType: TD3DLightType;     (* Type of light source *)
  6291.     dcvColor: TD3DColorValue;   (* Color of light *)
  6292.     dvPosition: TD3DVector;     (* Position in world space *)
  6293.     dvDirection: TD3DVector;    (* Direction in world space *)
  6294.     dvRange: TD3DValue;         (* Cutoff range *)
  6295.     dvFalloff: TD3DValue;       (* Falloff *)
  6296.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6297.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6298.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6299.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6300.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6301.   end;
  6302.  
  6303.   PD3DLight7 = ^TD3DLight7;
  6304.   TD3DLight7 = packed record
  6305.     dltType: TD3DLightType;     (* Type of light source *)
  6306.     dcvDiffuse: TD3DColorValue; (* Diffuse color of light *)
  6307.     dcvSpecular: TD3DColorValue;(* Specular color of light *)
  6308.     dcvAmbient: TD3DColorValue; (* Ambient color of light *)
  6309.     dvPosition: TD3DVector;     (* Position in world space *)
  6310.     dvDirection: TD3DVector;    (* Direction in world space *)
  6311.     dvRange: TD3DValue;         (* Cutoff range *)
  6312.     dvFalloff: TD3DValue;       (* Falloff *)
  6313.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6314.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6315.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6316.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6317.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6318.   end;
  6319.  
  6320. (*
  6321.  * Structure defining a light source and its properties.
  6322.  *)
  6323.  
  6324. (* flags bits *)
  6325. const
  6326.   D3DLIGHT_ACTIVE                       = $00000001;
  6327.   D3DLIGHT_NO_SPECULAR  = $00000002;
  6328.   D3DLIGHT_ALL = D3DLIGHT_ACTIVE or D3DLIGHT_ACTIVE;
  6329.  
  6330. (* maximum valid light range *)
  6331.   D3DLIGHT_RANGE_MAX            = 1.8439088915e+18; //sqrt(FLT_MAX);
  6332.  
  6333. type
  6334.   PD3DLight2 = ^TD3DLight2;
  6335.   TD3DLight2 = packed record
  6336.     dwSize: DWORD;
  6337.     dltType: TD3DLightType;     (* Type of light source *)
  6338.     dcvColor: TD3DColorValue;   (* Color of light *)
  6339.     dvPosition: TD3DVector;     (* Position in world space *)
  6340.     dvDirection: TD3DVector;    (* Direction in world space *)
  6341.     dvRange: TD3DValue;         (* Cutoff range *)
  6342.     dvFalloff: TD3DValue;       (* Falloff *)
  6343.     dvAttenuation0: TD3DValue;  (* Constant attenuation *)
  6344.     dvAttenuation1: TD3DValue;  (* Linear attenuation *)
  6345.     dvAttenuation2: TD3DValue;  (* Quadratic attenuation *)
  6346.     dvTheta: TD3DValue;         (* Inner angle of spotlight cone *)
  6347.     dvPhi: TD3DValue;           (* Outer angle of spotlight cone *)
  6348.     dwFlags: DWORD;
  6349.   end;
  6350.  
  6351.   PD3DLightData = ^TD3DLightData;
  6352.   TD3DLightData = packed record
  6353.     dwSize: DWORD;
  6354.     lpIn: ^TD3DLightingElement;   (* Input positions and normals *)
  6355.     dwInSize: DWORD;             (* Stride of input elements *)
  6356.     lpOut: ^TD3DTLVertex;         (* Output colors *)
  6357.     dwOutSize: DWORD;            (* Stride of output colors *)
  6358.   end;
  6359.  
  6360. (*
  6361.  * Before DX5, these values were in an enum called
  6362.  * TD3DColorModel. This was not correct, since they are
  6363.  * bit flags. A driver can surface either or both flags
  6364.  * in the dcmColorModel member of D3DDEVICEDESC.
  6365.  *)
  6366.  
  6367. type
  6368.   TD3DColorModel = DWORD;
  6369.  
  6370. const
  6371.   D3DCOLOR_MONO = 1;
  6372.   D3DCOLOR_RGB  = 2;
  6373.  
  6374. (*
  6375.  * Options for clearing
  6376.  *)
  6377.  
  6378. const
  6379.   D3DCLEAR_TARGET            = $00000001; (* Clear target surface *)
  6380.   D3DCLEAR_ZBUFFER           = $00000002; (* Clear target z buffer *)
  6381.   D3DCLEAR_STENCIL           = $00000004; (* Clear stencil planes *)
  6382.  
  6383. (*
  6384.  * Execute buffers are allocated via Direct3D.  These buffers may then
  6385.  * be filled by the application with instructions to execute along with
  6386.  * vertex data.
  6387.  *)
  6388.  
  6389. (*
  6390.  * Supported op codes for execute instructions.
  6391.  *)
  6392.  
  6393. type
  6394.   PD3DOpcode = ^TD3DOpcode;
  6395.   TD3DOpcode = (
  6396.     D3DOP_INVALID_0,
  6397.     D3DOP_POINT,
  6398.     D3DOP_LINE,
  6399.     D3DOP_TRIANGLE,
  6400.     D3DOP_MATRIXLOAD,
  6401.     D3DOP_MATRIXMULTIPLY,
  6402.     D3DOP_STATETRANSFORM,
  6403.     D3DOP_STATELIGHT,
  6404.     D3DOP_STATERENDER,
  6405.     D3DOP_PROCESSVERTICES,
  6406.     D3DOP_TEXTURELOAD,
  6407.     D3DOP_EXIT,
  6408.     D3DOP_BRANCHFORWARD,
  6409.     D3DOP_SPAN,
  6410.     D3DOP_SETSTATUS);
  6411.  
  6412.   PD3DInstruction = ^TD3DInstruction;
  6413.   TD3DInstruction = packed record
  6414.     bOpcode: BYTE;   (* Instruction opcode *)
  6415.     bSize: BYTE;     (* Size of each instruction data unit *)
  6416.     wCount: WORD;    (* Count of instruction data units to follow *)
  6417.   end;
  6418.  
  6419. (*
  6420.  * Structure for texture loads
  6421.  *)
  6422.  
  6423.   PD3DTextureLoad = ^TD3DTextureLoad;
  6424.   TD3DTextureLoad = packed record
  6425.     hDestTexture: TD3DTextureHandle;
  6426.     hSrcTexture: TD3DTextureHandle;
  6427.   end;
  6428.  
  6429. (*
  6430.  * Structure for picking
  6431.  *)
  6432.  
  6433.   PD3DPickRecord = ^TD3DPickRecord;
  6434.   TD3DPickRecord = packed record
  6435.     bOpcode: BYTE;
  6436.     bPad: BYTE;
  6437.     dwOffset: DWORD;
  6438.     dvZ: TD3DValue;
  6439.   end;
  6440.  
  6441. (*
  6442.  * The following defines the rendering states which can be set in the
  6443.  * execute buffer.
  6444.  *)
  6445.  
  6446.   PD3DShadeMode = ^TD3DShadeMode;
  6447.   TD3DShadeMode = (
  6448.     D3DSHADE_INVALID_0,
  6449.     D3DSHADE_FLAT,
  6450.     D3DSHADE_GOURAUD,
  6451.     D3DSHADE_PHONG);
  6452.  
  6453.   PD3DFillMode = ^TD3DFillMode;
  6454.   TD3DFillMode = (
  6455.     D3DFILL_INVALID_0,
  6456.     D3DFILL_POINT,
  6457.     D3DFILL_WIREFRAME,
  6458.     D3DFILL_SOLID);
  6459.  
  6460.   PD3DLinePattern = ^TD3DLinePattern;
  6461.   TD3DLinePattern = packed record
  6462.     wRepeatFactor: WORD;
  6463.     wLinePattern: WORD;
  6464.   end;
  6465.  
  6466.   PD3DTextureFilter = ^TD3DTextureFilter;
  6467.   TD3DTextureFilter = (
  6468.     D3DFILTER_INVALID_0,
  6469.     D3DFILTER_NEAREST,
  6470.     D3DFILTER_LINEAR,
  6471.     D3DFILTER_MIPNEAREST,
  6472.     D3DFILTER_MIPLINEAR,
  6473.     D3DFILTER_LINEARMIPNEAREST,
  6474.     D3DFILTER_LINEARMIPLINEAR);
  6475.  
  6476.   PD3DBlend = ^TD3DBlend;
  6477.   TD3DBlend = (
  6478.     D3DBLEND_INVALID_0,
  6479.     D3DBLEND_ZERO,
  6480.     D3DBLEND_ONE,
  6481.     D3DBLEND_SRCCOLOR,
  6482.     D3DBLEND_INVSRCCOLOR,
  6483.     D3DBLEND_SRCALPHA,
  6484.     D3DBLEND_INVSRCALPHA,
  6485.     D3DBLEND_DESTALPHA,
  6486.     D3DBLEND_INVDESTALPHA,
  6487.     D3DBLEND_DESTCOLOR,
  6488.     D3DBLEND_INVDESTCOLOR,
  6489.     D3DBLEND_SRCALPHASAT,
  6490.     D3DBLEND_BOTHSRCALPHA,
  6491.     D3DBLEND_BOTHINVSRCALPHA);
  6492.  
  6493.   PD3DTextureBlend = ^TD3DTextureBlend;
  6494.   TD3DTextureBlend = (
  6495.     D3DTBLEND_INVALID_0,
  6496.     D3DTBLEND_DECAL,
  6497.     D3DTBLEND_MODULATE,
  6498.     D3DTBLEND_DECALALPHA,
  6499.     D3DTBLEND_MODULATEALPHA,
  6500.     D3DTBLEND_DECALMASK,
  6501.     D3DTBLEND_MODULATEMASK,
  6502.     D3DTBLEND_COPY,
  6503.     D3DTBLEND_ADD);
  6504.  
  6505.   PD3DTextureAddress = ^TD3DTextureAddress;
  6506.   TD3DTextureAddress = (
  6507.     D3DTADDRESS_INVALID_0,
  6508.     D3DTADDRESS_WRAP,
  6509.     D3DTADDRESS_MIRROR,
  6510.     D3DTADDRESS_CLAMP,
  6511.     D3DTADDRESS_BORDER);
  6512.  
  6513.   PD3DCull = ^TD3DCull;
  6514.   TD3DCull = (
  6515.     D3DCULL_INVALID_0,
  6516.     D3DCULL_NONE,
  6517.     D3DCULL_CW,
  6518.     D3DCULL_CCW);
  6519.  
  6520.   PD3DCmpFunc = ^TD3DCmpFunc;
  6521.   TD3DCmpFunc = (
  6522.     D3DCMP_INVALID_0,
  6523.     D3DCMP_NEVER,
  6524.     D3DCMP_LESS,
  6525.     D3DCMP_EQUAL,
  6526.     D3DCMP_LESSEQUAL,
  6527.     D3DCMP_GREATER,
  6528.     D3DCMP_NOTEQUAL,
  6529.     D3DCMP_GREATEREQUAL,
  6530.     D3DCMP_ALWAYS);
  6531.  
  6532.   PD3DStencilOp = ^TD3DStencilOp;
  6533.   TD3DStencilOp = (
  6534.     D3DSTENCILOP_INVALID_0,
  6535.     D3DSTENCILOP_KEEP,
  6536.     D3DSTENCILOP_ZERO,
  6537.     D3DSTENCILOP_REPLACE,
  6538.     D3DSTENCILOP_INCRSAT,
  6539.     D3DSTENCILOP_DECRSAT,
  6540.     D3DSTENCILOP_INVERT,
  6541.     D3DSTENCILOP_INCR,
  6542.     D3DSTENCILOP_DECR);
  6543.    
  6544.   PD3DFogMode = ^TD3DFogMode;
  6545.   TD3DFogMode = (
  6546.     D3DFOG_NONE,
  6547.     D3DFOG_EXP,
  6548.     D3DFOG_EXP2,
  6549.     D3DFOG_LINEAR);
  6550.  
  6551.   PD3DZBufferType = ^TD3DZBufferType;
  6552.   TD3DZBufferType = (
  6553.     D3DZB_FALSE,
  6554.     D3DZB_TRUE,   // Z buffering
  6555.     D3DZB_USEW);  // W buffering
  6556.  
  6557.   PD3DAntialiasMode = ^TD3DAntialiasMode;
  6558.   TD3DAntialiasMode = (
  6559.     D3DANTIALIAS_NONE,
  6560.     D3DANTIALIAS_SORTDEPENDENT,
  6561.     D3DANTIALIAS_SORTINDEPENDENT);
  6562.  
  6563. // Vertex types supported by Direct3D
  6564.   PD3DVertexType = ^TD3DVertexType;
  6565.   TD3DVertexType = (
  6566.     D3DVT_INVALID_0,
  6567.     D3DVT_VERTEX,
  6568.     D3DVT_LVERTEX,
  6569.     D3DVT_TLVERTEX);
  6570.  
  6571. // Primitives supported by draw-primitive API
  6572.   PD3DPrimitiveType = ^TD3DPrimitiveType;
  6573.   TD3DPrimitiveType = (
  6574.     D3DPT_INVALID_0,
  6575.     D3DPT_POINTLIST,
  6576.     D3DPT_LINELIST,
  6577.     D3DPT_LINESTRIP,
  6578.     D3DPT_TRIANGLELIST,
  6579.     D3DPT_TRIANGLESTRIP,
  6580.     D3DPT_TRIANGLEFAN);
  6581.  
  6582. (*
  6583.  * Amount to add to a state to generate the override for that state.
  6584.  *)
  6585.  
  6586. const
  6587.   D3DSTATE_OVERRIDE_BIAS          = 256;
  6588.  
  6589. (*
  6590.  * A state which sets the override flag for the specified state type.
  6591.  *)
  6592.  
  6593. function D3DSTATE_OVERRIDE(StateType: DWORD) : DWORD;
  6594.  
  6595. type
  6596.   PD3DTransformStateType = ^TD3DTransformStateType;
  6597.   TD3DTransformStateType = DWORD;
  6598. const
  6599.   D3DTRANSFORMSTATE_WORLD         = 1;
  6600.   D3DTRANSFORMSTATE_VIEW          = 2;
  6601.   D3DTRANSFORMSTATE_PROJECTION    = 3;
  6602.   D3DTRANSFORMSTATE_WORLD1        = 4;  // 2nd matrix to blend
  6603.   D3DTRANSFORMSTATE_WORLD2        = 5;  // 3rd matrix to blend
  6604.   D3DTRANSFORMSTATE_WORLD3        = 6;  // 4th matrix to blend
  6605.   D3DTRANSFORMSTATE_TEXTURE0      = 16;
  6606.   D3DTRANSFORMSTATE_TEXTURE1      = 17;
  6607.   D3DTRANSFORMSTATE_TEXTURE2      = 18;
  6608.   D3DTRANSFORMSTATE_TEXTURE3      = 19;
  6609.   D3DTRANSFORMSTATE_TEXTURE4      = 20;
  6610.   D3DTRANSFORMSTATE_TEXTURE5      = 21;
  6611.   D3DTRANSFORMSTATE_TEXTURE6      = 22;
  6612.   D3DTRANSFORMSTATE_TEXTURE7      = 23;
  6613.  
  6614. type
  6615.   PD3DLightStateType = ^TD3DLightStateType;
  6616.   TD3DLightStateType = (
  6617.     D3DLIGHTSTATE_INVALID_0,
  6618.     D3DLIGHTSTATE_MATERIAL,
  6619.     D3DLIGHTSTATE_AMBIENT,
  6620.     D3DLIGHTSTATE_COLORMODEL,
  6621.     D3DLIGHTSTATE_FOGMODE,
  6622.     D3DLIGHTSTATE_FOGSTART,
  6623.     D3DLIGHTSTATE_FOGEND,
  6624.     D3DLIGHTSTATE_FOGDENSITY,
  6625.     D3DLIGHTSTATE_COLORVERTEX);
  6626.  
  6627.   PD3DRenderStateType = ^TD3DRenderStateType;
  6628.   TD3DRenderStateType = DWORD;
  6629. const
  6630.     D3DRENDERSTATE_ANTIALIAS          = 2;    (* D3DANTIALIASMODE *)
  6631.     D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4;    (* TRUE for perspective correction *)
  6632.     D3DRENDERSTATE_ZENABLE            = 7;    (* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) *)
  6633.     D3DRENDERSTATE_FILLMODE           = 8;    (* D3DFILL_MODE        *)
  6634.     D3DRENDERSTATE_SHADEMODE          = 9;    (* D3DSHADEMODE *)
  6635.     D3DRENDERSTATE_LINEPATTERN        = 10;   (* D3DLINEPATTERN *)
  6636.     D3DRENDERSTATE_ZWRITEENABLE       = 14;   (* TRUE to enable z writes *)
  6637.     D3DRENDERSTATE_ALPHATESTENABLE    = 15;   (* TRUE to enable alpha tests *)
  6638.     D3DRENDERSTATE_LASTPIXEL          = 16;   (* TRUE for last-pixel on lines *)
  6639.     D3DRENDERSTATE_SRCBLEND           = 19;   (* D3DBLEND *)
  6640.     D3DRENDERSTATE_DESTBLEND          = 20;   (* D3DBLEND *)
  6641.     D3DRENDERSTATE_CULLMODE           = 22;   (* D3DCULL *)
  6642.     D3DRENDERSTATE_ZFUNC              = 23;   (* D3DCMPFUNC *)
  6643.     D3DRENDERSTATE_ALPHAREF           = 24;   (* D3DFIXED *)
  6644.     D3DRENDERSTATE_ALPHAFUNC          = 25;   (* D3DCMPFUNC *)
  6645.     D3DRENDERSTATE_DITHERENABLE       = 26;   (* TRUE to enable dithering *)
  6646.     D3DRENDERSTATE_ALPHABLENDENABLE   = 27;   (* TRUE to enable alpha blending *)
  6647.     D3DRENDERSTATE_FOGENABLE          = 28;   (* TRUE to enable fog blending *)
  6648.     D3DRENDERSTATE_SPECULARENABLE     = 29;   (* TRUE to enable specular *)
  6649.     D3DRENDERSTATE_ZVISIBLE           = 30;   (* TRUE to enable z checking *)
  6650.     D3DRENDERSTATE_STIPPLEDALPHA      = 33;   (* TRUE to enable stippled alpha (RGB device only) *)
  6651.     D3DRENDERSTATE_FOGCOLOR           = 34;   (* D3DCOLOR *)
  6652.     D3DRENDERSTATE_FOGTABLEMODE       = 35;   (* D3DFOGMODE *)
  6653.     D3DRENDERSTATE_FOGSTART           = 36;   (* Fog start (for both vertex and pixel fog) *)
  6654.     D3DRENDERSTATE_FOGEND             = 37;   (* Fog end      *)
  6655.     D3DRENDERSTATE_FOGDENSITY         = 38;   (* Fog density  *)
  6656.     D3DRENDERSTATE_EDGEANTIALIAS      = 40;   (* TRUE to enable edge antialiasing *)
  6657.     D3DRENDERSTATE_COLORKEYENABLE     = 41;   (* TRUE to enable source colorkeyed textures *)
  6658.     D3DRENDERSTATE_ZBIAS              = 47;   (* LONG Z bias *)
  6659.     D3DRENDERSTATE_RANGEFOGENABLE     = 48;   (* Enables range-based fog *)
  6660.  
  6661.     D3DRENDERSTATE_STENCILENABLE      = 52;   (* BOOL enable/disable stenciling *)
  6662.     D3DRENDERSTATE_STENCILFAIL        = 53;   (* D3DSTENCILOP to do if stencil test fails *)
  6663.     D3DRENDERSTATE_STENCILZFAIL       = 54;   (* D3DSTENCILOP to do if stencil test passes and Z test fails *)
  6664.     D3DRENDERSTATE_STENCILPASS        = 55;   (* D3DSTENCILOP to do if both stencil and Z tests pass *)
  6665.     D3DRENDERSTATE_STENCILFUNC        = 56;   (* D3DCMPFUNC fn.  Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *)
  6666.     D3DRENDERSTATE_STENCILREF         = 57;   (* Reference value used in stencil test *)
  6667.     D3DRENDERSTATE_STENCILMASK        = 58;   (* Mask value used in stencil test *)
  6668.     D3DRENDERSTATE_STENCILWRITEMASK   = 59;   (* Write mask applied to values written to stencil buffer *)
  6669.     D3DRENDERSTATE_TEXTUREFACTOR      = 60;   (* D3DCOLOR used for multi-texture blend *)
  6670.  
  6671.     (*
  6672.      * 128 values [128; 255] are reserved for texture coordinate wrap flags.
  6673.      * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using
  6674.      * a flags word preserves forward compatibility with texture coordinates
  6675.      * that are >2D.
  6676.      *)
  6677.     D3DRENDERSTATE_WRAP0              = 128;  (* wrap for 1st texture coord. set *)
  6678.     D3DRENDERSTATE_WRAP1              = 129;  (* wrap for 2nd texture coord. set *)
  6679.     D3DRENDERSTATE_WRAP2              = 130;  (* wrap for 3rd texture coord. set *)
  6680.     D3DRENDERSTATE_WRAP3              = 131;  (* wrap for 4th texture coord. set *)
  6681.     D3DRENDERSTATE_WRAP4              = 132;  (* wrap for 5th texture coord. set *)
  6682.     D3DRENDERSTATE_WRAP5              = 133;  (* wrap for 6th texture coord. set *)
  6683.     D3DRENDERSTATE_WRAP6              = 134;  (* wrap for 7th texture coord. set *)
  6684.     D3DRENDERSTATE_WRAP7              = 135;  (* wrap for 8th texture coord. set *)
  6685.     D3DRENDERSTATE_CLIPPING            = 136;
  6686.     D3DRENDERSTATE_LIGHTING            = 137;
  6687.     D3DRENDERSTATE_EXTENTS             = 138;
  6688.     D3DRENDERSTATE_AMBIENT             = 139;
  6689.     D3DRENDERSTATE_FOGVERTEXMODE       = 140;
  6690.     D3DRENDERSTATE_COLORVERTEX         = 141;
  6691.     D3DRENDERSTATE_LOCALVIEWER         = 142;
  6692.     D3DRENDERSTATE_NORMALIZENORMALS    = 143;
  6693.     D3DRENDERSTATE_COLORKEYBLENDENABLE = 144;
  6694.     D3DRENDERSTATE_DIFFUSEMATERIALSOURCE    = 145;
  6695.     D3DRENDERSTATE_SPECULARMATERIALSOURCE   = 146;
  6696.     D3DRENDERSTATE_AMBIENTMATERIALSOURCE    = 147;
  6697.     D3DRENDERSTATE_EMISSIVEMATERIALSOURCE   = 148;
  6698.     D3DRENDERSTATE_VERTEXBLEND              = 151;
  6699.     D3DRENDERSTATE_CLIPPLANEENABLE          = 152;
  6700.  
  6701. //
  6702. // retired renderstates - not supported for DX7 interfaces
  6703. //
  6704.     D3DRENDERSTATE_TEXTUREHANDLE      = 1;    (* Texture handle for legacy interfaces (Texture;Texture2) *)
  6705.     D3DRENDERSTATE_TEXTUREADDRESS     = 3;    (* D3DTEXTUREADDRESS  *)
  6706.     D3DRENDERSTATE_WRAPU              = 5;    (* TRUE for wrapping in u *)
  6707.     D3DRENDERSTATE_WRAPV              = 6;    (* TRUE for wrapping in v *)
  6708.     D3DRENDERSTATE_MONOENABLE         = 11;   (* TRUE to enable mono rasterization *)
  6709.     D3DRENDERSTATE_ROP2               = 12;   (* ROP2 *)
  6710.     D3DRENDERSTATE_PLANEMASK          = 13;   (* DWORD physical plane mask *)
  6711.     D3DRENDERSTATE_TEXTUREMAG         = 17;   (* D3DTEXTUREFILTER *)
  6712.     D3DRENDERSTATE_TEXTUREMIN         = 18;   (* D3DTEXTUREFILTER *)
  6713.     D3DRENDERSTATE_TEXTUREMAPBLEND    = 21;   (* D3DTEXTUREBLEND *)
  6714.     D3DRENDERSTATE_SUBPIXEL           = 31;   (* TRUE to enable subpixel correction *)
  6715.     D3DRENDERSTATE_SUBPIXELX          = 32;   (* TRUE to enable correction in X only *)
  6716.     D3DRENDERSTATE_STIPPLEENABLE      = 39;   (* TRUE to enable stippling *)
  6717.     D3DRENDERSTATE_BORDERCOLOR        = 43;   (* Border color for texturing w/border *)
  6718.     D3DRENDERSTATE_TEXTUREADDRESSU    = 44;   (* Texture addressing mode for U coordinate *)
  6719.     D3DRENDERSTATE_TEXTUREADDRESSV    = 45;   (* Texture addressing mode for V coordinate *)
  6720.     D3DRENDERSTATE_MIPMAPLODBIAS      = 46;   (* D3DVALUE Mipmap LOD bias *)
  6721.     D3DRENDERSTATE_ANISOTROPY         = 49;   (* Max. anisotropy. 1 = no anisotropy *)
  6722.     D3DRENDERSTATE_FLUSHBATCH         = 50;   (* Explicit flush for DP batching (DX5 Only) *)
  6723.     D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51; (* BOOL enable sort-independent transparency *)
  6724.     D3DRENDERSTATE_STIPPLEPATTERN00   = 64;   (* Stipple pattern 01...  *)
  6725.     D3DRENDERSTATE_STIPPLEPATTERN01   = 65;
  6726.     D3DRENDERSTATE_STIPPLEPATTERN02   = 66;
  6727.     D3DRENDERSTATE_STIPPLEPATTERN03   = 67;
  6728.     D3DRENDERSTATE_STIPPLEPATTERN04   = 68;
  6729.     D3DRENDERSTATE_STIPPLEPATTERN05   = 69;
  6730.     D3DRENDERSTATE_STIPPLEPATTERN06   = 70;
  6731.     D3DRENDERSTATE_STIPPLEPATTERN07   = 71;
  6732.     D3DRENDERSTATE_STIPPLEPATTERN08   = 72;
  6733.     D3DRENDERSTATE_STIPPLEPATTERN09   = 73;
  6734.     D3DRENDERSTATE_STIPPLEPATTERN10   = 74;
  6735.     D3DRENDERSTATE_STIPPLEPATTERN11   = 75;
  6736.     D3DRENDERSTATE_STIPPLEPATTERN12   = 76;
  6737.     D3DRENDERSTATE_STIPPLEPATTERN13   = 77;
  6738.     D3DRENDERSTATE_STIPPLEPATTERN14   = 78;
  6739.     D3DRENDERSTATE_STIPPLEPATTERN15   = 79;
  6740.     D3DRENDERSTATE_STIPPLEPATTERN16   = 80;
  6741.     D3DRENDERSTATE_STIPPLEPATTERN17   = 81;
  6742.     D3DRENDERSTATE_STIPPLEPATTERN18   = 82;
  6743.     D3DRENDERSTATE_STIPPLEPATTERN19   = 83;
  6744.     D3DRENDERSTATE_STIPPLEPATTERN20   = 84;
  6745.     D3DRENDERSTATE_STIPPLEPATTERN21   = 85;
  6746.     D3DRENDERSTATE_STIPPLEPATTERN22   = 86;
  6747.     D3DRENDERSTATE_STIPPLEPATTERN23   = 87;
  6748.     D3DRENDERSTATE_STIPPLEPATTERN24   = 88;
  6749.     D3DRENDERSTATE_STIPPLEPATTERN25   = 89;
  6750.     D3DRENDERSTATE_STIPPLEPATTERN26   = 90;
  6751.     D3DRENDERSTATE_STIPPLEPATTERN27   = 91;
  6752.     D3DRENDERSTATE_STIPPLEPATTERN28   = 92;
  6753.     D3DRENDERSTATE_STIPPLEPATTERN29   = 93;
  6754.     D3DRENDERSTATE_STIPPLEPATTERN30   = 94;
  6755.     D3DRENDERSTATE_STIPPLEPATTERN31   = 95;
  6756.  
  6757. //
  6758. // retired renderstate names - the values are still used under new naming conventions
  6759. //
  6760.     D3DRENDERSTATE_FOGTABLESTART      = 36;   (* Fog table start    *)
  6761.     D3DRENDERSTATE_FOGTABLEEND        = 37;   (* Fog table end      *)
  6762.     D3DRENDERSTATE_FOGTABLEDENSITY    = 38;   (* Fog table density  *)
  6763.  
  6764. type
  6765. // Values for material source
  6766.   PD3DMateralColorSource = ^TD3DMateralColorSource;
  6767.   TD3DMateralColorSource = (
  6768.     D3DMCS_MATERIAL,              // Color from material is used
  6769.     D3DMCS_COLOR1,                // Diffuse vertex color is used
  6770.     D3DMCS_COLOR2                 // Specular vertex color is used
  6771.   );
  6772.  
  6773. const
  6774.   // For back-compatibility with legacy compilations
  6775.   D3DRENDERSTATE_BLENDENABLE = D3DRENDERSTATE_ALPHABLENDENABLE;
  6776.  
  6777.  
  6778. // Bias to apply to the texture coordinate set to apply a wrap to.
  6779.    D3DRENDERSTATE_WRAPBIAS                = 128;
  6780.  
  6781. (* Flags to construct the WRAP render states *)
  6782.   D3DWRAP_U   = $00000001;
  6783.   D3DWRAP_V   = $00000002;
  6784.  
  6785. (* Flags to construct the WRAP render states for 1D thru 4D texture coordinates *)
  6786.   D3DWRAPCOORD_0   = $00000001;    // same as D3DWRAP_U
  6787.   D3DWRAPCOORD_1   = $00000002;    // same as D3DWRAP_V
  6788.   D3DWRAPCOORD_2   = $00000004;
  6789.   D3DWRAPCOORD_3   = $00000008;
  6790.  
  6791. function D3DRENDERSTATE_STIPPLEPATTERN(y: integer) : TD3DRenderStateType;
  6792.  
  6793. type
  6794.   PD3DState = ^TD3DState;
  6795.   TD3DState = packed record
  6796.     case Integer of
  6797.     0: (
  6798.       dtstTransformStateType: TD3DTransformStateType;
  6799.       dwArg: Array [ 0..0 ] of DWORD;
  6800.      );
  6801.     1: (
  6802.       dlstLightStateType: TD3DLightStateType;
  6803.       dvArg: Array [ 0..0 ] of TD3DValue;
  6804.      );
  6805.     2: (
  6806.       drstRenderStateType: TD3DRenderStateType;
  6807.      );
  6808.   end;
  6809.  
  6810. (*
  6811.  * Operation used to load matrices
  6812.  * hDstMat = hSrcMat
  6813.  *)
  6814.   PD3DMatrixLoad = ^TD3DMatrixLoad;
  6815.   TD3DMatrixLoad = packed record
  6816.     hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
  6817.     hSrcMatrix: TD3DMatrixHandle;    (* Source matrix *)
  6818.   end;
  6819.  
  6820. (*
  6821.  * Operation used to multiply matrices
  6822.  * hDstMat = hSrcMat1 * hSrcMat2
  6823.  *)
  6824.   PD3DMatrixMultiply = ^TD3DMatrixMultiply;
  6825.   TD3DMatrixMultiply = packed record
  6826.     hDestMatrix: TD3DMatrixHandle;   (* Destination matrix *)
  6827.     hSrcMatrix1: TD3DMatrixHandle;   (* First source matrix *)
  6828.     hSrcMatrix2: TD3DMatrixHandle;   (* Second source matrix *)
  6829.   end;
  6830.  
  6831. (*
  6832.  * Operation used to transform and light vertices.
  6833.  *)
  6834.   PD3DProcessVertices = ^TD3DProcessVertices;
  6835.   TD3DProcessVertices = packed record
  6836.     dwFlags: DWORD;           (* Do we transform or light or just copy? *)
  6837.     wStart: WORD;             (* Index to first vertex in source *)
  6838.     wDest: WORD;              (* Index to first vertex in local buffer *)
  6839.     dwCount: DWORD;           (* Number of vertices to be processed *)
  6840.     dwReserved: DWORD;        (* Must be zero *)
  6841.   end;
  6842.  
  6843. const
  6844.   D3DPROCESSVERTICES_TRANSFORMLIGHT       = $00000000;
  6845.   D3DPROCESSVERTICES_TRANSFORM            = $00000001;
  6846.   D3DPROCESSVERTICES_COPY                 = $00000002;
  6847.   D3DPROCESSVERTICES_OPMASK               = $00000007;
  6848.  
  6849.   D3DPROCESSVERTICES_UPDATEEXTENTS        = $00000008;
  6850.   D3DPROCESSVERTICES_NOCOLOR              = $00000010;
  6851.  
  6852.  
  6853. (*
  6854.  * State enumerants for per-stage texture processing.
  6855.  *)
  6856. type
  6857.   PD3DTextureStageStateType = ^TD3DTextureStageStateType;
  6858.   TD3DTextureStageStateType = DWORD;
  6859. const
  6860.   D3DTSS_COLOROP        =  1; (* D3DTEXTUREOP - per-stage blending controls for color channels *)
  6861.   D3DTSS_COLORARG1      =  2; (* D3DTA_* (texture arg) *)
  6862.   D3DTSS_COLORARG2      =  3; (* D3DTA_* (texture arg) *)
  6863.   D3DTSS_ALPHAOP        =  4; (* D3DTEXTUREOP - per-stage blending controls for alpha channel *)
  6864.   D3DTSS_ALPHAARG1      =  5; (* D3DTA_* (texture arg) *)
  6865.   D3DTSS_ALPHAARG2      =  6; (* D3DTA_* (texture arg) *)
  6866.   D3DTSS_BUMPENVMAT00   =  7; (* D3DVALUE (bump mapping matrix) *)
  6867.   D3DTSS_BUMPENVMAT01   =  8; (* D3DVALUE (bump mapping matrix) *)
  6868.   D3DTSS_BUMPENVMAT10   =  9; (* D3DVALUE (bump mapping matrix) *)
  6869.   D3DTSS_BUMPENVMAT11   = 10; (* D3DVALUE (bump mapping matrix) *)
  6870.   D3DTSS_TEXCOORDINDEX  = 11; (* identifies which set of texture coordinates index this texture *)
  6871.   D3DTSS_ADDRESS        = 12; (* D3DTEXTUREADDRESS for both coordinates *)
  6872.   D3DTSS_ADDRESSU       = 13; (* D3DTEXTUREADDRESS for U coordinate *)
  6873.   D3DTSS_ADDRESSV       = 14; (* D3DTEXTUREADDRESS for V coordinate *)
  6874.   D3DTSS_BORDERCOLOR    = 15; (* D3DCOLOR *)
  6875.   D3DTSS_MAGFILTER      = 16; (* D3DTEXTUREMAGFILTER filter to use for magnification *)
  6876.   D3DTSS_MINFILTER      = 17; (* D3DTEXTUREMINFILTER filter to use for minification *)
  6877.   D3DTSS_MIPFILTER      = 18; (* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification *)
  6878.   D3DTSS_MIPMAPLODBIAS  = 19; (* D3DVALUE Mipmap LOD bias *)
  6879.   D3DTSS_MAXMIPLEVEL    = 20; (* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) *)
  6880.   D3DTSS_MAXANISOTROPY  = 21; (* DWORD maximum anisotropy *)
  6881.   D3DTSS_BUMPENVLSCALE  = 22; (* D3DVALUE scale for bump map luminance *)
  6882.   D3DTSS_BUMPENVLOFFSET = 23; (* D3DVALUE offset for bump map luminance *)
  6883.   D3DTSS_TEXTURETRANSFORMFLAGS = 24; (* D3DTEXTURETRANSFORMFLAGS controls texture transform *)
  6884.  
  6885. // Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position
  6886. // and normal in the camera space) should be taken as texture coordinates
  6887. // Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from
  6888. //
  6889.   D3DTSS_TCI_PASSTHRU                             = $00000000;
  6890.   D3DTSS_TCI_CAMERASPACENORMAL                    = $00010000;
  6891.   D3DTSS_TCI_CAMERASPACEPOSITION                  = $00020000;
  6892.   D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR          = $00030000;
  6893.  
  6894. type
  6895. (*
  6896.  * Enumerations for COLOROP and ALPHAOP texture blending operations set in
  6897.  * texture processing stage controls in D3DRENDERSTATE.
  6898.  *)
  6899.   PD3DTextureOp = ^TD3DTextureOp;
  6900.   TD3DTextureOp = (
  6901.     D3DTOP_INVALID_0,
  6902. // Control
  6903.     D3DTOP_DISABLE   ,      // disables stage
  6904.     D3DTOP_SELECTARG1,      // the default
  6905.     D3DTOP_SELECTARG2,
  6906.  
  6907. // Modulate
  6908.     D3DTOP_MODULATE  ,      // multiply args together
  6909.     D3DTOP_MODULATE2X,      // multiply and  1 bit
  6910.     D3DTOP_MODULATE4X,      // multiply and  2 bits
  6911.  
  6912. // Add
  6913.     D3DTOP_ADD        ,   // add arguments together
  6914.     D3DTOP_ADDSIGNED  ,   // add with -0.5 bias
  6915.     D3DTOP_ADDSIGNED2X,   // as above but left  1 bit
  6916.     D3DTOP_SUBTRACT   ,   // Arg1 - Arg2, with no saturation
  6917.     D3DTOP_ADDSMOOTH  ,   // add 2 args, subtract product
  6918.                           // Arg1 + Arg2 - Arg1*Arg2
  6919.                           // = Arg1 + (1-Arg1)*Arg2
  6920.  
  6921. // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
  6922.     D3DTOP_BLENDDIFFUSEALPHA  , // iterated alpha
  6923.     D3DTOP_BLENDTEXTUREALPHA  , // texture alpha
  6924.     D3DTOP_BLENDFACTORALPHA   , // alpha from D3DRENDERSTATE_TEXTUREFACTOR
  6925.     // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
  6926.     D3DTOP_BLENDTEXTUREALPHAPM, // texture alpha
  6927.     D3DTOP_BLENDCURRENTALPHA  , // by alpha of current color
  6928.  
  6929. // Specular mapping
  6930.     D3DTOP_PREMODULATE           ,     // modulate with next texture before use
  6931.     D3DTOP_MODULATEALPHA_ADDCOLOR,     // Arg1.RGB + Arg1.A*Arg2.RGB
  6932.                                        // COLOROP only
  6933.     D3DTOP_MODULATECOLOR_ADDALPHA,     // Arg1.RGB*Arg2.RGB + Arg1.A
  6934.                                             // COLOROP only
  6935.     D3DTOP_MODULATEINVALPHA_ADDCOLOR,  // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
  6936.                                        // COLOROP only
  6937.     D3DTOP_MODULATEINVCOLOR_ADDALPHA,  // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
  6938.                                             // COLOROP only
  6939.  
  6940. // Bump mapping
  6941.     D3DTOP_BUMPENVMAP         , // per pixel env map perturbation
  6942.     D3DTOP_BUMPENVMAPLUMINANCE, // with luminance channel
  6943.     // This can do either diffuse or specular bump mapping with correct input.
  6944.     // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
  6945.     // where each component has been scaled and offset to make it signed.
  6946.     // The result is replicated into all four (including alpha) channels.
  6947.     // This is a valid COLOROP only.
  6948.     D3DTOP_DOTPRODUCT3
  6949.   );
  6950.  
  6951. (*
  6952.  * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations
  6953.  * set in texture processing stage controls in D3DRENDERSTATE.
  6954.  *)
  6955. const
  6956.   D3DTA_SELECTMASK        = $0000000f;  // mask for arg selector
  6957.   D3DTA_DIFFUSE           = $00000000;  // select diffuse color
  6958.   D3DTA_CURRENT           = $00000001;  // select result of previous stage
  6959.   D3DTA_TEXTURE           = $00000002;  // select texture color
  6960.   D3DTA_TFACTOR           = $00000003;  // select RENDERSTATE_TEXTUREFACTOR
  6961.   D3DTA_SPECULAR          = $00000004;  // select specular color
  6962.   D3DTA_COMPLEMENT        = $00000010;  // take 1.0 - x
  6963.   D3DTA_ALPHAREPLICATE    = $00000020;  // replicate alpha to color components
  6964.  
  6965. (*
  6966.  *  IDirect3DTexture2 State Filter Types
  6967.  *)
  6968. type
  6969.   PD3DTextureMagFilter = ^TD3DTextureMagFilter;
  6970.   TD3DTextureMagFilter = (
  6971.     D3DTFG_INVALID_0,
  6972.     D3DTFG_POINT        ,    // nearest
  6973.     D3DTFG_LINEAR       ,    // linear interpolation
  6974.     D3DTFG_FLATCUBIC    ,    // cubic
  6975.     D3DTFG_GAUSSIANCUBIC,    // different cubic kernel
  6976.     D3DTFG_ANISOTROPIC
  6977.   );
  6978.  
  6979.   PD3DTextureMinFilter = ^TD3DTextureMinFilter;
  6980.   TD3DTextureMinFilter = (
  6981.     D3DTFN_INVALID_0,
  6982.     D3DTFN_POINT      ,    // nearest
  6983.     D3DTFN_LINEAR     ,    // linear interpolation
  6984.     D3DTFN_ANISOTROPIC
  6985.   );
  6986.  
  6987.   PD3DTextureMipFilter = ^TD3DTextureMipFilter;
  6988.   TD3DTextureMipFilter = (
  6989.     D3DTFP_INVALID_0,
  6990.     D3DTFP_NONE   ,    // mipmapping disabled (use MAG filter)
  6991.     D3DTFP_POINT  ,    // nearest
  6992.     D3DTFP_LINEAR      // linear interpolation
  6993.   );
  6994.  
  6995.  
  6996. (*
  6997.  * Triangle flags
  6998.  *)
  6999.  
  7000. (*
  7001.  * Tri strip and fan flags.
  7002.  * START loads all three vertices
  7003.  * EVEN and ODD load just v3 with even or odd culling
  7004.  * START_FLAT contains a count from 0 to 29 that allows the
  7005.  * whole strip or fan to be culled in one hit.
  7006.  * e.g. for a quad len = 1
  7007.  *)
  7008. const
  7009.   D3DTRIFLAG_START                        = $00000000;
  7010. // #define D3DTRIFLAG_STARTFLAT(len) (len)         (* 0 < len < 30 *)
  7011. function D3DTRIFLAG_STARTFLAT(len: DWORD) : DWORD;
  7012.  
  7013. const
  7014.   D3DTRIFLAG_ODD                          = $0000001e;
  7015.   D3DTRIFLAG_EVEN                         = $0000001f;
  7016.  
  7017. (*
  7018.  * Triangle edge flags
  7019.  * enable edges for wireframe or antialiasing
  7020.  *)
  7021.   D3DTRIFLAG_EDGEENABLE1                  = $00000100; (* v0-v1 edge *)
  7022.   D3DTRIFLAG_EDGEENABLE2                  = $00000200; (* v1-v2 edge *)
  7023.   D3DTRIFLAG_EDGEENABLE3                  = $00000400; (* v2-v0 edge *)
  7024.   D3DTRIFLAG_EDGEENABLETRIANGLE = (
  7025.       D3DTRIFLAG_EDGEENABLE1 or D3DTRIFLAG_EDGEENABLE2 or D3DTRIFLAG_EDGEENABLE3);
  7026.  
  7027. (*
  7028.  * Primitive structures and related defines.  Vertex offsets are to types
  7029.  * TD3DVertex, TD3DLVertex, or TD3DTLVertex.
  7030.  *)
  7031.  
  7032. (*
  7033.  * Triangle list primitive structure
  7034.  *)
  7035. type
  7036.   PD3DTriangle = ^TD3DTriangle;
  7037.   TD3DTriangle = packed record
  7038.     case Integer of
  7039.     0: (
  7040.       v1: WORD;            (* Vertex indices *)
  7041.       v2: WORD;
  7042.       v3: WORD;
  7043.       wFlags: WORD;        (* Edge (and other) flags *)
  7044.      );
  7045.     1: (
  7046.       wV1: WORD;
  7047.       wV2: WORD;
  7048.       wV3: WORD;
  7049.      );
  7050.   end;
  7051.  
  7052. (*
  7053.  * Line strip structure.
  7054.  * The instruction count - 1 defines the number of line segments.
  7055.  *)
  7056.   PD3DLine = ^TD3DLine;
  7057.   TD3DLine = packed record
  7058.     case Integer of
  7059.     0: (
  7060.       v1: WORD;            (* Vertex indices *)
  7061.       v2: WORD;
  7062.      );
  7063.     1: (
  7064.       wV1: WORD;
  7065.       wV2: WORD;
  7066.      );
  7067.   end;
  7068.  
  7069. (*
  7070.  * Span structure
  7071.  * Spans join a list of points with the same y value.
  7072.  * If the y value changes, a new span is started.
  7073.  *)
  7074.   PD3DSpan = ^TD3DSpan;
  7075.   TD3DSpan = packed record
  7076.     wCount: WORD;        (* Number of spans *)
  7077.     wFirst: WORD;        (* Index to first vertex *)
  7078.   end;
  7079.  
  7080. (*
  7081.  * Point structure
  7082.  *)
  7083.   PD3DPoint = ^TD3DPoint;
  7084.   TD3DPoint = packed record
  7085.     wCount: WORD;        (* number of points         *)
  7086.     wFirst: WORD;        (* index to first vertex    *)
  7087.   end;
  7088.  
  7089. (*
  7090.  * Forward branch structure.
  7091.  * Mask is logically anded with the driver status mask
  7092.  * if the result equals 'value', the branch is taken.
  7093.  *)
  7094.   PD3DBranch = ^TD3DBranch;
  7095.   TD3DBranch = packed record
  7096.     dwMask: DWORD;         (* Bitmask against D3D status *)
  7097.     dwValue: DWORD;
  7098.     bNegate: BOOL;         (* TRUE to negate comparison *)
  7099.     dwOffset: DWORD;       (* How far to branch forward (0 for exit)*)
  7100.   end;
  7101.  
  7102. (*
  7103.  * Status used for set status instruction.
  7104.  * The D3D status is initialised on device creation
  7105.  * and is modified by all execute calls.
  7106.  *)
  7107.   PD3DStatus = ^TD3DStatus;
  7108.   TD3DStatus = packed record
  7109.     dwFlags: DWORD;        (* Do we set extents or status *)
  7110.     dwStatus: DWORD;       (* D3D status *)
  7111.     drExtent: TD3DRect;
  7112.   end;
  7113.  
  7114. const
  7115.   D3DSETSTATUS_STATUS    = $00000001;
  7116.   D3DSETSTATUS_EXTENTS   = $00000002;
  7117.   D3DSETSTATUS_ALL      = (D3DSETSTATUS_STATUS or D3DSETSTATUS_EXTENTS);
  7118.  
  7119. type
  7120.   PD3DClipStatus = ^TD3DClipStatus;
  7121.   TD3DClipStatus = packed record
  7122.     dwFlags : DWORD; (* Do we set 2d extents, 3D extents or status *)
  7123.     dwStatus : DWORD; (* Clip status *)
  7124.     minx, maxx : float; (* X extents *)
  7125.     miny, maxy : float; (* Y extents *)
  7126.     minz, maxz : float; (* Z extents *)
  7127.   end;
  7128.  
  7129. const
  7130.   D3DCLIPSTATUS_STATUS        = $00000001;
  7131.   D3DCLIPSTATUS_EXTENTS2      = $00000002;
  7132.   D3DCLIPSTATUS_EXTENTS3      = $00000004;
  7133.  
  7134. (*
  7135.  * Statistics structure
  7136.  *)
  7137. type
  7138.   PD3DStats = ^TD3DStats;
  7139.   TD3DStats = packed record
  7140.     dwSize: DWORD;
  7141.     dwTrianglesDrawn: DWORD;
  7142.     dwLinesDrawn: DWORD;
  7143.     dwPointsDrawn: DWORD;
  7144.     dwSpansDrawn: DWORD;
  7145.     dwVerticesProcessed: DWORD;
  7146.   end;
  7147.  
  7148. (*
  7149.  * Execute options.
  7150.  * When calling using D3DEXECUTE_UNCLIPPED all the primitives
  7151.  * inside the buffer must be contained within the viewport.
  7152.  *)
  7153. const
  7154.   D3DEXECUTE_CLIPPED       = $00000001;
  7155.   D3DEXECUTE_UNCLIPPED     = $00000002;
  7156.  
  7157. type
  7158.   PD3DExecuteData = ^TD3DExecuteData;
  7159.   TD3DExecuteData = packed record
  7160.     dwSize: DWORD;
  7161.     dwVertexOffset: DWORD;
  7162.     dwVertexCount: DWORD;
  7163.     dwInstructionOffset: DWORD;
  7164.     dwInstructionLength: DWORD;
  7165.     dwHVertexOffset: DWORD;
  7166.     dsStatus: TD3DStatus;       (* Status after execute *)
  7167.   end;
  7168.  
  7169. (*
  7170.  * Palette flags.
  7171.  * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw.
  7172.  *)
  7173.  
  7174. const
  7175.   D3DPAL_FREE     = $00;    (* Renderer may use this entry freely *)
  7176.   D3DPAL_READONLY = $40;    (* Renderer may not set this entry *)
  7177.   D3DPAL_RESERVED = $80;    (* Renderer may not use this entry *)
  7178.  
  7179.  
  7180. type
  7181.   PD3DVertexBufferDesc = ^TD3DVertexBufferDesc;
  7182.   TD3DVertexBufferDesc = packed record
  7183.     dwSize : DWORD;
  7184.     dwCaps : DWORD;
  7185.     dwFVF : DWORD;
  7186.     dwNumVertices : DWORD;
  7187.   end;
  7188.  
  7189. const
  7190. (* These correspond to DDSCAPS_* flags *)
  7191.   D3DVBCAPS_SYSTEMMEMORY      = $00000800;
  7192.   D3DVBCAPS_WRITEONLY         = $00010000;
  7193.   D3DVBCAPS_OPTIMIZED         = $80000000;
  7194.   D3DVBCAPS_DONOTCLIP         = $00000001;
  7195.  
  7196. (* Vertex Operations for ProcessVertices *)
  7197.   D3DVOP_LIGHT      = (1 shl 10);
  7198.   D3DVOP_TRANSFORM  = (1 shl 0);
  7199.   D3DVOP_CLIP       = (1 shl 2);
  7200.   D3DVOP_EXTENTS    = (1 shl 3);
  7201.  
  7202. (* The maximum number of vertices user can pass to any d3d
  7203.    drawing function or to create vertex buffer with
  7204. *)
  7205.   D3DMAXNUMVERTICES  =  ((1 shl 16) - 1);
  7206. (* The maximum number of primitives user can pass to any d3d
  7207.    drawing function.
  7208. *)
  7209.   D3DMAXNUMPRIMITIVES = ((1 shl 16) - 1);
  7210.  
  7211. (* Bits for dwFlags in ProcessVertices call *)
  7212.   D3DPV_DONOTCOPYDATA = (1 shl 0);
  7213.  
  7214. //-------------------------------------------------------------------
  7215.  
  7216. // Flexible vertex format bits
  7217. //
  7218.   D3DFVF_RESERVED0        = $001;
  7219.   D3DFVF_POSITION_MASK    = $00E;
  7220.   D3DFVF_XYZ              = $002;
  7221.   D3DFVF_XYZRHW           = $004;
  7222.   D3DFVF_XYZB1            = $006;
  7223.   D3DFVF_XYZB2            = $008;
  7224.   D3DFVF_XYZB3            = $00a;
  7225.   D3DFVF_XYZB4            = $00c;
  7226.   D3DFVF_XYZB5            = $00e;
  7227.  
  7228.   D3DFVF_NORMAL           = $010;
  7229.   D3DFVF_RESERVED1        = $020;
  7230.   D3DFVF_DIFFUSE          = $040;
  7231.   D3DFVF_SPECULAR         = $080;
  7232.  
  7233.   D3DFVF_TEXCOUNT_MASK    = $f00;
  7234.   D3DFVF_TEXCOUNT_SHIFT   = 8;
  7235.   D3DFVF_TEX0             = $000;
  7236.   D3DFVF_TEX1             = $100;
  7237.   D3DFVF_TEX2             = $200;
  7238.   D3DFVF_TEX3             = $300;
  7239.   D3DFVF_TEX4             = $400;
  7240.   D3DFVF_TEX5             = $500;
  7241.   D3DFVF_TEX6             = $600;
  7242.   D3DFVF_TEX7             = $700;
  7243.   D3DFVF_TEX8             = $800;
  7244.  
  7245.   D3DFVF_RESERVED2        = $f000;  // 4 reserved bits
  7246.  
  7247.   D3DFVF_VERTEX = ( D3DFVF_XYZ or D3DFVF_NORMAL or D3DFVF_TEX1 );
  7248.   D3DFVF_LVERTEX = ( D3DFVF_XYZ or D3DFVF_RESERVED1 or D3DFVF_DIFFUSE or
  7249.                          D3DFVF_SPECULAR or D3DFVF_TEX1 );
  7250.   D3DFVF_TLVERTEX = ( D3DFVF_XYZRHW or D3DFVF_DIFFUSE or D3DFVF_SPECULAR or
  7251.                           D3DFVF_TEX1 );
  7252.  
  7253. type
  7254.   PD3DDP_PtrStride = ^TD3DDP_PtrStride;
  7255.   TD3DDP_PtrStride = packed record
  7256.     lpvData : pointer;
  7257.     dwStride : DWORD;
  7258.   end;
  7259.  
  7260. const
  7261.   D3DDP_MAXTEXCOORD = 8;
  7262.  
  7263. type
  7264.   PD3DDrawPrimitiveStridedData = ^TD3DDrawPrimitiveStridedData;
  7265.   TD3DDrawPrimitiveStridedData = packed record
  7266.     position : TD3DDP_PtrStride;
  7267.     normal : TD3DDP_PtrStride;
  7268.     diffuse : TD3DDP_PtrStride;
  7269.     specular : TD3DDP_PtrStride;
  7270.     textureCoords : array [0..D3DDP_MAXTEXCOORD-1] of TD3DDP_PtrStride;
  7271.   end;
  7272.  
  7273. //---------------------------------------------------------------------
  7274. // ComputeSphereVisibility return values
  7275. //
  7276. const
  7277.   D3DVIS_INSIDE_FRUSTUM      = 0;
  7278.   D3DVIS_INTERSECT_FRUSTUM   = 1;
  7279.   D3DVIS_OUTSIDE_FRUSTUM     = 2;
  7280.   D3DVIS_INSIDE_LEFT         = 0;
  7281.   D3DVIS_INTERSECT_LEFT      = (1 shl 2);
  7282.   D3DVIS_OUTSIDE_LEFT        = (2 shl 2);
  7283.   D3DVIS_INSIDE_RIGHT        = 0;
  7284.   D3DVIS_INTERSECT_RIGHT     = (1 shl 4);
  7285.   D3DVIS_OUTSIDE_RIGHT       = (2 shl 4);
  7286.   D3DVIS_INSIDE_TOP          = 0;
  7287.   D3DVIS_INTERSECT_TOP       = (1 shl 6);
  7288.   D3DVIS_OUTSIDE_TOP         = (2 shl 6);
  7289.   D3DVIS_INSIDE_BOTTOM       = 0;
  7290.   D3DVIS_INTERSECT_BOTTOM    = (1 shl 8);
  7291.   D3DVIS_OUTSIDE_BOTTOM      = (2 shl 8);
  7292.   D3DVIS_INSIDE_NEAR         = 0;
  7293.   D3DVIS_INTERSECT_NEAR      = (1 shl 10);
  7294.   D3DVIS_OUTSIDE_NEAR        = (2 shl 10);
  7295.   D3DVIS_INSIDE_FAR          = 0;
  7296.   D3DVIS_INTERSECT_FAR       = (1 shl 12);
  7297.   D3DVIS_OUTSIDE_FAR         = (2 shl 12);
  7298.  
  7299.   D3DVIS_MASK_FRUSTUM        = (3 shl 0);
  7300.   D3DVIS_MASK_LEFT           = (3 shl 2);
  7301.   D3DVIS_MASK_RIGHT          = (3 shl 4);
  7302.   D3DVIS_MASK_TOP            = (3 shl 6);
  7303.   D3DVIS_MASK_BOTTOM         = (3 shl 8);
  7304.   D3DVIS_MASK_NEAR           = (3 shl 10);
  7305.   D3DVIS_MASK_FAR            = (3 shl 12);
  7306.  
  7307. // To be used with GetInfo()
  7308.   D3DDEVINFOID_TEXTUREMANAGER    = 1;
  7309.   D3DDEVINFOID_D3DTEXTUREMANAGER = 2;
  7310.   D3DDEVINFOID_TEXTURING         = 3;
  7311.  
  7312. type
  7313.   PD3DStateBlockType = ^TD3DStateBlockType;
  7314.   TD3DStateBlockType = (
  7315.     D3DSBT_INVALID_0   ,
  7316.     D3DSBT_ALL         , // capture all state
  7317.     D3DSBT_PIXELSTATE  , // capture pixel state
  7318.     D3DSBT_VERTEXSTATE   // capture vertex state
  7319.   );
  7320.  
  7321. // The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state.
  7322. //
  7323.   PD3DVertexBlendFlags = ^TD3DVertexBlendFlags;
  7324.   TD3DVertexBlendFlags = (
  7325.     D3DVBLEND_DISABLE , // Disable vertex blending
  7326.     D3DVBLEND_1WEIGHT , // blend between 2 matrices
  7327.     D3DVBLEND_2WEIGHTS, // blend between 3 matrices
  7328.     D3DVBLEND_3WEIGHTS  // blend between 4 matrices
  7329.   );
  7330.  
  7331.   PD3DTextureTransformFlags = ^TD3DTextureTransformFlags;
  7332.   TD3DTextureTransformFlags = (
  7333.     D3DTTFF_DISABLE ,    // texture coordinates are passed directly
  7334.     D3DTTFF_COUNT1  ,    // rasterizer should expect 1-D texture coords
  7335.     D3DTTFF_COUNT2  ,    // rasterizer should expect 2-D texture coords
  7336.     D3DTTFF_COUNT3  ,    // rasterizer should expect 3-D texture coords
  7337.     D3DTTFF_COUNT4       // rasterizer should expect 4-D texture coords
  7338.   );
  7339.  
  7340. const
  7341.   D3DTTFF_PROJECTED       = TD3DTextureTransformFlags(256); // texcoords to be divided by COUNTth element
  7342.  
  7343. // Macros to set texture coordinate format bits in the FVF id
  7344.  
  7345. D3DFVF_TEXTUREFORMAT2 = 0;         // Two floating point values
  7346. D3DFVF_TEXTUREFORMAT1 = 3;         // One floating point value
  7347. D3DFVF_TEXTUREFORMAT3 = 1;         // Three floating point values
  7348. D3DFVF_TEXTUREFORMAT4 = 2;         // Four floating point values
  7349.  
  7350. function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWORD) : DWORD;
  7351. function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWORD) : DWORD;
  7352. function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWORD) : DWORD;
  7353. function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWORD) : DWORD;
  7354.  
  7355. (*==========================================================================;
  7356.  *
  7357.  *
  7358.  *  File:       d3dcaps.h
  7359.  *  Content:    Direct3D capabilities include file
  7360.  *
  7361.  ***************************************************************************)
  7362.  
  7363. (* Description of capabilities of transform *)
  7364.  
  7365. type
  7366.   PD3DTransformCaps = ^TD3DTransformCaps;
  7367.   TD3DTransformCaps = packed record
  7368.     dwSize: DWORD;
  7369.     dwCaps: DWORD;
  7370.   end;
  7371.  
  7372. const
  7373.   D3DTRANSFORMCAPS_CLIP         = $00000001; (* Will clip whilst transforming *)
  7374.  
  7375. (* Description of capabilities of lighting *)
  7376.  
  7377. type
  7378.   PD3DLightingCaps = ^TD3DLightingCaps;
  7379.   TD3DLightingCaps = packed record
  7380.     dwSize: DWORD;
  7381.     dwCaps: DWORD;                   (* Lighting caps *)
  7382.     dwLightingModel: DWORD;          (* Lighting model - RGB or mono *)
  7383.     dwNumLights: DWORD;              (* Number of lights that can be handled *)
  7384.   end;
  7385.  
  7386. const
  7387.   D3DLIGHTINGMODEL_RGB            = $00000001;
  7388.   D3DLIGHTINGMODEL_MONO           = $00000002;
  7389.  
  7390.   D3DLIGHTCAPS_POINT              = $00000001; (* Point lights supported *)
  7391.   D3DLIGHTCAPS_SPOT               = $00000002; (* Spot lights supported *)
  7392.   D3DLIGHTCAPS_DIRECTIONAL        = $00000004; (* Directional lights supported *)
  7393.   D3DLIGHTCAPS_PARALLELPOINT      = $00000008; (* Parallel point lights supported *)
  7394.   D3DLIGHTCAPS_GLSPOT             = $00000010; (* GL syle spot lights supported *)
  7395.  
  7396. (* Description of capabilities for each primitive type *)
  7397.  
  7398. type
  7399.   PD3DPrimCaps = ^TD3DPrimCaps;
  7400.   TD3DPrimCaps = packed record
  7401.     dwSize: DWORD;
  7402.     dwMiscCaps: DWORD;                 (* Capability flags *)
  7403.     dwRasterCaps: DWORD;
  7404.     dwZCmpCaps: DWORD;
  7405.     dwSrcBlendCaps: DWORD;
  7406.     dwDestBlendCaps: DWORD;
  7407.     dwAlphaCmpCaps: DWORD;
  7408.     dwShadeCaps: DWORD;
  7409.     dwTextureCaps: DWORD;
  7410.     dwTextureFilterCaps: DWORD;
  7411.     dwTextureBlendCaps: DWORD;
  7412.     dwTextureAddressCaps: DWORD;
  7413.     dwStippleWidth: DWORD;             (* maximum width and height of *)
  7414.     dwStippleHeight: DWORD;            (* of supported stipple (up to 32x32) *)
  7415.   end;
  7416.  
  7417. const
  7418. (* TD3DPrimCaps dwMiscCaps *)
  7419.  
  7420.   D3DPMISCCAPS_MASKPLANES         = $00000001;
  7421.   D3DPMISCCAPS_MASKZ              = $00000002;
  7422.   D3DPMISCCAPS_LINEPATTERNREP     = $00000004;
  7423.   D3DPMISCCAPS_CONFORMANT         = $00000008;
  7424.   D3DPMISCCAPS_CULLNONE           = $00000010;
  7425.   D3DPMISCCAPS_CULLCW             = $00000020;
  7426.   D3DPMISCCAPS_CULLCCW            = $00000040;
  7427.  
  7428. (* TD3DPrimCaps dwRasterCaps *)
  7429.  
  7430.   D3DPRASTERCAPS_DITHER           = $00000001;
  7431.   D3DPRASTERCAPS_ROP2             = $00000002;
  7432.   D3DPRASTERCAPS_XOR              = $00000004;
  7433.   D3DPRASTERCAPS_PAT              = $00000008;
  7434.   D3DPRASTERCAPS_ZTEST            = $00000010;
  7435.   D3DPRASTERCAPS_SUBPIXEL         = $00000020;
  7436.   D3DPRASTERCAPS_SUBPIXELX        = $00000040;
  7437.   D3DPRASTERCAPS_FOGVERTEX        = $00000080;
  7438.   D3DPRASTERCAPS_FOGTABLE         = $00000100;
  7439.   D3DPRASTERCAPS_STIPPLE          = $00000200;
  7440.   D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT   = $00000400;
  7441.   D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT = $00000800;
  7442.   D3DPRASTERCAPS_ANTIALIASEDGES           = $00001000;
  7443.   D3DPRASTERCAPS_MIPMAPLODBIAS            = $00002000;
  7444.   D3DPRASTERCAPS_ZBIAS                    = $00004000;
  7445.   D3DPRASTERCAPS_ZBUFFERLESSHSR           = $00008000;
  7446.   D3DPRASTERCAPS_FOGRANGE                 = $00010000;
  7447.   D3DPRASTERCAPS_ANISOTROPY               = $00020000;
  7448.   D3DPRASTERCAPS_WBUFFER                      = $00040000;
  7449.   D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT   = $00080000;
  7450.   D3DPRASTERCAPS_WFOG                         = $00100000;
  7451.   D3DPRASTERCAPS_ZFOG                         = $00200000;
  7452.  
  7453. (* TD3DPrimCaps dwZCmpCaps, dwAlphaCmpCaps *)
  7454.  
  7455. const
  7456.   D3DPCMPCAPS_NEVER               = $00000001;
  7457.   D3DPCMPCAPS_LESS                = $00000002;
  7458.   D3DPCMPCAPS_EQUAL               = $00000004;
  7459.   D3DPCMPCAPS_LESSEQUAL           = $00000008;
  7460.   D3DPCMPCAPS_GREATER             = $00000010;
  7461.   D3DPCMPCAPS_NOTEQUAL            = $00000020;
  7462.   D3DPCMPCAPS_GREATEREQUAL        = $00000040;
  7463.   D3DPCMPCAPS_ALWAYS              = $00000080;
  7464.  
  7465. (* TD3DPrimCaps dwSourceBlendCaps, dwDestBlendCaps *)
  7466.  
  7467.   D3DPBLENDCAPS_ZERO              = $00000001;
  7468.   D3DPBLENDCAPS_ONE               = $00000002;
  7469.   D3DPBLENDCAPS_SRCCOLOR          = $00000004;
  7470.   D3DPBLENDCAPS_INVSRCCOLOR       = $00000008;
  7471.   D3DPBLENDCAPS_SRCALPHA          = $00000010;
  7472.   D3DPBLENDCAPS_INVSRCALPHA       = $00000020;
  7473.   D3DPBLENDCAPS_DESTALPHA         = $00000040;
  7474.   D3DPBLENDCAPS_INVDESTALPHA      = $00000080;
  7475.   D3DPBLENDCAPS_DESTCOLOR         = $00000100;
  7476.   D3DPBLENDCAPS_INVDESTCOLOR      = $00000200;
  7477.   D3DPBLENDCAPS_SRCALPHASAT       = $00000400;
  7478.   D3DPBLENDCAPS_BOTHSRCALPHA      = $00000800;
  7479.   D3DPBLENDCAPS_BOTHINVSRCALPHA   = $00001000;
  7480.  
  7481. (* TD3DPrimCaps dwShadeCaps *)
  7482.  
  7483.   D3DPSHADECAPS_COLORFLATMONO             = $00000001;
  7484.   D3DPSHADECAPS_COLORFLATRGB              = $00000002;
  7485.   D3DPSHADECAPS_COLORGOURAUDMONO          = $00000004;
  7486.   D3DPSHADECAPS_COLORGOURAUDRGB           = $00000008;
  7487.   D3DPSHADECAPS_COLORPHONGMONO            = $00000010;
  7488.   D3DPSHADECAPS_COLORPHONGRGB             = $00000020;
  7489.  
  7490.   D3DPSHADECAPS_SPECULARFLATMONO          = $00000040;
  7491.   D3DPSHADECAPS_SPECULARFLATRGB           = $00000080;
  7492.   D3DPSHADECAPS_SPECULARGOURAUDMONO       = $00000100;
  7493.   D3DPSHADECAPS_SPECULARGOURAUDRGB        = $00000200;
  7494.   D3DPSHADECAPS_SPECULARPHONGMONO         = $00000400;
  7495.   D3DPSHADECAPS_SPECULARPHONGRGB          = $00000800;
  7496.  
  7497.   D3DPSHADECAPS_ALPHAFLATBLEND            = $00001000;
  7498.   D3DPSHADECAPS_ALPHAFLATSTIPPLED         = $00002000;
  7499.   D3DPSHADECAPS_ALPHAGOURAUDBLEND         = $00004000;
  7500.   D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED      = $00008000;
  7501.   D3DPSHADECAPS_ALPHAPHONGBLEND           = $00010000;
  7502.   D3DPSHADECAPS_ALPHAPHONGSTIPPLED        = $00020000;
  7503.  
  7504.   D3DPSHADECAPS_FOGFLAT                   = $00040000;
  7505.   D3DPSHADECAPS_FOGGOURAUD                = $00080000;
  7506.   D3DPSHADECAPS_FOGPHONG                  = $00100000;
  7507.  
  7508. (* TD3DPrimCaps dwTextureCaps *)
  7509.  
  7510. (*
  7511.  * Perspective-correct texturing is supported
  7512.  *)
  7513.   D3DPTEXTURECAPS_PERSPECTIVE     = $00000001;
  7514.  
  7515. (*
  7516.  * Power-of-2 texture dimensions are required
  7517.  *)
  7518.   D3DPTEXTURECAPS_POW2            = $00000002;
  7519.  
  7520. (*
  7521.  * Alpha in texture pixels is supported
  7522.  *)
  7523.   D3DPTEXTURECAPS_ALPHA           = $00000004;
  7524.  
  7525. (*
  7526.  * Color-keyed textures are supported
  7527.  *)
  7528.   D3DPTEXTURECAPS_TRANSPARENCY    = $00000008;
  7529.  
  7530. (*
  7531.  * obsolete, see D3DPTADDRESSCAPS_BORDER
  7532.  *)
  7533.   D3DPTEXTURECAPS_BORDER          = $00000010;
  7534.  
  7535. (*
  7536.  * Only square textures are supported
  7537.  *)
  7538.   D3DPTEXTURECAPS_SQUAREONLY      = $00000020;
  7539.  
  7540. (*
  7541.  * Texture indices are not scaled by the texture size prior
  7542.  * to interpolation.
  7543.  *)
  7544.   D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040;
  7545.  
  7546. (*
  7547.  * Device can draw alpha from texture palettes
  7548.  *)
  7549.   D3DPTEXTURECAPS_ALPHAPALETTE    = $00000080;
  7550.  
  7551. (*
  7552.  * Device can use non-POW2 textures if:
  7553.  *  1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
  7554.  *  2) D3DRS_WRAP(N) is zero for this texture's coordinates
  7555.  *  3) mip mapping is not enabled (use magnification filter only)
  7556.  *)
  7557.   D3DPTEXTURECAPS_NONPOW2CONDITIONAL  = $00000100;
  7558.  
  7559. // 0x00000200L unused
  7560.  
  7561. (*
  7562.  * Device can divide transformed texture coordinates by the
  7563.  * COUNTth texture coordinate (can do D3DTTFF_PROJECTED)
  7564.  *)
  7565.   D3DPTEXTURECAPS_PROJECTED  = $00000400;
  7566.  
  7567. (*
  7568.  * Device can do cubemap textures
  7569.  *)
  7570.   D3DPTEXTURECAPS_CUBEMAP           = $00000800;
  7571.  
  7572.   D3DPTEXTURECAPS_COLORKEYBLEND     = $00001000;
  7573.  
  7574.  
  7575. (* TD3DPrimCaps dwTextureFilterCaps *)
  7576.  
  7577.   D3DPTFILTERCAPS_NEAREST         = $00000001;
  7578.   D3DPTFILTERCAPS_LINEAR          = $00000002;
  7579.   D3DPTFILTERCAPS_MIPNEAREST      = $00000004;
  7580.   D3DPTFILTERCAPS_MIPLINEAR       = $00000008;
  7581.   D3DPTFILTERCAPS_LINEARMIPNEAREST = $00000010;
  7582.   D3DPTFILTERCAPS_LINEARMIPLINEAR = $00000020;
  7583.  
  7584. (* Device3 Min Filter *)
  7585.   D3DPTFILTERCAPS_MINFPOINT       = $00000100;
  7586.   D3DPTFILTERCAPS_MINFLINEAR      = $00000200;
  7587.   D3DPTFILTERCAPS_MINFANISOTROPIC = $00000400;
  7588.  
  7589. (* Device3 Mip Filter *)
  7590.   D3DPTFILTERCAPS_MIPFPOINT       = $00010000;
  7591.   D3DPTFILTERCAPS_MIPFLINEAR      = $00020000;
  7592.  
  7593. (* Device3 Mag Filter *)
  7594.   D3DPTFILTERCAPS_MAGFPOINT         = $01000000;
  7595.   D3DPTFILTERCAPS_MAGFLINEAR        = $02000000;
  7596.   D3DPTFILTERCAPS_MAGFANISOTROPIC   = $04000000;
  7597.   D3DPTFILTERCAPS_MAGFAFLATCUBIC    = $08000000;
  7598.   D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC = $10000000;
  7599.  
  7600. (* TD3DPrimCaps dwTextureBlendCaps *)
  7601.  
  7602.   D3DPTBLENDCAPS_DECAL            = $00000001;
  7603.   D3DPTBLENDCAPS_MODULATE         = $00000002;
  7604.   D3DPTBLENDCAPS_DECALALPHA       = $00000004;
  7605.   D3DPTBLENDCAPS_MODULATEALPHA    = $00000008;
  7606.   D3DPTBLENDCAPS_DECALMASK        = $00000010;
  7607.   D3DPTBLENDCAPS_MODULATEMASK     = $00000020;
  7608.   D3DPTBLENDCAPS_COPY             = $00000040;
  7609.   D3DPTBLENDCAPS_ADD                      = $00000080;
  7610.  
  7611. (* TD3DPrimCaps dwTextureAddressCaps *)
  7612.   D3DPTADDRESSCAPS_WRAP           = $00000001;
  7613.   D3DPTADDRESSCAPS_MIRROR         = $00000002;
  7614.   D3DPTADDRESSCAPS_CLAMP          = $00000004;
  7615.   D3DPTADDRESSCAPS_BORDER         = $00000008;
  7616.   D3DPTADDRESSCAPS_INDEPENDENTUV  = $00000010;
  7617.  
  7618. (* D3DDEVICEDESC dwStencilCaps *)
  7619.  
  7620.   D3DSTENCILCAPS_KEEP     = $00000001;
  7621.   D3DSTENCILCAPS_ZERO     = $00000002;
  7622.   D3DSTENCILCAPS_REPLACE  = $00000004;
  7623.   D3DSTENCILCAPS_INCRSAT  = $00000008;
  7624.   D3DSTENCILCAPS_DECRSAT  = $00000010;
  7625.   D3DSTENCILCAPS_INVERT   = $00000020;
  7626.   D3DSTENCILCAPS_INCR     = $00000040;
  7627.   D3DSTENCILCAPS_DECR     = $00000080;
  7628.  
  7629. (* D3DDEVICEDESC dwTextureOpCaps *)
  7630.  
  7631.   D3DTEXOPCAPS_DISABLE                    = $00000001;
  7632.   D3DTEXOPCAPS_SELECTARG1                 = $00000002;
  7633.   D3DTEXOPCAPS_SELECTARG2                 = $00000004;
  7634.   D3DTEXOPCAPS_MODULATE                   = $00000008;
  7635.   D3DTEXOPCAPS_MODULATE2X                 = $00000010;
  7636.   D3DTEXOPCAPS_MODULATE4X                 = $00000020;
  7637.   D3DTEXOPCAPS_ADD                        = $00000040;
  7638.   D3DTEXOPCAPS_ADDSIGNED                  = $00000080;
  7639.   D3DTEXOPCAPS_ADDSIGNED2X                = $00000100;
  7640.   D3DTEXOPCAPS_SUBTRACT                   = $00000200;
  7641.   D3DTEXOPCAPS_ADDSMOOTH                  = $00000400;
  7642.   D3DTEXOPCAPS_BLENDDIFFUSEALPHA          = $00000800;
  7643.   D3DTEXOPCAPS_BLENDTEXTUREALPHA          = $00001000;
  7644.   D3DTEXOPCAPS_BLENDFACTORALPHA           = $00002000;
  7645.   D3DTEXOPCAPS_BLENDTEXTUREALPHAPM        = $00004000;
  7646.   D3DTEXOPCAPS_BLENDCURRENTALPHA          = $00008000;
  7647.   D3DTEXOPCAPS_PREMODULATE                = $00010000;
  7648.   D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR     = $00020000;
  7649.   D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA     = $00040000;
  7650.   D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR  = $00080000;
  7651.   D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA  = $00100000;
  7652.   D3DTEXOPCAPS_BUMPENVMAP                 = $00200000;
  7653.   D3DTEXOPCAPS_BUMPENVMAPLUMINANCE        = $00400000;
  7654.   D3DTEXOPCAPS_DOTPRODUCT3                = $00800000;
  7655.  
  7656. (* D3DDEVICEDESC dwFVFCaps flags *)
  7657.  
  7658.   D3DFVFCAPS_TEXCOORDCOUNTMASK    = $0000ffff; (* mask for texture coordinate count field *)
  7659.   D3DFVFCAPS_DONOTSTRIPELEMENTS   = $00080000; (* Device prefers that vertex elements not be stripped *)
  7660.  
  7661. (*
  7662.  * Description for a device.
  7663.  * This is used to describe a device that is to be created or to query
  7664.  * the current device.
  7665.  *)
  7666.  
  7667. type
  7668.   PD3DDeviceDesc = ^TD3DDeviceDesc;
  7669.   TD3DDeviceDesc = packed record
  7670.     dwSize: DWORD;                       (* Size of TD3DDeviceDesc structure *)
  7671.     dwFlags: DWORD;                      (* Indicates which fields have valid data *)
  7672.     dcmColorModel: TD3DColorModel;        (* Color model of device *)
  7673.     dwDevCaps: DWORD;                    (* Capabilities of device *)
  7674.     dtcTransformCaps: TD3DTransformCaps;  (* Capabilities of transform *)
  7675.     bClipping: BOOL;                     (* Device can do 3D clipping *)
  7676.     dlcLightingCaps: TD3DLightingCaps;    (* Capabilities of lighting *)
  7677.     dpcLineCaps: TD3DPrimCaps;
  7678.     dpcTriCaps: TD3DPrimCaps;
  7679.     dwDeviceRenderBitDepth: DWORD;       (* One of DDBB_8, 16, etc.. *)
  7680.     dwDeviceZBufferBitDepth: DWORD;      (* One of DDBD_16, 32, etc.. *)
  7681.     dwMaxBufferSize: DWORD;              (* Maximum execute buffer size *)
  7682.     dwMaxVertexCount: DWORD;             (* Maximum vertex count *)
  7683.     // *** New fields for DX5 *** //
  7684.  
  7685.     // Width and height caps are 0 for legacy HALs.
  7686.     dwMinTextureWidth, dwMinTextureHeight  : DWORD;
  7687.     dwMaxTextureWidth, dwMaxTextureHeight  : DWORD;
  7688.     dwMinStippleWidth, dwMaxStippleWidth   : DWORD;
  7689.     dwMinStippleHeight, dwMaxStippleHeight : DWORD;
  7690.  
  7691.     // New fields for DX6
  7692.     dwMaxTextureRepeat : DWORD;
  7693.     dwMaxTextureAspectRatio : DWORD;
  7694.     dwMaxAnisotropy : DWORD;
  7695.  
  7696.     // Guard band that the rasterizer can accommodate
  7697.     // Screen-space vertices inside this space but outside the viewport
  7698.     // will get clipped properly.
  7699.     dvGuardBandLeft : TD3DValue;
  7700.     dvGuardBandTop : TD3DValue;
  7701.     dvGuardBandRight : TD3DValue;
  7702.     dvGuardBandBottom : TD3DValue;
  7703.  
  7704.     dvExtentsAdjust : TD3DValue;
  7705.     dwStencilCaps : DWORD;
  7706.  
  7707.     dwFVFCaps : DWORD;  (* low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware *)
  7708.     dwTextureOpCaps : DWORD;
  7709.     wMaxTextureBlendStages : WORD;
  7710.     wMaxSimultaneousTextures : WORD;
  7711.   end;
  7712.  
  7713.   PD3DDeviceDesc7 = ^TD3DDeviceDesc7;
  7714.   TD3DDeviceDesc7 = packed record
  7715.     dwDevCaps:               DWORD;             (* Capabilities of device *)
  7716.     dpcLineCaps:             TD3DPrimCaps;
  7717.     dpcTriCaps:              TD3DPrimCaps;
  7718.     dwDeviceRenderBitDepth:  DWORD;             (* One of DDBB_8, 16, etc.. *)
  7719.     dwDeviceZBufferBitDepth: DWORD;             (* One of DDBD_16, 32, etc.. *)
  7720.  
  7721.     dwMinTextureWidth, dwMinTextureHeight: DWORD;
  7722.     dwMaxTextureWidth, dwMaxTextureHeight: DWORD;
  7723.  
  7724.     dwMaxTextureRepeat:                    DWORD;
  7725.     dwMaxTextureAspectRatio:               DWORD;
  7726.     dwMaxAnisotropy:                       DWORD;
  7727.  
  7728.     dvGuardBandLeft:                       TD3DValue;
  7729.     dvGuardBandTop:                        TD3DValue;
  7730.     dvGuardBandRight:                      TD3DValue;
  7731.     dvGuardBandBottom:                     TD3DValue;
  7732.  
  7733.     dvExtentsAdjust:                       TD3DValue;
  7734.     dwStencilCaps:                         DWORD;
  7735.  
  7736.     dwFVFCaps:                             DWORD;
  7737.     dwTextureOpCaps:                       DWORD;
  7738.     wMaxTextureBlendStages:                WORD;
  7739.     wMaxSimultaneousTextures:              WORD;
  7740.  
  7741.     dwMaxActiveLights:                     DWORD;
  7742.     dvMaxVertexW:                          TD3DValue;
  7743.     deviceGUID:                            TGUID;
  7744.  
  7745.     wMaxUserClipPlanes:                    WORD;
  7746.     wMaxVertexBlendMatrices:               WORD;
  7747.  
  7748.     dwVertexProcessingCaps:                DWORD;
  7749.  
  7750.     dwReserved1:                           DWORD;
  7751.     dwReserved2:                           DWORD;
  7752.     dwReserved3:                           DWORD;
  7753.     dwReserved4:                           DWORD;
  7754.   end;
  7755.  
  7756. const
  7757.   D3DDEVICEDESCSIZE = sizeof(TD3DDeviceDesc);
  7758.   D3DDEVICEDESC7SIZE = sizeof(TD3DDeviceDesc7);
  7759.  
  7760. type
  7761.   TD3DEnumDevicesCallbackA = function (lpGuid: PGUID; // nil for the default device
  7762.       lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
  7763.       var lpD3DHWDeviceDesc: TD3DDeviceDesc;
  7764.       var lpD3DHELDeviceDesc: TD3DDeviceDesc;
  7765.       lpContext : pointer) : HResult; stdcall;
  7766.   TD3DEnumDevicesCallback = TD3DEnumDevicesCallbackA;
  7767.  
  7768.   TD3DEnumDevicesCallback7A = function (
  7769.       lpDeviceDescription: PAnsiChar; lpDeviceName: PAnsiChar;
  7770.       const lpD3DDeviceDesc: TD3DDeviceDesc7; lpContext: Pointer) : HResult; stdcall;
  7771.   TD3DEnumDevicesCallback7 = TD3DEnumDevicesCallback7A;
  7772.  
  7773. (* TD3DDeviceDesc dwFlags indicating valid fields *)
  7774.  
  7775. const
  7776.   D3DDD_COLORMODEL            = $00000001; (* dcmColorModel is valid *)
  7777.   D3DDD_DEVCAPS               = $00000002; (* dwDevCaps is valid *)
  7778.   D3DDD_TRANSFORMCAPS         = $00000004; (* dtcTransformCaps is valid *)
  7779.   D3DDD_LIGHTINGCAPS          = $00000008; (* dlcLightingCaps is valid *)
  7780.   D3DDD_BCLIPPING             = $00000010; (* bClipping is valid *)
  7781.   D3DDD_LINECAPS              = $00000020; (* dpcLineCaps is valid *)
  7782.   D3DDD_TRICAPS               = $00000040; (* dpcTriCaps is valid *)
  7783.   D3DDD_DEVICERENDERBITDEPTH  = $00000080; (* dwDeviceRenderBitDepth is valid *)
  7784.   D3DDD_DEVICEZBUFFERBITDEPTH = $00000100; (* dwDeviceZBufferBitDepth is valid *)
  7785.   D3DDD_MAXBUFFERSIZE         = $00000200; (* dwMaxBufferSize is valid *)
  7786.   D3DDD_MAXVERTEXCOUNT        = $00000400; (* dwMaxVertexCount is valid *)
  7787.  
  7788. (* TD3DDeviceDesc dwDevCaps flags *)
  7789.  
  7790.   D3DDEVCAPS_FLOATTLVERTEX        = $00000001; (* Device accepts floating point *)
  7791.                                                     (* for post-transform vertex data *)
  7792.   D3DDEVCAPS_SORTINCREASINGZ      = $00000002; (* Device needs data sorted for increasing Z*)
  7793.   D3DDEVCAPS_SORTDECREASINGZ      = $00000004; (* Device needs data sorted for decreasing Z*)
  7794.   D3DDEVCAPS_SORTEXACT            = $00000008; (* Device needs data sorted exactly *)
  7795.  
  7796.   D3DDEVCAPS_EXECUTESYSTEMMEMORY  = $00000010; (* Device can use execute buffers from system memory *)
  7797.   D3DDEVCAPS_EXECUTEVIDEOMEMORY   = $00000020; (* Device can use execute buffers from video memory *)
  7798.   D3DDEVCAPS_TLVERTEXSYSTEMMEMORY = $00000040; (* Device can use TL buffers from system memory *)
  7799.   D3DDEVCAPS_TLVERTEXVIDEOMEMORY  = $00000080; (* Device can use TL buffers from video memory *)
  7800.   D3DDEVCAPS_TEXTURESYSTEMMEMORY  = $00000100; (* Device can texture from system memory *)
  7801.   D3DDEVCAPS_TEXTUREVIDEOMEMORY   = $00000200; (* Device can texture from device memory *)
  7802.   D3DDEVCAPS_DRAWPRIMTLVERTEX     = $00000400; (* Device can draw TLVERTEX primitives *)
  7803.   D3DDEVCAPS_CANRENDERAFTERFLIP   = $00000800; (* Device can render without waiting for flip to complete *)
  7804.   D3DDEVCAPS_TEXTURENONLOCALVIDMEM   = $00001000; (* Device can texture from nonlocal video memory *)
  7805.   D3DDEVCAPS_DRAWPRIMITIVES2         = $00002000; (* Device can support DrawPrimitives2 *)
  7806.   D3DDEVCAPS_SEPARATETEXTUREMEMORIES = $00004000; (* Device is texturing from separate memory pools *)
  7807.   D3DDEVCAPS_DRAWPRIMITIVES2EX       = $00008000; (* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*)
  7808.   D3DDEVCAPS_HWTRANSFORMANDLIGHT     = $00010000; (* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also *)
  7809.   D3DDEVCAPS_CANBLTSYSTONONLOCAL     = $00020000; (* Device supports a Tex Blt from system memory to non-local vidmem *)
  7810.   D3DDEVCAPS_HWRASTERIZATION         = $00080000; (* Device has HW acceleration for rasterization *)
  7811.  
  7812. (*
  7813.  * These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field
  7814.  *)
  7815.  
  7816. (* device can do texgen *)
  7817.   D3DVTXPCAPS_TEXGEN              = $00000001;
  7818. (* device can do IDirect3DDevice7 colormaterialsource ops *)
  7819.   D3DVTXPCAPS_MATERIALSOURCE7     = $00000002;
  7820. (* device can do vertex fog *)
  7821.   D3DVTXPCAPS_VERTEXFOG           = $00000004;
  7822. (* device can do directional lights *)
  7823.   D3DVTXPCAPS_DIRECTIONALLIGHTS   = $00000008;
  7824. (* device can do positional lights (includes point and spot) *)
  7825.   D3DVTXPCAPS_POSITIONALLIGHTS    = $00000010;
  7826. (* device can do local viewer *)
  7827.   D3DVTXPCAPS_LOCALVIEWER         = $00000020;
  7828.  
  7829.   D3DFDS_COLORMODEL        = $00000001; (* Match color model *)
  7830.   D3DFDS_GUID              = $00000002; (* Match guid *)
  7831.   D3DFDS_HARDWARE          = $00000004; (* Match hardware/software *)
  7832.   D3DFDS_TRIANGLES         = $00000008; (* Match in triCaps *)
  7833.   D3DFDS_LINES             = $00000010; (* Match in lineCaps  *)
  7834.   D3DFDS_MISCCAPS          = $00000020; (* Match primCaps.dwMiscCaps *)
  7835.   D3DFDS_RASTERCAPS        = $00000040; (* Match primCaps.dwRasterCaps *)
  7836.   D3DFDS_ZCMPCAPS          = $00000080; (* Match primCaps.dwZCmpCaps *)
  7837.   D3DFDS_ALPHACMPCAPS      = $00000100; (* Match primCaps.dwAlphaCmpCaps *)
  7838.   D3DFDS_SRCBLENDCAPS      = $00000200; (* Match primCaps.dwSourceBlendCaps *)
  7839.   D3DFDS_DSTBLENDCAPS      = $00000400; (* Match primCaps.dwDestBlendCaps *)
  7840.   D3DFDS_SHADECAPS         = $00000800; (* Match primCaps.dwShadeCaps *)
  7841.   D3DFDS_TEXTURECAPS       = $00001000; (* Match primCaps.dwTextureCaps *)
  7842.   D3DFDS_TEXTUREFILTERCAPS = $00002000; (* Match primCaps.dwTextureFilterCaps *)
  7843.   D3DFDS_TEXTUREBLENDCAPS  = $00004000; (* Match primCaps.dwTextureBlendCaps *)
  7844.   D3DFDS_TEXTUREADDRESSCAPS  = $00008000; (* Match primCaps.dwTextureBlendCaps *)
  7845.  
  7846. (*
  7847.  * FindDevice arguments
  7848.  *)
  7849. type
  7850.   PD3DFindDeviceSearch = ^TD3DFindDeviceSearch;
  7851.   TD3DFindDeviceSearch = packed record
  7852.     dwSize: DWORD;
  7853.     dwFlags: DWORD;
  7854.     bHardware: BOOL;
  7855.     dcmColorModel: TD3DColorModel;
  7856.     guid: TGUID;
  7857.     dwCaps: DWORD;
  7858.     dpcPrimCaps: TD3DPrimCaps;
  7859.   end;
  7860.  
  7861.   PD3DFindDeviceResult = ^TD3DFindDeviceResult;
  7862.   TD3DFindDeviceResult = packed record
  7863.     dwSize: DWORD;
  7864.     guid: TGUID;               (* guid which matched *)
  7865.     ddHwDesc: TD3DDeviceDesc;   (* hardware TD3DDeviceDesc *)
  7866.     ddSwDesc: TD3DDeviceDesc;   (* software TD3DDeviceDesc *)
  7867.   end;
  7868.  
  7869. (*
  7870.  * Description of execute buffer.
  7871.  *)
  7872.   PD3DExecuteBufferDesc = ^TD3DExecuteBufferDesc;
  7873.   TD3DExecuteBufferDesc = packed record
  7874.     dwSize: DWORD;         (* size of this structure *)
  7875.     dwFlags: DWORD;        (* flags indicating which fields are valid *)
  7876.     dwCaps: DWORD;         (* capabilities of execute buffer *)
  7877.     dwBufferSize: DWORD;   (* size of execute buffer data *)
  7878.     lpData: Pointer;       (* pointer to actual data *)
  7879.   end;
  7880.  
  7881. (* D3DEXECUTEBUFFER dwFlags indicating valid fields *)
  7882.  
  7883. const
  7884.   D3DDEB_BUFSIZE          = $00000001;     (* buffer size valid *)
  7885.   D3DDEB_CAPS             = $00000002;     (* caps valid *)
  7886.   D3DDEB_LPDATA           = $00000004;     (* lpData valid *)
  7887.  
  7888. (* D3DEXECUTEBUFFER dwCaps *)
  7889.  
  7890.   D3DDEBCAPS_SYSTEMMEMORY = $00000001;     (* buffer in system memory *)
  7891.   D3DDEBCAPS_VIDEOMEMORY  = $00000002;     (* buffer in device memory *)
  7892.   D3DDEBCAPS_MEM          = (D3DDEBCAPS_SYSTEMMEMORY or D3DDEBCAPS_VIDEOMEMORY);
  7893.  
  7894. type
  7895.   PD3DDevInfo_TextureManager = ^TD3DDevInfo_TextureManager;
  7896.   TD3DDevInfo_TextureManager = packed record
  7897.     bThrashing:              BOOL;       (* indicates if thrashing *)
  7898.     dwApproxBytesDownloaded: DWORD;      (* Approximate number of bytes downloaded by texture manager *)
  7899.     dwNumEvicts:             DWORD;      (* number of textures evicted *)
  7900.     dwNumVidCreates:         DWORD;      (* number of textures created in video memory *)
  7901.     dwNumTexturesUsed:       DWORD;      (* number of textures used *)
  7902.     dwNumUsedTexInVid:       DWORD;      (* number of used textures present in video memory *)
  7903.     dwWorkingSet:            DWORD;      (* number of textures in video memory *)
  7904.     dwWorkingSetBytes:       DWORD;      (* number of bytes in video memory *)
  7905.     dwTotalManaged:          DWORD;      (* total number of managed textures *)
  7906.     dwTotalBytes:            DWORD;      (* total number of bytes of managed textures *)
  7907.     dwLastPri:               DWORD;      (* priority of last texture evicted *)
  7908.   end;
  7909.  
  7910.   PD3DDevInfo_Texturing = ^TD3DDevInfo_Texturing;
  7911.   TD3DDevInfo_Texturing = packed record
  7912.     dwNumLoads:          DWORD;          (* counts Load() API calls *)
  7913.     dwApproxBytesLoaded: DWORD;          (* Approximate number bytes loaded via Load() *)
  7914.     dwNumPreLoads:       DWORD;          (* counts PreLoad() API calls *)
  7915.     dwNumSet:            DWORD;          (* counts SetTexture() API calls *)
  7916.     dwNumCreates:        DWORD;          (* counts texture creates *)
  7917.     dwNumDestroys:       DWORD;          (* counts texture destroys *)
  7918.     dwNumSetPriorities:  DWORD;          (* counts SetPriority() API calls *)
  7919.     dwNumSetLODs:        DWORD;          (* counts SetLOD() API calls *)
  7920.     dwNumLocks:          DWORD;          (* counts number of texture locks *)
  7921.     dwNumGetDCs:         DWORD;          (* counts number of GetDCs to textures *)
  7922.   end;
  7923.  
  7924. (*==========================================================================;
  7925.  *
  7926.  *
  7927.  *  File:   d3d.h
  7928.  *  Content:    Direct3D include file
  7929.  *
  7930.  ****************************************************************************)
  7931.  
  7932. function D3DErrorString(Value: HResult) : string;
  7933.  
  7934. (*
  7935.  * Interface IID's
  7936.  *)
  7937.  
  7938. const
  7939. (*
  7940.  * Internal Guid to distinguish requested MMX from MMX being used as an RGB rasterizer
  7941.  *)
  7942.   IID_IDirect3DRampDevice: TGUID =
  7943.       (D1:$F2086B20;D2:$259F;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
  7944.   IID_IDirect3DRGBDevice: TGUID =
  7945.       (D1:$A4665C60;D2:$2673;D3:$11CF;D4:($A3,$1A,$00,$AA,$00,$B9,$33,$56));
  7946.   IID_IDirect3DHALDevice: TGUID =
  7947.       (D1:$84E63dE0;D2:$46AA;D3:$11CF;D4:($81,$6F,$00,$00,$C0,$20,$15,$6E));
  7948.   IID_IDirect3DMMXDevice: TGUID =
  7949.       (D1:$881949a1;D2:$d6f3;D3:$11d0;D4:($89,$ab,$00,$a0,$c9,$05,$41,$29));
  7950.  
  7951.   IID_IDirect3DRefDevice: TGUID =
  7952.       (D1:$50936643;D2:$13e9;D3:$11d1;D4:($89,$aa,$00,$a0,$c9,$05,$41,$29));
  7953.   IID_IDirect3DNullDevice: TGUID =
  7954.       (D1:$8767df22;D2:$bacc;D3:$11d1;D4:($89,$69,$00,$a0,$c9,$06,$29,$a8));
  7955.  
  7956.   IID_IDirect3DTnLHalDevice: TGUID = '{f5049e78-4861-11d2-a407-00a0c90629a8}';
  7957.  
  7958. type
  7959.   IDirect3D = interface;
  7960.   IDirect3D2 = interface;
  7961.   IDirect3D3 = interface;
  7962.   IDirect3D7 = interface;
  7963.   IDirect3DDevice = interface;
  7964.   IDirect3DDevice2 = interface;
  7965.   IDirect3DDevice3 = interface;
  7966.   IDirect3DDevice7 = interface;
  7967.   IDirect3DExecuteBuffer = interface;
  7968.   IDirect3DLight = interface;
  7969.   IDirect3DMaterial = interface;
  7970.   IDirect3DMaterial2 = interface;
  7971.   IDirect3DMaterial3 = interface;
  7972.   IDirect3DTexture = interface;
  7973.   IDirect3DTexture2 = interface;
  7974.   IDirect3DViewport = interface;
  7975.   IDirect3DViewport2 = interface;
  7976.   IDirect3DViewport3 = interface;
  7977.   IDirect3DVertexBuffer = interface;
  7978.   IDirect3DVertexBuffer7 = interface;
  7979.  
  7980. (*
  7981.  * Direct3D interfaces
  7982.  *)
  7983.  
  7984.   IDirect3D = interface (IUnknown)
  7985.     ['{3BBA0080-2421-11CF-A31A-00AA00B93356}']
  7986.     (*** IDirect3D methods ***)
  7987.     function Initialize (lpREFIID: {REFIID} PGUID) : HResult; stdcall;
  7988.     function EnumDevices (lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  7989.         lpUserArg: Pointer) : HResult; stdcall;
  7990.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  7991.         pUnkOuter: IUnknown) : HResult; stdcall;
  7992.     function CreateMaterial (var lplpDirect3DMaterial: IDirect3DMaterial;
  7993.         pUnkOuter: IUnknown) : HResult; stdcall;
  7994.     function CreateViewport (var lplpD3DViewport: IDirect3DViewport;
  7995.         pUnkOuter: IUnknown) : HResult; stdcall;
  7996.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  7997.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  7998.   end;
  7999.  
  8000.   IDirect3D2 = interface (IUnknown)
  8001.     ['{6aae1ec1-662a-11d0-889d-00aa00bbb76a}']
  8002.     (*** IDirect3D2 methods ***)
  8003.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  8004.         lpUserArg: pointer) : HResult; stdcall;
  8005.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  8006.         pUnkOuter: IUnknown) : HResult; stdcall;
  8007.     function CreateMaterial (var lplpDirect3DMaterial2: IDirect3DMaterial2;
  8008.         pUnkOuter: IUnknown) : HResult; stdcall;
  8009.     function CreateViewport (var lplpD3DViewport2: IDirect3DViewport2;
  8010.         pUnkOuter: IUnknown) : HResult; stdcall;
  8011.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  8012.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  8013.     function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface;
  8014.         out lplpD3DDevice2: IDirect3DDevice2) : HResult; stdcall;
  8015.   end;
  8016.  
  8017.   IDirect3D3 = interface (IUnknown)
  8018.     ['{bb223240-e72b-11d0-a9b4-00aa00c0993e}']
  8019.     (*** IDirect3D3 methods ***)
  8020.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback;
  8021.         lpUserArg: pointer) : HResult; stdcall;
  8022.     function CreateLight (var lplpDirect3Dlight: IDirect3DLight;
  8023.         pUnkOuter: IUnknown) : HResult; stdcall;
  8024.     function CreateMaterial (var lplpDirect3DMaterial3: IDirect3DMaterial3;
  8025.         pUnkOuter: IUnknown) : HResult; stdcall;
  8026.     function CreateViewport (var lplpD3DViewport3: IDirect3DViewport3;
  8027.         pUnkOuter: IUnknown) : HResult; stdcall;
  8028.     function FindDevice (var lpD3DFDS: TD3DFindDeviceSearch;
  8029.         var lpD3DFDR: TD3DFindDeviceResult) : HResult; stdcall;
  8030.     function CreateDevice (const rclsid: TRefClsID; lpDDS: IDirectDrawSurface4;
  8031.         out lplpD3DDevice: IDirect3DDevice3; pUnkOuter: IUnknown) : HResult; stdcall;
  8032.     function CreateVertexBuffer (var lpVBDesc: TD3DVertexBufferDesc;
  8033.         var lpD3DVertexBuffer: IDirect3DVertexBuffer;
  8034.         dwFlags: DWORD; pUnkOuter: IUnknown) : HResult; stdcall;
  8035.     function EnumZBufferFormats (const riidDevice: TRefClsID; lpEnumCallback:
  8036.         TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
  8037.     function EvictManagedTextures : HResult; stdcall;
  8038.   end;
  8039.  
  8040.   IDirect3D7 = interface (IUnknown)
  8041.     ['{f5049e77-4861-11d2-a407-00a0c90629a8}']
  8042.     (*** IDirect3D7 methods ***)
  8043.     function EnumDevices(lpEnumDevicesCallback: TD3DEnumDevicesCallback7;
  8044.         lpUserArg: pointer) : HResult; stdcall;
  8045.     function CreateDevice (const rclsid: TGUID; lpDDS: IDirectDrawSurface7;
  8046.         out lplpD3DDevice: IDirect3DDevice7) : HResult; stdcall;
  8047.     function CreateVertexBuffer (const lpVBDesc: TD3DVertexBufferDesc;
  8048.         out lplpD3DVertexBuffer: IDirect3DVertexBuffer7;
  8049.         dwFlags: DWORD) : HResult; stdcall;
  8050.     function EnumZBufferFormats (const riidDevice: TGUID; lpEnumCallback:
  8051.         TD3DEnumPixelFormatsCallback; lpContext: pointer) : HResult; stdcall;
  8052.     function EvictManagedTextures : HResult; stdcall;
  8053.   end;
  8054.  
  8055. (*
  8056.  * Direct3D Device interfaces
  8057.  *)
  8058.  
  8059.   IDirect3DDevice = interface (IUnknown)
  8060.     ['{64108800-957d-11d0-89ab-00a0c9054129}']
  8061.     (*** IDirect3DDevice methods ***)
  8062.     function Initialize (lpd3d: IDirect3D; lpGUID: PGUID;
  8063.         var lpd3ddvdesc: TD3DDeviceDesc) : HResult; stdcall;
  8064.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8065.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8066.     function SwapTextureHandles (lpD3DTex1: IDirect3DTexture;
  8067.         lpD3DTex2: IDirect3DTexture) : HResult; stdcall;
  8068.     function CreateExecuteBuffer (var lpDesc: TD3DExecuteBufferDesc ;
  8069.         var lplpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8070.         pUnkOuter: IUnknown) : HResult; stdcall;
  8071.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8072.     function Execute (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8073.         lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
  8074.     function AddViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
  8075.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport) : HResult; stdcall;
  8076.     function NextViewport (lpDirect3DViewport: IDirect3DViewport;
  8077.         var lplpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD) : HResult; stdcall;
  8078.     function Pick (lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  8079.         lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD;
  8080.         var lpRect: TD3DRect) : HResult; stdcall;
  8081.     function GetPickRecords (var lpCount: DWORD;
  8082.         var lpD3DPickRec: TD3DPickRecord) : HResult; stdcall;
  8083.     function EnumTextureFormats (lpd3dEnumTextureProc:
  8084.         TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
  8085.         HResult; stdcall;
  8086.     function CreateMatrix (var lpD3DMatHandle: TD3DMatrixHandle) : HResult; stdcall;
  8087.     function SetMatrix (d3dMatHandle: TD3DMatrixHandle;
  8088.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8089.     function GetMatrix (var lpD3DMatHandle: TD3DMatrixHandle;
  8090.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8091.     function DeleteMatrix (d3dMatHandle: TD3DMatrixHandle) : HResult; stdcall;
  8092.     function BeginScene: HResult; stdcall;
  8093.     function EndScene: HResult; stdcall;
  8094.     function GetDirect3D (var lpD3D: IDirect3D) : HResult; stdcall;
  8095.   end;
  8096.  
  8097.   IDirect3DDevice2 = interface (IUnknown)
  8098.     ['{93281501-8cf8-11d0-89ab-00a0c9054129}']
  8099.     (*** IDirect3DDevice2 methods ***)
  8100.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8101.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8102.     function SwapTextureHandles (lpD3DTex1: IDirect3DTexture2;
  8103.         lpD3DTex2: IDirect3DTexture2) : HResult; stdcall;
  8104.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8105.     function AddViewport (lpDirect3DViewport2: IDirect3DViewport2) : HResult; stdcall;
  8106.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport2) : HResult; stdcall;
  8107.     function NextViewport (lpDirect3DViewport: IDirect3DViewport2;
  8108.         var lplpDirect3DViewport: IDirect3DViewport2; dwFlags: DWORD) :
  8109.         HResult; stdcall;
  8110.     function EnumTextureFormats (
  8111.         lpd3dEnumTextureProc: TD3DEnumTextureFormatsCallback; lpArg: Pointer) :
  8112.         HResult; stdcall;
  8113.     function BeginScene: HResult; stdcall;
  8114.     function EndScene: HResult; stdcall;
  8115.     function GetDirect3D (var lpD3D: IDirect3D2) : HResult; stdcall;
  8116.  
  8117.     (*** DrawPrimitive API ***)
  8118.     function SetCurrentViewport (lpd3dViewport2: IDirect3DViewport2)
  8119.         : HResult; stdcall;
  8120.     function GetCurrentViewport (var lplpd3dViewport2: IDirect3DViewport2)
  8121.         : HResult; stdcall;
  8122.  
  8123.     function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface)
  8124.         : HResult; stdcall;
  8125.     function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface)
  8126.         : HResult; stdcall;
  8127.  
  8128.     function Begin_ (d3dpt: TD3DPrimitiveType; d3dvt: TD3DVertexType;
  8129.         dwFlags: DWORD) : HResult; stdcall;
  8130.     function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType; dvtVertexType:
  8131.         TD3DVertexType; lpvVertices: pointer; dwNumVertices: DWORD;
  8132.         dwFlags: DWORD) : HResult; stdcall;
  8133.     function Vertex (lpVertexType: pointer) : HResult;  stdcall;
  8134.     function Index (wVertexIndex: WORD) : HResult;  stdcall;
  8135.     function End_ (dwFlags: DWORD) : HResult; stdcall;
  8136.  
  8137.     function GetRenderState (dwRenderStateType: TD3DRenderStateType;
  8138.         var lpdwRenderState) : HResult; stdcall;
  8139.     function SetRenderState (dwRenderStateType: TD3DRenderStateType;
  8140.         dwRenderState: DWORD) : HResult; stdcall;
  8141.     function GetLightState (dwLightStateType: TD3DLightStateType;
  8142.         var lpdwLightState) : HResult; stdcall;
  8143.     function SetLightState (dwLightStateType: TD3DLightStateType;
  8144.         dwLightState: DWORD) : HResult; stdcall;
  8145.     function SetTransform (dtstTransformStateType: TD3DTransformStateType;
  8146.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8147.     function GetTransform (dtstTransformStateType: TD3DTransformStateType;
  8148.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8149.     function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
  8150.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8151.  
  8152.     function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8153.         dvtVertexType: TD3DVertexType; var lpvVertices; dwVertexCount,
  8154.         dwFlags: DWORD) : HResult; stdcall;
  8155.     function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8156.         dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwVertexCount: DWORD;
  8157.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8158.     function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8159.     function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8160.   end;
  8161.  
  8162.   IDirect3DDevice3 = interface (IUnknown)
  8163.     ['{b0ab3b60-33d7-11d1-a981-00c04fd7b174}']
  8164.     (*** IDirect3DDevice2 methods ***)
  8165.     function GetCaps (var lpD3DHWDevDesc: TD3DDeviceDesc;
  8166.         var lpD3DHELDevDesc: TD3DDeviceDesc) : HResult; stdcall;
  8167.     function GetStats (var lpD3DStats: TD3DStats) : HResult; stdcall;
  8168.     function AddViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
  8169.     function DeleteViewport (lpDirect3DViewport: IDirect3DViewport3) : HResult; stdcall;
  8170.     function NextViewport (lpDirect3DViewport: IDirect3DViewport3;
  8171.         var lplpAnotherViewport: IDirect3DViewport3; dwFlags: DWORD) : HResult; stdcall;
  8172.     function EnumTextureFormats (
  8173.         lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) :
  8174.         HResult; stdcall;
  8175.     function BeginScene: HResult; stdcall;
  8176.     function EndScene: HResult; stdcall;
  8177.     function GetDirect3D (var lpD3D: IDirect3D3) : HResult; stdcall;
  8178.     function SetCurrentViewport (lpd3dViewport: IDirect3DViewport3)
  8179.         : HResult; stdcall;
  8180.     function GetCurrentViewport (var lplpd3dViewport: IDirect3DViewport3)
  8181.         : HResult; stdcall;
  8182.     function SetRenderTarget (lpNewRenderTarget: IDirectDrawSurface4)
  8183.         : HResult; stdcall;
  8184.     function GetRenderTarget (var lplpNewRenderTarget: IDirectDrawSurface4)
  8185.         : HResult; stdcall;
  8186.     function Begin_ (d3dpt: TD3DPrimitiveType; dwVertexTypeDesc: DWORD;
  8187.         dwFlags: DWORD) : HResult; stdcall;
  8188.     function BeginIndexed (dptPrimitiveType: TD3DPrimitiveType;
  8189.         dwVertexTypeDesc: DWORD; lpvVertices: pointer; dwNumVertices: DWORD;
  8190.         dwFlags: DWORD) : HResult; stdcall;
  8191.     function Vertex (lpVertex: pointer) : HResult;  stdcall;
  8192.     function Index (wVertexIndex: WORD) : HResult;  stdcall;
  8193.     function End_ (dwFlags: DWORD) : HResult; stdcall;
  8194.     function GetRenderState (dwRenderStateType: TD3DRenderStateType;
  8195.         var lpdwRenderState) : HResult; stdcall;
  8196.     function SetRenderState (dwRenderStateType: TD3DRenderStateType;
  8197.         dwRenderState: DWORD) : HResult; stdcall;
  8198.     function GetLightState (dwLightStateType: TD3DLightStateType;
  8199.         var lpdwLightState) : HResult; stdcall;
  8200.     function SetLightState (dwLightStateType: TD3DLightStateType;
  8201.         dwLightState: DWORD) : HResult; stdcall;
  8202.     function SetTransform (dtstTransformStateType: TD3DTransformStateType;
  8203.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8204.     function GetTransform (dtstTransformStateType: TD3DTransformStateType;
  8205.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8206.     function MultiplyTransform (dtstTransformStateType: TD3DTransformStateType;
  8207.         var lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8208.     function DrawPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8209.         dwVertexTypeDesc: DWORD; const lpvVertices;
  8210.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8211.     function DrawIndexedPrimitive (dptPrimitiveType: TD3DPrimitiveType;
  8212.         dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
  8213.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8214.     function SetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8215.     function GetClipStatus (var lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8216.     function DrawPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
  8217.         dwVertexTypeDesc : DWORD;
  8218.         var lpVertexArray: TD3DDrawPrimitiveStridedData;
  8219.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8220.     function DrawIndexedPrimitiveStrided (dptPrimitiveType: TD3DPrimitiveType;
  8221.         dwVertexTypeDesc : DWORD;
  8222.         var lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
  8223.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8224.     function DrawPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
  8225.         lpd3dVertexBuffer: IDirect3DVertexBuffer;
  8226.         dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
  8227.     function DrawIndexedPrimitiveVB (dptPrimitiveType: TD3DPrimitiveType;
  8228.         lpd3dVertexBuffer: IDirect3DVertexBuffer; var lpwIndices: WORD;
  8229.         dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8230.     function ComputeSphereVisibility (var lpCenters: TD3DVector;
  8231.         var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
  8232.         var lpdwReturnValues: DWORD) : HResult; stdcall;
  8233.     function GetTexture (dwStage: DWORD; var lplpTexture: IDirect3DTexture2)
  8234.         : HResult; stdcall;
  8235.     function SetTexture (dwStage: DWORD; lplpTexture: IDirect3DTexture2)
  8236.         : HResult; stdcall;
  8237.     function GetTextureStageState (dwStage: DWORD;
  8238.         dwState: TD3DTextureStageStateType; var lpdwValue: DWORD) : HResult; stdcall;
  8239.     function SetTextureStageState (dwStage: DWORD;
  8240.         dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
  8241.     function ValidateDevice (var lpdwExtraPasses: DWORD) : HResult; stdcall;
  8242.   end;
  8243.  
  8244.   IDirect3DDevice7 = interface (IUnknown)
  8245.     ['{f5049e79-4861-11d2-a407-00a0c90629a8}']
  8246.     (*** IDirect3DDevice7 methods ***)
  8247.     function GetCaps(out lpD3DDevDesc: TD3DDeviceDesc7) : HResult; stdcall;
  8248.     function EnumTextureFormats(lpd3dEnumPixelProc: TD3DEnumPixelFormatsCallback; lpArg: Pointer) : HResult; stdcall;
  8249.     function BeginScene: HResult; stdcall;
  8250.     function EndScene: HResult; stdcall;
  8251.     function GetDirect3D(out lpD3D: IDirect3D7) : HResult; stdcall;
  8252.     function SetRenderTarget(lpNewRenderTarget: IDirectDrawSurface7; dwFlags: DWORD) : HResult; stdcall;
  8253.     function GetRenderTarget(out lplpRenderTarget: IDirectDrawSurface7) : HResult; stdcall;
  8254.     function Clear(dwCount: DWORD; lpRects: PD3DRect; dwFlags, dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
  8255.     function SetTransform(dtstTransformStateType: TD3DTransformStateType;
  8256.         const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8257.     function GetTransform(dtstTransformStateType: TD3DTransformStateType;
  8258.         out lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8259.     function SetViewport(const lpViewport: TD3DViewport7) : HResult; stdcall;
  8260.     function MultiplyTransform(dtstTransformStateType: TD3DTransformStateType;
  8261.         const lpD3DMatrix: TD3DMatrix) : HResult; stdcall;
  8262.     function GetViewport(out lpViewport: TD3DViewport7) : HResult; stdcall;
  8263.     function SetMaterial(const lpMaterial: TD3DMaterial7) : HResult; stdcall;
  8264.     function GetMaterial(out lpMaterial: TD3DMaterial7) : HResult; stdcall;
  8265.     function SetLight(dwLightIndex: DWORD; const lpLight: TD3DLight7) : HResult; stdcall;
  8266.     function GetLight(dwLightIndex: DWORD; out lpLight: TD3DLight7) : HResult; stdcall;
  8267.     function SetRenderState(dwRenderStateType: TD3DRenderStateType; dwRenderState: DWORD) : HResult; stdcall;
  8268.     function GetRenderState(dwRenderStateType: TD3DRenderStateType; out dwRenderState: DWORD) : HResult; stdcall;
  8269.     function BeginStateBlock : HResult; stdcall;
  8270.     function EndStateBlock(out lpdwBlockHandle: DWORD) : HResult; stdcall;
  8271.     function PreLoad(lpddsTexture: IDirectDrawSurface7) : HResult; stdcall;
  8272.     function DrawPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  8273.         dwVertexTypeDesc: DWORD; const lpvVertices;
  8274.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8275.     function DrawIndexedPrimitive(dptPrimitiveType: TD3DPrimitiveType;
  8276.         dwVertexTypeDesc: DWORD; const lpvVertices; dwVertexCount: DWORD;
  8277.         const lpwIndices; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8278.     function SetClipStatus(const lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8279.     function GetClipStatus(out lpD3DClipStatus: TD3DClipStatus) : HResult; stdcall;
  8280.     function DrawPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
  8281.         dwVertexTypeDesc : DWORD;
  8282.         const lpVertexArray: TD3DDrawPrimitiveStridedData;
  8283.         dwVertexCount, dwFlags: DWORD) : HResult; stdcall;
  8284.     function DrawIndexedPrimitiveStrided(dptPrimitiveType: TD3DPrimitiveType;
  8285.         dwVertexTypeDesc : DWORD;
  8286.         const lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexCount: DWORD;
  8287.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8288.     function DrawPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
  8289.         lpd3dVertexBuffer: IDirect3DVertexBuffer7;
  8290.         dwStartVertex, dwNumVertices, dwFlags: DWORD) : HResult; stdcall;
  8291.     function DrawIndexedPrimitiveVB(dptPrimitiveType: TD3DPrimitiveType;
  8292.         lpd3dVertexBuffer: IDirect3DVertexBuffer7; dwStartVertex, dwNumVertices: DWORD;
  8293.         var lpwIndices: WORD; dwIndexCount, dwFlags: DWORD) : HResult; stdcall;
  8294.     function ComputeSphereVisibility(const lpCenters: TD3DVector;
  8295.         var lpRadii: TD3DValue; dwNumSpheres, dwFlags: DWORD;
  8296.         var lpdwReturnValues: DWORD) : HResult; stdcall;
  8297.     function GetTexture(dwStage: DWORD; out lplpTexture: IDirectDrawSurface7) : HResult; stdcall;
  8298.     function SetTexture(dwStage: DWORD; lpTexture: IDirectDrawSurface7) : HResult; stdcall;
  8299.     function GetTextureStageState(dwStage: DWORD;
  8300.         dwState: TD3DTextureStageStateType; out lpdwValue: DWORD) : HResult; stdcall;
  8301.     function SetTextureStageState(dwStage: DWORD;
  8302.         dwState: TD3DTextureStageStateType; lpdwValue: DWORD) : HResult; stdcall;
  8303.     function ValidateDevice(out lpdwExtraPasses: DWORD) : HResult; stdcall;
  8304.     function ApplyStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8305.     function CaptureStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8306.     function DeleteStateBlock(dwBlockHandle: DWORD) : HResult; stdcall;
  8307.     function CreateStateBlock(d3dsbType: TD3DStateBlockType; out lpdwBlockHandle: DWORD) : HResult; stdcall;
  8308.     function Load(lpDestTex: IDirectDrawSurface7; lpDestPoint: PPoint;
  8309.         lpSrcTex: IDirectDrawSurface7; lprcSrcRect: PRect; dwFlags: DWORD) : HResult; stdcall;
  8310.     function LightEnable(dwLightIndex: DWORD; bEnable: BOOL) : HResult; stdcall;
  8311.     function GetLightEnable(dwLightIndex: DWORD; out bEnable: BOOL) : HResult; stdcall;
  8312.     function SetClipPlane(dwIndex: DWORD; var pPlaneEquation: TD3DValue) : HResult; stdcall;
  8313.     function GetClipPlane(dwIndex: DWORD; out pPlaneEquation: TD3DValue) : HResult; stdcall;
  8314.     function GetInfo(dwDevInfoID: DWORD; pDevInfoStruct: Pointer; dwSize: DWORD) : HResult; stdcall;
  8315.   end;
  8316.  
  8317. (*
  8318.  * Execute Buffer interface
  8319.  *)
  8320.  
  8321.   IDirect3DExecuteBuffer = interface (IUnknown)
  8322.     ['{4417C145-33AD-11CF-816F-0000C020156E}']
  8323.     (*** IDirect3DExecuteBuffer methods ***)
  8324.     function Initialize (lpDirect3DDevice: IDirect3DDevice;
  8325.         var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
  8326.     function Lock (var lpDesc: TD3DExecuteBufferDesc) : HResult; stdcall;
  8327.     function Unlock: HResult; stdcall;
  8328.     function SetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
  8329.     function GetExecuteData (var lpData: TD3DExecuteData) : HResult; stdcall;
  8330.     function Validate (var lpdwOffset: DWORD; lpFunc: TD3DValidateCallback;
  8331.         lpUserArg: Pointer; dwReserved: DWORD) : HResult; stdcall;
  8332.     (*** Warning!  Optimize is defined differently in the header files
  8333.          and the online documentation ***)
  8334.     function Optimize (dwFlags: DWORD) : HResult; stdcall;
  8335.   end;
  8336.  
  8337. (*
  8338.  * Light interfaces
  8339.  *)
  8340.  
  8341.   IDirect3DLight = interface (IUnknown)
  8342.     ['{4417C142-33AD-11CF-816F-0000C020156E}']
  8343.     (*** IDirect3DLight methods ***)
  8344.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8345.     function SetLight (var lpLight: TD3DLight2) : HResult; stdcall;
  8346.     function GetLight (var lpLight: TD3DLight2) : HResult; stdcall;
  8347.   end;
  8348.  
  8349. (*
  8350.  * Material interfaces
  8351.  *)
  8352.  
  8353.   IDirect3DMaterial = interface (IUnknown)
  8354.     ['{4417C144-33AD-11CF-816F-0000C020156E}']
  8355.     (*** IDirect3DMaterial methods ***)
  8356.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8357.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8358.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8359.     function GetHandle (lpDirect3DDevice: IDirect3DDevice;
  8360.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8361.     function Reserve: HResult; stdcall;
  8362.     function Unreserve: HResult; stdcall;
  8363.   end;
  8364.  
  8365.   IDirect3DMaterial2 = interface (IUnknown)
  8366.     ['{93281503-8cf8-11d0-89ab-00a0c9054129}']
  8367.     (*** IDirect3DMaterial2 methods ***)
  8368.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8369.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8370.     function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
  8371.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8372.   end;
  8373.  
  8374.   IDirect3DMaterial3 = interface (IUnknown)
  8375.     ['{ca9c46f4-d3c5-11d1-b75a-00600852b312}']
  8376.     (*** IDirect3DMaterial2 methods ***)
  8377.     function SetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8378.     function GetMaterial (var lpMat: TD3DMaterial) : HResult; stdcall;
  8379.     function GetHandle (lpDirect3DDevice: IDirect3DDevice3;
  8380.         var lpHandle: TD3DMaterialHandle) : HResult; stdcall;
  8381.   end;
  8382.  
  8383. (*
  8384.  * Texture interfaces
  8385.  *)
  8386.  
  8387.   IDirect3DTexture = interface (IUnknown)
  8388.     ['{2CDCD9E0-25A0-11CF-A31A-00AA00B93356}']
  8389.     (*** IDirect3DTexture methods ***)
  8390.     function Initialize (lpD3DDevice: IDirect3DDevice;
  8391.         lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  8392.     function GetHandle (lpDirect3DDevice: IDirect3DDevice;
  8393.         var lpHandle: TD3DTextureHandle) : HResult; stdcall;
  8394.     function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
  8395.     function Load (lpD3DTexture: IDirect3DTexture) : HResult; stdcall;
  8396.     function Unload: HResult; stdcall;
  8397.   end;
  8398.  
  8399.   IDirect3DTexture2 = interface (IUnknown)
  8400.     ['{93281502-8cf8-11d0-89ab-00a0c9054129}']
  8401.     (*** IDirect3DTexture2 methods ***)
  8402.     function GetHandle (lpDirect3DDevice: IDirect3DDevice2;
  8403.         var lpHandle: TD3DTextureHandle) : HResult; stdcall;
  8404.     function PaletteChanged (dwStart: DWORD; dwCount: DWORD) : HResult; stdcall;
  8405.     function Load (lpD3DTexture: IDirect3DTexture2) : HResult; stdcall;
  8406.   end;
  8407.  
  8408. (*
  8409.  * Viewport interfaces
  8410.  *)
  8411.  
  8412.   IDirect3DViewport = interface (IUnknown)
  8413.     ['{4417C146-33AD-11CF-816F-0000C020156E}']
  8414.     (*** IDirect3DViewport methods ***)
  8415.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8416.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8417.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8418.     function TransformVertices (dwVertexCount: DWORD;
  8419.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8420.         out lpOffscreen: DWORD) : HResult; stdcall;
  8421.     function LightElements (dwElementCount: DWORD;
  8422.         var lpData: TD3DLightData) : HResult; stdcall;
  8423.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8424.     function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
  8425.     function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
  8426.         HResult; stdcall;
  8427.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8428.         out lpValid: BOOL) : HResult; stdcall;
  8429.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8430.         HResult; stdcall;
  8431.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8432.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8433.      function NextLight (lpDirect3DLight: IDirect3DLight;
  8434.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8435.   end;
  8436.  
  8437.   IDirect3DViewport2 = interface (IUnknown)
  8438.     ['{93281500-8cf8-11d0-89ab-00a0c9054129}']
  8439.     (*** IDirect3DViewport2 methods ***)
  8440.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8441.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8442.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8443.     function TransformVertices (dwVertexCount: DWORD;
  8444.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8445.         out lpOffscreen: DWORD) : HResult; stdcall;
  8446.     function LightElements (dwElementCount: DWORD;
  8447.         var lpData: TD3DLightData) : HResult; stdcall;
  8448.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8449.     function GetBackground (out hMat: TD3DMaterialHandle) : HResult; stdcall;
  8450.     function SetBackgroundDepth (lpDDSurface: IDirectDrawSurface) :
  8451.         HResult; stdcall;
  8452.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8453.         out lpValid: BOOL) : HResult; stdcall;
  8454.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8455.         HResult; stdcall;
  8456.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8457.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8458.     function NextLight (lpDirect3DLight: IDirect3DLight;
  8459.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8460.     (*** IDirect3DViewport2 methods ***)
  8461.     function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
  8462.     function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
  8463.   end;
  8464.  
  8465.   IDirect3DViewport3 = interface (IUnknown)
  8466.     ['{b0ab3b61-33d7-11d1-a981-00c04fd7b174}']
  8467.     (*** IDirect3DViewport3 methods ***)
  8468.     function Initialize (lpDirect3D: IDirect3D) : HResult; stdcall;
  8469.     function GetViewport (out lpData: TD3DViewport) : HResult; stdcall;
  8470.     function SetViewport (const lpData: TD3DViewport) : HResult; stdcall;
  8471.     function TransformVertices (dwVertexCount: DWORD;
  8472.         const lpData: TD3DTransformData; dwFlags: DWORD;
  8473.         out lpOffscreen: DWORD) : HResult; stdcall;
  8474.     function LightElements (dwElementCount: DWORD;
  8475.         var lpData: TD3DLightData) : HResult; stdcall;
  8476.     function SetBackground (hMat: TD3DMaterialHandle) : HResult; stdcall;
  8477.     function GetBackground (var hMat: TD3DMaterialHandle) : HResult; stdcall;
  8478.     function SetBackgroundDepth (
  8479.         lpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  8480.     function GetBackgroundDepth (out lplpDDSurface: IDirectDrawSurface;
  8481.         out lpValid: BOOL) : HResult; stdcall;
  8482.     function Clear (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD) :
  8483.         HResult; stdcall;
  8484.     function AddLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8485.     function DeleteLight (lpDirect3DLight: IDirect3DLight) : HResult; stdcall;
  8486.     function NextLight (lpDirect3DLight: IDirect3DLight;
  8487.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD) : HResult; stdcall;
  8488.     function GetViewport2 (out lpData: TD3DViewport2) : HResult; stdcall;
  8489.     function SetViewport2 (const lpData: TD3DViewport2) : HResult; stdcall;
  8490.     function SetBackgroundDepth2 (
  8491.         lpDDSurface: IDirectDrawSurface4) : HResult; stdcall;
  8492.     function GetBackgroundDepth2 (out lplpDDSurface: IDirectDrawSurface4;
  8493.         out lpValid: BOOL) : HResult; stdcall;
  8494.     function Clear2 (dwCount: DWORD; const lpRects: TD3DRect; dwFlags: DWORD;
  8495.         dwColor: DWORD; dvZ: TD3DValue; dwStencil: DWORD) : HResult; stdcall;
  8496.   end;
  8497.  
  8498.   IDirect3DVertexBuffer = interface (IUnknown)
  8499.     ['{7a503555-4a83-11d1-a5db-00a0c90367f8}']
  8500.     (*** IDirect3DVertexBuffer methods ***)
  8501.     function Lock (dwFlags: DWORD; var lplpData: pointer; var lpdwSize: DWORD)
  8502.         : HResult; stdcall;
  8503.     function Unlock : HResult; stdcall;
  8504.     function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
  8505.         lpSrcBuffer: IDirect3DVertexBuffer; dwSrcIndex: DWORD;
  8506.         lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
  8507.     function GetVertexBufferDesc (var lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
  8508.     function Optimize(lpD3DDevice: IDirect3DDevice3; dwFlags: DWORD) : HResult; stdcall;
  8509.   end;
  8510.  
  8511.   IDirect3DVertexBuffer7 = interface (IUnknown)
  8512.     ['{f5049e7d-4861-11d2-a407-00a0c90629a8}']
  8513.     (*** IDirect3DVertexBuffer methods ***)
  8514.     function Lock (dwFlags: DWORD; out lplpData: Pointer; out lpdwSize: DWORD) : HResult; stdcall;
  8515.     function Unlock : HResult; stdcall;
  8516.     function ProcessVertices (dwVertexOp, dwDestIndex, dwCount: DWORD;
  8517.         lpSrcBuffer: IDirect3DVertexBuffer7; dwSrcIndex: DWORD;
  8518.         lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8519.     function GetVertexBufferDesc (out lpVBDesc: TD3DVertexBufferDesc) : HResult; stdcall;
  8520.     function Optimize(lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8521.     function ProcessVerticesStrided(dwVertexOp, dwDestIndex, dwCount: DWORD;
  8522.       lpVertexArray: TD3DDrawPrimitiveStridedData; dwVertexTypeDesc: DWORD;
  8523.       lpD3DDevice: IDirect3DDevice7; dwFlags: DWORD) : HResult; stdcall;
  8524.   end;
  8525.  
  8526. type
  8527.   IID_IDirect3D = IDirect3D;
  8528.   IID_IDirect3D2 = IDirect3D2;
  8529.   IID_IDirect3D3 = IDirect3D3;
  8530.   IID_IDirect3D7 = IDirect3D7;
  8531.  
  8532.   IID_IDirect3DDevice = IDirect3DDevice;
  8533.   IID_IDirect3DDevice2 = IDirect3DDevice2;
  8534.   IID_IDirect3DDevice3 = IDirect3DDevice3;
  8535.   IID_IDirect3DDevice7 = IDirect3DDevice7;
  8536.  
  8537.   IID_IDirect3DTexture = IDirect3DTexture;
  8538.   IID_IDirect3DTexture2 = IDirect3DTexture2;
  8539.   IID_IDirect3DLight = IDirect3DLight;
  8540.   IID_IDirect3DMaterial = IDirect3DMaterial;
  8541.   IID_IDirect3DMaterial2 = IDirect3DMaterial2;
  8542.   IID_IDirect3DMaterial3 = IDirect3DMaterial3;
  8543.   IID_IDirect3DExecuteBuffer = IDirect3DExecuteBuffer;
  8544.   IID_IDirect3DViewport = IDirect3DViewport;
  8545.   IID_IDirect3DViewport2 = IDirect3DViewport2;
  8546.   IID_IDirect3DViewport3 = IDirect3DViewport3;
  8547.   IID_IDirect3DVertexBuffer = IDirect3DVertexBuffer;
  8548.   IID_IDirect3DVertexBuffer7 = IDirect3DVertexBuffer7;
  8549.  
  8550.  
  8551. const
  8552. (****************************************************************************
  8553.  *
  8554.  * Flags for IDirect3DDevice::NextViewport
  8555.  *
  8556.  ****************************************************************************)
  8557.  
  8558. (*
  8559.  * Return the next viewport
  8560.  *)
  8561.   D3DNEXT_NEXT =        $00000001;
  8562.  
  8563. (*
  8564.  * Return the first viewport
  8565.  *)
  8566.   D3DNEXT_HEAD =        $00000002;
  8567.  
  8568. (*
  8569.  * Return the last viewport
  8570.  *)
  8571.   D3DNEXT_TAIL =        $00000004;
  8572.  
  8573.  
  8574. (****************************************************************************
  8575.  *
  8576.  * Flags for DrawPrimitive/DrawIndexedPrimitive
  8577.  *   Also valid for Begin/BeginIndexed
  8578.  *   Also valid for VertexBuffer::CreateVertexBuffer
  8579.  ****************************************************************************)
  8580.  
  8581. (*
  8582.  * Wait until the device is ready to draw the primitive
  8583.  * This will cause DP to not return DDERR_WASSTILLDRAWING
  8584.  *)
  8585.   D3DDP_WAIT =                                  $00000001;
  8586.  
  8587. (*
  8588.  * Hint that it is acceptable to render the primitive out of order.
  8589.  *)
  8590.   D3DDP_OUTOFORDER            = $00000002;
  8591.  
  8592. (*
  8593.  * Hint that the primitives have been clipped by the application.
  8594.  *)
  8595.   D3DDP_DONOTCLIP =                             $00000004;
  8596.  
  8597. (*
  8598.  * Hint that the extents need not be updated.
  8599.  *)
  8600.   D3DDP_DONOTUPDATEEXTENTS =    $00000008;
  8601.  
  8602. (*
  8603.  * Hint that the lighting should not be applied on vertices.
  8604.  *)
  8605.  
  8606.   D3DDP_DONOTLIGHT            = $00000010;
  8607.  
  8608.  
  8609. (*
  8610.  * Direct3D Errors
  8611.  * DirectDraw error codes are used when errors not specified here.
  8612.  *)
  8613.  
  8614. const
  8615.   MAKE_D3DHRESULT = HResult($88760000);
  8616.  
  8617.   D3D_OK                          = DD_OK;
  8618.   D3DERR_BADMAJORVERSION          = MAKE_D3DHRESULT + 700;
  8619.   D3DERR_BADMINORVERSION          = MAKE_D3DHRESULT + 701;
  8620.  
  8621. (*
  8622.  * An invalid device was requested by the application.
  8623.  *)
  8624.   D3DERR_INVALID_DEVICE   = MAKE_D3DHRESULT + 705;
  8625.   D3DERR_INITFAILED       = MAKE_D3DHRESULT + 706;
  8626.  
  8627. (*
  8628.  * SetRenderTarget attempted on a device that was
  8629.  * QI'd off the render target.
  8630.  *)
  8631.   D3DERR_DEVICEAGGREGATED = MAKE_D3DHRESULT + 707;
  8632.  
  8633.   D3DERR_EXECUTE_CREATE_FAILED    = MAKE_D3DHRESULT + 710;
  8634.   D3DERR_EXECUTE_DESTROY_FAILED   = MAKE_D3DHRESULT + 711;
  8635.   D3DERR_EXECUTE_LOCK_FAILED      = MAKE_D3DHRESULT + 712;
  8636.   D3DERR_EXECUTE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 713;
  8637.   D3DERR_EXECUTE_LOCKED           = MAKE_D3DHRESULT + 714;
  8638.   D3DERR_EXECUTE_NOT_LOCKED       = MAKE_D3DHRESULT + 715;
  8639.  
  8640.   D3DERR_EXECUTE_FAILED           = MAKE_D3DHRESULT + 716;
  8641.   D3DERR_EXECUTE_CLIPPED_FAILED   = MAKE_D3DHRESULT + 717;
  8642.  
  8643.   D3DERR_TEXTURE_NO_SUPPORT       = MAKE_D3DHRESULT + 720;
  8644.   D3DERR_TEXTURE_CREATE_FAILED    = MAKE_D3DHRESULT + 721;
  8645.   D3DERR_TEXTURE_DESTROY_FAILED   = MAKE_D3DHRESULT + 722;
  8646.   D3DERR_TEXTURE_LOCK_FAILED      = MAKE_D3DHRESULT + 723;
  8647.   D3DERR_TEXTURE_UNLOCK_FAILED    = MAKE_D3DHRESULT + 724;
  8648.   D3DERR_TEXTURE_LOAD_FAILED      = MAKE_D3DHRESULT + 725;
  8649.   D3DERR_TEXTURE_SWAP_FAILED      = MAKE_D3DHRESULT + 726;
  8650.   D3DERR_TEXTURE_LOCKED           = MAKE_D3DHRESULT + 727;
  8651.   D3DERR_TEXTURE_NOT_LOCKED       = MAKE_D3DHRESULT + 728;
  8652.   D3DERR_TEXTURE_GETSURF_FAILED   = MAKE_D3DHRESULT + 729;
  8653.  
  8654.   D3DERR_MATRIX_CREATE_FAILED     = MAKE_D3DHRESULT + 730;
  8655.   D3DERR_MATRIX_DESTROY_FAILED    = MAKE_D3DHRESULT + 731;
  8656.   D3DERR_MATRIX_SETDATA_FAILED    = MAKE_D3DHRESULT + 732;
  8657.   D3DERR_MATRIX_GETDATA_FAILED    = MAKE_D3DHRESULT + 733;
  8658.   D3DERR_SETVIEWPORTDATA_FAILED   = MAKE_D3DHRESULT + 734;
  8659.  
  8660.   D3DERR_INVALIDCURRENTVIEWPORT   = MAKE_D3DHRESULT + 735;
  8661.   D3DERR_INVALIDPRIMITIVETYPE     = MAKE_D3DHRESULT + 736;
  8662.   D3DERR_INVALIDVERTEXTYPE        = MAKE_D3DHRESULT + 737;
  8663.   D3DERR_TEXTURE_BADSIZE          = MAKE_D3DHRESULT + 738;
  8664.   D3DERR_INVALIDRAMPTEXTURE       = MAKE_D3DHRESULT + 739;
  8665.  
  8666.   D3DERR_MATERIAL_CREATE_FAILED   = MAKE_D3DHRESULT + 740;
  8667.   D3DERR_MATERIAL_DESTROY_FAILED  = MAKE_D3DHRESULT + 741;
  8668.   D3DERR_MATERIAL_SETDATA_FAILED  = MAKE_D3DHRESULT + 742;
  8669.   D3DERR_MATERIAL_GETDATA_FAILED  = MAKE_D3DHRESULT + 743;
  8670.  
  8671.   D3DERR_INVALIDPALETTE           = MAKE_D3DHRESULT + 744;
  8672.  
  8673.   D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY = MAKE_D3DHRESULT + 745;
  8674.   D3DERR_ZBUFF_NEEDS_VIDEOMEMORY  = MAKE_D3DHRESULT + 746;
  8675.   D3DERR_SURFACENOTINVIDMEM       = MAKE_D3DHRESULT + 747;
  8676.  
  8677.   D3DERR_LIGHT_SET_FAILED         = MAKE_D3DHRESULT + 750;
  8678.   D3DERR_LIGHTHASVIEWPORT         = MAKE_D3DHRESULT + 751;
  8679.   D3DERR_LIGHTNOTINTHISVIEWPORT   = MAKE_D3DHRESULT + 752;
  8680.  
  8681.   D3DERR_SCENE_IN_SCENE           = MAKE_D3DHRESULT + 760;
  8682.   D3DERR_SCENE_NOT_IN_SCENE       = MAKE_D3DHRESULT + 761;
  8683.   D3DERR_SCENE_BEGIN_FAILED       = MAKE_D3DHRESULT + 762;
  8684.   D3DERR_SCENE_END_FAILED         = MAKE_D3DHRESULT + 763;
  8685.  
  8686.   D3DERR_INBEGIN                  = MAKE_D3DHRESULT + 770;
  8687.   D3DERR_NOTINBEGIN               = MAKE_D3DHRESULT + 771;
  8688.   D3DERR_NOVIEWPORTS              = MAKE_D3DHRESULT + 772;
  8689.   D3DERR_VIEWPORTDATANOTSET       = MAKE_D3DHRESULT + 773;
  8690.   D3DERR_VIEWPORTHASNODEVICE      = MAKE_D3DHRESULT + 774;
  8691.   D3DERR_NOCURRENTVIEWPORT        = MAKE_D3DHRESULT + 775;
  8692.  
  8693.   D3DERR_INVALIDVERTEXFORMAT      = MAKE_D3DHRESULT + 2048;
  8694.  
  8695. (*
  8696.  * Attempted to CreateTexture on a surface that had a color key
  8697.  *)
  8698.   D3DERR_COLORKEYATTACHED                 = MAKE_D3DHRESULT + 2050;
  8699.  
  8700.   D3DERR_VERTEXBUFFEROPTIMIZED            = MAKE_D3DHRESULT + 2060;
  8701.   D3DERR_VBUF_CREATE_FAILED               = MAKE_D3DHRESULT + 2061;
  8702.   D3DERR_VERTEXBUFFERLOCKED               = MAKE_D3DHRESULT + 2062;
  8703.  
  8704.   D3DERR_ZBUFFER_NOTPRESENT               = MAKE_D3DHRESULT + 2070;
  8705.   D3DERR_STENCILBUFFER_NOTPRESENT         = MAKE_D3DHRESULT + 2071;
  8706.  
  8707.   D3DERR_WRONGTEXTUREFORMAT               = MAKE_D3DHRESULT + 2072;
  8708.   D3DERR_UNSUPPORTEDCOLOROPERATION        = MAKE_D3DHRESULT + 2073;
  8709.   D3DERR_UNSUPPORTEDCOLORARG              = MAKE_D3DHRESULT + 2074;
  8710.   D3DERR_UNSUPPORTEDALPHAOPERATION        = MAKE_D3DHRESULT + 2075;
  8711.   D3DERR_UNSUPPORTEDALPHAARG              = MAKE_D3DHRESULT + 2076;
  8712.   D3DERR_TOOMANYOPERATIONS                = MAKE_D3DHRESULT + 2077;
  8713.   D3DERR_CONFLICTINGTEXTUREFILTER         = MAKE_D3DHRESULT + 2078;
  8714.   D3DERR_UNSUPPORTEDFACTORVALUE           = MAKE_D3DHRESULT + 2079;
  8715.   D3DERR_CONFLICTINGRENDERSTATE           = MAKE_D3DHRESULT + 2081;
  8716.   D3DERR_UNSUPPORTEDTEXTUREFILTER         = MAKE_D3DHRESULT + 2082;
  8717.   D3DERR_TOOMANYPRIMITIVES                = MAKE_D3DHRESULT + 2083;
  8718.   D3DERR_INVALIDMATRIX                    = MAKE_D3DHRESULT + 2084;
  8719.   D3DERR_TOOMANYVERTICES                  = MAKE_D3DHRESULT + 2085;
  8720.   D3DERR_CONFLICTINGTEXTUREPALETTE        = MAKE_D3DHRESULT + 2086;
  8721.  
  8722.   D3DERR_INVALIDSTATEBLOCK        = MAKE_D3DHRESULT + 2100;
  8723.   D3DERR_INBEGINSTATEBLOCK        = MAKE_D3DHRESULT + 2101;
  8724.   D3DERR_NOTINBEGINSTATEBLOCK     = MAKE_D3DHRESULT + 2102;
  8725.  
  8726. procedure DisableFPUExceptions;
  8727. procedure EnableFPUExceptions;
  8728.  
  8729. (***************************************************************************
  8730.  *
  8731.  *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
  8732.  *
  8733.  *  File:       dxfile.h
  8734.  *
  8735.  *  Content:    DirectX File public header file
  8736.  *
  8737.  ***************************************************************************)
  8738.  
  8739. var
  8740.   DXFileDLL : HMODULE;
  8741.  
  8742. function DXFileErrorString(Value: HResult) : string;
  8743.  
  8744. type
  8745.   TDXFileFormat = (
  8746.     DXFILEFORMAT_BINARY,
  8747.     DXFILEFORMAT_TEXT,
  8748.     DXFILEFORMAT_COMPRESSED
  8749.   );
  8750.  
  8751.   TDXFileLoadOptions = (
  8752.     DXFILELOAD_FROMFILE,
  8753.     DXFILELOAD_FROMRESOURCE,
  8754.     DXFILELOAD_FROMMEMORY,
  8755.     DXFILELOAD_INVALID_3,
  8756.     DXFILELOAD_FROMSTREAM,
  8757.     DXFILELOAD_INVALID_5,
  8758.     DXFILELOAD_INVALID_6,
  8759.     DXFILELOAD_INVALID_7,
  8760.     DXFILELOAD_FROMURL
  8761.   );
  8762.  
  8763.   PDXFileLoadResource = ^TDXFileLoadResource;
  8764.   TDXFileLoadResource = packed record
  8765.     hModule: HModule;
  8766.     lpName: PAnsiChar;
  8767.     lpType: PAnsiChar;
  8768.   end;
  8769.  
  8770.   PDXFileLoadMemory = ^TDXFileLoadMemory;
  8771.   TDXFileLoadMemory = packed record
  8772.     lpMemory: Pointer;
  8773.     dSize: DWORD;
  8774.   end;
  8775.  
  8776. (*
  8777.  * DirectX File object types.
  8778.  *)
  8779.  
  8780.   IDirectXFile = interface;
  8781.   IDirectXFileEnumObject = interface;
  8782.   IDirectXFileSaveObject = interface;
  8783.   IDirectXFileObject = interface;
  8784.   IDirectXFileData = interface;
  8785.   IDirectXFileDataReference = interface;
  8786.   IDirectXFileBinary = interface;
  8787.  
  8788. (*
  8789.  * DirectX File interfaces.
  8790.  *)
  8791.  
  8792.   IDirectXFile = interface (IUnknown)
  8793.     ['{3d82ab40-62da-11cf-ab39-0020af71e433}']
  8794.     function CreateEnumObject (pvSource: Pointer;
  8795.         dwLoadOptions: TDXFileLoadOptions;
  8796.         var ppEnumObj: IDirectXFileEnumObject) : HResult; stdcall;
  8797.     function CreateSaveObject (szFileName: PChar; dwFileFormat: TDXFileFormat;
  8798.         var ppSaveObj: IDirectXFileSaveObject) : HResult; stdcall;
  8799.     function RegisterTemplates (pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
  8800.   end;
  8801.  
  8802.   IDirectXFileEnumObject = interface (IUnknown)
  8803.     ['{3d82ab41-62da-11cf-ab39-0020af71e433}']
  8804.     function GetNextDataObject (var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8805.     function GetDataObjectById
  8806.         (const rguid: TGUID; var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8807.     function GetDataObjectByName
  8808.         (szName: PChar; var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8809.   end;
  8810.  
  8811.   IDirectXFileSaveObject = interface (IUnknown)
  8812.     ['{3d82ab42-62da-11cf-ab39-0020af71e433}']
  8813.     function SaveTemplates
  8814.         (cTemplates: DWORD; var ppguidTemplates: PGUID) : HResult; stdcall;
  8815.     function CreateDataObject (const rguidTemplate: TGUID; szName: PChar;
  8816.         pguid: PGUID; cbSize: DWORD; pvData: Pointer;
  8817.         var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8818.     function SaveData (pDataObj: IDirectXFileData) : HResult; stdcall;
  8819.   end;
  8820.  
  8821.   IDirectXFileObject = interface (IUnknown)
  8822.     ['{3d82ab43-62da-11cf-ab39-0020af71e433}']
  8823.     function GetName (pstrNameBuf: PChar; var dwBufLen: DWORD) : HResult; stdcall;
  8824.     function GetId (var pGuidBuf: TGUID) : HResult; stdcall;
  8825.   end;
  8826.  
  8827.   IDirectXFileData = interface (IDirectXFileObject)
  8828.     ['{3d82ab44-62da-11cf-ab39-0020af71e433}']
  8829.     function GetData
  8830.         (szMember: PChar; var pcbSize: DWORD; var ppvData: Pointer) : HResult; stdcall;
  8831.     function GetType (var ppguid: PGUID) : HResult; stdcall;
  8832.     function GetNextObject (var ppChildObj: IDirectXFileObject) : HResult; stdcall;
  8833.     function AddDataObject (pDataObj: IDirectXFileData) : HResult; stdcall;
  8834.     function AddDataReference (szRef: PChar; pguidRef: PGUID) : HResult; stdcall;
  8835.     function AddBinaryObject (szName: PChar; pguid: PGUID; szMimeType: PChar;
  8836.         pvData: Pointer; cbSize: DWORD) : HResult; stdcall;
  8837.   end;
  8838.  
  8839.   IDirectXFileDataReference = interface (IDirectXFileObject)
  8840.     ['{3d82ab45-62da-11cf-ab39-0020af71e433}']
  8841.     function Resolve (var ppDataObj: IDirectXFileData) : HResult; stdcall;
  8842.   end;
  8843.  
  8844.   IDirectXFileBinary = interface (IDirectXFileObject)
  8845.     ['{3d82ab46-62da-11cf-ab39-0020af71e433}']
  8846.     function GetSize (var pcbSize: DWORD) : HResult; stdcall;
  8847.     function GetMimeType (var pszMimeType: PChar) : HResult; stdcall;
  8848.     function Read(pvData: Pointer; cbSize: DWORD; pcbRead: PDWORD{?}) : HResult; stdcall;
  8849.   end;
  8850.  
  8851. const
  8852.  
  8853. (*
  8854.  * DirectXFile Object Class Id (for CoCreateInstance())
  8855.  *)
  8856.  
  8857.    CLSID_CDirectXFile: TGUID =
  8858.        (D1:$4516ec43;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  8859.  
  8860. (*
  8861.  * DirectX File Interface GUIDs.
  8862.  *)
  8863.  
  8864. type
  8865.   IID_IDirectXFile = IDirectXFile;
  8866.   IID_IDirectXFileEnumObject = IDirectXFileEnumObject;
  8867.   IID_IDirectXFileSaveObject = IDirectXFileSaveObject;
  8868.   IID_IDirectXFileObject = IDirectXFileObject;
  8869.   IID_IDirectXFileData = IDirectXFileData;
  8870.   IID_IDirectXFileDataReference = IDirectXFileDataReference;
  8871.   IID_IDirectXFileBinary = IDirectXFileBinary;
  8872.  
  8873. (*
  8874.  * DirectX File Header template's GUID.
  8875.  *)
  8876. const
  8877.   TID_DXFILEHeader: TGUID =
  8878.       (D1:$3d82ab43;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  8879.  
  8880. (*
  8881.  * DirectX File errors.
  8882.  *)
  8883.  
  8884. const
  8885.   DXFILE_OK = 0;
  8886.  
  8887.   DXFILEERR_BADOBJECT                 = MAKE_D3DHRESULT or 850;
  8888.   DXFILEERR_BADVALUE                  = MAKE_D3DHRESULT or 851;
  8889.   DXFILEERR_BADTYPE                   = MAKE_D3DHRESULT or 852;
  8890.   DXFILEERR_BADSTREAMHANDLE           = MAKE_D3DHRESULT or 853;
  8891.   DXFILEERR_BADALLOC                  = MAKE_D3DHRESULT or 854;
  8892.   DXFILEERR_NOTFOUND                  = MAKE_D3DHRESULT or 855;
  8893.   DXFILEERR_NOTDONEYET                = MAKE_D3DHRESULT or 856;
  8894.   DXFILEERR_FILENOTFOUND              = MAKE_D3DHRESULT or 857;
  8895.   DXFILEERR_RESOURCENOTFOUND          = MAKE_D3DHRESULT or 858;
  8896.   DXFILEERR_URLNOTFOUND               = MAKE_D3DHRESULT or 859;
  8897.   DXFILEERR_BADRESOURCE               = MAKE_D3DHRESULT or 860;
  8898.   DXFILEERR_BADFILETYPE               = MAKE_D3DHRESULT or 861;
  8899.   DXFILEERR_BADFILEVERSION            = MAKE_D3DHRESULT or 862;
  8900.   DXFILEERR_BADFILEFLOATSIZE          = MAKE_D3DHRESULT or 863;
  8901.   DXFILEERR_BADFILECOMPRESSIONTYPE    = MAKE_D3DHRESULT or 864;
  8902.   DXFILEERR_BADFILE                   = MAKE_D3DHRESULT or 865;
  8903.   DXFILEERR_PARSEERROR                = MAKE_D3DHRESULT or 866;
  8904.   DXFILEERR_NOTEMPLATE                = MAKE_D3DHRESULT or 867;
  8905.   DXFILEERR_BADARRAYSIZE              = MAKE_D3DHRESULT or 868;
  8906.   DXFILEERR_BADDATAREFERENCE          = MAKE_D3DHRESULT or 869;
  8907.   DXFILEERR_INTERNALERROR             = MAKE_D3DHRESULT or 870;
  8908.   DXFILEERR_NOMOREOBJECTS             = MAKE_D3DHRESULT or 871;
  8909.   DXFILEERR_BADINTRINSICS             = MAKE_D3DHRESULT or 872;
  8910.   DXFILEERR_NOMORESTREAMHANDLES       = MAKE_D3DHRESULT or 873;
  8911.   DXFILEERR_NOMOREDATA                = MAKE_D3DHRESULT or 874;
  8912.   DXFILEERR_BADCACHEFILE              = MAKE_D3DHRESULT or 875;
  8913.   DXFILEERR_NOINTERNET                = MAKE_D3DHRESULT or 876;
  8914.  
  8915. {$IFDEF D3DRM}
  8916. (*
  8917.  * API for creating IDirectXFile interface.
  8918.  *)
  8919.  
  8920. var
  8921.   DirectXFileCreate : function
  8922.     (out lplpDirectXFile: IDirectXFile) : HResult; stdcall;
  8923.  
  8924. (* D3DRM XFile templates in binary form *)
  8925. const
  8926.   D3DRM_XTEMPLATE_BYTES = 3215;
  8927.   D3DRM_XTEMPLATES: array [0..D3DRM_XTEMPLATE_BYTES-1] of byte = (
  8928.         $78, $6f, $66, $20, $30, $33, $30, $32, $62,
  8929.         $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
  8930.         0, $6, 0, 0, 0, $48, $65, $61, $64, $65,
  8931.         $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
  8932.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
  8933.         $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
  8934.         $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0,
  8935.         $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
  8936.         0, $29, 0, $1, 0, $5, 0, 0, 0, $66,
  8937.         $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
  8938.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  8939.         $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
  8940.         $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71,
  8941.         $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
  8942.         $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0,
  8943.         0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
  8944.         0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1,
  8945.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  8946.         $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2,
  8947.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  8948.         $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0,
  8949.         0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
  8950.         0, 0, $76, $14, 0, $b, 0, $1f, 0, $1,
  8951.         0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  8952.         $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f,
  8953.         $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  8954.         $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0,
  8955.         $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
  8956.         $e, 0, $3, 0, $10, 0, 0, 0, $f, 0,
  8957.         $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
  8958.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  8959.         $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
  8960.         $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94,
  8961.         $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
  8962.         $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0,
  8963.         0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
  8964.         0, $1, 0, $4, 0, 0, 0, $62, $6c, $75,
  8965.         $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
  8966.         0, $61, $6c, $70, $68, $61, $14, 0, $b, 0,
  8967.         $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
  8968.         $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0,
  8969.         $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
  8970.         0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0,
  8971.         $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
  8972.         0, $1, 0, $5, 0, 0, 0, $67, $72, $65,
  8973.         $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
  8974.         0, 0, $62, $6c, $75, $65, $14, 0, $b, 0,
  8975.         $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
  8976.         $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72,
  8977.         $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
  8978.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  8979.         $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
  8980.         $64, $65, $78, $14, 0, $1, 0, $9, 0, 0,
  8981.         0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
  8982.         $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65,
  8983.         $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
  8984.         $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f,
  8985.         $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
  8986.         $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0,
  8987.         $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
  8988.         0, 0, 0, $74, $72, $75, $65, $66, $61, $6c,
  8989.         $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
  8990.         $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61,
  8991.         $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
  8992.         $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33,
  8993.         $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
  8994.         $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0,
  8995.         0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
  8996.         0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0,
  8997.         $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
  8998.         0, $1, 0, $c, 0, 0, 0, $4d, $61, $74,
  8999.         $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
  9000.         0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf,
  9001.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  9002.         0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65,
  9003.         $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
  9004.         0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f,
  9005.         $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
  9006.         $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f,
  9007.         0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
  9008.         $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0,
  9009.         $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
  9010.         $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0,
  9011.         $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
  9012.         $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0,
  9013.         $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
  9014.         $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab,
  9015.         $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
  9016.         $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0,
  9017.         $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
  9018.         0, $9, 0, 0, 0, $66, $61, $63, $65, $43,
  9019.         $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
  9020.         $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14,
  9021.         0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
  9022.         $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0,
  9023.         0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
  9024.         $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0,
  9025.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  9026.         $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73,
  9027.         $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
  9028.         0, $e, 0, $12, 0, $12, 0, $12, 0, $f,
  9029.         0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
  9030.         0, $4d, $65, $73, $68, $46, $61, $63, $65, $a,
  9031.         0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
  9032.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  9033.         0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
  9034.         $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e,
  9035.         $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
  9036.         0, $1, 0, $11, 0, 0, 0, $66, $61, $63,
  9037.         $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
  9038.         $69, $63, $65, $73, $e, 0, $1, 0, $12, 0,
  9039.         0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
  9040.         $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73,
  9041.         $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  9042.         $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61,
  9043.         $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
  9044.         0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94,
  9045.         $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
  9046.         0, $f, 0, 0, 0, $6e, $46, $61, $63, $65,
  9047.         $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
  9048.         $14, 0, $34, 0, $1, 0, $9, 0, 0, 0,
  9049.         $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
  9050.         0, $e, 0, 0, 0, $66, $61, $63, $65, $57,
  9051.         $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
  9052.         0, $1, 0, $f, 0, 0, 0, $6e, $46, $61,
  9053.         $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
  9054.         $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
  9055.         $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
  9056.         $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f,
  9057.         $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
  9058.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  9059.         $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
  9060.         0, $6e, $54, $65, $78, $74, $75, $72, $65, $43,
  9061.         $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
  9062.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  9063.         $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
  9064.         $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72,
  9065.         $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
  9066.         $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f,
  9067.         $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
  9068.         $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65,
  9069.         $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
  9070.         $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f,
  9071.         $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  9072.         $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0,
  9073.         0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
  9074.         $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0,
  9075.         0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
  9076.         $65, $78, $65, $73, $14, 0, $34, 0, $29, 0,
  9077.         $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
  9078.         $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1,
  9079.         0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
  9080.         $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14,
  9081.         0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
  9082.         $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b,
  9083.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
  9084.         $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73,
  9085.         $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
  9086.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  9087.         $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
  9088.         $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0,
  9089.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  9090.         $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f,
  9091.         $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
  9092.         0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c,
  9093.         $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
  9094.         0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f,
  9095.         $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
  9096.         0, $8, 0, 0, 0, $4d, $65, $73, $68, $46,
  9097.         $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
  9098.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
  9099.         $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
  9100.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73,
  9101.         $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  9102.         $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65,
  9103.         $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
  9104.         $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78,
  9105.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  9106.         $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56,
  9107.         $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  9108.         $73, $14, 0, $34, 0, $1, 0, $c, 0, 0,
  9109.         0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
  9110.         $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76,
  9111.         $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  9112.         $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e,
  9113.         $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
  9114.         $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0,
  9115.         $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
  9116.         $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62,
  9117.         $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  9118.         $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56,
  9119.         $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
  9120.         0, $1, 0, $6, 0, 0, 0, $56, $65, $63,
  9121.         $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
  9122.         $65, $72, $74, $69, $63, $65, $73, $e, 0, $1,
  9123.         0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
  9124.         $69, $63, $65, $73, $f, 0, $14, 0, $29, 0,
  9125.         $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
  9126.         $65, $73, $14, 0, $34, 0, $1, 0, $8, 0,
  9127.         0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
  9128.         $1, 0, $5, 0, 0, 0, $66, $61, $63, $65,
  9129.         $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
  9130.         $46, $61, $63, $65, $73, $f, 0, $14, 0, $e,
  9131.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  9132.         0, $1f, 0, $1, 0, $14, 0, 0, 0, $46,
  9133.         $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
  9134.         $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a,
  9135.         0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
  9136.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  9137.         0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  9138.         $78, $34, $78, $34, $1, 0, $b, 0, 0, 0,
  9139.         $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
  9140.         $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5,
  9141.         0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
  9142.         $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11,
  9143.         $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
  9144.         $12, 0, $12, 0, $12, 0, $f, 0, $b, 0,
  9145.         $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
  9146.         $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5,
  9147.         0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
  9148.         $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1,
  9149.         0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
  9150.         $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0,
  9151.         $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
  9152.         $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56,
  9153.         $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
  9154.         0, $1f, 0, $1, 0, $e, 0, 0, 0, $54,
  9155.         $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
  9156.         $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6,
  9157.         $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
  9158.         $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0,
  9159.         0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
  9160.         0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65,
  9161.         $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
  9162.         $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0,
  9163.         $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
  9164.         $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0,
  9165.         $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
  9166.         $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0,
  9167.         $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
  9168.         $79, $70, $65, $14, 0, $29, 0, $1, 0, $5,
  9169.         0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
  9170.         $34, 0, $1, 0, $e, 0, 0, 0, $54, $69,
  9171.         $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
  9172.         $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65,
  9173.         $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
  9174.         $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b,
  9175.         0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
  9176.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70,
  9177.         $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
  9178.         $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0,
  9179.         $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
  9180.         0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f,
  9181.         $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
  9182.         0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f,
  9183.         $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
  9184.         $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0,
  9185.         $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
  9186.         0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf,
  9187.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
  9188.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  9189.         0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
  9190.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65,
  9191.         $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
  9192.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4,
  9193.         $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
  9194.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0,
  9195.         $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
  9196.         $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61,
  9197.         $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
  9198.         $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  9199.         $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
  9200.         $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0,
  9201.         $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
  9202.         0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0,
  9203.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  9204.         0, $1, 0, $5, 0, 0, 0, $6e, $55, $72,
  9205.         $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
  9206.         $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0,
  9207.         $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
  9208.         $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1,
  9209.         0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
  9210.         $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68,
  9211.         $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
  9212.         $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b,
  9213.         $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
  9214.         $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49,
  9215.         $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
  9216.         0, $b, 0, $1f, 0, $1, 0, $4, 0, 0,
  9217.         0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
  9218.         $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0,
  9219.         $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
  9220.         0, 0, 0, $64, $61, $74, $61, $31, $14, 0,
  9221.         $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
  9222.         $74, $61, $32, $14, 0, $28, 0, $1, 0, $5,
  9223.         0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
  9224.         $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0,
  9225.         $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
  9226.         0, 0, 0, $f, 0, $14, 0, $b, 0, $1f,
  9227.         0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
  9228.         $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74,
  9229.         $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
  9230.         $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72,
  9231.         $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
  9232.         $65, $79, $14, 0, $31, 0, $1, 0, $5, 0,
  9233.         0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
  9234.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $50,
  9235.         $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
  9236.         $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf,
  9237.         $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
  9238.         $e, 0, $1, 0, $e, 0, 0, 0, $53, $74,
  9239.         $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
  9240.         $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0,
  9241.         $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
  9242.         $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0,
  9243.         $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
  9244.         $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0,
  9245.         $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
  9246.         $12, 0, 0, 0, $67, $75, $69, $64, $45, $78,
  9247.         $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
  9248.         $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0,
  9249.         $12, 0, $f, 0, $b, 0);
  9250.  
  9251. //---------------
  9252.  
  9253. //Direct3DRM file
  9254. (*==========================================================================;
  9255.  *
  9256.  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
  9257.  *
  9258.  *  Files:      D3DRMDef.h D3DRMObj.h D3DRM.h D3DRMWin.h RMXFGUID.h RMXFTmpl.h
  9259.  *  Content:    Direct3D Retained Mode include files
  9260.  *
  9261.  *  DirectX 7.0 Delphi adaptation by Erik Unger
  9262.  *
  9263.  *  Modified: 10-Sep-2000
  9264.  *
  9265.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  9266.  *  E-Mail: DelphiDirectX@next-reality.com
  9267.  *
  9268.  *
  9269.  ***************************************************************************)
  9270.  
  9271. var
  9272.   D3DRMDLL : HMODULE = 0;
  9273.  
  9274. (*==========================================================================;
  9275.  *
  9276.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  9277.  *
  9278.  *  File:       d3drmdef.h
  9279.  *  Content:    Direct3DRM include file
  9280.  *
  9281.  ***************************************************************************)
  9282.  
  9283. type
  9284.   PD3DRMVector4D = ^TD3DRMVector4D;
  9285.   TD3DRMVector4D = packed record
  9286.     x, y, z, w: TD3DValue;
  9287.   end;
  9288.  
  9289.   PD3DRMMatrix4D = ^TD3DRMMatrix4D;
  9290.   TD3DRMMatrix4D = array [0..3, 0..3] of TD3DValue;
  9291.  
  9292.   PD3DRMQuaternion = ^TD3DRMQuaternion;
  9293.   TD3DRMQuaternion = packed record
  9294.     s: TD3DValue;
  9295.     v: TD3DVector;
  9296.   end;
  9297.  
  9298.   PD3DRMRay = ^TD3DRMRay;
  9299.   TD3DRMRay = packed record
  9300.     dvDir: TD3DVector;
  9301.     dvPos: TD3DVector;
  9302.   end;
  9303.  
  9304.   PD3DRMBox = ^TD3DRMBox;
  9305.   TD3DRMBox = packed record
  9306.     min, max: TD3DVector;
  9307.   end;
  9308.  
  9309.   TD3DRMWrapCallback = procedure (var lpD3DVector: TD3DVector;
  9310.       var lpU, lpV: Integer; var lpD3DRMVA, lpD3DRMVB: TD3DVector; lpArg:
  9311.       Pointer); stdcall; // unused ?
  9312.  
  9313.   PD3DRMLightType = ^TD3DRMLightType; // is it 16 or 32 bit ?
  9314.   TD3DRMLightType = (
  9315.     D3DRMLIGHT_AMBIENT,
  9316.     D3DRMLIGHT_POINT,
  9317.     D3DRMLIGHT_SPOT,
  9318.     D3DRMLIGHT_DIRECTIONAL,
  9319.     D3DRMLIGHT_PARALLELPOINT
  9320.   );
  9321.  
  9322.   PD3DRMShadeMode = ^TD3DRMShadeMode;
  9323.   TD3DRMShadeMode = WORD;
  9324.  
  9325. const
  9326.   D3DRMSHADE_FLAT = 0;
  9327.   D3DRMSHADE_GOURAUD = 1;
  9328.   D3DRMSHADE_PHONG = 2;
  9329.   D3DRMSHADE_MASK = 7;
  9330.   D3DRMSHADE_MAX = 8;
  9331.  
  9332. type
  9333.   PD3DRMLightMode = ^TD3DRMLightMode;
  9334.   TD3DRMLightMode = WORD;
  9335.  
  9336. const
  9337.   D3DRMLIGHT_OFF  = 0 * D3DRMSHADE_MAX;
  9338.   D3DRMLIGHT_ON   = 1 * D3DRMSHADE_MAX;
  9339.   D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX;
  9340.   D3DRMLIGHT_MAX  = 8 * D3DRMSHADE_MAX;
  9341.  
  9342. type
  9343.   PD3DRMFillMode = ^TD3DRMFillMode;
  9344.   TD3DRMFillMode = WORD;
  9345.  
  9346. const
  9347.   D3DRMFILL_POINTS    = 0 * D3DRMLIGHT_MAX;
  9348.   D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX;
  9349.   D3DRMFILL_SOLID     = 2 * D3DRMLIGHT_MAX;
  9350.   D3DRMFILL_MASK      = 7 * D3DRMLIGHT_MAX;
  9351.   D3DRMFILL_MAX       = 8 * D3DRMLIGHT_MAX;
  9352.  
  9353. type
  9354.   PD3DRMRenderQuality = ^TD3DRMRenderQuality;
  9355.   TD3DRMRenderQuality = DWORD;
  9356.  
  9357. const
  9358.   D3DRMRENDER_WIREFRAME   =
  9359.       (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_WIREFRAME);
  9360.   D3DRMRENDER_UNLITFLAT   =
  9361.       (D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_SOLID);
  9362.   D3DRMRENDER_FLAT        =
  9363.       (D3DRMSHADE_FLAT + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9364.   D3DRMRENDER_GOURAUD     =
  9365.       (D3DRMSHADE_GOURAUD + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9366.   D3DRMRENDER_PHONG       =
  9367.       (D3DRMSHADE_PHONG + D3DRMLIGHT_ON + D3DRMFILL_SOLID);
  9368.  
  9369.   D3DRMRENDERMODE_BLENDEDTRANSPARENCY   =  1;
  9370.   D3DRMRENDERMODE_SORTEDTRANSPARENCY    =  2;
  9371.   D3DRMRENDERMODE_LIGHTINMODELSPACE     =  8;
  9372.   D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR = 16;
  9373.  
  9374. type
  9375.   PD3DRMTextureQuality = ^TD3DRMTextureQuality;
  9376.   TD3DRMTextureQuality = (
  9377.     D3DRMTEXTURE_NEAREST,               (* choose nearest texel *)
  9378.     D3DRMTEXTURE_LINEAR,                (* interpolate 4 texels *)
  9379.     D3DRMTEXTURE_MIPNEAREST,            (* nearest texel in nearest mipmap  *)
  9380.     D3DRMTEXTURE_MIPLINEAR,             (* interpolate 2 texels from 2 mipmaps *)
  9381.     D3DRMTEXTURE_LINEARMIPNEAREST,      (* interpolate 4 texels in nearest mipmap *)
  9382.     D3DRMTEXTURE_LINEARMIPLINEAR        (* interpolate 8 texels from 2 mipmaps *)
  9383.   );
  9384.  
  9385. const
  9386. (*
  9387.  * Texture flags
  9388.  *)
  9389.   D3DRMTEXTURE_FORCERESIDENT          = $00000001; (* texture should be kept in video memory *)
  9390.   D3DRMTEXTURE_STATIC                 = $00000002; (* texture will not change *)
  9391.   D3DRMTEXTURE_DOWNSAMPLEPOINT        = $00000004; (* point filtering should be used when downsampling *)
  9392.   D3DRMTEXTURE_DOWNSAMPLEBILINEAR     = $00000008; (* bilinear filtering should be used when downsampling *)
  9393.   D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH  = $00000010; (* reduce bit depth when downsampling *)
  9394.   D3DRMTEXTURE_DOWNSAMPLENONE         = $00000020; (* texture should never be downsampled *)
  9395.   D3DRMTEXTURE_CHANGEDPIXELS          = $00000040; (* pixels have changed *)
  9396.   D3DRMTEXTURE_CHANGEDPALETTE         = $00000080; (* palette has changed *)
  9397.   D3DRMTEXTURE_INVALIDATEONLY         = $00000100; (* dirty regions are invalid *)
  9398.  
  9399. (*
  9400.  * Shadow flags
  9401.  *)
  9402.    D3DRMSHADOW_TRUEALPHA               = $00000001; (* shadow should render without artifacts when true alpha is on *)
  9403.  
  9404. type
  9405.   PD3DRMCombineType = ^TD3DRMCombineType;
  9406.   TD3DRMCombineType = (
  9407.     D3DRMCOMBINE_REPLACE,
  9408.     D3DRMCOMBINE_BEFORE,
  9409.     D3DRMCOMBINE_AFTER
  9410.   );
  9411.  
  9412.   PD3DRMColorModel = ^TD3DRMColorModel;
  9413.   TD3DRMColorModel = TD3DColorModel;
  9414.  
  9415.   PD3DRMPaletteFlags = ^TD3DRMPaletteFlags;
  9416.   TD3DRMPaletteFlags = (
  9417.     D3DRMPALETTE_FREE,                  (* renderer may use this entry freely *)
  9418.     D3DRMPALETTE_READONLY,              (* fixed but may be used by renderer *)
  9419.     D3DRMPALETTE_RESERVED               (* may not be used by renderer *)
  9420.   );
  9421.  
  9422.   PD3DRMPaletteEntry = ^TD3DRMPaletteEntry;
  9423.   TD3DRMPaletteEntry = packed record
  9424.     red: Byte;          (* 0 .. 255 *)
  9425.     green: Byte;        (* 0 .. 255 *)
  9426.     blue: Byte;         (* 0 .. 255 *)
  9427.     flags: Byte;        (* one of D3DRMPALETTEFLAGS *)
  9428.   end;
  9429.  
  9430.   PD3DRMImage = ^TD3DRMImage;
  9431.   TD3DRMImage = packed record
  9432.     width, height: Integer;    (* width and height in pixels *)
  9433.     aspectx, aspecty: Integer; (* aspect ratio for non-square pixels *)
  9434.     depth: Integer;            (* bits per pixel *)
  9435.     rgb: Integer;              (* if false, pixels are indices into a
  9436.                                    palette otherwise, pixels encode
  9437.                                    RGB values. *)
  9438.     bytes_per_line: Integer;   (* number of bytes of memory for a
  9439.                                    scanline. This must be a multiple
  9440.                                    of 4. *)
  9441.     buffer1: Pointer;          (* memory to render into (first buffer). *)
  9442.     buffer2: Pointer;          (* second rendering buffer for double
  9443.                                    buffering, set to NULL for single
  9444.                                    buffering. *)
  9445.     red_mask: DWORD;
  9446.     green_mask: DWORD;
  9447.     blue_mask: DWORD;
  9448.     alpha_mask: DWORD;        (* if rgb is true, these are masks for
  9449.                                    the red, green and blue parts of a
  9450.                                    pixel.  Otherwise, these are masks
  9451.                                    for the significant bits of the
  9452.                                    red, green and blue elements in the
  9453.                                    palette.  For instance, most SVGA
  9454.                                    displays use 64 intensities of red,
  9455.                                    green and blue, so the masks should
  9456.                                    all be set to = $fc. *)
  9457.     palette_size: Integer;     (* number of entries in palette *)
  9458.     palette: PD3DRMPaletteEntry; (* description of the palette (only if
  9459.                                    rgb is false).  Must be (1<<depth)
  9460.                                    elements. *)
  9461.   end;
  9462.  
  9463.   PD3DRMWrapType = ^TD3DRMWrapType;
  9464.   TD3DRMWrapType = (
  9465.     D3DRMWRAP_FLAT,
  9466.     D3DRMWRAP_CYLINDER,
  9467.     D3DRMWRAP_SPHERE,
  9468.     D3DRMWRAP_CHROME,
  9469.     D3DRMWRAP_SHEET,
  9470.     D3DRMWRAP_BOX
  9471.   );
  9472.  
  9473. const
  9474.   D3DRMWIREFRAME_CULL             = 1; (* cull backfaces *)
  9475.   D3DRMWIREFRAME_HIDDENLINE       = 2; (* lines are obscured by closer objects *)
  9476.  
  9477. type
  9478. (*
  9479.  * Do not use righthanded perspective in Viewport2::SetProjection().
  9480.  * Set up righthanded mode by using IDirect3DRM3::SetOptions().
  9481.  *)
  9482.   PD3DRMProjectionType = ^TD3DRMProjectionType;
  9483.   TD3DRMProjectionType = (
  9484.     D3DRMPROJECT_PERSPECTIVE,
  9485.     D3DRMPROJECT_ORTHOGRAPHIC,
  9486.     D3DRMPROJECT_RIGHTHANDPERSPECTIVE, (* Only valid pre-DX6 *)
  9487.     D3DRMPROJECT_RIGHTHANDORTHOGRAPHIC (* Only valid pre-DX6 *)
  9488.   );
  9489.  
  9490. const
  9491.   D3DRMOPTIONS_LEFTHANDED  = 00000001; (* Default *)
  9492.   D3DRMOPTIONS_RIGHTHANDED = 00000002;
  9493.  
  9494. type
  9495.   PD3DRMXOFFormat = ^TD3DRMXOFFormat;
  9496.   TD3DRMXOFFormat = (
  9497.     D3DRMXOF_BINARY,
  9498.     D3DRMXOF_COMPRESSED,
  9499.     D3DRMXOF_TEXT
  9500.   );
  9501.  
  9502.   TD3DRMSaveOptions = DWORD;
  9503. const
  9504.   D3DRMXOFSAVE_NORMALS = 1;
  9505.   D3DRMXOFSAVE_TEXTURECOORDINATES = 2;
  9506.   D3DRMXOFSAVE_MATERIALS = 4;
  9507.   D3DRMXOFSAVE_TEXTURENAMES = 8;
  9508.   D3DRMXOFSAVE_ALL = 15;
  9509.   D3DRMXOFSAVE_TEMPLATES = 16;
  9510.   D3DRMXOFSAVE_TEXTURETOPOLOGY = 32;
  9511.  
  9512. type
  9513.   PD3DRMColorSource = ^TD3DRMColorSource;
  9514.   TD3DRMColorSource = (
  9515.     D3DRMCOLOR_FROMFACE,
  9516.     D3DRMCOLOR_FROMVERTEX
  9517.   );
  9518.  
  9519.   PD3DRMFrameConstraint = ^TD3DRMFrameConstraint;
  9520.   TD3DRMFrameConstraint = (
  9521.     D3DRMCONSTRAIN_Z,           (* use only X and Y rotations *)
  9522.     D3DRMCONSTRAIN_Y,           (* use only X and Z rotations *)
  9523.     D3DRMCONSTRAIN_X            (* use only Y and Z rotations *)
  9524.   );
  9525.  
  9526.   PD3DRMMaterialMode = ^TD3DRMMaterialMode;
  9527.   TD3DRMMaterialMode = (
  9528.     D3DRMMATERIAL_FROMMESH,
  9529.     D3DRMMATERIAL_FROMPARENT,
  9530.     D3DRMMATERIAL_FROMFRAME
  9531.   );
  9532.  
  9533.   PD3DRMFogMode = ^TD3DRMFogMode;
  9534.   TD3DRMFogMode = (
  9535.     D3DRMFOG_LINEAR,            (* linear between start and end *)
  9536.     D3DRMFOG_EXPONENTIAL,       (* density * exp(-distance) *)
  9537.     D3DRMFOG_EXPONENTIALSQUARED (* density * exp(-distance*distance) *)
  9538.   );
  9539.  
  9540.   PD3DRMZBufferMode = ^TD3DRMZBufferMode;
  9541.   TD3DRMZBufferMode = (
  9542.     D3DRMZBUFFER_FROMPARENT,    (* default *)
  9543.     D3DRMZBUFFER_ENABLE,        (* enable zbuffering *)
  9544.     D3DRMZBUFFER_DISABLE        (* disable zbuffering *)
  9545.   );
  9546.  
  9547.   PD3DRMSortMode = ^TD3DRMSortMode;
  9548.   TD3DRMSortMode = (
  9549.     D3DRMSORT_FROMPARENT,       (* default *)
  9550.     D3DRMSORT_NONE,             (* don't sort child frames *)
  9551.     D3DRMSORT_FRONTTOBACK,      (* sort child frames front-to-back *)
  9552.     D3DRMSORT_BACKTOFRONT       (* sort child frames back-to-front *)
  9553.   );
  9554.  
  9555.   TD3DRMMaterialOverride = packed record
  9556.     dwSize : DWORD;       (* Size of this structure *)
  9557.     dwFlags : DWORD;      (* Indicate which fields are valid *)
  9558.     dcDiffuse : TD3DColorValue;    (* RGBA *)
  9559.     dcAmbient : TD3DColorValue;    (* RGB *)
  9560.     dcEmissive : TD3DColorValue;   (* RGB *)
  9561.     dcSpecular : TD3DColorValue;   (* RGB *)
  9562.     dvPower : TD3DValue;
  9563.     lpD3DRMTex : IUnknown;
  9564.   end;
  9565.  
  9566. const
  9567.   D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAONLY     = $00000001;
  9568.   D3DRMMATERIALOVERRIDE_DIFFUSE_RGBONLY       = $00000002;
  9569.   D3DRMMATERIALOVERRIDE_DIFFUSE               = $00000003;
  9570.   D3DRMMATERIALOVERRIDE_AMBIENT               = $00000004;
  9571.   D3DRMMATERIALOVERRIDE_EMISSIVE              = $00000008;
  9572.   D3DRMMATERIALOVERRIDE_SPECULAR              = $00000010;
  9573.   D3DRMMATERIALOVERRIDE_POWER                 = $00000020;
  9574.   D3DRMMATERIALOVERRIDE_TEXTURE               = $00000040;
  9575.   D3DRMMATERIALOVERRIDE_DIFFUSE_ALPHAMULTIPLY = $00000080;
  9576.   D3DRMMATERIALOVERRIDE_ALL                   = $000000FF;
  9577.  
  9578.   D3DRMFPTF_ALPHA                           = $00000001;
  9579.   D3DRMFPTF_NOALPHA                         = $00000002;
  9580.   D3DRMFPTF_PALETTIZED                      = $00000004;
  9581.   D3DRMFPTF_NOTPALETTIZED                   = $00000008;
  9582.  
  9583.   D3DRMSTATECHANGE_UPDATEONLY               = $000000001;
  9584.   D3DRMSTATECHANGE_VOLATILE                 = $000000002;
  9585.   D3DRMSTATECHANGE_NONVOLATILE              = $000000004;
  9586.   D3DRMSTATECHANGE_RENDER                   = $000000020;
  9587.   D3DRMSTATECHANGE_LIGHT                    = $000000040;
  9588.  
  9589. (*
  9590.  * Values for flags in RM3::CreateDeviceFromSurface
  9591.  *)
  9592.   D3DRMDEVICE_NOZBUFFER           = $00000001;
  9593.  
  9594. (*
  9595.  * Values for flags in Object2::SetClientData
  9596.  *)
  9597.   D3DRMCLIENTDATA_NONE            = $00000001;
  9598.   D3DRMCLIENTDATA_LOCALFREE       = $00000002;
  9599.   D3DRMCLIENTDATA_IUNKNOWN        = $00000004;
  9600.  
  9601. (*
  9602.  * Values for flags in Frame2::AddMoveCallback.
  9603.  *)
  9604.   D3DRMCALLBACK_PREORDER                = 0;
  9605.   D3DRMCALLBACK_POSTORDER               = 1;
  9606.  
  9607. (*
  9608.  * Values for flags in MeshBuilder2::RayPick.
  9609.  *)
  9610.   D3DRMRAYPICK_ONLYBOUNDINGBOXES        = 1;
  9611.   D3DRMRAYPICK_IGNOREFURTHERPRIMITIVES  = 2;
  9612.   D3DRMRAYPICK_INTERPOLATEUV            = 4;
  9613.   D3DRMRAYPICK_INTERPOLATECOLOR         = 8;
  9614.   D3DRMRAYPICK_INTERPOLATENORMAL        = $10;
  9615.  
  9616. (*
  9617.  * Values for flags in MeshBuilder3::AddFacesIndexed.
  9618.  *)
  9619.   D3DRMADDFACES_VERTICESONLY             = 1;
  9620.  
  9621. (*
  9622.  * Values for flags in MeshBuilder2::GenerateNormals.
  9623.  *)
  9624.   D3DRMGENERATENORMALS_PRECOMPACT       = 1;
  9625.   D3DRMGENERATENORMALS_USECREASEANGLE   = 2;
  9626.  
  9627. (*
  9628.  * Values for MeshBuilder3::GetParentMesh
  9629.  *)
  9630.   D3DRMMESHBUILDER_DIRECTPARENT          = 1;
  9631.   D3DRMMESHBUILDER_ROOTMESH              = 2;
  9632.  
  9633. (*
  9634.  * Flags for MeshBuilder3::Enable
  9635.  *)
  9636.   D3DRMMESHBUILDER_RENDERENABLE   = $00000001;
  9637.   D3DRMMESHBUILDER_PICKENABLE     = $00000002;
  9638.  
  9639. (*
  9640.  * Flags for Object2::GetAge when used with MeshBuilders
  9641.  *)
  9642.   D3DRMMESHBUILDERAGE_GEOMETRY    = $00000001;
  9643.   D3DRMMESHBUILDERAGE_MATERIALS   = $00000002;
  9644.   D3DRMMESHBUILDERAGE_TEXTURES    = $00000004;
  9645.  
  9646. (*
  9647.  * Format flags for MeshBuilder3::AddTriangles.
  9648.  *)
  9649.   D3DRMFVF_TYPE                   = $00000001;
  9650.   D3DRMFVF_NORMAL                 = $00000002;
  9651.   D3DRMFVF_COLOR                  = $00000004;
  9652.   D3DRMFVF_TEXTURECOORDS          = $00000008;
  9653.  
  9654.   D3DRMVERTEX_STRIP               = $00000001;
  9655.   D3DRMVERTEX_FAN                 = $00000002;
  9656.   D3DRMVERTEX_LIST                = $00000004;
  9657.  
  9658. (*
  9659.  * Values for flags in Viewport2::Clear2
  9660.  *)
  9661.   D3DRMCLEAR_TARGET               = $00000001;
  9662.   D3DRMCLEAR_ZBUFFER              = $00000002;
  9663.   D3DRMCLEAR_DIRTYRECTS           = $00000004;
  9664.   D3DRMCLEAR_ALL                  = (D3DRMCLEAR_TARGET or
  9665.                                          D3DRMCLEAR_ZBUFFER or
  9666.                                          D3DRMCLEAR_DIRTYRECTS);
  9667.  
  9668. (*
  9669.  * Values for flags in Frame3::SetSceneFogMethod
  9670.  *)
  9671.   D3DRMFOGMETHOD_VERTEX          = $00000001;
  9672.   D3DRMFOGMETHOD_TABLE           = $00000002;
  9673.   D3DRMFOGMETHOD_ANY             = $00000004;
  9674.  
  9675. (*
  9676.  * Values for flags in Frame3::SetTraversalOptions
  9677.  *)
  9678.   D3DRMFRAME_RENDERENABLE        = $00000001;
  9679.   D3DRMFRAME_PICKENABLE          = $00000002;
  9680.  
  9681. type
  9682.   TD3DRMAnimationOptions = DWORD;
  9683.  
  9684. const
  9685.   D3DRMANIMATION_OPEN = $01;
  9686.   D3DRMANIMATION_CLOSED = $02;
  9687.   D3DRMANIMATION_LINEARPOSITION = $04;
  9688.   D3DRMANIMATION_SPLINEPOSITION = $08;
  9689.   D3DRMANIMATION_SCALEANDROTATION = $00000010;
  9690.   D3DRMANIMATION_POSITION = $00000020;
  9691.  
  9692. type
  9693.   TD3DRMInterpolationOptions = DWORD;
  9694. const
  9695.   D3DRMINTERPOLATION_OPEN = $01;
  9696.   D3DRMINTERPOLATION_CLOSED = $02;
  9697.   D3DRMINTERPOLATION_NEAREST = $0100;
  9698.   D3DRMINTERPOLATION_LINEAR = $04;
  9699.   D3DRMINTERPOLATION_SPLINE = $08;
  9700.   D3DRMINTERPOLATION_VERTEXCOLOR = $40;
  9701.   D3DRMINTERPOLATION_SLERPNORMALS = $80;
  9702.  
  9703. type
  9704.   TD3DRMLoadOptions = DWORD;
  9705.  
  9706. const
  9707.   D3DRMLOAD_FROMFILE  = $00;
  9708.   D3DRMLOAD_FROMRESOURCE = $01;
  9709.   D3DRMLOAD_FROMMEMORY = $02;
  9710.   D3DRMLOAD_FROMSTREAM = $04;
  9711.   D3DRMLOAD_FROMURL = $08;
  9712.  
  9713.   D3DRMLOAD_BYNAME = $10;
  9714.   D3DRMLOAD_BYPOSITION = $20;
  9715.   D3DRMLOAD_BYGUID = $40;
  9716.   D3DRMLOAD_FIRST = $80;
  9717.  
  9718.   D3DRMLOAD_INSTANCEBYREFERENCE = $100;
  9719.   D3DRMLOAD_INSTANCEBYCOPYING = $200;
  9720.  
  9721.   D3DRMLOAD_ASYNCHRONOUS = $400;
  9722.  
  9723. type
  9724.   PD3DRMLoadResource = ^TD3DRMLoadResource;
  9725.   TD3DRMLoadResource = packed record
  9726.     hModule: HMODULE;
  9727.     lpName: PAnsiChar;
  9728.     lpType: PAnsiChar;
  9729.   end;
  9730.  
  9731.   PD3DRMLoadMemory = ^TD3DRMLoadMemory;
  9732.   TD3DRMLoadMemory = packed record
  9733.     lpMemory: Pointer;
  9734.     dwSize: DWORD;
  9735.   end;
  9736.  
  9737. const
  9738.   D3DRMPMESHSTATUS_VALID = $01;
  9739.   D3DRMPMESHSTATUS_INTERRUPTED = $02;
  9740.   D3DRMPMESHSTATUS_BASEMESHCOMPLETE = $04;
  9741.   D3DRMPMESHSTATUS_COMPLETE = $08;
  9742.   D3DRMPMESHSTATUS_RENDERABLE = $10;
  9743.  
  9744.   D3DRMPMESHEVENT_BASEMESH = $01;
  9745.   D3DRMPMESHEVENT_COMPLETE = $02;
  9746.  
  9747. type
  9748.   PD3DRMPMeshLoadStatus = ^TD3DRMPMeshLoadStatus;
  9749.   TD3DRMPMeshLoadStatus = packed record
  9750.     dwSize,            // Size of this structure
  9751.     dwPMeshSize,       // Total Size (bytes)
  9752.     dwBaseMeshSize,    // Total Size of the Base Mesh
  9753.     dwBytesLoaded,     // Total bytes loaded
  9754.     dwVerticesLoaded,  // Number of vertices loaded
  9755.     dwFacesLoaded : DWORD;     // Number of faces loaded
  9756.     dwLoadResult : HResult;    // Result of the load operation
  9757.     dwFlags : DWORD;
  9758.   end;
  9759.  
  9760.   PD3DRMUserVisualReason = ^TD3DRMUserVisualReason;
  9761.   TD3DRMUserVisualReason = (
  9762.     D3DRMUSERVISUAL_CANSEE,
  9763.     D3DRMUSERVISUAL_RENDER
  9764.   );
  9765.  
  9766.   PD3DRMAnimationKey = ^TD3DRMAnimationKey;
  9767.   TD3DRMAnimationKey = packed record
  9768.     dwSize : DWORD;
  9769.     dwKeyType : DWORD;
  9770.     dvTime : TD3DValue;
  9771.     dwID : DWORD;
  9772.     case integer of
  9773.       0 : (dqRotateKey : TD3DRMQuaternion);
  9774.       1 : (dvScaleKey : TD3DVector);
  9775.       2 : (dvPositionKey : TD3DVector);
  9776.       3 : (dvK : array [0..3] of TD3DValue);
  9777.     end;
  9778.  
  9779. procedure D3DRMAnimationGetRotateKey
  9780.     (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  9781.  
  9782. procedure D3DRMAnimationGetScaleKey
  9783.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9784.  
  9785. procedure D3DRMAnimationGetPositionKey
  9786.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9787.  
  9788. procedure D3DRMAnimatioSetRotateKey
  9789.     (var rmKey: TD3DRMAnimationKey; var rmQuat: TD3DRMQuaternion);
  9790.  
  9791. procedure D3DRMAnimationSetScaleKey
  9792.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9793.  
  9794. procedure D3DRMAnimationSetPositionKey
  9795.     (var rmKey: TD3DRMAnimationKey; var dvVec: TD3DVector);
  9796.  
  9797. const
  9798.   D3DRMANIMATION_ROTATEKEY = 01;
  9799.   D3DRMANIMATION_SCALEKEY = 02;
  9800.   D3DRMANIMATION_POSITIONKEY = 03;
  9801.  
  9802. type
  9803.   TD3DRMMapping = DWORD;
  9804.   PD3DRMMappingFlag = ^TD3DRMMappingFlag;
  9805.   TD3DRMMappingFlag = DWORD;
  9806.  
  9807. const
  9808.   D3DRMMAP_WRAPU = 1;
  9809.   D3DRMMAP_WRAPV = 2;
  9810.   D3DRMMAP_PERSPCORRECT = 4;
  9811.  
  9812. type
  9813.   PD3DRMVertex = ^TD3DRMVertex;
  9814.   TD3DRMVertex = packed record
  9815.     position: TD3DVector;
  9816.     normal: TD3DVector;
  9817.     tu, tv: TD3DValue;
  9818.     color: TD3DColor;
  9819.   end;
  9820.  
  9821.   TD3DRMGroupIndex = LongInt; (* group indexes begin a 0 *)
  9822.  
  9823. const
  9824.   D3DRMGROUP_ALLGROUPS = -1;
  9825.  
  9826. var
  9827. (*
  9828.  * Create a color from three components in the range 0-1 inclusive.
  9829.  *)
  9830.   D3DRMCreateColorRGB : function (red, green, blue: TD3DValue) : TD3DColor;
  9831.       stdcall;
  9832.  
  9833. (*
  9834.  * Create a color from four components in the range 0-1 inclusive.
  9835.  *)
  9836.   D3DRMCreateColorRGBA : function (red, green, blue, alpha: TD3DValue)
  9837.       : TD3DColor; stdcall;
  9838.  
  9839. (*
  9840.  * Get the red component of a color.
  9841.  *)
  9842.   D3DRMColorGetRed : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9843.  
  9844. (*
  9845.  * Get the green component of a color.
  9846.  *)
  9847.   D3DRMColorGetGreen : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9848.  
  9849. (*
  9850.  * Get the blue component of a color.
  9851.  *)
  9852.   D3DRMColorGetBlue : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9853.  
  9854. (*
  9855.  * Get the alpha component of a color.
  9856.  *)
  9857.   D3DRMColorGetAlpha : function (d3drmc: TD3DColor) : TD3DValue; stdcall;
  9858.  
  9859. (*
  9860.  * Add two vectors.  Returns its first argument.
  9861.  *)
  9862.   D3DRMVectorAdd : function (var d, s1, s2: TD3DVector) : PD3DVector; stdcall;
  9863.  
  9864. (*
  9865.  * Subtract two vectors.  Returns its first argument.
  9866.  *)
  9867.   D3DRMVectorSubtract : function (var d, s1, s2: TD3DVector) : PD3DVector;
  9868.       stdcall;
  9869.  
  9870. (*
  9871.  * Reflect a ray about a given normal.  Returns its first argument.
  9872.  *)
  9873.   D3DRMVectorReflect : function (var d, ray, norm: TD3DVector) : PD3DVector;
  9874.       stdcall;
  9875.  
  9876. (*
  9877.  * Calculate the vector cross product.  Returns its first argument.
  9878.  *)
  9879.   D3DRMVectorCrossProduct : function (var d, s1, s2: TD3DVector) : PD3DVector;
  9880.       stdcall;
  9881.  
  9882. (*
  9883.  * Return the vector dot product.
  9884.  *)
  9885.   D3DRMVectorDotProduct : function (var s1, s2: TD3DVector) : TD3DValue;
  9886.       stdcall;
  9887.  
  9888. (*
  9889.  * Scale a vector so that its modulus is 1.  Returns its argument or
  9890.  * NULL if there was an error (e.g. a zero vector was passed).
  9891.  *)
  9892.   D3DRMVectorNormalize : function (var lpv: TD3DVector) : PD3DVector; stdcall;
  9893.  
  9894. (*
  9895.  * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
  9896.  *)
  9897.   D3DRMVectorModulus : function (var v: TD3DVector) : TD3DValue; stdcall;
  9898.  
  9899. (*
  9900.  * Set the rotation part of a matrix to be a rotation of theta radians
  9901.  * around the given axis.
  9902.  *)
  9903.   D3DRMVectorRotate : function (var r, v, axis: TD3DVector; theta: TD3DValue) :
  9904.       PD3DVector; stdcall;
  9905.  
  9906. (*
  9907.  * Scale a vector uniformly in all three axes
  9908.  *)
  9909.   D3DRMVectorScale : function (var d, s: TD3DVector; factor: TD3DValue) :
  9910.       PD3DVector; stdcall;
  9911.  
  9912. (*
  9913.  * Return a random unit vector
  9914.  *)
  9915.   D3DRMVectorRandom : function (var d: TD3DVector) : PD3DVector; stdcall;
  9916.  
  9917. (*
  9918.  * Returns a unit quaternion that represents a rotation of theta radians
  9919.  * around the given axis.
  9920.  *)
  9921.  
  9922.   D3DRMQuaternionFromRotation : function (var quat: TD3DRMQuaternion;
  9923.       var v: TD3DVector; theta: TD3DValue) : PD3DRMQuaternion; stdcall;
  9924.  
  9925. (*
  9926.  * Calculate the product of two quaternions
  9927.  *)
  9928.   D3DRMQuaternionMultiply : function (var q, a, b: TD3DRMQuaternion) :
  9929.       PD3DRMQuaternion; stdcall;
  9930.  
  9931. (*
  9932.  * Interpolate between two quaternions
  9933.  *)
  9934.   D3DRMQuaternionSlerp : function (var q, a, b: TD3DRMQuaternion;
  9935.       alpha: TD3DValue) : PD3DRMQuaternion; stdcall;
  9936.  
  9937. (*
  9938.  * Calculate the matrix for the rotation that a unit quaternion represents
  9939.  *)
  9940.   D3DRMMatrixFromQuaternion : procedure (dmMat: TD3DRMMatrix4D; var lpDqQuat:
  9941.       TD3DRMQuaternion); stdcall;
  9942.  
  9943. (*
  9944.  * Calculate the quaternion that corresponds to a rotation matrix
  9945.  *)
  9946.   D3DRMQuaternionFromMatrix : function (var lpQuat: TD3DRMQuaternion;
  9947.       Mat: TD3DRMMatrix4D) : PD3DRMQuaternion; stdcall;
  9948.  
  9949. (*==========================================================================;
  9950.  *
  9951.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  9952.  *
  9953.  *  File:       d3drmobj.h
  9954.  *  Content:    Direct3DRM include file
  9955.  *
  9956.  ***************************************************************************)
  9957.  
  9958. (*
  9959.  * Direct3DRM Object classes
  9960.  *)
  9961.  
  9962. const
  9963.   CLSID_CDirect3DRMDevice: TGUID =
  9964.       (D1:$4fa3568e;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9965.   CLSID_CDirect3DRMViewport: TGUID =
  9966.       (D1:$4fa3568f;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9967.   CLSID_CDirect3DRMFrame: TGUID =
  9968.       (D1:$4fa35690;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9969.   CLSID_CDirect3DRMMesh: TGUID =
  9970.       (D1:$4fa35691;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9971.   CLSID_CDirect3DRMMeshBuilder: TGUID =
  9972.       (D1:$4fa35692;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9973.   CLSID_CDirect3DRMFace: TGUID =
  9974.       (D1:$4fa35693;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9975.   CLSID_CDirect3DRMLight: TGUID =
  9976.       (D1:$4fa35694;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9977.   CLSID_CDirect3DRMTexture: TGUID =
  9978.       (D1:$4fa35695;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9979.   CLSID_CDirect3DRMWrap: TGUID =
  9980.       (D1:$4fa35696;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9981.   CLSID_CDirect3DRMMaterial: TGUID =
  9982.       (D1:$4fa35697;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9983.   CLSID_CDirect3DRMAnimation: TGUID =
  9984.       (D1:$4fa35698;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9985.   CLSID_CDirect3DRMAnimationSet: TGUID =
  9986.       (D1:$4fa35699;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9987.   CLSID_CDirect3DRMUserVisual: TGUID =
  9988.       (D1:$4fa3569a;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9989.   CLSID_CDirect3DRMShadow: TGUID =
  9990.       (D1:$4fa3569b;D2:$623f;D3:$11cf;D4:($ac,$4a,$00,$00,$c0,$38,$25,$a1));
  9991.   CLSID_CDirect3DRMViewportInterpolator: TGUID =
  9992.       (D1:$0de9eaa1;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  9993.   CLSID_CDirect3DRMFrameInterpolator: TGUID =
  9994.       (D1:$0de9eaa2;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  9995.   CLSID_CDirect3DRMMeshInterpolator: TGUID =
  9996.       (D1:$0de9eaa3;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  9997.   CLSID_CDirect3DRMLightInterpolator: TGUID =
  9998.       (D1:$0de9eaa6;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  9999.   CLSID_CDirect3DRMMaterialInterpolator: TGUID =
  10000.       (D1:$0de9eaa7;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10001.   CLSID_CDirect3DRMTextureInterpolator: TGUID =
  10002.       (D1:$0de9eaa8;D2:$3b84;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10003.   CLSID_CDirect3DRMProgressiveMesh: TGUID =
  10004.       (D1:$4516ec40;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  10005.   CLSID_CDirect3DRMClippedVisual: TGUID =
  10006.       (D1:$5434e72d;D2:$6d66;D3:$11d1;D4:($bb,$0b,$00,$00,$f8,$75,$86,$5a));
  10007.  
  10008.  
  10009.  
  10010. type
  10011.   IDirect3DRMObject = interface;
  10012.   IDirect3DRMDevice = interface;
  10013.   IDirect3DRMDevice2 = interface;
  10014.   IDirect3DRMDevice3 = interface;
  10015.   IDirect3DRMViewport = interface;
  10016.   IDirect3DRMViewport2 = interface;
  10017.   IDirect3DRMFrame = interface;
  10018.   IDirect3DRMFrame2 = interface;
  10019.   IDirect3DRMFrame3 = interface;
  10020.   IDirect3DRMVisual = interface;
  10021.   IDirect3DRMMesh = interface;
  10022.   IDirect3DRMMeshBuilder = interface;
  10023.   IDirect3DRMMeshBuilder2 = interface;
  10024.   IDirect3DRMMeshBuilder3 = interface;
  10025.   IDirect3DRMFace = interface;
  10026.   IDirect3DRMFace2 = interface;
  10027.   IDirect3DRMLight = interface;
  10028.   IDirect3DRMTexture = interface;
  10029.   IDirect3DRMTexture2 = interface;
  10030.   IDirect3DRMTexture3 = interface;
  10031.   IDirect3DRMWrap = interface;
  10032.   IDirect3DRMMaterial = interface;
  10033.   IDirect3DRMMaterial2 = interface;
  10034.   IDirect3DRMAnimation = interface;
  10035.   IDirect3DRMAnimation2 = interface;
  10036.   IDirect3DRMAnimationSet = interface;
  10037.   IDirect3DRMAnimationSet2 = interface;
  10038.   IDirect3DRMArray = interface;
  10039.   IDirect3DRMObjectArray = interface;
  10040.   IDirect3DRMDeviceArray = interface;
  10041.   IDirect3DRMViewportArray = interface;
  10042.   IDirect3DRMFrameArray = interface;
  10043.   IDirect3DRMVisualArray = interface;
  10044.   IDirect3DRMLightArray = interface;
  10045.   IDirect3DRMPickedArray = interface;
  10046.   IDirect3DRMFaceArray = interface;
  10047.   IDirect3DRMAnimationArray = interface;
  10048.   IDirect3DRMUserVisual = interface;
  10049.   IDirect3DRMShadow = interface;
  10050.   IDirect3DRMShadow2 = interface;
  10051.   IDirect3DRMInterpolator = interface;
  10052.   IDirect3DRMProgressiveMesh = interface;
  10053.   IDirect3DRMPicked2Array = interface;
  10054.   IDirect3DRMClippedVisual = interface;
  10055.  
  10056. (*
  10057.  * Direct3DRM Object interfaces
  10058.  *)
  10059.   IID_IDirect3DRMObject =          IDirect3DRMObject;
  10060.   IID_IDirect3DRMDevice =          IDirect3DRMDevice;
  10061.   IID_IDirect3DRMDevice2 =         IDirect3DRMDevice2;
  10062.   IID_IDirect3DRMDevice3 =         IDirect3DRMDevice3;
  10063.   IID_IDirect3DRMViewport =        IDirect3DRMViewport;
  10064.   IID_IDirect3DRMViewport2 =       IDirect3DRMViewport2;
  10065.   IID_IDirect3DRMFrame =           IDirect3DRMFrame;
  10066.   IID_IDirect3DRMFrame2 =          IDirect3DRMFrame2;
  10067.   IID_IDirect3DRMFrame3 =          IDirect3DRMFrame3;
  10068.   IID_IDirect3DRMVisual =          IDirect3DRMVisual;
  10069.   IID_IDirect3DRMMesh =            IDirect3DRMMesh;
  10070.   IID_IDirect3DRMMeshBuilder =     IDirect3DRMMeshBuilder;
  10071.   IID_IDirect3DRMMeshBuilder2 =    IDirect3DRMMeshBuilder2;
  10072.   IID_IDirect3DRMMeshBuilder3 =    IDirect3DRMMeshBuilder3;
  10073.   IID_IDirect3DRMFace =            IDirect3DRMFace;
  10074.   IID_IDirect3DRMFace2 =           IDirect3DRMFace2;
  10075.   IID_IDirect3DRMLight =           IDirect3DRMLight;
  10076.   IID_IDirect3DRMTexture =         IDirect3DRMTexture;
  10077.   IID_IDirect3DRMTexture2 =        IDirect3DRMTexture2;
  10078.   IID_IDirect3DRMTexture3 =        IDirect3DRMTexture3;
  10079.   IID_IDirect3DRMWrap =            IDirect3DRMWrap;
  10080.   IID_IDirect3DRMMaterial =        IDirect3DRMMaterial;
  10081.   IID_IDirect3DRMMaterial2 =       IDirect3DRMMaterial2;
  10082.   IID_IDirect3DRMAnimation =       IDirect3DRMAnimation;
  10083.   IID_IDirect3DRMAnimation2 =      IDirect3DRMAnimation2;
  10084.   IID_IDirect3DRMAnimationSet =    IDirect3DRMAnimationSet;
  10085.   IID_IDirect3DRMAnimationSet2 =   IDirect3DRMAnimationSet2;
  10086.   IID_IDirect3DRMObjectArray =     IDirect3DRMObjectArray;
  10087.   IID_IDirect3DRMDeviceArray =     IDirect3DRMDeviceArray;
  10088.   IID_IDirect3DRMViewportArray =   IDirect3DRMViewportArray;
  10089.   IID_IDirect3DRMFrameArray =      IDirect3DRMFrameArray;
  10090.   IID_IDirect3DRMVisualArray =     IDirect3DRMVisualArray;
  10091.   IID_IDirect3DRMLightArray =      IDirect3DRMLightArray;
  10092.   IID_IDirect3DRMPickedArray =     IDirect3DRMPickedArray;
  10093.   IID_IDirect3DRMFaceArray =       IDirect3DRMFaceArray;
  10094.   IID_IDirect3DRMAnimationArray =  IDirect3DRMAnimationArray;
  10095.   IID_IDirect3DRMUserVisual =      IDirect3DRMUserVisual;
  10096.   IID_IDirect3DRMShadow =          IDirect3DRMShadow;
  10097.   IID_IDirect3DRMShadow2 =         IDirect3DRMShadow2;
  10098.   IID_IDirect3DRMInterpolator =    IDirect3DRMInterpolator;
  10099.   IID_IDirect3DRMProgressiveMesh = IDirect3DRMProgressiveMesh;
  10100.   IID_IDirect3DRMPicked2Array =    IDirect3DRMPicked2Array;
  10101.   IID_IDirect3DRMClippedVisual =   IDirect3DRMClippedVisual;
  10102.  
  10103.  
  10104.  
  10105.  
  10106.  
  10107.   PIDirect3DRMFaceArray = ^IDirect3DRMFaceArray;
  10108.  
  10109.   TD3DRMObjectCallback = procedure (lpD3DRMobj: IDirect3DRMObject;
  10110.       lpArg: Pointer); cdecl;
  10111.   TD3DRMFrameMoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame;
  10112.       lpArg: Pointer; delta: TD3DValue); cdecl;
  10113.   TD3DRMFrame3MoveCallback = procedure (lpD3DRMFrame: IDirect3DRMFrame3;
  10114.       lpArg: Pointer; delta: TD3DValue); cdecl;
  10115.   TD3DRMUpdateCallback = procedure (lpobj: IDirect3DRMDevice; lpArg: Pointer;
  10116.       iRectCount: Integer; const d3dRectUpdate: TD3DRect); cdecl;
  10117.   TD3DRMDevice3UpdateCallback = procedure (lpobj: IDirect3DRMDevice3;
  10118.       lpArg: Pointer; iRectCount: Integer; const d3dRectUpdate: TD3DRect);cdecl;
  10119.   TD3DRMUserVisualCallback = function (lpD3DRMUV: IDirect3DRMUserVisual;
  10120.       lpArg: Pointer; lpD3DRMUVreason: TD3DRMUserVisualReason;
  10121.       lpD3DRMDev: IDirect3DRMDevice;
  10122.       lpD3DRMview: IDirect3DRMViewport) : Integer; cdecl;
  10123.   TD3DRMLoadTextureCallback = function (tex_name: PAnsiChar; lpArg: Pointer;
  10124.       out lpD3DRMTex: IDirect3DRMTexture) : HResult; cdecl;
  10125.   TD3DRMLoadTexture3Callback = function (tex_name: PAnsiChar; lpArg: Pointer;
  10126.       out lpD3DRMTex: IDirect3DRMTexture3) : HResult; cdecl;
  10127.   TD3DRMLoadCallback = procedure (lpObject: IDirect3DRMObject;
  10128.       const ObjectGuid: TGUID; lpArg: Pointer); cdecl;
  10129.   TD3DRMDownSampleCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
  10130.       pArg: pointer; pDDSSrc, pDDSDst: IDirectDrawSurface) : HResult; cdecl;
  10131.   TD3DRMValidationCallback = function (lpDirect3DRMTexture: IDirect3DRMTexture3;
  10132.       pArg: pointer; dwFlags, DWcRects: DWORD; const pRects: TRect) : HResult; cdecl;
  10133.  
  10134.   PD3DRMPickDesc = ^TD3DRMPickDesc;
  10135.   TD3DRMPickDesc = packed record
  10136.     ulFaceIdx: DWORD;
  10137.     lGroupIdx: LongInt;
  10138.     vPosition: TD3DVector;
  10139.   end;
  10140.  
  10141.   PD3DRMPickDesc2 = ^TD3DRMPickDesc2;
  10142.   TD3DRMPickDesc2 = packed record
  10143.     ulFaceIdx: DWORD;
  10144.     lGroupIdx: LongInt;
  10145.     dvPosition: TD3DVector;
  10146.     tu, tv: TD3DValue;
  10147.     dvNormal: TD3DVector;
  10148.     dcColor: TD3DColor;
  10149.   end;
  10150.  
  10151. (*
  10152.  * Base class
  10153.  *)
  10154. {$IFDEF D2COM}
  10155.   IDirect3DRMObject = class (IUnknown)
  10156. {$ELSE}
  10157.   IDirect3DRMObject = interface (IUnknown)
  10158.     ['{eb16cb00-d271-11ce-ac48-0000c03825a1}']
  10159. {$ENDIF}
  10160.     (*
  10161.      * The methods for IDirect3DRMObject
  10162.      *)
  10163.     function Clone (pUnkOuter: IUnknown; riid: TGUID;
  10164.         var ppvObj: Pointer) : HResult; stdcall;
  10165.     function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
  10166.         lpArg: Pointer) : HResult; stdcall;
  10167.     function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
  10168.         lpArg: Pointer) : HResult; stdcall;
  10169.     function SetAppData (ulData: DWORD) : HResult; stdcall;
  10170.     function GetAppData: DWORD; stdcall;
  10171.     function SetName (lpName: PAnsiChar) : HResult; stdcall;
  10172.     function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  10173.     function GetClassName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  10174.   end;
  10175.  
  10176.   IDirect3DRMVisual = interface (IDirect3DRMObject)
  10177.   end;
  10178.  
  10179.   IDirect3DRMDevice = interface (IDirect3DRMObject)
  10180.     ['{e9e19280-6e05-11cf-ac4a-0000c03825a1}']
  10181.     (*
  10182.      * IDirect3DRMDevice methods
  10183.      *)
  10184.     function Init (width: LongInt; height: LongInt) : HResult; stdcall;
  10185.     function InitFromD3D (lpD3D: IDirect3D; lpD3DIMDev: IDirect3DDevice) : HResult; stdcall;
  10186.     function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
  10187.         width: Integer; height: Integer) : HResult; stdcall;
  10188.     function Update: HResult; stdcall;
  10189.     function AddUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
  10190.         arg: Pointer) : HResult; stdcall;
  10191.     function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMUpdateCallback;
  10192.         arg: Pointer) : HResult; stdcall;
  10193.     function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
  10194.     function GetBufferCount: DWORD; stdcall;
  10195.     function SetDither (bDither: BOOL) : HResult; stdcall;
  10196.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10197.     function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
  10198.     function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
  10199.     function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
  10200.     function GetDither: BOOL; stdcall;
  10201.     function GetShades: DWORD; stdcall;
  10202.     function GetHeight: DWORD; stdcall;
  10203.     function GetWidth: DWORD; stdcall;
  10204.     function GetTrianglesDrawn: DWORD; stdcall;
  10205.     function GetWireframeOptions: DWORD; stdcall;
  10206.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10207.     function GetColorModel: TD3DColorModel; stdcall;
  10208.     function GetTextureQuality: TD3DRMTextureQuality; stdcall;
  10209.     function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
  10210.   end;
  10211.  
  10212.   IDirect3DRMDevice2 = interface (IDirect3DRMDevice)
  10213.     ['{4516ec78-8f20-11d0-9b6d-0000c0781bc3}']
  10214.     (*
  10215.      * IDirect3DRMDevice2 methods
  10216.      *)
  10217.     function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10218.     function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw; lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
  10219.     function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
  10220.     function GetRenderMode : DWORD; stdcall;
  10221.     function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
  10222.   end;
  10223.  
  10224.   IDirect3DRMDevice3 = interface (IDirect3DRMObject)
  10225.     ['{549f498b-bfeb-11d1-8ed8-00a0c967a482}']
  10226.     (*
  10227.      * IDirect3DRMDevice methods
  10228.      *)
  10229.     function Init (width: LongInt; height: LongInt) : HResult; stdcall;
  10230.     function InitFromD3D (lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10231.     function InitFromClipper (lpDDClipper: IDirectDrawClipper; lpGUID: PGUID;
  10232.         width: Integer; height: Integer) : HResult; stdcall;
  10233.     function Update: HResult; stdcall;
  10234.     function AddUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
  10235.         arg: Pointer) : HResult; stdcall;
  10236.     function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMDevice3UpdateCallback;
  10237.         arg: Pointer) : HResult; stdcall;
  10238.     function SetBufferCount (dwCount: DWORD) : HResult; stdcall;
  10239.     function GetBufferCount: DWORD; stdcall;
  10240.     function SetDither (bDither: BOOL) : HResult; stdcall;
  10241.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10242.     function SetQuality (rqQuality: TD3DRMRenderQuality) : HResult; stdcall;
  10243.     function SetTextureQuality (tqTextureQuality: TD3DRMTextureQuality) : HResult; stdcall;
  10244.     function GetViewports (out lplpViewports: IDirect3DRMViewportArray) : HResult; stdcall;
  10245.     function GetDither: BOOL; stdcall;
  10246.     function GetShades: DWORD; stdcall;
  10247.     function GetHeight: DWORD; stdcall;
  10248.     function GetWidth: DWORD; stdcall;
  10249.     function GetTrianglesDrawn: DWORD; stdcall;
  10250.     function GetWireframeOptions: DWORD; stdcall;
  10251.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10252.     function GetColorModel: TD3DColorModel; stdcall;
  10253.     function GetTextureQuality: TD3DRMTextureQuality; stdcall;
  10254.     function GetDirect3DDevice (out lplpD3DDevice: IDirect3DDevice) : HResult; stdcall;
  10255.     (*
  10256.      * IDirect3DRMDevice2 methods
  10257.      *)
  10258.     function InitFromD3D2(lpD3D: IDirect3D2; lpD3DIMDev: IDirect3DDevice2) : HResult; stdcall;
  10259.     function InitFromSurface(const lpGUID: TGUID; lpDD: IDirectDraw;
  10260.             lpDDSBack: IDirectDrawSurface) : HResult; stdcall;
  10261.     function SetRenderMode(dwFlags: DWORD ) : HResult; stdcall;
  10262.     function GetRenderMode : DWORD; stdcall;
  10263.     function GetDirect3DDevice2(out lplpD3DDevice: IDirect3DDevice2) : HResult; stdcall;
  10264.     (*
  10265.      * IDirect3DRMDevice3 methods
  10266.      *)
  10267.     function FindPreferredTextureFormat (dwBitDepths, dwFlags: DWORD;
  10268.         out lpDDPF: TDDPixelFormat) : HResult; stdcall;
  10269.     function RenderStateChange (dwStateNum, dwVal, dwFlags: DWORD) : HResult; stdcall;
  10270.  
  10271.     function LightStateChange (drsType: TD3DLightStateType; // defined different in header and help
  10272.         dwVal, dwFlags: DWORD) : HResult; stdcall;
  10273.     function GetStateChangeOptions (dwStateClass, dwStateNum: DWORD;
  10274.         var pdwFlags: DWORD) : HResult; stdcall;
  10275.     function SetStateChangeOptions ( dwStateClass, dwStateNum, dwFlags: DWORD) : HResult; stdcall;
  10276.   end;
  10277.  
  10278.   IDirect3DRMViewport = interface (IDirect3DRMObject)
  10279.     ['{eb16cb02-d271-11ce-ac48-0000c03825a1}']
  10280.     (*
  10281.      * IDirect3DRMViewport methods
  10282.      *)
  10283.     function Init (lpD3DRMDevice: IDirect3DRMDevice;
  10284.         lpD3DRMFrameCamera: IDirect3DRMFrame; xpos, ypos,
  10285.         width, height: DWORD) : HResult; stdcall;
  10286.     function Clear: HResult; stdcall;
  10287.     function Render (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  10288.     function SetFront (rvFront: TD3DValue) : HResult; stdcall;
  10289.     function SetBack (rvBack: TD3DValue) : HResult; stdcall;
  10290.     function SetField (rvField: TD3DValue) : HResult; stdcall;
  10291.     function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
  10292.     function SetCamera (lpCamera: IDirect3DRMFrame) : HResult; stdcall;
  10293.     function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
  10294.     function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
  10295.     function InverseTransform (out lprvDst: TD3DVector;
  10296.         const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
  10297.     function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
  10298.     function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
  10299.     function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
  10300.     function GetCamera (out lpCamera: IDirect3DRMFrame) : HResult; stdcall;
  10301.     function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
  10302.     function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
  10303.         TD3DValue) : HResult; stdcall;
  10304.     function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
  10305.     function GetUniformScaling: BOOL;  stdcall;
  10306.     function GetX: LongInt; stdcall;
  10307.     function GetY: LongInt; stdcall;
  10308.     function GetWidth: DWORD; stdcall;
  10309.     function GetHeight: DWORD; stdcall;
  10310.     function GetField: TD3DValue; stdcall;
  10311.     function GetBack: TD3DValue; stdcall;
  10312.     function GetFront: TD3DValue; stdcall;
  10313.     function GetProjection: TD3DRMProjectionType; stdcall;
  10314.     function GetDirect3DViewport (out lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
  10315.   end;
  10316.  
  10317.   IDirect3DRMViewport2 = interface (IDirect3DRMObject)
  10318.     ['{4a1b1be6-bfed-11d1-8ed8-00a0c967a482}']
  10319.     (*
  10320.      * IDirect3DRMViewport2 methods
  10321.      *)
  10322.     function Init (lpD3DRMDevice: IDirect3DRMDevice3;
  10323.         lpD3DRMFrameCamera: IDirect3DRMFrame3; xpos, ypos,
  10324.         width, height: DWORD) : HResult; stdcall;
  10325.     function Clear (dwFlags: DWORD): HResult; stdcall;
  10326.     function Render (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  10327.     function SetFront (rvFront: TD3DValue) : HResult; stdcall;
  10328.     function SetBack (rvBack: TD3DValue) : HResult; stdcall;
  10329.     function SetField (rvField: TD3DValue) : HResult; stdcall;
  10330.     function SetUniformScaling (bScale: BOOL) : HResult; stdcall;
  10331.     function SetCamera (lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
  10332.     function SetProjection (rptType: TD3DRMProjectionType) : HResult; stdcall;
  10333.     function Transform (out lprvDst: TD3DRMVector4D; const lprvSrc: TD3DVector) : HResult; stdcall;
  10334.     function InverseTransform (out lprvDst: TD3DVector;
  10335.         const lprvSrc: TD3DRMVector4D) : HResult; stdcall;
  10336.     function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD) : HResult; stdcall;
  10337.     function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD) : HResult; stdcall;
  10338.     function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DValue) : HResult; stdcall;
  10339.     function GetCamera (out lpCamera: IDirect3DRMFrame3) : HResult; stdcall;
  10340.     function GetDevice (out lpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  10341.     function GetPlane (out lpd3dvLeft, lpd3dvRight, lpd3dvBottom, lpd3dvTop:
  10342.         TD3DValue) : HResult; stdcall;
  10343.     function Pick (lX, lY: LongInt; var lplpVisuals: IDirect3DRMPickedArray) : HResult; stdcall;
  10344.     function GetUniformScaling: BOOL; stdcall;
  10345.     function GetX: LongInt; stdcall;
  10346.     function GetY: LongInt; stdcall;
  10347.     function GetWidth: DWORD; stdcall;
  10348.     function GetHeight: DWORD; stdcall;
  10349.     function GetField: TD3DValue; stdcall;
  10350.     function GetBack: TD3DValue; stdcall;
  10351.     function GetFront: TD3DValue; stdcall;
  10352.     function GetProjection: TD3DRMProjectionType; stdcall;
  10353.     function GetDirect3DViewport (var lplpD3DViewport: IDirect3DViewport) : HResult; stdcall;
  10354.     function TransformVectors (dwNumVectors: DWORD; out lpDstVectors:
  10355.         TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10356.     function InverseTransformVectors (dwNumVectors: DWORD; out lpDstVectors:
  10357.         TD3DRMVector4D; const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10358.   end;
  10359.  
  10360.   IDirect3DRMFrame = interface (IDirect3DRMVisual)
  10361.     ['{eb16cb03-d271-11ce-ac48-0000c03825a1}']
  10362.     (*
  10363.      * IDirect3DRMFrame methods
  10364.      *)
  10365.     function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame) : HResult; stdcall;
  10366.     function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10367.     function AddMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
  10368.         lpArg: Pointer) : HResult; stdcall;
  10369.     function AddTransform (rctCombine: TD3DRMCombineType;
  10370.         rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10371.     function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
  10372.         TD3DValue) : HResult; stdcall;
  10373.     function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10374.     function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
  10375.         rvTheta: TD3DValue) : HResult; stdcall;
  10376.     function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10377.     function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
  10378.     function GetColor: TD3DColor; stdcall;
  10379.     function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
  10380.     function GetMaterialMode: TD3DRMMaterialMode; stdcall;
  10381.     function GetParent (out lplpParent: IDirect3DRMFrame) : HResult; stdcall;
  10382.     function GetPosition (lpRef: IDirect3DRMFrame; out lprvPos: TD3DVector) : HResult; stdcall;
  10383.     function GetRotation (lpRef: IDirect3DRMFrame; out lprvAxis: TD3DVector;
  10384.         out lprvTheta: TD3DValue) : HResult; stdcall;
  10385.     function GetScene (out lplpRoot: IDirect3DRMFrame) : HResult; stdcall;
  10386.     function GetSortMode: TD3DRMSortMode; stdcall;
  10387.     function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10388.     function GetTransform (out rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10389.     function GetVelocity (lpRef: IDirect3DRMFrame; var lprvVel: TD3DVector;
  10390.         fRotVel: BOOL) : HResult; stdcall;
  10391.     function GetOrientation (lpRef: IDirect3DRMFrame; var lprvDir: TD3DVector;
  10392.         var lprvUp: TD3DVector) : HResult; stdcall;
  10393.     function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
  10394.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10395.     function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
  10396.     function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
  10397.         d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
  10398.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer) : HResult; stdcall;
  10399.     function LookAt (lpTarget, lpRef: IDirect3DRMFrame;
  10400.         rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
  10401.     function Move (delta: TD3DValue) : HResult; stdcall;
  10402.     function DeleteChild (lpChild: IDirect3DRMFrame) : HResult; stdcall;
  10403.     function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10404.     function DeleteMoveCallback (d3drmFMC: TD3DRMFrameMoveCallback;
  10405.         lpArg: Pointer) : HResult; stdcall;
  10406.     function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10407.     function GetSceneBackground: TD3DColor; stdcall;
  10408.     function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  10409.     function GetSceneFogColor: TD3DColor; stdcall;
  10410.     function GetSceneFogEnable: BOOL; stdcall;
  10411.     function GetSceneFogMode: TD3DRMFogMode; stdcall;
  10412.     function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
  10413.     function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
  10414.     function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10415.     function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
  10416.     function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10417.     function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
  10418.     function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
  10419.     function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
  10420.     function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
  10421.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10422.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10423.     function GetZbufferMode: TD3DRMZBufferMode; stdcall;
  10424.     function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
  10425.     function SetOrientation (lpRef: IDirect3DRMFrame; rvDx, rvDy, rvDz, rvUx,
  10426.         rvUy, rvUz: TD3DValue) : HResult; stdcall;
  10427.     function SetPosition (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10428.     function SetRotation (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ,
  10429.         rvTheta: TD3DValue) : HResult; stdcall;
  10430.     function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
  10431.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10432.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10433.     function SetVelocity (lpRef: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DValue;
  10434.         fRotVel: BOOL) : HResult; stdcall;
  10435.     function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
  10436.     function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
  10437.   end;
  10438.  
  10439.   IDirect3DRMFrame2 = interface (IDirect3DRMFrame)
  10440.     ['{c3dfbd60-3988-11d0-9ec2-0000c0291ac3}']
  10441.     (*
  10442.      * IDirect3DRMFrame2 methods
  10443.      *)
  10444.     function AddMoveCallback2 (d3drmFMC: TD3DRMFrameMoveCallback; lpArg:
  10445.         Pointer; dwFlags: DWORD) : HResult; stdcall;
  10446.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10447.     function GetBoxEnable : boolean; stdcall;
  10448.     function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
  10449.     function GetMaterial (out lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10450.     function GetInheritAxes : boolean; stdcall;
  10451.     function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10452.     function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10453.     function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
  10454.     function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
  10455.     function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
  10456.     function SetMaterial (var lplpMaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10457.     function SetQuaternion (lpRef: IDirect3DRMFrame;
  10458.         const quat: TD3DRMQuaternion) : HResult; stdcall;
  10459.     function RayPick (lpRefFrame: IDirect3DRMFrame; var ray: TD3DRMRay;
  10460.         dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) :
  10461.         HResult; stdcall;
  10462.     function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
  10463.         d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
  10464.   end;
  10465.  
  10466.   IDirect3DRMFrame3 = interface (IDirect3DRMVisual)
  10467.     ['{ff6b7f70-a40e-11d1-91f9-0000f8758e66}']
  10468.     (*
  10469.      * IDirect3DRMFrame3 methods
  10470.      *)
  10471.     function AddChild (lpD3DRMFrameChild: IDirect3DRMFrame3) : HResult; stdcall;
  10472.     function AddLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10473.     function AddMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback;
  10474.         lpArg: Pointer; dwFlags: DWORD) : HResult; stdcall;
  10475.     function AddTransform (rctCombine: TD3DRMCombineType;
  10476.         rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10477.     function AddTranslation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ:
  10478.         TD3DValue) : HResult; stdcall;
  10479.     function AddScale (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10480.     function AddRotation (rctCombine: TD3DRMCombineType; rvX, rvY, rvZ,
  10481.         rvTheta: TD3DValue) : HResult; stdcall;
  10482.     function AddVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10483.     function GetChildren (out lplpChildren: IDirect3DRMFrameArray) : HResult; stdcall;
  10484.     function GetColor: TD3DColor; stdcall;
  10485.     function GetLights (out lplpLights: IDirect3DRMLightArray) : HResult; stdcall;
  10486.     function GetMaterialMode: TD3DRMMaterialMode; stdcall;
  10487.     function GetParent (out lplpParent: IDirect3DRMFrame3) : HResult; stdcall;
  10488.     function GetPosition (lpRef: IDirect3DRMFrame3; out lprvPos: TD3DVector) : HResult; stdcall;
  10489.     function GetRotation (lpRef: IDirect3DRMFrame3; out lprvAxis: TD3DVector;
  10490.         out lprvTheta: TD3DValue) : HResult; stdcall;
  10491.     function GetScene (out lplpRoot: IDirect3DRMFrame3) : HResult; stdcall;
  10492.     function GetSortMode: TD3DRMSortMode; stdcall;
  10493.     function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10494.     function GetTransform (lpRefFrame: IDirect3DRMFrame3;
  10495.         var rmMatrix: TD3DRMMatrix4D) : HResult; stdcall;
  10496.     function GetVelocity (lpRef: IDirect3DRMFrame3; out lprvVel: TD3DVector;
  10497.         fRotVel: BOOL) : HResult; stdcall;
  10498.     function GetOrientation (lpRef: IDirect3DRMFrame3; out lprvDir: TD3DVector;
  10499.         out lprvUp: TD3DVector) : HResult; stdcall;
  10500.     function GetVisuals (out lplpVisuals: IDirect3DRMVisualArray) : HResult; stdcall;
  10501.     function InverseTransform (out lprvDst: TD3DVector; const lprvSrc: TD3DVector) : HResult; stdcall;
  10502.     function Load (lpvObjSource: Pointer; lpvObjID: Pointer;
  10503.         d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadTextureProc:
  10504.         TD3DRMLoadTexture3Callback; lpArgLTP: Pointer) : HResult; stdcall;
  10505.     function LookAt (lpTarget, lpRef: IDirect3DRMFrame3;
  10506.         rfcConstraint: TD3DRMFrameConstraint ) : HResult; stdcall;
  10507.     function Move (delta: TD3DValue) : HResult; stdcall;
  10508.     function DeleteChild (lpChild: IDirect3DRMFrame3) : HResult; stdcall;
  10509.     function DeleteLight (lpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10510.     function DeleteMoveCallback (d3drmFMC: TD3DRMFrame3MoveCallback; lpArg: Pointer) : HResult; stdcall;
  10511.     function DeleteVisual (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10512.     function GetSceneBackground: TD3DColor; stdcall;
  10513.     function GetSceneBackgroundDepth (out lplpDDSurface: IDirectDrawSurface) : HResult; stdcall;
  10514.     function GetSceneFogColor: TD3DColor; stdcall;
  10515.     function GetSceneFogEnable: BOOL; stdcall;
  10516.     function GetSceneFogMode: TD3DRMFogMode; stdcall;
  10517.     function GetSceneFogParams (out lprvStart, lprvEnd, lprvDensity: TD3DValue) : HResult; stdcall;
  10518.     function SetSceneBackground (rcColor: TD3DColor) : HResult; stdcall;
  10519.     function SetSceneBackgroundRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10520.     function SetSceneBackgroundDepth (lpImage: IDirectDrawSurface) : HResult; stdcall;
  10521.     function SetSceneBackgroundImage (lpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10522.     function SetSceneFogEnable (bEnable: BOOL) : HResult; stdcall;
  10523.     function SetSceneFogColor (rcColor: TD3DColor) : HResult; stdcall;
  10524.     function SetSceneFogMode (rfMode: TD3DRMFogMode) : HResult; stdcall;
  10525.     function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DValue) : HResult; stdcall;
  10526.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10527.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10528.     function GetZbufferMode: TD3DRMZBufferMode; stdcall;
  10529.     function SetMaterialMode (rmmMode: TD3DRMMaterialMode) : HResult; stdcall;
  10530.     function SetOrientation (lpRef: IDirect3DRMFrame3; rvDx, rvDy, rvDz, rvUx,
  10531.         rvUy, rvUz: TD3DValue) : HResult; stdcall;
  10532.     function SetPosition (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue) :
  10533.         HResult; stdcall;
  10534.     function SetRotation (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ,
  10535.         rvTheta: TD3DValue) : HResult; stdcall;
  10536.     function SetSortMode (d3drmSM: TD3DRMSortMode) : HResult; stdcall;
  10537.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10538.     function SetVelocity (lpRef: IDirect3DRMFrame3; rvX, rvY, rvZ: TD3DValue;
  10539.         fRotVel: BOOL) : HResult; stdcall;
  10540.     function SetZbufferMode (d3drmZBM: TD3DRMZBufferMode) : HResult; stdcall;
  10541.     function Transform (out lpd3dVDst: TD3DVector; const lpd3dVSrc: TD3DVector) : HResult; stdcall;
  10542.  
  10543.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10544.     function GetBoxEnable : boolean; stdcall;
  10545.     function GetAxes (out dir, up: TD3DVector) : HResult; stdcall;
  10546.     function GetMaterial (out lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10547.     function GetInheritAxes : boolean; stdcall;
  10548.     function GetHierarchyBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10549.     function SetBox (const lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10550.     function SetBoxEnable (bEnableFlag: BOOL) : HResult; stdcall;
  10551.     function SetAxes (dx, dy, dz, ux, uy, uz: TD3DValue) : HResult; stdcall;
  10552.     function SetInheritAxes (inherit_from_parent: BOOL) : HResult; stdcall;
  10553.     function SetMaterial (var lplpMaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10554.     function SetQuaternion (lpRef: IDirect3DRMFrame3;
  10555.         const quat: TD3DRMQuaternion) : HResult; stdcall;
  10556.     function RayPick (lpRefFrame: IDirect3DRMFrame3; var ray: TD3DRMRay;
  10557.         dwFlags: DWORD; out lplpPicked2Array: IDirect3DRMPicked2Array) : HResult; stdcall;
  10558.     function Save (lpFilename: PAnsiChar; d3dFormat: TD3DRMXOFFormat;
  10559.         d3dSaveFlags: TD3DRMSaveOptions) : HResult; stdcall;
  10560.     function TransformVectors (lpRefFrame: IDirect3DRMFrame3;
  10561.         dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
  10562.         const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10563.     function InverseTransformVectors (lpRefFrame: IDirect3DRMFrame3;
  10564.         dwNumVectors: DWORD; out lpDstVectors: TD3DVector;
  10565.         const lpSrcVectors: TD3DVector) : HResult; stdcall;
  10566.     function SetTraversalOptions (dwFlags: DWORD) : HResult; stdcall;
  10567.     function GetTraversalOptions (out lpdwFlags: DWORD) : HResult; stdcall;
  10568.     function SetSceneFogMethod (dwFlags: DWORD) : HResult; stdcall;
  10569.     function GetSceneFogMethod (out lpdwFlags: DWORD) : HResult; stdcall;
  10570.     function SetMaterialOverride (
  10571.         const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
  10572.     function GetMaterialOverride (
  10573.         const lpdmOverride: TD3DRMMaterialOverride) : HResult; stdcall;
  10574.   end;
  10575.  
  10576.  
  10577.   IDirect3DRMMesh = interface (IDirect3DRMVisual)
  10578.     ['{a3a80d01-6e12-11cf-ac4a-0000c03825a1}']
  10579.     (*
  10580.      * IDirect3DRMMesh methods
  10581.      *)
  10582.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10583.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10584.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10585.     function AddGroup (vCount, fCount, vPerFace: DWORD; var fData: DWORD;
  10586.         var returnId: TD3DRMGroupIndex) : HResult; stdcall;
  10587.     function SetVertices (id: TD3DRMGroupIndex; index, count: DWORD;
  10588.         var values: TD3DRMVertex) : HResult; stdcall;
  10589.     function SetGroupColor (id: TD3DRMGroupIndex; value: TD3DColor) : HResult; stdcall;
  10590.     function SetGroupColorRGB (id: TD3DRMGroupIndex; red, green,
  10591.         blue: TD3DValue) : HResult; stdcall;
  10592.     function SetGroupMapping (id: TD3DRMGroupIndex;
  10593.         value: TD3DRMMapping) : HResult; stdcall;
  10594.     function SetGroupQuality (id: TD3DRMGroupIndex;
  10595.         value: TD3DRMRenderQuality) : HResult; stdcall;
  10596.     function SetGroupMaterial (id: TD3DRMGroupIndex; value:
  10597.         IDirect3DRMMaterial) : HResult; stdcall;
  10598.     function SetGroupTexture (id: TD3DRMGroupIndex; value: IDirect3DRMTexture) : HResult; stdcall;
  10599.     function GetGroupCount: DWORD; stdcall;
  10600.     function GetGroup (id: TD3DRMGroupIndex; vCount, fCount, vPerFace : PDWORD;
  10601.         var fDataSize: DWORD; fData: PDWORD) : HResult; stdcall;
  10602.     function GetVertices (id: TD3DRMGroupIndex; index, count : DWORD;
  10603.         out returnPtr : TD3DRMVertex) : HResult; stdcall;
  10604.     function GetGroupColor (id: TD3DRMGroupIndex) : TD3DColor; stdcall;
  10605.     function GetGroupMapping (id: TD3DRMGroupIndex) : TD3DRMMapping; stdcall;
  10606.     function GetGroupQuality (id: TD3DRMGroupIndex) : TD3DRMRenderQuality; stdcall;
  10607.     function GetGroupMaterial (id: TD3DRMGroupIndex;
  10608.         out returnPtr: IDirect3DRMMaterial) : HResult; stdcall;
  10609.     function GetGroupTexture (id: TD3DRMGroupIndex;
  10610.         out returnPtr: IDirect3DRMTexture) : HResult; stdcall;
  10611.   end;
  10612.  
  10613.   IDirect3DRMProgressiveMesh = interface (IDirect3DRMVisual)
  10614.     ['{4516ec79-8f20-11d0-9b6d-0000c0781bc3}']
  10615.     (*
  10616.      * IDirect3DRMProgressiveMesh methods
  10617.      *)
  10618.     function Load (lpSource, lpObjID: pointer; dloLoadflags : TD3DRMLoadOptions;
  10619.         lpCallback: TD3DRMLoadTextureCallback; lpArg: pointer) : HResult; stdcall;
  10620.     function GetLoadStatus (out lpStatus: TD3DRMPMeshLoadStatus) : HResult; stdcall;
  10621.     function SetMinRenderDetail (d3dVal: TD3DValue) : HResult; stdcall;
  10622.     function Abort (dwFlags: DWORD) : HResult; stdcall;
  10623.     function GetFaceDetail (out lpdwCount: DWORD) : HResult; stdcall;
  10624.     function GetVertexDetail (out lpdwCount: DWORD) : HResult; stdcall;
  10625.     function SetFaceDetail (dwCount: DWORD) : HResult; stdcall;
  10626.     function SetVertexDetail (dwCount: DWORD) : HResult; stdcall;
  10627.     function GetFaceDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
  10628.     function GetVertexDetailRange (out lpdwMin, lpdwMax: DWORD) : HResult; stdcall;
  10629.     function GetDetail (out lpdvVal: TD3DValue) : HResult; stdcall;
  10630.     function SetDetail (lpdvVal: TD3DValue) : HResult; stdcall;
  10631.     function RegisterEvents (hEvent: THANDLE; dwFlags, dwReserved: DWORD) : HResult; stdcall;
  10632.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10633.     function Duplicate (out lplpD3DRMPMesh: IDirect3DRMProgressiveMesh) : HResult; stdcall;
  10634.     function GetBox (out lpBBox: TD3DRMBox) : HResult; stdcall;
  10635.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10636.     function GetQuality (out lpdwquality: TD3DRMRenderQuality) : HResult; stdcall;
  10637.   end;
  10638.  
  10639.   IDirect3DRMShadow = interface (IDirect3DRMVisual)
  10640.     ['{af359780-6ba3-11cf-ac4a-0000c03825a1}']
  10641.     (*
  10642.      * IDirect3DRMShadow methods
  10643.      *)
  10644.     function Init (lpD3DRMVisual: IDirect3DRMVisual;
  10645.         lpD3DRMLight: IDirect3DRMLight;
  10646.         px, py, pz, nx, ny, nz: TD3DValue) : HResult; stdcall;
  10647.   end;
  10648.  
  10649.   IDirect3DRMShadow2 = interface (IDirect3DRMShadow)
  10650.     ['{86b44e25-9c82-11d1-bb0b-00a0c981a0a6}']
  10651.     (*
  10652.      * IDirect3DRMShadow2 methods
  10653.      *)
  10654.     function GetVisual (out lplpDirect3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  10655.     function SetVisual (lpDirect3DRMVisual: IDirect3DRMVisual;
  10656.         dwFlags: DWORD) : HResult; stdcall;
  10657.     function GetLight (out lplpDirect3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  10658.     function SetLight (lplpDirect3DRMLight: IDirect3DRMLight;
  10659.         dwFlags: DWORD) : HResult; stdcall;
  10660.     function GetPlane (
  10661.         var pdvPX, pdvPY, pdvPZ, pdvNX, pdvNY, pdvNZ: TD3DValue) : HResult; stdcall;
  10662.     function SetPlane (px, py, pz, nx, ny, nz: TD3DValue;
  10663.         dwFlags: DWORD) : HResult; stdcall;
  10664.     function GetOptions (out pdwOptions: DWORD) : HResult; stdcall;
  10665.     function SetOptions (dwOptions: DWORD) : HResult; stdcall;
  10666.  
  10667.   end;
  10668.  
  10669.   IDirect3DRMFace = interface (IDirect3DRMObject)
  10670.     ['{eb16cb07-d271-11ce-ac48-0000c03825a1}']
  10671.     (*
  10672.      * IDirect3DRMFace methods
  10673.      *)
  10674.     function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
  10675.     function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
  10676.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10677.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10678.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10679.     function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10680.     function SetMaterial (lpMat: IDirect3DRMMaterial) : HResult; stdcall;
  10681.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10682.     function GetVertex (index: DWORD; out lpPosition: TD3DVector;
  10683.         out lpNormal: TD3DVector) : HResult; stdcall;
  10684.     function GetVertices (var lpdwVertexCount: DWORD;
  10685.         out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
  10686.     function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
  10687.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10688.     function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
  10689.     function GetTexture (out lplpTexture: IDirect3DRMTexture) : HResult; stdcall;
  10690.     function GetMaterial (out lpMat: IDirect3DRMMaterial) : HResult; stdcall;
  10691.     function GetVertexCount: Integer; stdcall;
  10692.     function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
  10693.     function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
  10694.     function GetColor: TD3DColor; stdcall;
  10695.   end;
  10696.  
  10697.   IDirect3DRMFace2 = interface (IDirect3DRMObject)
  10698.     ['{4516ec81-8f20-11d0-9b6d-0000c0781bc3}']
  10699.     (*
  10700.      * IDirect3DRMFace2 methods
  10701.      *)
  10702.     function AddVertex (x, y, z: TD3DValue) : HResult; stdcall;
  10703.     function AddVertexAndNormalIndexed (vertex: DWORD; normal: DWORD) : HResult; stdcall;
  10704.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10705.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10706.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10707.     function SetTextureCoordinates (vertex: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10708.     function SetMaterial (lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
  10709.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10710.     function GetVertex (index: DWORD; out lpPosition: TD3DVector;
  10711.         out lpNormal: TD3DVector) : HResult; stdcall;
  10712.     function GetVertices (var lpdwVertexCount: DWORD;
  10713.         out lpPosition, lpNormal: TD3DVector) : HResult; stdcall;
  10714.     function GetTextureCoordinates (index: DWORD; out lpU, lpV: TD3DValue) : HResult; stdcall;
  10715.     function GetTextureTopology (out lpU, lpV: BOOL) : HResult; stdcall;
  10716.     function GetNormal (out lpNormal: TD3DVector) : HResult; stdcall;
  10717.     function GetTexture (out lplpTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10718.     function GetMaterial (out lpMat: IDirect3DRMMaterial2) : HResult; stdcall;
  10719.     function GetVertexCount: Integer; stdcall;
  10720.     function GetVertexIndex (dwIndex: DWORD) : Integer; stdcall;
  10721.     function GetTextureCoordinateIndex (dwIndex: DWORD) : Integer; stdcall;
  10722.     function GetColor: TD3DColor; stdcall;
  10723.   end;
  10724.  
  10725.   IDirect3DRMMeshBuilder = interface (IDirect3DRMVisual)
  10726.     ['{a3a80d02-6e12-11cf-ac4a-0000c03825a1}']
  10727.     (*
  10728.      * IDirect3DRMMeshBuilder methods
  10729.      *)
  10730.     function Load (lpvObjSource, lpvObjID: Pointer; d3drmLOFlags:
  10731.         TD3DRMLoadOptions; d3drmLoadTextureProc: TD3DRMLoadTextureCallback;
  10732.         lpvArg: Pointer) : HResult; stdcall;
  10733.     function Save (lpFilename: PChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
  10734.         d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
  10735.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10736.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10737.     function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
  10738.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10739.     function GenerateNormals : HResult; stdcall;
  10740.     function GetColorSource: TD3DRMColorSource; stdcall;
  10741.     function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10742.     function AddMeshBuilder (lpD3DRMMeshBuild: IDirect3DRMMeshBuilder) : HResult; stdcall;
  10743.     function AddFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  10744.     function AddFace (lpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10745.     function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
  10746.         normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
  10747.         lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
  10748.     function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
  10749.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10750.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10751.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  10752.     function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial) : HResult; stdcall;
  10753.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10754.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10755.     function SetPerspective (perspective: BOOL) : HResult; stdcall;
  10756.     function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10757.     function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10758.     function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10759.     function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
  10760.     function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
  10761.     function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
  10762.     function GetVertices (var vcount: DWORD; var vertices : TD3DVector;
  10763.         var ncount : DWORD;
  10764.         var normals : TD3DVector;
  10765.         var face_data_size, face_data : DWORD) : HResult; stdcall;
  10766.     function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
  10767.     function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
  10768.     function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
  10769.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  10770.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10771.     function GetPerspective: BOOL; stdcall;
  10772.     function GetFaceCount: Integer; stdcall;
  10773.     function GetVertexCount: Integer; stdcall;
  10774.     function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
  10775.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10776.   end;
  10777.  
  10778.   IDirect3DRMMeshBuilder2 = interface (IDirect3DRMMeshBuilder)
  10779.     ['{4516ec77-8f20-11d0-9b6d-0000c0781bc3}']
  10780.     (*
  10781.      * IDirect3DRMMeshBuilder2 methods
  10782.      *)
  10783.     function GenerateNormals2 (
  10784.         dvCreaseAngle: TD3DValue; dwFlags: DWORD) : HResult; stdcall;
  10785.     function GetFace (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10786.   end;
  10787.  
  10788.   IDirect3DRMMeshBuilder3 = interface (IDirect3DRMVisual)
  10789.     ['{ff6b7f71-a40e-11d1-91f9-0000f8758e66}']
  10790.     (*
  10791.      * IDirect3DRMMeshBuilder3 methods
  10792.      *)
  10793.     function Load (lpvObjSource, lpvObjID: Pointer;
  10794.         d3drmLOFlags: TD3DRMLoadOptions;
  10795.         d3drmLoadTextureProc: TD3DRMLoadTexture3Callback;
  10796.         lpvArg: Pointer) : HResult; stdcall;
  10797.     function Save (lpFilename: PAnsiChar; TD3DRMXOFFormat: TD3DRMXOFFormat;
  10798.         d3drmSOContents: TD3DRMSaveOptions) : HResult; stdcall;
  10799.     function Scale (sx, sy, sz: TD3DValue) : HResult; stdcall;
  10800.     function Translate (tx, ty, tz: TD3DValue) : HResult; stdcall;
  10801.     function SetColorSource (source: TD3DRMColorSource) : HResult; stdcall;
  10802.     function GetBox (out lpTD3DRMBox: TD3DRMBox) : HResult; stdcall;
  10803.     function GenerateNormals (
  10804.         dvCreaseAngle: TD3DValue; dwFlags: DWORD): HResult; stdcall;
  10805.     function GetColorSource: TD3DRMColorSource; stdcall;
  10806.     function AddMesh (lpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10807.     function AddMeshBuilder (
  10808.         lpD3DRMMeshBuild: IDirect3DRMMeshBuilder3) : HResult; stdcall;
  10809.     function AddFrame (lpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  10810.     function AddFace (lpD3DRMFace: IDirect3DRMFace2) : HResult; stdcall;
  10811.     function AddFaces (dwVertexCount: DWORD; const lpD3DVertices: TD3DVector;
  10812.         normalCount: DWORD; lpNormals: PD3DVector; var lpFaceData: DWORD;
  10813.         lplpD3DRMFaceArray: PIDirect3DRMFaceArray) : HResult; stdcall;
  10814.     function ReserveSpace (vertexCount, normalCount, faceCount: DWORD) : HResult; stdcall;
  10815.     function SetColorRGB (red, green, blue: TD3DValue) : HResult; stdcall;
  10816.     function SetColor (color: TD3DColor) : HResult; stdcall;
  10817.     function SetTexture (lpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  10818.     function SetMaterial (lpIDirect3DRMmaterial: IDirect3DRMMaterial2) : HResult; stdcall;
  10819.     function SetTextureTopology (cylU, cylV: BOOL) : HResult; stdcall;
  10820.     function SetQuality (quality: TD3DRMRenderQuality) : HResult; stdcall;
  10821.     function SetPerspective (perspective: BOOL) : HResult; stdcall;
  10822.     function SetVertex (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10823.     function SetNormal (index: DWORD; x, y, z: TD3DValue) : HResult; stdcall;
  10824.     function SetTextureCoordinates (index: DWORD; u, v: TD3DValue) : HResult; stdcall;
  10825.     function SetVertexColor (index: DWORD; color: TD3DColor) : HResult; stdcall;
  10826.     function SetVertexColorRGB (index: DWORD; red, green, blue: TD3DValue) : HResult; stdcall;
  10827.     function GetFaces (out lplpD3DRMFaceArray: IDirect3DRMFaceArray) : HResult; stdcall;
  10828.     function GetGeometry (var vcount: DWORD; var vertices : TD3DVector;
  10829.         var ncount : DWORD; var normals : TD3DVector;
  10830.         var face_data_size, face_data : DWORD) : HResult; stdcall;
  10831.     function GetTextureCoordinates(index : DWORD; out u, v : TD3DValue) : HResult; stdcall;
  10832.     function AddVertex (x, y, z: TD3DValue) : Integer; stdcall;
  10833.     function AddNormal (x, y, z: TD3DValue) : Integer; stdcall;
  10834.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
  10835.     function GetQuality: TD3DRMRenderQuality; stdcall;
  10836.     function GetPerspective: BOOL; stdcall;
  10837.     function GetFaceCount: Integer; stdcall;
  10838.     function GetVertexCount: Integer; stdcall;
  10839.     function GetVertexColor (index: DWORD) : TD3DColor; stdcall;
  10840.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  10841.     function GetFace
  10842.         (dwIndex: DWORD; lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  10843.     function GetVertex (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
  10844.     function GetNormal (dwIndex: DWORD; out lpVector: TD3DVector) : HResult; stdcall;
  10845.     function DeleteVertices (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
  10846.     function DeleteNormals (dwFirstIndex, dwCount: DWORD) : HResult; stdcall;
  10847.     function DeleteFace (lpFace: IDirect3DRMFace2) : HResult; stdcall;
  10848.     function Empty (dwFlags: DWORD) : HResult; stdcall;
  10849.     function Optimize (dwFlags: DWORD) : HResult; stdcall;
  10850.     function AddFacesIndexed (dwFlags: DWORD; var lpdwvIndices: DWORD;
  10851.         lpdwIndexFirst, lpdwCount: PDWORD) : HResult; stdcall;
  10852.     function CreateSubMesh (out lplpUnk: IUnknown) : HResult; stdcall;
  10853.     function GetParentMesh (dwFlags: DWORD; out lplpUnk: IUnknown) : HResult; stdcall;
  10854.     function GetSubMeshes (lpdwCount: PDWORD; lpUnk: IUnknown) : HResult; stdcall;
  10855.     function DeleteSubMesh (lplpUnk: IUnknown) : HResult; stdcall;
  10856.     function Enable (dwFlags: DWORD) : HResult; stdcall;
  10857.     function GetEnable (out lpdwFlags: DWORD) : HResult; stdcall;
  10858.     function AddTriangles (dwFlags, dwFormat, dwVertexCount:  DWORD;
  10859.         lpData: pointer) : HResult; stdcall;
  10860.     function SetVertices
  10861.         (dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
  10862.     function GetVertices(dwFirst: DWORD; var lpdwCount: DWORD;
  10863.         lpdvVector: PD3DVector) : HResult; stdcall;
  10864.     function SetNormals(dwFirst, dwCount: DWORD; const lpdvVector: TD3DVector) : HResult; stdcall;
  10865.     function GetNormals (dwFirst: DWORD; lpdwCount: PDWORD;
  10866.         var lpdvVector: TD3DVector) : HResult; stdcall;
  10867.     function GetNormalCount : integer; stdcall;
  10868.   end;
  10869.  
  10870.   IDirect3DRMLight = interface (IDirect3DRMObject)
  10871.     ['{eb16cb08-d271-11ce-ac48-0000c03825a1}']
  10872.     (*
  10873.      * IDirect3DRMLight methods
  10874.      *)
  10875.     function SetType (d3drmtType: TD3DRMLightType) : HResult; stdcall;
  10876.     function SetColor (rcColor: TD3DColor) : HResult; stdcall;
  10877.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DValue) : HResult; stdcall;
  10878.     function SetRange (rvRange: TD3DValue) : HResult; stdcall;
  10879.     function SetUmbra (rvAngle: TD3DValue) : HResult; stdcall;
  10880.     function SetPenumbra (rvAngle: TD3DValue) : HResult; stdcall;
  10881.     function SetConstantAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10882.     function SetLinearAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10883.     function SetQuadraticAttenuation (rvAtt: TD3DValue) : HResult; stdcall;
  10884.     function GetRange: TD3DValue; stdcall;
  10885.     function GetUmbra: TD3DValue; stdcall;
  10886.     function GetPenumbra: TD3DValue; stdcall;
  10887.     function GetConstantAttenuation: TD3DValue; stdcall;
  10888.     function GetLinearAttenuation: TD3DValue; stdcall;
  10889.     function GetQuadraticAttenuation: TD3DValue; stdcall;
  10890.     function GetColor: TD3DColor; stdcall;
  10891.     function GetType: TD3DRMLightType; stdcall;
  10892.     function SetEnableFrame (lpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
  10893.     function GetEnableFrame (out lplpEnableFrame: IDirect3DRMFrame) : HResult; stdcall;
  10894.   end;
  10895.  
  10896.   IDirect3DRMTexture = interface (IDirect3DRMVisual)
  10897.     ['{eb16cb09-d271-11ce-ac48-0000c03825a1}']
  10898.     (*
  10899.      * IDirect3DRMTexture methods
  10900.      *)
  10901.     function InitFromFile (filename: PAnsiChar) : HResult; stdcall;
  10902.     function InitFromSurface (lpDDS: IDirectDrawSurface) : HResult; stdcall;
  10903.     function InitFromResource (rs: HRSRC) : HResult; stdcall;
  10904.     function Changed (bPixels, bPalette: BOOL) : HResult; stdcall;
  10905.     function SetColors (ulColors: DWORD) : HResult; stdcall;
  10906.     function SetShades (ulShades: DWORD) : HResult; stdcall;
  10907.     function SetDecalSize (rvWidth, rvHeight: TD3DValue) : HResult; stdcall;
  10908.     function SetDecalOrigin (lX, lY: LongInt) : HResult; stdcall;
  10909.     function SetDecalScale (dwScale: DWORD) : HResult; stdcall;
  10910.     function SetDecalTransparency (bTransp: BOOL) : HResult; stdcall;
  10911.     function SetDecalTransparentColor (rcTransp: TD3DColor) : HResult; stdcall;
  10912.     function GetDecalSize (out lprvWidth, lprvHeight: TD3DValue) : HResult; stdcall;
  10913.     function GetDecalOrigin (out lplX, lplY: LongInt) : HResult; stdcall;
  10914.     function GetImage: PD3DRMImage; stdcall;
  10915.     function GetShades: DWORD; stdcall;
  10916.     function GetColors: DWORD; stdcall;
  10917.     function GetDecalScale: DWORD; stdcall;
  10918.     function GetDecalTransparency: BOOL; stdcall;
  10919.     function GetDecalTransparentColor: TD3DColor; stdcall;
  10920.   end;
  10921.  
  10922.   IDirect3DRMTexture2 = interface (IDirect3DRMTexture)
  10923.     ['{120f30c0-1629-11d0-941c-0080c80cfa7b}']
  10924.     (*
  10925.      * IDirect3DRMTexture2 methods
  10926.      *)
  10927.     function InitFromImage (const lpImage: TD3DRMImage) : HResult; stdcall;
  10928.     function InitFromResource2 (hModule: HModule;
  10929.         strName, strType: PAnsiChar) : HResult; stdcall;
  10930.     function GenerateMIPMap (dwFlags: DWORD) : HResult; stdcall;
  10931.   end;
  10932.  
  10933.   IDirect3DRMTexture3 = interface (IDirect3DRMTexture2)
  10934.     ['{ff6b7f73-a40e-11d1-91f9-0000f8758e66}']
  10935.     (*
  10936.      * IDirect3DRMTexture3 methods
  10937.      *)
  10938.     function GetSurface
  10939.         (dwFlags: DWORD; out lplpDDS: IDirectDrawSurface) : HResult; stdcall;
  10940.     function SetCacheOptions (lImportance: integer; dwFlags: DWORD) : HResult; stdcall;
  10941.     function GetCacheOptions (var lplImportance: integer; var lpdwFlags: DWORD) : HResult; stdcall;
  10942.     function SetDownsampleCallback (
  10943.         pCallback: TD3DRMDownSampleCallback; pArg: pointer) : HResult; stdcall;
  10944.     function SetValidationCallback (
  10945.         pCallback: TD3DRMValidationCallback; pArg: pointer) : HResult; stdcall;
  10946.   end;
  10947.  
  10948.   IDirect3DRMWrap = interface (IDirect3DRMObject)
  10949.     ['{eb16cb0a-d271-11ce-ac48-0000c03825a1}']
  10950.     (*
  10951.      * IDirect3DRMWrap methods
  10952.      *)
  10953.     function Init (d3drmwt: TD3DRMWrapType; lpd3drmfRef: IDirect3DRMFrame;
  10954.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue)
  10955.         : HResult; stdcall;
  10956.     function Apply (lpObject: IDirect3DRMObject) : HResult; stdcall;
  10957.     function ApplyRelative(frame: IDirect3DRMFrame; mesh: IDirect3DRMObject) : HResult; stdcall;
  10958.   end;
  10959.  
  10960.   IDirect3DRMMaterial = interface (IDirect3DRMObject)
  10961.     ['{eb16cb0b-d271-11ce-ac48-0000c03825a1}']
  10962.     (*
  10963.      * IDirect3DRMMaterial methods
  10964.      *)
  10965.     function SetPower (rvPower: TD3DValue) : HResult; stdcall;
  10966.     function SetSpecular (r, g, b: TD3DValue) : HResult; stdcall;
  10967.     function SetEmissive (r, g, b: TD3DValue) : HResult; stdcall;
  10968.     function GetPower: TD3DValue; stdcall;
  10969.     function GetSpecular (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
  10970.     function GetEmissive (out lpr, lpg, lpb: TD3DValue) : HResult; stdcall;
  10971.   end;
  10972.  
  10973.   IDirect3DRMMaterial2 = interface (IDirect3DRMMaterial)
  10974.     ['{ff6b7f75-a40e-11d1-91f9-0000f8758e66}']
  10975.     (*
  10976.      * IDirect3DRMMaterial2 methods
  10977.      *)
  10978.     function GetAmbient(out r,g,b: TD3DValue) : HResult; stdcall;
  10979.     function SetAmbient(r,g,b: TD3DValue) : HResult; stdcall;
  10980.   end;
  10981.  
  10982.   IDirect3DRMAnimation = interface (IDirect3DRMObject)
  10983.     ['{eb16cb0d-d271-11ce-ac48-0000c03825a1}']
  10984.     (*
  10985.      * IDirect3DRMAnimation methods
  10986.      *)
  10987.     function SetOptions (d3drmanimFlags: TD3DRMAnimationOptions) : HResult; stdcall;
  10988.     function AddRotateKey (rvTime: TD3DValue; const rqQuat: TD3DRMQuaternion) : HResult; stdcall;
  10989.     function AddPositionKey (rvTime, rvX, rvY, rvZ: TD3DValue) : HResult; stdcall;
  10990.     function AddScaleKey (time, x, y, z: TD3DValue) : HResult; stdcall;
  10991.     function DeleteKey (time: TD3DValue) : HResult; stdcall;
  10992.     function SetFrame (lpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  10993.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  10994.     function GetOptions: TD3DRMAnimationOptions; stdcall;
  10995.   end;
  10996.  
  10997.   IDirect3DRMAnimation2 = interface (IDirect3DRMAnimation)
  10998.     ['{ff6b7f77-a40e-11d1-91f9-0000f8758e66}']
  10999.     (*
  11000.      * IDirect3DRMAnimation methods
  11001.      *)
  11002.     function GetFrame (out lpD3DFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11003.     function DeleteKeyByID (dwID: DWORD) : HResult; stdcall;
  11004.     function AddKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
  11005.     function ModifyKey (const lpKey: TD3DRMAnimationKey) : HResult; stdcall;
  11006.     function GetKeys (dvTimeMin, dvTimeMax: TD3DValue; var lpdwNumKeys: DWORD;
  11007.         lpKey: PD3DRMAnimationKey) : HResult; stdcall;
  11008.   end;
  11009.  
  11010.   IDirect3DRMAnimationSet = interface (IDirect3DRMObject)
  11011.     ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
  11012.     (*
  11013.      * IDirect3DRMAnimationSet methods
  11014.      *)
  11015.     function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11016.     function Load (lpvObjSource, lpvObjID: Pointer;
  11017.         d3drmLOFlags: TD3DRMLoadOptions;
  11018.         d3drmLoadTextureProc: TD3DRMLoadTextureCallback; lpArgLTP: Pointer;
  11019.         lpParentFrame: IDirect3DRMFrame) : HResult; stdcall;
  11020.     function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11021.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  11022.   end;
  11023.  
  11024.   IDirect3DRMAnimationSet2 = interface (IDirect3DRMObject)
  11025.     ['{ff6b7f79-a40e-11d1-91f9-0000f8758e66}']
  11026.     (*
  11027.      * IDirect3DRMAnimationSet methods
  11028.      *)
  11029.     function AddAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11030.     function Load (lpvObjSource, lpvObjID: Pointer;
  11031.         d3drmLOFlags: TD3DRMLoadOptions;
  11032.         d3drmLoadTextureProc: TD3DRMLoadTexture3Callback; lpArgLTP: Pointer;
  11033.         lpParentFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11034.     function DeleteAnimation (lpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11035.     function SetTime (rvTime: TD3DValue) : HResult; stdcall;
  11036.     function GetAnimations(out lplpArray: IDirect3DRMAnimationArray) : HResult; stdcall;
  11037.   end;
  11038.  
  11039.   IDirect3DRMUserVisual = interface (IDirect3DRMVisual)
  11040.     ['{59163de0-6d43-11cf-ac4a-0000c03825a1}']
  11041.     (*
  11042.      * IDirect3DRMUserVisual methods
  11043.      *)
  11044.     function Init (d3drmUVProc: TD3DRMUserVisualCallback;
  11045.         lpArg: Pointer) : HResult; stdcall;
  11046.   end;
  11047.  
  11048.   IDirect3DRMArray = interface (IUnknown)
  11049.     function GetSize: DWORD; stdcall;
  11050.     (* No GetElement method as it would get overloaded
  11051.      * in derived classes, and overloading is
  11052.      * a no-no in COM
  11053.      *)
  11054.   end;
  11055.  
  11056.   IDirect3DRMObjectArray = interface (IDirect3DRMArray)
  11057.         ['{242f6bc2-3849-11d0-9b6d-0000c0781bc3}']
  11058.     function GetElement (index: DWORD; out lplpD3DRMObject:
  11059.         IDirect3DRMObject) : HResult; stdcall;
  11060.   end;
  11061.  
  11062.   IDirect3DRMDeviceArray = interface (IDirect3DRMArray)
  11063.     ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
  11064.     function GetElement (index: DWORD; out lplpD3DRMDevice:
  11065.         IDirect3DRMDevice) : HResult; stdcall;
  11066.   end;
  11067.  
  11068.   IDirect3DRMFrameArray = interface (IDirect3DRMArray)
  11069.     ['{eb16cb12-d271-11ce-ac48-0000c03825a1}']
  11070.     function GetElement (index: DWORD; out lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  11071.   end;
  11072.  
  11073.   IDirect3DRMViewportArray = interface (IDirect3DRMArray)
  11074.     ['{eb16cb11-d271-11ce-ac48-0000c03825a1}']
  11075.     function GetElement (index: DWORD; out lplpD3DRMViewport:
  11076.         IDirect3DRMViewport) : HResult; stdcall;
  11077.   end;
  11078.  
  11079.   IDirect3DRMVisualArray = interface (IDirect3DRMArray)
  11080.     ['{eb16cb13-d271-11ce-ac48-0000c03825a1}']
  11081.     function GetElement (index: DWORD; out lplpD3DRMVisual:
  11082.         IDirect3DRMVisual) : HResult; stdcall;
  11083.   end;
  11084.  
  11085.   IDirect3DRMAnimationArray = interface (IDirect3DRMArray)
  11086.     ['{d5f1cae0-4bd7-11d1-b974-0060083e45f3}']
  11087.     function GetElement (index: DWORD; out lplpD3DRMAnimation2:
  11088.         IDirect3DRMAnimation2) : HResult; stdcall;
  11089.   end;
  11090.  
  11091.   IDirect3DRMPickedArray = interface (IDirect3DRMArray)
  11092.     ['{eb16cb16-d271-11ce-ac48-0000c03825a1}']
  11093.     function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
  11094.         out lplpFrameArray: IDirect3DRMFrameArray;
  11095.         const lpD3DRMPickDesc: TD3DRMPickDesc) : HResult; stdcall;
  11096.  
  11097.   end;
  11098.  
  11099.   IDirect3DRMLightArray = interface (IDirect3DRMArray)
  11100.     ['{eb16cb14-d271-11ce-ac48-0000c03825a1}']
  11101.     function GetElement (index: DWORD; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11102.   end;
  11103.  
  11104.  
  11105.   IDirect3DRMFaceArray = interface (IDirect3DRMArray)
  11106.     ['{eb16cb17-d271-11ce-ac48-0000c03825a1}']
  11107.     function GetElement (index: DWORD; out lplpD3DRMFace: IDirect3DRMFace) : HResult; stdcall;
  11108.   end;
  11109.  
  11110.   IDirect3DRMPicked2Array = interface (IDirect3DRMArray)
  11111.     ['{4516ec7b-8f20-11d0-9b6d-0000c0781bc3}']
  11112.     function GetPick (index: DWORD; out lplpVisual: IDirect3DRMVisual;
  11113.         out lplpFrameArray: IDirect3DRMFrameArray; const lpD3DRMPickDesc2:
  11114.         TD3DRMPickDesc2) : HResult; stdcall;
  11115.   end;
  11116.  
  11117.   IDirect3DRMInterpolator = interface (IDirect3DRMObject)
  11118.     ['{242f6bc1-3849-11d0-9b6d-0000c0781bc3}']
  11119.     (*
  11120.      * IDirect3DRMInterpolator methods
  11121.      *)
  11122.     function AttachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11123.     function GetAttachedObjects
  11124.         (lpD3DRMObjectArray: IDirect3DRMObjectArray) : HResult; stdcall;
  11125.     function DetachObject (lpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11126.     function SetIndex (d3dVal: TD3DValue) : HResult; stdcall;
  11127.     function GetIndex : TD3DValue; stdcall;
  11128.     function Interpolate (d3dVal: TD3DValue; lpD3DRMObject: IDirect3DRMObject;
  11129.         d3drmInterpFlags: TD3DRMInterpolationOptions) : HResult; stdcall;
  11130.   end;
  11131.  
  11132.   IDirect3DRMClippedVisual = interface (IDirect3DRMObject)
  11133.     ['{5434e733-6d66-11d1-bb0b-0000f875865a}']
  11134.     (*
  11135.      * IDirect3DRMClippedVisual methods
  11136.      *)
  11137.     function Init (lpD3DRMVisual: IDirect3DRMVisual) : HResult; stdcall;
  11138.     function AddPlane (lpRef: IDirect3DRMFrame3;
  11139.         const lpdvPoint, lpdvNormal: TD3DVector;
  11140.         dwFlags: DWORD; out lpdwReturnID: DWORD) : HResult; stdcall;
  11141.     function DeletePlane (dwID, dwFlags: DWORD) : HResult; stdcall;
  11142.     function GetPlaneIDs (var lpdwCount: DWORD; out lpdwID: DWORD; dwFlags: DWORD) : HResult; stdcall;
  11143.     function GetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
  11144.         out lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
  11145.     function SetPlane (dwID: DWORD; lpRef: IDirect3DRMFrame3;
  11146.         const lpdvPoint, lpdvNormal: TD3DVector; dwFlags: DWORD) : HResult; stdcall;
  11147.   end;
  11148.  
  11149. (*==========================================================================;
  11150.  *
  11151.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11152.  *
  11153.  *  File:       d3drm.h
  11154.  *  Content:    Direct3DRM include file
  11155.  *
  11156.  ***************************************************************************)
  11157.  
  11158. function D3DRMErrorString(Value: HResult) : string;
  11159.  
  11160. //type
  11161.   //TRefClsID = TGUID;
  11162.  
  11163. type
  11164.   TD3DRMDevicePaletteCallback = procedure (lpDirect3DRMDev: IDirect3DRMDevice;
  11165.       lpArg: Pointer; dwIndex: DWORD; red, green, blue: LongInt); cdecl;
  11166.  
  11167. (*
  11168.  * Direct3DRM Object Class (for CoCreateInstance())
  11169.  *)
  11170. const
  11171.   CLSID_CDirect3DRM: TGUID =
  11172.       (D1:$4516ec41;D2:$8f20;D3:$11d0;D4:($9b,$6d,$00,$00,$c0,$78,$1b,$c3));
  11173.  
  11174. type
  11175.   IDirect3DRM = interface (IUnknown)
  11176.     ['{2bc49361-8327-11cf-ac4a-0000c03825a1}']
  11177.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11178.         const riid: TGUID; out ppv) : HResult; stdcall;
  11179.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame;
  11180.         var lplpD3DRMFrame: IDirect3DRMFrame) : HResult; stdcall;
  11181.     function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11182.     function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
  11183.         IDirect3DRMMeshBuilder) : HResult; stdcall;
  11184.     function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  11185.     function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11186.     function CreateAnimationSet (var lplpD3DRMAnimationSet:
  11187.         IDirect3DRMAnimationSet) : HResult; stdcall;
  11188.     function CreateTexture (var lpImage: TD3DRMImage;
  11189.         var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  11190.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11191.         cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11192.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11193.         vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11194.     function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
  11195.         IDirect3DRMMaterial) : HResult; stdcall;
  11196.     function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
  11197.         IDirect3DRMDevice) : HResult; stdcall;
  11198.  
  11199.     (* Create a Windows Device using DirectDraw surfaces *)
  11200.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11201.         lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice) :
  11202.         HResult; stdcall;
  11203.  
  11204.       (* Create a Windows Device using D3D objects *)
  11205.     function CreateDeviceFromD3D (lpD3D: IDirect3D; lpD3DDev: IDirect3DDevice;
  11206.         var lplpD3DRMDevice: IDirect3DRMDevice) : HResult; stdcall;
  11207.  
  11208.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11209.         lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
  11210.         IDirect3DRMDevice) : HResult; stdcall;
  11211.  
  11212.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11213.         var lplpD3DRMTexture: IDirect3DRMTexture) : HResult; stdcall;
  11214.  
  11215.     function CreateShadow (lpVisual: IDirect3DRMVisual;
  11216.         lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
  11217.         var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
  11218.     function CreateViewport (lpDev: IDirect3DRMDevice;
  11219.         lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11220.         var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
  11221.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
  11222.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11223.         var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11224.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11225.         var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11226.     function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
  11227.         IDirect3DRMTexture) : HResult; stdcall;
  11228.     function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
  11229.         IDirect3DRMTexture) : HResult; stdcall;
  11230.  
  11231.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11232.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11233.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11234.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11235.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11236.  
  11237.     function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11238.     function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11239.  
  11240.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11241.  
  11242.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11243.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11244.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11245.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
  11246.         IDirect3DRMFrame) : HResult; stdcall;
  11247.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11248.   end;
  11249.  
  11250. // Moved from D3DRMObj, to avoid circular unit reference:
  11251.  
  11252.   IDirect3DRMObject2 = interface (IUnknown)
  11253.     ['{4516ec7c-8f20-11d0-9b6d-0000c0781bc3}']
  11254.     (*
  11255.      * IDirect3DRMObject2 methods
  11256.      *)
  11257.     function AddDestroyCallback (lpCallback: TD3DRMObjectCallback;
  11258.         lpArg: Pointer) : HResult; stdcall;
  11259.     function Clone (pUnkOuter: IUnknown; const riid: TGUID;
  11260.         out ppvObj) : HResult; stdcall;
  11261.     function DeleteDestroyCallback (d3drmObjProc: TD3DRMObjectCallback;
  11262.         lpArg: Pointer) : HResult; stdcall;
  11263.     function GetClientData (dwID: DWORD; out lplpvData: Pointer) : HResult; stdcall;
  11264.     function GetDirect3DRM (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
  11265.     function GetName (var lpdwSize: DWORD; lpName: PAnsiChar) : HResult; stdcall;
  11266.     function SetClientData (dwID: DWORD; lpvData: pointer; dwFlags: DWORD) : HResult; stdcall;
  11267.     function SetName (lpName: PAnsiChar) : HResult; stdcall;
  11268.     function GetAge (dwFlags: DWORD; out pdwAge: DWORD) : HResult; stdcall;
  11269.   end;
  11270.  
  11271.   IID_IDirect3DRMObject2 = IDirect3DRMObject2;
  11272.  
  11273.   IDirect3DRM2 = interface (IUnknown)
  11274.     ['{4516ecc8-8f20-11d0-9b6d-0000c0781bc3}']
  11275.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11276.         const riid: TGUID; out ppv) : HResult; stdcall;
  11277.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame2;
  11278.         var lplpD3DRMFrame: IDirect3DRMFrame2) : HResult; stdcall;
  11279.     function CreateMesh (var lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11280.     function CreateMeshBuilder (var lplpD3DRMMeshBuilder:
  11281.         IDirect3DRMMeshBuilder2) : HResult; stdcall;
  11282.     function CreateFace (var lplpd3drmFace: IDirect3DRMFace) : HResult; stdcall;
  11283.     function CreateAnimation (var lplpD3DRMAnimation: IDirect3DRMAnimation) : HResult; stdcall;
  11284.     function CreateAnimationSet (var lplpD3DRMAnimationSet:
  11285.         IDirect3DRMAnimationSet) : HResult; stdcall;
  11286.     function CreateTexture (var lpImage: TD3DRMImage;
  11287.         var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
  11288.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11289.         cColor: TD3DColor; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11290.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11291.         vGreen, vBlue: TD3DValue; var lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11292.     function CreateMaterial (vPower: TD3DValue; var lplpD3DRMMaterial:
  11293.         IDirect3DRMMaterial) : HResult; stdcall;
  11294.     function CreateDevice (dwWidth, dwHeight: DWORD; var lplpD3DRMDevice:
  11295.         IDirect3DRMDevice2) : HResult; stdcall;
  11296.  
  11297.     (* Create a Windows Device using DirectDraw surfaces *)
  11298.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11299.         lpDDSBack: IDirectDrawSurface; var lplpD3DRMDevice: IDirect3DRMDevice2) :
  11300.         HResult; stdcall;
  11301.  
  11302.       (* Create a Windows Device using D3D objects *)
  11303.     function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
  11304.         var lplpD3DRMDevice: IDirect3DRMDevice2) : HResult; stdcall;
  11305.  
  11306.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11307.         lpGUID: PGUID; width, height: Integer; var lplpD3DRMDevice:
  11308.         IDirect3DRMDevice2) : HResult; stdcall;
  11309.  
  11310.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11311.         var lplpD3DRMTexture: IDirect3DRMTexture2) : HResult; stdcall;
  11312.  
  11313.     function CreateShadow (lpVisual: IDirect3DRMVisual;
  11314.         lpLight: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DValue;
  11315.         var lplpShadow: IDirect3DRMVisual) : HResult; stdcall;
  11316.     function CreateViewport (lpDev: IDirect3DRMDevice;
  11317.         lpCamera: IDirect3DRMFrame; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11318.         var lplpD3DRMViewport: IDirect3DRMViewport) : HResult; stdcall;
  11319.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame;
  11320.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11321.         var lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11322.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11323.         var lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11324.     function LoadTexture (lpFileName: PAnsiChar; var lplpD3DRMTexture:
  11325.         IDirect3DRMTexture2) : HResult; stdcall;
  11326.     function LoadTextureFromResource (rs: HRSRC; var lplpD3DRMTexture:
  11327.         IDirect3DRMTexture2) : HResult; stdcall;
  11328.  
  11329.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11330.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11331.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11332.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11333.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11334.  
  11335.     function GetDevices (var lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11336.     function GetNamedObject (lpName: PAnsiChar; var lplpD3DRMObject:
  11337.         IDirect3DRMObject) : HResult; stdcall;
  11338.  
  11339.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11340.  
  11341.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11342.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11343.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11344.         TD3DRMLoadTextureCallback; lpArgLTP: Pointer; lpParentFrame:
  11345.         IDirect3DRMFrame) : HResult; stdcall;
  11346.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11347.     function CreateProgressiveMesh (var lplpD3DRMProgressiveMesh:
  11348.         IDirect3DRMProgressiveMesh) : HResult; stdcall;
  11349.   end;
  11350.  
  11351.   IDirect3DRM3 = interface (IUnknown)
  11352.     ['{4516ec83-8f20-11d0-9b6d-0000c0781bc3}']
  11353.     function CreateObject (const rclsid: TRefClsID; pUnkOuter: IUnknown;
  11354.         const riid: TGUID; out ppv) : HResult; stdcall;
  11355.     function CreateFrame (lpD3DRMFrame: IDirect3DRMFrame3;
  11356.         out lplpD3DRMFrame: IDirect3DRMFrame3) : HResult; stdcall;
  11357.     function CreateMesh (out lplpD3DRMMesh: IDirect3DRMMesh) : HResult; stdcall;
  11358.     function CreateMeshBuilder (out lplpD3DRMMeshBuilder:
  11359.         IDirect3DRMMeshBuilder3) : HResult; stdcall;
  11360.     function CreateFace (out lplpd3drmFace: IDirect3DRMFace2) : HResult; stdcall;
  11361.     function CreateAnimation (out lplpD3DRMAnimation: IDirect3DRMAnimation2) : HResult; stdcall;
  11362.     function CreateAnimationSet (out lplpD3DRMAnimationSet:
  11363.         IDirect3DRMAnimationSet2) : HResult; stdcall;
  11364.     function CreateTexture (const lpImage: TD3DRMImage;
  11365.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11366.     function CreateLight (d3drmltLightType: TD3DRMLightType;
  11367.         cColor: TD3DColor; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11368.     function CreateLightRGB (ltLightType: TD3DRMLightType; vRed,
  11369.         vGreen, vBlue: TD3DValue; out lplpD3DRMLight: IDirect3DRMLight) : HResult; stdcall;
  11370.     function CreateMaterial (vPower: TD3DValue; out lplpD3DRMMaterial:
  11371.         IDirect3DRMMaterial2) : HResult; stdcall;
  11372.     function CreateDevice (dwWidth, dwHeight: DWORD; out lplpD3DRMDevice:
  11373.         IDirect3DRMDevice3) : HResult; stdcall;
  11374.  
  11375.     (* Create a Windows Device using DirectDraw surfaces *)
  11376.     function CreateDeviceFromSurface (lpGUID: PGUID; lpDD: IDirectDraw;
  11377.         lpDDSBack: IDirectDrawSurface; dwFlags: DWORD;
  11378.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11379.  
  11380.       (* Create a Windows Device using D3D objects *)
  11381.     function CreateDeviceFromD3D (lpD3D: IDirect3D2; lpD3DDev: IDirect3DDevice2;
  11382.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11383.  
  11384.     function CreateDeviceFromClipper (lpDDClipper: IDirectDrawClipper;
  11385.         lpGUID: PGUID; width, height: Integer;
  11386.         out lplpD3DRMDevice: IDirect3DRMDevice3) : HResult; stdcall;
  11387.  
  11388.     function CreateTextureFromSurface ( lpDDS: IDirectDrawSurface;
  11389.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11390.  
  11391.     function CreateShadow (pUnk: IUnknown; lpLight: IDirect3DRMLight;
  11392.         px, py, pz, nx, ny, nz: TD3DValue;
  11393.         out lplpShadow: IDirect3DRMShadow2) : HResult; stdcall;
  11394.     function CreateViewport (lpDev: IDirect3DRMDevice3;
  11395.         lpCamera: IDirect3DRMFrame3; dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  11396.         out lplpD3DRMViewport: IDirect3DRMViewport2) : HResult; stdcall;
  11397.     function CreateWrap (wraptype: TD3DRMWrapType; lpRef: IDirect3DRMFrame3;
  11398.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DValue;
  11399.         out lplpD3DRMWrap: IDirect3DRMWrap) : HResult; stdcall;
  11400.     function CreateUserVisual (fn: TD3DRMUserVisualCallback; lpArg: Pointer;
  11401.         out lplpD3DRMUV: IDirect3DRMUserVisual) : HResult; stdcall;
  11402.     function LoadTexture (lpFileName: PAnsiChar; out lplpD3DRMTexture:
  11403.         IDirect3DRMTexture3) : HResult; stdcall;
  11404.     function LoadTextureFromResource (hModule: HMODULE;
  11405.         strName, strType: PAnsiChar;
  11406.         out lplpD3DRMTexture: IDirect3DRMTexture3) : HResult; stdcall;
  11407.  
  11408.     function SetSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11409.     function AddSearchPath (lpPath: PAnsiChar) : HResult; stdcall;
  11410.     function GetSearchPath (var lpdwSize: DWORD; lpszPath: PAnsiChar) : HResult; stdcall;
  11411.     function SetDefaultTextureColors (dwColors: DWORD) : HResult; stdcall;
  11412.     function SetDefaultTextureShades (dwShades: DWORD) : HResult; stdcall;
  11413.  
  11414.     function GetDevices (out lplpDevArray: IDirect3DRMDeviceArray) : HResult; stdcall;
  11415.     function GetNamedObject (lpName: PAnsiChar; out lplpD3DRMObject: IDirect3DRMObject) : HResult; stdcall;
  11416.  
  11417.     function EnumerateObjects (func: TD3DRMObjectCallback; lpArg: Pointer) : HResult; stdcall;
  11418.  
  11419.     function Load (lpvObjSource, lpvObjID: Pointer; var lplpGUIDs: PGUID;
  11420.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLoadOptions; d3drmLoadProc:
  11421.         TD3DRMLoadCallback; lpArgLP: Pointer; d3drmLoadTextureProc:
  11422.         TD3DRMLoadTexture3Callback; lpArgLTP: Pointer; lpParentFrame:
  11423.         IDirect3DRMFrame3) : HResult; stdcall;
  11424.     function Tick (d3dvalTick: TD3DValue) : HResult; stdcall;
  11425.     function CreateProgressiveMesh (out lplpD3DRMProgressiveMesh:
  11426.         IDirect3DRMProgressiveMesh) : HResult; stdcall;
  11427.  
  11428.     (* Used with IDirect3DRMObject2 *)
  11429.     function RegisterClient (const rguid: TGUID; out lpdwID: DWORD) : HResult; stdcall;
  11430.     function UnregisterClient (const rguid: TGUID) : HResult; stdcall;
  11431.  
  11432.     function CreateClippedVisual (lpVisual: IDirect3DRMVisual;
  11433.         lpClippedVisual: IDirect3DRMClippedVisual) : HResult; stdcall;
  11434.     function SetOptions (dwOptions: DWORD) : HResult; stdcall;
  11435.     function GetOptions (out lpdwOptions: DWORD) : HResult; stdcall;
  11436.   end;
  11437.  
  11438.   IID_IDirect3DRM =  IDirect3DRM;
  11439.   IID_IDirect3DRM2 = IDirect3DRM2;
  11440.   IID_IDirect3DRM3 = IDirect3DRM3;
  11441.  
  11442. const
  11443.   MAKE_D3RMDHRESULT = HResult($88760000);
  11444.  
  11445.   D3DRM_OK                        = DD_OK;
  11446.   D3DRMERR_BADOBJECT              = MAKE_D3RMDHRESULT + 781;
  11447.   D3DRMERR_BADTYPE                = MAKE_D3RMDHRESULT + 782;
  11448.   D3DRMERR_BADALLOC               = MAKE_D3RMDHRESULT + 783;
  11449.   D3DRMERR_FACEUSED               = MAKE_D3RMDHRESULT + 784;
  11450.   D3DRMERR_NOTFOUND               = MAKE_D3RMDHRESULT + 785;
  11451.   D3DRMERR_NOTDONEYET             = MAKE_D3RMDHRESULT + 786;
  11452.   D3DRMERR_FILENOTFOUND           = MAKE_D3RMDHRESULT + 787;
  11453.   D3DRMERR_BADFILE                = MAKE_D3RMDHRESULT + 788;
  11454.   D3DRMERR_BADDEVICE              = MAKE_D3RMDHRESULT + 789;
  11455.   D3DRMERR_BADVALUE               = MAKE_D3RMDHRESULT + 790;
  11456.   D3DRMERR_BADMAJORVERSION        = MAKE_D3RMDHRESULT + 791;
  11457.   D3DRMERR_BADMINORVERSION        = MAKE_D3RMDHRESULT + 792;
  11458.   D3DRMERR_UNABLETOEXECUTE        = MAKE_D3RMDHRESULT + 793;
  11459.   D3DRMERR_LIBRARYNOTFOUND        = MAKE_D3RMDHRESULT + 794;
  11460.   D3DRMERR_INVALIDLIBRARY         = MAKE_D3RMDHRESULT + 795;
  11461.   D3DRMERR_PENDING                = MAKE_D3RMDHRESULT + 796;
  11462.   D3DRMERR_NOTENOUGHDATA          = MAKE_D3RMDHRESULT + 797;
  11463.   D3DRMERR_REQUESTTOOLARGE        = MAKE_D3RMDHRESULT + 798;
  11464.   D3DRMERR_REQUESTTOOSMALL        = MAKE_D3RMDHRESULT + 799;
  11465.   D3DRMERR_CONNECTIONLOST         = MAKE_D3RMDHRESULT + 800;
  11466.   D3DRMERR_LOADABORTED            = MAKE_D3RMDHRESULT + 801;
  11467.   D3DRMERR_NOINTERNET             = MAKE_D3RMDHRESULT + 802;
  11468.   D3DRMERR_BADCACHEFILE           = MAKE_D3RMDHRESULT + 803;
  11469.   D3DRMERR_BOXNOTSET              = MAKE_D3RMDHRESULT + 804;
  11470.   D3DRMERR_BADPMDATA              = MAKE_D3RMDHRESULT + 805;
  11471.   D3DRMERR_CLIENTNOTREGISTERED    = MAKE_D3RMDHRESULT + 806;
  11472.   D3DRMERR_NOTCREATEDFROMDDS      = MAKE_D3RMDHRESULT + 807;
  11473.   D3DRMERR_NOSUCHKEY              = MAKE_D3RMDHRESULT + 808;
  11474.   D3DRMERR_INCOMPATABLEKEY        = MAKE_D3RMDHRESULT + 809;
  11475.   D3DRMERR_ELEMENTINUSE           = MAKE_D3RMDHRESULT + 810;
  11476.   D3DRMERR_TEXTUREFORMATNOTFOUND  = MAKE_D3RMDHRESULT + 811;
  11477.  
  11478. (* Create a Direct3DRM API *)
  11479. var
  11480.   Direct3DRMCreate : function (out lplpDirect3DRM: IDirect3DRM) : HResult; stdcall;
  11481.  
  11482. (*==========================================================================;
  11483.  *
  11484.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11485.  *
  11486.  *  File:       d3drmwin.h
  11487.  *  Content:    Direct3DRM include file
  11488.  *
  11489.  ***************************************************************************)
  11490.  
  11491. type
  11492.   IDirect3DRMWinDevice = interface (IDirect3DRMObject)
  11493.     ['{c5016cc0-d273-11ce-ac48-0000c03825a1}']
  11494.     (*
  11495.      * IDirect3DRMWinDevice methods
  11496.      *)
  11497.  
  11498.     (* Repaint the window with the last frame which was rendered. *)
  11499.     function HandlePaint (hDC: HDC) : HResult; stdcall;
  11500.  
  11501.     (* Respond to a WM_ACTIVATE message. *)
  11502.     function HandleActivate (wparam: WORD) : HResult; stdcall;
  11503.   end;
  11504.  
  11505. (*
  11506.  * GUIDS used by Direct3DRM Windows interface
  11507.  *)
  11508.   IID_IDirect3DRMWinDevice = IDirect3DRMWinDevice;
  11509.  
  11510. (***************************************************************************
  11511.  *
  11512.  *  Copyright (C) 1998-1999 Microsoft Corporation.  All Rights Reserved.
  11513.  *
  11514.  *  File:       rmxfguid.h
  11515.  *
  11516.  *  Content:    Defines GUIDs of D3DRM's templates.
  11517.  *
  11518.  ***************************************************************************)
  11519.  
  11520. const
  11521. (* {2B957100-9E9A-11cf-AB39-0020AF71E433} *)
  11522.   TID_D3DRMInfo: TGUID =
  11523.       (D1:$2b957100;D2:$9e9a;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11524.  
  11525. (* {3D82AB44-62DA-11cf-AB39-0020AF71E433} *)
  11526.   TID_D3DRMMesh: TGUID =
  11527.       (D1:$3d82ab44;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11528.  
  11529. (* {3D82AB5E-62DA-11cf-AB39-0020AF71E433} *)
  11530.   TID_D3DRMVector: TGUID =
  11531.       (D1:$3d82ab5e;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11532.  
  11533. (* {3D82AB5F-62DA-11cf-AB39-0020AF71E433} *)
  11534.   TID_D3DRMMeshFace: TGUID =
  11535.       (D1:$3d82ab5f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11536.  
  11537. (* {3D82AB4D-62DA-11cf-AB39-0020AF71E433} *)
  11538.   TID_D3DRMMaterial: TGUID =
  11539.       (D1:$3d82ab4d;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11540.  
  11541. (* {35FF44E1-6C7C-11cf-8F52-0040333594A3} *)
  11542.   TID_D3DRMMaterialArray: TGUID =
  11543.       (D1:$35ff44e1;D2:$6c7c;D3:$11cf;D4:($8F,$52,$00,$40,$33,$35,$94,$a3));
  11544.  
  11545. (* {3D82AB46-62DA-11cf-AB39-0020AF71E433} *)
  11546.   TID_D3DRMFrame: TGUID =
  11547.       (D1:$3d82ab46;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11548.  
  11549. (* {F6F23F41-7686-11cf-8F52-0040333594A3} *)
  11550.   TID_D3DRMFrameTransformMatrix: TGUID =
  11551.       (D1:$f6f23f41;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11552.  
  11553. (* {F6F23F42-7686-11cf-8F52-0040333594A3} *)
  11554.   TID_D3DRMMeshMaterialList: TGUID =
  11555.       (D1:$f6f23f42;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11556.  
  11557. (* {F6F23F40-7686-11cf-8F52-0040333594A3} *)
  11558.   TID_D3DRMMeshTextureCoords: TGUID =
  11559.       (D1:$f6f23f40;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11560.  
  11561. (* {F6F23F43-7686-11cf-8F52-0040333594A3} *)
  11562.   TID_D3DRMMeshNormals: TGUID =
  11563.       (D1:$f6f23f43;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11564.  
  11565. (* {F6F23F44-7686-11cf-8F52-0040333594A3} *)
  11566.   TID_D3DRMCoords2d: TGUID =
  11567.       (D1:$f6f23f44;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11568.  
  11569. (* {F6F23F45-7686-11cf-8F52-0040333594A3} *)
  11570.   TID_D3DRMMatrix4x4: TGUID =
  11571.       (D1:$f6f23f45;D2:$7686;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11572.  
  11573. (* {3D82AB4F-62DA-11cf-AB39-0020AF71E433} *)
  11574.   TID_D3DRMAnimation: TGUID =
  11575.       (D1:$3d82ab4f;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11576.  
  11577. (* {3D82AB50-62DA-11cf-AB39-0020AF71E433} *)
  11578.   TID_D3DRMAnimationSet: TGUID =
  11579.       (D1:$3d82ab50;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11580.  
  11581. (* {10DD46A8-775B-11cf-8F52-0040333594A3} *)
  11582.   TID_D3DRMAnimationKey: TGUID =
  11583.       (D1:$10dd46a8;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11584.  
  11585. (* {10DD46A9-775B-11cf-8F52-0040333594A3} *)
  11586.   TID_D3DRMFloatKeys: TGUID =
  11587.       (D1:$10dd46a9;D2:$775b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11588.  
  11589. (* {01411840-7786-11cf-8F52-0040333594A3} *)
  11590.   TID_D3DRMMaterialAmbientColor: TGUID =
  11591.       (D1:$01411840;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11592.  
  11593. (* {01411841-7786-11cf-8F52-0040333594A3} *)
  11594.   TID_D3DRMMaterialDiffuseColor: TGUID =
  11595.       (D1:$01411841;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11596.  
  11597. (* {01411842-7786-11cf-8F52-0040333594A3} *)
  11598.   TID_D3DRMMaterialSpecularColor: TGUID =
  11599.       (D1:$01411842;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11600.  
  11601. (* {D3E16E80-7835-11cf-8F52-0040333594A3} *)
  11602.   TID_D3DRMMaterialEmissiveColor: TGUID =
  11603.       (D1:$d3e16e80;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11604.  
  11605. (* {01411843-7786-11cf-8F52-0040333594A3} *)
  11606.   TID_D3DRMMaterialPower: TGUID =
  11607.       (D1:$01411843;D2:$7786;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11608.  
  11609. (* {35FF44E0-6C7C-11cf-8F52-0040333594A3} *)
  11610.   TID_D3DRMColorRGBA: TGUID =
  11611.       (D1:$35ff44e0;D2:$6c7c;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$A3));
  11612.  
  11613. (* {D3E16E81-7835-11cf-8F52-0040333594A3} *)
  11614.   TID_D3DRMColorRGB: TGUID =
  11615.       (D1:$d3e16e81;D2:$7835;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11616.  
  11617. (* {A42790E0-7810-11cf-8F52-0040333594A3} *)
  11618.   TID_D3DRMGuid: TGUID =
  11619.       (D1:$a42790e0;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11620.  
  11621. (* {A42790E1-7810-11cf-8F52-0040333594A3} *)
  11622.   TID_D3DRMTextureFilename: TGUID =
  11623.       (D1:$a42790e1;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11624.  
  11625. (* {A42790E2-7810-11cf-8F52-0040333594A3} *)
  11626.   TID_D3DRMTextureReference: TGUID =
  11627.       (D1:$a42790e2;D2:$7810;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11628.  
  11629. (* {1630B820-7842-11cf-8F52-0040333594A3} *)
  11630.   TID_D3DRMIndexedColor: TGUID =
  11631.       (D1:$1630b820;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11632.  
  11633. (* {1630B821-7842-11cf-8F52-0040333594A3} *)
  11634.   TID_D3DRMMeshVertexColors: TGUID =
  11635.       (D1:$1630b821;D2:$7842;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11636.  
  11637. (* {4885AE60-78E8-11cf-8F52-0040333594A3} *)
  11638.   TID_D3DRMMaterialWrap: TGUID =
  11639.       (D1:$4885ae60;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11640.  
  11641. (* {537DA6A0-CA37-11d0-941C-0080C80CFA7B} *)
  11642.   TID_D3DRMBoolean: TGUID =
  11643.       (D1:$537da6a0;D2:$ca37;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
  11644.  
  11645. (* {ED1EC5C0-C0A8-11d0-941C-0080C80CFA7B} *)
  11646.   TID_D3DRMMeshFaceWraps: TGUID =
  11647.       (D1:$ed1ec5c0;D2:$c0a8;D3:$11d0;D4:($94,$1c,$00,$80,$c8,$0c,$fa,$7b));
  11648.  
  11649. (* {4885AE63-78E8-11cf-8F52-0040333594A3} *)
  11650.   TID_D3DRMBoolean2d: TGUID =
  11651.       (D1:$4885ae63;D2:$78e8;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11652.  
  11653. (* {F406B180-7B3B-11cf-8F52-0040333594A3} *)
  11654.   TID_D3DRMTimedFloatKeys: TGUID =
  11655.       (D1:$f406b180;D2:$7b3b;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11656.  
  11657. (* {E2BF56C0-840F-11cf-8F52-0040333594A3} *)
  11658.   TID_D3DRMAnimationOptions: TGUID =
  11659.       (D1:$e2bf56c0;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11660.  
  11661. (* {E2BF56C1-840F-11cf-8F52-0040333594A3} *)
  11662.   TID_D3DRMFramePosition: TGUID =
  11663.       (D1:$e2bf56c1;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11664.  
  11665. (* {E2BF56C2-840F-11cf-8F52-0040333594A3} *)
  11666.   TID_D3DRMFrameVelocity: TGUID =
  11667.       (D1:$e2bf56c2;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11668.  
  11669. (* {E2BF56C3-840F-11cf-8F52-0040333594A3} *)
  11670.   TID_D3DRMFrameRotation: TGUID =
  11671.       (D1:$e2bf56c3;D2:$840f;D3:$11cf;D4:($8f,$52,$00,$40,$33,$35,$94,$a3));
  11672.  
  11673. (* {3D82AB4A-62DA-11cf-AB39-0020AF71E433} *)
  11674.   TID_D3DRMLight: TGUID =
  11675.       (D1:$3d82ab4a;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11676.  
  11677. (* {3D82AB51-62DA-11cf-AB39-0020AF71E433} *)
  11678.   TID_D3DRMCamera: TGUID =
  11679.       (D1:$3d82ab51;D2:$62da;D3:$11cf;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11680.  
  11681. (* {E5745280-B24F-11cf-9DD5-00AA00A71A2F} *)
  11682.   TID_D3DRMAppData: TGUID =
  11683.       (D1:$e5745280;D2:$b24f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11684.  
  11685. (* {AED22740-B31F-11cf-9DD5-00AA00A71A2F} *)
  11686.   TID_D3DRMLightUmbra: TGUID =
  11687.       (D1:$aed22740;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11688.  
  11689. (* {AED22742-B31F-11cf-9DD5-00AA00A71A2F} *)
  11690.   TID_D3DRMLightRange: TGUID =
  11691.       (D1:$aed22742;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11692.  
  11693. (* {AED22741-B31F-11cf-9DD5-00AA00A71A2F} *)
  11694.   TID_D3DRMLightPenumbra: TGUID =
  11695.       (D1:$aed22741;D2:$b31f;D3:$11cf;D4:($9d,$d5,$00,$aa,$00,$a7,$1a,$2f));
  11696.  
  11697. (* {A8A98BA0-C5E5-11cf-B941-0080C80CFA7B} *)
  11698.   TID_D3DRMLightAttenuation: TGUID =
  11699.       (D1:$a8a98ba0;D2:$c5e5;D3:$11cf;D4:($b9,$41,$00,$80,$c8,$0c,$fa,$7b));
  11700.  
  11701. (* {3A23EEA0-94B1-11d0-AB39-0020AF71E433} *)
  11702.   TID_D3DRMInlineData: TGUID =
  11703.       (D1:$3a23eea0;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11704.  
  11705. (* {3A23EEA1-94B1-11d0-AB39-0020AF71E433} *)
  11706.   TID_D3DRMUrl: TGUID =
  11707.       (D1:$3a23eea1;D2:$94b1;D3:$11d0;D4:($ab,$39,$00,$20,$af,$71,$e4,$33));
  11708.  
  11709. (* {8A63C360-997D-11d0-941C-0080C80CFA7B} *)
  11710.   TID_D3DRMProgressiveMesh: TGUID =
  11711.       (D1:$8A63C360;D2:$997D;D3:$11d0;D4:($94,$1C,$00,$80,$C8,$0C,$FA,$7B));
  11712.  
  11713. (* {98116AA0-BDBA-11d1-82C0-00A0C9697271} *)
  11714.   TID_D3DRMExternalVisual: TGUID =
  11715.       (D1:$98116AA0;D2:$BDBA;D3:$11d1;D4:($82,$C0,$00,$A0,$C9,$69,$72,$71));
  11716.  
  11717. (* {7F0F21E0-BFE1-11d1-82C0-00A0C9697271} *)
  11718.   TID_D3DRMStringProperty: TGUID =
  11719.       (D1:$7f0f21e0;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11720.  
  11721. (* {7F0F21E1-BFE1-11d1-82C0-00A0C9697271} *)
  11722.   TID_D3DRMPropertyBag: TGUID =
  11723.       (D1:$7f0f21e1;D2:$bfe1;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11724.  
  11725. // {7F5D5EA0-D53A-11d1-82C0-00A0C9697271}
  11726.   TID_D3DRMRightHanded: TGUID =
  11727.       (D1:$7f5d5ea0;D2:$d53a;D3:$11d1;D4:($82,$c0,$00,$a0,$c9,$69,$72,$71));
  11728.  
  11729. (*==========================================================================;
  11730.  *
  11731.  *  Copyright (C) 1995-1997 Microsoft Corporation.  All Rights Reserved.
  11732.  *
  11733.  *  File:       rmxftmpl.h
  11734.  *  Content:    D3DRM XFile templates in binary form
  11735.  *
  11736.  ***************************************************************************)
  11737.  
  11738. const
  11739.   D3DRM_XTEMPLATE_BYTES_2  = 3278;
  11740.  
  11741.   D3DRM_XTEMPLATES_2: array [0..D3DRM_XTEMPLATE_BYTES_2-1] of byte = (
  11742.         $78, $6f, $66, $20, $30, $33, $30, $32, $62, $69, $6e, $20, $30, $30, $36, $34, $1f, 0, $1,
  11743.         0, $6, 0, 0, 0, $48, $65, $61, $64, $65, $72, $a, 0, $5, 0, $43, $ab, $82, $3d, $da,
  11744.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $28, 0, $1, 0, $5, 0, 0, 0, $6d,
  11745.         $61, $6a, $6f, $72, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $6d, $69, $6e, $6f, $72, $14,
  11746.         0, $29, 0, $1, 0, $5, 0, 0, 0, $66, $6c, $61, $67, $73, $14, 0, $b, 0, $1f, 0,
  11747.         $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $a, 0, $5, 0, $5e, $ab, $82, $3d,
  11748.         $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $2a, 0, $1, 0, $1, 0, 0, 0,
  11749.         $78, $14, 0, $2a, 0, $1, 0, $1, 0, 0, 0, $79, $14, 0, $2a, 0, $1, 0, $1, 0,
  11750.         0, 0, $7a, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64,
  11751.         $73, $32, $64, $a, 0, $5, 0, $44, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33,
  11752.         $35, $94, $a3, $2a, 0, $1, 0, $1, 0, 0, 0, $75, $14, 0, $2a, 0, $1, 0, $1, 0,
  11753.         0, 0, $76, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  11754.         $78, $34, $78, $34, $a, 0, $5, 0, $45, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  11755.         $33, $35, $94, $a3, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $6d, $61, $74, $72, $69, $78,
  11756.         $e, 0, $3, 0, $10, 0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $9, 0,
  11757.         0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $a, 0, $5, 0, $e0, $44, $ff, $35, $7c,
  11758.         $6c, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72,
  11759.         $65, $64, $14, 0, $2a, 0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a,
  11760.         0, $1, 0, $4, 0, 0, 0, $62, $6c, $75, $65, $14, 0, $2a, 0, $1, 0, $5, 0, 0,
  11761.         0, $61, $6c, $70, $68, $61, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $43, $6f,
  11762.         $6c, $6f, $72, $52, $47, $42, $a, 0, $5, 0, $81, $6e, $e1, $d3, $35, $78, $cf, $11, $8f, $52,
  11763.         0, $40, $33, $35, $94, $a3, $2a, 0, $1, 0, $3, 0, 0, 0, $72, $65, $64, $14, 0, $2a,
  11764.         0, $1, 0, $5, 0, 0, 0, $67, $72, $65, $65, $6e, $14, 0, $2a, 0, $1, 0, $4, 0,
  11765.         0, 0, $62, $6c, $75, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $49, $6e,
  11766.         $64, $65, $78, $65, $64, $43, $6f, $6c, $6f, $72, $a, 0, $5, 0, $20, $b8, $30, $16, $42, $78,
  11767.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5, 0, 0, 0, $69, $6e,
  11768.         $64, $65, $78, $14, 0, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41,
  11769.         $1, 0, $a, 0, 0, 0, $69, $6e, $64, $65, $78, $43, $6f, $6c, $6f, $72, $14, 0, $b, 0,
  11770.         $1f, 0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $a, 0, $5, 0, $a0,
  11771.         $a6, $7d, $53, $37, $ca, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1, 0, $9,
  11772.         0, 0, 0, $74, $72, $75, $65, $66, $61, $6c, $73, $65, $14, 0, $b, 0, $1f, 0, $1, 0,
  11773.         $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $a, 0, $5, 0, $63, $ae, $85,
  11774.         $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $7, 0, 0, 0, $42,
  11775.         $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14, 0, $1, 0, $7, 0, 0,
  11776.         0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $76, $14, 0, $b, 0, $1f,
  11777.         0, $1, 0, $c, 0, 0, 0, $4d, $61, $74, $65, $72, $69, $61, $6c, $57, $72, $61, $70, $a,
  11778.         0, $5, 0, $60, $ae, $85, $48, $e8, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1,
  11779.         0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0, $75, $14,
  11780.         0, $1, 0, $7, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $1, 0, $1, 0, 0, 0,
  11781.         $76, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $54, $65, $78, $74, $75, $72, $65,
  11782.         $46, $69, $6c, $65, $6e, $61, $6d, $65, $a, 0, $5, 0, $e1, $90, $27, $a4, $10, $78, $cf, $11,
  11783.         $8f, $52, 0, $40, $33, $35, $94, $a3, $31, 0, $1, 0, $8, 0, 0, 0, $66, $69, $6c, $65,
  11784.         $6e, $61, $6d, $65, $14, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0, 0, $4d, $61, $74, $65,
  11785.         $72, $69, $61, $6c, $a, 0, $5, 0, $4d, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20,
  11786.         $af, $71, $e4, $33, $1, 0, $9, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42, $41, $1,
  11787.         0, $9, 0, 0, 0, $66, $61, $63, $65, $43, $6f, $6c, $6f, $72, $14, 0, $2a, 0, $1, 0,
  11788.         $5, 0, 0, 0, $70, $6f, $77, $65, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c,
  11789.         $6f, $72, $52, $47, $42, $1, 0, $d, 0, 0, 0, $73, $70, $65, $63, $75, $6c, $61, $72, $43,
  11790.         $6f, $6c, $6f, $72, $14, 0, $1, 0, $8, 0, 0, 0, $43, $6f, $6c, $6f, $72, $52, $47, $42,
  11791.         $1, 0, $d, 0, 0, 0, $65, $6d, $69, $73, $73, $69, $76, $65, $43, $6f, $6c, $6f, $72, $14,
  11792.         0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $8, 0, 0,
  11793.         0, $4d, $65, $73, $68, $46, $61, $63, $65, $a, 0, $5, 0, $5f, $ab, $82, $3d, $da, $62, $cf,
  11794.         $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61,
  11795.         $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $14, 0, $34, 0, $29,
  11796.         0, $1, 0, $11, 0, 0, 0, $66, $61, $63, $65, $56, $65, $72, $74, $65, $78, $49, $6e, $64,
  11797.         $69, $63, $65, $73, $e, 0, $1, 0, $12, 0, 0, 0, $6e, $46, $61, $63, $65, $56, $65, $72,
  11798.         $74, $65, $78, $49, $6e, $64, $69, $63, $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  11799.         $d, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $57, $72, $61, $70, $73, $a, 0, $5,
  11800.         0, $c0, $c5, $1e, $ed, $a8, $c0, $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $29, 0, $1,
  11801.         0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73,
  11802.         $14, 0, $34, 0, $1, 0, $9, 0, 0, 0, $42, $6f, $6f, $6c, $65, $61, $6e, $32, $64, $1,
  11803.         0, $e, 0, 0, 0, $66, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75, $65, $73, $e,
  11804.         0, $1, 0, $f, 0, 0, 0, $6e, $46, $61, $63, $65, $57, $72, $61, $70, $56, $61, $6c, $75,
  11805.         $65, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $11, 0, 0, 0, $4d, $65, $73, $68,
  11806.         $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $a, 0, $5, 0, $40, $3f, $f2,
  11807.         $f6, $86, $76, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $e, 0, 0,
  11808.         0, $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $14, 0, $34, 0, $1,
  11809.         0, $8, 0, 0, 0, $43, $6f, $6f, $72, $64, $73, $32, $64, $1, 0, $d, 0, 0, 0, $74,
  11810.         $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $e, 0, $1, 0, $e, 0, 0, 0,
  11811.         $6e, $54, $65, $78, $74, $75, $72, $65, $43, $6f, $6f, $72, $64, $73, $f, 0, $14, 0, $b, 0,
  11812.         $1f, 0, $1, 0, $10, 0, 0, 0, $4d, $65, $73, $68, $4d, $61, $74, $65, $72, $69, $61, $6c,
  11813.         $4c, $69, $73, $74, $a, 0, $5, 0, $42, $3f, $f2, $f6, $86, $76, $cf, $11, $8f, $52, 0, $40,
  11814.         $33, $35, $94, $a3, $29, 0, $1, 0, $a, 0, 0, 0, $6e, $4d, $61, $74, $65, $72, $69, $61,
  11815.         $6c, $73, $14, 0, $29, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65, $49, $6e, $64,
  11816.         $65, $78, $65, $73, $14, 0, $34, 0, $29, 0, $1, 0, $b, 0, 0, 0, $66, $61, $63, $65,
  11817.         $49, $6e, $64, $65, $78, $65, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46, $61, $63, $65,
  11818.         $49, $6e, $64, $65, $78, $65, $73, $f, 0, $14, 0, $e, 0, $1, 0, $8, 0, 0, 0, $4d,
  11819.         $61, $74, $65, $72, $69, $61, $6c, $f, 0, $b, 0, $1f, 0, $1, 0, $b, 0, 0, 0, $4d,
  11820.         $65, $73, $68, $4e, $6f, $72, $6d, $61, $6c, $73, $a, 0, $5, 0, $43, $3f, $f2, $f6, $86, $76,
  11821.         $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $8, 0, 0, 0, $6e, $4e,
  11822.         $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74,
  11823.         $6f, $72, $1, 0, $7, 0, 0, 0, $6e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $8,
  11824.         0, 0, 0, $6e, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $29, 0, $1, 0, $c,
  11825.         0, 0, 0, $6e, $46, $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $14, 0, $34, 0, $1,
  11826.         0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65, $1, 0, $b, 0, 0, 0, $66,
  11827.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $e, 0, $1, 0, $c, 0, 0, 0, $6e, $46,
  11828.         $61, $63, $65, $4e, $6f, $72, $6d, $61, $6c, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0,
  11829.         $10, 0, 0, 0, $4d, $65, $73, $68, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72, $73,
  11830.         $a, 0, $5, 0, $21, $b8, $30, $16, $42, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3,
  11831.         $29, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  11832.         $73, $14, 0, $34, 0, $1, 0, $c, 0, 0, 0, $49, $6e, $64, $65, $78, $65, $64, $43, $6f,
  11833.         $6c, $6f, $72, $1, 0, $c, 0, 0, 0, $76, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f, $72,
  11834.         $73, $e, 0, $1, 0, $d, 0, 0, 0, $6e, $56, $65, $72, $74, $65, $78, $43, $6f, $6c, $6f,
  11835.         $72, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $4d, $65, $73, $68,
  11836.         $a, 0, $5, 0, $44, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33,
  11837.         $29, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74, $69, $63, $65, $73, $14, 0, $34,
  11838.         0, $1, 0, $6, 0, 0, 0, $56, $65, $63, $74, $6f, $72, $1, 0, $8, 0, 0, 0, $76,
  11839.         $65, $72, $74, $69, $63, $65, $73, $e, 0, $1, 0, $9, 0, 0, 0, $6e, $56, $65, $72, $74,
  11840.         $69, $63, $65, $73, $f, 0, $14, 0, $29, 0, $1, 0, $6, 0, 0, 0, $6e, $46, $61, $63,
  11841.         $65, $73, $14, 0, $34, 0, $1, 0, $8, 0, 0, 0, $4d, $65, $73, $68, $46, $61, $63, $65,
  11842.         $1, 0, $5, 0, 0, 0, $66, $61, $63, $65, $73, $e, 0, $1, 0, $6, 0, 0, 0, $6e,
  11843.         $46, $61, $63, $65, $73, $f, 0, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b,
  11844.         0, $1f, 0, $1, 0, $14, 0, 0, 0, $46, $72, $61, $6d, $65, $54, $72, $61, $6e, $73, $66,
  11845.         $6f, $72, $6d, $4d, $61, $74, $72, $69, $78, $a, 0, $5, 0, $41, $3f, $f2, $f6, $86, $76, $cf,
  11846.         $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $1, 0, $9, 0, 0, 0, $4d, $61, $74, $72, $69,
  11847.         $78, $34, $78, $34, $1, 0, $b, 0, 0, 0, $66, $72, $61, $6d, $65, $4d, $61, $74, $72, $69,
  11848.         $78, $14, 0, $b, 0, $1f, 0, $1, 0, $5, 0, 0, 0, $46, $72, $61, $6d, $65, $a, 0,
  11849.         $5, 0, $46, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0,
  11850.         $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $46, $6c,
  11851.         $6f, $61, $74, $4b, $65, $79, $73, $a, 0, $5, 0, $a9, $46, $dd, $10, $5b, $77, $cf, $11, $8f,
  11852.         $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75,
  11853.         $65, $73, $14, 0, $34, 0, $2a, 0, $1, 0, $6, 0, 0, 0, $76, $61, $6c, $75, $65, $73,
  11854.         $e, 0, $1, 0, $7, 0, 0, 0, $6e, $56, $61, $6c, $75, $65, $73, $f, 0, $14, 0, $b,
  11855.         0, $1f, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b,
  11856.         $65, $79, $73, $a, 0, $5, 0, $80, $b1, $6, $f4, $3b, $7b, $cf, $11, $8f, $52, 0, $40, $33,
  11857.         $35, $94, $a3, $29, 0, $1, 0, $4, 0, 0, 0, $74, $69, $6d, $65, $14, 0, $1, 0, $9,
  11858.         0, 0, 0, $46, $6c, $6f, $61, $74, $4b, $65, $79, $73, $1, 0, $6, 0, 0, 0, $74, $66,
  11859.         $6b, $65, $79, $73, $14, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41, $6e, $69, $6d,
  11860.         $61, $74, $69, $6f, $6e, $4b, $65, $79, $a, 0, $5, 0, $a8, $46, $dd, $10, $5b, $77, $cf, $11,
  11861.         $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $7, 0, 0, 0, $6b, $65, $79, $54,
  11862.         $79, $70, $65, $14, 0, $29, 0, $1, 0, $5, 0, 0, 0, $6e, $4b, $65, $79, $73, $14, 0,
  11863.         $34, 0, $1, 0, $e, 0, 0, 0, $54, $69, $6d, $65, $64, $46, $6c, $6f, $61, $74, $4b, $65,
  11864.         $79, $73, $1, 0, $4, 0, 0, 0, $6b, $65, $79, $73, $e, 0, $1, 0, $5, 0, 0, 0,
  11865.         $6e, $4b, $65, $79, $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $10, 0, 0, 0, $41,
  11866.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $4f, $70, $74, $69, $6f, $6e, $73, $a, 0, $5, 0, $c0,
  11867.         $56, $bf, $e2, $f, $84, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $a,
  11868.         0, 0, 0, $6f, $70, $65, $6e, $63, $6c, $6f, $73, $65, $64, $14, 0, $29, 0, $1, 0, $f,
  11869.         0, 0, 0, $70, $6f, $73, $69, $74, $69, $6f, $6e, $71, $75, $61, $6c, $69, $74, $79, $14, 0,
  11870.         $b, 0, $1f, 0, $1, 0, $9, 0, 0, 0, $41, $6e, $69, $6d, $61, $74, $69, $6f, $6e, $a,
  11871.         0, $5, 0, $4f, $ab, $82, $3d, $da, $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e,
  11872.         0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0, $c, 0, 0, 0, $41,
  11873.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $53, $65, $74, $a, 0, $5, 0, $50, $ab, $82, $3d, $da,
  11874.         $62, $cf, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $9, 0, 0, 0, $41,
  11875.         $6e, $69, $6d, $61, $74, $69, $6f, $6e, $f, 0, $b, 0, $1f, 0, $1, 0, $a, 0, 0, 0,
  11876.         $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $a, 0, $5, 0, $a0, $ee, $23, $3a, $b1, $94,
  11877.         $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $e, 0, $1, 0, $6, 0, 0, 0, $42, $49,
  11878.         $4e, $41, $52, $59, $f, 0, $b, 0, $1f, 0, $1, 0, $3, 0, 0, 0, $55, $72, $6c, $a,
  11879.         0, $5, 0, $a1, $ee, $23, $3a, $b1, $94, $d0, $11, $ab, $39, 0, $20, $af, $71, $e4, $33, $29,
  11880.         0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c, $73, $14, 0, $34, 0, $31, 0, $1, 0,
  11881.         $4, 0, 0, 0, $75, $72, $6c, $73, $e, 0, $1, 0, $5, 0, 0, 0, $6e, $55, $72, $6c,
  11882.         $73, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $f, 0, 0, 0, $50, $72, $6f, $67, $72,
  11883.         $65, $73, $73, $69, $76, $65, $4d, $65, $73, $68, $a, 0, $5, 0, $60, $c3, $63, $8a, $7d, $99,
  11884.         $d0, $11, $94, $1c, 0, $80, $c8, $c, $fa, $7b, $e, 0, $1, 0, $3, 0, 0, 0, $55, $72,
  11885.         $6c, $13, 0, $1, 0, $a, 0, 0, 0, $49, $6e, $6c, $69, $6e, $65, $44, $61, $74, $61, $f,
  11886.         0, $b, 0, $1f, 0, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $a, 0, $5, 0, $e0,
  11887.         $90, $27, $a4, $10, $78, $cf, $11, $8f, $52, 0, $40, $33, $35, $94, $a3, $29, 0, $1, 0, $5,
  11888.         0, 0, 0, $64, $61, $74, $61, $31, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61,
  11889.         $74, $61, $32, $14, 0, $28, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $33, $14, 0,
  11890.         $34, 0, $2d, 0, $1, 0, $5, 0, 0, 0, $64, $61, $74, $61, $34, $e, 0, $3, 0, $8,
  11891.         0, 0, 0, $f, 0, $14, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72,
  11892.         $69, $6e, $67, $50, $72, $6f, $70, $65, $72, $74, $79, $a, 0, $5, 0, $e0, $21, $f, $7f, $e1,
  11893.         $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $31, 0, $1, 0, $3, 0, 0, 0, $6b,
  11894.         $65, $79, $14, 0, $31, 0, $1, 0, $5, 0, 0, 0, $76, $61, $6c, $75, $65, $14, 0, $b,
  11895.         0, $1f, 0, $1, 0, $b, 0, 0, 0, $50, $72, $6f, $70, $65, $72, $74, $79, $42, $61, $67,
  11896.         $a, 0, $5, 0, $e1, $21, $f, $7f, $e1, $bf, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71,
  11897.         $e, 0, $1, 0, $e, 0, 0, 0, $53, $74, $72, $69, $6e, $67, $50, $72, $6f, $70, $65, $72,
  11898.         $74, $79, $f, 0, $b, 0, $1f, 0, $1, 0, $e, 0, 0, 0, $45, $78, $74, $65, $72, $6e,
  11899.         $61, $6c, $56, $69, $73, $75, $61, $6c, $a, 0, $5, 0, $a0, $6a, $11, $98, $ba, $bd, $d1, $11,
  11900.         $82, $c0, 0, $a0, $c9, $69, $72, $71, $1, 0, $4, 0, 0, 0, $47, $75, $69, $64, $1, 0,
  11901.         $12, 0, 0, 0, $67, $75, $69, $64, $45, $78, $74, $65, $72, $6e, $61, $6c, $56, $69, $73, $75,
  11902.         $61, $6c, $14, 0, $e, 0, $12, 0, $12, 0, $12, 0, $f, 0, $b, 0, $1f, 0, $1, 0,
  11903.         $b, 0, 0, 0, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $a, 0, $5, 0, $a0,
  11904.         $5e, $5d, $7f, $3a, $d5, $d1, $11, $82, $c0, 0, $a0, $c9, $69, $72, $71, $29, 0, $1, 0, $c,
  11905.         0, 0, 0, $62, $52, $69, $67, $68, $74, $48, $61, $6e, $64, $65, $64, $14, 0, $b, 0);
  11906.  
  11907. //---------------
  11908. {$ENDIF}
  11909. //DirectInput file
  11910. (*==========================================================================;
  11911.  *
  11912.  *  Copyright (C) 1996-1999 Microsoft Corporation.  All Rights Reserved.
  11913.  *
  11914.  *  File:       dinput.h
  11915.  *  Content:    DirectInput include file
  11916.  *
  11917.  *  DirectX 7.0 Delphi adaptation by Erik Unger, input format
  11918.  *  variable structure & other fixups by Arne Schäpers (as)
  11919.  *
  11920.  *  Modified: 10-Sep-2000
  11921.  *
  11922.  *  Download: http://www.delphi-jedi.org/DelphiGraphics/
  11923.  *  E-Mail: DelphiDirectX@next-reality.com
  11924.  *          a.schaepers@digitalpublishing.de            
  11925.  *
  11926.  ***************************************************************************)
  11927.  
  11928. { Some notes from as:
  11929.   1. DirectInput Enum callback functions which are documented with result
  11930.   type BOOL in the SDK had to be changed to result type integer because the debug
  11931.   version of DINPUT.DLL (which is the same for SDK versions 5.0, 5.2, 6.0, and 6.1)
  11932.   explicitely checks for two possible return values:
  11933.  
  11934.   0 - FALSE in C and in Delphi
  11935.   1 - TRUE in C, defined as DIENUM_CONTINUE
  11936.  
  11937.   In Delphi, TRUE means $FFFFFFFF (= -1) for the LongBool (= BOOL) data
  11938.   type, and AL = 1 (upper three bytes undefined) for the Boolean data type.
  11939.   The debug version of DINPUT.DLL will throw an external exception
  11940.   ("invalid return value for callback") when fed with either value.
  11941.  
  11942.   This change affects the following methods:
  11943.   EnumDevices, EnumObjects, EnumEffects, EnumCreatedEffectObjects
  11944.  
  11945.   2. Windows 98 and DX6 debug versions DInput and DSound
  11946.  
  11947.   Under Windows 98, the "debug" setup of the DirectX SDK 6.x skips DInput.DLL
  11948.   and DSound.DLL, i.e. makes you end up with the retail version of these two
  11949.   files without any notice.
  11950.   The debug versions of DInput.DLL and DSound.DLL can be found in the
  11951.   \extras\Win98\Win98Dbg folder of the SDK CD; they need to be installed
  11952.   "manually".
  11953.  
  11954.   This problem has been fixed with DX7 where the SDK installs the debug versions
  11955.   of DInput and DSound without any "manual" help.
  11956.  
  11957. }
  11958.  
  11959.  
  11960. var
  11961.   DInputDLL : HMODULE;
  11962.  
  11963. {$IFDEF DIRECTX3}
  11964. const DIRECTINPUT_VERSION = $0300;
  11965. {$ELSE}
  11966. const DIRECTINPUT_VERSION = $0700;
  11967. {$ENDIF}
  11968.  
  11969. function DIErrorString(Value: HResult) : string;
  11970.  
  11971. //type
  11972. //  TRefGUID = packed record
  11973. //    case integer of
  11974. //    1: (guid : PGUID);
  11975. //    2: (dwFlags : DWORD);
  11976. //  end;
  11977.  
  11978. (****************************************************************************
  11979.  *
  11980.  *      Class IDs
  11981.  *
  11982.  ****************************************************************************)
  11983. const
  11984.   CLSID_DirectInput: TGUID =
  11985.       (D1:$25E609E0;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  11986.   CLSID_DirectInputDevice: TGUID =
  11987.       (D1:$25E609E1;D2:$B259;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  11988.  
  11989. (****************************************************************************
  11990.  *
  11991.  *      Predefined object types
  11992.  *
  11993.  ****************************************************************************)
  11994.  
  11995.   GUID_XAxis: TGUID =
  11996.       (D1:$A36D02E0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  11997.   GUID_YAxis: TGUID =
  11998.       (D1:$A36D02E1;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  11999.   GUID_ZAxis: TGUID =
  12000.       (D1:$A36D02E2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12001.   GUID_RxAxis: TGUID =
  12002.       (D1:$A36D02F4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12003.   GUID_RyAxis: TGUID =
  12004.       (D1:$A36D02F5;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12005.   GUID_RzAxis: TGUID =
  12006.       (D1:$A36D02E3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12007.   GUID_Slider: TGUID =
  12008.       (D1:$A36D02E4;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12009.  
  12010.   GUID_Button: TGUID =
  12011.       (D1:$A36D02F0;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12012.   GUID_Key: TGUID =
  12013.       (D1:$55728220;D2:$D33C;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12014.  
  12015.   GUID_POV: TGUID =
  12016.       (D1:$A36D02F2;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12017.  
  12018.   GUID_Unknown: TGUID =
  12019.       (D1:$A36D02F3;D2:$C9F3;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12020.  
  12021. (****************************************************************************
  12022.  *
  12023.  *      Predefined product GUIDs
  12024.  *
  12025.  ****************************************************************************)
  12026.  
  12027.   GUID_SysMouse: TGUID =
  12028.       (D1:$6F1D2B60;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12029.   GUID_SysKeyboard: TGUID =
  12030.       (D1:$6F1D2B61;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12031.   GUID_Joystick: TGUID =
  12032.       (D1:$6F1D2B70;D2:$D5A0;D3:$11CF;D4:($BF,$C7,$44,$45,$53,$54,$00,$00));
  12033.   GUID_SysMouseEm: TGUID = '{6F1D2B80-D5A0-11CF-BFC7-444553540000}';
  12034.   GUID_SysMouseEm2: TGUID = '{6F1D2B81-D5A0-11CF-BFC7-444553540000}';
  12035.   GUID_SysKeyboardEm: TGUID = '{6F1D2B82-D5A0-11CF-BFC7-444553540000}';
  12036.   GUID_SysKeyboardEm2: TGUID = '{6F1D2B83-D5A0-11CF-BFC7-444553540000}';
  12037.  
  12038. (****************************************************************************
  12039.  *
  12040.  *      Predefined force feedback effects
  12041.  *
  12042.  ****************************************************************************)
  12043.  
  12044.   GUID_ConstantForce: TGUID =
  12045.       (D1:$13541C20;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12046.   GUID_RampForce: TGUID =
  12047.       (D1:$13541C21;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12048.   GUID_Square: TGUID =
  12049.       (D1:$13541C22;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12050.   GUID_Sine: TGUID =
  12051.       (D1:$13541C23;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12052.   GUID_Triangle: TGUID =
  12053.       (D1:$13541C24;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12054.   GUID_SawtoothUp: TGUID =
  12055.       (D1:$13541C25;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12056.   GUID_SawtoothDown: TGUID =
  12057.       (D1:$13541C26;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12058.   GUID_Spring: TGUID =
  12059.       (D1:$13541C27;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12060.   GUID_Damper: TGUID =
  12061.       (D1:$13541C28;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12062.   GUID_Inertia: TGUID =
  12063.       (D1:$13541C29;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12064.   GUID_Friction: TGUID =
  12065.       (D1:$13541C2A;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12066.   GUID_CustomForce: TGUID =
  12067.       (D1:$13541C2B;D2:$8E33;D3:$11D0;D4:($9A,$D0,$00,$A0,$C9,$A0,$6E,$35));
  12068.  
  12069.  
  12070.  
  12071. (****************************************************************************
  12072.  *
  12073.  *      Interfaces and Structures...
  12074.  *
  12075.  ****************************************************************************)
  12076.  
  12077. (****************************************************************************
  12078.  *
  12079.  *      IDirectInputEffect
  12080.  *
  12081.  ****************************************************************************)
  12082.  
  12083. const
  12084.   DIEFT_ALL                   = $00000000;
  12085.  
  12086.   DIEFT_CONSTANTFORCE         = $00000001;
  12087.   DIEFT_RAMPFORCE             = $00000002;
  12088.   DIEFT_PERIODIC              = $00000003;
  12089.   DIEFT_CONDITION             = $00000004;
  12090.   DIEFT_CUSTOMFORCE           = $00000005;
  12091.   DIEFT_HARDWARE              = $000000FF;
  12092.  
  12093.   DIEFT_FFATTACK              = $00000200;
  12094.   DIEFT_FFFADE                = $00000400;
  12095.   DIEFT_SATURATION            = $00000800;
  12096.   DIEFT_POSNEGCOEFFICIENTS    = $00001000;
  12097.   DIEFT_POSNEGSATURATION      = $00002000;
  12098.   DIEFT_DEADBAND              = $00004000;
  12099.   DIEFT_STARTDELAY            = $00008000;
  12100.  
  12101. function DIEFT_GETTYPE(n: variant) : byte;
  12102.  
  12103. const
  12104.   DI_DEGREES                  =     100;
  12105.   DI_FFNOMINALMAX             =   10000;
  12106.   DI_SECONDS                  = 1000000;
  12107.  
  12108. type
  12109.   PDIConstantForce = ^TDIConstantForce;
  12110.   TDIConstantForce = packed record
  12111.     lMagnitude : LongInt;
  12112.   end;
  12113.  
  12114.   PDIRampForce = ^TDIRampForce;
  12115.   TDIRampForce = packed record
  12116.     lStart : LongInt;
  12117.     lEnd : LongInt;
  12118.   end;
  12119.  
  12120.   PDIPeriodic = ^TDIPeriodic;
  12121.   TDIPeriodic = packed record
  12122.     dwMagnitude : DWORD;
  12123.     lOffset : LongInt;
  12124.     dwPhase : DWORD;
  12125.     dwPeriod : DWORD;
  12126.   end;
  12127.  
  12128.   PDICondition = ^TDICondition;
  12129.   TDICondition = packed record
  12130.     lOffset : LongInt;
  12131.     lPositiveCoefficient : LongInt;
  12132.     lNegativeCoefficient : LongInt;
  12133.     dwPositiveSaturation : DWORD;
  12134.     dwNegativeSaturation : DWORD;
  12135.     lDeadBand : LongInt;
  12136.   end;
  12137.  
  12138.   PDICustomForce = ^TDICustomForce;
  12139.   TDICustomForce = packed record
  12140.     cChannels : DWORD;
  12141.     dwSamplePeriod : DWORD;
  12142.     cSamples : DWORD;
  12143.     rglForceData : PLongInt;
  12144.   end;
  12145.  
  12146.   PDIEnvelope = ^TDIEnvelope;
  12147.   TDIEnvelope = packed record
  12148.     dwSize : DWORD;                   (* sizeof(DIENVELOPE)   *)
  12149.     dwAttackLevel : DWORD;
  12150.     dwAttackTime : DWORD;             (* Microseconds         *)
  12151.     dwFadeLevel : DWORD;
  12152.     dwFadeTime : DWORD;               (* Microseconds         *)
  12153.   end;
  12154.  
  12155.   PDIEffect_DX5 = ^TDIEffect_DX5;
  12156.   TDIEffect_DX5 = packed record
  12157.     dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
  12158.     dwFlags : DWORD;                  (* DIEFF_*              *)
  12159.     dwDuration : DWORD;               (* Microseconds         *)
  12160.     dwSamplePeriod : DWORD;           (* Microseconds         *)
  12161.     dwGain : DWORD;
  12162.     dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
  12163.     dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
  12164.     cAxes : DWORD;                    (* Number of axes       *)
  12165.     rgdwAxes : PDWORD;                (* Array of axes        *)
  12166.     rglDirection : PLongInt;          (* Array of directions  *)
  12167.     lpEnvelope : PDIEnvelope;         (* Optional             *)
  12168.     cbTypeSpecificParams : DWORD;     (* Size of params       *)
  12169.     lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
  12170.   end;
  12171.  
  12172.   PDIEffect_DX6 = ^TDIEffect_DX6;
  12173.   TDIEffect_DX6 = packed record
  12174.     dwSize : DWORD;                   (* sizeof(DIEFFECT)     *)
  12175.     dwFlags : DWORD;                  (* DIEFF_*              *)
  12176.     dwDuration : DWORD;               (* Microseconds         *)
  12177.     dwSamplePeriod : DWORD;           (* Microseconds         *)
  12178.     dwGain : DWORD;
  12179.     dwTriggerButton : DWORD;          (* or DIEB_NOTRIGGER    *)
  12180.     dwTriggerRepeatInterval : DWORD;  (* Microseconds         *)
  12181.     cAxes : DWORD;                    (* Number of axes       *)
  12182.     rgdwAxes : PDWORD;                (* Array of axes        *)
  12183.     rglDirection : PLongInt;          (* Array of directions  *)
  12184.     lpEnvelope : PDIEnvelope;         (* Optional             *)
  12185.     cbTypeSpecificParams : DWORD;     (* Size of params       *)
  12186.     lpvTypeSpecificParams : pointer;  (* Pointer to params    *)
  12187.     dwStartDelay: DWORD;              (* Microseconds         *)
  12188.   end;
  12189.  
  12190.   PDIEffect = ^TDIEffect;
  12191. {$IFDEF DIRECTX5}
  12192.   TDIEffect = TDIEffect_DX5;
  12193. {$ELSE}
  12194.   TDIEffect = TDIEffect_DX6;
  12195. {$ENDIF}
  12196.  
  12197.   PDIFileEffect = ^TDIFileEffect;
  12198.   TDIFileEffect = packed record
  12199.     dwSize : DWORD;
  12200.     GuidEffect: TGUID;
  12201.     lpDiEffect: PDIEffect;
  12202.     szFriendlyName : array [0..MAX_PATH-1] of AnsiChar;
  12203.   end;
  12204.  
  12205. const
  12206.   DIEFF_OBJECTIDS             = $00000001;
  12207.   DIEFF_OBJECTOFFSETS         = $00000002;
  12208.   DIEFF_CARTESIAN             = $00000010;
  12209.   DIEFF_POLAR                 = $00000020;
  12210.   DIEFF_SPHERICAL             = $00000040;
  12211.  
  12212.   DIEP_DURATION               = $00000001;
  12213.   DIEP_SAMPLEPERIOD           = $00000002;
  12214.   DIEP_GAIN                   = $00000004;
  12215.   DIEP_TRIGGERBUTTON          = $00000008;
  12216.   DIEP_TRIGGERREPEATINTERVAL  = $00000010;
  12217.   DIEP_AXES                   = $00000020;
  12218.   DIEP_DIRECTION              = $00000040;
  12219.   DIEP_ENVELOPE               = $00000080;
  12220.   DIEP_TYPESPECIFICPARAMS     = $00000100;
  12221. {$IFDEF DIRECTX5}
  12222.   DIEP_ALLPARAMS              = $000001FF;
  12223. {$ELSE}
  12224.   DIEP_STARTDELAY             = $00000200;
  12225.   DIEP_ALLPARAMS_DX5          = $000001FF;
  12226.   DIEP_ALLPARAMS              = $000003FF;
  12227. {$ENDIF}
  12228.   DIEP_START                  = $20000000;
  12229.   DIEP_NORESTART              = $40000000;
  12230.   DIEP_NODOWNLOAD             = $80000000;
  12231.   DIEB_NOTRIGGER              = $FFFFFFFF;
  12232.  
  12233.   DIES_SOLO                   = $00000001;
  12234.   DIES_NODOWNLOAD             = $80000000;
  12235.  
  12236.   DIEGES_PLAYING              = $00000001;
  12237.   DIEGES_EMULATED             = $00000002;
  12238.  
  12239.  
  12240. type
  12241.   PDIEffEscape = ^TDIEffEscape;
  12242.   TDIEffEscape = packed record
  12243.     dwSize : DWORD;
  12244.     dwCommand : DWORD;
  12245.     lpvInBuffer : pointer;
  12246.     cbInBuffer : DWORD;
  12247.     lpvOutBuffer : pointer;
  12248.     cbOutBuffer : DWORD;
  12249.   end;
  12250.  
  12251.  
  12252. //
  12253. // IDirectSoundCapture  // as: ???
  12254. //
  12255.   IDirectInputEffect = interface (IUnknown)
  12256.     ['{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}']
  12257.     (** IDirectInputEffect methods ***)
  12258.     function Initialize(hinst: THandle; dwVersion: DWORD;
  12259.         const rguid: TGUID) : HResult;  stdcall;
  12260.     function GetEffectGuid(var pguid: TGUID) : HResult;  stdcall;
  12261.     function GetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
  12262.     function SetParameters(var peff: TDIEffect; dwFlags: DWORD) : HResult;  stdcall;
  12263.     function Start(dwIterations: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12264.     function Stop : HResult;  stdcall;
  12265.     function GetEffectStatus(var pdwFlags : DWORD) : HResult;  stdcall;
  12266.     function Download : HResult;  stdcall;
  12267.     function Unload : HResult;  stdcall;
  12268.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12269.   end;
  12270.  
  12271. (****************************************************************************
  12272.  *
  12273.  *      IDirectInputDevice
  12274.  *
  12275.  ****************************************************************************)
  12276.  
  12277. const
  12278.   DIDEVTYPE_DEVICE = 1;
  12279.   DIDEVTYPE_MOUSE = 2;
  12280.   DIDEVTYPE_KEYBOARD = 3;
  12281.   DIDEVTYPE_JOYSTICK = 4;
  12282.   DIDEVTYPE_HID = $00010000;
  12283.  
  12284.   DIDEVTYPEMOUSE_UNKNOWN = 1;
  12285.   DIDEVTYPEMOUSE_TRADITIONAL = 2;
  12286.   DIDEVTYPEMOUSE_FINGERSTICK = 3;
  12287.   DIDEVTYPEMOUSE_TOUCHPAD = 4;
  12288.   DIDEVTYPEMOUSE_TRACKBALL = 5;
  12289.  
  12290.   DIDEVTYPEKEYBOARD_UNKNOWN = 0;
  12291.   DIDEVTYPEKEYBOARD_PCXT = 1;
  12292.   DIDEVTYPEKEYBOARD_OLIVETTI = 2;
  12293.   DIDEVTYPEKEYBOARD_PCAT = 3;
  12294.   DIDEVTYPEKEYBOARD_PCENH = 4;
  12295.   DIDEVTYPEKEYBOARD_NOKIA1050 = 5;
  12296.   DIDEVTYPEKEYBOARD_NOKIA9140 = 6;
  12297.   DIDEVTYPEKEYBOARD_NEC98 = 7;
  12298.   DIDEVTYPEKEYBOARD_NEC98LAPTOP = 8;
  12299.   DIDEVTYPEKEYBOARD_NEC98106 = 9;
  12300.   DIDEVTYPEKEYBOARD_JAPAN106 = 10;
  12301.   DIDEVTYPEKEYBOARD_JAPANAX = 11;
  12302.   DIDEVTYPEKEYBOARD_J3100 = 12;
  12303.  
  12304.   DIDEVTYPEJOYSTICK_UNKNOWN = 1;
  12305.   DIDEVTYPEJOYSTICK_TRADITIONAL = 2;
  12306.   DIDEVTYPEJOYSTICK_FLIGHTSTICK = 3;
  12307.   DIDEVTYPEJOYSTICK_GAMEPAD = 4;
  12308.   DIDEVTYPEJOYSTICK_RUDDER = 5;
  12309.   DIDEVTYPEJOYSTICK_WHEEL = 6;
  12310.   DIDEVTYPEJOYSTICK_HEADTRACKER = 7;
  12311.  
  12312. function GET_DIDEVICE_TYPE(dwDevType: variant) : byte;
  12313. function GET_DIDEVICE_SUBTYPE(dwDevType: variant) : byte;
  12314.  
  12315. type
  12316.   PDIDevCaps_DX3 = ^TDIDevCaps_DX3;
  12317.   TDIDevCaps_DX3 = packed record
  12318.     dwSize: DWORD;
  12319.     dwFlags: DWORD;
  12320.     dwDevType: DWORD;
  12321.     dwAxes: DWORD;
  12322.     dwButtons: DWORD;
  12323.     dwPOVs: DWORD;
  12324.   end;
  12325.  
  12326.   PDIDevCaps_DX5 = ^TDIDevCaps_DX5;
  12327.   TDIDevCaps_DX5 = packed record
  12328.     dwSize: DWORD;
  12329.     dwFlags: DWORD;
  12330.     dwDevType: DWORD;
  12331.     dwAxes: DWORD;
  12332.     dwButtons: DWORD;
  12333.     dwPOVs: DWORD;
  12334.     dwFFSamplePeriod: DWORD;
  12335.     dwFFMinTimeResolution: DWORD;
  12336.     dwFirmwareRevision: DWORD;
  12337.     dwHardwareRevision: DWORD;
  12338.     dwFFDriverVersion: DWORD;
  12339.   end;
  12340.  
  12341.   PDIDevCaps = ^TDIDevCaps;
  12342. {$IFDEF DIRECTX3}
  12343.   TDIDevCaps = TDIDevCaps_DX3;
  12344. {$ELSE}
  12345.   TDIDevCaps = TDIDevCaps_DX5;
  12346. {$ENDIF}
  12347.  
  12348. const
  12349.   DIDC_ATTACHED           = $00000001;
  12350.   DIDC_POLLEDDEVICE       = $00000002;
  12351.   DIDC_EMULATED           = $00000004;
  12352.   DIDC_POLLEDDATAFORMAT   = $00000008;
  12353.   DIDC_FORCEFEEDBACK      = $00000100;
  12354.   DIDC_FFATTACK           = $00000200;
  12355.   DIDC_FFFADE             = $00000400;
  12356.   DIDC_SATURATION         = $00000800;
  12357.   DIDC_POSNEGCOEFFICIENTS = $00001000;
  12358.   DIDC_POSNEGSATURATION   = $00002000;
  12359.   DIDC_DEADBAND           = $00004000;
  12360.   DIDC_STARTDELAY         = $00008000;
  12361.   DIDC_ALIAS              = $00010000;
  12362.   DIDC_PHANTOM            = $00020000;
  12363.  
  12364.   DIDFT_ALL = $00000000;
  12365.  
  12366.   DIDFT_RELAXIS = $00000001;
  12367.   DIDFT_ABSAXIS = $00000002;
  12368.   DIDFT_AXIS    = $00000003;
  12369.  
  12370.   DIDFT_PSHBUTTON = $00000004;
  12371.   DIDFT_TGLBUTTON = $00000008;
  12372.   DIDFT_BUTTON    = $0000000C;
  12373.  
  12374.   DIDFT_POV        = $00000010;
  12375.   DIDFT_COLLECTION = $00000040;
  12376.   DIDFT_NODATA     = $00000080;
  12377.  
  12378.   DIDFT_ANYINSTANCE = $00FFFF00;
  12379.   DIDFT_INSTANCEMASK = DIDFT_ANYINSTANCE;
  12380. function DIDFT_MAKEINSTANCE(n: variant) : DWORD;
  12381. function DIDFT_GETTYPE(n: variant) : byte;
  12382. function DIDFT_GETINSTANCE(n: variant) : DWORD;
  12383. const
  12384.   DIDFT_FFACTUATOR        = $01000000;
  12385.   DIDFT_FFEFFECTTRIGGER   = $02000000;
  12386.   DIDFT_OUTPUT            = $10000000;
  12387.   DIDFT_VENDORDEFINED     = $04000000;
  12388.   DIDFT_ALIAS             = $08000000;
  12389.  
  12390. function DIDFT_ENUMCOLLECTION(n: variant) : DWORD;
  12391. const
  12392.   DIDFT_NOCOLLECTION = $00FFFF00;
  12393.  
  12394.  
  12395.  
  12396. type
  12397.   PDIObjectDataFormat = ^TDIObjectDataFormat;
  12398.   TDIObjectDataFormat = packed record
  12399.     pguid: PGUID;
  12400.     dwOfs: DWORD;
  12401.     dwType: DWORD;
  12402.     dwFlags: DWORD;
  12403.   end;
  12404.  
  12405.   PDIDataFormat = ^TDIDataFormat;
  12406.   TDIDataFormat = packed record
  12407.     dwSize: DWORD;  
  12408.     dwObjSize: DWORD;
  12409.     dwFlags: DWORD;  
  12410.     dwDataSize: DWORD;  
  12411.     dwNumObjs: DWORD;  
  12412.     rgodf: PDIObjectDataFormat;
  12413.   end;
  12414.  
  12415. const
  12416.   DIDF_ABSAXIS = $00000001;
  12417.   DIDF_RELAXIS = $00000002;
  12418.  
  12419. type
  12420.   PDIDeviceObjectInstance_DX3A = ^TDIDeviceObjectInstance_DX3A;
  12421.   TDIDeviceObjectInstance_DX3A = packed record
  12422.     dwSize: DWORD;
  12423.     guidType: TGUID;
  12424.     dwOfs: DWORD;
  12425.     dwType: DWORD;
  12426.     dwFlags: DWORD;
  12427.     tszName: Array [0..MAX_PATH-1] of CHAR;
  12428.   end;
  12429.  
  12430.   PDIDeviceObjectInstance_DX3W = ^TDIDeviceObjectInstance_DX3W;
  12431.   TDIDeviceObjectInstance_DX3W = packed record
  12432.     dwSize: DWORD;
  12433.     guidType: TGUID;
  12434.     dwOfs: DWORD;
  12435.     dwType: DWORD;
  12436.     dwFlags: DWORD;
  12437.     tszName: Array [0..MAX_PATH-1] of WCHAR;
  12438.   end;
  12439.  
  12440.   PDIDeviceObjectInstance_DX3 = ^TDIDeviceObjectInstance_DX3;
  12441. {$IFDEF UNICODE}
  12442.   TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3W;
  12443. {$ELSE}
  12444.   TDIDeviceObjectInstance_DX3 = TDIDeviceObjectInstance_DX3A;
  12445. {$ENDIF}
  12446.  
  12447.   PDIDeviceObjectInstance_DX5A = ^TDIDeviceObjectInstance_DX5A;
  12448.   TDIDeviceObjectInstance_DX5A = packed record
  12449.     dwSize: DWORD;
  12450.     guidType: TGUID;
  12451.     dwOfs: DWORD;
  12452.     dwType: DWORD;
  12453.     dwFlags: DWORD;
  12454.     tszName: Array [0..MAX_PATH-1] of CHAR;
  12455.     dwFFMaxForce: DWORD;
  12456.     dwFFForceResolution: DWORD;
  12457.     wCollectionNumber: WORD;
  12458.     wDesignatorIndex: WORD;
  12459.     wUsagePage: WORD;
  12460.     wUsage: WORD;
  12461.     dwDimension: DWORD;
  12462.     wExponent: WORD;
  12463.     wReserved: WORD;
  12464.   end;
  12465.  
  12466.   PDIDeviceObjectInstance_DX5W = ^TDIDeviceObjectInstance_DX5W;
  12467.   TDIDeviceObjectInstance_DX5W = packed record
  12468.     dwSize: DWORD;
  12469.     guidType: TGUID;
  12470.     dwOfs: DWORD;
  12471.     dwType: DWORD;
  12472.     dwFlags: DWORD;
  12473.     tszName: Array [0..MAX_PATH-1] of WCHAR;
  12474.     dwFFMaxForce: DWORD;
  12475.     dwFFForceResolution: DWORD;
  12476.     wCollectionNumber: WORD;
  12477.     wDesignatorIndex: WORD;
  12478.     wUsagePage: WORD;
  12479.     wUsage: WORD;
  12480.     dwDimension: DWORD;
  12481.     wExponent: WORD;
  12482.     wReserved: WORD;
  12483.   end;
  12484.  
  12485.   PDIDeviceObjectInstance_DX5 = ^TDIDeviceObjectInstance_DX5;
  12486. {$IFDEF UNICODE}
  12487.   TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5W;
  12488. {$ELSE}
  12489.   TDIDeviceObjectInstance_DX5 = TDIDeviceObjectInstance_DX5A;
  12490. {$ENDIF}
  12491.  
  12492.   PDIDeviceObjectInstanceA = ^TDIDeviceObjectInstanceA;
  12493.   PDIDeviceObjectInstanceW = ^TDIDeviceObjectInstanceA;
  12494.   PDIDeviceObjectInstance = ^TDIDeviceObjectInstance;
  12495. {$IFDEF DIRECTX3}
  12496.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX3A;
  12497.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX3W;
  12498.   TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX3;
  12499. {$ELSE}
  12500.   TDIDeviceObjectInstanceA = TDIDeviceObjectInstance_DX5A;
  12501.   TDIDeviceObjectInstanceW = TDIDeviceObjectInstance_DX5W;
  12502.   TDIDeviceObjectInstance = TDIDeviceObjectInstance_DX5;
  12503. {$ENDIF}
  12504.  
  12505.   // Bug fix (and deviation from the SDK). Callback *must* return
  12506.   // DIENUM_STOP (= 0) or DIENUM_CONTINUE (=1) in order to work
  12507.   // with the debug version of DINPUT.DLL
  12508.   TDIEnumDeviceObjectsCallbackA = function (
  12509.       var lpddoi: TDIDeviceObjectInstanceA; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12510.   TDIEnumDeviceObjectsCallbackW = function (
  12511.       var lpddoi: TDIDeviceObjectInstanceW; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12512.   TDIEnumDeviceObjectsCallback = function (
  12513.       var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12514.  
  12515.   TDIEnumDeviceObjectsProc = function (
  12516.       var lpddoi: TDIDeviceObjectInstance; pvRef: Pointer): Integer; stdcall; // BOOL; stdcall;
  12517.  
  12518. const
  12519.   DIDOI_FFACTUATOR        = $00000001;
  12520.   DIDOI_FFEFFECTTRIGGER   = $00000002;
  12521.   DIDOI_POLLED            = $00008000;
  12522.   DIDOI_ASPECTPOSITION    = $00000100;
  12523.   DIDOI_ASPECTVELOCITY    = $00000200;
  12524.   DIDOI_ASPECTACCEL       = $00000300;
  12525.   DIDOI_ASPECTFORCE       = $00000400;
  12526.   DIDOI_ASPECTMASK        = $00000F00;
  12527.   DIDOI_GUIDISUSAGE       = $00010000;
  12528.  
  12529. type
  12530.   PDIPropHeader = ^TDIPropHeader;
  12531.   TDIPropHeader = packed record
  12532.     dwSize: DWORD;
  12533.     dwHeaderSize: DWORD;
  12534.     dwObj: DWORD;
  12535.     dwHow: DWORD;
  12536.   end;
  12537.  
  12538. const
  12539.   DIPH_DEVICE = 0;
  12540.   DIPH_BYOFFSET = 1;
  12541.   DIPH_BYID = 2;
  12542.   DIPH_BYUSAGE = 3;
  12543.  
  12544. function DIMAKEUSAGEDWORD(UsagePage, Usage: WORD) : DWORD;
  12545.  
  12546. type
  12547.   PDIPropDWord = ^TDIPropDWord;
  12548.   TDIPropDWord = packed record
  12549.     diph: TDIPropHeader;
  12550.     dwData: DWORD;
  12551.   end;
  12552.  
  12553.   PDIPropRange = ^TDIPropRange;
  12554.   TDIPropRange = packed record
  12555.     diph: TDIPropHeader;
  12556.     lMin: Longint;
  12557.     lMax: Longint;
  12558.   end;
  12559.  
  12560. const
  12561.   DIPROPRANGE_NOMIN = $80000000;
  12562.   DIPROPRANGE_NOMAX = $7FFFFFFF;
  12563.  
  12564. type
  12565.   PDIPropCal = ^TDIPropCal;
  12566.   TDIPropCal = packed record
  12567.     diph: TDIPropHeader;
  12568.     lMin:    LongInt;
  12569.     lCenter: LongInt;
  12570.     lMax:    LongInt;
  12571.   end;
  12572.  
  12573.   PDIPropGUIDAndPath = ^TDIPropGUIDAndPath;
  12574.   TDIPropGUIDAndPath = packed record
  12575.     diph: TDIPropHeader;
  12576.     guidClass: TGUID;
  12577.     wszPath: array [0..MAX_PATH-1] of WideChar;
  12578.   end;
  12579.  
  12580.   PDIPropString = ^TDIPropString;
  12581.   TDIPropString = packed record
  12582.     diph: TDIPropHeader;
  12583.     wsz: array [0..MAX_PATH-1] of WideChar;
  12584.   end;
  12585.  
  12586. type
  12587.   MAKEDIPROP = PGUID;
  12588.  
  12589. const
  12590.   DIPROP_BUFFERSIZE = MAKEDIPROP(1);
  12591.  
  12592.   DIPROP_AXISMODE = MAKEDIPROP(2);
  12593.  
  12594.   DIPROPAXISMODE_ABS = 0;
  12595.   DIPROPAXISMODE_REL = 1;
  12596.  
  12597.   DIPROP_GRANULARITY = MAKEDIPROP(3);
  12598.  
  12599.   DIPROP_RANGE = MAKEDIPROP(4);
  12600.  
  12601.   DIPROP_DEADZONE = MAKEDIPROP(5);
  12602.  
  12603.   DIPROP_SATURATION = MAKEDIPROP(6);
  12604.  
  12605.   DIPROP_FFGAIN = MAKEDIPROP(7);
  12606.  
  12607.   DIPROP_FFLOAD = MAKEDIPROP(8);
  12608.  
  12609.   DIPROP_AUTOCENTER = MAKEDIPROP(9);
  12610.  
  12611.   DIPROPAUTOCENTER_OFF = 0;
  12612.   DIPROPAUTOCENTER_ON = 1;
  12613.  
  12614.   DIPROP_CALIBRATIONMODE = MAKEDIPROP(10);
  12615.  
  12616.   DIPROPCALIBRATIONMODE_COOKED = 0;
  12617.   DIPROPCALIBRATIONMODE_RAW = 1;
  12618.  
  12619.   DIPROP_CALIBRATION      = MAKEDIPROP(11);
  12620.  
  12621.   DIPROP_GUIDANDPATH      = MAKEDIPROP(12);
  12622.  
  12623.   DIPROP_INSTANCENAME     = MAKEDIPROP(13);
  12624.  
  12625.   DIPROP_PRODUCTNAME      = MAKEDIPROP(14);
  12626.  
  12627.   DIPROP_JOYSTICKID       = MAKEDIPROP(15);
  12628.  
  12629.   DIPROP_GETPORTDISPLAYNAME       = MAKEDIPROP(16);
  12630.  
  12631.  
  12632.   DIPROP_ENABLEREPORTID       = MAKEDIPROP(17);
  12633.  
  12634.  
  12635.   DIPROP_GETPHYSICALRANGE            = MAKEDIPROP(18);
  12636.  
  12637.   DIPROP_GETLOGICALRANGE            = MAKEDIPROP(19);
  12638.  
  12639.  
  12640. type
  12641.   PDIDeviceObjectData = ^TDIDeviceObjectData;
  12642.   TDIDeviceObjectData = packed record
  12643.     dwOfs: DWORD;
  12644.     dwData: DWORD;
  12645.     dwTimeStamp: DWORD;
  12646.     dwSequence: DWORD;
  12647.   end;
  12648.  
  12649. const
  12650.   DIGDD_PEEK = $00000001;
  12651. {
  12652. #define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \
  12653.                          (int) ((dwSequence1) - (dwSequence2))  cmp 0
  12654. }
  12655.  
  12656.   DISCL_EXCLUSIVE  = $00000001;
  12657.   DISCL_NONEXCLUSIVE = $00000002;
  12658.   DISCL_FOREGROUND = $00000004;
  12659.   DISCL_BACKGROUND = $00000008;
  12660.   DISCL_NOWINKEY   = $00000010;
  12661.  
  12662.  
  12663. type
  12664.  
  12665.   PDIDeviceInstance_DX3A = ^TDIDeviceInstance_DX3A;
  12666.   TDIDeviceInstance_DX3A = packed record
  12667.     dwSize: DWORD;
  12668.     guidInstance: TGUID;
  12669.     guidProduct: TGUID;
  12670.     dwDevType: DWORD;
  12671.     tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
  12672.     tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
  12673.   end;
  12674.  
  12675.   PDIDeviceInstance_DX3W = ^TDIDeviceInstance_DX3W;
  12676.   TDIDeviceInstance_DX3W = packed record
  12677.     dwSize: DWORD;
  12678.     guidInstance: TGUID;
  12679.     guidProduct: TGUID;
  12680.     dwDevType: DWORD;
  12681.     tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
  12682.     tszProductName: Array [0..MAX_PATH-1] of WideChar;
  12683.   end;
  12684.  
  12685.   PDIDeviceInstance_DX3 = ^TDIDeviceInstance_DX3;
  12686. {$IFDEF UNICODE}
  12687.   TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3W;
  12688. {$ELSE}
  12689.   TDIDeviceInstance_DX3 = TDIDeviceInstance_DX3A;
  12690. {$ENDIF}
  12691.  
  12692.   PDIDeviceInstance_DX5A = ^TDIDeviceInstance_DX5A;
  12693.   TDIDeviceInstance_DX5A = packed record
  12694.     dwSize: DWORD;
  12695.     guidInstance: TGUID;
  12696.     guidProduct: TGUID;
  12697.     dwDevType: DWORD;
  12698.     tszInstanceName: Array [0..MAX_PATH-1] of AnsiChar;
  12699.     tszProductName: Array [0..MAX_PATH-1] of AnsiChar;
  12700.     guidFFDriver: TGUID;
  12701.     wUsagePage: WORD;
  12702.     wUsage: WORD;
  12703.   end;
  12704.  
  12705.   PDIDeviceInstance_DX5W = ^TDIDeviceInstance_DX5W;
  12706.   TDIDeviceInstance_DX5W = packed record
  12707.     dwSize: DWORD;
  12708.     guidInstance: TGUID;
  12709.     guidProduct: TGUID;
  12710.     dwDevType: DWORD;
  12711.     tszInstanceName: Array [0..MAX_PATH-1] of WideChar;
  12712.     tszProductName: Array [0..MAX_PATH-1] of WideChar;
  12713.     guidFFDriver: TGUID;
  12714.     wUsagePage: WORD;
  12715.     wUsage: WORD;
  12716.   end;
  12717.  
  12718.   PDIDeviceInstance_DX5 = ^TDIDeviceInstance_DX5;
  12719. {$IFDEF UNICODE}
  12720.   TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5W;
  12721. {$ELSE}
  12722.   TDIDeviceInstance_DX5 = TDIDeviceInstance_DX5A;
  12723. {$ENDIF}
  12724.  
  12725.   PDIDeviceInstanceA = ^TDIDeviceInstanceA;
  12726.   PDIDeviceInstanceW = ^TDIDeviceInstanceW;
  12727.   PDIDeviceInstance = ^TDIDeviceInstance;
  12728. {$IFDEF DIRECTX3}
  12729.   TDIDeviceInstanceA = TDIDeviceInstance_DX3A;
  12730.   TDIDeviceInstanceW = TDIDeviceInstance_DX3W;
  12731.   TDIDeviceInstance = TDIDeviceInstance_DX3;
  12732. {$ELSE}
  12733.   TDIDeviceInstanceA = TDIDeviceInstance_DX5A;
  12734.   TDIDeviceInstanceW = TDIDeviceInstance_DX5W;
  12735.   TDIDeviceInstance = TDIDeviceInstance_DX5;
  12736. {$ENDIF}
  12737.  
  12738.   IDirectInputDeviceA = interface (IUnknown)
  12739.     ['{5944E680-C92E-11CF-BFC7-444553540000}']
  12740.     (*** IDirectInputDeviceA methods ***)
  12741.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
  12742.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackA;
  12743.         pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
  12744.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12745.         HResult;  stdcall;
  12746.     function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader) :
  12747.         HResult;  stdcall;
  12748.     function Acquire : HResult;  stdcall;
  12749.     function Unacquire : HResult;  stdcall;
  12750.     function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
  12751.     function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
  12752.         var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12753.     function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
  12754.     function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
  12755.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12756.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceA; dwObj: DWORD;
  12757.         dwHow: DWORD) : HResult;  stdcall;
  12758.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceA) : HResult;  stdcall;
  12759.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12760.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
  12761.   end;
  12762.  
  12763.   IDirectInputDeviceW = interface (IUnknown)
  12764.     ['{5944E681-C92E-11CF-BFC7-444553540000}']
  12765.     (*** IDirectInputDeviceW methods ***)
  12766.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps) : HResult;  stdcall;
  12767.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackW;
  12768.         pvRef: Pointer; dwFlags: DWORD) : HResult;  stdcall;
  12769.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12770.         HResult;  stdcall;
  12771.     function SetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader) :
  12772.         HResult;  stdcall;
  12773.     function Acquire : HResult;  stdcall;
  12774.     function Unacquire : HResult;  stdcall;
  12775.     function GetDeviceState(cbData: DWORD; lpvData: Pointer) : HResult;  stdcall;
  12776.     function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData;
  12777.         var pdwInOut: DWORD; dwFlags: DWORD) : HResult;  stdcall;
  12778.     function SetDataFormat(var lpdf: TDIDataFormat) : HResult;  stdcall;
  12779.     function SetEventNotification(hEvent: THandle) : HResult;  stdcall;
  12780.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12781.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceW; dwObj: DWORD;
  12782.         dwHow: DWORD) : HResult;  stdcall;
  12783.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceW) : HResult;  stdcall;
  12784.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD) : HResult;  stdcall;
  12785.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID) : HResult;  stdcall;
  12786.   end;
  12787.  
  12788. {$IFDEF UNICODE}
  12789.   IDirectInputDevice = IDirectInputDeviceW;
  12790. {$ELSE}
  12791.   IDirectInputDevice = IDirectInputDeviceA;
  12792. {$ENDIF}
  12793.  
  12794. const
  12795.   DISFFC_RESET            = $00000001;
  12796.   DISFFC_STOPALL          = $00000002;
  12797.   DISFFC_PAUSE            = $00000004;
  12798.   DISFFC_CONTINUE         = $00000008;
  12799.   DISFFC_SETACTUATORSON   = $00000010;
  12800.   DISFFC_SETACTUATORSOFF  = $00000020;
  12801.  
  12802.   DIGFFS_EMPTY            = $00000001;
  12803.   DIGFFS_STOPPED          = $00000002;
  12804.   DIGFFS_PAUSED           = $00000004;
  12805.   DIGFFS_ACTUATORSON      = $00000010;
  12806.   DIGFFS_ACTUATORSOFF     = $00000020;
  12807.   DIGFFS_POWERON          = $00000040;
  12808.   DIGFFS_POWEROFF         = $00000080;
  12809.   DIGFFS_SAFETYSWITCHON   = $00000100;
  12810.   DIGFFS_SAFETYSWITCHOFF  = $00000200;
  12811.   DIGFFS_USERFFSWITCHON   = $00000400;
  12812.   DIGFFS_USERFFSWITCHOFF  = $00000800;
  12813.   DIGFFS_DEVICELOST       = $80000000;
  12814.  
  12815. type
  12816.   PDIEffectInfoA = ^TDIEffectInfoA;
  12817.   TDIEffectInfoA = packed record
  12818.     dwSize : DWORD;
  12819.     guid : TGUID;
  12820.     dwEffType : DWORD;
  12821.     dwStaticParams : DWORD;
  12822.     dwDynamicParams : DWORD;
  12823.     tszName : array [0..MAX_PATH-1] of CHAR;
  12824.   end;
  12825.  
  12826.   PDIEffectInfoW = ^TDIEffectInfoW;
  12827.   TDIEffectInfoW = packed record
  12828.     dwSize : DWORD;
  12829.     guid : TGUID;
  12830.     dwEffType : DWORD;
  12831.     dwStaticParams : DWORD;
  12832.     dwDynamicParams : DWORD;
  12833.     tszName : array [0..MAX_PATH-1] of WCHAR;
  12834.   end;
  12835.  
  12836.   PDIEffectInfo = ^TDIEffectInfo;
  12837. {$IFDEF UNICODE}
  12838.   TDIEffectInfo = TDIEffectInfoW;
  12839. {$ELSE}
  12840.   TDIEffectInfo = TDIEffectInfoA;
  12841. {$ENDIF}
  12842.  
  12843. const
  12844.   DISDD_CONTINUE          = $00000001;
  12845.  
  12846.   // Bug fix & deviation from the SDK: Must return DIENUM_STOP or
  12847.   // DIENUM_CONTINUE (=1) in order to work with the debug version of DINPUT.DLL
  12848. type
  12849.   TDIEnumEffectsCallbackA =
  12850.       function(var pdei: TDIEffectInfoA; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
  12851.   TDIEnumEffectsCallbackW =
  12852.       function(var pdei: TDIEffectInfoW; pvRef: pointer): Integer; stdcall; // BOOL; stdcall;
  12853.   TDIEnumEffectsCallback =
  12854.       function(var pdei: TDIEffectInfo; pvRef: pointer) : Integer; stdcall; // BOOL; stdcall;
  12855.   TDIEnumEffectsProc = TDIEnumEffectsCallback;
  12856.  
  12857.   TDIEnumCreatedEffectObjectsCallback =
  12858.       function(peff: IDirectInputEffect; pvRev: pointer): Integer; stdcall; // BOOL; stdcall;
  12859.   TDIEnumCreatedEffectObjectsProc = TDIEnumCreatedEffectObjectsCallback;
  12860.  
  12861.   IDirectInputDevice2A = interface (IDirectInputDeviceA)
  12862.     ['{5944E682-C92E-11CF-BFC7-444553540000}']
  12863.     (*** IDirectInputDevice2A methods ***)
  12864.     function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
  12865.         var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
  12866.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackA;
  12867.         pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
  12868.     function GetEffectInfo(pdei: TDIEffectInfoA; const rguid: TGUID) : HResult;  stdcall;
  12869.     function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
  12870.     function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
  12871.     function EnumCreatedEffectObjects(lpCallback:
  12872.         TDIEnumCreatedEffectObjectsCallback;
  12873.         pvRef: pointer; fl: DWORD) : HResult;  stdcall;
  12874.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12875.     function Poll : HResult;  stdcall;
  12876.     function SendDeviceData
  12877.         (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
  12878.         var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
  12879.   end;
  12880.  
  12881.   IDirectInputDevice2W = interface (IDirectInputDeviceW)
  12882.     ['{5944E683-C92E-11CF-BFC7-444553540000}']
  12883.     (*** IDirectInputDevice2W methods ***)
  12884.     function CreateEffect(const rguid: TGUID; lpeff: PDIEffect;
  12885.         var ppdeff: IDirectInputEffect; punkOuter: IUnknown) : HResult;  stdcall;
  12886.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackW;
  12887.         pvRef: pointer; dwEffType: DWORD) : HResult;  stdcall;
  12888.     function GetEffectInfo(pdei: TDIEffectInfoW; const rguid: TGUID) : HResult;  stdcall;
  12889.     function GetForceFeedbackState(var pdwOut: DWORD) : HResult;  stdcall;
  12890.     function SendForceFeedbackCommand(dwFlags: DWORD) : HResult;  stdcall;
  12891.     function EnumCreatedEffectObjects(lpCallback:
  12892.         TDIEnumCreatedEffectObjectsCallback;
  12893.         pvRef: pointer; fl: DWORD) : HResult;  stdcall;
  12894.     function Escape(var pesc: TDIEffEscape) : HResult;  stdcall;
  12895.     function Poll : HResult;  stdcall;
  12896.     function SendDeviceData
  12897.         (cbObjectData: DWORD; var rgdod: TDIDeviceObjectData;
  12898.         var pdwInOut: DWORD; fl: DWORD) : HResult;  stdcall;
  12899.   end;
  12900.  
  12901. {$IFDEF UNICODE}
  12902.   IDirectInputDevice2 = IDirectInputDevice2W;
  12903. {$ELSE}
  12904.   IDirectInputDevice2 = IDirectInputDevice2A;
  12905. {$ENDIF}
  12906.  
  12907. const
  12908.   DIFEF_DEFAULT               = $00000000;
  12909.   DIFEF_INCLUDENONSTANDARD    = $00000001;
  12910.   DIFEF_MODIFYIFNEEDED          = $00000010;
  12911.  
  12912. ///Weitermachen:  (as: nur die Deklarationen eingefüllt, die ich zum Testen gebraucht habe)
  12913.  
  12914. type
  12915.   TEnumEffectsInFileCallback = function(gaga, huhu: Integer): HResult;
  12916.  
  12917. type
  12918.   IDirectInputDevice7W = interface (IDirectInputDevice2W)
  12919.     ['{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}']
  12920.     (*** IDirectInputDevice7A methods ***)
  12921.     function EnumEffectsInFile(const lpszFileName: PChar;
  12922.       pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
  12923.     function WriteEffectToFile(const lpszFileName: PChar;
  12924.       dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
  12925.   end;
  12926.  
  12927.   IDirectInputDevice7A = interface (IDirectInputDevice2A)
  12928.     ['{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}']
  12929.     function EnumEffectsInFile(const lpszFileName: PChar;
  12930.       pec: TEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWord): HResult; stdcall;
  12931.     function WriteEffectToFile(const lpszFileName: PChar;
  12932.       dwEntries: DWord; const rgDIFileEft: PDIFileEffect; dwFlags: DWord): HResult; stdcall;
  12933.   end;
  12934.  
  12935. {$IFDEF UNICODE}
  12936.   IDirectInputDevice7 = IDirectInputDevice7W;
  12937. {$ELSE}
  12938.   IDirectInputDevice7 = IDirectInputDevice7A;
  12939. {$ENDIF}
  12940.  
  12941. (****************************************************************************
  12942.  *
  12943.  *      Mouse
  12944.  *
  12945.  ****************************************************************************)
  12946.  
  12947. type
  12948.   PDIMouseState = ^TDIMouseState;
  12949.   TDIMouseState = packed record
  12950.     lX: Longint;
  12951.     lY: Longint;
  12952.     lZ: Longint;
  12953.     rgbButtons: Array [0..3] of BYTE;  // up to 4 buttons
  12954.   end;
  12955.  
  12956.   PDIMouseState2 = ^TDIMouseState2;
  12957.   TDIMouseState2 = packed record
  12958.     lX: Longint;
  12959.     lY: Longint;
  12960.     lZ: Longint;
  12961.     rgbButtons: Array [0..7] of BYTE;  // up to 8 buttons
  12962.   end;
  12963.  
  12964. const
  12965.   DIMOFS_X       = 0;
  12966.   DIMOFS_Y       = 4;
  12967.   DIMOFS_Z       = 8;
  12968.   DIMOFS_BUTTON0 = 12;
  12969.   DIMOFS_BUTTON1 = 13;
  12970.   DIMOFS_BUTTON2 = 14;
  12971.   DIMOFS_BUTTON3 = 15;
  12972.   // DX7 supports up to 8 mouse buttons
  12973.   DIMOFS_BUTTON4 = DIMOFS_BUTTON0+4;
  12974.   DIMOFS_BUTTON5 = DIMOFS_BUTTON0+5;
  12975.   DIMOFS_BUTTON6 = DIMOFS_BUTTON0+6;
  12976.   DIMOFS_BUTTON7 = DIMOFS_BUTTON0+7;
  12977.  
  12978.  
  12979. const
  12980.   _c_dfDIMouse_Objects: array[0..6] of TDIObjectDataFormat = (