?? directdraw.pas
字號:
(*==========================================================================;
*
* Copyright (C) 1994-1997 Microsoft Corporation. All Rights Reserved.
*
* Files: ddraw.h dvp.h
* Content: DirectDraw and DirectDrawVideoPort include files
*
* DirectX 7.0 Delphi adaptation by Erik Unger
*
* Modified: 10-Sep-2000
*
* Download: http://www.delphi-jedi.org/DelphiGraphics/
* E-Mail: DelphiDirectX@next-reality.com
*
*
***************************************************************************)
unit DirectDraw;
interface
{$MINENUMSIZE 4}
{$ALIGN ON}
uses
Windows;
var
DDrawDLL : HMODULE = 0;
function DDErrorString(Value: HResult) : string;
function MAKEFOURCC(ch0, ch1, ch2, ch3: Char) : DWORD;
(*
* FOURCC codes for DX compressed-texture pixel formats
*)
const
FOURCC_DXT1 = 'DXT1';
FOURCC_DXT2 = 'DXT2';
FOURCC_DXT3 = 'DXT3';
FOURCC_DXT4 = 'DXT4';
FOURCC_DXT5 = 'DXT5';
(*
* GUIDS used by DirectDraw objects
*)
const
CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}';
CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}';
CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}';
const
DD_ROP_SPACE = (256 div 32); // space required to store ROP array
MAX_DDDEVICEID_STRING = 512;
(*
* Flags for the IDirectDraw4::GetDeviceIdentifier method
*)
(*
* This flag causes GetDeviceIdentifier to return information about the host (typically 2D) adapter in a system equipped
* with a stacked secondary 3D adapter. Such an adapter appears to the application as if it were part of the
* host adapter, but is typically physcially located on a separate card. The stacked secondary's information is
* returned when GetDeviceIdentifier's dwFlags field is zero, since this most accurately reflects the qualities
* of the DirectDraw object involved.
*)
DDGDI_GETHOSTIDENTIFIER = $00000001;
(*============================================================================
*
* DirectDraw Structures
*
* Various structures used to invoke DirectDraw.
*
*==========================================================================*)
var
NilGUID : TGUID absolute 0;
type
TRefGUID = packed record
case integer of
1: (guid : PGUID);
2: (dwFlags : DWORD);
end;
IDirectDraw = interface;
IDirectDraw2 = interface;
IDirectDraw4 = interface;
IDirectDraw7 = interface;
IDirectDrawSurface = interface;
IDirectDrawSurface2 = interface;
IDirectDrawSurface3 = interface;
IDirectDrawSurface4 = interface;
IDirectDrawSurface7 = interface;
IDirectDrawPalette = interface;
IDirectDrawClipper = interface;
IDirectDrawColorControl = interface;
IDirectDrawGammaControl = interface;
(*
* Generic pixel format with 8-bit RGB and alpha components
*)
PDDARGB = ^TDDARGB;
TDDARGB = packed record
blue: BYTE;
green: BYTE;
red: BYTE;
alpha: BYTE;
end;
(*
* This version of the structure remains for backwards source compatibility.
* The DDARGB structure is the one that should be used for all DirectDraw APIs.
*)
PDDRGBA = ^TDDRGBA;
TDDRGBA = packed record
red : BYTE;
green : BYTE;
blue : BYTE;
alpha : BYTE;
end;
(*
* TDDColorKey
*)
PDDColorKey = ^TDDColorKey;
TDDColorKey = packed record
dwColorSpaceLowValue: DWORD; // low boundary of color space that is to
// be treated as Color Key, inclusive
dwColorSpaceHighValue: DWORD; // high boundary of color space that is
// to be treated as Color Key, inclusive
end;
// Delphi 5 can't handle interface in variant records
// so we have to use pointers instead (which can be type-casted into interfaces):
{$IFDEF VER130}
PDirectDrawSurface = Pointer;
{$ELSE}
{$IFDEF VER140} // D6, TP 14
PDirectDrawSurface = Pointer;
{$ELSE}
PDirectDrawSurface = IDirectDrawSurface;
{$ENDIF}
{$ENDIF}
(*
* TDDBltFX
* Used to pass override information to the DIRECTDRAWSURFACE callback Blt.
*)
PDDBltFX = ^TDDBltFX;
TDDBltFX = packed record
dwSize : DWORD; // size of structure
dwDDFX : DWORD; // FX operations
dwROP : DWORD; // Win32 raster operations
dwDDROP : DWORD; // Raster operations new for DirectDraw
dwRotationAngle : DWORD; // Rotation angle for blt
dwZBufferOpCode : DWORD; // ZBuffer compares
dwZBufferLow : DWORD; // Low limit of Z buffer
dwZBufferHigh : DWORD; // High limit of Z buffer
dwZBufferBaseDest : DWORD; // Destination base value
dwZDestConstBitDepth : DWORD; // Bit depth used to specify Z constant for destination
case integer of
0: (
dwZDestConst : DWORD // Constant to use as Z buffer for dest
);
1: (
lpDDSZBufferDest : PDirectDrawSurface; // Surface to use as Z buffer for dest
dwZSrcConstBitDepth : DWORD; // Bit depth used to specify Z constant for source
case integer of
0: (
dwZSrcConst : DWORD; // Constant to use as Z buffer for src
);
1: (
lpDDSZBufferSrc : PDirectDrawSurface; // Surface to use as Z buffer for src
dwAlphaEdgeBlendBitDepth : DWORD; // Bit depth used to specify constant for alpha edge blend
dwAlphaEdgeBlend : DWORD; // Alpha for edge blending
dwReserved : DWORD;
dwAlphaDestConstBitDepth : DWORD; // Bit depth used to specify alpha constant for destination
case integer of
0: (
dwAlphaDestConst : DWORD; // Constant to use as Alpha Channel
);
1: (
lpDDSAlphaDest : PDirectDrawSurface; // Surface to use as Alpha Channel
dwAlphaSrcConstBitDepth : DWORD; // Bit depth used to specify alpha constant for source
case integer of
0: (
dwAlphaSrcConst : DWORD; // Constant to use as Alpha Channel
);
1: (
lpDDSAlphaSrc : PDirectDrawSurface; // Surface to use as Alpha Channel
case integer of
0: (
dwFillColor : DWORD; // color in RGB or Palettized
);
1: (
dwFillDepth : DWORD; // depth value for z-buffer
);
2: (
dwFillPixel : DWORD; // pixel value
);
3: (
lpDDSPattern : PDirectDrawSurface; // Surface to use as pattern
ddckDestColorkey : TDDColorKey; // DestColorkey override
ddckSrcColorkey : TDDColorKey; // SrcColorkey override
)
)
)
)
)
end;
(*
* TDDSCaps
*)
PDDSCaps = ^TDDSCaps;
TDDSCaps = packed record
dwCaps: DWORD; // capabilities of surface wanted
end;
(*
* TDDOSCaps
*)
PDDOSCaps = ^TDDOSCaps;
TDDOSCaps = packed record
dwCaps: DWORD; // capabilities of surface wanted
end;
(*
* This structure is used internally by DirectDraw.
*)
PDDSCapsEx = ^TDDSCapsEx;
TDDSCapsEx = packed record
dwCaps2 : DWORD;
dwCaps3 : DWORD;
dwCaps4 : DWORD;
end;
(*
* TDDSCaps2
*)
PDDSCaps2 = ^TDDSCaps2;
TDDSCaps2 = packed record
dwCaps: DWORD; // capabilities of surface wanted
dwCaps2 : DWORD;
dwCaps3 : DWORD;
dwCaps4 : DWORD;
end;
(*
* TDDCaps
*)
(*
* This structure is the TDDCaps structure as it was in version 2 and 3 of Direct X.
* It is present for back compatability.
*)
PDDCaps_DX3 = ^TDDCaps_DX3;
TDDCaps_DX3 = packed record
dwSize: DWORD; // size of the DDDRIVERCAPS structure
dwCaps: DWORD; // driver specific capabilities
dwCaps2: DWORD; // more driver specific capabilites
dwCKeyCaps: DWORD; // color key capabilities of the surface
dwFXCaps: DWORD; // driver specific stretching and effects capabilites
dwFXAlphaCaps: DWORD; // alpha driver specific capabilities
dwPalCaps: DWORD; // palette capabilities
dwSVCaps: DWORD; // stereo vision capabilities
dwAlphaBltConstBitDepths: DWORD; // DDBD_2,4,8
dwAlphaBltPixelBitDepths: DWORD; // DDBD_1,2,4,8
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -