diff --git a/Pramougolnik/Arrow.cfg b/Pramougolnik/Arrow.cfg new file mode 100644 index 0000000..e9c1cc1 --- /dev/null +++ b/Pramougolnik/Arrow.cfg @@ -0,0 +1,38 @@ +-$A8 +-$B- +-$C+ +-$D+ +-$E- +-$F- +-$G+ +-$H+ +-$I+ +-$J- +-$K- +-$L+ +-$M- +-$N+ +-$O+ +-$P+ +-$Q- +-$R- +-$S- +-$T- +-$U- +-$V+ +-$W- +-$X+ +-$YD +-$Z1 +-cg +-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +-H+ +-W+ +-M +-$M16384,1048576 +-K$00400000 +-LE"c:\program files (x86)\borland\delphi7\Projects\Bpl" +-LN"c:\program files (x86)\borland\delphi7\Projects\Bpl" +-w-UNSAFE_TYPE +-w-UNSAFE_CODE +-w-UNSAFE_CAST diff --git a/Pramougolnik/Arrow.dof b/Pramougolnik/Arrow.dof new file mode 100644 index 0000000..5f45ffa --- /dev/null +++ b/Pramougolnik/Arrow.dof @@ -0,0 +1,136 @@ +[FileVersion] +Version=7.0 +[Compiler] +A=8 +B=0 +C=1 +D=1 +E=0 +F=0 +G=1 +H=1 +I=1 +J=0 +K=0 +L=1 +M=0 +N=1 +O=1 +P=1 +Q=0 +R=0 +S=0 +T=0 +U=0 +V=1 +W=0 +X=1 +Y=1 +Z=1 +ShowHints=1 +ShowWarnings=1 +UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +NamespacePrefix= +SymbolDeprecated=1 +SymbolLibrary=1 +SymbolPlatform=1 +UnitLibrary=1 +UnitPlatform=1 +UnitDeprecated=1 +HResultCompat=1 +HidingMember=1 +HiddenVirtual=1 +Garbage=1 +BoundsError=1 +ZeroNilCompat=1 +StringConstTruncated=1 +ForLoopVarVarPar=1 +TypedConstVarPar=1 +AsgToTypedConst=1 +CaseLabelRange=1 +ForVariable=1 +ConstructingAbstract=1 +ComparisonFalse=1 +ComparisonTrue=1 +ComparingSignedUnsigned=1 +CombiningSignedUnsigned=1 +UnsupportedConstruct=1 +FileOpen=1 +FileOpenUnitSrc=1 +BadGlobalSymbol=1 +DuplicateConstructorDestructor=1 +InvalidDirective=1 +PackageNoLink=1 +PackageThreadVar=1 +ImplicitImport=1 +HPPEMITIgnored=1 +NoRetVal=1 +UseBeforeDef=1 +ForLoopVarUndef=1 +UnitNameMismatch=1 +NoCFGFileFound=1 +MessageDirective=1 +ImplicitVariants=1 +UnicodeToLocale=1 +LocaleToUnicode=1 +ImagebaseMultiple=1 +SuspiciousTypecast=1 +PrivatePropAccessor=1 +UnsafeType=0 +UnsafeCode=0 +UnsafeCast=0 +[Linker] +MapFile=0 +OutputObjs=0 +ConsoleApp=1 +DebugInfo=0 +RemoteSymbols=0 +MinStackSize=16384 +MaxStackSize=1048576 +ImageBase=4194304 +ExeDescription= +[Directories] +OutputDir= +UnitOutputDir= +PackageDLLOutputDir= +PackageDCPOutputDir= +SearchPath= +Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP +Conditionals= +DebugSourceDirs= +UsePackages=0 +[Parameters] +RunParams= +HostApplication= +Launcher= +UseLauncher=0 +DebugCWD= +[Language] +ActiveLang= +ProjectLang= +RootDir= +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1049 +CodePage=1251 +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= diff --git a/Pramougolnik/Arrow_Icon.ico b/Pramougolnik/Arrow_Icon.ico new file mode 100644 index 0000000..63b510b Binary files /dev/null and b/Pramougolnik/Arrow_Icon.ico differ diff --git a/Pramougolnik/DirectDraw.pas b/Pramougolnik/DirectDraw.pas new file mode 100644 index 0000000..dfdf5b9 --- /dev/null +++ b/Pramougolnik/DirectDraw.pas @@ -0,0 +1,7161 @@ +{******************************************************************************} +{* *} +{* Copyright (C) Microsoft Corporation. All Rights Reserved. *} +{* *} +{* Files: ddraw.h dvp.h *} +{* Content: DirectDraw and DirectDrawVideoPort include files *} +{* *} +{* DirectX 9.0 Delphi adaptation by Alexey Barkovoy *} +{* E-Mail: clootie@reactor.ru *} +{* *} +{* Modified: 20-Dec-2002 *} +{* *} +{* Based upon : *} +{* DirectX 7.0 Object Pascal adaptation by *} +{* Erik Unger, e-Mail: DelphiDirectX@next-reality.com *} +{* *} +{* Latest version can be downloaded from: *} +{* http://clootie.narod.ru/delphi/ *} +{* *} +{******************************************************************************} +{ } +{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) } +{ } +{ The contents of this file are used with permission, subject to the Mozilla } +{ Public License Version 1.1 (the "License"); you may not use this file except } +{ in compliance with the License. You may obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an "AS IS" basis, } +{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for } +{ the specific language governing rights and limitations under the License. } +{ } +{ Alternatively, the contents of this file may be used under the terms of the } +{ GNU Lesser General Public License (the "LGPL License"), in which case the } +{ provisions of the LGPL License are applicable instead of those above. } +{ If you wish to allow use of your version of this file only under the terms } +{ of the LGPL License and not to allow others to use your version of this file } +{ under the MPL, indicate your decision by deleting the provisions above and } +{ replace them with the notice and other provisions required by the LGPL } +{ License. If you do not delete the provisions above, a recipient may use } +{ your version of this file under either the MPL or the LGPL License. } +{ } +{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html } +{ } +{******************************************************************************} + +/////////////////////////////////////////////////////////////////////////////// +// Notes: +//---------------------------------------------------------------------------- +// Possible input defines for this file, mapped to original C values: +// DIRECTDRAW_VERSION_7 : DIRECTDRAW_VERSION = 0x0700, +// DIRECTDRAW_VERSION_6 : DIRECTDRAW_VERSION = 0x0600, +// DIRECTDRAW_VERSION_5 : DIRECTDRAW_VERSION = 0x0500, +// DIRECTDRAW_VERSION_3 : DIRECTDRAW_VERSION = 0x0300, +// DIRECTDRAW_VERSION_LESS_3 : DIRECTDRAW_VERSION < 0x0300, +// +// By default DIRECTDRAW_VERSION_7 (DIRECTDRAW_VERSION = 0x0700) is assumed +// +// Also you can use generic DIRECTXx defines, so: +// DIRECTX7 equal to DIRECTDRAW_VERSION_7; +// DIRECTX6 equal to DIRECTDRAW_VERSION_6; +// DIRECTX5 equal to DIRECTDRAW_VERSION_5; +// DIRECTX3 equal to DIRECTDRAW_VERSION_3 +/////////////////////////////////////////////////////////////////////////////// + +unit DirectDraw; + +interface + +{$I DirectX.inc} + +//////////////////////////////////////////////////////////////////////// +// Global level dynamic loading support +{$IFDEF DYNAMIC_LINK_ALL} + {$DEFINE DIRECTDRAW_DYNAMIC_LINK} +{$ENDIF} +{$IFDEF DYNAMIC_LINK_EXPLICIT_ALL} + {$DEFINE DIRECTDRAW_DYNAMIC_LINK_EXPLICIT} +{$ENDIF} + +// Remove "dots" below to force some kind of dynamic linking +{.$DEFINE DIRECTDRAW_DYNAMIC_LINK} +{.$DEFINE DIRECTDRAW_DYNAMIC_LINK_EXPLICIT} + +//////////////////////////////////////////////////////////////////////// +// Assume for what DirectDraw version we will compile headers +{$IFDEF DIRECTX7} + {$DEFINE DIRECTDRAW_VERSION_7} +{$ENDIF} +{$IFDEF DIRECTX6} + {$DEFINE DIRECTDRAW_VERSION_6} +{$ENDIF} +{$IFDEF DIRECTX5} + {$DEFINE DIRECTDRAW_VERSION_5} +{$ENDIF} +{$IFDEF DIRECTX3} + {$DEFINE DIRECTDRAW_VERSION_3} +{$ENDIF} + +{$IFNDEF DIRECTDRAW_VERSION_7} + {$IFNDEF DIRECTDRAW_VERSION_6} + {$IFNDEF DIRECTDRAW_VERSION_5} + {$IFNDEF DIRECTDRAW_VERSION_3} + {$IFNDEF DIRECTDRAW_VERSION_LESS_3} + {$DEFINE DIRECTDRAW_VERSION_7} // Compiling for DirectDraw7 by default + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} +{$ENDIF} + +//////////////////////////////////////////////////////////////////////// +// Emit conditionals to C++Builder compiler +{$IFDEF DIRECTDRAW_VERSION_LESS_3} + {$HPPEMIT '#define DIRECTDRAW_VERSION 0x0100'} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_3} + {$HPPEMIT '#define DIRECTDRAW_VERSION 0x0300'} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_5} + {$HPPEMIT '#define DIRECTDRAW_VERSION 0x0500'} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_6} + {$HPPEMIT '#define DIRECTDRAW_VERSION 0x0600'} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_7} + {$HPPEMIT '#define DIRECTDRAW_VERSION 0x0700'} +{$ENDIF} + +//////////////////////////////////////////////////////////////////////// +// Define symbols for '<=' comparision +{$IFDEF DIRECTDRAW_VERSION_7} + {$DEFINE DIRECTDRAW_VERSION_6} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_6} + {$DEFINE DIRECTDRAW_VERSION_5} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_5} + {$DEFINE DIRECTDRAW_VERSION_3} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_3} + {$DEFINE DIRECTDRAW_VERSION_LESS_3} +{$ENDIF} + +(*$HPPEMIT '#include "ddraw.h"' *) +(*$HPPEMIT '#include "dvp.h"' *) + +uses + Windows; + + +(*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: ddraw.h + * Content: DirectDraw include file + * + ***************************************************************************) + +function MAKEFOURCC(ch0, ch1, ch2, ch3: Char): DWORD; +{$EXTERNALSYM MAKEFOURCC} + +(* + * FOURCC codes for DX compressed-texture pixel formats + *) +const + //#define FOURCC_DXT1 (MAKEFOURCC('D','X','T','1')) + FOURCC_DXT1 = DWORD(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('1') shl 24)); + {$EXTERNALSYM FOURCC_DXT1} + //#define FOURCC_DXT2 (MAKEFOURCC('D','X','T','2')) + FOURCC_DXT2 = DWORD(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('2') shl 24)); + {$EXTERNALSYM FOURCC_DXT2} + //#define FOURCC_DXT3 (MAKEFOURCC('D','X','T','3')) + FOURCC_DXT3 = DWORD(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('3') shl 24)); + {$EXTERNALSYM FOURCC_DXT3} + //#define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4')) + FOURCC_DXT4 = DWORD(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('4') shl 24)); + {$EXTERNALSYM FOURCC_DXT4} + //#define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5')) + FOURCC_DXT5 = DWORD(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('5') shl 24)); + {$EXTERNALSYM FOURCC_DXT5} + +(* + * GUIDS used by DirectDraw objects + *) +const + CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}'; + {$EXTERNALSYM CLSID_DirectDraw} + CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}'; + {$EXTERNALSYM CLSID_DirectDraw7} + CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}'; + {$EXTERNALSYM CLSID_DirectDrawClipper} + (* These GUID's defined later by typedefing to Delphi interfaces + DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); + DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); + DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); + DEFINE_GUID( IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); + DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); + DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 ); + DEFINE_GUID( IID_IDirectDrawSurface3, 0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB ); + DEFINE_GUID( IID_IDirectDrawSurface4, 0x0B2B8630,0xAD35,0x11D0,0x8E,0xA6,0x00,0x60,0x97,0x97,0xEA,0x5B ); + DEFINE_GUID( IID_IDirectDrawSurface7, 0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); + DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); + DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); + DEFINE_GUID( IID_IDirectDrawColorControl, 0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8 ); + DEFINE_GUID( IID_IDirectDrawGammaControl, 0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00,0xC0,0x4F,0xC2,0x9B,0x4E ); + *) + +const + DD_ROP_SPACE = (256 div 32); // space required to store ROP array + {$EXTERNALSYM DD_ROP_SPACE} + + MAX_DDDEVICEID_STRING = 512; + {$EXTERNALSYM MAX_DDDEVICEID_STRING} + + +(*============================================================================ + * + * DirectDraw Structures + * + * Various structures used to invoke DirectDraw. + * + *==========================================================================*) + +var + NilGUID : TGUID = '{00000000-0000-0000-0000-000000000000}'; + + +type + //Clootie: This was originally in Erik Unger headers - don't know why, so leave it alone + TRefGUID = packed record + case Integer of + 1: (guid : PGUID); + 2: (dwFlags : DWORD); + end; + + REFGUID = PGUID; + {$EXTERNALSYM REFGUID} + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDraw;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDraw2;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDraw4;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDraw7;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawSurface;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawSurface2;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawSurface3;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawSurface4;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawSurface7;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawPalette;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawClipper;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawColorControl;'} + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawGammaControl;'} + IDirectDraw = interface; + {$EXTERNALSYM IDirectDraw} + IDirectDraw2 = interface; + {$EXTERNALSYM IDirectDraw2} + IDirectDraw4 = interface; + {$EXTERNALSYM IDirectDraw4} + IDirectDraw7 = interface; + {$EXTERNALSYM IDirectDraw7} + IDirectDrawSurface = interface; + {$EXTERNALSYM IDirectDrawSurface} + IDirectDrawSurface2 = interface; + {$EXTERNALSYM IDirectDrawSurface2} + IDirectDrawSurface3 = interface; + {$EXTERNALSYM IDirectDrawSurface3} + IDirectDrawSurface4 = interface; + {$EXTERNALSYM IDirectDrawSurface4} + IDirectDrawSurface7 = interface; + {$EXTERNALSYM IDirectDrawSurface7} + + IDirectDrawPalette = interface; + {$EXTERNALSYM IDirectDrawPalette} + IDirectDrawClipper = interface; + {$EXTERNALSYM IDirectDrawClipper} + IDirectDrawColorControl = interface; + {$EXTERNALSYM IDirectDrawColorControl} + IDirectDrawGammaControl = interface; + {$EXTERNALSYM IDirectDrawGammaControl} + +(* + * Generic pixel format with 8-bit RGB and alpha components + *) + PDDARGB = ^TDDARGB; + _DDARGB = packed record + blue: Byte; + green: Byte; + red: Byte; + alpha: Byte; + end; + {$EXTERNALSYM _DDARGB} + DDARGB = _DDARGB; + {$EXTERNALSYM DDARGB} + TDDARGB = _DDARGB; + +(* + * 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; + _DDRGBA = packed record + red : Byte; + green : Byte; + blue : Byte; + alpha : Byte; + end; + {$EXTERNALSYM _DDRGBA} + DDRGBA = _DDRGBA; + {$EXTERNALSYM DDRGBA} + TDDRGBA = _DDRGBA; + +(* + * TDDColorKey + *) + PDDColorKey = ^TDDColorKey; + _DDCOLORKEY = 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; + {$EXTERNALSYM _DDCOLORKEY} + DDCOLORKEY = _DDCOLORKEY; + {$EXTERNALSYM DDCOLORKEY} + TDDColorKey = _DDCOLORKEY; + +// Delphi 5 and up don't allow interfaces in variant records +// so we have to use pointers instead (which can be type-casted into interfaces): + +{$IFDEF COMPILER5_UP} + PDirectDrawSurface = Pointer; +{$ELSE} + PDirectDrawSurface = IDirectDrawSurface; +{$ENDIF} + +(* + * TDDBltFX + * Used to pass override information to the DIRECTDRAWSURFACE callback Blt. + *) + PDDBltFX = ^TDDBltFX; + _DDBLTFX = 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; + {$EXTERNALSYM _DDBLTFX} + DDBLTFX = _DDBLTFX; + {$EXTERNALSYM DDBLTFX} + TDDBltFX = _DDBLTFX; + +(* + * TDDSCaps + *) + PDDSCaps = ^TDDSCaps; + _DDSCAPS = packed record + dwCaps: DWORD; // capabilities of surface wanted + end; + {$EXTERNALSYM _DDSCAPS} + DDSCAPS = _DDSCAPS; + {$EXTERNALSYM DDSCAPS} + TDDSCaps = _DDSCAPS; + +(* + * TDDOSCaps + *) + PDDOSCaps = ^TDDOSCaps; + _DDOSCAPS = packed record + dwCaps: DWORD; // capabilities of surface wanted + end; + {$EXTERNALSYM _DDOSCAPS} + DDOSCAPS = _DDOSCAPS; + {$EXTERNALSYM DDOSCAPS} + TDDOSCaps = _DDOSCAPS; + +(* + * This structure is used internally by DirectDraw. + *) + PDDSCapsEx = ^TDDSCapsEx; + _DDSCAPSEX = packed record + dwCaps2 : DWORD; + dwCaps3 : DWORD; + dwCaps4 : DWORD; + end; + {$EXTERNALSYM _DDSCAPSEX} + DDSCAPSEX = _DDSCAPSEX; + {$EXTERNALSYM DDSCAPSEX} + TDDSCapsEx = _DDSCAPSEX; + +(* + * TDDSCaps2 + *) + PDDSCaps2 = ^TDDSCaps2; + _DDSCAPS2 = packed record + dwCaps: DWORD; // capabilities of surface wanted + dwCaps2 : DWORD; + dwCaps3 : DWORD; + dwCaps4 : DWORD; + end; + {$EXTERNALSYM _DDSCAPS2} + DDSCAPS2 = _DDSCAPS2; + {$EXTERNALSYM DDSCAPS2} + TDDSCaps2 = _DDSCAPS2; + +(* + * NOTE: Our choosen structure number scheme is to append a single digit to + * the end of the structure giving the version that structure is associated + * with. + *) + +(* + * This structure represents the DDCAPS structure released in DirectDraw 1.0. It is used internally + * by DirectDraw to interpret caps passed into ddraw by drivers written prior to the release of DirectDraw 2.0. + * New applications should use the DDCAPS structure defined below. + *) + PDDCaps_DX1 = ^TDDCaps_DX1; + _DDCAPS_DX1 = packed record + dwSize: DWORD; // size of the DDDRIVERCAPS structure + dwCaps: DWORD; // driver specific capabilities + dwCaps2: DWORD; // more driver specific capabilites + dwCKeyCaps: DWORD; // color key capabilities of the surface + dwFXCaps: DWORD; // driver specific stretching and effects capabilites + dwFXAlphaCaps: DWORD; // alpha driver specific capabilities + dwPalCaps: DWORD; // palette capabilities + dwSVCaps: DWORD; // stereo vision capabilities + dwAlphaBltConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaBltPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaBltSurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlayConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaOverlayPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwZBufferBitDepths: DWORD; // DDBD_8,16,24,32 + dwVidMemTotal: DWORD; // total amount of video memory + dwVidMemFree: DWORD; // amount of free video memory + dwMaxVisibleOverlays: DWORD; // maximum number of visible overlays + dwCurrVisibleOverlays: DWORD; // current number of visible overlays + dwNumFourCCCodes: DWORD; // number of four cc codes + dwAlignBoundarySrc: DWORD; // source rectangle alignment + dwAlignSizeSrc: DWORD; // source rectangle byte size + dwAlignBoundaryDest: DWORD; // dest rectangle alignment + dwAlignSizeDest: DWORD; // dest rectangle byte size + dwAlignStrideAlign: DWORD; // stride alignment + dwRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported + ddsCaps: TDDSCaps; // TDDSCaps structure has all the general capabilities + dwMinOverlayStretch: DWORD; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxOverlayStretch: DWORD; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinLiveVideoStretch: DWORD; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxLiveVideoStretch: DWORD; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinHwCodecStretch: DWORD; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxHwCodecStretch: DWORD; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwReserved1: DWORD; // reserved + dwReserved2: DWORD; // reserved + dwReserved3: DWORD; // reserved + end; + {$EXTERNALSYM _DDCAPS_DX1} + DDCAPS_DX1 = _DDCAPS_DX1; + {$EXTERNALSYM DDCAPS_DX1} + TDDCaps_DX1 = _DDCAPS_DX1; + +(* + * 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; + _DDCAPS_DX3 = packed record + dwSize: DWORD; // size of the DDDRIVERCAPS structure + dwCaps: DWORD; // driver specific capabilities + dwCaps2: DWORD; // more driver specific capabilites + dwCKeyCaps: DWORD; // color key capabilities of the surface + dwFXCaps: DWORD; // driver specific stretching and effects capabilites + dwFXAlphaCaps: DWORD; // alpha driver specific capabilities + dwPalCaps: DWORD; // palette capabilities + dwSVCaps: DWORD; // stereo vision capabilities + dwAlphaBltConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaBltPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaBltSurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlayConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaOverlayPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwZBufferBitDepths: DWORD; // DDBD_8,16,24,32 + dwVidMemTotal: DWORD; // total amount of video memory + dwVidMemFree: DWORD; // amount of free video memory + dwMaxVisibleOverlays: DWORD; // maximum number of visible overlays + dwCurrVisibleOverlays: DWORD; // current number of visible overlays + dwNumFourCCCodes: DWORD; // number of four cc codes + dwAlignBoundarySrc: DWORD; // source rectangle alignment + dwAlignSizeSrc: DWORD; // source rectangle byte size + dwAlignBoundaryDest: DWORD; // dest rectangle alignment + dwAlignSizeDest: DWORD; // dest rectangle byte size + dwAlignStrideAlign: DWORD; // stride alignment + dwRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported + ddsCaps: TDDSCaps; // TDDSCaps structure has all the general capabilities + dwMinOverlayStretch: DWORD; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxOverlayStretch: DWORD; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinLiveVideoStretch: DWORD; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxLiveVideoStretch: DWORD; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinHwCodecStretch: DWORD; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxHwCodecStretch: DWORD; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwReserved1: DWORD; // reserved + dwReserved2: DWORD; // reserved + dwReserved3: DWORD; // reserved + dwSVBCaps: DWORD; // driver specific capabilities for System->Vmem blts + dwSVBCKeyCaps: DWORD; // driver color key capabilities for System->Vmem blts + dwSVBFXCaps: DWORD; // driver FX capabilities for System->Vmem blts + dwSVBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts + dwVSBCaps: DWORD; // driver specific capabilities for Vmem->System blts + dwVSBCKeyCaps: DWORD; // driver color key capabilities for Vmem->System blts + dwVSBFXCaps: DWORD; // driver FX capabilities for Vmem->System blts + dwVSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts + dwSSBCaps: DWORD; // driver specific capabilities for System->System blts + dwSSBCKeyCaps: DWORD; // driver color key capabilities for System->System blts + dwSSBFXCaps: DWORD; // driver FX capabilities for System->System blts + dwSSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts + dwReserved4 : DWORD; + dwReserved5 : DWORD; + dwReserved6 : DWORD; + end; + {$EXTERNALSYM _DDCAPS_DX3} + DDCAPS_DX3 = _DDCAPS_DX3; + {$EXTERNALSYM DDCAPS_DX3} + TDDCaps_DX3 = _DDCAPS_DX3; + +(* + * This structure is the TDDCaps structure as it was in version 5 of Direct X. + * It is present for back compatability. + *) + PDDCaps_DX5 = ^TDDCaps_DX5; + _DDCAPS_DX5 = packed record + dwSize: DWORD; // size of the DDDRIVERCAPS structure + dwCaps: DWORD; // driver specific capabilities + dwCaps2: DWORD; // more driver specific capabilites + dwCKeyCaps: DWORD; // color key capabilities of the surface + dwFXCaps: DWORD; // driver specific stretching and effects capabilites + dwFXAlphaCaps: DWORD; // alpha driver specific capabilities + dwPalCaps: DWORD; // palette capabilities + dwSVCaps: DWORD; // stereo vision capabilities + dwAlphaBltConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaBltPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaBltSurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlayConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaOverlayPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwZBufferBitDepths: DWORD; // DDBD_8,16,24,32 + dwVidMemTotal: DWORD; // total amount of video memory + dwVidMemFree: DWORD; // amount of free video memory + dwMaxVisibleOverlays: DWORD; // maximum number of visible overlays + dwCurrVisibleOverlays: DWORD; // current number of visible overlays + dwNumFourCCCodes: DWORD; // number of four cc codes + dwAlignBoundarySrc: DWORD; // source rectangle alignment + dwAlignSizeSrc: DWORD; // source rectangle byte size + dwAlignBoundaryDest: DWORD; // dest rectangle alignment + dwAlignSizeDest: DWORD; // dest rectangle byte size + dwAlignStrideAlign: DWORD; // stride alignment + dwRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported + ddsCaps: TDDSCaps; // TDDSCaps structure has all the general capabilities + dwMinOverlayStretch: DWORD; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxOverlayStretch: DWORD; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinLiveVideoStretch: DWORD; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxLiveVideoStretch: DWORD; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinHwCodecStretch: DWORD; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxHwCodecStretch: DWORD; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwReserved1: DWORD; // reserved + dwReserved2: DWORD; // reserved + dwReserved3: DWORD; // reserved + dwSVBCaps: DWORD; // driver specific capabilities for System->Vmem blts + dwSVBCKeyCaps: DWORD; // driver color key capabilities for System->Vmem blts + dwSVBFXCaps: DWORD; // driver FX capabilities for System->Vmem blts + dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts + dwVSBCaps: DWORD; // driver specific capabilities for Vmem->System blts + dwVSBCKeyCaps: DWORD; // driver color key capabilities for Vmem->System blts + dwVSBFXCaps: DWORD; // driver FX capabilities for Vmem->System blts + dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts + dwSSBCaps: DWORD; // driver specific capabilities for System->System blts + dwSSBCKeyCaps: DWORD; // driver color key capabilities for System->System blts + dwSSBFXCaps: DWORD; // driver FX capabilities for System->System blts + dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts + // Members added for DX5: + dwMaxVideoPorts: DWORD; // maximum number of usable video ports + dwCurrVideoPorts: DWORD; // current number of video ports used + dwSVBCaps2: DWORD; // more driver specific capabilities for System->Vmem blts + dwNLVBCaps: DWORD; // driver specific capabilities for non-local->local vidmem blts + dwNLVBCaps2: DWORD; // more driver specific capabilities non-local->local vidmem blts + dwNLVBCKeyCaps: DWORD; // driver color key capabilities for non-local->local vidmem blts + dwNLVBFXCaps: DWORD; // driver FX capabilities for non-local->local blts + dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts + end; + {$EXTERNALSYM _DDCAPS_DX5} + DDCAPS_DX5 = _DDCAPS_DX5; + {$EXTERNALSYM DDCAPS_DX5} + TDDCaps_DX5 = _DDCAPS_DX5; + + PDDCaps_DX6 = ^TDDCaps_DX6; + _DDCAPS_DX6 = packed record + dwSize: DWORD; // size of the DDDRIVERCAPS structure + dwCaps: DWORD; // driver specific capabilities + dwCaps2: DWORD; // more driver specific capabilites + dwCKeyCaps: DWORD; // color key capabilities of the surface + dwFXCaps: DWORD; // driver specific stretching and effects capabilites + dwFXAlphaCaps: DWORD; // alpha driver specific capabilities + dwPalCaps: DWORD; // palette capabilities + dwSVCaps: DWORD; // stereo vision capabilities + dwAlphaBltConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaBltPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaBltSurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlayConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaOverlayPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwZBufferBitDepths: DWORD; // DDBD_8,16,24,32 + dwVidMemTotal: DWORD; // total amount of video memory + dwVidMemFree: DWORD; // amount of free video memory + dwMaxVisibleOverlays: DWORD; // maximum number of visible overlays + dwCurrVisibleOverlays: DWORD; // current number of visible overlays + dwNumFourCCCodes: DWORD; // number of four cc codes + dwAlignBoundarySrc: DWORD; // source rectangle alignment + dwAlignSizeSrc: DWORD; // source rectangle byte size + dwAlignBoundaryDest: DWORD; // dest rectangle alignment + dwAlignSizeDest: DWORD; // dest rectangle byte size + dwAlignStrideAlign: DWORD; // stride alignment + dwRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported + ddsOldCaps: TDDSCaps; // Was dssCaps: TDDSCaps. ddsCaps is of type TDDScaps2 for DX6 + dwMinOverlayStretch: DWORD; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxOverlayStretch: DWORD; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinLiveVideoStretch: DWORD; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxLiveVideoStretch: DWORD; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinHwCodecStretch: DWORD; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxHwCodecStretch: DWORD; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwReserved1: DWORD; // reserved + dwReserved2: DWORD; // reserved + dwReserved3: DWORD; // reserved + dwSVBCaps: DWORD; // driver specific capabilities for System->Vmem blts + dwSVBCKeyCaps: DWORD; // driver color key capabilities for System->Vmem blts + dwSVBFXCaps: DWORD; // driver FX capabilities for System->Vmem blts + dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts + dwVSBCaps: DWORD; // driver specific capabilities for Vmem->System blts + dwVSBCKeyCaps: DWORD; // driver color key capabilities for Vmem->System blts + dwVSBFXCaps: DWORD; // driver FX capabilities for Vmem->System blts + dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts + dwSSBCaps: DWORD; // driver specific capabilities for System->System blts + dwSSBCKeyCaps: DWORD; // driver color key capabilities for System->System blts + dwSSBFXCaps: DWORD; // driver FX capabilities for System->System blts + dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts + // Members added for DX5: + dwMaxVideoPorts: DWORD; // maximum number of usable video ports + dwCurrVideoPorts: DWORD; // current number of video ports used + dwSVBCaps2: DWORD; // more driver specific capabilities for System->Vmem blts + dwNLVBCaps: DWORD; // driver specific capabilities for non-local->local vidmem blts + dwNLVBCaps2: DWORD; // more driver specific capabilities non-local->local vidmem blts + dwNLVBCKeyCaps: DWORD; // driver color key capabilities for non-local->local vidmem blts + dwNLVBFXCaps: DWORD; // driver FX capabilities for non-local->local blts + dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts + // Members added for DX6 release + ddsCaps : TDDSCaps2 ; // Surface Caps + end; + {$EXTERNALSYM _DDCAPS_DX6} + DDCAPS_DX6 = _DDCAPS_DX6; + {$EXTERNALSYM DDCAPS_DX6} + TDDCaps_DX6 = _DDCAPS_DX6; + + _DDCAPS_DX7 = TDDCaps_DX6; + {$EXTERNALSYM _DDCAPS_DX7} + DDCAPS_DX7 = _DDCAPS_DX7; + {$EXTERNALSYM DDCAPS_DX7} + PDDCaps_DX7 = ^TDDCaps_DX7; + TDDCaps_DX7 = TDDCaps_DX6; + +{$IFDEF DIRECTDRAW_VERSION_7} + PDDCaps = PDDCaps_DX7; + TDDCaps = TDDCaps_DX7; +{$ELSE} +{$IFDEF DIRECTDRAW_VERSION_6} + PDDCaps = PDDCaps_DX6; + TDDCaps = TDDCaps_DX6; +{$ELSE} +{$IFDEF DIRECTDRAW_VERSION_5} + PDDCaps = PDDCaps_DX5; + TDDCaps = TDDCaps_DX5; +{$ELSE} +{$IFDEF DIRECTDRAW_VERSION_3} + PDDCaps = PDDCaps_DX3; + TDDCaps = TDDCaps_DX3; +{$ELSE} + PDDCaps = PDDCaps_DX1; + TDDCaps = TDDCaps_DX1; +{$ENDIF} +{$ENDIF} +{$ENDIF} +{$ENDIF} + + + +(* + * TDDPixelFormat + *) + PDDPixelFormat = ^TDDPixelFormat; + _DDPIXELFORMAT = packed record + dwSize: DWORD; // size of structure + dwFlags: DWORD; // pixel format flags + dwFourCC: DWORD; // (FOURCC code) + case Integer of + 1: ( + dwRGBBitCount : DWORD; // how many bits per pixel + dwRBitMask : DWORD; // mask for red bit + dwGBitMask : DWORD; // mask for green bits + dwBBitMask : DWORD; // mask for blue bits + dwRGBAlphaBitMask : DWORD; // mask for alpha channel + ); + 2: ( + dwYUVBitCount : DWORD; // how many bits per pixel + dwYBitMask : DWORD; // mask for Y bits + dwUBitMask : DWORD; // mask for U bits + dwVBitMask : DWORD; // mask for V bits + dwYUVAlphaBitMask : DWORD; // mask for alpha channel + ); + 3: ( + dwZBufferBitDepth : DWORD; // how many total bits/pixel in z buffer (including any stencil bits) + dwStencilBitDepth : DWORD; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits) + dwZBitMask : DWORD; // mask for Z bits + dwStencilBitMask : DWORD; // mask for stencil bits + dwLuminanceAlphaBitMask : DWORD; // mask for alpha channel + ); + 4: ( + dwAlphaBitDepth : DWORD; // how many bits for alpha channels + dwLuminanceBitMask : DWORD; // mask for luminance bits + dwBumpDvBitMask : DWORD; // mask for bump map V delta bits + dwBumpLuminanceBitMask : DWORD; // mask for luminance in bump map + dwRGBZBitMask : DWORD; // mask for Z channel + ); + 5: ( + dwLuminanceBitCount : DWORD; // how many bits per pixel + dwBumpDuBitMask : DWORD; // mask for bump map U delta bits + Fill1, Fill2 : DWORD; + dwYUVZBitMask : DWORD; // mask for Z channel + ); + 6: ( dwBumpBitCount : DWORD; // how many bits per "buxel", total + ); + end; + {$EXTERNALSYM _DDPIXELFORMAT} + DDPIXELFORMAT = _DDPIXELFORMAT; + {$EXTERNALSYM DDPIXELFORMAT} + TDDPixelFormat = _DDPIXELFORMAT; + + // These definitions are for compatibility with Erik Unger original conversion + PDDPixelFormat_DX3 = PDDPixelFormat; + TDDPixelFormat_DX3 = TDDPixelFormat; + + PDDPixelFormat_DX5 = PDDPixelFormat; + TDDPixelFormat_DX5 = TDDPixelFormat; + + PDDPixelFormat_DX6 = PDDPixelFormat; + TDDPixelFormat_DX6 = TDDPixelFormat; + + PDDPixelFormat_DX7 = PDDPixelFormat; + TDDPixelFormat_DX7 = TDDPixelFormat; + + + +(* + * TDDOverlayFX + *) + PDDOverlayFX = ^TDDOverlayFX; + _DDOVERLAYFX = packed record + dwSize: DWORD; // size of structure + dwAlphaEdgeBlendBitDepth: DWORD; // Bit depth used to specify constant for alpha edge blend + dwAlphaEdgeBlend: DWORD; // Constant to use as alpha for edge blend + dwReserved: DWORD; + dwAlphaDestConstBitDepth: DWORD; // Bit depth used to specify alpha constant for destination + case Integer of + 0: ( + dwAlphaDestConst: DWORD; // Constant to use as alpha channel for dest + dwAlphaSrcConstBitDepth: DWORD; // Bit depth used to specify alpha constant for source + dwAlphaSrcConst: DWORD; // Constant to use as alpha channel for src + dckDestColorkey: TDDColorKey; // DestColorkey override + dckSrcColorkey: TDDColorKey; // DestColorkey override + dwDDFX: DWORD; // Overlay FX + dwFlags: DWORD; // flags + ); + 1: ( + lpDDSAlphaDest: PDirectDrawSurface; // Surface to use as alpha channel for dest + filler: DWORD; + lpDDSAlphaSrc: PDirectDrawSurface; // Surface to use as alpha channel for src + ); + end; + {$EXTERNALSYM _DDOVERLAYFX} + DDOVERLAYFX = _DDOVERLAYFX; + {$EXTERNALSYM DDOVERLAYFX} + TDDOverlayFX = _DDOVERLAYFX; + +(* + * TDDBltBatch: BltBatch entry structure + *) + PDDBltBatch = ^TDDBltBatch; + _DDBLTBATCH = packed record + lprDest: PRect; + lpDDSSrc: IDirectDrawSurface; + lprSrc: PRect; + dwFlags: DWORD; + lpDDBltFx: TDDBltFX; + end; + {$EXTERNALSYM _DDBLTBATCH} + DDBLTBATCH = _DDBLTBATCH; + {$EXTERNALSYM DDBLTBATCH} + TDDBltBatch = _DDBLTBATCH; + +(* + * TDDGammaRamp + *) + PDDGammaRamp = ^TDDGammaRamp; + _DDGAMMARAMP = packed record + red : array[0..255] of WORD; + green : array[0..255] of WORD; + blue : array[0..255] of WORD; + end; + {$EXTERNALSYM _DDGAMMARAMP} + DDGAMMARAMP = _DDGAMMARAMP; + {$EXTERNALSYM DDGAMMARAMP} + TDDGammaRamp = _DDGAMMARAMP; + +(* + * This is the structure within which DirectDraw returns data about the current graphics driver and chipset + *) + + PDDDeviceIdentifier = ^TDDDeviceIdentifier; + tagDDDEVICEIDENTIFIER = packed record + // + // These elements are for presentation to the user only. They should not be used to identify particular + // drivers, since this is unreliable and many different strings may be associated with the same + // device, and the same driver from different vendors. + // + szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char; + szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char; + + // + // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons + // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic + // drivers. It is recommended that guidDeviceIdentifier is used for this purpose. + // + // This version has the form: + // wProduct = HIWORD(liDriverVersion.HighPart) + // wVersion = LOWORD(liDriverVersion.HighPart) + // wSubVersion = HIWORD(liDriverVersion.LowPart) + // wBuild = LOWORD(liDriverVersion.LowPart) + // + liDriverVersion: TLargeInteger; // Defined for applications and other 32 bit components + + // + // These elements can be used to identify particular chipsets. Use with extreme caution. + // dwVendorId Identifies the manufacturer. May be zero if unknown. + // dwDeviceId Identifies the type of chipset. May be zero if unknown. + // dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown. + // dwRevision Identifies the revision level of the chipset. May be zero if unknown. + // + dwVendorId: DWORD; + dwDeviceId: DWORD; + dwSubSysId: DWORD; + dwRevision: DWORD; + + // + // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the + // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to + // reprofile the graphics subsystem. + // This element can also be used to identify particular problematic drivers. + // + guidDeviceIdentifier: TGUID; + end; + {$EXTERNALSYM tagDDDEVICEIDENTIFIER} + DDDEVICEIDENTIFIER = tagDDDEVICEIDENTIFIER; + {$EXTERNALSYM DDDEVICEIDENTIFIER} + TDDDeviceIdentifier = tagDDDEVICEIDENTIFIER; + + PDDDeviceIdentifier2 = ^TDDDeviceIdentifier2; + tagDDDEVICEIDENTIFIER2 = packed record + // + // These elements are for presentation to the user only. They should not be used to identify particular + // drivers, since this is unreliable and many different strings may be associated with the same + // device, and the same driver from different vendors. + // + szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char; + szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char; + + // + // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons + // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic + // drivers. It is recommended that guidDeviceIdentifier is used for this purpose. + // + // This version has the form: + // wProduct = HIWORD(liDriverVersion.HighPart) + // wVersion = LOWORD(liDriverVersion.HighPart) + // wSubVersion = HIWORD(liDriverVersion.LowPart) + // wBuild = LOWORD(liDriverVersion.LowPart) + // + liDriverVersion: TLargeInteger; // Defined for applications and other 32 bit components + + // + // These elements can be used to identify particular chipsets. Use with extreme caution. + // dwVendorId Identifies the manufacturer. May be zero if unknown. + // dwDeviceId Identifies the type of chipset. May be zero if unknown. + // dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown. + // dwRevision Identifies the revision level of the chipset. May be zero if unknown. + // + dwVendorId: DWORD; + dwDeviceId: DWORD; + dwSubSysId: DWORD; + dwRevision: DWORD; + + // + // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the + // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to + // reprofile the graphics subsystem. + // This element can also be used to identify particular problematic drivers. + // + guidDeviceIdentifier: TGUID; + + (* + * This element is used to determine the Windows Hardware Quality Lab (WHQL) + * certification level for this driver/device pair. + *) + dwWHQLLevel: DWORD; + end; + {$EXTERNALSYM tagDDDEVICEIDENTIFIER2} + DDDEVICEIDENTIFIER2 = tagDDDEVICEIDENTIFIER2; + {$EXTERNALSYM DDDEVICEIDENTIFIER2} + TDDDeviceIdentifier2 = tagDDDEVICEIDENTIFIER2; + +(* + * callbacks + *) + TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND; + Code: DWORD; lpContext: Pointer): HResult; stdcall; + {$NODEFINE TClipperCallback} + {$HPPEMIT 'typedef LPCLIPPERCALLBACK TClipperCallback;'} + TSurfacesStreamingCallback = function(arg: DWORD): HResult; stdcall; + {$NODEFINE TSurfacesStreamingCallback} + +(* + * TDDSurfaceDesc + *) + PDDSurfaceDesc = ^TDDSurfaceDesc; + _DDSURFACEDESC = packed record + dwSize: DWORD; // size of the TDDSurfaceDesc structure + dwFlags: DWORD; // determines what fields are valid + dwHeight: DWORD; // height of surface to be created + dwWidth: DWORD; // width of input surface + case Integer of + 0: ( + dwLinearSize: DWORD; // unused at the moment + ); + 1: ( + lPitch: Longint; // distance to start of next line (return value only) + dwBackBufferCount: DWORD; // number of back buffers requested + case Integer of + 0: ( + dwMipMapCount: DWORD; // number of mip-map levels requested + dwAlphaBitDepth: DWORD; // depth of alpha buffer requested + dwReserved: DWORD; // reserved + lpSurface: Pointer; // pointer to the associated surface memory + ddckCKDestOverlay: TDDColorKey; // color key for destination overlay use + ddckCKDestBlt: TDDColorKey; // color key for destination blt use + ddckCKSrcOverlay: TDDColorKey; // color key for source overlay use + ddckCKSrcBlt: TDDColorKey; // color key for source blt use + ddpfPixelFormat: TDDPixelFormat; // pixel format description of the surface + ddsCaps: TDDSCaps; // direct draw surface capabilities + ); + 1: ( + dwZBufferBitDepth: DWORD; // depth of Z buffer requested + ); + 2: ( + dwRefreshRate: DWORD; // refresh rate (used when display mode is described) + ); + ); + end; + {$EXTERNALSYM _DDSURFACEDESC} + DDSURFACEDESC = _DDSURFACEDESC; + {$EXTERNALSYM DDSURFACEDESC} + TDDSurfaceDesc = _DDSURFACEDESC; + + // These definitions are for compatibility with Erik Unger original conversion + PDDSurfaceDesc_DX5 = PDDSurfaceDesc; + TDDSurfaceDesc_DX5 = TDDSurfaceDesc; + + PDDSurfaceDesc_DX6 = PDDSurfaceDesc; + TDDSurfaceDesc_DX6 = TDDSurfaceDesc; + + +(* + * TDDSurfaceDesc2 + *) + PDDSurfaceDesc2 = ^TDDSurfaceDesc2; + _DDSURFACEDESC2 = packed record + dwSize: DWORD; // size of the TDDSurfaceDesc structure + dwFlags: DWORD; // determines what fields are valid + dwHeight: DWORD; // height of surface to be created + dwWidth: DWORD; // width of input surface + case Integer of + 0: ( + lPitch : Longint; // distance to start of next line (return value only) + ); + 1: ( + dwLinearSize : DWORD; // Formless late-allocated optimized surface size + dwBackBufferCount: DWORD; // number of back buffers requested + case Integer of + 0: ( + dwMipMapCount: DWORD; // number of mip-map levels requested + dwAlphaBitDepth: DWORD; // depth of alpha buffer requested + dwReserved: DWORD; // reserved + lpSurface: Pointer; // pointer to the associated surface memory + ddckCKDestOverlay: TDDColorKey; // color key for destination overlay use + ddckCKDestBlt: TDDColorKey; // color key for destination blt use + ddckCKSrcOverlay: TDDColorKey; // color key for source overlay use + ddckCKSrcBlt: TDDColorKey; // color key for source blt use + ddpfPixelFormat: TDDPixelFormat; // pixel format description of the surface + ddsCaps: TDDSCaps2; // direct draw surface capabilities + dwTextureStage: DWORD; // stage in multitexture cascade + ); + 1: ( + dwRefreshRate: DWORD; // refresh rate (used when display mode is described) + ); + ); + end; + {$EXTERNALSYM _DDSURFACEDESC2} + DDSURFACEDESC2 = _DDSURFACEDESC2; + {$EXTERNALSYM DDSURFACEDESC2} + TDDSurfaceDesc2 = _DDSURFACEDESC2; + +(* + * TDDOptSurfaceDesc + *) + + PDDOptSurfaceDesc = ^TDDOptSurfaceDesc; + _DDOPTSURFACEDESC = packed record + dwSize : DWORD; // size of the DDOPTSURFACEDESC structure + dwFlags : DWORD; // determines what fields are valid + ddSCaps : TDDSCaps2; // Common caps like: Memory type + ddOSCaps : TDDOSCaps; // Common caps like: Memory type + guid : TGUID; // Compression technique GUID + dwCompressionRatio : DWORD; // Compression ratio + end; + {$EXTERNALSYM _DDOPTSURFACEDESC} + DDOPTSURFACEDESC = _DDOPTSURFACEDESC; + {$EXTERNALSYM DDOPTSURFACEDESC} + TDDOptSurfaceDesc = _DDOPTSURFACEDESC; + +(* + * DDCOLORCONTROL + *) + PDDColorControl = ^TDDColorControl; + _DDCOLORCONTROL = packed record + dwSize: DWORD; + dwFlags: DWORD; + lBrightness: Longint; + lContrast: Longint; + lHue: Longint; + lSaturation: Longint; + lSharpness: Longint; + lGamma: Longint; + lColorEnable: Longint; + dwReserved1: DWORD; + end; + {$EXTERNALSYM _DDCOLORCONTROL} + DDCOLORCONTROL = _DDCOLORCONTROL; + {$EXTERNALSYM DDCOLORCONTROL} + TDDColorControl = _DDCOLORCONTROL; + +(* + * callbacks + *) + +//{$IFNDEF WINNT} + TDDEnumModesCallback = function (const lpDDSurfaceDesc: TDDSurfaceDesc; + lpContext: Pointer): HResult; stdcall; + {$NODEFINE TDDEnumModesCallback} + {$HPPEMIT 'typedef LPCLIPPERCALLBACK TDDEnumModesCallback;'} + TDDEnumModesCallback2 = function (const lpDDSurfaceDesc: TDDSurfaceDesc2; + lpContext: Pointer): HResult; stdcall; + {$NODEFINE TDDEnumModesCallback2} + {$HPPEMIT 'typedef LPDDENUMMODESCALLBACK2 TDDEnumModesCallback2;'} + TDDEnumSurfacesCallback = function (lpDDSurface: IDirectDrawSurface; + const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer): HResult; stdcall; + {$NODEFINE TDDEnumSurfacesCallback} + {$HPPEMIT 'typedef LPDDENUMSURFACESCALLBACK TDDEnumSurfacesCallback;'} + TDDEnumSurfacesCallback2 = function (lpDDSurface: IDirectDrawSurface4; + const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer): HResult; stdcall; + {$NODEFINE TDDEnumSurfacesCallback2} + {$HPPEMIT 'typedef LPDDENUMSURFACESCALLBACK2 TDDEnumSurfacesCallback2;'} + TDDEnumSurfacesCallback7 = function (lpDDSurface: IDirectDrawSurface7; + const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer): HResult; stdcall; + {$NODEFINE TDDEnumSurfacesCallback7} + {$HPPEMIT 'typedef LPDDENUMSURFACESCALLBACK7 TDDEnumSurfacesCallback7;'} +//{$ENDIF} + +(* + * INTERACES FOLLOW: + * IDirectDraw + * IDirectDrawClipper + * IDirectDrawPalette + * IDirectDrawSurface + *) + +(* + * IDirectDraw + *) + + IDirectDraw = interface(IUnknown) + ['{6C14DB80-A733-11CE-A521-0020AF0BE560}'] + (*** IDirectDraw methods ***) + function Compact: HResult; stdcall; + function CreateClipper(dwFlags: DWORD; + out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; + function CreatePalette(dwFlags: DWORD; lpColorTable: Pointer; + out lplpDDPalette: IDirectDrawPalette; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateSurface(var lpDDSurfaceDesc: TDDSurfaceDesc; + out lplpDDSurface: IDirectDrawSurface; + pUnkOuter: IUnknown): HResult; stdcall; + function DuplicateSurface(lpDDSurface: IDirectDrawSurface; + out lplpDupDDSurface: IDirectDrawSurface): HResult; stdcall; + function EnumDisplayModes(dwFlags: DWORD; + lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer; + lpEnumModesCallback: TDDEnumModesCallback): HResult; stdcall; + function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc; + lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) : + HResult; stdcall; + function FlipToGDISurface: HResult; stdcall; + function GetCaps(lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps): HResult; stdcall; + function GetDisplayMode(out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function GetFourCCCodes(var lpNumCodes: DWORD; lpCodes: PDWORD): HResult; stdcall; + function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface): HResult; stdcall; + function GetMonitorFrequency(out lpdwFrequency: DWORD): HResult; stdcall; + function GetScanLine(out lpdwScanLine: DWORD): HResult; stdcall; + function GetVerticalBlankStatus(out lpbIsInVB: BOOL): HResult; stdcall; + function Initialize(lpGUID: PGUID): HResult; stdcall; + function RestoreDisplayMode: HResult; stdcall; + function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall; + (*** Warning! SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***) + function SetDisplayMode(dwWidth: DWORD; dwHeight: DWORD; + dwBpp: DWORD): HResult; stdcall; + function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall; + end; + + IDirectDraw2 = interface(IUnknown) + ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}'] + (*** IDirectDraw methods ***) + function Compact: HResult; stdcall; + function CreateClipper(dwFlags: DWORD; + out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; + function CreatePalette(dwFlags: DWORD; lpColorTable: Pointer; + out lplpDDPalette: IDirectDrawPalette; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateSurface(var lpDDSurfaceDesc: TDDSurfaceDesc; + out lplpDDSurface: IDirectDrawSurface; + pUnkOuter: IUnknown): HResult; stdcall; + function DuplicateSurface(lpDDSurface: IDirectDrawSurface; + out lplpDupDDSurface: IDirectDrawSurface): HResult; stdcall; + function EnumDisplayModes(dwFlags: DWORD; + lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer; + lpEnumModesCallback: TDDEnumModesCallback): HResult; stdcall; + function EnumSurfaces(dwFlags: DWORD; var lpDDSD: TDDSurfaceDesc; + lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function FlipToGDISurface: HResult; stdcall; + function GetCaps(lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps): HResult; stdcall; + function GetDisplayMode(out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function GetFourCCCodes(var lpNumCodes: DWORD; lpCodes: PDWORD): HResult; stdcall; + function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface): HResult; stdcall; + function GetMonitorFrequency(out lpdwFrequency: DWORD): HResult; stdcall; + function GetScanLine(out lpdwScanLine: DWORD): HResult; stdcall; + function GetVerticalBlankStatus(out lpbIsInVB: BOOL): HResult; stdcall; + function Initialize(lpGUID: PGUID): HResult; stdcall; + function RestoreDisplayMode: HResult; stdcall; + function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall; + function SetDisplayMode(dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD; + dwRefreshRate: DWORD; dwFlags: DWORD): HResult; stdcall; + function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetAvailableVidMem(var lpDDSCaps: TDDSCaps; + out lpdwTotal, lpdwFree: DWORD): HResult; stdcall; + end; + + IDirectDraw4 = interface(IUnknown) + ['{9c59509a-39bd-11d1-8c4a-00c04fd930c5}'] + (*** IDirectDraw methods ***) + function Compact: HResult; stdcall; + function CreateClipper(dwFlags: DWORD; + out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; + function CreatePalette(dwFlags: DWORD; lpColorTable: Pointer; + out lplpDDPalette: IDirectDrawPalette; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc2; + out lplpDDSurface: IDirectDrawSurface4; + pUnkOuter: IUnknown): HResult; stdcall; + function DuplicateSurface(lpDDSurface: IDirectDrawSurface4; + out lplpDupDDSurface: IDirectDrawSurface4): HResult; stdcall; + function EnumDisplayModes(dwFlags: DWORD; + lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer; + lpEnumModesCallback: TDDEnumModesCallback2): HResult; stdcall; + function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2; + lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback2): + HResult; stdcall; + function FlipToGDISurface: HResult; stdcall; + function GetCaps(lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps): HResult; stdcall; + function GetDisplayMode(out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function GetFourCCCodes(var lpNumCodes: DWORD; lpCodes: PDWORD): HResult; stdcall; + function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface4): HResult; stdcall; + function GetMonitorFrequency(out lpdwFrequency: DWORD): HResult; stdcall; + function GetScanLine(out lpdwScanLine: DWORD): HResult; stdcall; + function GetVerticalBlankStatus(out lpbIsInVB: BOOL): HResult; stdcall; + function Initialize(lpGUID: PGUID): HResult; stdcall; + function RestoreDisplayMode: HResult; stdcall; + function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall; + function SetDisplayMode(dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD; + dwRefreshRate: DWORD; dwFlags: DWORD): HResult; stdcall; + function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetAvailableVidMem(const lpDDSCaps: TDDSCaps2; + out lpdwTotal, lpdwFree: DWORD): HResult; stdcall; + (*** Added in the V4 Interface ***) + function GetSurfaceFromDC(hdc: Windows.HDC; + out lpDDS4: IDirectDrawSurface4): HResult; stdcall; + function RestoreAllSurfaces: HResult; stdcall; + function TestCooperativeLevel: HResult; stdcall; + function GetDeviceIdentifier(out lpdddi: TDDDeviceIdentifier; + dwFlags: DWORD): HResult; stdcall; + end; + + IDirectDraw7 = interface(IUnknown) + ['{15e65ec0-3b9c-11d2-b92f-00609797ea5b}'] + (*** IDirectDraw methods ***) + function Compact: HResult; stdcall; + function CreateClipper(dwFlags: DWORD; + out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; + function CreatePalette(dwFlags: DWORD; lpColorTable: Pointer; + out lplpDDPalette: IDirectDrawPalette; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc2; + out lplpDDSurface: IDirectDrawSurface7; + pUnkOuter: IUnknown): HResult; stdcall; + function DuplicateSurface(lpDDSurface: IDirectDrawSurface7; + out lplpDupDDSurface: IDirectDrawSurface7): HResult; stdcall; + function EnumDisplayModes(dwFlags: DWORD; + lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer; + lpEnumModesCallback: TDDEnumModesCallback2): HResult; stdcall; + function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2; + lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback7) : + HResult; stdcall; + function FlipToGDISurface: HResult; stdcall; + function GetCaps(lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps): HResult; stdcall; + function GetDisplayMode(out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function GetFourCCCodes(var lpNumCodes: DWORD; lpCodes: PDWORD): HResult; stdcall; + function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface7) : + HResult; stdcall; + function GetMonitorFrequency(out lpdwFrequency: DWORD): HResult; stdcall; + function GetScanLine(out lpdwScanLine: DWORD): HResult; stdcall; + function GetVerticalBlankStatus(out lpbIsInVB: BOOL): HResult; stdcall; + function Initialize(lpGUID: PGUID): HResult; stdcall; + function RestoreDisplayMode: HResult; stdcall; + function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall; + function SetDisplayMode(dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD; + dwRefreshRate: DWORD; dwFlags: DWORD): HResult; stdcall; + function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle) : + HResult; stdcall; + (*** Added in the v2 interface ***) + function GetAvailableVidMem(const lpDDSCaps: TDDSCaps2; + out lpdwTotal, lpdwFree: DWORD): HResult; stdcall; + (*** Added in the V4 Interface ***) + function GetSurfaceFromDC(hdc: Windows.HDC; + out lpDDS: IDirectDrawSurface7): HResult; stdcall; + function RestoreAllSurfaces: HResult; stdcall; + function TestCooperativeLevel: HResult; stdcall; + function GetDeviceIdentifier(out lpdddi: TDDDeviceIdentifier2; + dwFlags: DWORD): HResult; stdcall; + function StartModeTest(const lpModesToTest; dwNumEntries, dwFlags: DWORD): HResult; stdcall; + function EvaluateMode(dwFlags: DWORD; out pSecondsUntilTimeout: DWORD): HResult; stdcall; + end; + + + +(* + * IDirectDrawPalette + *) + + IDirectDrawPalette = interface(IUnknown) + ['{6C14DB84-A733-11CE-A521-0020AF0BE560}'] + (*** IDirectDrawPalette methods ***) + function GetCaps(out lpdwCaps: DWORD): HResult; stdcall; + function GetEntries(dwFlags: DWORD; dwBase: DWORD; dwNumEntries: DWORD; + lpEntries: Pointer): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; dwFlags: DWORD; + lpDDColorTable: Pointer): HResult; stdcall; + function SetEntries(dwFlags: DWORD; dwStartingEntry: DWORD; + dwCount: DWORD; lpEntries: Pointer): HResult; stdcall; + end; + +(* + * IDirectDrawClipper + *) + + IDirectDrawClipper = interface(IUnknown) + ['{6C14DB85-A733-11CE-A521-0020AF0BE560}'] + (*** IDirectDrawClipper methods ***) + function GetClipList(lpRect: PRect; lpClipList: PRgnData; + var lpdwSize: DWORD): HResult; stdcall; + function GetHWnd(out lphWnd: HWND): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; dwFlags: DWORD): HResult; stdcall; + function IsClipListChanged(out lpbChanged: BOOL): HResult; stdcall; + function SetClipList(lpClipList: PRgnData; dwFlags: DWORD): HResult; stdcall; + function SetHWnd(dwFlags: DWORD; hWnd: HWND): HResult; stdcall; + end; + +(* + * IDirectDrawSurface and related interfaces + *) + + IDirectDrawSurface = interface(IUnknown) + ['{6C14DB81-A733-11CE-A521-0020AF0BE560}'] + (*** IDirectDrawSurface methods ***) + function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface) : + HResult; stdcall; + function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall; + function Blt(lpDestRect: PRect; + lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect; + dwFlags: DWORD; lpDDBltFx: PDDBltFX): HResult; stdcall; + function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD; + dwFlags: DWORD): HResult; stdcall; + function BltFast(dwX: DWORD; dwY: DWORD; + lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect; + dwTrans: DWORD): HResult; stdcall; + function DeleteAttachedSurface(dwFlags: DWORD; + lpDDSAttachedSurface: IDirectDrawSurface): HResult; stdcall; + function EnumAttachedSurfaces(lpContext: Pointer; + lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer; + lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface; + dwFlags: DWORD): HResult; stdcall; + function GetAttachedSurface(var lpDDSCaps: TDDSCaps; + (*out*)var lplpDDAttachedSurface: IDirectDrawSurface): HResult; stdcall; + function GetBltStatus(dwFlags: DWORD): HResult; stdcall; + function GetCaps(out lpDDSCaps: TDDSCaps): HResult; stdcall; + function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall; + function GetColorKey(dwFlags: DWORD; out lpDDColorKey: TDDColorKey) : + HResult; stdcall; + function GetDC(out lphDC: HDC): HResult; stdcall; + function GetFlipStatus(dwFlags: DWORD): HResult; stdcall; + function GetOverlayPosition(out lplX, lplY: Longint): HResult; stdcall; + function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall; + function GetPixelFormat(out lpDDPixelFormat: TDDPixelFormat): HResult; stdcall; + function GetSurfaceDesc(out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; + out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function IsLost: HResult; stdcall; + function Lock(lpDestRect: PRect; out lpDDSurfaceDesc: + TDDSurfaceDesc; dwFlags: DWORD; hEvent: THandle): HResult; stdcall; + function ReleaseDC(hDC: Windows.HDC): HResult; stdcall; + function _Restore: HResult; stdcall; + function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall; + function SetColorKey(dwFlags: DWORD; lpDDColorKey: PDDColorKey) : + HResult; stdcall; + function SetOverlayPosition(lX, lY: Longint): HResult; stdcall; + function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall; + function Unlock(lpSurfaceData: Pointer): HResult; stdcall; + function UpdateOverlay(lpSrcRect: PRect; + lpDDDestSurface: IDirectDrawSurface; lpDestRect: PRect; + dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX): HResult; stdcall; + function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall; + function UpdateOverlayZOrder(dwFlags: DWORD; + lpDDSReference: IDirectDrawSurface): HResult; stdcall; + end; + +(* + * IDirectDrawSurface2 and related interfaces + *) + + IDirectDrawSurface2 = interface(IUnknown) + ['{57805885-6eec-11cf-9441-a82303c10e27}'] + (*** IDirectDrawSurface methods ***) + function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface2) : + HResult; stdcall; + function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall; + function Blt(lpDestRect: PRect; + lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect; + dwFlags: DWORD; lpDDBltFx: PDDBltFX): HResult; stdcall; + function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD; + dwFlags: DWORD): HResult; stdcall; + function BltFast(dwX: DWORD; dwY: DWORD; + lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect; + dwTrans: DWORD): HResult; stdcall; + function DeleteAttachedSurface(dwFlags: DWORD; + lpDDSAttachedSurface: IDirectDrawSurface2): HResult; stdcall; + function EnumAttachedSurfaces(lpContext: Pointer; + lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer; + lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface2; + dwFlags: DWORD): HResult; stdcall; + function GetAttachedSurface(var lpDDSCaps: TDDSCaps; + out lplpDDAttachedSurface: IDirectDrawSurface2): HResult; stdcall; + function GetBltStatus(dwFlags: DWORD): HResult; stdcall; + function GetCaps(out lpDDSCaps: TDDSCaps): HResult; stdcall; + function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall; + function GetColorKey(dwFlags: DWORD; out lpDDColorKey: TDDColorKey) : + HResult; stdcall; + function GetDC(out lphDC: HDC): HResult; stdcall; + function GetFlipStatus(dwFlags: DWORD): HResult; stdcall; + function GetOverlayPosition(out lplX, lplY: Longint): HResult; stdcall; + function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall; + function GetPixelFormat(out lpDDPixelFormat: TDDPixelFormat): HResult; stdcall; + function GetSurfaceDesc(out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; + out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function IsLost: HResult; stdcall; + function Lock(lpDestRect: PRect; + out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD; + hEvent: THandle): HResult; stdcall; + function ReleaseDC(hDC: Windows.HDC): HResult; stdcall; + function _Restore: HResult; stdcall; + function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall; + function SetColorKey(dwFlags: DWORD; lpDDColorKey: PDDColorKey) : + HResult; stdcall; + function SetOverlayPosition(lX, lY: Longint): HResult; stdcall; + function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall; + function Unlock(lpSurfaceData: Pointer): HResult; stdcall; + function UpdateOverlay(lpSrcRect: PRect; + lpDDDestSurface: IDirectDrawSurface2; lpDestRect: PRect; + dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX): HResult; stdcall; + function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall; + function UpdateOverlayZOrder(dwFlags: DWORD; + lpDDSReference: IDirectDrawSurface2): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetDDInterface(var lplpDD: IDirectDraw): HResult; stdcall; + function PageLock(dwFlags: DWORD): HResult; stdcall; + function PageUnlock(dwFlags: DWORD): HResult; stdcall; + end; + + IDirectDrawSurface3 = interface(IUnknown) + ['{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}'] + (*** IDirectDrawSurface methods ***) + function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface3) : + HResult; stdcall; + function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall; + function Blt(lpDestRect: PRect; + lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect; + dwFlags: DWORD; lpDDBltFx: PDDBltFX): HResult; stdcall; + function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD; + dwFlags: DWORD): HResult; stdcall; + function BltFast(dwX: DWORD; dwY: DWORD; + lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect; + dwTrans: DWORD): HResult; stdcall; + function DeleteAttachedSurface(dwFlags: DWORD; + lpDDSAttachedSurface: IDirectDrawSurface3): HResult; stdcall; + function EnumAttachedSurfaces(lpContext: Pointer; + lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer; + lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface3; + dwFlags: DWORD): HResult; stdcall; + function GetAttachedSurface(var lpDDSCaps: TDDSCaps; + out lplpDDAttachedSurface: IDirectDrawSurface3): HResult; stdcall; + function GetBltStatus(dwFlags: DWORD): HResult; stdcall; + function GetCaps(out lpDDSCaps: TDDSCaps): HResult; stdcall; + function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall; + function GetColorKey(dwFlags: DWORD; out lpDDColorKey: TDDColorKey) : + HResult; stdcall; + function GetDC(out lphDC: HDC): HResult; stdcall; + function GetFlipStatus(dwFlags: DWORD): HResult; stdcall; + function GetOverlayPosition(out lplX, lplY: Longint): HResult; stdcall; + function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall; + function GetPixelFormat(out lpDDPixelFormat: TDDPixelFormat): HResult; stdcall; + function GetSurfaceDesc(out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; + out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function IsLost: HResult; stdcall; + function Lock(lpDestRect: PRect; + out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD; + hEvent: THandle): HResult; stdcall; + function ReleaseDC(hDC: Windows.HDC): HResult; stdcall; + function _Restore: HResult; stdcall; + function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall; + function SetColorKey(dwFlags: DWORD; lpDDColorKey: PDDColorKey) : + HResult; stdcall; + function SetOverlayPosition(lX, lY: Longint): HResult; stdcall; + function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall; + function Unlock(lpSurfaceData: Pointer): HResult; stdcall; + function UpdateOverlay(lpSrcRect: PRect; + lpDDDestSurface: IDirectDrawSurface3; lpDestRect: PRect; + dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX): HResult; stdcall; + function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall; + function UpdateOverlayZOrder(dwFlags: DWORD; + lpDDSReference: IDirectDrawSurface3): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetDDInterface(out lplpDD: IDirectDraw): HResult; stdcall; + function PageLock(dwFlags: DWORD): HResult; stdcall; + function PageUnlock(dwFlags: DWORD): HResult; stdcall; + (*** Added in the V3 interface ***) + function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc; dwFlags: DWORD): HResult; stdcall; + end; + +(* + * IDirectDrawSurface4 and related interfaces + *) + IDirectDrawSurface4 = interface(IUnknown) + ['{0B2B8630-AD35-11D0-8EA6-00609797EA5B}'] + (*** IDirectDrawSurface methods ***) + function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface4) : + HResult; stdcall; + function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall; + function Blt(lpDestRect: PRect; + lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect; + dwFlags: DWORD; lpDDBltFx: PDDBltFX): HResult; stdcall; + function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD; + dwFlags: DWORD): HResult; stdcall; + function BltFast(dwX: DWORD; dwY: DWORD; + lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect; + dwTrans: DWORD): HResult; stdcall; + function DeleteAttachedSurface(dwFlags: DWORD; + lpDDSAttachedSurface: IDirectDrawSurface4): HResult; stdcall; + function EnumAttachedSurfaces(lpContext: Pointer; + lpEnumSurfacesCallback: TDDEnumSurfacesCallback2): HResult; stdcall; + function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer; + lpfnCallback: TDDEnumSurfacesCallback2): HResult; stdcall; + function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface4; + dwFlags: DWORD): HResult; stdcall; + function GetAttachedSurface(const lpDDSCaps: TDDSCaps2; + out lplpDDAttachedSurface: IDirectDrawSurface4): HResult; stdcall; + function GetBltStatus(dwFlags: DWORD): HResult; stdcall; + function GetCaps(out lpDDSCaps: TDDSCaps2): HResult; stdcall; + function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall; + function GetColorKey(dwFlags: DWORD; out lpDDColorKey: TDDColorKey) : + HResult; stdcall; + function GetDC(out lphDC: HDC): HResult; stdcall; + function GetFlipStatus(dwFlags: DWORD): HResult; stdcall; + function GetOverlayPosition(out lplX, lplY: Longint): HResult; stdcall; + function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall; + function GetPixelFormat(out lpDDPixelFormat: TDDPixelFormat): HResult; stdcall; + function GetSurfaceDesc(out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; + out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function IsLost: HResult; stdcall; + function Lock(lpDestRect: PRect; + out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD; + hEvent: THandle): HResult; stdcall; + function ReleaseDC(hDC: Windows.HDC): HResult; stdcall; + function _Restore: HResult; stdcall; + function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall; + function SetColorKey(dwFlags: DWORD; lpDDColorKey: PDDColorKey) : + HResult; stdcall; + function SetOverlayPosition(lX, lY: Longint): HResult; stdcall; + function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall; + function Unlock(lpRect: PRect): HResult; stdcall; + function UpdateOverlay(lpSrcRect: PRect; + lpDDDestSurface: IDirectDrawSurface4; lpDestRect: PRect; + dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX): HResult; stdcall; + function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall; + function UpdateOverlayZOrder(dwFlags: DWORD; + lpDDSReference: IDirectDrawSurface4): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall; + function PageLock(dwFlags: DWORD): HResult; stdcall; + function PageUnlock(dwFlags: DWORD): HResult; stdcall; + (*** Added in the V3 interface ***) + function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD): HResult; stdcall; + (*** Added in the v4 interface ***) + function SetPrivateData(const guidTag: TGUID; lpData: Pointer; + cbSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function GetPrivateData(const guidTag: TGUID; lpBuffer: Pointer; + var lpcbBufferSize: DWORD): HResult; stdcall; + function FreePrivateData(const guidTag: TGUID): HResult; stdcall; + function GetUniquenessValue(out lpValue: DWORD): HResult; stdcall; + function ChangeUniquenessValue: HResult; stdcall; + end; + + IDirectDrawSurface7 = interface(IUnknown) + ['{06675a80-3b9b-11d2-b92f-00609797ea5b}'] + (*** IDirectDrawSurface methods ***) + function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface7) : + HResult; stdcall; + function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall; + function Blt(lpDestRect: PRect; + lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect; + dwFlags: DWORD; lpDDBltFx: PDDBltFX): HResult; stdcall; + function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD; + dwFlags: DWORD): HResult; stdcall; + function BltFast(dwX: DWORD; dwY: DWORD; + lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect; + dwTrans: DWORD): HResult; stdcall; + function DeleteAttachedSurface(dwFlags: DWORD; + lpDDSAttachedSurface: IDirectDrawSurface7): HResult; stdcall; + function EnumAttachedSurfaces(lpContext: Pointer; + lpEnumSurfacesCallback: TDDEnumSurfacesCallback7): HResult; stdcall; + function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer; + lpfnCallback: TDDEnumSurfacesCallback7): HResult; stdcall; + function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface7; + dwFlags: DWORD): HResult; stdcall; + function GetAttachedSurface(const lpDDSCaps: TDDSCaps2; + out lplpDDAttachedSurface: IDirectDrawSurface7): HResult; stdcall; + function GetBltStatus(dwFlags: DWORD): HResult; stdcall; + function GetCaps(out lpDDSCaps: TDDSCaps2): HResult; stdcall; + function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall; + function GetColorKey(dwFlags: DWORD; out lpDDColorKey: TDDColorKey) : + HResult; stdcall; + function GetDC(out lphDC: HDC): HResult; stdcall; + function GetFlipStatus(dwFlags: DWORD): HResult; stdcall; + function GetOverlayPosition(out lplX, lplY: Longint): HResult; stdcall; + function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall; + function GetPixelFormat(out lpDDPixelFormat: TDDPixelFormat): HResult; stdcall; + function GetSurfaceDesc(out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; + out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function IsLost: HResult; stdcall; + function Lock(lpDestRect: PRect; + out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD; + hEvent: THandle): HResult; stdcall; + function ReleaseDC(hDC: Windows.HDC): HResult; stdcall; + function _Restore: HResult; stdcall; + function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall; + function SetColorKey(dwFlags: DWORD; lpDDColorKey: PDDColorKey) : + HResult; stdcall; + function SetOverlayPosition(lX, lY: Longint): HResult; stdcall; + function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall; + function Unlock(lpRect: PRect): HResult; stdcall; + function UpdateOverlay(lpSrcRect: PRect; + lpDDDestSurface: IDirectDrawSurface7; lpDestRect: PRect; + dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX): HResult; stdcall; + function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall; + function UpdateOverlayZOrder(dwFlags: DWORD; + lpDDSReference: IDirectDrawSurface7): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall; + function PageLock(dwFlags: DWORD): HResult; stdcall; + function PageUnlock(dwFlags: DWORD): HResult; stdcall; + (*** Added in the V3 interface ***) + function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD): HResult; stdcall; + (*** Added in the v4 interface ***) + function SetPrivateData(const guidTag: TGUID; lpData: Pointer; + cbSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function GetPrivateData(const guidTag: TGUID; lpBuffer: Pointer; + var lpcbBufferSize: DWORD): HResult; stdcall; + function FreePrivateData(const guidTag: TGUID): HResult; stdcall; + function GetUniquenessValue(out lpValue: DWORD): HResult; stdcall; + function ChangeUniquenessValue: HResult; stdcall; + (*** Moved Texture7 methods here ***) + function SetPriority(dwPriority: DWORD): HResult; stdcall; + function GetPriority(out lpdwPriority: DWORD): HResult; stdcall; + function SetLOD(dwMaxLOD: DWORD): HResult; stdcall; + function GetLOD(out lpdwMaxLOD: DWORD): HResult; stdcall; + end; + + IDirectDrawColorControl = interface(IUnknown) + ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}'] + function GetColorControls(out lpColorControl: TDDColorControl): HResult; stdcall; + function SetColorControls(const lpColorControl: TDDColorControl): HResult; stdcall; + end; + +(* + * IDirectDrawGammaControl + *) + IDirectDrawGammaControl = interface(IUnknown) + ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}'] + function GetGammaRamp(dwFlags: DWORD; out lpRampData: TDDGammaRamp): HResult; stdcall; + function SetGammaRamp(dwFlags: DWORD; const lpRampData: TDDGammaRamp): HResult; stdcall; + end; + +type + IID_IDirectDraw = IDirectDraw; + {$EXTERNALSYM IID_IDirectDraw} + IID_IDirectDraw2 = IDirectDraw2; + {$EXTERNALSYM IID_IDirectDraw2} + IID_IDirectDraw4 = IDirectDraw4; + {$EXTERNALSYM IID_IDirectDraw4} + IID_IDirectDraw7 = IDirectDraw7; + {$EXTERNALSYM IID_IDirectDraw7} + IID_IDirectDrawSurface = IDirectDrawSurface; + {$EXTERNALSYM IID_IDirectDrawSurface} + IID_IDirectDrawSurface2 = IDirectDrawSurface2; + {$EXTERNALSYM IID_IDirectDrawSurface2} + IID_IDirectDrawSurface3 = IDirectDrawSurface3; + {$EXTERNALSYM IID_IDirectDrawSurface3} + IID_IDirectDrawSurface4 = IDirectDrawSurface4; + {$EXTERNALSYM IID_IDirectDrawSurface4} + IID_IDirectDrawSurface7 = IDirectDrawSurface7; + {$EXTERNALSYM IID_IDirectDrawSurface7} + + IID_IDirectDrawPalette = IDirectDrawPalette; + {$EXTERNALSYM IID_IDirectDrawPalette} + IID_IDirectDrawClipper = IDirectDrawClipper; + {$EXTERNALSYM IID_IDirectDrawClipper} + IID_IDirectDrawColorControl = IDirectDrawColorControl; + {$EXTERNALSYM IID_IDirectDrawColorControl} + IID_IDirectDrawGammaControl = IDirectDrawGammaControl; + {$EXTERNALSYM IID_IDirectDrawGammaControl} + +const +(* + * ddsCaps field is valid. + *) + DDSD_CAPS = $00000001; // default + {$EXTERNALSYM DDSD_CAPS} + +(* + * dwHeight field is valid. + *) + DDSD_HEIGHT = $00000002; + {$EXTERNALSYM DDSD_HEIGHT} + +(* + * dwWidth field is valid. + *) + DDSD_WIDTH = $00000004; + {$EXTERNALSYM DDSD_WIDTH} + +(* + * lPitch is valid. + *) + DDSD_PITCH = $00000008; + {$EXTERNALSYM DDSD_PITCH} + +(* + * dwBackBufferCount is valid. + *) + DDSD_BACKBUFFERCOUNT = $00000020; + {$EXTERNALSYM DDSD_BACKBUFFERCOUNT} + +(* + * dwZBufferBitDepth is valid. (shouldnt be used in DDSURFACEDESC2) + *) + DDSD_ZBUFFERBITDEPTH = $00000040; + {$EXTERNALSYM DDSD_ZBUFFERBITDEPTH} + +(* + * dwAlphaBitDepth is valid. + *) + DDSD_ALPHABITDEPTH = $00000080; + {$EXTERNALSYM DDSD_ALPHABITDEPTH} + +(* + * lpSurface is valid. + *) + DDSD_LPSURFACE = $00000800; + {$EXTERNALSYM DDSD_LPSURFACE} + +(* + * ddpfPixelFormat is valid. + *) + DDSD_PIXELFORMAT = $00001000; + {$EXTERNALSYM DDSD_PIXELFORMAT} + +(* + * ddckCKDestOverlay is valid. + *) + DDSD_CKDESTOVERLAY = $00002000; + {$EXTERNALSYM DDSD_CKDESTOVERLAY} + +(* + * ddckCKDestBlt is valid. + *) + DDSD_CKDESTBLT = $00004000; + {$EXTERNALSYM DDSD_CKDESTBLT} + +(* + * ddckCKSrcOverlay is valid. + *) + DDSD_CKSRCOVERLAY = $00008000; + {$EXTERNALSYM DDSD_CKSRCOVERLAY} + +(* + * ddckCKSrcBlt is valid. + *) + DDSD_CKSRCBLT = $00010000; + {$EXTERNALSYM DDSD_CKSRCBLT} + +(* + * dwMipMapCount is valid. + *) + DDSD_MIPMAPCOUNT = $00020000; + {$EXTERNALSYM DDSD_MIPMAPCOUNT} + + (* + * dwRefreshRate is valid + *) + DDSD_REFRESHRATE = $00040000; + {$EXTERNALSYM DDSD_REFRESHRATE} + +(* + * dwLinearSize is valid + *) + DDSD_LINEARSIZE = $00080000; + {$EXTERNALSYM DDSD_LINEARSIZE} + +(* + * dwTextureStage is valid + *) + DDSD_TEXTURESTAGE = $00100000; + {$EXTERNALSYM DDSD_TEXTURESTAGE} + +(* + * dwFVF is valid + *) + DDSD_FVF = $00200000; + {$EXTERNALSYM DDSD_FVF} + +(* + * dwSrcVBHandle is valid + *) + DDSD_SRCVBHANDLE = $00400000; + {$EXTERNALSYM DDSD_SRCVBHANDLE} + +(* + * dwDepth is valid + *) + DDSD_DEPTH = $00800000; + {$EXTERNALSYM DDSD_DEPTH} + +(* + * All input fields are valid. + *) + DDSD_ALL = $00fff9ee; + {$EXTERNALSYM DDSD_ALL} + + +(* + * guid field is valid. + *) + DDOSD_GUID = $00000001; + {$EXTERNALSYM DDOSD_GUID} + +(* + * dwCompressionRatio field is valid. + *) + DDOSD_COMPRESSION_RATIO = $00000002; + {$EXTERNALSYM DDOSD_COMPRESSION_RATIO} + +(* + * ddSCaps field is valid. + *) + DDOSD_SCAPS = $00000004; + {$EXTERNALSYM DDOSD_SCAPS} + +(* + * ddOSCaps field is valid. + *) + DDOSD_OSCAPS = $00000008; + {$EXTERNALSYM DDOSD_OSCAPS} + +(* + * All input fields are valid. + *) + DDOSD_ALL = $0000000f; + {$EXTERNALSYM DDOSD_ALL} + +(* + * The surface's optimized pixelformat is compressed + *) + DDOSDCAPS_OPTCOMPRESSED = $00000001; + {$EXTERNALSYM DDOSDCAPS_OPTCOMPRESSED} + +(* + * The surface's optimized pixelformat is reordered + *) + DDOSDCAPS_OPTREORDERED = $00000002; + {$EXTERNALSYM DDOSDCAPS_OPTREORDERED} + +(* + * The opt surface is a monolithic mipmap + *) + DDOSDCAPS_MONOLITHICMIPMAP = $00000004; + {$EXTERNALSYM DDOSDCAPS_MONOLITHICMIPMAP} + +(* + * The valid Surf caps: + * DDSCAPS_SYSTEMMEMORY = $00000800; + * DDSCAPS_VIDEOMEMORY = $00004000; + * DDSCAPS_LOCALVIDMEM = $10000000; + * DDSCAPS_NONLOCALVIDMEM = $20000000; + *) + DDOSDCAPS_VALIDSCAPS = $30004800; + {$EXTERNALSYM DDOSDCAPS_VALIDSCAPS} + +(* + * The valid OptSurf caps + *) + DDOSDCAPS_VALIDOSCAPS = $00000007; + {$EXTERNALSYM DDOSDCAPS_VALIDOSCAPS} + + +(* + * DDCOLORCONTROL + *) + +(* + * lBrightness field is valid. + *) + DDCOLOR_BRIGHTNESS = $00000001; + {$EXTERNALSYM DDCOLOR_BRIGHTNESS} + +(* + * lContrast field is valid. + *) + DDCOLOR_CONTRAST = $00000002; + {$EXTERNALSYM DDCOLOR_CONTRAST} + +(* + * lHue field is valid. + *) + DDCOLOR_HUE = $00000004; + {$EXTERNALSYM DDCOLOR_HUE} + +(* + * lSaturation field is valid. + *) + DDCOLOR_SATURATION = $00000008; + {$EXTERNALSYM DDCOLOR_SATURATION} + +(* + * lSharpness field is valid. + *) + DDCOLOR_SHARPNESS = $00000010; + {$EXTERNALSYM DDCOLOR_SHARPNESS} + +(* + * lGamma field is valid. + *) + DDCOLOR_GAMMA = $00000020; + {$EXTERNALSYM DDCOLOR_GAMMA} + +(* + * lColorEnable field is valid. + *) + DDCOLOR_COLORENABLE = $00000040; + {$EXTERNALSYM DDCOLOR_COLORENABLE} + + + +(*============================================================================ + * + * Direct Draw Capability Flags + * + * These flags are used to describe the capabilities of a given Surface. + * All flags are bit flags. + * + *==========================================================================*) + +(**************************************************************************** + * + * DIRECTDRAWSURFACE CAPABILITY FLAGS + * + ****************************************************************************) +(* + * This bit currently has no meaning. + *) + DDSCAPS_RESERVED1 = $00000001; + {$EXTERNALSYM DDSCAPS_RESERVED1} + +(* + * Indicates that this surface contains alpha-only information. + * (To determine if a surface is RGBA/YUVA, the pixel format must be + * interrogated.) + *) + DDSCAPS_ALPHA = $00000002; + {$EXTERNALSYM DDSCAPS_ALPHA} + +(* + * Indicates that this surface is a backbuffer. It is generally + * set by CreateSurface when the DDSCAPS_FLIP capability bit is set. + * It indicates that this surface is THE back buffer of a surface + * flipping structure. DirectDraw supports N surfaces in a + * surface flipping structure. Only the surface that immediately + * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set. + * The other surfaces are identified as back buffers by the presence + * of the DDSCAPS_FLIP capability, their attachment order, and the + * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER + * capabilities. The bit is sent to CreateSurface when a standalone + * back buffer is being created. This surface could be attached to + * a front buffer and/or back buffers to form a flipping surface + * structure after the CreateSurface call. See AddAttachments for + * a detailed description of the behaviors in this case. + *) + DDSCAPS_BACKBUFFER = $00000004; + {$EXTERNALSYM DDSCAPS_BACKBUFFER} + +(* + * Indicates a complex surface structure is being described. A + * complex surface structure results in the creation of more than + * one surface. The additional surfaces are attached to the root + * surface. The complex structure can only be destroyed by + * destroying the root. + *) + DDSCAPS_COMPLEX = $00000008; + {$EXTERNALSYM DDSCAPS_COMPLEX} + +(* + * Indicates that this surface is a part of a surface flipping structure. + * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and + * DDSCAP_BACKBUFFER bits are not set. They are set by CreateSurface + * on the resulting creations. The dwBackBufferCount field in the + * TDDSurfaceDesc structure must be set to at least 1 in order for + * the CreateSurface call to succeed. The DDSCAPS_COMPLEX capability + * must always be set with creating multiple surfaces through CreateSurface. + *) + DDSCAPS_FLIP = $00000010; + {$EXTERNALSYM DDSCAPS_FLIP} + +(* + * Indicates that this surface is THE front buffer of a surface flipping + * structure. It is generally set by CreateSurface when the DDSCAPS_FLIP + * capability bit is set. + * If this capability is sent to CreateSurface then a standalonw front buffer + * is created. This surface will not have the DDSCAPS_FLIP capability. + * It can be attached to other back buffers to form a flipping structure. + * See AddAttachments for a detailed description of the behaviors in this + * case. + *) + DDSCAPS_FRONTBUFFER = $00000020; + {$EXTERNALSYM DDSCAPS_FRONTBUFFER} + +(* + * Indicates that this surface is any offscreen surface that is not an overlay, + * texture, zbuffer, front buffer, back buffer, or alpha surface. It is used + * to identify plain vanilla surfaces. + *) + DDSCAPS_OFFSCREENPLAIN = $00000040; + {$EXTERNALSYM DDSCAPS_OFFSCREENPLAIN} + +(* + * Indicates that this surface is an overlay. It may or may not be directly visible + * depending on whether or not it is currently being overlayed onto the primary + * surface. DDSCAPS_VISIBLE can be used to determine whether or not it is being + * overlayed at the moment. + *) + DDSCAPS_OVERLAY = $00000080; + {$EXTERNALSYM DDSCAPS_OVERLAY} + +(* + * Indicates that unique DirectDrawPalette objects can be created and + * attached to this surface. + *) + DDSCAPS_PALETTE = $00000100; + {$EXTERNALSYM DDSCAPS_PALETTE} + +(* + * Indicates that this surface is the primary surface. The primary + * surface represents what the user is seeing at the moment. + *) + DDSCAPS_PRIMARYSURFACE = $00000200; + {$EXTERNALSYM DDSCAPS_PRIMARYSURFACE} + +(* + * This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now + * obsolete. + *) + DDSCAPS_RESERVED3 = $00000400; + {$EXTERNALSYM DDSCAPS_RESERVED3} + DDSCAPS_PRIMARYSURFACELEFT = DDSCAPS_RESERVED3; + {$EXTERNALSYM DDSCAPS_PRIMARYSURFACELEFT} + +(* + * Indicates that this surface memory was allocated in system memory + *) + DDSCAPS_SYSTEMMEMORY = $00000800; + {$EXTERNALSYM DDSCAPS_SYSTEMMEMORY} + +(* + * Indicates that this surface can be used as a 3D texture. It does not + * indicate whether or not the surface is being used for that purpose. + *) + DDSCAPS_TEXTURE = $00001000; + {$EXTERNALSYM DDSCAPS_TEXTURE} + +(* + * Indicates that a surface may be a destination for 3D rendering. This + * bit must be set in order to query for a Direct3D Device Interface + * from this surface. + *) + DDSCAPS_3DDEVICE = $00002000; + {$EXTERNALSYM DDSCAPS_3DDEVICE} + +(* + * Indicates that this surface exists in video memory. + *) + DDSCAPS_VIDEOMEMORY = $00004000; + {$EXTERNALSYM DDSCAPS_VIDEOMEMORY} + +(* + * Indicates that changes made to this surface are immediately visible. + * It is always set for the primary surface and is set for overlays while + * they are being overlayed and texture maps while they are being textured. + *) + DDSCAPS_VISIBLE = $00008000; + {$EXTERNALSYM DDSCAPS_VISIBLE} + +(* + * Indicates that only writes are permitted to the surface. Read accesses + * from the surface may or may not generate a protection fault, but the + * results of a read from this surface will not be meaningful. READ ONLY. + *) + DDSCAPS_WRITEONLY = $00010000; + {$EXTERNALSYM DDSCAPS_WRITEONLY} + +(* + * Indicates that this surface is a z buffer. A z buffer does not contain + * displayable information. Instead it contains bit depth information that is + * used to determine which pixels are visible and which are obscured. + *) + DDSCAPS_ZBUFFER = $00020000; + {$EXTERNALSYM DDSCAPS_ZBUFFER} + +(* + * Indicates surface will have a DC associated long term + *) + DDSCAPS_OWNDC = $00040000; + {$EXTERNALSYM DDSCAPS_OWNDC} + +(* + * Indicates surface should be able to receive live video + *) + DDSCAPS_LIVEVIDEO = $00080000; + {$EXTERNALSYM DDSCAPS_LIVEVIDEO} + +(* + * Indicates surface should be able to have a stream decompressed + * to it by the hardware. + *) + DDSCAPS_HWCODEC = $00100000; + {$EXTERNALSYM DDSCAPS_HWCODEC} + +(* + * Surface is a ModeX surface. + * + *) + DDSCAPS_MODEX = $00200000; + {$EXTERNALSYM DDSCAPS_MODEX} + +(* + * Indicates surface is one level of a mip-map. This surface will + * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map. + * This can be done explicitly, by creating a number of surfaces and + * attaching them with AddAttachedSurface or by implicitly by CreateSurface. + * If this bit is set then DDSCAPS_TEXTURE must also be set. + *) + DDSCAPS_MIPMAP = $00400000; + {$EXTERNALSYM DDSCAPS_MIPMAP} + +(* + * This bit is reserved. It should not be specified. + *) + DDSCAPS_RESERVED2 = $00800000; + {$EXTERNALSYM DDSCAPS_RESERVED2} + +(* + * Indicates that memory for the surface is not allocated until the surface + * is loaded (via the Direct3D texture Load() function). + *) + DDSCAPS_ALLOCONLOAD = $04000000; + {$EXTERNALSYM DDSCAPS_ALLOCONLOAD} + +(* + * Indicates that the surface will recieve data from a video port. + *) + DDSCAPS_VIDEOPORT = $08000000; + {$EXTERNALSYM DDSCAPS_VIDEOPORT} + +(* + * Indicates that a video memory surface is resident in true, local video + * memory rather than non-local video memory. If this flag is specified then + * so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with + * DDSCAPS_NONLOCALVIDMEM. + *) + DDSCAPS_LOCALVIDMEM = $10000000; + {$EXTERNALSYM DDSCAPS_LOCALVIDMEM} + +(* + * Indicates that a video memory surface is resident in non-local video + * memory rather than true, local video memory. If this flag is specified + * then so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with + * DDSCAPS_LOCALVIDMEM. + *) + DDSCAPS_NONLOCALVIDMEM = $20000000; + {$EXTERNALSYM DDSCAPS_NONLOCALVIDMEM} + +(* + * Indicates that this surface is a standard VGA mode surface, and not a + * ModeX surface. (This flag will never be set in combination with the + * DDSCAPS_MODEX flag). + *) + DDSCAPS_STANDARDVGAMODE = $40000000; + {$EXTERNALSYM DDSCAPS_STANDARDVGAMODE} + +(* + * Indicates that this surface will be an optimized surface. This flag is + * currently only valid in conjunction with the DDSCAPS_TEXTURE flag. The surface + * will be created without any underlying video memory until loaded. + *) + DDSCAPS_OPTIMIZED = $80000000; + {$EXTERNALSYM DDSCAPS_OPTIMIZED} + + + +(* + * This bit is reserved + *) + DDSCAPS2_RESERVED4 = $00000002; + {$EXTERNALSYM DDSCAPS2_RESERVED4} + DDSCAPS2_HARDWAREDEINTERLACE = $00000000; + {$EXTERNALSYM DDSCAPS2_HARDWAREDEINTERLACE} + +(* + * Indicates to the driver that this surface will be locked very frequently + * (for procedural textures, dynamic lightmaps, etc). Surfaces with this cap + * set must also have DDSCAPS_TEXTURE. This cap cannot be used with + * DDSCAPS2_HINTSTATIC and DDSCAPS2_OPAQUE. + *) + DDSCAPS2_HINTDYNAMIC = $00000004; + {$EXTERNALSYM DDSCAPS2_HINTDYNAMIC} + +(* + * Indicates to the driver that this surface can be re-ordered/retiled on + * load. This operation will not change the size of the texture. It is + * relatively fast and symmetrical, since the application may lock these + * bits (although it will take a performance hit when doing so). Surfaces + * with this cap set must also have DDSCAPS_TEXTURE. This cap cannot be + * used with DDSCAPS2_HINTDYNAMIC and DDSCAPS2_OPAQUE. + *) + DDSCAPS2_HINTSTATIC = $00000008; + {$EXTERNALSYM DDSCAPS2_HINTSTATIC} + +(* + * Indicates that the client would like this texture surface to be managed by the + * DirectDraw/Direct3D runtime. Surfaces with this cap set must also have + * DDSCAPS_TEXTURE and DDSCAPS_SYSTEMMEMORY. + *) + DDSCAPS2_TEXTUREMANAGE = $00000010; + {$EXTERNALSYM DDSCAPS2_TEXTUREMANAGE} + +(* + * These bits are reserved for internal use *) + DDSCAPS2_RESERVED1 = $00000020; + {$EXTERNALSYM DDSCAPS2_RESERVED1} + DDSCAPS2_RESERVED2 = $00000040; + {$EXTERNALSYM DDSCAPS2_RESERVED2} + +(* + * Indicates to the driver that this surface will never be locked again. + * The driver is free to optimize this surface via retiling and actual compression. + * All calls to Lock() or Blts from this surface will fail. Surfaces with this + * cap set must also have DDSCAPS_TEXTURE. This cap cannot be used with + * DDSCAPS2_HINTDYNAMIC and DDSCAPS2_HINTSTATIC. + *) + DDSCAPS2_OPAQUE = $00000080; + {$EXTERNALSYM DDSCAPS2_OPAQUE} + +(* + * Applications should set this bit at CreateSurface time to indicate that they + * intend to use antialiasing. Only valid if DDSCAPS_3DDEVICE is also set. + *) + DDSCAPS2_HINTANTIALIASING = $00000100; + {$EXTERNALSYM DDSCAPS2_HINTANTIALIASING} + +(* + * This flag is used at CreateSurface time to indicate that this set of + * surfaces is a cubic environment map + *) + DDSCAPS2_CUBEMAP = $00000200; + {$EXTERNALSYM DDSCAPS2_CUBEMAP} + +(* + * These flags preform two functions: + * - At CreateSurface time, they define which of the six cube faces are + * required by the application. + * - After creation, each face in the cubemap will have exactly one of these + * bits set. + *) + DDSCAPS2_CUBEMAP_POSITIVEX = $00000400; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_POSITIVEX} + DDSCAPS2_CUBEMAP_NEGATIVEX = $00000800; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_NEGATIVEX} + DDSCAPS2_CUBEMAP_POSITIVEY = $00001000; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_POSITIVEY} + DDSCAPS2_CUBEMAP_NEGATIVEY = $00002000; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_NEGATIVEY} + DDSCAPS2_CUBEMAP_POSITIVEZ = $00004000; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_POSITIVEZ} + DDSCAPS2_CUBEMAP_NEGATIVEZ = $00008000; + {$EXTERNALSYM DDSCAPS2_CUBEMAP_NEGATIVEZ} + +(* + * This macro may be used to specify all faces of a cube map at CreateSurface time + *) + DDSCAPS2_CUBEMAP_ALLFACES = ( DDSCAPS2_CUBEMAP_POSITIVEX or + DDSCAPS2_CUBEMAP_NEGATIVEX or + DDSCAPS2_CUBEMAP_POSITIVEY or + DDSCAPS2_CUBEMAP_NEGATIVEY or + DDSCAPS2_CUBEMAP_POSITIVEZ or + DDSCAPS2_CUBEMAP_NEGATIVEZ ); + {$EXTERNALSYM DDSCAPS2_CUBEMAP_ALLFACES} + + +(* + * This flag is an additional flag which is present on mipmap sublevels from DX7 onwards + * It enables easier use of GetAttachedSurface rather than EnumAttachedSurfaces for surface + * constructs such as Cube Maps, wherein there are more than one mipmap surface attached + * to the root surface. + * This caps bit is ignored by CreateSurface + *) + DDSCAPS2_MIPMAPSUBLEVEL = $00010000; + {$EXTERNALSYM DDSCAPS2_MIPMAPSUBLEVEL} + +(* This flag indicates that the texture should be managed by D3D only *) + DDSCAPS2_D3DTEXTUREMANAGE = $00020000; + {$EXTERNALSYM DDSCAPS2_D3DTEXTUREMANAGE} + +(* This flag indicates that the managed surface can be safely lost *) + DDSCAPS2_DONOTPERSIST = $00040000; + {$EXTERNALSYM DDSCAPS2_DONOTPERSIST} + +(* indicates that this surface is part of a stereo flipping chain *) + DDSCAPS2_STEREOSURFACELEFT = $00080000; + {$EXTERNALSYM DDSCAPS2_STEREOSURFACELEFT} + + +(* + * Indicates that the surface is a volume. + * Can be combined with DDSCAPS_MIPMAP to indicate a multi-level volume + *) + DDSCAPS2_VOLUME = $00200000; + {$EXTERNALSYM DDSCAPS2_VOLUME} + +(* + * Indicates that the surface may be locked multiple times by the application. + * This cap cannot be used with DDSCAPS2_OPAQUE. + *) + DDSCAPS2_NOTUSERLOCKABLE = $00400000; + {$EXTERNALSYM DDSCAPS2_NOTUSERLOCKABLE} + +(* + * Indicates that the vertex buffer data can be used to render points and + * point sprites. + *) + DDSCAPS2_POINTS = $00800000; + {$EXTERNALSYM DDSCAPS2_POINTS} + +(* + * Indicates that the vertex buffer data can be used to render rt pactches. + *) + DDSCAPS2_RTPATCHES = $01000000; + {$EXTERNALSYM DDSCAPS2_RTPATCHES} + +(* + * Indicates that the vertex buffer data can be used to render n patches. + *) + DDSCAPS2_NPATCHES = $02000000; + {$EXTERNALSYM DDSCAPS2_NPATCHES} + +(* + * This bit is reserved for internal use + *) + DDSCAPS2_RESERVED3 = $04000000; + {$EXTERNALSYM DDSCAPS2_RESERVED3} + + +(* + * Indicates that the contents of the backbuffer do not have to be preserved + * the contents of the backbuffer after they are presented. + *) + DDSCAPS2_DISCARDBACKBUFFER = $10000000; + {$EXTERNALSYM DDSCAPS2_DISCARDBACKBUFFER} + +(* + * Indicates that all surfaces in this creation chain should be given an alpha channel. + * This flag will be set on primary surface chains that may have no explicit pixel format + * (and thus take on the format of the current display mode). + * The driver should infer that all these surfaces have a format having an alpha channel. + * (e.g. assume D3DFMT_A8R8G8B8 if the display mode is x888.) + *) + DDSCAPS2_ENABLEALPHACHANNEL = $20000000; + {$EXTERNALSYM DDSCAPS2_ENABLEALPHACHANNEL} + +(* + * Indicates that all surfaces in this creation chain is extended primary surface format. + * This flag will be set on extended primary surface chains that always have explicit pixel + * format and the pixel format is typically GDI (Graphics Device Interface) couldn't handle, + * thus only used with fullscreen application. (e.g. D3DFMT_A2R10G10B10 format) + *) + DDSCAPS2_EXTENDEDFORMATPRIMARY = $40000000; + {$EXTERNALSYM DDSCAPS2_EXTENDEDFORMATPRIMARY} + +(* + * Indicates that all surfaces in this creation chain is additional primary surface. + * This flag will be set on primary surface chains which must present on the adapter + * id provided on dwCaps4. Typically this will be used to create secondary primary surface + * on DualView display adapter. + *) + DDSCAPS2_ADDITIONALPRIMARY = $80000000; + {$EXTERNALSYM DDSCAPS2_ADDITIONALPRIMARY} + +(* + * This is a mask that indicates the set of bits that may be set + * at createsurface time to indicate number of samples per pixel + * when multisampling + *) + DDSCAPS3_MULTISAMPLE_MASK = $0000001F; + {$EXTERNALSYM DDSCAPS3_MULTISAMPLE_MASK} + +(* + * This is a mask that indicates the set of bits that may be set + * at createsurface time to indicate the quality level of rendering + * for the current number of samples per pixel + *) + DDSCAPS3_MULTISAMPLE_QUALITY_MASK = $000000E0; + {$EXTERNALSYM DDSCAPS3_MULTISAMPLE_QUALITY_MASK} + DDSCAPS3_MULTISAMPLE_QUALITY_SHIFT = 5; + {$EXTERNALSYM DDSCAPS3_MULTISAMPLE_QUALITY_SHIFT} + +(* + * This bit is reserved for internal use + *) + DDSCAPS3_RESERVED1 = $00000100; + {$EXTERNALSYM DDSCAPS3_RESERVED1} + +(* + * This bit is reserved for internal use + *) + DDSCAPS3_RESERVED2 = $00000200; + {$EXTERNALSYM DDSCAPS3_RESERVED2} + +(* + * This indicates whether this surface has light-weight miplevels + *) + DDSCAPS3_LIGHTWEIGHTMIPMAP = $00000400; + {$EXTERNALSYM DDSCAPS3_LIGHTWEIGHTMIPMAP} + +(* + * This indicates that the mipsublevels for this surface are auto-generated + *) + DDSCAPS3_AUTOGENMIPMAP = $00000800; + {$EXTERNALSYM DDSCAPS3_AUTOGENMIPMAP} + +(* + * This indicates that the mipsublevels for this surface are auto-generated + *) + DDSCAPS3_DMAP = $00001000; + {$EXTERNALSYM DDSCAPS3_DMAP} + + + (**************************************************************************** + * + * DIRECTDRAW DRIVER CAPABILITY FLAGS + * + ****************************************************************************) + +(* + * Display hardware has 3D acceleration. + *) + DDCAPS_3D = $00000001; + {$EXTERNALSYM DDCAPS_3D} + +(* + * Indicates that DirectDraw will support only dest rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively. + * READ ONLY. + *) + DDCAPS_ALIGNBOUNDARYDEST = $00000002; + {$EXTERNALSYM DDCAPS_ALIGNBOUNDARYDEST} + +(* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively. READ ONLY. + *) + DDCAPS_ALIGNSIZEDEST = $00000004; + {$EXTERNALSYM DDCAPS_ALIGNSIZEDEST} +(* + * Indicates that DirectDraw will support only source rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively. + * READ ONLY. + *) + DDCAPS_ALIGNBOUNDARYSRC = $00000008; + {$EXTERNALSYM DDCAPS_ALIGNBOUNDARYSRC} + +(* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively. READ ONLY. + *) + DDCAPS_ALIGNSIZESRC = $00000010; + {$EXTERNALSYM DDCAPS_ALIGNSIZESRC} + +(* + * Indicates that DirectDraw will create video memory surfaces that have a stride + * alignment equal to DIRECTDRAWCAPS.dwAlignStride. READ ONLY. + *) + DDCAPS_ALIGNSTRIDE = $00000020; + {$EXTERNALSYM DDCAPS_ALIGNSTRIDE} + +(* + * Display hardware is capable of blt operations. + *) + DDCAPS_BLT = $00000040; + {$EXTERNALSYM DDCAPS_BLT} + +(* + * Display hardware is capable of asynchronous blt operations. + *) + DDCAPS_BLTQUEUE = $00000080; + {$EXTERNALSYM DDCAPS_BLTQUEUE} + +(* + * Display hardware is capable of color space conversions during the blt operation. + *) + DDCAPS_BLTFOURCC = $00000100; + {$EXTERNALSYM DDCAPS_BLTFOURCC} + +(* + * Display hardware is capable of stretching during blt operations. + *) + DDCAPS_BLTSTRETCH = $00000200; + {$EXTERNALSYM DDCAPS_BLTSTRETCH} + +(* + * Display hardware is shared with GDI. + *) + DDCAPS_GDI = $00000400; + {$EXTERNALSYM DDCAPS_GDI} + +(* + * Display hardware can overlay. + *) + DDCAPS_OVERLAY = $00000800; + {$EXTERNALSYM DDCAPS_OVERLAY} + +(* + * Set if display hardware supports overlays but can not clip them. + *) + DDCAPS_OVERLAYCANTCLIP = $00001000; + {$EXTERNALSYM DDCAPS_OVERLAYCANTCLIP} + +(* + * Indicates that overlay hardware is capable of color space conversions during + * the overlay operation. + *) + DDCAPS_OVERLAYFOURCC = $00002000; + {$EXTERNALSYM DDCAPS_OVERLAYFOURCC} + +(* + * Indicates that stretching can be done by the overlay hardware. + *) + DDCAPS_OVERLAYSTRETCH = $00004000; + {$EXTERNALSYM DDCAPS_OVERLAYSTRETCH} + +(* + * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces + * other than the primary surface. + *) + DDCAPS_PALETTE = $00008000; + {$EXTERNALSYM DDCAPS_PALETTE} + +(* + * Indicates that palette changes can be syncd with the veritcal refresh. + *) + DDCAPS_PALETTEVSYNC = $00010000; + {$EXTERNALSYM DDCAPS_PALETTEVSYNC} + +(* + * Display hardware can return the current scan line. + *) + DDCAPS_READSCANLINE = $00020000; + {$EXTERNALSYM DDCAPS_READSCANLINE} + +(* + * This flag used to bo DDCAPS_STEREOVIEW, which is now obsolete + *) + DDCAPS_RESERVED1 = $00040000; + {$EXTERNALSYM DDCAPS_RESERVED1} + +(* + * Display hardware is capable of generating a vertical blank interrupt. + *) + DDCAPS_VBI = $00080000; + {$EXTERNALSYM DDCAPS_VBI} + +(* + * Supports the use of z buffers with blt operations. + *) + DDCAPS_ZBLTS = $00100000; + {$EXTERNALSYM DDCAPS_ZBLTS} + +(* + * Supports Z Ordering of overlays. + *) + DDCAPS_ZOVERLAYS = $00200000; + {$EXTERNALSYM DDCAPS_ZOVERLAYS} + +(* + * Supports color key + *) + DDCAPS_COLORKEY = $00400000; + {$EXTERNALSYM DDCAPS_COLORKEY} + +(* + * Supports alpha surfaces + *) + DDCAPS_ALPHA = $00800000; + {$EXTERNALSYM DDCAPS_ALPHA} + +(* + * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set) + *) + DDCAPS_COLORKEYHWASSIST = $01000000; + {$EXTERNALSYM DDCAPS_COLORKEYHWASSIST} + +(* + * no hardware support at all + *) + DDCAPS_NOHARDWARE = $02000000; + {$EXTERNALSYM DDCAPS_NOHARDWARE} + +(* + * Display hardware is capable of color fill with bltter + *) + DDCAPS_BLTCOLORFILL = $04000000; + {$EXTERNALSYM DDCAPS_BLTCOLORFILL} + +(* + * Display hardware is bank switched, and potentially very slow at + * random access to VRAM. + *) + DDCAPS_BANKSWITCHED = $08000000; + {$EXTERNALSYM DDCAPS_BANKSWITCHED} + +(* + * Display hardware is capable of depth filling Z-buffers with bltter + *) + DDCAPS_BLTDEPTHFILL = $10000000; + {$EXTERNALSYM DDCAPS_BLTDEPTHFILL} + +(* + * Display hardware is capable of clipping while bltting. + *) + DDCAPS_CANCLIP = $20000000; + {$EXTERNALSYM DDCAPS_CANCLIP} + +(* + * Display hardware is capable of clipping while stretch bltting. + *) + DDCAPS_CANCLIPSTRETCHED = $40000000; + {$EXTERNALSYM DDCAPS_CANCLIPSTRETCHED} + +(* + * Display hardware is capable of bltting to or from system memory + *) + DDCAPS_CANBLTSYSMEM = $80000000; + {$EXTERNALSYM DDCAPS_CANBLTSYSMEM} + + + (**************************************************************************** + * + * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2) + * + ****************************************************************************) + +(* + * Display hardware is certified + *) + DDCAPS2_CERTIFIED = $00000001; + {$EXTERNALSYM DDCAPS2_CERTIFIED} + +(* + * Driver cannot interleave 2D operations (lock and blt) to surfaces with + * Direct3D rendering operations between calls to BeginScene() and EndScene() + *) + DDCAPS2_NO2DDURING3DSCENE = $00000002; + {$EXTERNALSYM DDCAPS2_NO2DDURING3DSCENE} + +(* + * Display hardware contains a video port + *) + DDCAPS2_VIDEOPORT = $00000004; + {$EXTERNALSYM DDCAPS2_VIDEOPORT} + +(* + * The overlay can be automatically flipped according to the video port + * VSYNCs, providing automatic doubled buffered display of video port + * data using an overlay + *) + DDCAPS2_AUTOFLIPOVERLAY = $00000008; + {$EXTERNALSYM DDCAPS2_AUTOFLIPOVERLAY} + +(* + * Overlay can display each field of interlaced data individually while + * it is interleaved in memory without causing jittery artifacts. + *) + DDCAPS2_CANBOBINTERLEAVED = $00000010; + {$EXTERNALSYM DDCAPS2_CANBOBINTERLEAVED} + +(* + * Overlay can display each field of interlaced data individually while + * it is not interleaved in memory without causing jittery artifacts. + *) + DDCAPS2_CANBOBNONINTERLEAVED = $00000020; + {$EXTERNALSYM DDCAPS2_CANBOBNONINTERLEAVED} + +(* + * The overlay surface contains color controls (brightness, sharpness, etc.) + *) + DDCAPS2_COLORCONTROLOVERLAY = $00000040; + {$EXTERNALSYM DDCAPS2_COLORCONTROLOVERLAY} + +(* + * The primary surface contains color controls (gamma, etc.) + *) + DDCAPS2_COLORCONTROLPRIMARY = $00000080; + {$EXTERNALSYM DDCAPS2_COLORCONTROLPRIMARY} + +(* + * RGBZ -> RGB supported for 16:16 RGB:Z + *) + DDCAPS2_CANDROPZ16BIT = $00000100; + {$EXTERNALSYM DDCAPS2_CANDROPZ16BIT} + +(* + * Driver supports non-local video memory. + *) + DDCAPS2_NONLOCALVIDMEM = $00000200; + {$EXTERNALSYM DDCAPS2_NONLOCALVIDMEM} + +(* + * Dirver supports non-local video memory but has different capabilities for + * non-local video memory surfaces. If this bit is set then so must + * DDCAPS2_NONLOCALVIDMEM. + *) + DDCAPS2_NONLOCALVIDMEMCAPS = $00000400; + {$EXTERNALSYM DDCAPS2_NONLOCALVIDMEMCAPS} + +(* + * Driver neither requires nor prefers surfaces to be pagelocked when performing + * blts involving system memory surfaces + *) + DDCAPS2_NOPAGELOCKREQUIRED = $00000800; + {$EXTERNALSYM DDCAPS2_NOPAGELOCKREQUIRED} + +(* + * Driver can create surfaces which are wider than the primary surface + *) + DDCAPS2_WIDESURFACES = $00001000; + {$EXTERNALSYM DDCAPS2_WIDESURFACES} + +(* + * Driver supports bob without using a video port by handling the + * DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip. + *) + DDCAPS2_CANFLIPODDEVEN = $00002000; + {$EXTERNALSYM DDCAPS2_CANFLIPODDEVEN} + +(* + * Driver supports bob using hardware + *) + DDCAPS2_CANBOBHARDWARE = $00004000; + {$EXTERNALSYM DDCAPS2_CANBOBHARDWARE} + +(* + * Driver supports bltting any FOURCC surface to another surface of the same FOURCC + *) + DDCAPS2_COPYFOURCC = $00008000; + {$EXTERNALSYM DDCAPS2_COPYFOURCC} + + +(* + * Driver supports loadable gamma ramps for the primary surface + *) + DDCAPS2_PRIMARYGAMMA = $00020000; + {$EXTERNALSYM DDCAPS2_PRIMARYGAMMA} + +(* + * Driver can render in windowed mode. + *) + DDCAPS2_CANRENDERWINDOWED = $00080000; + {$EXTERNALSYM DDCAPS2_CANRENDERWINDOWED} + +(* + * A calibrator is available to adjust the gamma ramp according to the + * physical display properties so that the result will be identical on + * all calibrated systems. + *) + DDCAPS2_CANCALIBRATEGAMMA = $00100000; + {$EXTERNALSYM DDCAPS2_CANCALIBRATEGAMMA} + +(* + * Indicates that the driver will respond to DDFLIP_INTERVALn flags + *) + DDCAPS2_FLIPINTERVAL = $00200000; + {$EXTERNALSYM DDCAPS2_FLIPINTERVAL} + +(* + * Indicates that the driver will respond to DDFLIP_NOVSYNC + *) + DDCAPS2_FLIPNOVSYNC = $00400000; + {$EXTERNALSYM DDCAPS2_FLIPNOVSYNC} + +(* + * Driver supports management of video memory, if this flag is ON, + * driver manages the texture if requested with DDSCAPS2_TEXTUREMANAGE on + * DirectX manages the texture if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on + *) + DDCAPS2_CANMANAGETEXTURE = $00800000; + {$EXTERNALSYM DDCAPS2_CANMANAGETEXTURE} + +(* + * The Direct3D texture manager uses this cap to decide whether to put managed + * surfaces in non-local video memory. If the cap is set, the texture manager will + * put managed surfaces in non-local vidmem. Drivers that cannot texture from + * local vidmem SHOULD NOT set this cap. + *) + DDCAPS2_TEXMANINNONLOCALVIDMEM = $01000000; + {$EXTERNALSYM DDCAPS2_TEXMANINNONLOCALVIDMEM} + +(* + * Indicates that the driver supports DX7 type of stereo in at least one mode (which may + * not necessarily be the current mode). Applications should use IDirectDraw7 (or higher) + * ::EnumDisplayModes and check the DDSURFACEDESC.ddsCaps.dwCaps2 field for the presence of + * DDSCAPS2_STEREOSURFACELEFT to check if a particular mode supports stereo. The application + * can also use IDirectDraw7(or higher)::GetDisplayMode to check the current mode. + *) + DDCAPS2_STEREO = $02000000; + {$EXTERNALSYM DDCAPS2_STEREO} + +(* + * This caps bit is intended for internal DirectDraw use. + * -It is only valid if DDCAPS2_NONLOCALVIDMEMCAPS is set. + * -If this bit is set, then DDCAPS_CANBLTSYSMEM MUST be set by the driver (and + * all the assoicated system memory blt caps must be correct). + * -It implies that the system->video blt caps in DDCAPS also apply to system to + * nonlocal blts. I.e. the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops + * members of DDCAPS (DDCORECAPS) are filled in correctly. + * -Any blt from system to nonlocal memory that matches these caps bits will + * be passed to the driver. + * + * NOTE: This is intended to enable the driver itself to do efficient reordering + * of textures. This is NOT meant to imply that hardware can write into AGP memory. + * This operation is not currently supported. + *) + DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL = $04000000; + {$EXTERNALSYM DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL} + +(* + * was DDCAPS2_PUREHAL + *) + DDCAPS2_RESERVED1 = $08000000; + {$EXTERNALSYM DDCAPS2_RESERVED1} + +(* + * Driver supports management of video memory, if this flag is ON, + * driver manages the resource if requested with DDSCAPS2_TEXTUREMANAGE on + * DirectX manages the resource if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on + *) + DDCAPS2_CANMANAGERESOURCE = $10000000; + {$EXTERNALSYM DDCAPS2_CANMANAGERESOURCE} + +(* + * Driver supports dynamic textures. This will allow the application to set + * D3DUSAGE_DYNAMIC (DDSCAPS2_HINTDYNAMIC for drivers) at texture create time. + * Video memory dynamic textures WILL be lockable by applications. It is + * expected that these locks will be very efficient (which implies that the + * driver should always maintain a linear copy, a pointer to which can be + * quickly handed out to the application). + *) + DDCAPS2_DYNAMICTEXTURES = $20000000; + {$EXTERNALSYM DDCAPS2_DYNAMICTEXTURES} + +(* + * Driver supports auto-generation of mipmaps. + *) + DDCAPS2_CANAUTOGENMIPMAP = $40000000; + {$EXTERNALSYM DDCAPS2_CANAUTOGENMIPMAP} + + +(**************************************************************************** + * + * DIRECTDRAW FX ALPHA CAPABILITY FLAGS + * + ****************************************************************************) + +(* + * Supports alpha blending around the edge of a source color keyed surface. + * For Blt. + *) + DDFXALPHACAPS_BLTALPHAEDGEBLEND = $00000001; + {$EXTERNALSYM DDFXALPHACAPS_BLTALPHAEDGEBLEND} + +(* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) + * For Blt. + *) + DDFXALPHACAPS_BLTALPHAPIXELS = $00000002; + {$EXTERNALSYM DDFXALPHACAPS_BLTALPHAPIXELS} + +(* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) + * This flag can only be set if DDCAPS_ALPHA is set. + * For Blt. + *) + DDFXALPHACAPS_BLTALPHAPIXELSNEG = $00000004; + {$EXTERNALSYM DDFXALPHACAPS_BLTALPHAPIXELSNEG} + +(* + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * (0 is transparent.) + * For Blt. + *) + DDFXALPHACAPS_BLTALPHASURFACES = $00000008; + {$EXTERNALSYM DDFXALPHACAPS_BLTALPHASURFACES} + +(* + * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The NEG suffix indicates that this alpha channel becomes more transparent + * as the alpha value increases. (0 is opaque.) This flag can only be set if + * DDCAPS_ALPHA is set. + * For Blt. + *) + DDFXALPHACAPS_BLTALPHASURFACESNEG = $00000010; + {$EXTERNALSYM DDFXALPHACAPS_BLTALPHASURFACESNEG} + +(* + * Supports alpha blending around the edge of a source color keyed surface. + * For Overlays. + *) + DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND = $00000020; + {$EXTERNALSYM DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND} + +(* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) + * For Overlays. + *) + DDFXALPHACAPS_OVERLAYALPHAPIXELS = $00000040; + {$EXTERNALSYM DDFXALPHACAPS_OVERLAYALPHAPIXELS} + +(* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) + * This flag can only be set if DDCAPS_ALPHA is set. + * For Overlays. + *) + DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG = $00000080; + {$EXTERNALSYM DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG} + +(* + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * (0 is transparent.) + * For Overlays. + *) + DDFXALPHACAPS_OVERLAYALPHASURFACES = $00000100; + {$EXTERNALSYM DDFXALPHACAPS_OVERLAYALPHASURFACES} + +(* + * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The NEG suffix indicates that this alpha channel becomes more transparent + * as the alpha value increases. (0 is opaque.) This flag can only be set if + * DDCAPS_ALPHA is set. + * For Overlays. + *) + DDFXALPHACAPS_OVERLAYALPHASURFACESNEG = $00000200; + {$EXTERNALSYM DDFXALPHACAPS_OVERLAYALPHASURFACESNEG} + +(**************************************************************************** + * + * DIRECTDRAW FX CAPABILITY FLAGS + * + ****************************************************************************) + +(* + * Uses arithmetic operations to stretch and shrink surfaces during blt + * rather than pixel doubling techniques. Along the Y axis. + *) + DDFXCAPS_BLTARITHSTRETCHY = $00000020; + {$EXTERNALSYM DDFXCAPS_BLTARITHSTRETCHY} + +(* + * Uses arithmetic operations to stretch during blt + * rather than pixel doubling techniques. Along the Y axis. Only + * works for x1, x2, etc. + *) + DDFXCAPS_BLTARITHSTRETCHYN = $00000010; + {$EXTERNALSYM DDFXCAPS_BLTARITHSTRETCHYN} + +(* + * Supports mirroring left to right in blt. + *) + DDFXCAPS_BLTMIRRORLEFTRIGHT = $00000040; + {$EXTERNALSYM DDFXCAPS_BLTMIRRORLEFTRIGHT} + +(* + * Supports mirroring top to bottom in blt. + *) + DDFXCAPS_BLTMIRRORUPDOWN = $00000080; + {$EXTERNALSYM DDFXCAPS_BLTMIRRORUPDOWN} + +(* + * Supports arbitrary rotation for blts. + *) + DDFXCAPS_BLTROTATION = $00000100; + {$EXTERNALSYM DDFXCAPS_BLTROTATION} + +(* + * Supports 90 degree rotations for blts. + *) + DDFXCAPS_BLTROTATION90 = $00000200; + {$EXTERNALSYM DDFXCAPS_BLTROTATION90} + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSHRINKX = $00000400; + {$EXTERNALSYM DDFXCAPS_BLTSHRINKX} + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSHRINKXN = $00000800; + {$EXTERNALSYM DDFXCAPS_BLTSHRINKXN} + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSHRINKY = $00001000; + {$EXTERNALSYM DDFXCAPS_BLTSHRINKY} + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + *) + DDFXCAPS_BLTSHRINKYN = $00002000; + {$EXTERNALSYM DDFXCAPS_BLTSHRINKYN} + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSTRETCHX = $00004000; + {$EXTERNALSYM DDFXCAPS_BLTSTRETCHX} + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSTRETCHXN = $00008000; + {$EXTERNALSYM DDFXCAPS_BLTSTRETCHXN} + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSTRETCHY = $00010000; + {$EXTERNALSYM DDFXCAPS_BLTSTRETCHY} + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + *) + DDFXCAPS_BLTSTRETCHYN = $00020000; + {$EXTERNALSYM DDFXCAPS_BLTSTRETCHYN} + +(* + * Uses arithmetic operations to stretch and shrink surfaces during + * overlay rather than pixel doubling techniques. Along the Y axis + * for overlays. + *) + DDFXCAPS_OVERLAYARITHSTRETCHY = $00040000; + {$EXTERNALSYM DDFXCAPS_OVERLAYARITHSTRETCHY} + +(* + * Uses arithmetic operations to stretch surfaces during + * overlay rather than pixel doubling techniques. Along the Y axis + * for overlays. Only works for x1, x2, etc. + *) + DDFXCAPS_OVERLAYARITHSTRETCHYN = $00000008; + {$EXTERNALSYM DDFXCAPS_OVERLAYARITHSTRETCHYN} + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKX = $00080000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSHRINKX} + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKXN = $00100000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSHRINKXN} + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKY = $00200000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSHRINKY} + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKYN = $00400000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSHRINKYN} + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHX = $00800000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSTRETCHX} + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHXN = $01000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSTRETCHXN} + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHY = $02000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSTRETCHY} + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHYN = $04000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYSTRETCHYN} + +(* + * DirectDraw supports mirroring of overlays across the vertical axis + *) + DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYMIRRORLEFTRIGHT} + +(* + * DirectDraw supports mirroring of overlays across the horizontal axis + *) + DDFXCAPS_OVERLAYMIRRORUPDOWN = $10000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYMIRRORUPDOWN} + +(* + * DirectDraw supports deinterlacing of overlay surfaces + *) + DDFXCAPS_OVERLAYDEINTERLACE = $20000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYDEINTERLACE} + + +(* + * Driver can do alpha blending for blits. + *) + DDFXCAPS_BLTALPHA = $00000001; + {$EXTERNALSYM DDFXCAPS_BLTALPHA} + +(* + * Driver can do geometric transformations (or warps) for blits. + *) + DDFXCAPS_BLTTRANSFORM = $00000002; + {$EXTERNALSYM DDFXCAPS_BLTTRANSFORM} + +(* + * Driver can do surface-reconstruction filtering for warped blits. + *) + DDFXCAPS_BLTFILTER = DDFXCAPS_BLTARITHSTRETCHY; + {$EXTERNALSYM DDFXCAPS_BLTFILTER} + +(* + * Driver can do alpha blending for overlays. + *) + DDFXCAPS_OVERLAYALPHA = $00000004; + {$EXTERNALSYM DDFXCAPS_OVERLAYALPHA} + +(* + * Driver can do geometric transformations (or warps) for overlays. + *) + DDFXCAPS_OVERLAYTRANSFORM = $20000000; + {$EXTERNALSYM DDFXCAPS_OVERLAYTRANSFORM} + +(* + * Driver can do surface-reconstruction filtering for warped overlays. + *) + DDFXCAPS_OVERLAYFILTER = DDFXCAPS_OVERLAYARITHSTRETCHY; + {$EXTERNALSYM DDFXCAPS_OVERLAYFILTER} + +(**************************************************************************** + * + * DIRECTDRAW STEREO VIEW CAPABILITIES + * + ****************************************************************************) + +(* + * This flag used to be DDSVCAPS_ENIGMA, which is now obsolete + *) + DDSVCAPS_RESERVED1 = $00000001; + {$EXTERNALSYM DDSVCAPS_RESERVED1} + +(* + * This flag used to be DDSVCAPS_FLICKER, which is now obsolete + *) + DDSVCAPS_RESERVED2 = $00000002; + {$EXTERNALSYM DDSVCAPS_RESERVED2} + +(* + * This flag used to be DDSVCAPS_REDBLUE, which is now obsolete + *) + DDSVCAPS_RESERVED3 = $00000004; + {$EXTERNALSYM DDSVCAPS_RESERVED3} + +(* + * This flag used to be DDSVCAPS_SPLIT, which is now obsolete + *) + DDSVCAPS_RESERVED4 = $00000008; + {$EXTERNALSYM DDSVCAPS_RESERVED4} + +(* + * The stereo view is accomplished with switching technology + *) + DDSVCAPS_STEREOSEQUENTIAL = $00000010; + {$EXTERNALSYM DDSVCAPS_STEREOSEQUENTIAL} + +(**************************************************************************** + * + * DIRECTDRAWPALETTE CAPABILITIES + * + ****************************************************************************) + +(* + * Index is 4 bits. There are sixteen color entries in the palette table. + *) + DDPCAPS_4BIT = $00000001; + {$EXTERNALSYM DDPCAPS_4BIT} + +(* + * Index is onto a 8 bit color index. This field is only valid with the + * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target + * surface is in 8bpp. Each color entry is one byte long and is an index + * into destination surface's 8bpp palette. + *) + DDPCAPS_8BITENTRIES = $00000002; + {$EXTERNALSYM DDPCAPS_8BITENTRIES} + +(* + * Index is 8 bits. There are 256 color entries in the palette table. + *) + DDPCAPS_8BIT = $00000004; + {$EXTERNALSYM DDPCAPS_8BIT} + +(* + * Indicates that this DIRECTDRAWPALETTE should use the palette color array + * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE + * object. + * This flag is obsolete. DirectDraw always initializes the color array from + * the lpDDColorArray parameter. The definition remains for source-level + * compatibility. + *) + DDPCAPS_INITIALIZE = $00000008; + {$EXTERNALSYM DDPCAPS_INITIALIZE} + +(* + * This palette is the one attached to the primary surface. Changing this + * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified + * and supported. + *) + DDPCAPS_PRIMARYSURFACE = $00000010; + {$EXTERNALSYM DDPCAPS_PRIMARYSURFACE} + +(* + * This palette is the one attached to the primary surface left. Changing + * this table has immediate effect on the display for the left eye unless + * DDPSETPAL_VSYNC is specified and supported. + *) + DDPCAPS_PRIMARYSURFACELEFT = $00000020; + {$EXTERNALSYM DDPCAPS_PRIMARYSURFACELEFT} + +(* + * This palette can have all 256 entries defined + *) + DDPCAPS_ALLOW256 = $00000040; + {$EXTERNALSYM DDPCAPS_ALLOW256} + +(* + * This palette can have modifications to it synced with the monitors + * refresh rate. + *) + DDPCAPS_VSYNC = $00000080; + {$EXTERNALSYM DDPCAPS_VSYNC} + +(* + * Index is 1 bit. There are two color entries in the palette table. + *) + DDPCAPS_1BIT = $00000100; + {$EXTERNALSYM DDPCAPS_1BIT} + +(* + * Index is 2 bit. There are four color entries in the palette table. + *) + DDPCAPS_2BIT = $00000200; + {$EXTERNALSYM DDPCAPS_2BIT} + +(* + * The peFlags member of PALETTEENTRY denotes an 8 bit alpha value + *) + DDPCAPS_ALPHA = $00000400; + {$EXTERNALSYM DDPCAPS_ALPHA} + + +(**************************************************************************** + * + * DIRECTDRAWPALETTE SETENTRY CONSTANTS + * + ****************************************************************************) + + +(**************************************************************************** + * + * DIRECTDRAWPALETTE GETENTRY CONSTANTS + * + ****************************************************************************) + +(* 0 is the only legal value *) + +(**************************************************************************** + * + * DIRECTDRAWSURFACE SETPRIVATEDATA CONSTANTS + * + ****************************************************************************) + +(* + * The passed pointer is an IUnknown ptr. The cbData argument to SetPrivateData + * must be set to SizeOf(IUnknown^). DirectDraw will call AddRef through this + * pointer and Release when the private data is destroyed. This includes when + * the surface or palette is destroyed before such priovate data is destroyed. + *) + DDSPD_IUNKNOWNPOINTER = $00000001; + {$EXTERNALSYM DDSPD_IUNKNOWNPOINTER} + +(* + * Private data is only valid for the current state of the object, + * as determined by the uniqueness value. + *) + DDSPD_VOLATILE = $00000002; + {$EXTERNALSYM DDSPD_VOLATILE} + + +(**************************************************************************** + * + * DIRECTDRAWSURFACE SETPALETTE CONSTANTS + * + ****************************************************************************) + + +(**************************************************************************** + * + * DIRECTDRAW BITDEPTH CONSTANTS + * + * NOTE: These are only used to indicate supported bit depths. These + * are flags only, they are not to be used as an actual bit depth. The + * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual + * bit depths in a surface or for changing the display mode. + * + ****************************************************************************) + +(* + * 1 bit per pixel. + *) + DDBD_1 = $00004000; + {$EXTERNALSYM DDBD_1} + +(* + * 2 bits per pixel. + *) + DDBD_2 = $00002000; + {$EXTERNALSYM DDBD_2} + +(* + * 4 bits per pixel. + *) + DDBD_4 = $00001000; + {$EXTERNALSYM DDBD_4} + +(* + * 8 bits per pixel. + *) + DDBD_8 = $00000800; + {$EXTERNALSYM DDBD_8} + +(* + * 16 bits per pixel. + *) + DDBD_16 = $00000400; + {$EXTERNALSYM DDBD_16} + +(* + * 24 bits per pixel. + *) + DDBD_24 = $00000200; + {$EXTERNALSYM DDBD_24} + +(* + * 32 bits per pixel. + *) + DDBD_32 = $00000100; + {$EXTERNALSYM DDBD_32} + +(**************************************************************************** + * + * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS + * + ****************************************************************************) + +(* + * Set if the structure contains a color space. Not set if the structure + * contains a single color key. + *) + DDCKEY_COLORSPACE = $00000001; + {$EXTERNALSYM DDCKEY_COLORSPACE} + +(* + * Set if the structure specifies a color key or color space which is to be + * used as a destination color key for blt operations. + *) + DDCKEY_DESTBLT = $00000002; + {$EXTERNALSYM DDCKEY_DESTBLT} + +(* + * Set if the structure specifies a color key or color space which is to be + * used as a destination color key for overlay operations. + *) + DDCKEY_DESTOVERLAY = $00000004; + {$EXTERNALSYM DDCKEY_DESTOVERLAY} + +(* + * Set if the structure specifies a color key or color space which is to be + * used as a source color key for blt operations. + *) + DDCKEY_SRCBLT = $00000008; + {$EXTERNALSYM DDCKEY_SRCBLT} + +(* + * Set if the structure specifies a color key or color space which is to be + * used as a source color key for overlay operations. + *) + DDCKEY_SRCOVERLAY = $00000010; + {$EXTERNALSYM DDCKEY_SRCOVERLAY} + + +(**************************************************************************** + * + * DIRECTDRAW COLOR KEY CAPABILITY FLAGS + * + ****************************************************************************) + +(* + * Supports transparent blting using a color key to identify the replaceable + * bits of the destination surface for RGB colors. + *) + DDCKEYCAPS_DESTBLT = $00000001; + {$EXTERNALSYM DDCKEYCAPS_DESTBLT} + +(* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for RGB colors. + *) + DDCKEYCAPS_DESTBLTCLRSPACE = $00000002; + {$EXTERNALSYM DDCKEYCAPS_DESTBLTCLRSPACE} + +(* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for YUV colors. + *) + DDCKEYCAPS_DESTBLTCLRSPACEYUV = $00000004; + {$EXTERNALSYM DDCKEYCAPS_DESTBLTCLRSPACEYUV} + +(* + * Supports transparent blting using a color key to identify the replaceable + * bits of the destination surface for YUV colors. + *) + DDCKEYCAPS_DESTBLTYUV = $00000008; + {$EXTERNALSYM DDCKEYCAPS_DESTBLTYUV} + +(* + * Supports overlaying using colorkeying of the replaceable bits of the surface + * being overlayed for RGB colors. + *) + DDCKEYCAPS_DESTOVERLAY = $00000010; + {$EXTERNALSYM DDCKEYCAPS_DESTOVERLAY} + +(* + * Supports a color space as the color key for the destination for RGB colors. + *) + DDCKEYCAPS_DESTOVERLAYCLRSPACE = $00000020; + {$EXTERNALSYM DDCKEYCAPS_DESTOVERLAYCLRSPACE} + +(* + * Supports a color space as the color key for the destination for YUV colors. + *) + DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV = $00000040; + {$EXTERNALSYM DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV} + +(* + * Supports only one active destination color key value for visible overlay + * surfaces. + *) + DDCKEYCAPS_DESTOVERLAYONEACTIVE = $00000080; + {$EXTERNALSYM DDCKEYCAPS_DESTOVERLAYONEACTIVE} + +(* + * Supports overlaying using colorkeying of the replaceable bits of the + * surface being overlayed for YUV colors. + *) + DDCKEYCAPS_DESTOVERLAYYUV = $00000100; + {$EXTERNALSYM DDCKEYCAPS_DESTOVERLAYYUV} + +(* + * Supports transparent blting using the color key for the source with + * this surface for RGB colors. + *) + DDCKEYCAPS_SRCBLT = $00000200; + {$EXTERNALSYM DDCKEYCAPS_SRCBLT} + +(* + * Supports transparent blting using a color space for the source with + * this surface for RGB colors. + *) + DDCKEYCAPS_SRCBLTCLRSPACE = $00000400; + {$EXTERNALSYM DDCKEYCAPS_SRCBLTCLRSPACE} + +(* + * Supports transparent blting using a color space for the source with + * this surface for YUV colors. + *) + DDCKEYCAPS_SRCBLTCLRSPACEYUV = $00000800; + {$EXTERNALSYM DDCKEYCAPS_SRCBLTCLRSPACEYUV} + +(* + * Supports transparent blting using the color key for the source with + * this surface for YUV colors. + *) + DDCKEYCAPS_SRCBLTYUV = $00001000; + {$EXTERNALSYM DDCKEYCAPS_SRCBLTYUV} + +(* + * Supports overlays using the color key for the source with this + * overlay surface for RGB colors. + *) + DDCKEYCAPS_SRCOVERLAY = $00002000; + {$EXTERNALSYM DDCKEYCAPS_SRCOVERLAY} + +(* + * Supports overlays using a color space as the source color key for + * the overlay surface for RGB colors. + *) + DDCKEYCAPS_SRCOVERLAYCLRSPACE = $00004000; + {$EXTERNALSYM DDCKEYCAPS_SRCOVERLAYCLRSPACE} + +(* + * Supports overlays using a color space as the source color key for + * the overlay surface for YUV colors. + *) + DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV = $00008000; + {$EXTERNALSYM DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV} + +(* + * Supports only one active source color key value for visible + * overlay surfaces. + *) + DDCKEYCAPS_SRCOVERLAYONEACTIVE = $00010000; + {$EXTERNALSYM DDCKEYCAPS_SRCOVERLAYONEACTIVE} + +(* + * Supports overlays using the color key for the source with this + * overlay surface for YUV colors. + *) + DDCKEYCAPS_SRCOVERLAYYUV = $00020000; + {$EXTERNALSYM DDCKEYCAPS_SRCOVERLAYYUV} + +(* + * there are no bandwidth trade-offs for using colorkey with an overlay + *) + DDCKEYCAPS_NOCOSTOVERLAY = $00040000; + {$EXTERNALSYM DDCKEYCAPS_NOCOSTOVERLAY} + + +(**************************************************************************** + * + * DIRECTDRAW PIXELFORMAT FLAGS + * + ****************************************************************************) + +(* + * The surface has alpha channel information in the pixel format. + *) + DDPF_ALPHAPIXELS = $00000001; + {$EXTERNALSYM DDPF_ALPHAPIXELS} + +(* + * The pixel format contains alpha only information + *) + DDPF_ALPHA = $00000002; + {$EXTERNALSYM DDPF_ALPHA} + +(* + * The FourCC code is valid. + *) + DDPF_FOURCC = $00000004; + {$EXTERNALSYM DDPF_FOURCC} + +(* + * The surface is 4-bit color indexed. + *) + DDPF_PALETTEINDEXED4 = $00000008; + {$EXTERNALSYM DDPF_PALETTEINDEXED4} + +(* + * The surface is indexed into a palette which stores indices + * into the destination surface's 8-bit palette. + *) + DDPF_PALETTEINDEXEDTO8 = $00000010; + {$EXTERNALSYM DDPF_PALETTEINDEXEDTO8} + +(* + * The surface is 8-bit color indexed. + *) + DDPF_PALETTEINDEXED8 = $00000020; + {$EXTERNALSYM DDPF_PALETTEINDEXED8} + +(* + * The RGB data in the pixel format structure is valid. + *) + DDPF_RGB = $00000040; + {$EXTERNALSYM DDPF_RGB} + +(* + * The surface will accept pixel data in the format specified + * and compress it during the write. + *) + DDPF_COMPRESSED = $00000080; + {$EXTERNALSYM DDPF_COMPRESSED} + +(* + * The surface will accept RGB data and translate it during + * the write to YUV data. The format of the data to be written + * will be contained in the pixel format structure. The DDPF_RGB + * flag will be set. + *) + DDPF_RGBTOYUV = $00000100; + {$EXTERNALSYM DDPF_RGBTOYUV} + +(* + * pixel format is YUV - YUV data in pixel format struct is valid + *) + DDPF_YUV = $00000200; + {$EXTERNALSYM DDPF_YUV} + +(* + * pixel format is a z buffer only surface + *) + DDPF_ZBUFFER = $00000400; + {$EXTERNALSYM DDPF_ZBUFFER} + +(* + * The surface is 1-bit color indexed. + *) + DDPF_PALETTEINDEXED1 = $00000800; + {$EXTERNALSYM DDPF_PALETTEINDEXED1} + +(* + * The surface is 2-bit color indexed. + *) + DDPF_PALETTEINDEXED2 = $00001000; + {$EXTERNALSYM DDPF_PALETTEINDEXED2} + +(* + * The surface contains Z information in the pixels + *) + DDPF_ZPIXELS = $00002000; + {$EXTERNALSYM DDPF_ZPIXELS} + +(* + * The surface contains stencil information along with Z + *) + DDPF_STENCILBUFFER = $00004000; + {$EXTERNALSYM DDPF_STENCILBUFFER} + +(* + * Premultiplied alpha format -- the color components have been + * premultiplied by the alpha component. + *) + DDPF_ALPHAPREMULT = $00008000; + {$EXTERNALSYM DDPF_ALPHAPREMULT} + + +(* + * Luminance data in the pixel format is valid. + * Use this flag for luminance-only or luminance+alpha surfaces, + * the bit depth is then ddpf.dwLuminanceBitCount. + *) + DDPF_LUMINANCE = $00020000; + {$EXTERNALSYM DDPF_LUMINANCE} + +(* + * Luminance data in the pixel format is valid. + * Use this flag when hanging luminance off bumpmap surfaces, + * the bit mask for the luminance portion of the pixel is then + * ddpf.dwBumpLuminanceBitMask + *) + DDPF_BUMPLUMINANCE = $00040000; + {$EXTERNALSYM DDPF_BUMPLUMINANCE} + +(* + * Bump map dUdV data in the pixel format is valid. + *) + DDPF_BUMPDUDV = $00080000; + {$EXTERNALSYM DDPF_BUMPDUDV} + + +(*=========================================================================== + * + * + * DIRECTDRAW CALLBACK FLAGS + * + * + *==========================================================================*) + +(**************************************************************************** + * + * DIRECTDRAW ENUMSURFACES FLAGS + * + ****************************************************************************) + +(* + * Enumerate all of the surfaces that meet the search criterion. + *) + DDENUMSURFACES_ALL = $00000001; + {$EXTERNALSYM DDENUMSURFACES_ALL} + {$EXTERNALSYM DDENUMSURFACES_ALL} + +(* + * A search hit is a surface that matches the surface description. + *) + DDENUMSURFACES_MATCH = $00000002; + {$EXTERNALSYM DDENUMSURFACES_MATCH} + +(* + * A search hit is a surface that does not match the surface description. + *) + DDENUMSURFACES_NOMATCH = $00000004; + {$EXTERNALSYM DDENUMSURFACES_NOMATCH} + +(* + * Enumerate the first surface that can be created which meets the search criterion. + *) + DDENUMSURFACES_CANBECREATED = $00000008; + {$EXTERNALSYM DDENUMSURFACES_CANBECREATED} + +(* + * Enumerate the surfaces that already exist that meet the search criterion. + *) + DDENUMSURFACES_DOESEXIST = $00000010; + {$EXTERNALSYM DDENUMSURFACES_DOESEXIST} + + +(**************************************************************************** + * + * DIRECTDRAW SETDISPLAYMODE FLAGS + * + ****************************************************************************) + +(* + * The desired mode is a standard VGA mode + *) + DDSDM_STANDARDVGAMODE = $00000001; + {$EXTERNALSYM DDSDM_STANDARDVGAMODE} + + +(**************************************************************************** + * + * DIRECTDRAW ENUMDISPLAYMODES FLAGS + * + ****************************************************************************) + +(* + * Enumerate Modes with different refresh rates. EnumDisplayModes guarantees + * that a particular mode will be enumerated only once. This flag specifies whether + * the refresh rate is taken into account when determining if a mode is unique. + *) + DDEDM_REFRESHRATES = $00000001; + {$EXTERNALSYM DDEDM_REFRESHRATES} + +(* + * Enumerate VGA modes. Specify this flag if you wish to enumerate supported VGA + * modes such as mode 0x13 in addition to the usual ModeX modes (which are always + * enumerated if the application has previously called SetCooperativeLevel with the + * DDSCL_ALLOWMODEX flag set). + *) + DDEDM_STANDARDVGAMODES = $00000002; + {$EXTERNALSYM DDEDM_STANDARDVGAMODES} + + +(**************************************************************************** + * + * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS + * + ****************************************************************************) + +(* + * Exclusive mode owner will be responsible for the entire primary surface. + * GDI can be ignored. used with DD + *) + DDSCL_FULLSCREEN = $00000001; + {$EXTERNALSYM DDSCL_FULLSCREEN} + +(* + * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode + *) + DDSCL_ALLOWREBOOT = $00000002; + {$EXTERNALSYM DDSCL_ALLOWREBOOT} + +(* + * prevents DDRAW from modifying the application window. + * prevents DDRAW from minimize/restore the application window on activation. + *) + DDSCL_NOWINDOWCHANGES = $00000004; + {$EXTERNALSYM DDSCL_NOWINDOWCHANGES} + +(* + * app wants to work as a regular Windows application + *) + DDSCL_NORMAL = $00000008; + {$EXTERNALSYM DDSCL_NORMAL} + +(* + * app wants exclusive access + *) + DDSCL_EXCLUSIVE = $00000010; + {$EXTERNALSYM DDSCL_EXCLUSIVE} + + +(* + * app can deal with non-windows display modes + *) + DDSCL_ALLOWMODEX = $00000040; + {$EXTERNALSYM DDSCL_ALLOWMODEX} + +(* + * this window will receive the focus messages + *) + DDSCL_SETFOCUSWINDOW = $00000080; + {$EXTERNALSYM DDSCL_SETFOCUSWINDOW} + +(* + * this window is associated with the DDRAW object and will + * cover the screen in fullscreen mode + *) + DDSCL_SETDEVICEWINDOW = $00000100; + {$EXTERNALSYM DDSCL_SETDEVICEWINDOW} + +(* + * app wants DDRAW to create a window to be associated with the + * DDRAW object + *) + DDSCL_CREATEDEVICEWINDOW = $00000200; + {$EXTERNALSYM DDSCL_CREATEDEVICEWINDOW} + +(* + * App explicitly asks DDRAW/D3D to be multithread safe. This makes D3D + * take the global crtisec more frequently. + *) + DDSCL_MULTITHREADED = $00000400; + {$EXTERNALSYM DDSCL_MULTITHREADED} + +(* + * App specifies that it would like to keep the FPU set up for optimal Direct3D + * performance (single precision and exceptions disabled) so Direct3D + * does not need to explicitly set the FPU each time. This is assumed by + * default in DirectX 7. See also DDSCL_FPUPRESERVE + *) + DDSCL_FPUSETUP = $00000800; + {$EXTERNALSYM DDSCL_FPUSETUP} + +(* + * App specifies that it needs either double precision FPU or FPU exceptions + * enabled. This makes Direct3D explicitly set the FPU state eah time it is + * called. Setting the flag will reduce Direct3D performance. The flag is + * assumed by default in DirectX 6 and earlier. See also DDSCL_FPUSETUP + *) + DDSCL_FPUPRESERVE = $00001000; + {$EXTERNALSYM DDSCL_FPUPRESERVE} + + +(**************************************************************************** + * + * DIRECTDRAW BLT FLAGS + * + ****************************************************************************) + +(* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the destination surface as the alpha channel for this blt. + *) + DDBLT_ALPHADEST = $00000001; + {$EXTERNALSYM DDBLT_ALPHADEST} + +(* + * Use the dwConstAlphaDest field in the DDBLTFX structure as the alpha channel + * for the destination surface for this blt. + *) + DDBLT_ALPHADESTCONSTOVERRIDE = $00000002; + {$EXTERNALSYM DDBLT_ALPHADESTCONSTOVERRIDE} + +(* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. (0 is opaque) + *) + DDBLT_ALPHADESTNEG = $00000004; + {$EXTERNALSYM DDBLT_ALPHADESTNEG} + +(* + * Use the lpDDSAlphaDest field in the DDBLTFX structure as the alpha + * channel for the destination for this blt. + *) + DDBLT_ALPHADESTSURFACEOVERRIDE = $00000008; + {$EXTERNALSYM DDBLT_ALPHADESTSURFACEOVERRIDE} + +(* + * Use the dwAlphaEdgeBlend field in the DDBLTFX structure as the alpha channel + * for the edges of the image that border the color key colors. + *) + DDBLT_ALPHAEDGEBLEND = $00000010; + {$EXTERNALSYM DDBLT_ALPHAEDGEBLEND} + +(* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the source surface as the alpha channel for this blt. + *) + DDBLT_ALPHASRC = $00000020; + {$EXTERNALSYM DDBLT_ALPHASRC} + +(* + * Use the dwConstAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + *) + DDBLT_ALPHASRCCONSTOVERRIDE = $00000040; + {$EXTERNALSYM DDBLT_ALPHASRCCONSTOVERRIDE} + +(* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. (0 is opaque) + *) + DDBLT_ALPHASRCNEG = $00000080; + {$EXTERNALSYM DDBLT_ALPHASRCNEG} + +(* + * Use the lpDDSAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + *) + DDBLT_ALPHASRCSURFACEOVERRIDE = $00000100; + {$EXTERNALSYM DDBLT_ALPHASRCSURFACEOVERRIDE} + +(* + * Do this blt asynchronously through the FIFO in the order received. If + * there is no room in the hardware FIFO fail the call. + *) + DDBLT_ASYNC = $00000200; + {$EXTERNALSYM DDBLT_ASYNC} + +(* + * Uses the dwFillColor field in the DDBLTFX structure as the RGB color + * to fill the destination rectangle on the destination surface with. + *) + DDBLT_COLORFILL = $00000400; + {$EXTERNALSYM DDBLT_COLORFILL} + +(* + * Uses the dwDDFX field in the DDBLTFX structure to specify the effects + * to use for the blt. + *) + DDBLT_DDFX = $00000800; + {$EXTERNALSYM DDBLT_DDFX} + +(* + * Uses the dwDDROPS field in the DDBLTFX structure to specify the ROPS + * that are not part of the Win32 API. + *) + DDBLT_DDROPS = $00001000; + {$EXTERNALSYM DDBLT_DDROPS} + +(* + * Use the color key associated with the destination surface. + *) + DDBLT_KEYDEST = $00002000; + {$EXTERNALSYM DDBLT_KEYDEST} + +(* + * Use the dckDestColorkey field in the DDBLTFX structure as the color key + * for the destination surface. + *) + DDBLT_KEYDESTOVERRIDE = $00004000; + {$EXTERNALSYM DDBLT_KEYDESTOVERRIDE} + +(* + * Use the color key associated with the source surface. + *) + DDBLT_KEYSRC = $00008000; + {$EXTERNALSYM DDBLT_KEYSRC} + +(* + * Use the dckSrcColorkey field in the DDBLTFX structure as the color key + * for the source surface. + *) + DDBLT_KEYSRCOVERRIDE = $00010000; + {$EXTERNALSYM DDBLT_KEYSRCOVERRIDE} + +(* + * Use the dwROP field in the DDBLTFX structure for the raster operation + * for this blt. These ROPs are the same as the ones defined in the Win32 API. + *) + DDBLT_ROP = $00020000; + {$EXTERNALSYM DDBLT_ROP} + +(* + * Use the dwRotationAngle field in the DDBLTFX structure as the angle + * (specified in 1/100th of a degree) to rotate the surface. + *) + DDBLT_ROTATIONANGLE = $00040000; + {$EXTERNALSYM DDBLT_ROTATIONANGLE} + +(* + * Z-buffered blt using the z-buffers attached to the source and destination + * surfaces and the dwZBufferOpCode field in the DDBLTFX structure as the + * z-buffer opcode. + *) + DDBLT_ZBUFFER = $00080000; + {$EXTERNALSYM DDBLT_ZBUFFER} + +(* + * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field + * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively + * for the destination. + *) + DDBLT_ZBUFFERDESTCONSTOVERRIDE = $00100000; + {$EXTERNALSYM DDBLT_ZBUFFERDESTCONSTOVERRIDE} + +(* + * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode + * field in the DDBLTFX structure as the z-buffer and z-buffer opcode + * respectively for the destination. + *) + DDBLT_ZBUFFERDESTOVERRIDE = $00200000; + {$EXTERNALSYM DDBLT_ZBUFFERDESTOVERRIDE} + +(* + * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field + * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively + * for the source. + *) + DDBLT_ZBUFFERSRCCONSTOVERRIDE = $00400000; + {$EXTERNALSYM DDBLT_ZBUFFERSRCCONSTOVERRIDE} + +(* + * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode + * field in the DDBLTFX structure as the z-buffer and z-buffer opcode + * respectively for the source. + *) + DDBLT_ZBUFFERSRCOVERRIDE = $00800000; + {$EXTERNALSYM DDBLT_ZBUFFERSRCOVERRIDE} + +(* + * wait until the device is ready to handle the blt + * this will cause blt to not return DDERR_WASSTILLDRAWING + *) + DDBLT_WAIT = $01000000; + {$EXTERNALSYM DDBLT_WAIT} + +(* + * Uses the dwFillDepth field in the DDBLTFX structure as the depth value + * to fill the destination rectangle on the destination Z-buffer surface + * with. + *) + DDBLT_DEPTHFILL = $02000000; + {$EXTERNALSYM DDBLT_DEPTHFILL} + + +(* + * Return immediately (with DDERR_WASSTILLDRAWING) if the device is not + * ready to schedule the blt at the time Blt() is called. + *) + DDBLT_DONOTWAIT = $08000000; + {$EXTERNALSYM DDBLT_DONOTWAIT} + +(* + * These flags indicate a presentation blt (i.e. a blt + * that moves surface contents from an offscreen back buffer to the primary + * surface). The driver is not allowed to "queue" more than three such blts. + * The "end" of the presentation blt is indicated, since the + * blt may be clipped, in which case the runtime will call the driver with + * several blts. All blts (even if not clipped) are tagged with DDBLT_PRESENTATION + * and the last (even if not clipped) additionally with DDBLT_LAST_PRESENTATION. + * Thus the true rule is that the driver must not schedule a DDBLT_PRESENTATION + * blt if there are 3 or more DDBLT_PRESENTLAST blts in the hardware pipe. + * If there are such blts in the pipe, the driver should return DDERR_WASSTILLDRAWING + * until the oldest queued DDBLT_LAST_PRESENTATION blts has been retired (i.e. the + * pixels have been actually written to the primary surface). Once the oldest blt + * has been retired, the driver is free to schedule the current blt. + * The goal is to provide a mechanism whereby the device's hardware queue never + * gets more than 3 frames ahead of the frames being generated by the application. + * When excessive queueing occurs, applications become unusable because the application + * visibly lags user input, and such problems make windowed interactive applications impossible. + * Some drivers may not have sufficient knowledge of their hardware's FIFO to know + * when a certain blt has been retired. Such drivers should code cautiously, and + * simply not allow any frames to be queued at all. DDBLT_LAST_PRESENTATION should cause + * such drivers to return DDERR_WASSTILLDRAWING until the accelerator is completely + * finished- exactly as if the application had called Lock on the source surface + * before calling Blt. + * In other words, the driver is allowed and encouraged to + * generate as much latency as it can, but never more than 3 frames worth. + * Implementation detail: Drivers should count blts against the SOURCE surface, not + * against the primary surface. This enables multiple parallel windowed application + * to function more optimally. + * This flag is passed only to DX8 or higher drivers. + * + * APPLICATIONS DO NOT SET THESE FLAGS. THEY ARE SET BY THE DIRECTDRAW RUNTIME. + * + *) + DDBLT_PRESENTATION = $10000000; + {$EXTERNALSYM DDBLT_PRESENTATION} + DDBLT_LAST_PRESENTATION = $20000000; + {$EXTERNALSYM DDBLT_LAST_PRESENTATION} + +(* + * If DDBLT_EXTENDED_FLAGS is set, then the driver should re-interpret + * other flags according to the definitions that follow. + * For example, bit 0 (0x00000001L) means DDBLT_ALPHADEST, unless + * DDBLT_EXTENDED_FLAGS is also set, in which case bit 0 means + * DDBLT_EXTENDED_LINEAR_CONTENT. + * Only DirectX9 and higher drivers will be given extended blt flags. + * Only flags explicitly mentioned here should be re-interpreted. + * All other flags retain their original meanings. + * + * List of re-interpreted flags: + * + * Bit Hex value New meaning old meaning + * --------------------------------------------------------------- + * 2 0x00000004 DDBLT_EXTENDED_LINEAR_CONTENT DDBLT_ALPHADESTNEG + * 4 0x00000010 DDBLT_EXTENDED_PRESENTATION_STRETCHFACTOR DDBLT_ALPHAEDGEBLEND + * + * + * NOTE: APPLICATIONS SHOULD NOT SET THIS FLAG. THIS FLAG IS INTENDED + * FOR USE BY THE DIRECT3D RUNTIME. + *) + DDBLT_EXTENDED_FLAGS = $40000000; + {$EXTERNALSYM DDBLT_EXTENDED_FLAGS} + +(* + * EXTENDED FLAG. SEE DEFINITION OF DDBLT_EXTENDED_FLAGS. + * This flag indidcates that the source surface contains content in a + * linear color space. The driver may perform gamma correction to the + * desktop color space (i.e. sRGB, gamma 2.2) as part of this blt. + * If the device can perform such a conversion as part of the copy, + * the driver should also set D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION + * + * NOTE: APPLICATIONS SHOULD NOT SET THIS FLAG. THIS FLAG IS INTENDED + * FOR USE BY THE DIRECT3D RUNTIME. Use IDirect3DSwapChain9::Present + * and specify D3DPRESENT_LINEAR_CONTENT in order to use this functionality. + *) + DDBLT_EXTENDED_LINEAR_CONTENT = $00000004; + {$EXTERNALSYM DDBLT_EXTENDED_LINEAR_CONTENT} + + +(**************************************************************************** + * + * BLTFAST FLAGS + * + ****************************************************************************) + + DDBLTFAST_NOCOLORKEY = $00000000; + {$EXTERNALSYM DDBLTFAST_NOCOLORKEY} + DDBLTFAST_SRCCOLORKEY = $00000001; + {$EXTERNALSYM DDBLTFAST_SRCCOLORKEY} + DDBLTFAST_DESTCOLORKEY = $00000002; + {$EXTERNALSYM DDBLTFAST_DESTCOLORKEY} + DDBLTFAST_WAIT = $00000010; + {$EXTERNALSYM DDBLTFAST_WAIT} + DDBLTFAST_DONOTWAIT = $00000020; + {$EXTERNALSYM DDBLTFAST_DONOTWAIT} + +(**************************************************************************** + * + * FLIP FLAGS + * + ****************************************************************************) + + DDFLIP_WAIT = $00000001; + {$EXTERNALSYM DDFLIP_WAIT} + +(* + * Indicates that the target surface contains the even field of video data. + * This flag is only valid with an overlay surface. + *) + DDFLIP_EVEN = $00000002; + {$EXTERNALSYM DDFLIP_EVEN} + +(* + * Indicates that the target surface contains the odd field of video data. + * This flag is only valid with an overlay surface. + *) + DDFLIP_ODD = $00000004; + {$EXTERNALSYM DDFLIP_ODD} + +(* + * Causes DirectDraw to perform the physical flip immediately and return + * to the application. Typically, what was the front buffer but is now the back + * buffer will still be visible (depending on timing) until the next vertical + * retrace. Subsequent operations involving the two flipped surfaces will + * not check to see if the physical flip has finished (i.e. will not return + * DDERR_WASSTILLDRAWING for that reason (but may for other reasons)). + * This allows an application to perform Flips at a higher frequency than the + * monitor refresh rate, but may introduce visible artifacts. + * Only effective if DDCAPS2_FLIPNOVSYNC is set. If that bit is not set, + * DDFLIP_NOVSYNC has no effect. + *) + DDFLIP_NOVSYNC = $00000008; + {$EXTERNALSYM DDFLIP_NOVSYNC} + + +(* + * Flip Interval Flags. These flags indicate how many vertical retraces to wait between + * each flip. The default is one. DirectDraw will return DDERR_WASSTILLDRAWING for each + * surface involved in the flip until the specified number of vertical retraces has + * ocurred. Only effective if DDCAPS2_FLIPINTERVAL is set. If that bit is not set, + * DDFLIP_INTERVALn has no effect. + *) + +(* + * DirectDraw will flip on every other vertical sync + *) + DDFLIP_INTERVAL2 = $02000000; + {$EXTERNALSYM DDFLIP_INTERVAL2} + + +(* + * DirectDraw will flip on every third vertical sync + *) + DDFLIP_INTERVAL3 = $03000000; + {$EXTERNALSYM DDFLIP_INTERVAL3} + + +(* + * DirectDraw will flip on every fourth vertical sync + *) + DDFLIP_INTERVAL4 = $04000000; + {$EXTERNALSYM DDFLIP_INTERVAL4} + +(* + * DirectDraw will flip and display a main stereo surface + *) + DDFLIP_STEREO = $00000010; + {$EXTERNALSYM DDFLIP_STEREO} + +(* + * On IDirectDrawSurface7 and higher interfaces, the default is DDFLIP_WAIT. If you wish + * to override the default and use time when the accelerator is busy (as denoted by + * the DDERR_WASSTILLDRAWING return code) then use DDFLIP_DONOTWAIT. + *) + DDFLIP_DONOTWAIT = $00000020; + {$EXTERNALSYM DDFLIP_DONOTWAIT} + + +(**************************************************************************** + * + * DIRECTDRAW SURFACE OVERLAY FLAGS + * + ****************************************************************************) + +(* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the destination surface as the alpha channel for the + * destination overlay. + *) + DDOVER_ALPHADEST = $00000001; + {$EXTERNALSYM DDOVER_ALPHADEST} + +(* + * Use the dwConstAlphaDest field in the DDOVERLAYFX structure as the + * destination alpha channel for this overlay. + *) + DDOVER_ALPHADESTCONSTOVERRIDE = $00000002; + {$EXTERNALSYM DDOVER_ALPHADESTCONSTOVERRIDE} + +(* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. + *) + DDOVER_ALPHADESTNEG = $00000004; + {$EXTERNALSYM DDOVER_ALPHADESTNEG} + +(* + * Use the lpDDSAlphaDest field in the DDOVERLAYFX structure as the alpha + * channel destination for this overlay. + *) + DDOVER_ALPHADESTSURFACEOVERRIDE = $00000008; + {$EXTERNALSYM DDOVER_ALPHADESTSURFACEOVERRIDE} + +(* + * Use the dwAlphaEdgeBlend field in the DDOVERLAYFX structure as the alpha + * channel for the edges of the image that border the color key colors. + *) + DDOVER_ALPHAEDGEBLEND = $00000010; + {$EXTERNALSYM DDOVER_ALPHAEDGEBLEND} + +(* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the source surface as the source alpha channel for this overlay. + *) + DDOVER_ALPHASRC = $00000020; + {$EXTERNALSYM DDOVER_ALPHASRC} + +(* + * Use the dwConstAlphaSrc field in the DDOVERLAYFX structure as the source + * alpha channel for this overlay. + *) + DDOVER_ALPHASRCCONSTOVERRIDE = $00000040; + {$EXTERNALSYM DDOVER_ALPHASRCCONSTOVERRIDE} + +(* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. + *) + DDOVER_ALPHASRCNEG = $00000080; + {$EXTERNALSYM DDOVER_ALPHASRCNEG} + +(* + * Use the lpDDSAlphaSrc field in the DDOVERLAYFX structure as the alpha channel + * source for this overlay. + *) + DDOVER_ALPHASRCSURFACEOVERRIDE = $00000100; + {$EXTERNALSYM DDOVER_ALPHASRCSURFACEOVERRIDE} + +(* + * Turn this overlay off. + *) + DDOVER_HIDE = $00000200; + {$EXTERNALSYM DDOVER_HIDE} + +(* + * Use the color key associated with the destination surface. + *) + DDOVER_KEYDEST = $00000400; + {$EXTERNALSYM DDOVER_KEYDEST} + +(* + * Use the dckDestColorkey field in the DDOVERLAYFX structure as the color key + * for the destination surface + *) + DDOVER_KEYDESTOVERRIDE = $00000800; + {$EXTERNALSYM DDOVER_KEYDESTOVERRIDE} + +(* + * Use the color key associated with the source surface. + *) + DDOVER_KEYSRC = $00001000; + {$EXTERNALSYM DDOVER_KEYSRC} + +(* + * Use the dckSrcColorkey field in the DDOVERLAYFX structure as the color key + * for the source surface. + *) + DDOVER_KEYSRCOVERRIDE = $00002000; + {$EXTERNALSYM DDOVER_KEYSRCOVERRIDE} + +(* + * Turn this overlay on. + *) + DDOVER_SHOW = $00004000; + {$EXTERNALSYM DDOVER_SHOW} + +(* + * Add a dirty rect to an emulated overlayed surface. + *) + DDOVER_ADDDIRTYRECT = $00008000; + {$EXTERNALSYM DDOVER_ADDDIRTYRECT} + +(* + * Redraw all dirty rects on an emulated overlayed surface. + *) + DDOVER_REFRESHDIRTYRECTS = $00010000; + {$EXTERNALSYM DDOVER_REFRESHDIRTYRECTS} + +(* + * Redraw the entire surface on an emulated overlayed surface. + *) + DDOVER_REFRESHALL = $00020000; + {$EXTERNALSYM DDOVER_REFRESHALL} + + +(* + * Use the overlay FX flags to define special overlay FX + *) + DDOVER_DDFX = $00080000; + {$EXTERNALSYM DDOVER_DDFX} + +(* + * Autoflip the overlay when ever the video port autoflips + *) + DDOVER_AUTOFLIP = $00100000; + {$EXTERNALSYM DDOVER_AUTOFLIP} + +(* + * Display each field of video port data individually without + * causing any jittery artifacts + *) + DDOVER_BOB = $00200000; + {$EXTERNALSYM DDOVER_BOB} + +(* + * Indicates that bob/weave decisions should not be overridden by other + * interfaces. + *) + DDOVER_OVERRIDEBOBWEAVE = $00400000; + {$EXTERNALSYM DDOVER_OVERRIDEBOBWEAVE} + +(* + * Indicates that the surface memory is composed of interleaved fields. + *) + DDOVER_INTERLEAVED = $00800000; + {$EXTERNALSYM DDOVER_INTERLEAVED} + +(* + * Indicates that bob will be performed using hardware rather than + * software or emulated. + *) + DDOVER_BOBHARDWARE = $01000000; + {$EXTERNALSYM DDOVER_BOBHARDWARE} + +(* + * Indicates that overlay FX structure contains valid ARGB scaling factors. + *) + DDOVER_ARGBSCALEFACTORS = $02000000; + {$EXTERNALSYM DDOVER_ARGBSCALEFACTORS} + +(* + * Indicates that ARGB scaling factors can be degraded to fit driver capabilities. + *) + DDOVER_DEGRADEARGBSCALING = $04000000; + {$EXTERNALSYM DDOVER_DEGRADEARGBSCALING} + + +(**************************************************************************** + * + * DIRECTDRAWSURFACE LOCK FLAGS + * + ****************************************************************************) + +(* + * The default. Set to indicate that Lock should return a valid memory pointer + * to the top of the specified rectangle. If no rectangle is specified then a + * pointer to the top of the surface is returned. + *) + DDLOCK_SURFACEMEMORYPTR = $00000000; // = default + {$EXTERNALSYM DDLOCK_SURFACEMEMORYPTR} + +(* + * Set to indicate that Lock should wait until it can obtain a valid memory + * pointer before returning. If this bit is set, Lock will never return + * DDERR_WASSTILLDRAWING. + *) + DDLOCK_WAIT = $00000001; + {$EXTERNALSYM DDLOCK_WAIT} + +(* + * Set if an event handle is being passed to Lock. Lock will trigger the event + * when it can return the surface memory pointer requested. + *) + DDLOCK_EVENT = $00000002; + {$EXTERNALSYM DDLOCK_EVENT} + +(* + * Indicates that the surface being locked will only be read from. + *) + DDLOCK_READONLY = $00000010; + {$EXTERNALSYM DDLOCK_READONLY} + +(* + * Indicates that the surface being locked will only be written to + *) + DDLOCK_WRITEONLY = $00000020; + {$EXTERNALSYM DDLOCK_WRITEONLY} + + +(* + * Indicates that a system wide lock should not be taken when this surface + * is locked. This has several advantages (cursor responsiveness, ability + * to call more Windows functions, easier debugging) when locking video + * memory surfaces. However, an application specifying this flag must + * comply with a number of conditions documented in the help file. + * Furthermore, this flag cannot be specified when locking the primary. + *) + DDLOCK_NOSYSLOCK = $00000800; + {$EXTERNALSYM DDLOCK_NOSYSLOCK} + +(* + * Used only with Direct3D Vertex Buffer Locks. Indicates that no vertices + * that were referred to in Draw*PrimtiveVB calls since the start of the + * frame (or the last lock without this flag) will be modified during the + * lock. This can be useful when one is only appending data to the vertex + * buffer + *) + DDLOCK_NOOVERWRITE = $00001000; + {$EXTERNALSYM DDLOCK_NOOVERWRITE} + +(* + * Indicates that no assumptions will be made about the contents of the + * surface or vertex buffer during this lock. + * This enables two things: + * - Direct3D or the driver may provide an alternative memory + * area as the vertex buffer. This is useful when one plans to clear the + * contents of the vertex buffer and fill in new data. + * - Drivers sometimes store surface data in a re-ordered format. + * When the application locks the surface, the driver is forced to un-re-order + * the surface data before allowing the application to see the surface contents. + * This flag is a hint to the driver that it can skip the un-re-ordering process + * since the application plans to overwrite every single pixel in the surface + * or locked rectangle (and so erase any un-re-ordered pixels anyway). + * Applications should always set this flag when they intend to overwrite the entire + * surface or locked rectangle. + *) + DDLOCK_DISCARDCONTENTS = $00002000; + {$EXTERNALSYM DDLOCK_DISCARDCONTENTS} + (* + * DDLOCK_OKTOSWAP is an older, less informative name for DDLOCK_DISCARDCONTENTS + *) + DDLOCK_OKTOSWAP = $00002000; + {$EXTERNALSYM DDLOCK_OKTOSWAP} + +(* + * On IDirectDrawSurface7 and higher interfaces, the default is DDLOCK_WAIT. If you wish + * to override the default and use time when the accelerator is busy (as denoted by + * the DDERR_WASSTILLDRAWING return code) then use DDLOCK_DONOTWAIT. + *) + DDLOCK_DONOTWAIT = $00004000; + {$EXTERNALSYM DDLOCK_DONOTWAIT} + +(* + * This indicates volume texture lock with front and back specified. + *) + DDLOCK_HASVOLUMETEXTUREBOXRECT = $00008000; + {$EXTERNALSYM DDLOCK_HASVOLUMETEXTUREBOXRECT} + +(* + * This indicates that the driver should not update dirty rect information for this lock. + *) + DDLOCK_NODIRTYUPDATE = $00010000; + {$EXTERNALSYM DDLOCK_NODIRTYUPDATE} + + +(**************************************************************************** + * + * DIRECTDRAWSURFACE PAGELOCK FLAGS + * + ****************************************************************************) + +(* + * No flags defined at present + *) + + +(**************************************************************************** + * + * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS + * + ****************************************************************************) + +(* + * No flags defined at present + *) + + +(**************************************************************************** + * + * DIRECTDRAWSURFACE BLT FX FLAGS + * + ****************************************************************************) + +(* + * If stretching, use arithmetic stretching along the Y axis for this blt. + *) + DDBLTFX_ARITHSTRETCHY = $00000001; + {$EXTERNALSYM DDBLTFX_ARITHSTRETCHY} + +(* + * Do this blt mirroring the surface left to right. Spin the + * surface around its y-axis. + *) + DDBLTFX_MIRRORLEFTRIGHT = $00000002; + {$EXTERNALSYM DDBLTFX_MIRRORLEFTRIGHT} + +(* + * Do this blt mirroring the surface up and down. Spin the surface + * around its x-axis. + *) + DDBLTFX_MIRRORUPDOWN = $00000004; + {$EXTERNALSYM DDBLTFX_MIRRORUPDOWN} + +(* + * Schedule this blt to avoid tearing. + *) + DDBLTFX_NOTEARING = $00000008; + {$EXTERNALSYM DDBLTFX_NOTEARING} + +(* + * Do this blt rotating the surface one hundred and eighty degrees. + *) + DDBLTFX_ROTATE180 = $00000010; + {$EXTERNALSYM DDBLTFX_ROTATE180} + +(* + * Do this blt rotating the surface two hundred and seventy degrees. + *) + DDBLTFX_ROTATE270 = $00000020; + {$EXTERNALSYM DDBLTFX_ROTATE270} + +(* + * Do this blt rotating the surface ninety degrees. + *) + DDBLTFX_ROTATE90 = $00000040; + {$EXTERNALSYM DDBLTFX_ROTATE90} + +(* + * Do this z blt using dwZBufferLow and dwZBufferHigh as range values + * specified to limit the bits copied from the source surface. + *) + DDBLTFX_ZBUFFERRANGE = $00000080; + {$EXTERNALSYM DDBLTFX_ZBUFFERRANGE} + +(* + * Do this z blt adding the dwZBufferBaseDest to each of the sources z values + * before comparing it with the desting z values. + *) + DDBLTFX_ZBUFFERBASEDEST = $00000100; + {$EXTERNALSYM DDBLTFX_ZBUFFERBASEDEST} + +(**************************************************************************** + * + * DIRECTDRAWSURFACE OVERLAY FX FLAGS + * + ****************************************************************************) + +(* + * If stretching, use arithmetic stretching along the Y axis for this overlay. + *) + DDOVERFX_ARITHSTRETCHY = $00000001; + {$EXTERNALSYM DDOVERFX_ARITHSTRETCHY} + +(* + * Mirror the overlay across the vertical axis + *) + DDOVERFX_MIRRORLEFTRIGHT = $00000002; + {$EXTERNALSYM DDOVERFX_MIRRORLEFTRIGHT} + +(* + * Mirror the overlay across the horizontal axis + *) + DDOVERFX_MIRRORUPDOWN = $00000004; + {$EXTERNALSYM DDOVERFX_MIRRORUPDOWN} + +(* + * Deinterlace the overlay, if possible + *) + DDOVERFX_DEINTERLACE = $00000008; + {$EXTERNALSYM DDOVERFX_DEINTERLACE} + + +(**************************************************************************** + * + * DIRECTDRAW WAITFORVERTICALBLANK FLAGS + * + ****************************************************************************) + +(* + * return when the vertical blank interval begins + *) + DDWAITVB_BLOCKBEGIN = $00000001; + {$EXTERNALSYM DDWAITVB_BLOCKBEGIN} + +(* + * set up an event to trigger when the vertical blank begins + *) + DDWAITVB_BLOCKBEGINEVENT = $00000002; + {$EXTERNALSYM DDWAITVB_BLOCKBEGINEVENT} + +(* + * return when the vertical blank interval ends and display begins + *) + DDWAITVB_BLOCKEND = $00000004; + {$EXTERNALSYM DDWAITVB_BLOCKEND} + +(**************************************************************************** + * + * DIRECTDRAW GETFLIPSTATUS FLAGS + * + ****************************************************************************) + +(* + * is it OK to flip now? + *) + DDGFS_CANFLIP = $00000001; + {$EXTERNALSYM DDGFS_CANFLIP} + +(* + * is the last flip finished? + *) + DDGFS_ISFLIPDONE = $00000002; + {$EXTERNALSYM DDGFS_ISFLIPDONE} + +(**************************************************************************** + * + * DIRECTDRAW GETBLTSTATUS FLAGS + * + ****************************************************************************) + +(* + * is it OK to blt now? + *) + DDGBS_CANBLT = $00000001; + {$EXTERNALSYM DDGBS_CANBLT} + +(* + * is the blt to the surface finished? + *) + DDGBS_ISBLTDONE = $00000002; + {$EXTERNALSYM DDGBS_ISBLTDONE} + + +(**************************************************************************** + * + * DIRECTDRAW ENUMOVERLAYZORDER FLAGS + * + ****************************************************************************) + +(* + * Enumerate overlays back to front. + *) + DDENUMOVERLAYZ_BACKTOFRONT = $00000000; + {$EXTERNALSYM DDENUMOVERLAYZ_BACKTOFRONT} + +(* + * Enumerate overlays front to back + *) + DDENUMOVERLAYZ_FRONTTOBACK = $00000001; + {$EXTERNALSYM DDENUMOVERLAYZ_FRONTTOBACK} + +(**************************************************************************** + * + * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS + * + ****************************************************************************) + +(* + * Send overlay to front + *) + DDOVERZ_SENDTOFRONT = $00000000; + {$EXTERNALSYM DDOVERZ_SENDTOFRONT} + +(* + * Send overlay to back + *) + DDOVERZ_SENDTOBACK = $00000001; + {$EXTERNALSYM DDOVERZ_SENDTOBACK} + +(* + * Move Overlay forward + *) + DDOVERZ_MOVEFORWARD = $00000002; + {$EXTERNALSYM DDOVERZ_MOVEFORWARD} + +(* + * Move Overlay backward + *) + DDOVERZ_MOVEBACKWARD = $00000003; + {$EXTERNALSYM DDOVERZ_MOVEBACKWARD} + +(* + * Move Overlay in front of relative surface + *) + DDOVERZ_INSERTINFRONTOF = $00000004; + {$EXTERNALSYM DDOVERZ_INSERTINFRONTOF} + +(* + * Move Overlay in back of relative surface + *) + DDOVERZ_INSERTINBACKOF = $00000005; + {$EXTERNALSYM DDOVERZ_INSERTINBACKOF} + + +(**************************************************************************** + * + * DIRECTDRAW SETGAMMARAMP FLAGS + * + ****************************************************************************) + +(* + * Request calibrator to adjust the gamma ramp according to the physical + * properties of the display so that the result should appear identical + * on all systems. + *) + DDSGR_CALIBRATE = $00000001; + {$EXTERNALSYM DDSGR_CALIBRATE} + + +(**************************************************************************** + * + * DIRECTDRAW STARTMODETEST FLAGS + * + ****************************************************************************) + +(* + * Indicates that the mode being tested has passed + *) + DDSMT_ISTESTREQUIRED = $00000001; + {$EXTERNALSYM DDSMT_ISTESTREQUIRED} + + +(**************************************************************************** + * + * DIRECTDRAW EVALUATEMODE FLAGS + * + ****************************************************************************) + +(* + * Indicates that the mode being tested has passed + *) + DDEM_MODEPASSED = $00000001; + {$EXTERNALSYM DDEM_MODEPASSED} + +(* + * Indicates that the mode being tested has failed + *) + DDEM_MODEFAILED = $00000002; + {$EXTERNALSYM DDEM_MODEFAILED} + + +(*=========================================================================== + * + * + * DIRECTDRAW RETURN CODES + * + * The return values from DirectDraw Commands and Surface that return an HRESULT + * are codes from DirectDraw concerning the results of the action + * requested by DirectDraw. + * + *==========================================================================*) + +(* + * Status is OK + * + * Issued by: DirectDraw Commands and all callbacks + *) + DD_OK = 0; + {$EXTERNALSYM DD_OK} + DD_FALSE = S_FALSE; + {$EXTERNALSYM DD_FALSE} + +(**************************************************************************** + * + * DIRECTDRAW ENUMCALLBACK RETURN VALUES + * + * EnumCallback returns are used to control the flow of the DIRECTDRAW and + * DIRECTDRAWSURFACE object enumerations. They can only be returned by + * enumeration callback routines. + * + ****************************************************************************) + +(* + * stop the enumeration + *) + DDENUMRET_CANCEL = 0; + {$EXTERNALSYM DDENUMRET_CANCEL} + +(* + * continue the enumeration + *) + DDENUMRET_OK = 1; + {$EXTERNALSYM DDENUMRET_OK} + +(**************************************************************************** + * + * DIRECTDRAW ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************) + +const + _FACDD = $876; + {$EXTERNALSYM _FACDD} + _MAKE_DDHRESULT = HResult(1 shl 31) or HResult(_FACDD shl 16); + +//#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) +function MAKE_DDHRESULT(Code: DWORD): HResult; +{$EXTERNALSYM MAKE_DDHRESULT} + +const +(* + * This object is already initialized + *) + DDERR_ALREADYINITIALIZED = HResult(_MAKE_DDHRESULT + 5); + {$EXTERNALSYM DDERR_ALREADYINITIALIZED} + +(* + * This surface can not be attached to the requested surface. + *) + DDERR_CANNOTATTACHSURFACE = HResult(_MAKE_DDHRESULT + 10); + {$EXTERNALSYM DDERR_CANNOTATTACHSURFACE} + +(* + * This surface can not be detached from the requested surface. + *) + DDERR_CANNOTDETACHSURFACE = HResult(_MAKE_DDHRESULT + 20); + {$EXTERNALSYM DDERR_CANNOTDETACHSURFACE} + +(* + * Support is currently not available. + *) + DDERR_CURRENTLYNOTAVAIL = HResult(_MAKE_DDHRESULT + 40); + {$EXTERNALSYM DDERR_CURRENTLYNOTAVAIL} + +(* + * An exception was encountered while performing the requested operation + *) + DDERR_EXCEPTION = HResult(_MAKE_DDHRESULT + 55); + {$EXTERNALSYM DDERR_EXCEPTION} + +(* + * Generic failure. + *) + DDERR_GENERIC = E_FAIL; + {$EXTERNALSYM DDERR_GENERIC} + +(* + * Height of rectangle provided is not a multiple of reqd alignment + *) + DDERR_HEIGHTALIGN = HResult(_MAKE_DDHRESULT + 90); + {$EXTERNALSYM DDERR_HEIGHTALIGN} + +(* + * Unable to match primary surface creation request with existing + * primary surface. + *) + DDERR_INCOMPATIBLEPRIMARY = HResult(_MAKE_DDHRESULT + 95); + {$EXTERNALSYM DDERR_INCOMPATIBLEPRIMARY} + +(* + * One or more of the caps bits passed to the callback are incorrect. + *) + DDERR_INVALIDCAPS = HResult(_MAKE_DDHRESULT + 100); + {$EXTERNALSYM DDERR_INVALIDCAPS} + +(* + * DirectDraw does not support provided Cliplist. + *) + DDERR_INVALIDCLIPLIST = HResult(_MAKE_DDHRESULT + 110); + {$EXTERNALSYM DDERR_INVALIDCLIPLIST} + +(* + * DirectDraw does not support the requested mode + *) + DDERR_INVALIDMODE = HResult(_MAKE_DDHRESULT + 120); + {$EXTERNALSYM DDERR_INVALIDMODE} + +(* + * DirectDraw received a pointer that was an invalid DIRECTDRAW object. + *) + DDERR_INVALIDOBJECT = HResult(_MAKE_DDHRESULT + 130); + {$EXTERNALSYM DDERR_INVALIDOBJECT} + +(* + * One or more of the parameters passed to the callback function are + * incorrect. + *) + DDERR_INVALIDPARAMS = E_INVALIDARG; + {$EXTERNALSYM DDERR_INVALIDPARAMS} + +(* + * pixel format was invalid as specified + *) + DDERR_INVALIDPIXELFORMAT = HResult(_MAKE_DDHRESULT + 145); + {$EXTERNALSYM DDERR_INVALIDPIXELFORMAT} + +(* + * Rectangle provided was invalid. + *) + DDERR_INVALIDRECT = HResult(_MAKE_DDHRESULT + 150); + {$EXTERNALSYM DDERR_INVALIDRECT} + +(* + * Operation could not be carried out because one or more surfaces are locked + *) + DDERR_LOCKEDSURFACES = HResult(_MAKE_DDHRESULT + 160); + {$EXTERNALSYM DDERR_LOCKEDSURFACES} + +(* + * There is no 3D present. + *) + DDERR_NO3D = HResult(_MAKE_DDHRESULT + 170); + {$EXTERNALSYM DDERR_NO3D} + +(* + * Operation could not be carried out because there is no alpha accleration + * hardware present or available. + *) + DDERR_NOALPHAHW = HResult(_MAKE_DDHRESULT + 180); + {$EXTERNALSYM DDERR_NOALPHAHW} + +(* + * Operation could not be carried out because there is no stereo + * hardware present or available. + *) + DDERR_NOSTEREOHARDWARE = HResult(_MAKE_DDHRESULT + 181); + {$EXTERNALSYM DDERR_NOSTEREOHARDWARE} + +(* + * Operation could not be carried out because there is no hardware + * present which supports stereo surfaces + *) + DDERR_NOSURFACELEFT = HResult(_MAKE_DDHRESULT + 182); + {$EXTERNALSYM DDERR_NOSURFACELEFT} + + + +(* + * no clip list available + *) + DDERR_NOCLIPLIST = HResult(_MAKE_DDHRESULT + 205); + {$EXTERNALSYM DDERR_NOCLIPLIST} + +(* + * Operation could not be carried out because there is no color conversion + * hardware present or available. + *) + DDERR_NOCOLORCONVHW = HResult(_MAKE_DDHRESULT + 210); + {$EXTERNALSYM DDERR_NOCOLORCONVHW} + +(* + * Create function called without DirectDraw object method SetCooperativeLevel + * being called. + *) + DDERR_NOCOOPERATIVELEVELSET = HResult(_MAKE_DDHRESULT + 212); + {$EXTERNALSYM DDERR_NOCOOPERATIVELEVELSET} + +(* + * Surface doesn't currently have a color key + *) + DDERR_NOCOLORKEY = HResult(_MAKE_DDHRESULT + 215); + {$EXTERNALSYM DDERR_NOCOLORKEY} + +(* + * Operation could not be carried out because there is no hardware support + * of the dest color key. + *) + DDERR_NOCOLORKEYHW = HResult(_MAKE_DDHRESULT + 220); + {$EXTERNALSYM DDERR_NOCOLORKEYHW} + +(* + * No DirectDraw support possible with current display driver + *) + DDERR_NODIRECTDRAWSUPPORT = HResult(_MAKE_DDHRESULT + 222); + {$EXTERNALSYM DDERR_NODIRECTDRAWSUPPORT} + +(* + * Operation requires the application to have exclusive mode but the + * application does not have exclusive mode. + *) + DDERR_NOEXCLUSIVEMODE = HResult(_MAKE_DDHRESULT + 225); + {$EXTERNALSYM DDERR_NOEXCLUSIVEMODE} + +(* + * Flipping visible surfaces is not supported. + *) + DDERR_NOFLIPHW = HResult(_MAKE_DDHRESULT + 230); + {$EXTERNALSYM DDERR_NOFLIPHW} + +(* + * There is no GDI present. + *) + DDERR_NOGDI = HResult(_MAKE_DDHRESULT + 240); + {$EXTERNALSYM DDERR_NOGDI} + +(* + * Operation could not be carried out because there is no hardware present + * or available. + *) + DDERR_NOMIRRORHW = HResult(_MAKE_DDHRESULT + 250); + {$EXTERNALSYM DDERR_NOMIRRORHW} + +(* + * Requested item was not found + *) + DDERR_NOTFOUND = HResult(_MAKE_DDHRESULT + 255); + {$EXTERNALSYM DDERR_NOTFOUND} + +(* + * Operation could not be carried out because there is no overlay hardware + * present or available. + *) + DDERR_NOOVERLAYHW = HResult(_MAKE_DDHRESULT + 260); + {$EXTERNALSYM DDERR_NOOVERLAYHW} + +(* + * Operation could not be carried out because the source and destination + * rectangles are on the same surface and overlap each other. + *) + DDERR_OVERLAPPINGRECTS = HResult(_MAKE_DDHRESULT + 270); + {$EXTERNALSYM DDERR_OVERLAPPINGRECTS} + +(* + * Operation could not be carried out because there is no appropriate raster + * op hardware present or available. + *) + DDERR_NORASTEROPHW = HResult(_MAKE_DDHRESULT + 280); + {$EXTERNALSYM DDERR_NORASTEROPHW} + +(* + * Operation could not be carried out because there is no rotation hardware + * present or available. + *) + DDERR_NOROTATIONHW = HResult(_MAKE_DDHRESULT + 290); + {$EXTERNALSYM DDERR_NOROTATIONHW} + +(* + * Operation could not be carried out because there is no hardware support + * for stretching + *) + DDERR_NOSTRETCHHW = HResult(_MAKE_DDHRESULT + 310); + {$EXTERNALSYM DDERR_NOSTRETCHHW} + +(* + * DirectDrawSurface is not in 4 bit color palette and the requested operation + * requires 4 bit color palette. + *) + DDERR_NOT4BITCOLOR = HResult(_MAKE_DDHRESULT + 316); + {$EXTERNALSYM DDERR_NOT4BITCOLOR} + +(* + * DirectDrawSurface is not in 4 bit color index palette and the requested + * operation requires 4 bit color index palette. + *) + DDERR_NOT4BITCOLORINDEX = HResult(_MAKE_DDHRESULT + 317); + {$EXTERNALSYM DDERR_NOT4BITCOLORINDEX} + +(* + * DirectDraw Surface is not in 8 bit color mode and the requested operation + * requires 8 bit color. + *) + DDERR_NOT8BITCOLOR = HResult(_MAKE_DDHRESULT + 320); + {$EXTERNALSYM DDERR_NOT8BITCOLOR} + +(* + * Operation could not be carried out because there is no texture mapping + * hardware present or available. + *) + DDERR_NOTEXTUREHW = HResult(_MAKE_DDHRESULT + 330); + {$EXTERNALSYM DDERR_NOTEXTUREHW} + +(* + * Operation could not be carried out because there is no hardware support + * for vertical blank synchronized operations. + *) + DDERR_NOVSYNCHW = HResult(_MAKE_DDHRESULT + 335); + {$EXTERNALSYM DDERR_NOVSYNCHW} + +(* + * Operation could not be carried out because there is no hardware support + * for zbuffer blting. + *) + DDERR_NOZBUFFERHW = HResult(_MAKE_DDHRESULT + 340); + {$EXTERNALSYM DDERR_NOZBUFFERHW} + +(* + * Overlay surfaces could not be z layered based on their BltOrder because + * the hardware does not support z layering of overlays. + *) + DDERR_NOZOVERLAYHW = HResult(_MAKE_DDHRESULT + 350); + {$EXTERNALSYM DDERR_NOZOVERLAYHW} + +(* + * The hardware needed for the requested operation has already been + * allocated. + *) + DDERR_OUTOFCAPS = HResult(_MAKE_DDHRESULT + 360); + {$EXTERNALSYM DDERR_OUTOFCAPS} + +(* + * DirectDraw does not have enough memory to perform the operation. + *) + DDERR_OUTOFMEMORY = E_OUTOFMEMORY; + {$EXTERNALSYM DDERR_OUTOFMEMORY} + +(* + * DirectDraw does not have enough memory to perform the operation. + *) + DDERR_OUTOFVIDEOMEMORY = HResult(_MAKE_DDHRESULT + 380); + {$EXTERNALSYM DDERR_OUTOFVIDEOMEMORY} + +(* + * hardware does not support clipped overlays + *) + DDERR_OVERLAYCANTCLIP = HResult(_MAKE_DDHRESULT + 382); + {$EXTERNALSYM DDERR_OVERLAYCANTCLIP} + +(* + * Can only have ony color key active at one time for overlays + *) + DDERR_OVERLAYCOLORKEYONLYONEACTIVE = HResult(_MAKE_DDHRESULT + 384); + {$EXTERNALSYM DDERR_OVERLAYCOLORKEYONLYONEACTIVE} + +(* + * Access to this palette is being refused because the palette is already + * locked by another thread. + *) + DDERR_PALETTEBUSY = HResult(_MAKE_DDHRESULT + 387); + {$EXTERNALSYM DDERR_PALETTEBUSY} + +(* + * No src color key specified for this operation. + *) + DDERR_COLORKEYNOTSET = HResult(_MAKE_DDHRESULT + 400); + {$EXTERNALSYM DDERR_COLORKEYNOTSET} + +(* + * This surface is already attached to the surface it is being attached to. + *) + DDERR_SURFACEALREADYATTACHED = HResult(_MAKE_DDHRESULT + 410); + {$EXTERNALSYM DDERR_SURFACEALREADYATTACHED} + +(* + * This surface is already a dependency of the surface it is being made a + * dependency of. + *) + DDERR_SURFACEALREADYDEPENDENT = HResult(_MAKE_DDHRESULT + 420); + {$EXTERNALSYM DDERR_SURFACEALREADYDEPENDENT} + +(* + * Access to this surface is being refused because the surface is already + * locked by another thread. + *) + DDERR_SURFACEBUSY = HResult(_MAKE_DDHRESULT + 430); + {$EXTERNALSYM DDERR_SURFACEBUSY} + +(* + * Access to this surface is being refused because no driver exists + * which can supply a pointer to the surface. + * This is most likely to happen when attempting to lock the primary + * surface when no DCI provider is present. + * Will also happen on attempts to lock an optimized surface. + *) + DDERR_CANTLOCKSURFACE = HResult(_MAKE_DDHRESULT + 435); + {$EXTERNALSYM DDERR_CANTLOCKSURFACE} + +(* + * Access to Surface refused because Surface is obscured. + *) + DDERR_SURFACEISOBSCURED = HResult(_MAKE_DDHRESULT + 440); + {$EXTERNALSYM DDERR_SURFACEISOBSCURED} + +(* + * Access to this surface is being refused because the surface is gone. + * The DIRECTDRAWSURFACE object representing this surface should + * have Restore called on it. + *) + DDERR_SURFACELOST = HResult(_MAKE_DDHRESULT + 450); + {$EXTERNALSYM DDERR_SURFACELOST} + +(* + * The requested surface is not attached. + *) + DDERR_SURFACENOTATTACHED = HResult(_MAKE_DDHRESULT + 460); + {$EXTERNALSYM DDERR_SURFACENOTATTACHED} + +(* + * Height requested by DirectDraw is too large. + *) + DDERR_TOOBIGHEIGHT = HResult(_MAKE_DDHRESULT + 470); + {$EXTERNALSYM DDERR_TOOBIGHEIGHT} + +(* + * Size requested by DirectDraw is too large -- The individual height and + * width are OK. + *) + DDERR_TOOBIGSIZE = HResult(_MAKE_DDHRESULT + 480); + {$EXTERNALSYM DDERR_TOOBIGSIZE} + +(* + * Width requested by DirectDraw is too large. + *) + DDERR_TOOBIGWIDTH = HResult(_MAKE_DDHRESULT + 490); + {$EXTERNALSYM DDERR_TOOBIGWIDTH} + +(* + * Action not supported. + *) + DDERR_UNSUPPORTED = E_NOTIMPL; + {$EXTERNALSYM DDERR_UNSUPPORTED} + +(* + * FOURCC format requested is unsupported by DirectDraw + *) + DDERR_UNSUPPORTEDFORMAT = HResult(_MAKE_DDHRESULT + 510); + {$EXTERNALSYM DDERR_UNSUPPORTEDFORMAT} + +(* + * Bitmask in the pixel format requested is unsupported by DirectDraw + *) + DDERR_UNSUPPORTEDMASK = HResult(_MAKE_DDHRESULT + 520); + {$EXTERNALSYM DDERR_UNSUPPORTEDMASK} + +(* + * The specified stream contains invalid data + *) + DDERR_INVALIDSTREAM = HResult(_MAKE_DDHRESULT + 521); + {$EXTERNALSYM DDERR_INVALIDSTREAM} + +(* + * vertical blank is in progress + *) + DDERR_VERTICALBLANKINPROGRESS = HResult(_MAKE_DDHRESULT + 537); + {$EXTERNALSYM DDERR_VERTICALBLANKINPROGRESS} + +(* + * Informs DirectDraw that the previous Blt which is transfering information + * to or from this Surface is incomplete. + *) + DDERR_WASSTILLDRAWING = HResult(_MAKE_DDHRESULT + 540); + {$EXTERNALSYM DDERR_WASSTILLDRAWING} + + +(* + * The specified surface type requires specification of the COMPLEX flag + *) + DDERR_DDSCAPSCOMPLEXREQUIRED = HResult(_MAKE_DDHRESULT + 542); + {$EXTERNALSYM DDERR_DDSCAPSCOMPLEXREQUIRED} + + +(* + * Rectangle provided was not horizontally aligned on reqd. boundary + *) + DDERR_XALIGN = HResult(_MAKE_DDHRESULT + 560); + {$EXTERNALSYM DDERR_XALIGN} + +(* + * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver + * identifier. + *) + DDERR_INVALIDDIRECTDRAWGUID = HResult(_MAKE_DDHRESULT + 561); + {$EXTERNALSYM DDERR_INVALIDDIRECTDRAWGUID} + +(* + * A DirectDraw object representing this driver has already been created + * for this process. + *) + DDERR_DIRECTDRAWALREADYCREATED = HResult(_MAKE_DDHRESULT + 562); + {$EXTERNALSYM DDERR_DIRECTDRAWALREADYCREATED} + +(* + * A hardware only DirectDraw object creation was attempted but the driver + * did not support any hardware. + *) + DDERR_NODIRECTDRAWHW = HResult(_MAKE_DDHRESULT + 563); + {$EXTERNALSYM DDERR_NODIRECTDRAWHW} + +(* + * this process already has created a primary surface + *) + DDERR_PRIMARYSURFACEALREADYEXISTS = HResult(_MAKE_DDHRESULT + 564); + {$EXTERNALSYM DDERR_PRIMARYSURFACEALREADYEXISTS} + +(* + * software emulation not available. + *) + DDERR_NOEMULATION = HResult(_MAKE_DDHRESULT + 565); + {$EXTERNALSYM DDERR_NOEMULATION} + +(* + * region passed to Clipper::GetClipList is too small. + *) + DDERR_REGIONTOOSMALL = HResult(_MAKE_DDHRESULT + 566); + {$EXTERNALSYM DDERR_REGIONTOOSMALL} + +(* + * an attempt was made to set a clip list for a clipper objec that + * is already monitoring an hwnd. + *) + DDERR_CLIPPERISUSINGHWND = HResult(_MAKE_DDHRESULT + 567); + {$EXTERNALSYM DDERR_CLIPPERISUSINGHWND} + +(* + * No clipper object attached to surface object + *) + DDERR_NOCLIPPERATTACHED = HResult(_MAKE_DDHRESULT + 568); + {$EXTERNALSYM DDERR_NOCLIPPERATTACHED} + +(* + * Clipper notification requires an HWND or + * no HWND has previously been set as the CooperativeLevel HWND. + *) + DDERR_NOHWND = HResult(_MAKE_DDHRESULT + 569); + {$EXTERNALSYM DDERR_NOHWND} + +(* + * HWND used by DirectDraw CooperativeLevel has been subclassed, + * this prevents DirectDraw from restoring state. + *) + DDERR_HWNDSUBCLASSED = HResult(_MAKE_DDHRESULT + 570); + {$EXTERNALSYM DDERR_HWNDSUBCLASSED} + +(* + * The CooperativeLevel HWND has already been set. + * It can not be reset while the process has surfaces or palettes created. + *) + DDERR_HWNDALREADYSET = HResult(_MAKE_DDHRESULT + 571); + {$EXTERNALSYM DDERR_HWNDALREADYSET} + +(* + * No palette object attached to this surface. + *) + DDERR_NOPALETTEATTACHED = HResult(_MAKE_DDHRESULT + 572); + {$EXTERNALSYM DDERR_NOPALETTEATTACHED} + +(* + * No hardware support for 16 or 256 color palettes. + *) + DDERR_NOPALETTEHW = HResult(_MAKE_DDHRESULT + 573); + {$EXTERNALSYM DDERR_NOPALETTEHW} + +(* + * If a clipper object is attached to the source surface passed into a + * BltFast call. + *) + DDERR_BLTFASTCANTCLIP = HResult(_MAKE_DDHRESULT + 574); + {$EXTERNALSYM DDERR_BLTFASTCANTCLIP} + +(* + * No blter. + *) + DDERR_NOBLTHW = HResult(_MAKE_DDHRESULT + 575); + {$EXTERNALSYM DDERR_NOBLTHW} + +(* + * No DirectDraw ROP hardware. + *) + DDERR_NODDROPSHW = HResult(_MAKE_DDHRESULT + 576); + {$EXTERNALSYM DDERR_NODDROPSHW} + +(* + * returned when GetOverlayPosition is called on a hidden overlay + *) + DDERR_OVERLAYNOTVISIBLE = HResult(_MAKE_DDHRESULT + 577); + {$EXTERNALSYM DDERR_OVERLAYNOTVISIBLE} + +(* + * returned when GetOverlayPosition is called on a overlay that UpdateOverlay + * has never been called on to establish a destionation. + *) + DDERR_NOOVERLAYDEST = HResult(_MAKE_DDHRESULT + 578); + {$EXTERNALSYM DDERR_NOOVERLAYDEST} + +(* + * returned when the position of the overlay on the destionation is no longer + * legal for that destionation. + *) + DDERR_INVALIDPOSITION = HResult(_MAKE_DDHRESULT + 579); + {$EXTERNALSYM DDERR_INVALIDPOSITION} + +(* + * returned when an overlay member is called for a non-overlay surface + *) + DDERR_NOTAOVERLAYSURFACE = HResult(_MAKE_DDHRESULT + 580); + {$EXTERNALSYM DDERR_NOTAOVERLAYSURFACE} + +(* + * An attempt was made to set the cooperative level when it was already + * set to exclusive. + *) + DDERR_EXCLUSIVEMODEALREADYSET = HResult(_MAKE_DDHRESULT + 581); + {$EXTERNALSYM DDERR_EXCLUSIVEMODEALREADYSET} + +(* + * An attempt has been made to flip a surface that is not flippable. + *) + DDERR_NOTFLIPPABLE = HResult(_MAKE_DDHRESULT + 582); + {$EXTERNALSYM DDERR_NOTFLIPPABLE} + +(* + * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly + * created. + *) + DDERR_CANTDUPLICATE = HResult(_MAKE_DDHRESULT + 583); + {$EXTERNALSYM DDERR_CANTDUPLICATE} + +(* + * Surface was not locked. An attempt to unlock a surface that was not + * locked at all, or by this process, has been attempted. + *) + DDERR_NOTLOCKED = HResult(_MAKE_DDHRESULT + 584); + {$EXTERNALSYM DDERR_NOTLOCKED} + +(* + * Windows can not create any more DCs, or a DC was requested for a paltte-indexed + * surface when the surface had no palette AND the display mode was not palette-indexed + * (in this case DirectDraw cannot select a proper palette into the DC) + *) + DDERR_CANTCREATEDC = HResult(_MAKE_DDHRESULT + 585); + {$EXTERNALSYM DDERR_CANTCREATEDC} + +(* + * No DC was ever created for this surface. + *) + DDERR_NODC = HResult(_MAKE_DDHRESULT + 586); + {$EXTERNALSYM DDERR_NODC} + +(* + * This surface can not be restored because it was created in a different + * mode. + *) + DDERR_WRONGMODE = HResult(_MAKE_DDHRESULT + 587); + {$EXTERNALSYM DDERR_WRONGMODE} + +(* + * This surface can not be restored because it is an implicitly created + * surface. + *) + DDERR_IMPLICITLYCREATED = HResult(_MAKE_DDHRESULT + 588); + {$EXTERNALSYM DDERR_IMPLICITLYCREATED} + +(* + * The surface being used is not a palette-based surface + *) + DDERR_NOTPALETTIZED = HResult(_MAKE_DDHRESULT + 589); + {$EXTERNALSYM DDERR_NOTPALETTIZED} + + +(* + * The display is currently in an unsupported mode + *) + DDERR_UNSUPPORTEDMODE = HResult(_MAKE_DDHRESULT + 590); + {$EXTERNALSYM DDERR_UNSUPPORTEDMODE} + +(* + * Operation could not be carried out because there is no mip-map + * texture mapping hardware present or available. + *) + DDERR_NOMIPMAPHW = HResult(_MAKE_DDHRESULT + 591); + {$EXTERNALSYM DDERR_NOMIPMAPHW} + +(* + * The requested action could not be performed because the surface was of + * the wrong type. + *) + DDERR_INVALIDSURFACETYPE = HResult(_MAKE_DDHRESULT + 592); + {$EXTERNALSYM DDERR_INVALIDSURFACETYPE} + + +(* + * Device does not support optimized surfaces, therefore no video memory optimized surfaces + *) + DDERR_NOOPTIMIZEHW = HResult(_MAKE_DDHRESULT + 600); + {$EXTERNALSYM DDERR_NOOPTIMIZEHW} + +(* + * Surface is an optimized surface, but has not yet been allocated any memory + *) + DDERR_NOTLOADED = HResult(_MAKE_DDHRESULT + 601); + {$EXTERNALSYM DDERR_NOTLOADED} + +(* + * Attempt was made to create or set a device window without first setting + * the focus window + *) + DDERR_NOFOCUSWINDOW = HResult(_MAKE_DDHRESULT + 602); + {$EXTERNALSYM DDERR_NOFOCUSWINDOW} + +(* + * Attempt was made to set a palette on a mipmap sublevel + *) + DDERR_NOTONMIPMAPSUBLEVEL = HResult(_MAKE_DDHRESULT + 603); + {$EXTERNALSYM DDERR_NOTONMIPMAPSUBLEVEL} + +(* + * A DC has already been returned for this surface. Only one DC can be + * retrieved per surface. + *) + DDERR_DCALREADYCREATED = HResult(_MAKE_DDHRESULT + 620); + {$EXTERNALSYM DDERR_DCALREADYCREATED} + +(* + * An attempt was made to allocate non-local video memory from a device + * that does not support non-local video memory. + *) + DDERR_NONONLOCALVIDMEM = HResult(_MAKE_DDHRESULT + 630); + {$EXTERNALSYM DDERR_NONONLOCALVIDMEM} + +(* + * The attempt to page lock a surface failed. + *) + DDERR_CANTPAGELOCK = HResult(_MAKE_DDHRESULT + 640); + {$EXTERNALSYM DDERR_CANTPAGELOCK} + + +(* + * The attempt to page unlock a surface failed. + *) + DDERR_CANTPAGEUNLOCK = HResult(_MAKE_DDHRESULT + 660); + {$EXTERNALSYM DDERR_CANTPAGEUNLOCK} + +(* + * An attempt was made to page unlock a surface with no outstanding page locks. + *) + DDERR_NOTPAGELOCKED = HResult(_MAKE_DDHRESULT + 680); + {$EXTERNALSYM DDERR_NOTPAGELOCKED} + +(* + * There is more data available than the specified buffer size could hold + *) + DDERR_MOREDATA = HResult(_MAKE_DDHRESULT + 690); + {$EXTERNALSYM DDERR_MOREDATA} + +(* + * The data has expired and is therefore no longer valid. + *) + DDERR_EXPIRED = HResult(_MAKE_DDHRESULT + 691); + {$EXTERNALSYM DDERR_EXPIRED} + +(* + * The mode test has finished executing. + *) + DDERR_TESTFINISHED = HResult(_MAKE_DDHRESULT + 692); + {$EXTERNALSYM DDERR_TESTFINISHED} + +(* + * The mode test has switched to a new mode. + *) + DDERR_NEWMODE = HResult(_MAKE_DDHRESULT + 693); + {$EXTERNALSYM DDERR_NEWMODE} + +(* + * D3D has not yet been initialized. + *) + DDERR_D3DNOTINITIALIZED = HResult(_MAKE_DDHRESULT + 694); + {$EXTERNALSYM DDERR_D3DNOTINITIALIZED} + +(* + * The video port is not active + *) + DDERR_VIDEONOTACTIVE = HResult(_MAKE_DDHRESULT + 695); + {$EXTERNALSYM DDERR_VIDEONOTACTIVE} + +(* + * The monitor does not have EDID data. + *) + DDERR_NOMONITORINFORMATION = HResult(_MAKE_DDHRESULT + 696); + {$EXTERNALSYM DDERR_NOMONITORINFORMATION} + +(* + * The driver does not enumerate display mode refresh rates. + *) + DDERR_NODRIVERSUPPORT = HResult(_MAKE_DDHRESULT + 697); + {$EXTERNALSYM DDERR_NODRIVERSUPPORT} + +(* + * Surfaces created by one direct draw device cannot be used directly by + * another direct draw device. + *) + DDERR_DEVICEDOESNTOWNSURFACE = HResult(_MAKE_DDHRESULT + 699); + {$EXTERNALSYM DDERR_DEVICEDOESNTOWNSURFACE} + + + +(* + * An attempt was made to invoke an interface member of a DirectDraw object + * created by CoCreateInstance() before it was initialized. + *) + DDERR_NOTINITIALIZED = CO_E_NOTINITIALIZED; + {$EXTERNALSYM DDERR_NOTINITIALIZED} + +(* Alpha bit depth constants *) + + + +(* + * API's + *) + +const + DirectDrawDll = 'ddraw.dll'; + +type + HMonitor = THandle; + {$EXTERNALSYM HMonitor} + + TDDEnumCallbackA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar; + lpDriverName: PAnsiChar; lpContext: Pointer): BOOL; stdcall; + {$EXTERNALSYM TDDEnumCallbackA} + TDDEnumCallbackW = function (lpGUID: PGUID; lpDriverDescription: PWideChar; + lpDriverName: PWideChar; lpContext: Pointer): BOOL; stdcall; + {$EXTERNALSYM TDDEnumCallbackW} + TDDEnumCallback = function (lpGUID: PGUID; lpDriverDescription: PChar; + lpDriverName: PChar; lpContext: Pointer): BOOL; stdcall; + {$EXTERNALSYM TDDEnumCallback} + + TDDEnumCallbackExA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar; + lpDriverName: PAnsiChar; lpContext: Pointer; Monitor: HMonitor): BOOL; + stdcall; + {$EXTERNALSYM TDDEnumCallbackExA} + TDDEnumCallbackExW = function (lpGUID: PGUID; lpDriverDescription: PWideChar; + lpDriverName: PWideChar; lpContext: Pointer; Monitor: HMonitor): BOOL; + stdcall; + {$EXTERNALSYM TDDEnumCallbackExW} + TDDEnumCallbackEx = function (lpGUID: PGUID; lpDriverDescription: PChar; + lpDriverName: PChar; lpContext: Pointer; Monitor: HMonitor): BOOL; + stdcall; + {$EXTERNALSYM TDDEnumCallbackEx} + +function DirectDrawLoaded: Boolean; +function UnLoadDirectDraw: Boolean; +function LoadDirectDraw: Boolean; + +{$IFDEF DIRECTDRAW_DYNAMIC_LINK} +var + DirectDrawEnumerateA : function (lpCallback: TDDEnumCallbackA; + lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerateA} + DirectDrawEnumerateW : function (lpCallback: TDDEnumCallbackW; + lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerateW} + DirectDrawEnumerate : function (lpCallback: TDDEnumCallback; + lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerate} + + DirectDrawEnumerateExA : function (lpCallback: TDDEnumCallbackExA; + lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerateExA} + DirectDrawEnumerateExW : function (lpCallback: TDDEnumCallbackExW; + lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerateExW} + DirectDrawEnumerateEx : function (lpCallback: TDDEnumCallbackEx; + lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + {$EXTERNALSYM DirectDrawEnumerateEx} + + DirectDrawCreate : function (lpGUID: PGUID; + out lplpDD: IDirectDraw; + pUnkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectDrawCreate} + DirectDrawCreateEx : function (lpGUID: PGUID; + out lplpDD: IDirectDraw7; const iid: TGUID; + pUnkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectDrawCreateEx} + DirectDrawCreateClipper : function (dwFlags: DWORD; + out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; + {$EXTERNALSYM DirectDrawCreateClipper} +{$ELSE} + +function DirectDrawEnumerateA(lpCallback: TDDEnumCallbackA; lpContext: Pointer): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawEnumerateA} +function DirectDrawEnumerateW(lpCallback: TDDEnumCallbackW; lpContext: Pointer): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawEnumerateW} +function DirectDrawEnumerate(lpCallback: TDDEnumCallback; lpContext: Pointer): HResult; stdcall; + external DirectDrawDll name {$IFDEF UNICODE}'DirectDrawEnumerateW'{$ELSE}'DirectDrawEnumerateA'{$ENDIF}; +{$EXTERNALSYM DirectDrawEnumerate} + +function DirectDrawEnumerateExA(lpCallback: TDDEnumCallbackExA; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawEnumerateExA} +function DirectDrawEnumerateExW(lpCallback: TDDEnumCallbackExW; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawEnumerateExW} +function DirectDrawEnumerateEx(lpCallback: TDDEnumCallbackEx; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + external DirectDrawDll name {$IFDEF UNICODE}'DirectDrawEnumerateExW'{$ELSE}'DirectDrawEnumerateExA'{$ENDIF}; +{$EXTERNALSYM DirectDrawEnumerateEx} + +function DirectDrawCreate(lpGUID: PGUID; out lplpDD: IDirectDraw; + pUnkOuter: IUnknown): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawCreate} + +function DirectDrawCreateEx(lpGUID: PGUID; out lplpDD: IDirectDraw7; + const iid: TGUID; pUnkOuter: IUnknown): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawCreateEx} + +function DirectDrawCreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; external DirectDrawDll; +{$EXTERNALSYM DirectDrawCreateClipper} + +{$ENDIF} + +const +(* + * Flags for DirectDrawEnumerateEx + * DirectDrawEnumerateEx supercedes DirectDrawEnumerate. You must use GetProcAddress to + * obtain a function pointer (of type LPDIRECTDRAWENUMERATEEX) to DirectDrawEnumerateEx. + * By default, only the primary display device is enumerated. + * DirectDrawEnumerate is equivalent to DirectDrawEnumerate(,,DDENUM_NONDISPLAYDEVICES) + *) + +(* + * This flag causes enumeration of any GDI display devices which are part of + * the Windows Desktop + *) + DDENUM_ATTACHEDSECONDARYDEVICES = $00000001; + {$EXTERNALSYM DDENUM_ATTACHEDSECONDARYDEVICES} + +(* + * This flag causes enumeration of any GDI display devices which are not + * part of the Windows Desktop + *) + DDENUM_DETACHEDSECONDARYDEVICES = $00000002; + {$EXTERNALSYM DDENUM_DETACHEDSECONDARYDEVICES} + +(* + * This flag causes enumeration of non-display devices + *) + DDENUM_NONDISPLAYDEVICES = $00000004; + {$EXTERNALSYM DDENUM_NONDISPLAYDEVICES} + + + REGSTR_KEY_DDHW_DESCRIPTION = 'Description'; + {$EXTERNALSYM REGSTR_KEY_DDHW_DESCRIPTION} + REGSTR_KEY_DDHW_DRIVERNAME = 'DriverName'; + {$EXTERNALSYM REGSTR_KEY_DDHW_DRIVERNAME} + REGSTR_PATH_DDHW = 'Hardware\DirectDrawDrivers'; + {$EXTERNALSYM REGSTR_PATH_DDHW} + + DDCREATE_HARDWAREONLY = $00000001; + {$EXTERNALSYM DDCREATE_HARDWAREONLY} + DDCREATE_EMULATIONONLY = $00000002; + {$EXTERNALSYM DDCREATE_EMULATIONONLY} + +(* + * 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; + {$EXTERNALSYM DDGDI_GETHOSTIDENTIFIER} + +(* + * Macros for interpretting DDEVICEIDENTIFIER2.dwWHQLLevel + *) +function GET_WHQL_YEAR(dwWHQLLevel: DWORD): DWORD; +{$EXTERNALSYM GET_WHQL_YEAR} +function GET_WHQL_MONTH(dwWHQLLevel: DWORD): DWORD; +{$EXTERNALSYM GET_WHQL_MONTH} +function GET_WHQL_DAY(dwWHQLLevel: DWORD): DWORD; +{$EXTERNALSYM GET_WHQL_DAY} + + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dvp.h + * Content: DirectDrawVideoPort include file + * + ***************************************************************************) + +const +(* + * GUIDS used by DirectDrawVideoPort objects + *) + +(* + IID_IDDVideoPortContainer, + IID_IDirectDrawVideoPort, + IID_IDirectDrawVideoPortNotify + - are defined later in Delphi header +*) + + DDVPTYPE_E_HREFH_VREFH: TGUID = (D1:$54F39980;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_E_HREFH_VREFH} + DDVPTYPE_E_HREFH_VREFL: TGUID = (D1:$92783220;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_E_HREFH_VREFL} + DDVPTYPE_E_HREFL_VREFH: TGUID = (D1:$A07A02E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_E_HREFL_VREFH} + DDVPTYPE_E_HREFL_VREFL: TGUID = (D1:$E09C77E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_E_HREFL_VREFL} + DDVPTYPE_CCIR656: TGUID = (D1:$FCA326A0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_CCIR656} + DDVPTYPE_BROOKTREE: TGUID = (D1:$1352A560;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_BROOKTREE} + DDVPTYPE_PHILIPS: TGUID = (D1:$332CF160;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_PHILIPS} + + +(* + * These definitions are required to allow polymorphic structure members (i.e. those + * that are referred to both as DWORDs and as pointers) to resolve into a type + * of correct size to hold the largest of those two types (i.e. pointer) on 64 bit + * systems. For 32 bit environments, ULONG_PTR resolves to a DWORD. + *) +type + ULONG_PTR = DWORD; + {$EXTERNALSYM ULONG_PTR} + +(*============================================================================ + * + * DirectDraw Structures + * + * Various structures used to invoke DirectDraw. + * + *==========================================================================*) + +type + +(* + * DDVIDEOPORTCONNECT + *) + PDDVideoPortConnect = ^TDDVideoPortConnect; + _DDVIDEOPORTCONNECT = packed record + dwSize: DWORD; // size of the TDDVideoPortConnect structure + dwPortWidth: DWORD; // Width of the video port + guidTypeID: TGUID; // Description of video port connection + dwFlags: DWORD; // Connection flags + dwReserved1: ULONG_PTR; // Reserved, set to zero. + end; + {$EXTERNALSYM _DDVIDEOPORTCONNECT} + DDVIDEOPORTCONNECT = _DDVIDEOPORTCONNECT; + {$EXTERNALSYM DDVIDEOPORTCONNECT} + TDDVideoPortConnect = _DDVIDEOPORTCONNECT; + +(* + * DDVIDEOPORTCAPS + *) + PDDVideoPortCaps = ^TDDVideoPortCaps; + _DDVIDEOPORTCAPS = packed record + dwSize: DWORD; // size of the TDDVideoPortCaps structure + dwFlags: DWORD; // indicates which fields contain data + dwMaxWidth: DWORD; // max width of the video port field + dwMaxVBIWidth: DWORD; // max width of the VBI data + dwMaxHeight: DWORD; // max height of the video port field + dwVideoPortID: DWORD; // Video port ID (0 - (dwMaxVideoPorts -1)) + dwCaps: DWORD; // Video port capabilities + dwFX: DWORD; // More video port capabilities + dwNumAutoFlipSurfaces: DWORD; // Number of autoflippable surfaces + dwAlignVideoPortBoundary: DWORD; // Byte restriction of placement within the surface + dwAlignVideoPortPrescaleWidth: DWORD; // Byte restriction of width after prescaling + dwAlignVideoPortCropBoundary: DWORD; // Byte restriction of left cropping + dwAlignVideoPortCropWidth: DWORD; // Byte restriction of cropping width + dwPreshrinkXStep: DWORD; // Width can be shrunk in steps of 1/x + dwPreshrinkYStep: DWORD; // Height can be shrunk in steps of 1/x + dwNumVBIAutoFlipSurfaces: DWORD; // Number of VBI autoflippable surfaces allowed + dwNumPreferredAutoflip: DWORD; // Optimal number of autoflippable surfaces for hardware + wNumFilterTapsX: Word; // Number of taps the prescaler uses in the X direction (0 - no prescale, 1 - replication, etc.) + wNumFilterTapsY: Word; // Number of taps the prescaler uses in the Y direction (0 - no prescale, 1 - replication, etc.) + end; + {$EXTERNALSYM _DDVIDEOPORTCAPS} + DDVIDEOPORTCAPS = _DDVIDEOPORTCAPS; + {$EXTERNALSYM DDVIDEOPORTCAPS} + TDDVideoPortCaps = _DDVIDEOPORTCAPS; + +const +(* + * The dwMaxWidth and dwMaxVBIWidth members are valid + *) + DDVPD_WIDTH = $00000001; + {$EXTERNALSYM DDVPD_WIDTH} + +(* + * The dwMaxHeight member is valid + *) + DDVPD_HEIGHT = $00000002; + {$EXTERNALSYM DDVPD_HEIGHT} + +(* + * The dwVideoPortID member is valid + *) + DDVPD_ID = $00000004; + {$EXTERNALSYM DDVPD_ID} + +(* + * The dwCaps member is valid + *) + DDVPD_CAPS = $00000008; + {$EXTERNALSYM DDVPD_CAPS} + +(* + * The dwFX member is valid + *) + DDVPD_FX = $00000010; + {$EXTERNALSYM DDVPD_FX} + +(* + * The dwNumAutoFlipSurfaces member is valid + *) + DDVPD_AUTOFLIP = $00000020; + {$EXTERNALSYM DDVPD_AUTOFLIP} + +(* + * All of the alignment members are valid + *) + DDVPD_ALIGN = $00000040; + {$EXTERNALSYM DDVPD_ALIGN} + +(* + * The dwNumPreferredAutoflip member is valid + *) + DDVPD_PREFERREDAUTOFLIP = $00000080; + {$EXTERNALSYM DDVPD_PREFERREDAUTOFLIP} + +(* + * The wNumFilterTapsX and wNumFilterTapsY fields are valid + *) + DDVPD_FILTERQUALITY = $00000100; + {$EXTERNALSYM DDVPD_FILTERQUALITY} + +type +(* + * DDVIDEOPORTDESC + *) + PDDVideoPortDesc = ^TDDVideoPortDesc; + _DDVIDEOPORTDESC = packed record + dwSize: DWORD; // size of the TDDVideoPortDesc structure + dwFieldWidth: DWORD; // width of the video port field + dwVBIWidth: DWORD; // width of the VBI data + dwFieldHeight: DWORD; // height of the video port field + dwMicrosecondsPerField: DWORD; // Microseconds per video field + dwMaxPixelsPerSecond: DWORD; // Maximum pixel rate per second + dwVideoPortID: DWORD; // Video port ID (0 - (dwMaxVideoPorts -1)) + dwReserved1: DWORD; // Reserved for future use - set to zero (struct padding) + VideoPortType: TDDVideoPortConnect; // Description of video port connection + dwReserved2: DWORD; // Reserved for future use - set to zero + dwReserved3: DWORD; // Reserved for future use - set to zero + end; + {$EXTERNALSYM _DDVIDEOPORTDESC} + DDVIDEOPORTDESC = _DDVIDEOPORTDESC; + {$EXTERNALSYM DDVIDEOPORTDESC} + TDDVideoPortDesc = _DDVIDEOPORTDESC; + +(* + * DDVIDEOPORTINFO + *) + PDDVideoPortInfo = ^TDDVideoPortInfo; + _DDVIDEOPORTINFO = packed record + dwSize: DWORD; // Size of the structure + dwOriginX: DWORD; // Placement of the video data within the surface. + dwOriginY: DWORD; // Placement of the video data within the surface. + dwVPFlags: DWORD; // Video port options + rCrop: TRect; // Cropping rectangle (optional). + dwPrescaleWidth: DWORD; // Determines pre-scaling/zooming in the X direction (optional). + dwPrescaleHeight: DWORD; // Determines pre-scaling/zooming in the Y direction (optional). + lpddpfInputFormat: PDDPixelFormat; // Video format written to the video port + lpddpfVBIInputFormat: PDDPixelFormat; // Input format of the VBI data + lpddpfVBIOutputFormat: PDDPixelFormat; // Output format of the data + dwVBIHeight: DWORD; // Specifies the number of lines of data within the vertical blanking interval. + dwReserved1: DWORD; // Reserved for future use - set to zero + dwReserved2: DWORD; // Reserved for future use - set to zero + end; + {$EXTERNALSYM _DDVIDEOPORTINFO} + DDVIDEOPORTINFO = _DDVIDEOPORTINFO; + {$EXTERNALSYM DDVIDEOPORTINFO} + TDDVideoPortInfo = _DDVIDEOPORTINFO; + +(* + * DDVIDEOPORTBANDWIDTH + *) + PDDVideoPortBandWidth = ^TDDVideoPortBandWidth; + _DDVIDEOPORTBANDWIDTH = packed record + dwSize: DWORD; // Size of the structure + dwCaps: DWORD; + dwOverlay: DWORD; // Zoom factor at which overlay is supported + dwColorkey: DWORD; // Zoom factor at which overlay w/ colorkey is supported + dwYInterpolate: DWORD; // Zoom factor at which overlay w/ Y interpolation is supported + dwYInterpAndColorkey: DWORD; // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported + dwReserved1: DWORD; // Reserved for future use - set to zero + dwReserved2: DWORD; // Reserved for future use - set to zero + end; + {$EXTERNALSYM _DDVIDEOPORTBANDWIDTH} + DDVIDEOPORTBANDWIDTH = _DDVIDEOPORTBANDWIDTH; + {$EXTERNALSYM DDVIDEOPORTBANDWIDTH} + TDDVideoPortBandWidth = _DDVIDEOPORTBANDWIDTH; + +(* + * DDVIDEOPORTSTATUS + *) + PDDVideoPortStatus = ^TDDVideoPortStatus; + _DDVIDEOPORTSTATUS = record + dwSize: DWORD; // Size of the structure + bInUse: BOOL; // TRUE if video port is currently being used + dwFlags: DWORD; // Currently not used + dwReserved1: DWORD; // Reserved for future use + VideoPortType: TDDVideoPortConnect; // Information about the connection + dwReserved2: DWORD; // Reserved for future use + dwReserved3: DWORD; // Reserved for future use + end; + {$EXTERNALSYM _DDVIDEOPORTSTATUS} + DDVIDEOPORTSTATUS = _DDVIDEOPORTSTATUS; + {$EXTERNALSYM DDVIDEOPORTSTATUS} + TDDVideoPortStatus = _DDVIDEOPORTSTATUS; + +(* + * DDVIDEOPORTNOTIFY + *) + PDDVideoPortNotify = ^TDDVideoPortNotify; + _DDVIDEOPORTNOTIFY = packed record + ApproximateTimeStamp: Int64; // Timestamp in the event notification + lField: Longint; // 0 if even, 1 if odd, -1 if unknown + dwSurfaceIndex: Longword; // Index in the surface chain of the surface that received the sample + lDone: Longint; // Call InterlockedIncrement on this when done with sample + end; + {$EXTERNALSYM _DDVIDEOPORTNOTIFY} + DDVIDEOPORTNOTIFY = _DDVIDEOPORTNOTIFY; + {$EXTERNALSYM DDVIDEOPORTNOTIFY} + TDDVideoPortNotify = _DDVIDEOPORTNOTIFY; + + +(*============================================================================ + * + * Video Port Flags + * + * All flags are bit flags. + * + *==========================================================================*) +const +(**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTCONNECT / TDDVideoPortConnect FLAGS + * + ****************************************************************************) + +(* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of double clocking the data. + * When this is set by the client, this indicates that the video port + * should enable double clocking. This flag is only valid with external + * syncs. + *) + DDVPCONNECT_DOUBLECLOCK = $00000001; + {$EXTERNALSYM DDVPCONNECT_DOUBLECLOCK} + +(* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of using an external VACT + * signal. When this is set by the client, this indicates that the + * video port should use the external VACT signal. + *) + DDVPCONNECT_VACT = $00000002; + {$EXTERNALSYM DDVPCONNECT_VACT} + +(* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of treating even fields + * like odd fields and visa versa. When this is set by the client, + * this indicates that the video port should treat even fields like odd + * fields. + *) + DDVPCONNECT_INVERTPOLARITY = $00000004; + {$EXTERNALSYM DDVPCONNECT_INVERTPOLARITY} + +(* + * Indicates that any data written to the video port during the VREF + * period will not be written into the frame buffer. This flag is read only. + *) + DDVPCONNECT_DISCARDSVREFDATA = $00000008; + {$EXTERNALSYM DDVPCONNECT_DISCARDSVREFDATA} + +(* + * When this is set be the driver and passed to the client, this + * indicates that the device will write half lines into the frame buffer + * if half lines are provided by the decoder. If this is set by the client, + * this indicates that the decoder will be supplying half lines. + *) + DDVPCONNECT_HALFLINE = $00000010; + {$EXTERNALSYM DDVPCONNECT_HALFLINE} + +(* + * Indicates that the signal is interlaced. This flag is only + * set by the client. + *) + DDVPCONNECT_INTERLACED = $00000020; + {$EXTERNALSYM DDVPCONNECT_INTERLACED} + +(* + * Indicates that video port is shareable and that this video port + * will use the even fields. This flag is only set by the client. + *) + DDVPCONNECT_SHAREEVEN = $00000040; + {$EXTERNALSYM DDVPCONNECT_SHAREEVEN} + +(* + * Indicates that video port is shareable and that this video port + * will use the odd fields. This flag is only set by the client. + *) + DDVPCONNECT_SHAREODD = $00000080; + {$EXTERNALSYM DDVPCONNECT_SHAREODD} + +(**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTDESC / TDDVideoPortDesc CAPS + * + ****************************************************************************) + +(* + * Flip can be performed automatically to avoid tearing. + *) + DDVPCAPS_AUTOFLIP = $00000001; + {$EXTERNALSYM DDVPCAPS_AUTOFLIP} + +(* + * Supports interlaced video + *) + DDVPCAPS_INTERLACED = $00000002; + {$EXTERNALSYM DDVPCAPS_INTERLACED} + +(* + * Supports non-interlaced video + *) + DDVPCAPS_NONINTERLACED = $00000004; + {$EXTERNALSYM DDVPCAPS_NONINTERLACED} + +(* + * Indicates that the device can return whether the current field + * of an interlaced signal is even or odd. + *) + DDVPCAPS_READBACKFIELD = $00000008; + {$EXTERNALSYM DDVPCAPS_READBACKFIELD} + +(* + * Indicates that the device can return the current line of video + * being written into the frame buffer. + *) + DDVPCAPS_READBACKLINE = $00000010; + {$EXTERNALSYM DDVPCAPS_READBACKLINE} + +(* + * Allows two gen-locked video streams to share a single video port, + * where one stream uses the even fields and the other uses the odd + * fields. Separate parameters (including address, scaling, + * cropping, etc.) are maintained for both fields.) + *) + DDVPCAPS_SHAREABLE = $00000020; + {$EXTERNALSYM DDVPCAPS_SHAREABLE} + +(* + * Even fields of video can be automatically discarded. + *) + DDVPCAPS_SKIPEVENFIELDS = $00000040; + {$EXTERNALSYM DDVPCAPS_SKIPEVENFIELDS} + +(* + * Odd fields of video can be automatically discarded. + *) + DDVPCAPS_SKIPODDFIELDS = $00000080; + {$EXTERNALSYM DDVPCAPS_SKIPODDFIELDS} + +(* + * Indicates that the device is capable of driving the graphics + * VSYNC with the video port VSYNC. + *) + DDVPCAPS_SYNCMASTER = $00000100; + {$EXTERNALSYM DDVPCAPS_SYNCMASTER} + +(* + * Indicates that data within the vertical blanking interval can + * be written to a different surface. + *) + DDVPCAPS_VBISURFACE = $00000200; + {$EXTERNALSYM DDVPCAPS_VBISURFACE} + +(* + * Indicates that the video port can perform color operations + * on the incoming data before it is written to the frame buffer. + *) + DDVPCAPS_COLORCONTROL = $00000400; + {$EXTERNALSYM DDVPCAPS_COLORCONTROL} + +(* + * Indicates that the video port can accept VBI data in a different + * width or format than the regular video data. + *) + DDVPCAPS_OVERSAMPLEDVBI = $00000800; + {$EXTERNALSYM DDVPCAPS_OVERSAMPLEDVBI} + +(* + * Indicates that the video port can write data directly to system memory + *) + DDVPCAPS_SYSTEMMEMORY = $00001000; + {$EXTERNALSYM DDVPCAPS_SYSTEMMEMORY} + +(* + * Indicates that the VBI and video portions of the video stream can + * be controlled by an independent processes. + *) + DDVPCAPS_VBIANDVIDEOINDEPENDENT = $00002000; + {$EXTERNALSYM DDVPCAPS_VBIANDVIDEOINDEPENDENT} + +(* + * Indicates that the video port contains high quality hardware + * de-interlacing hardware that should be used instead of the + * bob/weave algorithms. + *) + DDVPCAPS_HARDWAREDEINTERLACE = $00004000; + {$EXTERNALSYM DDVPCAPS_HARDWAREDEINTERLACE} + + +(**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTDESC / TDDVideoPortDesc FX + * + ****************************************************************************) + +(* + * Limited cropping is available to crop out the vertical interval data. + *) + DDVPFX_CROPTOPDATA = $00000001; + {$EXTERNALSYM DDVPFX_CROPTOPDATA} + +(* + * Incoming data can be cropped in the X direction before it is written + * to the surface. + *) + DDVPFX_CROPX = $00000002; + {$EXTERNALSYM DDVPFX_CROPX} + +(* + * Incoming data can be cropped in the Y direction before it is written + * to the surface. + *) + DDVPFX_CROPY = $00000004; + {$EXTERNALSYM DDVPFX_CROPY} + +(* + * Supports interleaving interlaced fields in memory. + *) + DDVPFX_INTERLEAVE = $00000008; + {$EXTERNALSYM DDVPFX_INTERLEAVE} + +(* + * Supports mirroring left to right as the video data is written + * into the frame buffer. + *) + DDVPFX_MIRRORLEFTRIGHT = $00000010; + {$EXTERNALSYM DDVPFX_MIRRORLEFTRIGHT} + +(* + * Supports mirroring top to bottom as the video data is written + * into the frame buffer. + *) + DDVPFX_MIRRORUPDOWN = $00000020; + {$EXTERNALSYM DDVPFX_MIRRORUPDOWN} + +(* + * Data can be arbitrarily shrunk in the X direction before it + * is written to the surface. + *) + DDVPFX_PRESHRINKX = $00000040; + {$EXTERNALSYM DDVPFX_PRESHRINKX} + +(* + * Data can be arbitrarily shrunk in the Y direction before it + * is written to the surface. + *) + DDVPFX_PRESHRINKY = $00000080; + {$EXTERNALSYM DDVPFX_PRESHRINKY} + +(* + * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the X + * direction before it is written to the surface. + *) + DDVPFX_PRESHRINKXB = $00000100; + {$EXTERNALSYM DDVPFX_PRESHRINKXB} + +(* + * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the Y + * direction before it is written to the surface. + *) + DDVPFX_PRESHRINKYB = $00000200; + {$EXTERNALSYM DDVPFX_PRESHRINKYB} + +(* + * Data can be shrunk in increments of 1/x in the X direction + * (where X is specified in the TDDVideoPortCaps.dwPreshrinkXStep) + * before it is written to the surface. + *) + DDVPFX_PRESHRINKXS = $00000400; + {$EXTERNALSYM DDVPFX_PRESHRINKXS} + +(* + * Data can be shrunk in increments of 1/x in the Y direction + * (where X is specified in the TDDVideoPortCaps.dwPreshrinkYStep) + * before it is written to the surface. + *) + DDVPFX_PRESHRINKYS = $00000800; + {$EXTERNALSYM DDVPFX_PRESHRINKYS} + +(* + * Data can be arbitrarily stretched in the X direction before + * it is written to the surface. + *) + DDVPFX_PRESTRETCHX = $00001000; + {$EXTERNALSYM DDVPFX_PRESTRETCHX} + +(* + * Data can be arbitrarily stretched in the Y direction before + * it is written to the surface. + *) + DDVPFX_PRESTRETCHY = $00002000; + {$EXTERNALSYM DDVPFX_PRESTRETCHY} + +(* + * Data can be integer stretched in the X direction before it is + * written to the surface. + *) + DDVPFX_PRESTRETCHXN = $00004000; + {$EXTERNALSYM DDVPFX_PRESTRETCHXN} + +(* + * Data can be integer stretched in the Y direction before it is + * written to the surface. + *) + DDVPFX_PRESTRETCHYN = $00008000; + {$EXTERNALSYM DDVPFX_PRESTRETCHYN} + +(* + * Indicates that data within the vertical blanking interval can + * be converted independently of the remaining video data. + *) + DDVPFX_VBICONVERT = $00010000; + {$EXTERNALSYM DDVPFX_VBICONVERT} + +(* + * Indicates that scaling can be disabled for data within the + * vertical blanking interval. + *) + DDVPFX_VBINOSCALE = $00020000; + {$EXTERNALSYM DDVPFX_VBINOSCALE} + +(* + * Indicates that the video data can ignore the left and right + * cropping coordinates when cropping oversampled VBI data. + *) + DDVPFX_IGNOREVBIXCROP = $00040000; + {$EXTERNALSYM DDVPFX_IGNOREVBIXCROP} + +(* + * Indicates that interleaving can be disabled for data within the + * vertical blanking interval. + *) + DDVPFX_VBINOINTERLEAVE = $00080000; + {$EXTERNALSYM DDVPFX_VBINOINTERLEAVE} + + +(**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTINFO / TDDVideoPortInfo FLAGS + * + ****************************************************************************) + +(* + * Perform automatic flipping. Auto-flipping is performed between + * the overlay surface that was attached to the video port using + * IDirectDrawVideoPort::AttachSurface and the overlay surfaces that + * are attached to the surface via the IDirectDrawSurface::AttachSurface + * method. The flip order is the order in which the overlay surfaces + * were. attached. + *) + DDVP_AUTOFLIP = $00000001; + {$EXTERNALSYM DDVP_AUTOFLIP} + +(* + * Perform conversion using the ddpfOutputFormat information. + *) + DDVP_CONVERT = $00000002; + {$EXTERNALSYM DDVP_CONVERT} + +(* + * Perform cropping using the specified rectangle. + *) + DDVP_CROP = $00000004; + {$EXTERNALSYM DDVP_CROP} + +(* + * Indicates that interlaced fields should be interleaved in memory. + *) + DDVP_INTERLEAVE = $00000008; + {$EXTERNALSYM DDVP_INTERLEAVE} + +(* + * Indicates that the data should be mirrored left to right as it's + * written into the frame buffer. + *) + DDVP_MIRRORLEFTRIGHT = $00000010; + {$EXTERNALSYM DDVP_MIRRORLEFTRIGHT} + +(* + * Indicates that the data should be mirrored top to bottom as it's + * written into the frame buffer. + *) + DDVP_MIRRORUPDOWN = $00000020; + {$EXTERNALSYM DDVP_MIRRORUPDOWN} + +(* + * Perform pre-scaling/zooming based on the pre-scale parameters. + *) + DDVP_PRESCALE = $00000040; + {$EXTERNALSYM DDVP_PRESCALE} + +(* + * Ignore input of even fields. + *) + DDVP_SKIPEVENFIELDS = $00000080; + {$EXTERNALSYM DDVP_SKIPEVENFIELDS} + +(* + * Ignore input of odd fields. + *) + DDVP_SKIPODDFIELDS = $00000100; + {$EXTERNALSYM DDVP_SKIPODDFIELDS} + +(* + * Drive the graphics VSYNCs using the video port VYSNCs. + *) + DDVP_SYNCMASTER = $00000200; + {$EXTERNALSYM DDVP_SYNCMASTER} + +(* + * The ddpfVBIOutputFormatFormat member contains data that should be used + * to convert the data within the vertical blanking interval. + *) + DDVP_VBICONVERT = $00000400; + {$EXTERNALSYM DDVP_VBICONVERT} + +(* + * Indicates that data within the vertical blanking interval + * should not be scaled. + *) + DDVP_VBINOSCALE = $00000800; + {$EXTERNALSYM DDVP_VBINOSCALE} + +(* + * Indicates that these bob/weave decisions should not be + * overriden by other interfaces. + *) + DDVP_OVERRIDEBOBWEAVE = $00001000; + {$EXTERNALSYM DDVP_OVERRIDEBOBWEAVE} + +(* + * Indicates that the video data should ignore the left and right + * cropping coordinates when cropping the VBI data. + *) + DDVP_IGNOREVBIXCROP = $00002000; + {$EXTERNALSYM DDVP_IGNOREVBIXCROP} + +(* + * Indicates that interleaving can be disabled for data within the + * vertical blanking interval. + *) + DDVP_VBINOINTERLEAVE = $00004000; + {$EXTERNALSYM DDVP_VBINOINTERLEAVE} + +(* + * Indicates that the video port should use the hardware + * de-interlacing hardware. + *) + DDVP_HARDWAREDEINTERLACE = $00008000; + {$EXTERNALSYM DDVP_HARDWAREDEINTERLACE} + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS + * + ****************************************************************************) + +(* + * Return formats for the video data + *) + DDVPFORMAT_VIDEO = $00000001; + {$EXTERNALSYM DDVPFORMAT_VIDEO} + +(* + * Return formats for the VBI data + *) + DDVPFORMAT_VBI = $00000002; + {$EXTERNALSYM DDVPFORMAT_VBI} + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS + * + ****************************************************************************) + +(* + * Surface should receive video data (and VBI data if a surface + * is not explicitly attached for that purpose) + *) + DDVPTARGET_VIDEO = $00000001; + {$EXTERNALSYM DDVPTARGET_VIDEO} + +(* + * Surface should receive VBI data + *) + DDVPTARGET_VBI = $00000002; + {$EXTERNALSYM DDVPTARGET_VBI} + + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS + * + ****************************************************************************) + +(* + * Waits until the beginning of the next VSYNC + *) + DDVPWAIT_BEGIN = $00000001; + {$EXTERNALSYM DDVPWAIT_BEGIN} + +(* + * Waits until the end of the next/current VSYNC + *) + DDVPWAIT_END = $00000002; + {$EXTERNALSYM DDVPWAIT_END} + +(* + * Waits until the beginning of the specified line + *) + DDVPWAIT_LINE = $00000003; + {$EXTERNALSYM DDVPWAIT_LINE} + +(**************************************************************************** + * + * DIRECTDRAWVIDEOPORT FLIP FLAGS + * + ****************************************************************************) + +(* + * Flips the normal video surface + *) + DDVPFLIP_VIDEO = $00000001; + {$EXTERNALSYM DDVPFLIP_VIDEO} + +(* + * Flips the VBI surface + *) + DDVPFLIP_VBI = $00000002; + {$EXTERNALSYM DDVPFLIP_VBI} + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES + * + ****************************************************************************) + +(* + * No video signal is present at the video port + *) + DDVPSQ_NOSIGNAL = $00000001; + {$EXTERNALSYM DDVPSQ_NOSIGNAL} + +(* + * A valid video signal is present at the video port + *) + DDVPSQ_SIGNALOK = $00000002; + {$EXTERNALSYM DDVPSQ_SIGNALOK} + +(**************************************************************************** + * + * VIDEOPORTBANDWIDTH Flags + * + ****************************************************************************) + +(* + * The specified height/width refer to the size of the video port data + * written into memory, after prescaling has occured. + *) + DDVPB_VIDEOPORT = $00000001; + {$EXTERNALSYM DDVPB_VIDEOPORT} + +(* + * The specified height/width refer to the source size of the overlay. + *) + DDVPB_OVERLAY = $00000002; + {$EXTERNALSYM DDVPB_OVERLAY} + +(* + * This is a query for the device to return which caps this device requires. + *) + DDVPB_TYPE = $00000004; + {$EXTERNALSYM DDVPB_TYPE} + +(**************************************************************************** + * + * VIDEOPORTBANDWIDTH Caps + * + ****************************************************************************) + +(* + * The bandwidth for this device is dependant on the overlay source size. + *) + DDVPBCAPS_SOURCE = $00000001; + {$EXTERNALSYM DDVPBCAPS_SOURCE} + +(* + * The bandwidth for this device is dependant on the overlay destination + * size. + *) + DDVPBCAPS_DESTINATION = $00000002; + {$EXTERNALSYM DDVPBCAPS_DESTINATION} + +(**************************************************************************** + * + * DDVIDEOPORTCONTAINER CreateVideoPort flags + * + ****************************************************************************) + +(* + * The process only wants to control the VBI portion of the video stream. + *) + DDVPCREATE_VBIONLY = $00000001; + {$EXTERNALSYM DDVPCREATE_VBIONLY} + +(* + * The process only wants to control the non-VBI (video) portion of + * the video stream. + *) + DDVPCREATE_VIDEOONLY = $00000002; + {$EXTERNALSYM DDVPCREATE_VIDEOONLY} + +(**************************************************************************** + * + * DDVIDEOPORTSTATUS flags + * + ****************************************************************************) + +(* + * The video port interface is only controlling the VBI portion of the + * video stream + *) + DDVPSTATUS_VBIONLY = $00000001; + {$EXTERNALSYM DDVPSTATUS_VBIONLY} + +(* + * The video port interface is only controlling the video portion of the + * video stream + *) + DDVPSTATUS_VIDEOONLY = $00000002; + {$EXTERNALSYM DDVPSTATUS_VIDEOONLY} + + +type +(* + * API's + *) + + TDDEnumVideoCallback = function (lpTDDVideoPortCaps: PDDVideoPortCaps; + lpContext: Pointer): HResult; stdcall; + {$EXTERNALSYM TDDEnumVideoCallback} + +(* + * INTERACES FOLLOW: + * IDirectDrawVideoPort + * IVideoPort + *) + IDirectDrawVideoPort = interface; + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawVideoPort;'} + {$EXTERNALSYM IDirectDrawVideoPort} + +(* + * IDirectDrawVideoPortContainer + *) + {$HPPEMIT 'typedef System::DelphiInterface _di_IDDVideoPortContainer;'} + {$EXTERNALSYM IDDVideoPortContainer} + IDDVideoPortContainer = interface(IUnknown) + ['{6C142760-A733-11CE-A521-0020AF0BE560}'] + (*** IDDVideoPortContainer methods ***) + function CreateVideoPort(dwFlags: DWORD; var lpTDDVideoPortDesc: + TDDVideoPortDesc; var lplpDDVideoPort: IDirectDrawVideoPort; + pUnkOuter: IUnknown): HResult; stdcall; + function EnumVideoPorts(dwFlags: DWORD; + lpTDDVideoPortCaps: PDDVideoPortCaps; lpContext: Pointer; + lpEnumVideoCallback: TDDEnumVideoCallback): HResult; stdcall; + function GetVideoPortConnectInfo(dwPortId: DWORD; var lpNumEntries: DWORD; + lpConnectInfo: PDDVideoPortConnect): HResult; stdcall; + function QueryVideoPortStatus(dwPortId: DWORD; + var lpVPStatus: TDDVideoPortStatus): HResult; stdcall; + end; + +(* + * IDirectDrawVideoPort + *) + IDirectDrawVideoPort = interface(IUnknown) + ['{B36D93E0-2B43-11CF-A2DE-00AA00B93356}'] + (*** IDirectDrawVideoPort methods ***) + function Flip(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD): HResult; stdcall; + function GetBandwidthInfo(var lpddpfFormat: TDDPixelFormat; + dwWidth: DWORD; dwHeight: DWORD; dwFlags: DWORD; + var lpBandwidth: TDDVideoPortBandWidth): HResult; stdcall; + function GetColorControls(var lpColorControl: TDDColorControl): HResult; stdcall; + function GetInputFormats(var lpNumFormats: DWORD; var lpFormats: + TDDPixelFormat; dwFlags: DWORD): HResult; stdcall; + function GetOutputFormats(var lpInputFormat: TDDPixelFormat; + var lpNumFormats: DWORD; lpFormats: PDDPixelFormat; dwFlags: DWORD): + HResult; stdcall; + function GetFieldPolarity(var lpbVideoField: BOOL): HResult; stdcall; + function GetVideoLine(var lpdwLine: DWORD): HResult; stdcall; + function GetVideoSignalStatus(varlpdwStatus: DWORD): HResult; stdcall; + function SetColorControls(var lpColorControl: TDDColorControl): HResult; stdcall; + function SetTargetSurface(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD): + HResult; stdcall; + function StartVideo(var lpVideoInfo: TDDVideoPortInfo): HResult; stdcall; + function StopVideo: HResult; stdcall; + function UpdateVideo(var lpVideoInfo: TDDVideoPortInfo): HResult; stdcall; + function WaitForSync(dwFlags: DWORD; dwLine: DWORD; dwTimeout: DWORD): + HResult; stdcall; + end; + + IID_IDDVideoPortContainer = IDDVideoPortContainer; + {$EXTERNALSYM IID_IDDVideoPortContainer} + IID_IDirectDrawVideoPort = IDirectDrawVideoPort; + {$EXTERNALSYM IID_IDirectDrawVideoPort} + +(* + * IDirectDrawVideoPort + *) + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawVideoPortNotify;'} + {$EXTERNALSYM IDirectDrawVideoPortNotify} + IDirectDrawVideoPortNotify = interface(IUnknown) + ['{6C142760-A733-11CE-A521-0020AF0BE560}'] + (*** IVideoPort methods ***) + function AcquireNotification(hEvent: THandle; const params: TDDVideoPortNotify): HResult; stdcall; + function ReleaseNotification(hEvent: THandle): HResult; stdcall; + end; + + +var + DDrawDLL : HMODULE = 0; + +function DDErrorString(Value: HResult): String; + +implementation + +//#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) +function MAKE_DDHRESULT(Code: DWORD): HResult; +begin + Result:= MakeResult(1, _FACDD, code); +end; + +//#define GET_WHQL_YEAR( dwWHQLLevel ) \ +// ( (dwWHQLLevel) / 0x10000 ) +function GET_WHQL_YEAR(dwWHQLLevel: DWORD): DWORD; +begin + Result := (dwWHQLLevel) div $10000; +end; + +//#define GET_WHQL_MONTH( dwWHQLLevel ) \ +// ( ( (dwWHQLLevel) / 0x100 ) & 0x00ff ) +function GET_WHQL_MONTH(dwWHQLLevel: DWORD): DWORD; +begin + Result := ((dwWHQLLevel) div $100) and $00ff; +end; + +//#define GET_WHQL_DAY( dwWHQLLevel ) \ +// ( (dwWHQLLevel) & 0xff ) +function GET_WHQL_DAY(dwWHQLLevel: DWORD): DWORD; +begin + Result := (dwWHQLLevel) and $ff; +end; + + +function MAKEFOURCC(ch0, ch1, ch2, ch3: Char): DWORD; +begin + Result := DWORD(Byte(ch0) shl 0) or + DWORD(Byte(ch1) shl 8) or + DWORD(Byte(ch2) shl 16) or + DWORD(Byte(ch3) shl 24); +end; + +function DDErrorString(Value: HResult): String; +begin + case Value of + DD_OK: Result := 'The request completed successfully.'; + DDERR_ALREADYINITIALIZED: Result := 'This object is already initialized.'; + DDERR_BLTFASTCANTCLIP: Result := ' if a clipper object is attached to the source surface passed into a BltFast call.'; + DDERR_CANNOTATTACHSURFACE: Result := 'This surface can not be attached to the requested surface.'; + DDERR_CANNOTDETACHSURFACE: Result := 'This surface can not be detached from the requested surface.'; + DDERR_CANTCREATEDC: Result := 'Windows can not create any more DCs.'; + DDERR_CANTDUPLICATE: Result := 'Cannot duplicate primary & 3D surfaces, or surfaces that are implicitly created.'; + DDERR_CLIPPERISUSINGHWND: Result := 'An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.'; + DDERR_COLORKEYNOTSET: Result := 'No src color key specified for this operation.'; + DDERR_CURRENTLYNOTAVAIL: Result := 'Support is currently not available.'; + DDERR_DIRECTDRAWALREADYCREATED: Result := 'A DirectDraw object representing this driver has already been created for this process.'; + DDERR_EXCEPTION: Result := 'An exception was encountered while performing the requested operation.'; + DDERR_EXCLUSIVEMODEALREADYSET: Result := 'An attempt was made to set the cooperative level when it was already set to exclusive.'; + DDERR_GENERIC: Result := 'Generic failure.'; + DDERR_HEIGHTALIGN: Result := 'Height of rectangle provided is not a multiple of reqd alignment.'; + DDERR_HWNDALREADYSET: Result := 'The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created.'; + DDERR_HWNDSUBCLASSED: Result := 'HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state.'; + DDERR_IMPLICITLYCREATED: Result := 'This surface can not be restored because it is an implicitly created surface.'; + DDERR_INCOMPATIBLEPRIMARY: Result := 'Unable to match primary surface creation request with existing primary surface.'; + DDERR_INVALIDCAPS: Result := 'One or more of the caps bits passed to the callback are incorrect.'; + DDERR_INVALIDCLIPLIST: Result := 'DirectDraw does not support the provided cliplist.'; + DDERR_INVALIDDIRECTDRAWGUID: Result := 'The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.'; + DDERR_INVALIDMODE: Result := 'DirectDraw does not support the requested mode.'; + DDERR_INVALIDOBJECT: Result := 'DirectDraw received a pointer that was an invalid DIRECTDRAW object.'; + DDERR_INVALIDPARAMS: Result := 'One or more of the parameters passed to the function are incorrect.'; + DDERR_INVALIDPIXELFORMAT: Result := 'The pixel format was invalid as specified.'; + DDERR_INVALIDPOSITION: Result := 'Returned when the position of the overlay on the destination is no longer legal for that destination.'; + DDERR_INVALIDRECT: Result := 'Rectangle provided was invalid.'; + DDERR_LOCKEDSURFACES: Result := 'Operation could not be carried out because one or more surfaces are locked.'; + DDERR_NO3D: Result := 'There is no 3D present.'; + DDERR_NOALPHAHW: Result := 'Operation could not be carried out because there is no alpha accleration hardware present or available.'; + DDERR_NOBLTHW: Result := 'No blitter hardware present.'; + DDERR_NOCLIPLIST: Result := 'No cliplist available.'; + DDERR_NOCLIPPERATTACHED: Result := 'No clipper object attached to surface object.'; + DDERR_NOCOLORCONVHW: Result := 'Operation could not be carried out because there is no color conversion hardware present or available.'; + DDERR_NOCOLORKEY: Result := 'Surface does not currently have a color key'; + DDERR_NOCOLORKEYHW: Result := 'Operation could not be carried out because there is no hardware support of the destination color key.'; + DDERR_NOCOOPERATIVELEVELSET: Result := 'Create function called without DirectDraw object method SetCooperativeLevel being called.'; + DDERR_NODC: Result := 'No DC was ever created for this surface.'; + DDERR_NODDROPSHW: Result := 'No DirectDraw ROP hardware.'; + DDERR_NODIRECTDRAWHW: Result := 'A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware.'; + DDERR_NOEMULATION: Result := 'Software emulation not available.'; + DDERR_NOEXCLUSIVEMODE: Result := 'Operation requires the application to have exclusive mode but the application does not have exclusive mode.'; + DDERR_NOFLIPHW: Result := 'Flipping visible surfaces is not supported.'; + DDERR_NOGDI: Result := 'There is no GDI present.'; + DDERR_NOHWND: Result := 'Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND.'; + DDERR_NOMIRRORHW: Result := 'Operation could not be carried out because there is no hardware present or available.'; + DDERR_NOOVERLAYDEST: Result := 'Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination.'; + DDERR_NOOVERLAYHW: Result := 'Operation could not be carried out because there is no overlay hardware present or available.'; + DDERR_NOPALETTEATTACHED: Result := 'No palette object attached to this surface.'; + DDERR_NOPALETTEHW: Result := 'No hardware support for 16 or 256 color palettes.'; + DDERR_NORASTEROPHW: Result := 'Operation could not be carried out because there is no appropriate raster op hardware present or available.'; + DDERR_NOROTATIONHW: Result := 'Operation could not be carried out because there is no rotation hardware present or available.'; + DDERR_NOSTRETCHHW: Result := 'Operation could not be carried out because there is no hardware support for stretching.'; + DDERR_NOT4BITCOLOR: Result := 'DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette.'; + DDERR_NOT4BITCOLORINDEX: Result := 'DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette.'; + DDERR_NOT8BITCOLOR: Result := 'DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.'; + DDERR_NOTAOVERLAYSURFACE: Result := 'Returned when an overlay member is called for a non-overlay surface.'; + DDERR_NOTEXTUREHW: Result := 'Operation could not be carried out because there is no texture mapping hardware present or available.'; + DDERR_NOTFLIPPABLE: Result := 'An attempt has been made to flip a surface that is not flippable.'; + DDERR_NOTFOUND: Result := 'Requested item was not found.'; + DDERR_NOTLOCKED: Result := 'Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this process, has been attempted.'; + DDERR_NOTPALETTIZED: Result := 'The surface being used is not a palette-based surface.'; + DDERR_NOVSYNCHW: Result := 'Operation could not be carried out because there is no hardware support for vertical blank synchronized operations.'; + DDERR_NOZBUFFERHW: Result := 'Operation could not be carried out because there is no hardware support for zbuffer blitting.'; + DDERR_NOZOVERLAYHW: Result := 'Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays.'; + DDERR_OUTOFCAPS: Result := 'The hardware needed for the requested operation has already been allocated.'; + DDERR_OUTOFMEMORY: Result := 'DirectDraw does not have enough memory to perform the operation.'; + DDERR_OUTOFVIDEOMEMORY: Result := 'DirectDraw does not have enough memory to perform the operation.'; + DDERR_OVERLAYCANTCLIP: Result := 'The hardware does not support clipped overlays.'; + DDERR_OVERLAYCOLORKEYONLYONEACTIVE: Result := 'Can only have ony color key active at one time for overlays.'; + DDERR_OVERLAYNOTVISIBLE: Result := 'Returned when GetOverlayPosition is called on a hidden overlay.'; + DDERR_PALETTEBUSY: Result := 'Access to this palette is being refused because the palette is already locked by another thread.'; + DDERR_PRIMARYSURFACEALREADYEXISTS: Result := 'This process already has created a primary surface.'; + DDERR_REGIONTOOSMALL: Result := 'Region passed to Clipper::GetClipList is too small.'; + DDERR_SURFACEALREADYATTACHED: Result := 'This surface is already attached to the surface it is being attached to.'; + DDERR_SURFACEALREADYDEPENDENT: Result := 'This surface is already a dependency of the surface it is being made a dependency of.'; + DDERR_SURFACEBUSY: Result := 'Access to this surface is being refused because the surface is already locked by another thread.'; + DDERR_SURFACEISOBSCURED: Result := 'Access to surface refused because the surface is obscured.'; + DDERR_SURFACELOST: Result := 'Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it.'; + DDERR_SURFACENOTATTACHED: Result := 'The requested surface is not attached.'; + DDERR_TOOBIGHEIGHT: Result := 'Height requested by DirectDraw is too large.'; + DDERR_TOOBIGSIZE: Result := 'Size requested by DirectDraw is too large, but the individual height and width are OK.'; + DDERR_TOOBIGWIDTH: Result := 'Width requested by DirectDraw is too large.'; + DDERR_UNSUPPORTED: Result := 'Action not supported.'; + DDERR_UNSUPPORTEDFORMAT: Result := 'FOURCC format requested is unsupported by DirectDraw.'; + DDERR_UNSUPPORTEDMASK: Result := 'Bitmask in the pixel format requested is unsupported by DirectDraw.'; + DDERR_VERTICALBLANKINPROGRESS: Result := 'Vertical blank is in progress.'; + DDERR_WASSTILLDRAWING: Result := 'Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete.'; + DDERR_WRONGMODE: Result := 'This surface can not be restored because it was created in a different mode.'; + DDERR_XALIGN: Result := 'Rectangle provided was not horizontally aligned on required boundary.'; + // new: + DDERR_OVERLAPPINGRECTS: Result := 'Operation could not be carried out because the source and destination rectangles are on the same surface and overlap each other.'; + DDERR_INVALIDSTREAM: Result := 'The specified stream contains invalid data'; + DDERR_UNSUPPORTEDMODE: Result := 'The display is currently in an unsupported mode'; + DDERR_NOMIPMAPHW: Result := 'Operation could not be carried out because there is no mip-map texture mapping hardware present or available.'; + DDERR_INVALIDSURFACETYPE: Result := 'The requested action could not be performed because the surface was of the wrong type.'; + DDERR_NOOPTIMIZEHW: Result := 'Device does not support optimized surfaces, therefore no video memory optimized surfaces'; + DDERR_NOTLOADED: Result := 'Surface is an optimized surface, but has not yet been allocated any memory'; + DDERR_NOFOCUSWINDOW: Result := 'Attempt was made to create or set a device window without first setting the focus window'; + DDERR_DCALREADYCREATED: Result := 'A DC has already been returned for this surface. Only one DC can be retrieved per surface.'; + DDERR_NONONLOCALVIDMEM: Result := 'An attempt was made to allocate non-local video memory from a device that does not support non-local video memory.'; + DDERR_CANTPAGELOCK: Result := 'The attempt to page lock a surface failed.'; + DDERR_CANTPAGEUNLOCK: Result := 'The attempt to page unlock a surface failed.'; + DDERR_NOTPAGELOCKED: Result := 'An attempt was made to page unlock a surface with no outstanding page locks.'; + DDERR_MOREDATA: Result := 'There is more data available than the specified buffer size could hold'; + DDERR_EXPIRED: Result := 'The data has expired and is therefore no longer valid.'; + DDERR_VIDEONOTACTIVE: Result := 'The video port is not active'; + DDERR_DEVICEDOESNTOWNSURFACE: Result := 'Surfaces created by one direct draw device cannot be used directly by another direct draw device.'; + DDERR_NOTINITIALIZED: Result := 'An attempt was made to invoke an interface member of a DirectDraw object created by CoCreateInstance() before it was initialized.'; + else Result := 'Unrecognized Error'; + end; +end; + +{$IFDEF DIRECTDRAW_DYNAMIC_LINK} +var + DirectDrawLib: THandle = 0; + +function DirectDrawLoaded: Boolean; +begin + Result:= DirectDrawLib <> 0; +end; + +function UnLoadDirectDraw: Boolean; +begin + Result:= True; + if DirectDrawLoaded then + begin + Result:= FreeLibrary(DirectDrawLib); + + DirectDrawEnumerateA := nil; + DirectDrawEnumerateW := nil; + DirectDrawEnumerate := nil; + + DirectDrawEnumerateExA := nil; + DirectDrawEnumerateExW := nil; + DirectDrawEnumerateEx := nil; + + DirectDrawCreate := nil; + DirectDrawCreateEx := nil; + DirectDrawCreateClipper := nil; + {$IFDEF WINNT} + NtDirectDrawCreate := nil; + {$ENDIF} + + DirectDrawLib:= 0; + end; +end; + +function LoadDirectDraw: Boolean; +begin + Result:= DirectDrawLoaded; + if (not Result) then + begin + DirectDrawLib:= LoadLibrary(DirectDrawDll); + if DirectDrawLoaded then + begin + DirectDrawEnumerateA := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateA'); + DirectDrawEnumerateW := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateW'); + {$IFDEF UNICODE} + DirectDrawEnumerate := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateW'); + {$ELSE} + DirectDrawEnumerate := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateA'); + {$ENDIF} + + DirectDrawEnumerateExA := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateExA'); + DirectDrawEnumerateExW := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateExW'); + {$IFDEF UNICODE} + DirectDrawEnumerateEx := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateExW'); + {$ELSE} + DirectDrawEnumerateEx := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateExA'); + {$ENDIF} + + DirectDrawCreate := GetProcAddress(DDrawDLL,'DirectDrawCreate'); + DirectDrawCreateEx := GetProcAddress(DDrawDLL,'DirectDrawCreateEx'); + DirectDrawCreateClipper := GetProcAddress(DDrawDLL,'DirectDrawCreateClipper'); + {$IFDEF WINNT} + NtDirectDrawCreate := GetProcAddress(DDrawDLL,'NtDirectDrawCreate'); + {$ENDIF} + + Result:= Assigned(DirectDrawCreate); // At least basic procedure is found! + if not Result then UnLoadDirectDraw; + end; + end; +end; +{$ELSE} +function DirectDrawLoaded: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +function UnLoadDirectDraw: Boolean; +begin // Stub function for static linking + Result:= True; // should emulate "normal" behaviour +end; + +function LoadDirectDraw: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +{$ENDIF} + +{$IFDEF DIRECTDRAW_DYNAMIC_LINK} +initialization +{$IFNDEF DIRECTDRAW_DYNAMIC_LINK_EXPLICIT} + LoadDirectDraw; +{$ENDIF} +finalization + UnLoadDirectDraw; +{$ENDIF} +end. + diff --git a/Pramougolnik/DirectX.inc b/Pramougolnik/DirectX.inc new file mode 100644 index 0000000..f7f29c2 --- /dev/null +++ b/Pramougolnik/DirectX.inc @@ -0,0 +1,29 @@ +{******************************************************************************} +{ } +{ The contents of this file are subject to the Mozilla Public License Version } +{ 1.1 (the "License"); you may not use this file except in compliance with the } +{ License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ } +{ } +{ Software distributed under the License is distributed on an "AS IS" basis, } +{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for } +{ the specific language governing rights and limitations under the License. } +{ } +{ The Original Code is DirectX.inc. } +{ } +{******************************************************************************} + +// Borland compilers support +{$INCLUDE Jedix.inc} + +{$DEFINE TYPE_IDENTITY} +{$DEFINE SUPPORTS_EXCEPTIONS} + +// Additional settings +{$MINENUMSIZE 4} +{$ALIGN ON} + +{$IFDEF COMPILER7_UP} + {$WARN UNSAFE_CODE OFF} + {$WARN UNSAFE_TYPE OFF} + {$WARN UNSAFE_CAST OFF} +{$ENDIF} diff --git a/Pramougolnik/GDIPAPI.dcu b/Pramougolnik/GDIPAPI.dcu new file mode 100644 index 0000000..bb2d339 Binary files /dev/null and b/Pramougolnik/GDIPAPI.dcu differ diff --git a/Pramougolnik/GDIPAPI.pas b/Pramougolnik/GDIPAPI.pas new file mode 100644 index 0000000..9b36652 --- /dev/null +++ b/Pramougolnik/GDIPAPI.pas @@ -0,0 +1,7009 @@ + {******************************************************************} + { GDI+ API } + { } + { home page : http://www.progdigy.com } + { email : hgourvest@progdigy.com } + { } + { date : 15-02-2002 } + { } + { The contents of this file are used with permission, subject to } + { the Mozilla Public License Version 1.1 (the "License"); you may } + { not use this file except in compliance with the License. You may } + { obtain a copy of the License at } + { http://www.mozilla.org/MPL/MPL-1.1.html } + { } + { Software distributed under the License is distributed on an } + { "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } + { implied. See the License for the specific language governing } + { rights and limitations under the License. } + { } + { *****************************************************************} + +unit GDIPAPI; + +{$ALIGN ON} +{$MINENUMSIZE 4} + +interface + +(**************************************************************************\ +* +* GDI+ public header file +* +\**************************************************************************) + +uses + Windows, + ActiveX, + Math; + +type + INT16 = type Smallint; + UINT16 = type Word; + PUINT16 = ^UINT16; + UINT32 = type Cardinal; + TSingleDynArray = array of Single; + +(**************************************************************************\ +* +* GDI+ Private Memory Management APIs +* +\**************************************************************************) + +const WINGDIPDLL = 'gdiplus.dll'; + +//---------------------------------------------------------------------------- +// Memory Allocation APIs +//---------------------------------------------------------------------------- + +{$EXTERNALSYM GdipAlloc} +function GdipAlloc(size: ULONG): pointer; stdcall; +{$EXTERNALSYM GdipFree} +procedure GdipFree(ptr: pointer); stdcall; + +(**************************************************************************\ +* +* GDI+ base memory allocation class +* +\**************************************************************************) + +type + TGdiplusBase = class + public + class function NewInstance: TObject; override; + procedure FreeInstance; override; + end; + +(**************************************************************************\ +* +* GDI+ Enumeration Types +* +\**************************************************************************) + +//-------------------------------------------------------------------------- +// Default bezier flattening tolerance in device pixels. +//-------------------------------------------------------------------------- + +const + {$EXTERNALSYM FlatnessDefault} + FlatnessDefault = 0.25; + +//-------------------------------------------------------------------------- +// Graphics and Container State cookies +//-------------------------------------------------------------------------- +type + {$EXTERNALSYM GraphicsState} + GraphicsState = UINT; + {$EXTERNALSYM GraphicsContainer} + GraphicsContainer = UINT; + +//-------------------------------------------------------------------------- +// Fill mode constants +//-------------------------------------------------------------------------- + + {$EXTERNALSYM FillMode} + FillMode = ( + FillModeAlternate, // 0 + FillModeWinding // 1 + ); + TFillMode = FillMode; + +//-------------------------------------------------------------------------- +// Quality mode constants +//-------------------------------------------------------------------------- + +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM QualityMode} + QualityMode = ( + QualityModeInvalid = -1, + QualityModeDefault = 0, + QualityModeLow = 1, // Best performance + QualityModeHigh = 2 // Best rendering quality + ); + TQualityMode = QualityMode; +{$ELSE} + {$EXTERNALSYM QualityMode} + QualityMode = Integer; + const + QualityModeInvalid = -1; + QualityModeDefault = 0; + QualityModeLow = 1; // Best performance + QualityModeHigh = 2; // Best rendering quality +{$ENDIF} + +//-------------------------------------------------------------------------- +// Alpha Compositing mode constants +//-------------------------------------------------------------------------- +type + {$EXTERNALSYM CompositingMode} + CompositingMode = ( + CompositingModeSourceOver, // 0 + CompositingModeSourceCopy // 1 + ); + TCompositingMode = CompositingMode; + +//-------------------------------------------------------------------------- +// Alpha Compositing quality constants +//-------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM CompositingQuality} + CompositingQuality = ( + CompositingQualityInvalid = ord(QualityModeInvalid), + CompositingQualityDefault = ord(QualityModeDefault), + CompositingQualityHighSpeed = ord(QualityModeLow), + CompositingQualityHighQuality = ord(QualityModeHigh), + CompositingQualityGammaCorrected, + CompositingQualityAssumeLinear + ); + TCompositingQuality = CompositingQuality; +{$ELSE} + {$EXTERNALSYM CompositingQuality} + CompositingQuality = Integer; + const + CompositingQualityInvalid = QualityModeInvalid; + CompositingQualityDefault = QualityModeDefault; + CompositingQualityHighSpeed = QualityModeLow; + CompositingQualityHighQuality = QualityModeHigh; + CompositingQualityGammaCorrected = 3; + CompositingQualityAssumeLinear = 4; + +type + TCompositingQuality = CompositingQuality; +{$ENDIF} + +//-------------------------------------------------------------------------- +// Unit constants +//-------------------------------------------------------------------------- + + // {$EXTERNALSYM Unit} + Unit_ = ( + UnitWorld, // 0 -- World coordinate (non-physical unit) + UnitDisplay, // 1 -- Variable -- for PageTransform only + UnitPixel, // 2 -- Each unit is one device pixel. + UnitPoint, // 3 -- Each unit is a printer's point, or 1/72 inch. + UnitInch, // 4 -- Each unit is 1 inch. + UnitDocument, // 5 -- Each unit is 1/300 inch. + UnitMillimeter // 6 -- Each unit is 1 millimeter. + ); + TUnit = Unit_; + +//-------------------------------------------------------------------------- +// MetafileFrameUnit +// +// The frameRect for creating a metafile can be specified in any of these +// units. There is an extra frame unit value (MetafileFrameUnitGdi) so +// that units can be supplied in the same units that GDI expects for +// frame rects -- these units are in .01 (1/100ths) millimeter units +// as defined by GDI. +//-------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM MetafileFrameUnit} + MetafileFrameUnit = ( + MetafileFrameUnitPixel = ord(UnitPixel), + MetafileFrameUnitPoint = ord(UnitPoint), + MetafileFrameUnitInch = ord(UnitInch), + MetafileFrameUnitDocument = ord(UnitDocument), + MetafileFrameUnitMillimeter = ord(UnitMillimeter), + MetafileFrameUnitGdi // GDI compatible .01 MM units + ); + TMetafileFrameUnit = MetafileFrameUnit; +{$ELSE} + {$EXTERNALSYM MetafileFrameUnit} + MetafileFrameUnit = Integer; + const + MetafileFrameUnitPixel = 2; + MetafileFrameUnitPoint = 3; + MetafileFrameUnitInch = 4; + MetafileFrameUnitDocument = 5; + MetafileFrameUnitMillimeter = 6; + MetafileFrameUnitGdi = 7; // GDI compatible .01 MM units + +type + TMetafileFrameUnit = MetafileFrameUnit; +{$ENDIF} +//-------------------------------------------------------------------------- +// Coordinate space identifiers +//-------------------------------------------------------------------------- + + {$EXTERNALSYM CoordinateSpace} + CoordinateSpace = ( + CoordinateSpaceWorld, // 0 + CoordinateSpacePage, // 1 + CoordinateSpaceDevice // 2 + ); + TCoordinateSpace = CoordinateSpace; + +//-------------------------------------------------------------------------- +// Various wrap modes for brushes +//-------------------------------------------------------------------------- + + {$EXTERNALSYM WrapMode} + WrapMode = ( + WrapModeTile, // 0 + WrapModeTileFlipX, // 1 + WrapModeTileFlipY, // 2 + WrapModeTileFlipXY, // 3 + WrapModeClamp // 4 + ); + TWrapMode = WrapMode; + +//-------------------------------------------------------------------------- +// Various hatch styles +//-------------------------------------------------------------------------- + + {$EXTERNALSYM HatchStyle} + HatchStyle = ( + HatchStyleHorizontal, // = 0, + HatchStyleVertical, // = 1, + HatchStyleForwardDiagonal, // = 2, + HatchStyleBackwardDiagonal, // = 3, + HatchStyleCross, // = 4, + HatchStyleDiagonalCross, // = 5, + HatchStyle05Percent, // = 6, + HatchStyle10Percent, // = 7, + HatchStyle20Percent, // = 8, + HatchStyle25Percent, // = 9, + HatchStyle30Percent, // = 10, + HatchStyle40Percent, // = 11, + HatchStyle50Percent, // = 12, + HatchStyle60Percent, // = 13, + HatchStyle70Percent, // = 14, + HatchStyle75Percent, // = 15, + HatchStyle80Percent, // = 16, + HatchStyle90Percent, // = 17, + HatchStyleLightDownwardDiagonal, // = 18, + HatchStyleLightUpwardDiagonal, // = 19, + HatchStyleDarkDownwardDiagonal, // = 20, + HatchStyleDarkUpwardDiagonal, // = 21, + HatchStyleWideDownwardDiagonal, // = 22, + HatchStyleWideUpwardDiagonal, // = 23, + HatchStyleLightVertical, // = 24, + HatchStyleLightHorizontal, // = 25, + HatchStyleNarrowVertical, // = 26, + HatchStyleNarrowHorizontal, // = 27, + HatchStyleDarkVertical, // = 28, + HatchStyleDarkHorizontal, // = 29, + HatchStyleDashedDownwardDiagonal, // = 30, + HatchStyleDashedUpwardDiagonal, // = 31, + HatchStyleDashedHorizontal, // = 32, + HatchStyleDashedVertical, // = 33, + HatchStyleSmallConfetti, // = 34, + HatchStyleLargeConfetti, // = 35, + HatchStyleZigZag, // = 36, + HatchStyleWave, // = 37, + HatchStyleDiagonalBrick, // = 38, + HatchStyleHorizontalBrick, // = 39, + HatchStyleWeave, // = 40, + HatchStylePlaid, // = 41, + HatchStyleDivot, // = 42, + HatchStyleDottedGrid, // = 43, + HatchStyleDottedDiamond, // = 44, + HatchStyleShingle, // = 45, + HatchStyleTrellis, // = 46, + HatchStyleSphere, // = 47, + HatchStyleSmallGrid, // = 48, + HatchStyleSmallCheckerBoard, // = 49, + HatchStyleLargeCheckerBoard, // = 50, + HatchStyleOutlinedDiamond, // = 51, + HatchStyleSolidDiamond, // = 52, + + HatchStyleTotal // = 53, + ); + + const + HatchStyleLargeGrid = HatchStyleCross; // 4 + HatchStyleMin = HatchStyleHorizontal; + HatchStyleMax = HatchStyleSolidDiamond; + +type + THatchStyle = HatchStyle; + +//-------------------------------------------------------------------------- +// Dash style constants +//-------------------------------------------------------------------------- + + {$EXTERNALSYM DashStyle} + DashStyle = ( + DashStyleSolid, // 0 + DashStyleDash, // 1 + DashStyleDot, // 2 + DashStyleDashDot, // 3 + DashStyleDashDotDot, // 4 + DashStyleCustom // 5 + ); + TDashStyle = DashStyle; + +//-------------------------------------------------------------------------- +// Dash cap constants +//-------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM DashCap} + DashCap = ( + DashCapFlat = 0, + DashCapRound = 2, + DashCapTriangle = 3 + ); + TDashCap = DashCap; +{$ELSE} + {$EXTERNALSYM DashCap} + DashCap = Integer; + const + DashCapFlat = 0; + DashCapRound = 2; + DashCapTriangle = 3; + +type + TDashCap = DashCap; +{$ENDIF} + +//-------------------------------------------------------------------------- +// Line cap constants (only the lowest 8 bits are used). +//-------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM LineCap} + LineCap = ( + LineCapFlat = 0, + LineCapSquare = 1, + LineCapRound = 2, + LineCapTriangle = 3, + + LineCapNoAnchor = $10, // corresponds to flat cap + LineCapSquareAnchor = $11, // corresponds to square cap + LineCapRoundAnchor = $12, // corresponds to round cap + LineCapDiamondAnchor = $13, // corresponds to triangle cap + LineCapArrowAnchor = $14, // no correspondence + + LineCapCustom = $ff, // custom cap + + LineCapAnchorMask = $f0 // mask to check for anchor or not. + ); + TLineCap = LineCap; +{$ELSE} + {$EXTERNALSYM LineCap} + LineCap = Integer; + const + LineCapFlat = 0; + LineCapSquare = 1; + LineCapRound = 2; + LineCapTriangle = 3; + + LineCapNoAnchor = $10; // corresponds to flat cap + LineCapSquareAnchor = $11; // corresponds to square cap + LineCapRoundAnchor = $12; // corresponds to round cap + LineCapDiamondAnchor = $13; // corresponds to triangle cap + LineCapArrowAnchor = $14; // no correspondence + + LineCapCustom = $ff; // custom cap + + LineCapAnchorMask = $f0; // mask to check for anchor or not. + +type + TLineCap = LineCap; +{$ENDIF} + +//-------------------------------------------------------------------------- +// Custom Line cap type constants +//-------------------------------------------------------------------------- + + {$EXTERNALSYM CustomLineCapType} + CustomLineCapType = ( + CustomLineCapTypeDefault, + CustomLineCapTypeAdjustableArrow + ); + TCustomLineCapType = CustomLineCapType; + +//-------------------------------------------------------------------------- +// Line join constants +//-------------------------------------------------------------------------- + + {$EXTERNALSYM LineJoin} + LineJoin = ( + LineJoinMiter, + LineJoinBevel, + LineJoinRound, + LineJoinMiterClipped + ); + TLineJoin = LineJoin; + +//-------------------------------------------------------------------------- +// Path point types (only the lowest 8 bits are used.) +// The lowest 3 bits are interpreted as point type +// The higher 5 bits are reserved for flags. +//-------------------------------------------------------------------------- + +{$IFDEF DELPHI6_UP} + {$Z1} + {$EXTERNALSYM PathPointType} + PathPointType = ( + PathPointTypeStart = $00, // move + PathPointTypeLine = $01, // line + PathPointTypeBezier = $03, // default Bezier (= cubic Bezier) + PathPointTypePathTypeMask = $07, // type mask (lowest 3 bits). + PathPointTypeDashMode = $10, // currently in dash mode. + PathPointTypePathMarker = $20, // a marker for the path. + PathPointTypeCloseSubpath = $80, // closed flag + + // Path types used for advanced path. + PathPointTypeBezier3 = $03 // cubic Bezier + ); + TPathPointType = PathPointType; + {$Z4} +{$ELSE} + {$EXTERNALSYM PathPointType} + PathPointType = Byte; + const + PathPointTypeStart : Byte = $00; // move + PathPointTypeLine : Byte = $01; // line + PathPointTypeBezier : Byte = $03; // default Bezier (= cubic Bezier) + PathPointTypePathTypeMask : Byte = $07; // type mask (lowest 3 bits). + PathPointTypeDashMode : Byte = $10; // currently in dash mode. + PathPointTypePathMarker : Byte = $20; // a marker for the path. + PathPointTypeCloseSubpath : Byte = $80; // closed flag + + // Path types used for advanced path. + PathPointTypeBezier3 : Byte = $03; // cubic Bezier + +type + TPathPointType = PathPointType; +{$ENDIF} + +//-------------------------------------------------------------------------- +// WarpMode constants +//-------------------------------------------------------------------------- + + {$EXTERNALSYM WarpMode} + WarpMode = ( + WarpModePerspective, // 0 + WarpModeBilinear // 1 + ); + TWarpMode = WarpMode; + +//-------------------------------------------------------------------------- +// LineGradient Mode +//-------------------------------------------------------------------------- + + {$EXTERNALSYM LinearGradientMode} + LinearGradientMode = ( + LinearGradientModeHorizontal, // 0 + LinearGradientModeVertical, // 1 + LinearGradientModeForwardDiagonal, // 2 + LinearGradientModeBackwardDiagonal // 3 + ); + TLinearGradientMode = LinearGradientMode; + +//-------------------------------------------------------------------------- +// Region Comine Modes +//-------------------------------------------------------------------------- + + {$EXTERNALSYM CombineMode} + CombineMode = ( + CombineModeReplace, // 0 + CombineModeIntersect, // 1 + CombineModeUnion, // 2 + CombineModeXor, // 3 + CombineModeExclude, // 4 + CombineModeComplement // 5 (Exclude From) + ); + TCombineMode = CombineMode; + +//-------------------------------------------------------------------------- + // Image types +//-------------------------------------------------------------------------- + + {$EXTERNALSYM ImageType} + ImageType = ( + ImageTypeUnknown, // 0 + ImageTypeBitmap, // 1 + ImageTypeMetafile // 2 + ); + TImageType = ImageType; + +//-------------------------------------------------------------------------- +// Interpolation modes +//-------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM InterpolationMode} + InterpolationMode = ( + InterpolationModeInvalid = ord(QualityModeInvalid), + InterpolationModeDefault = ord(QualityModeDefault), + InterpolationModeLowQuality = ord(QualityModeLow), + InterpolationModeHighQuality = ord(QualityModeHigh), + InterpolationModeBilinear, + InterpolationModeBicubic, + InterpolationModeNearestNeighbor, + InterpolationModeHighQualityBilinear, + InterpolationModeHighQualityBicubic + ); + TInterpolationMode = InterpolationMode; +{$ELSE} + {$EXTERNALSYM InterpolationMode} + InterpolationMode = Integer; + const + InterpolationModeInvalid = QualityModeInvalid; + InterpolationModeDefault = QualityModeDefault; + InterpolationModeLowQuality = QualityModeLow; + InterpolationModeHighQuality = QualityModeHigh; + InterpolationModeBilinear = 3; + InterpolationModeBicubic = 4; + InterpolationModeNearestNeighbor = 5; + InterpolationModeHighQualityBilinear = 6; + InterpolationModeHighQualityBicubic = 7; + +type + TInterpolationMode = InterpolationMode; +{$ENDIF} + +//-------------------------------------------------------------------------- +// Pen types +//-------------------------------------------------------------------------- + + {$EXTERNALSYM PenAlignment} + PenAlignment = ( + PenAlignmentCenter, + PenAlignmentInset + ); + TPenAlignment = PenAlignment; + +//-------------------------------------------------------------------------- +// Brush types +//-------------------------------------------------------------------------- + + {$EXTERNALSYM BrushType} + BrushType = ( + BrushTypeSolidColor, + BrushTypeHatchFill, + BrushTypeTextureFill, + BrushTypePathGradient, + BrushTypeLinearGradient + ); + TBrushType = BrushType; + +//-------------------------------------------------------------------------- +// Pen's Fill types +//-------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM PenType} + PenType = ( + PenTypeSolidColor = ord(BrushTypeSolidColor), + PenTypeHatchFill = ord(BrushTypeHatchFill), + PenTypeTextureFill = ord(BrushTypeTextureFill), + PenTypePathGradient = ord(BrushTypePathGradient), + PenTypeLinearGradient = ord(BrushTypeLinearGradient), + PenTypeUnknown = -1 + ); + TPenType = PenType; +{$ELSE} + {$EXTERNALSYM PenType} + PenType = Integer; + const + PenTypeSolidColor = 0; + PenTypeHatchFill = 1; + PenTypeTextureFill = 2; + PenTypePathGradient = 3; + PenTypeLinearGradient = 4; + PenTypeUnknown = -1; + +type + TPenType = PenType; +{$ENDIF} + +//-------------------------------------------------------------------------- +// Matrix Order +//-------------------------------------------------------------------------- + + {$EXTERNALSYM MatrixOrder} + MatrixOrder = ( + MatrixOrderPrepend, + MatrixOrderAppend + ); + TMatrixOrder = MatrixOrder; + +//-------------------------------------------------------------------------- +// Generic font families +//-------------------------------------------------------------------------- + + {$EXTERNALSYM GenericFontFamily} + GenericFontFamily = ( + GenericFontFamilySerif, + GenericFontFamilySansSerif, + GenericFontFamilyMonospace + ); + TGenericFontFamily = GenericFontFamily; + +//-------------------------------------------------------------------------- +// FontStyle: face types and common styles +//-------------------------------------------------------------------------- +type + {$EXTERNALSYM FontStyle} + FontStyle = Integer; + const + FontStyleRegular = Integer(0); + FontStyleBold = Integer(1); + FontStyleItalic = Integer(2); + FontStyleBoldItalic = Integer(3); + FontStyleUnderline = Integer(4); + FontStyleStrikeout = Integer(8); + Type + TFontStyle = FontStyle; + +//--------------------------------------------------------------------------- +// Smoothing Mode +//--------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM SmoothingMode} + SmoothingMode = ( + SmoothingModeInvalid = ord(QualityModeInvalid), + SmoothingModeDefault = ord(QualityModeDefault), + SmoothingModeHighSpeed = ord(QualityModeLow), + SmoothingModeHighQuality = ord(QualityModeHigh), + SmoothingModeNone, + SmoothingModeAntiAlias + ); + TSmoothingMode = SmoothingMode; +{$ELSE} + {$EXTERNALSYM SmoothingMode} + SmoothingMode = Integer; + const + SmoothingModeInvalid = QualityModeInvalid; + SmoothingModeDefault = QualityModeDefault; + SmoothingModeHighSpeed = QualityModeLow; + SmoothingModeHighQuality = QualityModeHigh; + SmoothingModeNone = 3; + SmoothingModeAntiAlias = 4; + +type + TSmoothingMode = SmoothingMode; +{$ENDIF} + +//--------------------------------------------------------------------------- +// Pixel Format Mode +//--------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM PixelOffsetMode} + PixelOffsetMode = ( + PixelOffsetModeInvalid = Ord(QualityModeInvalid), + PixelOffsetModeDefault = Ord(QualityModeDefault), + PixelOffsetModeHighSpeed = Ord(QualityModeLow), + PixelOffsetModeHighQuality = Ord(QualityModeHigh), + PixelOffsetModeNone, // No pixel offset + PixelOffsetModeHalf // Offset by -0.5, -0.5 for fast anti-alias perf + ); + TPixelOffsetMode = PixelOffsetMode; +{$ELSE} + {$EXTERNALSYM PixelOffsetMode} + PixelOffsetMode = Integer; + const + PixelOffsetModeInvalid = QualityModeInvalid; + PixelOffsetModeDefault = QualityModeDefault; + PixelOffsetModeHighSpeed = QualityModeLow; + PixelOffsetModeHighQuality = QualityModeHigh; + PixelOffsetModeNone = 3; // No pixel offset + PixelOffsetModeHalf = 4; // Offset by -0.5, -0.5 for fast anti-alias perf + +type + TPixelOffsetMode = PixelOffsetMode; +{$ENDIF} + +//--------------------------------------------------------------------------- +// Text Rendering Hint +//--------------------------------------------------------------------------- + + {$EXTERNALSYM TextRenderingHint} + TextRenderingHint = ( + TextRenderingHintSystemDefault, // Glyph with system default rendering hint + TextRenderingHintSingleBitPerPixelGridFit, // Glyph bitmap with hinting + TextRenderingHintSingleBitPerPixel, // Glyph bitmap without hinting + TextRenderingHintAntiAliasGridFit, // Glyph anti-alias bitmap with hinting + TextRenderingHintAntiAlias, // Glyph anti-alias bitmap without hinting + TextRenderingHintClearTypeGridFit // Glyph CT bitmap with hinting + ); + TTextRenderingHint = TextRenderingHint; + +//--------------------------------------------------------------------------- +// Metafile Types +//--------------------------------------------------------------------------- + + {$EXTERNALSYM MetafileType} + MetafileType = ( + MetafileTypeInvalid, // Invalid metafile + MetafileTypeWmf, // Standard WMF + MetafileTypeWmfPlaceable, // Placeable WMF + MetafileTypeEmf, // EMF (not EMF+) + MetafileTypeEmfPlusOnly, // EMF+ without dual, down-level records + MetafileTypeEmfPlusDual // EMF+ with dual, down-level records + ); + TMetafileType = MetafileType; + +//--------------------------------------------------------------------------- +// Specifies the type of EMF to record +//--------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM EmfType} + EmfType = ( + EmfTypeEmfOnly = Ord(MetafileTypeEmf), // no EMF+, only EMF + EmfTypeEmfPlusOnly = Ord(MetafileTypeEmfPlusOnly), // no EMF, only EMF+ + EmfTypeEmfPlusDual = Ord(MetafileTypeEmfPlusDual) // both EMF+ and EMF + ); + TEmfType = EmfType; +{$ELSE} + {$EXTERNALSYM EmfType} + EmfType = Integer; + const + EmfTypeEmfOnly = Ord(MetafileTypeEmf); // no EMF+, only EMF + EmfTypeEmfPlusOnly = Ord(MetafileTypeEmfPlusOnly); // no EMF, only EMF+ + EmfTypeEmfPlusDual = Ord(MetafileTypeEmfPlusDual); // both EMF+ and EMF + +type + TEmfType = EmfType; +{$ENDIF} + +//--------------------------------------------------------------------------- +// EMF+ Persistent object types +//--------------------------------------------------------------------------- + + {$EXTERNALSYM ObjectType} + ObjectType = ( + ObjectTypeInvalid, + ObjectTypeBrush, + ObjectTypePen, + ObjectTypePath, + ObjectTypeRegion, + ObjectTypeImage, + ObjectTypeFont, + ObjectTypeStringFormat, + ObjectTypeImageAttributes, + ObjectTypeCustomLineCap + ); + TObjectType = ObjectType; + +const + ObjectTypeMax = ObjectTypeCustomLineCap; + ObjectTypeMin = ObjectTypeBrush; + +function ObjectTypeIsValid(type_: ObjectType): BOOL; + +//--------------------------------------------------------------------------- +// EMF+ Records +//--------------------------------------------------------------------------- + + // We have to change the WMF record numbers so that they don't conflict with + // the EMF and EMF+ record numbers. + +const + GDIP_EMFPLUS_RECORD_BASE = $00004000; + {$EXTERNALSYM GDIP_EMFPLUS_RECORD_BASE} + GDIP_WMF_RECORD_BASE = $00010000; + {$EXTERNALSYM GDIP_WMF_RECORD_BASE} + +// macros +function GDIP_WMF_RECORD_TO_EMFPLUS(n: integer): Integer; +function GDIP_EMFPLUS_RECORD_TO_WMF(n: integer): Integer; +function GDIP_IS_WMF_RECORDTYPE(n: integer): BOOL; + + +{$IFDEF DELPHI6_UP} +type + {$EXTERNALSYM EmfPlusRecordType} + EmfPlusRecordType = ( + // Since we have to enumerate GDI records right along with GDI+ records, + // We list all the GDI records here so that they can be part of the + // same enumeration type which is used in the enumeration callback. + + WmfRecordTypeSetBkColor = (META_SETBKCOLOR or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetBkMode = (META_SETBKMODE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetMapMode = (META_SETMAPMODE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetROP2 = (META_SETROP2 or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetRelAbs = (META_SETRELABS or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetPolyFillMode = (META_SETPOLYFILLMODE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetStretchBltMode = (META_SETSTRETCHBLTMODE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetTextCharExtra = (META_SETTEXTCHAREXTRA or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetTextColor = (META_SETTEXTCOLOR or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetTextJustification = (META_SETTEXTJUSTIFICATION or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetWindowOrg = (META_SETWINDOWORG or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetWindowExt = (META_SETWINDOWEXT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetViewportOrg = (META_SETVIEWPORTORG or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetViewportExt = (META_SETVIEWPORTEXT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeOffsetWindowOrg = (META_OFFSETWINDOWORG or GDIP_WMF_RECORD_BASE), + WmfRecordTypeScaleWindowExt = (META_SCALEWINDOWEXT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeOffsetViewportOrg = (META_OFFSETVIEWPORTORG or GDIP_WMF_RECORD_BASE), + WmfRecordTypeScaleViewportExt = (META_SCALEVIEWPORTEXT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeLineTo = (META_LINETO or GDIP_WMF_RECORD_BASE), + WmfRecordTypeMoveTo = (META_MOVETO or GDIP_WMF_RECORD_BASE), + WmfRecordTypeExcludeClipRect = (META_EXCLUDECLIPRECT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeIntersectClipRect = (META_INTERSECTCLIPRECT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeArc = (META_ARC or GDIP_WMF_RECORD_BASE), + WmfRecordTypeEllipse = (META_ELLIPSE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeFloodFill = (META_FLOODFILL or GDIP_WMF_RECORD_BASE), + WmfRecordTypePie = (META_PIE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeRectangle = (META_RECTANGLE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeRoundRect = (META_ROUNDRECT or GDIP_WMF_RECORD_BASE), + WmfRecordTypePatBlt = (META_PATBLT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSaveDC = (META_SAVEDC or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetPixel = (META_SETPIXEL or GDIP_WMF_RECORD_BASE), + WmfRecordTypeOffsetClipRgn = (META_OFFSETCLIPRGN or GDIP_WMF_RECORD_BASE), + WmfRecordTypeTextOut = (META_TEXTOUT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeBitBlt = (META_BITBLT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeStretchBlt = (META_STRETCHBLT or GDIP_WMF_RECORD_BASE), + WmfRecordTypePolygon = (META_POLYGON or GDIP_WMF_RECORD_BASE), + WmfRecordTypePolyline = (META_POLYLINE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeEscape = (META_ESCAPE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeRestoreDC = (META_RESTOREDC or GDIP_WMF_RECORD_BASE), + WmfRecordTypeFillRegion = (META_FILLREGION or GDIP_WMF_RECORD_BASE), + WmfRecordTypeFrameRegion = (META_FRAMEREGION or GDIP_WMF_RECORD_BASE), + WmfRecordTypeInvertRegion = (META_INVERTREGION or GDIP_WMF_RECORD_BASE), + WmfRecordTypePaintRegion = (META_PAINTREGION or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSelectClipRegion = (META_SELECTCLIPREGION or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSelectObject = (META_SELECTOBJECT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetTextAlign = (META_SETTEXTALIGN or GDIP_WMF_RECORD_BASE), + WmfRecordTypeDrawText = ($062F or GDIP_WMF_RECORD_BASE), // META_DRAWTEXT + WmfRecordTypeChord = (META_CHORD or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetMapperFlags = (META_SETMAPPERFLAGS or GDIP_WMF_RECORD_BASE), + WmfRecordTypeExtTextOut = (META_EXTTEXTOUT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetDIBToDev = (META_SETDIBTODEV or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSelectPalette = (META_SELECTPALETTE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeRealizePalette = (META_REALIZEPALETTE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeAnimatePalette = (META_ANIMATEPALETTE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetPalEntries = (META_SETPALENTRIES or GDIP_WMF_RECORD_BASE), + WmfRecordTypePolyPolygon = (META_POLYPOLYGON or GDIP_WMF_RECORD_BASE), + WmfRecordTypeResizePalette = (META_RESIZEPALETTE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeDIBBitBlt = (META_DIBBITBLT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeDIBStretchBlt = (META_DIBSTRETCHBLT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeDIBCreatePatternBrush = (META_DIBCREATEPATTERNBRUSH or GDIP_WMF_RECORD_BASE), + WmfRecordTypeStretchDIB = (META_STRETCHDIB or GDIP_WMF_RECORD_BASE), + WmfRecordTypeExtFloodFill = (META_EXTFLOODFILL or GDIP_WMF_RECORD_BASE), + WmfRecordTypeSetLayout = ($0149 or GDIP_WMF_RECORD_BASE), // META_SETLAYOUT + WmfRecordTypeResetDC = ($014C or GDIP_WMF_RECORD_BASE), // META_RESETDC + WmfRecordTypeStartDoc = ($014D or GDIP_WMF_RECORD_BASE), // META_STARTDOC + WmfRecordTypeStartPage = ($004F or GDIP_WMF_RECORD_BASE), // META_STARTPAGE + WmfRecordTypeEndPage = ($0050 or GDIP_WMF_RECORD_BASE), // META_ENDPAGE + WmfRecordTypeAbortDoc = ($0052 or GDIP_WMF_RECORD_BASE), // META_ABORTDOC + WmfRecordTypeEndDoc = ($005E or GDIP_WMF_RECORD_BASE), // META_ENDDOC + WmfRecordTypeDeleteObject = (META_DELETEOBJECT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeCreatePalette = (META_CREATEPALETTE or GDIP_WMF_RECORD_BASE), + WmfRecordTypeCreateBrush = ($00F8 or GDIP_WMF_RECORD_BASE), // META_CREATEBRUSH + WmfRecordTypeCreatePatternBrush = (META_CREATEPATTERNBRUSH or GDIP_WMF_RECORD_BASE), + WmfRecordTypeCreatePenIndirect = (META_CREATEPENINDIRECT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeCreateFontIndirect = (META_CREATEFONTINDIRECT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeCreateBrushIndirect = (META_CREATEBRUSHINDIRECT or GDIP_WMF_RECORD_BASE), + WmfRecordTypeCreateBitmapIndirect = ($02FD or GDIP_WMF_RECORD_BASE), // META_CREATEBITMAPINDIRECT + WmfRecordTypeCreateBitmap = ($06FE or GDIP_WMF_RECORD_BASE), // META_CREATEBITMAP + WmfRecordTypeCreateRegion = (META_CREATEREGION or GDIP_WMF_RECORD_BASE), + + EmfRecordTypeHeader = EMR_HEADER, + EmfRecordTypePolyBezier = EMR_POLYBEZIER, + EmfRecordTypePolygon = EMR_POLYGON, + EmfRecordTypePolyline = EMR_POLYLINE, + EmfRecordTypePolyBezierTo = EMR_POLYBEZIERTO, + EmfRecordTypePolyLineTo = EMR_POLYLINETO, + EmfRecordTypePolyPolyline = EMR_POLYPOLYLINE, + EmfRecordTypePolyPolygon = EMR_POLYPOLYGON, + EmfRecordTypeSetWindowExtEx = EMR_SETWINDOWEXTEX, + EmfRecordTypeSetWindowOrgEx = EMR_SETWINDOWORGEX, + EmfRecordTypeSetViewportExtEx = EMR_SETVIEWPORTEXTEX, + EmfRecordTypeSetViewportOrgEx = EMR_SETVIEWPORTORGEX, + EmfRecordTypeSetBrushOrgEx = EMR_SETBRUSHORGEX, + EmfRecordTypeEOF = EMR_EOF, + EmfRecordTypeSetPixelV = EMR_SETPIXELV, + EmfRecordTypeSetMapperFlags = EMR_SETMAPPERFLAGS, + EmfRecordTypeSetMapMode = EMR_SETMAPMODE, + EmfRecordTypeSetBkMode = EMR_SETBKMODE, + EmfRecordTypeSetPolyFillMode = EMR_SETPOLYFILLMODE, + EmfRecordTypeSetROP2 = EMR_SETROP2, + EmfRecordTypeSetStretchBltMode = EMR_SETSTRETCHBLTMODE, + EmfRecordTypeSetTextAlign = EMR_SETTEXTALIGN, + EmfRecordTypeSetColorAdjustment = EMR_SETCOLORADJUSTMENT, + EmfRecordTypeSetTextColor = EMR_SETTEXTCOLOR, + EmfRecordTypeSetBkColor = EMR_SETBKCOLOR, + EmfRecordTypeOffsetClipRgn = EMR_OFFSETCLIPRGN, + EmfRecordTypeMoveToEx = EMR_MOVETOEX, + EmfRecordTypeSetMetaRgn = EMR_SETMETARGN, + EmfRecordTypeExcludeClipRect = EMR_EXCLUDECLIPRECT, + EmfRecordTypeIntersectClipRect = EMR_INTERSECTCLIPRECT, + EmfRecordTypeScaleViewportExtEx = EMR_SCALEVIEWPORTEXTEX, + EmfRecordTypeScaleWindowExtEx = EMR_SCALEWINDOWEXTEX, + EmfRecordTypeSaveDC = EMR_SAVEDC, + EmfRecordTypeRestoreDC = EMR_RESTOREDC, + EmfRecordTypeSetWorldTransform = EMR_SETWORLDTRANSFORM, + EmfRecordTypeModifyWorldTransform = EMR_MODIFYWORLDTRANSFORM, + EmfRecordTypeSelectObject = EMR_SELECTOBJECT, + EmfRecordTypeCreatePen = EMR_CREATEPEN, + EmfRecordTypeCreateBrushIndirect = EMR_CREATEBRUSHINDIRECT, + EmfRecordTypeDeleteObject = EMR_DELETEOBJECT, + EmfRecordTypeAngleArc = EMR_ANGLEARC, + EmfRecordTypeEllipse = EMR_ELLIPSE, + EmfRecordTypeRectangle = EMR_RECTANGLE, + EmfRecordTypeRoundRect = EMR_ROUNDRECT, + EmfRecordTypeArc = EMR_ARC, + EmfRecordTypeChord = EMR_CHORD, + EmfRecordTypePie = EMR_PIE, + EmfRecordTypeSelectPalette = EMR_SELECTPALETTE, + EmfRecordTypeCreatePalette = EMR_CREATEPALETTE, + EmfRecordTypeSetPaletteEntries = EMR_SETPALETTEENTRIES, + EmfRecordTypeResizePalette = EMR_RESIZEPALETTE, + EmfRecordTypeRealizePalette = EMR_REALIZEPALETTE, + EmfRecordTypeExtFloodFill = EMR_EXTFLOODFILL, + EmfRecordTypeLineTo = EMR_LINETO, + EmfRecordTypeArcTo = EMR_ARCTO, + EmfRecordTypePolyDraw = EMR_POLYDRAW, + EmfRecordTypeSetArcDirection = EMR_SETARCDIRECTION, + EmfRecordTypeSetMiterLimit = EMR_SETMITERLIMIT, + EmfRecordTypeBeginPath = EMR_BEGINPATH, + EmfRecordTypeEndPath = EMR_ENDPATH, + EmfRecordTypeCloseFigure = EMR_CLOSEFIGURE, + EmfRecordTypeFillPath = EMR_FILLPATH, + EmfRecordTypeStrokeAndFillPath = EMR_STROKEANDFILLPATH, + EmfRecordTypeStrokePath = EMR_STROKEPATH, + EmfRecordTypeFlattenPath = EMR_FLATTENPATH, + EmfRecordTypeWidenPath = EMR_WIDENPATH, + EmfRecordTypeSelectClipPath = EMR_SELECTCLIPPATH, + EmfRecordTypeAbortPath = EMR_ABORTPATH, + EmfRecordTypeReserved_069 = 69, // Not Used + EmfRecordTypeGdiComment = EMR_GDICOMMENT, + EmfRecordTypeFillRgn = EMR_FILLRGN, + EmfRecordTypeFrameRgn = EMR_FRAMERGN, + EmfRecordTypeInvertRgn = EMR_INVERTRGN, + EmfRecordTypePaintRgn = EMR_PAINTRGN, + EmfRecordTypeExtSelectClipRgn = EMR_EXTSELECTCLIPRGN, + EmfRecordTypeBitBlt = EMR_BITBLT, + EmfRecordTypeStretchBlt = EMR_STRETCHBLT, + EmfRecordTypeMaskBlt = EMR_MASKBLT, + EmfRecordTypePlgBlt = EMR_PLGBLT, + EmfRecordTypeSetDIBitsToDevice = EMR_SETDIBITSTODEVICE, + EmfRecordTypeStretchDIBits = EMR_STRETCHDIBITS, + EmfRecordTypeExtCreateFontIndirect = EMR_EXTCREATEFONTINDIRECTW, + EmfRecordTypeExtTextOutA = EMR_EXTTEXTOUTA, + EmfRecordTypeExtTextOutW = EMR_EXTTEXTOUTW, + EmfRecordTypePolyBezier16 = EMR_POLYBEZIER16, + EmfRecordTypePolygon16 = EMR_POLYGON16, + EmfRecordTypePolyline16 = EMR_POLYLINE16, + EmfRecordTypePolyBezierTo16 = EMR_POLYBEZIERTO16, + EmfRecordTypePolylineTo16 = EMR_POLYLINETO16, + EmfRecordTypePolyPolyline16 = EMR_POLYPOLYLINE16, + EmfRecordTypePolyPolygon16 = EMR_POLYPOLYGON16, + EmfRecordTypePolyDraw16 = EMR_POLYDRAW16, + EmfRecordTypeCreateMonoBrush = EMR_CREATEMONOBRUSH, + EmfRecordTypeCreateDIBPatternBrushPt = EMR_CREATEDIBPATTERNBRUSHPT, + EmfRecordTypeExtCreatePen = EMR_EXTCREATEPEN, + EmfRecordTypePolyTextOutA = EMR_POLYTEXTOUTA, + EmfRecordTypePolyTextOutW = EMR_POLYTEXTOUTW, + EmfRecordTypeSetICMMode = 98, // EMR_SETICMMODE, + EmfRecordTypeCreateColorSpace = 99, // EMR_CREATECOLORSPACE, + EmfRecordTypeSetColorSpace = 100, // EMR_SETCOLORSPACE, + EmfRecordTypeDeleteColorSpace = 101, // EMR_DELETECOLORSPACE, + EmfRecordTypeGLSRecord = 102, // EMR_GLSRECORD, + EmfRecordTypeGLSBoundedRecord = 103, // EMR_GLSBOUNDEDRECORD, + EmfRecordTypePixelFormat = 104, // EMR_PIXELFORMAT, + EmfRecordTypeDrawEscape = 105, // EMR_RESERVED_105, + EmfRecordTypeExtEscape = 106, // EMR_RESERVED_106, + EmfRecordTypeStartDoc = 107, // EMR_RESERVED_107, + EmfRecordTypeSmallTextOut = 108, // EMR_RESERVED_108, + EmfRecordTypeForceUFIMapping = 109, // EMR_RESERVED_109, + EmfRecordTypeNamedEscape = 110, // EMR_RESERVED_110, + EmfRecordTypeColorCorrectPalette = 111, // EMR_COLORCORRECTPALETTE, + EmfRecordTypeSetICMProfileA = 112, // EMR_SETICMPROFILEA, + EmfRecordTypeSetICMProfileW = 113, // EMR_SETICMPROFILEW, + EmfRecordTypeAlphaBlend = 114, // EMR_ALPHABLEND, + EmfRecordTypeSetLayout = 115, // EMR_SETLAYOUT, + EmfRecordTypeTransparentBlt = 116, // EMR_TRANSPARENTBLT, + EmfRecordTypeReserved_117 = 117, // Not Used + EmfRecordTypeGradientFill = 118, // EMR_GRADIENTFILL, + EmfRecordTypeSetLinkedUFIs = 119, // EMR_RESERVED_119, + EmfRecordTypeSetTextJustification = 120, // EMR_RESERVED_120, + EmfRecordTypeColorMatchToTargetW = 121, // EMR_COLORMATCHTOTARGETW, + EmfRecordTypeCreateColorSpaceW = 122, // EMR_CREATECOLORSPACEW, + EmfRecordTypeMax = 122, + EmfRecordTypeMin = 1, + + // That is the END of the GDI EMF records. + + // Now we start the list of EMF+ records. We leave quite + // a bit of room here for the addition of any new GDI + // records that may be added later. + + EmfPlusRecordTypeInvalid = GDIP_EMFPLUS_RECORD_BASE, + EmfPlusRecordTypeHeader, + EmfPlusRecordTypeEndOfFile, + + EmfPlusRecordTypeComment, + + EmfPlusRecordTypeGetDC, + + EmfPlusRecordTypeMultiFormatStart, + EmfPlusRecordTypeMultiFormatSection, + EmfPlusRecordTypeMultiFormatEnd, + + // For all persistent objects + + EmfPlusRecordTypeObject, + + // Drawing Records + + EmfPlusRecordTypeClear, + EmfPlusRecordTypeFillRects, + EmfPlusRecordTypeDrawRects, + EmfPlusRecordTypeFillPolygon, + EmfPlusRecordTypeDrawLines, + EmfPlusRecordTypeFillEllipse, + EmfPlusRecordTypeDrawEllipse, + EmfPlusRecordTypeFillPie, + EmfPlusRecordTypeDrawPie, + EmfPlusRecordTypeDrawArc, + EmfPlusRecordTypeFillRegion, + EmfPlusRecordTypeFillPath, + EmfPlusRecordTypeDrawPath, + EmfPlusRecordTypeFillClosedCurve, + EmfPlusRecordTypeDrawClosedCurve, + EmfPlusRecordTypeDrawCurve, + EmfPlusRecordTypeDrawBeziers, + EmfPlusRecordTypeDrawImage, + EmfPlusRecordTypeDrawImagePoints, + EmfPlusRecordTypeDrawString, + + // Graphics State Records + + EmfPlusRecordTypeSetRenderingOrigin, + EmfPlusRecordTypeSetAntiAliasMode, + EmfPlusRecordTypeSetTextRenderingHint, + EmfPlusRecordTypeSetTextContrast, + EmfPlusRecordTypeSetInterpolationMode, + EmfPlusRecordTypeSetPixelOffsetMode, + EmfPlusRecordTypeSetCompositingMode, + EmfPlusRecordTypeSetCompositingQuality, + EmfPlusRecordTypeSave, + EmfPlusRecordTypeRestore, + EmfPlusRecordTypeBeginContainer, + EmfPlusRecordTypeBeginContainerNoParams, + EmfPlusRecordTypeEndContainer, + EmfPlusRecordTypeSetWorldTransform, + EmfPlusRecordTypeResetWorldTransform, + EmfPlusRecordTypeMultiplyWorldTransform, + EmfPlusRecordTypeTranslateWorldTransform, + EmfPlusRecordTypeScaleWorldTransform, + EmfPlusRecordTypeRotateWorldTransform, + EmfPlusRecordTypeSetPageTransform, + EmfPlusRecordTypeResetClip, + EmfPlusRecordTypeSetClipRect, + EmfPlusRecordTypeSetClipPath, + EmfPlusRecordTypeSetClipRegion, + EmfPlusRecordTypeOffsetClip, + + EmfPlusRecordTypeDrawDriverString, + + EmfPlusRecordTotal, + + EmfPlusRecordTypeMax = EmfPlusRecordTotal-1, + EmfPlusRecordTypeMin = EmfPlusRecordTypeHeader + ); + TEmfPlusRecordType = EmfPlusRecordType; +{$ELSE} +type + {$EXTERNALSYM EmfPlusRecordType} + EmfPlusRecordType = Integer; + // Since we have to enumerate GDI records right along with GDI+ records, + // We list all the GDI records here so that they can be part of the + // same enumeration type which is used in the enumeration callback. + const + WmfRecordTypeSetBkColor = (META_SETBKCOLOR or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetBkMode = (META_SETBKMODE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetMapMode = (META_SETMAPMODE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetROP2 = (META_SETROP2 or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetRelAbs = (META_SETRELABS or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetPolyFillMode = (META_SETPOLYFILLMODE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetStretchBltMode = (META_SETSTRETCHBLTMODE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetTextCharExtra = (META_SETTEXTCHAREXTRA or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetTextColor = (META_SETTEXTCOLOR or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetTextJustification = (META_SETTEXTJUSTIFICATION or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetWindowOrg = (META_SETWINDOWORG or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetWindowExt = (META_SETWINDOWEXT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetViewportOrg = (META_SETVIEWPORTORG or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetViewportExt = (META_SETVIEWPORTEXT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeOffsetWindowOrg = (META_OFFSETWINDOWORG or GDIP_WMF_RECORD_BASE); + WmfRecordTypeScaleWindowExt = (META_SCALEWINDOWEXT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeOffsetViewportOrg = (META_OFFSETVIEWPORTORG or GDIP_WMF_RECORD_BASE); + WmfRecordTypeScaleViewportExt = (META_SCALEVIEWPORTEXT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeLineTo = (META_LINETO or GDIP_WMF_RECORD_BASE); + WmfRecordTypeMoveTo = (META_MOVETO or GDIP_WMF_RECORD_BASE); + WmfRecordTypeExcludeClipRect = (META_EXCLUDECLIPRECT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeIntersectClipRect = (META_INTERSECTCLIPRECT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeArc = (META_ARC or GDIP_WMF_RECORD_BASE); + WmfRecordTypeEllipse = (META_ELLIPSE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeFloodFill = (META_FLOODFILL or GDIP_WMF_RECORD_BASE); + WmfRecordTypePie = (META_PIE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeRectangle = (META_RECTANGLE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeRoundRect = (META_ROUNDRECT or GDIP_WMF_RECORD_BASE); + WmfRecordTypePatBlt = (META_PATBLT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSaveDC = (META_SAVEDC or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetPixel = (META_SETPIXEL or GDIP_WMF_RECORD_BASE); + WmfRecordTypeOffsetClipRgn = (META_OFFSETCLIPRGN or GDIP_WMF_RECORD_BASE); + WmfRecordTypeTextOut = (META_TEXTOUT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeBitBlt = (META_BITBLT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeStretchBlt = (META_STRETCHBLT or GDIP_WMF_RECORD_BASE); + WmfRecordTypePolygon = (META_POLYGON or GDIP_WMF_RECORD_BASE); + WmfRecordTypePolyline = (META_POLYLINE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeEscape = (META_ESCAPE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeRestoreDC = (META_RESTOREDC or GDIP_WMF_RECORD_BASE); + WmfRecordTypeFillRegion = (META_FILLREGION or GDIP_WMF_RECORD_BASE); + WmfRecordTypeFrameRegion = (META_FRAMEREGION or GDIP_WMF_RECORD_BASE); + WmfRecordTypeInvertRegion = (META_INVERTREGION or GDIP_WMF_RECORD_BASE); + WmfRecordTypePaintRegion = (META_PAINTREGION or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSelectClipRegion = (META_SELECTCLIPREGION or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSelectObject = (META_SELECTOBJECT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetTextAlign = (META_SETTEXTALIGN or GDIP_WMF_RECORD_BASE); + WmfRecordTypeDrawText = ($062F or GDIP_WMF_RECORD_BASE); // META_DRAWTEXT + WmfRecordTypeChord = (META_CHORD or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetMapperFlags = (META_SETMAPPERFLAGS or GDIP_WMF_RECORD_BASE); + WmfRecordTypeExtTextOut = (META_EXTTEXTOUT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetDIBToDev = (META_SETDIBTODEV or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSelectPalette = (META_SELECTPALETTE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeRealizePalette = (META_REALIZEPALETTE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeAnimatePalette = (META_ANIMATEPALETTE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetPalEntries = (META_SETPALENTRIES or GDIP_WMF_RECORD_BASE); + WmfRecordTypePolyPolygon = (META_POLYPOLYGON or GDIP_WMF_RECORD_BASE); + WmfRecordTypeResizePalette = (META_RESIZEPALETTE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeDIBBitBlt = (META_DIBBITBLT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeDIBStretchBlt = (META_DIBSTRETCHBLT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeDIBCreatePatternBrush = (META_DIBCREATEPATTERNBRUSH or GDIP_WMF_RECORD_BASE); + WmfRecordTypeStretchDIB = (META_STRETCHDIB or GDIP_WMF_RECORD_BASE); + WmfRecordTypeExtFloodFill = (META_EXTFLOODFILL or GDIP_WMF_RECORD_BASE); + WmfRecordTypeSetLayout = ($0149 or GDIP_WMF_RECORD_BASE); // META_SETLAYOUT + WmfRecordTypeResetDC = ($014C or GDIP_WMF_RECORD_BASE); // META_RESETDC + WmfRecordTypeStartDoc = ($014D or GDIP_WMF_RECORD_BASE); // META_STARTDOC + WmfRecordTypeStartPage = ($004F or GDIP_WMF_RECORD_BASE); // META_STARTPAGE + WmfRecordTypeEndPage = ($0050 or GDIP_WMF_RECORD_BASE); // META_ENDPAGE + WmfRecordTypeAbortDoc = ($0052 or GDIP_WMF_RECORD_BASE); // META_ABORTDOC + WmfRecordTypeEndDoc = ($005E or GDIP_WMF_RECORD_BASE); // META_ENDDOC + WmfRecordTypeDeleteObject = (META_DELETEOBJECT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeCreatePalette = (META_CREATEPALETTE or GDIP_WMF_RECORD_BASE); + WmfRecordTypeCreateBrush = ($00F8 or GDIP_WMF_RECORD_BASE); // META_CREATEBRUSH + WmfRecordTypeCreatePatternBrush = (META_CREATEPATTERNBRUSH or GDIP_WMF_RECORD_BASE); + WmfRecordTypeCreatePenIndirect = (META_CREATEPENINDIRECT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeCreateFontIndirect = (META_CREATEFONTINDIRECT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeCreateBrushIndirect = (META_CREATEBRUSHINDIRECT or GDIP_WMF_RECORD_BASE); + WmfRecordTypeCreateBitmapIndirect = ($02FD or GDIP_WMF_RECORD_BASE); // META_CREATEBITMAPINDIRECT + WmfRecordTypeCreateBitmap = ($06FE or GDIP_WMF_RECORD_BASE); // META_CREATEBITMAP + WmfRecordTypeCreateRegion = (META_CREATEREGION or GDIP_WMF_RECORD_BASE); + + EmfRecordTypeHeader = EMR_HEADER; + EmfRecordTypePolyBezier = EMR_POLYBEZIER; + EmfRecordTypePolygon = EMR_POLYGON; + EmfRecordTypePolyline = EMR_POLYLINE; + EmfRecordTypePolyBezierTo = EMR_POLYBEZIERTO; + EmfRecordTypePolyLineTo = EMR_POLYLINETO; + EmfRecordTypePolyPolyline = EMR_POLYPOLYLINE; + EmfRecordTypePolyPolygon = EMR_POLYPOLYGON; + EmfRecordTypeSetWindowExtEx = EMR_SETWINDOWEXTEX; + EmfRecordTypeSetWindowOrgEx = EMR_SETWINDOWORGEX; + EmfRecordTypeSetViewportExtEx = EMR_SETVIEWPORTEXTEX; + EmfRecordTypeSetViewportOrgEx = EMR_SETVIEWPORTORGEX; + EmfRecordTypeSetBrushOrgEx = EMR_SETBRUSHORGEX; + EmfRecordTypeEOF = EMR_EOF; + EmfRecordTypeSetPixelV = EMR_SETPIXELV; + EmfRecordTypeSetMapperFlags = EMR_SETMAPPERFLAGS; + EmfRecordTypeSetMapMode = EMR_SETMAPMODE; + EmfRecordTypeSetBkMode = EMR_SETBKMODE; + EmfRecordTypeSetPolyFillMode = EMR_SETPOLYFILLMODE; + EmfRecordTypeSetROP2 = EMR_SETROP2; + EmfRecordTypeSetStretchBltMode = EMR_SETSTRETCHBLTMODE; + EmfRecordTypeSetTextAlign = EMR_SETTEXTALIGN; + EmfRecordTypeSetColorAdjustment = EMR_SETCOLORADJUSTMENT; + EmfRecordTypeSetTextColor = EMR_SETTEXTCOLOR; + EmfRecordTypeSetBkColor = EMR_SETBKCOLOR; + EmfRecordTypeOffsetClipRgn = EMR_OFFSETCLIPRGN; + EmfRecordTypeMoveToEx = EMR_MOVETOEX; + EmfRecordTypeSetMetaRgn = EMR_SETMETARGN; + EmfRecordTypeExcludeClipRect = EMR_EXCLUDECLIPRECT; + EmfRecordTypeIntersectClipRect = EMR_INTERSECTCLIPRECT; + EmfRecordTypeScaleViewportExtEx = EMR_SCALEVIEWPORTEXTEX; + EmfRecordTypeScaleWindowExtEx = EMR_SCALEWINDOWEXTEX; + EmfRecordTypeSaveDC = EMR_SAVEDC; + EmfRecordTypeRestoreDC = EMR_RESTOREDC; + EmfRecordTypeSetWorldTransform = EMR_SETWORLDTRANSFORM; + EmfRecordTypeModifyWorldTransform = EMR_MODIFYWORLDTRANSFORM; + EmfRecordTypeSelectObject = EMR_SELECTOBJECT; + EmfRecordTypeCreatePen = EMR_CREATEPEN; + EmfRecordTypeCreateBrushIndirect = EMR_CREATEBRUSHINDIRECT; + EmfRecordTypeDeleteObject = EMR_DELETEOBJECT; + EmfRecordTypeAngleArc = EMR_ANGLEARC; + EmfRecordTypeEllipse = EMR_ELLIPSE; + EmfRecordTypeRectangle = EMR_RECTANGLE; + EmfRecordTypeRoundRect = EMR_ROUNDRECT; + EmfRecordTypeArc = EMR_ARC; + EmfRecordTypeChord = EMR_CHORD; + EmfRecordTypePie = EMR_PIE; + EmfRecordTypeSelectPalette = EMR_SELECTPALETTE; + EmfRecordTypeCreatePalette = EMR_CREATEPALETTE; + EmfRecordTypeSetPaletteEntries = EMR_SETPALETTEENTRIES; + EmfRecordTypeResizePalette = EMR_RESIZEPALETTE; + EmfRecordTypeRealizePalette = EMR_REALIZEPALETTE; + EmfRecordTypeExtFloodFill = EMR_EXTFLOODFILL; + EmfRecordTypeLineTo = EMR_LINETO; + EmfRecordTypeArcTo = EMR_ARCTO; + EmfRecordTypePolyDraw = EMR_POLYDRAW; + EmfRecordTypeSetArcDirection = EMR_SETARCDIRECTION; + EmfRecordTypeSetMiterLimit = EMR_SETMITERLIMIT; + EmfRecordTypeBeginPath = EMR_BEGINPATH; + EmfRecordTypeEndPath = EMR_ENDPATH; + EmfRecordTypeCloseFigure = EMR_CLOSEFIGURE; + EmfRecordTypeFillPath = EMR_FILLPATH; + EmfRecordTypeStrokeAndFillPath = EMR_STROKEANDFILLPATH; + EmfRecordTypeStrokePath = EMR_STROKEPATH; + EmfRecordTypeFlattenPath = EMR_FLATTENPATH; + EmfRecordTypeWidenPath = EMR_WIDENPATH; + EmfRecordTypeSelectClipPath = EMR_SELECTCLIPPATH; + EmfRecordTypeAbortPath = EMR_ABORTPATH; + EmfRecordTypeReserved_069 = 69; // Not Used + EmfRecordTypeGdiComment = EMR_GDICOMMENT; + EmfRecordTypeFillRgn = EMR_FILLRGN; + EmfRecordTypeFrameRgn = EMR_FRAMERGN; + EmfRecordTypeInvertRgn = EMR_INVERTRGN; + EmfRecordTypePaintRgn = EMR_PAINTRGN; + EmfRecordTypeExtSelectClipRgn = EMR_EXTSELECTCLIPRGN; + EmfRecordTypeBitBlt = EMR_BITBLT; + EmfRecordTypeStretchBlt = EMR_STRETCHBLT; + EmfRecordTypeMaskBlt = EMR_MASKBLT; + EmfRecordTypePlgBlt = EMR_PLGBLT; + EmfRecordTypeSetDIBitsToDevice = EMR_SETDIBITSTODEVICE; + EmfRecordTypeStretchDIBits = EMR_STRETCHDIBITS; + EmfRecordTypeExtCreateFontIndirect = EMR_EXTCREATEFONTINDIRECTW; + EmfRecordTypeExtTextOutA = EMR_EXTTEXTOUTA; + EmfRecordTypeExtTextOutW = EMR_EXTTEXTOUTW; + EmfRecordTypePolyBezier16 = EMR_POLYBEZIER16; + EmfRecordTypePolygon16 = EMR_POLYGON16; + EmfRecordTypePolyline16 = EMR_POLYLINE16; + EmfRecordTypePolyBezierTo16 = EMR_POLYBEZIERTO16; + EmfRecordTypePolylineTo16 = EMR_POLYLINETO16; + EmfRecordTypePolyPolyline16 = EMR_POLYPOLYLINE16; + EmfRecordTypePolyPolygon16 = EMR_POLYPOLYGON16; + EmfRecordTypePolyDraw16 = EMR_POLYDRAW16; + EmfRecordTypeCreateMonoBrush = EMR_CREATEMONOBRUSH; + EmfRecordTypeCreateDIBPatternBrushPt = EMR_CREATEDIBPATTERNBRUSHPT; + EmfRecordTypeExtCreatePen = EMR_EXTCREATEPEN; + EmfRecordTypePolyTextOutA = EMR_POLYTEXTOUTA; + EmfRecordTypePolyTextOutW = EMR_POLYTEXTOUTW; + EmfRecordTypeSetICMMode = 98; // EMR_SETICMMODE, + EmfRecordTypeCreateColorSpace = 99; // EMR_CREATECOLORSPACE, + EmfRecordTypeSetColorSpace = 100; // EMR_SETCOLORSPACE, + EmfRecordTypeDeleteColorSpace = 101; // EMR_DELETECOLORSPACE, + EmfRecordTypeGLSRecord = 102; // EMR_GLSRECORD, + EmfRecordTypeGLSBoundedRecord = 103; // EMR_GLSBOUNDEDRECORD, + EmfRecordTypePixelFormat = 104; // EMR_PIXELFORMAT, + EmfRecordTypeDrawEscape = 105; // EMR_RESERVED_105, + EmfRecordTypeExtEscape = 106; // EMR_RESERVED_106, + EmfRecordTypeStartDoc = 107; // EMR_RESERVED_107, + EmfRecordTypeSmallTextOut = 108; // EMR_RESERVED_108, + EmfRecordTypeForceUFIMapping = 109; // EMR_RESERVED_109, + EmfRecordTypeNamedEscape = 110; // EMR_RESERVED_110, + EmfRecordTypeColorCorrectPalette = 111; // EMR_COLORCORRECTPALETTE, + EmfRecordTypeSetICMProfileA = 112; // EMR_SETICMPROFILEA, + EmfRecordTypeSetICMProfileW = 113; // EMR_SETICMPROFILEW, + EmfRecordTypeAlphaBlend = 114; // EMR_ALPHABLEND, + EmfRecordTypeSetLayout = 115; // EMR_SETLAYOUT, + EmfRecordTypeTransparentBlt = 116; // EMR_TRANSPARENTBLT, + EmfRecordTypeReserved_117 = 117; // Not Used + EmfRecordTypeGradientFill = 118; // EMR_GRADIENTFILL, + EmfRecordTypeSetLinkedUFIs = 119; // EMR_RESERVED_119, + EmfRecordTypeSetTextJustification = 120; // EMR_RESERVED_120, + EmfRecordTypeColorMatchToTargetW = 121; // EMR_COLORMATCHTOTARGETW, + EmfRecordTypeCreateColorSpaceW = 122; // EMR_CREATECOLORSPACEW, + EmfRecordTypeMax = 122; + EmfRecordTypeMin = 1; + + // That is the END of the GDI EMF records. + + // Now we start the list of EMF+ records. We leave quite + // a bit of room here for the addition of any new GDI + // records that may be added later. + + EmfPlusRecordTypeInvalid = GDIP_EMFPLUS_RECORD_BASE; + EmfPlusRecordTypeHeader = GDIP_EMFPLUS_RECORD_BASE + 1; + EmfPlusRecordTypeEndOfFile = GDIP_EMFPLUS_RECORD_BASE + 2; + + EmfPlusRecordTypeComment = GDIP_EMFPLUS_RECORD_BASE + 3; + + EmfPlusRecordTypeGetDC = GDIP_EMFPLUS_RECORD_BASE + 4; + + EmfPlusRecordTypeMultiFormatStart = GDIP_EMFPLUS_RECORD_BASE + 5; + EmfPlusRecordTypeMultiFormatSection = GDIP_EMFPLUS_RECORD_BASE + 6; + EmfPlusRecordTypeMultiFormatEnd = GDIP_EMFPLUS_RECORD_BASE + 7; + + // For all persistent objects + + EmfPlusRecordTypeObject = GDIP_EMFPLUS_RECORD_BASE + 8; + + // Drawing Records + + EmfPlusRecordTypeClear = GDIP_EMFPLUS_RECORD_BASE + 9; + EmfPlusRecordTypeFillRects = GDIP_EMFPLUS_RECORD_BASE + 10; + EmfPlusRecordTypeDrawRects = GDIP_EMFPLUS_RECORD_BASE + 11; + EmfPlusRecordTypeFillPolygon = GDIP_EMFPLUS_RECORD_BASE + 12; + EmfPlusRecordTypeDrawLines = GDIP_EMFPLUS_RECORD_BASE + 13; + EmfPlusRecordTypeFillEllipse = GDIP_EMFPLUS_RECORD_BASE + 14; + EmfPlusRecordTypeDrawEllipse = GDIP_EMFPLUS_RECORD_BASE + 15; + EmfPlusRecordTypeFillPie = GDIP_EMFPLUS_RECORD_BASE + 16; + EmfPlusRecordTypeDrawPie = GDIP_EMFPLUS_RECORD_BASE + 17; + EmfPlusRecordTypeDrawArc = GDIP_EMFPLUS_RECORD_BASE + 18; + EmfPlusRecordTypeFillRegion = GDIP_EMFPLUS_RECORD_BASE + 19; + EmfPlusRecordTypeFillPath = GDIP_EMFPLUS_RECORD_BASE + 20; + EmfPlusRecordTypeDrawPath = GDIP_EMFPLUS_RECORD_BASE + 21; + EmfPlusRecordTypeFillClosedCurve = GDIP_EMFPLUS_RECORD_BASE + 22; + EmfPlusRecordTypeDrawClosedCurve = GDIP_EMFPLUS_RECORD_BASE + 23; + EmfPlusRecordTypeDrawCurve = GDIP_EMFPLUS_RECORD_BASE + 24; + EmfPlusRecordTypeDrawBeziers = GDIP_EMFPLUS_RECORD_BASE + 25; + EmfPlusRecordTypeDrawImage = GDIP_EMFPLUS_RECORD_BASE + 26; + EmfPlusRecordTypeDrawImagePoints = GDIP_EMFPLUS_RECORD_BASE + 27; + EmfPlusRecordTypeDrawString = GDIP_EMFPLUS_RECORD_BASE + 28; + + // Graphics State Records + + EmfPlusRecordTypeSetRenderingOrigin = GDIP_EMFPLUS_RECORD_BASE + 29; + EmfPlusRecordTypeSetAntiAliasMode = GDIP_EMFPLUS_RECORD_BASE + 30; + EmfPlusRecordTypeSetTextRenderingHint = GDIP_EMFPLUS_RECORD_BASE + 31; + EmfPlusRecordTypeSetTextContrast = GDIP_EMFPLUS_RECORD_BASE + 32; + EmfPlusRecordTypeSetInterpolationMode = GDIP_EMFPLUS_RECORD_BASE + 33; + EmfPlusRecordTypeSetPixelOffsetMode = GDIP_EMFPLUS_RECORD_BASE + 34; + EmfPlusRecordTypeSetCompositingMode = GDIP_EMFPLUS_RECORD_BASE + 35; + EmfPlusRecordTypeSetCompositingQuality = GDIP_EMFPLUS_RECORD_BASE + 36; + EmfPlusRecordTypeSave = GDIP_EMFPLUS_RECORD_BASE + 37; + EmfPlusRecordTypeRestore = GDIP_EMFPLUS_RECORD_BASE + 38; + EmfPlusRecordTypeBeginContainer = GDIP_EMFPLUS_RECORD_BASE + 39; + EmfPlusRecordTypeBeginContainerNoParams = GDIP_EMFPLUS_RECORD_BASE + 40; + EmfPlusRecordTypeEndContainer = GDIP_EMFPLUS_RECORD_BASE + 41; + EmfPlusRecordTypeSetWorldTransform = GDIP_EMFPLUS_RECORD_BASE + 42; + EmfPlusRecordTypeResetWorldTransform = GDIP_EMFPLUS_RECORD_BASE + 43; + EmfPlusRecordTypeMultiplyWorldTransform = GDIP_EMFPLUS_RECORD_BASE + 44; + EmfPlusRecordTypeTranslateWorldTransform = GDIP_EMFPLUS_RECORD_BASE + 45; + EmfPlusRecordTypeScaleWorldTransform = GDIP_EMFPLUS_RECORD_BASE + 46; + EmfPlusRecordTypeRotateWorldTransform = GDIP_EMFPLUS_RECORD_BASE + 47; + EmfPlusRecordTypeSetPageTransform = GDIP_EMFPLUS_RECORD_BASE + 48; + EmfPlusRecordTypeResetClip = GDIP_EMFPLUS_RECORD_BASE + 49; + EmfPlusRecordTypeSetClipRect = GDIP_EMFPLUS_RECORD_BASE + 50; + EmfPlusRecordTypeSetClipPath = GDIP_EMFPLUS_RECORD_BASE + 51; + EmfPlusRecordTypeSetClipRegion = GDIP_EMFPLUS_RECORD_BASE + 52; + EmfPlusRecordTypeOffsetClip = GDIP_EMFPLUS_RECORD_BASE + 53; + + EmfPlusRecordTypeDrawDriverString = GDIP_EMFPLUS_RECORD_BASE + 54; + + EmfPlusRecordTotal = GDIP_EMFPLUS_RECORD_BASE + 55; + + EmfPlusRecordTypeMax = EmfPlusRecordTotal-1; + EmfPlusRecordTypeMin = EmfPlusRecordTypeHeader; + +type + TEmfPlusRecordType = EmfPlusRecordType; +{$ENDIF} +//--------------------------------------------------------------------------- +// StringFormatFlags +//--------------------------------------------------------------------------- + +//--------------------------------------------------------------------------- +// String format flags +// +// DirectionRightToLeft - For horizontal text, the reading order is +// right to left. This value is called +// the base embedding level by the Unicode +// bidirectional engine. +// For vertical text, columns are read from +// right to left. +// By default, horizontal or vertical text is +// read from left to right. +// +// DirectionVertical - Individual lines of text are vertical. In +// each line, characters progress from top to +// bottom. +// By default, lines of text are horizontal, +// each new line below the previous line. +// +// NoFitBlackBox - Allows parts of glyphs to overhang the +// bounding rectangle. +// By default glyphs are first aligned +// inside the margines, then any glyphs which +// still overhang the bounding box are +// repositioned to avoid any overhang. +// For example when an italic +// lower case letter f in a font such as +// Garamond is aligned at the far left of a +// rectangle, the lower part of the f will +// reach slightly further left than the left +// edge of the rectangle. Setting this flag +// will ensure the character aligns visually +// with the lines above and below, but may +// cause some pixels outside the formatting +// rectangle to be clipped or painted. +// +// DisplayFormatControl - Causes control characters such as the +// left-to-right mark to be shown in the +// output with a representative glyph. +// +// NoFontFallback - Disables fallback to alternate fonts for +// characters not supported in the requested +// font. Any missing characters will be +// be displayed with the fonts missing glyph, +// usually an open square. +// +// NoWrap - Disables wrapping of text between lines +// when formatting within a rectangle. +// NoWrap is implied when a point is passed +// instead of a rectangle, or when the +// specified rectangle has a zero line length. +// +// NoClip - By default text is clipped to the +// formatting rectangle. Setting NoClip +// allows overhanging pixels to affect the +// device outside the formatting rectangle. +// Pixels at the end of the line may be +// affected if the glyphs overhang their +// cells, and either the NoFitBlackBox flag +// has been set, or the glyph extends to far +// to be fitted. +// Pixels above/before the first line or +// below/after the last line may be affected +// if the glyphs extend beyond their cell +// ascent / descent. This can occur rarely +// with unusual diacritic mark combinations. + +//--------------------------------------------------------------------------- + + {$EXTERNALSYM StringFormatFlags} + StringFormatFlags = Integer; + const + StringFormatFlagsDirectionRightToLeft = $00000001; + StringFormatFlagsDirectionVertical = $00000002; + StringFormatFlagsNoFitBlackBox = $00000004; + StringFormatFlagsDisplayFormatControl = $00000020; + StringFormatFlagsNoFontFallback = $00000400; + StringFormatFlagsMeasureTrailingSpaces = $00000800; + StringFormatFlagsNoWrap = $00001000; + StringFormatFlagsLineLimit = $00002000; + + StringFormatFlagsNoClip = $00004000; + +Type + TStringFormatFlags = StringFormatFlags; + +//--------------------------------------------------------------------------- +// StringTrimming +//--------------------------------------------------------------------------- + + {$EXTERNALSYM StringTrimming} + StringTrimming = ( + StringTrimmingNone, + StringTrimmingCharacter, + StringTrimmingWord, + StringTrimmingEllipsisCharacter, + StringTrimmingEllipsisWord, + StringTrimmingEllipsisPath + ); + TStringTrimming = StringTrimming; + +//--------------------------------------------------------------------------- +// National language digit substitution +//--------------------------------------------------------------------------- + + {$EXTERNALSYM StringDigitSubstitute} + StringDigitSubstitute = ( + StringDigitSubstituteUser, // As NLS setting + StringDigitSubstituteNone, + StringDigitSubstituteNational, + StringDigitSubstituteTraditional + ); + TStringDigitSubstitute = StringDigitSubstitute; + PStringDigitSubstitute = ^TStringDigitSubstitute; + +//--------------------------------------------------------------------------- +// Hotkey prefix interpretation +//--------------------------------------------------------------------------- + + {$EXTERNALSYM HotkeyPrefix} + HotkeyPrefix = ( + HotkeyPrefixNone, + HotkeyPrefixShow, + HotkeyPrefixHide + ); + THotkeyPrefix = HotkeyPrefix; + +//--------------------------------------------------------------------------- +// String alignment flags +//--------------------------------------------------------------------------- + + {$EXTERNALSYM StringAlignment} + StringAlignment = ( + // Left edge for left-to-right text, + // right for right-to-left text, + // and top for vertical + StringAlignmentNear, + StringAlignmentCenter, + StringAlignmentFar + ); + TStringAlignment = StringAlignment; + +//--------------------------------------------------------------------------- +// DriverStringOptions +//--------------------------------------------------------------------------- + + {$EXTERNALSYM DriverStringOptions} + DriverStringOptions = Integer; + const + DriverStringOptionsCmapLookup = 1; + DriverStringOptionsVertical = 2; + DriverStringOptionsRealizedAdvance = 4; + DriverStringOptionsLimitSubpixel = 8; + +type + TDriverStringOptions = DriverStringOptions; + +//--------------------------------------------------------------------------- +// Flush Intention flags +//--------------------------------------------------------------------------- + + {$EXTERNALSYM FlushIntention} + FlushIntention = ( + FlushIntentionFlush, // Flush all batched rendering operations + FlushIntentionSync // Flush all batched rendering operations + // and wait for them to complete + ); + TFlushIntention = FlushIntention; + +//--------------------------------------------------------------------------- +// Image encoder parameter related types +//--------------------------------------------------------------------------- + + {$EXTERNALSYM EncoderParameterValueType} + EncoderParameterValueType = Integer; + const + EncoderParameterValueTypeByte : Integer = 1; // 8-bit unsigned int + EncoderParameterValueTypeASCII : Integer = 2; // 8-bit byte containing one 7-bit ASCII + // code. NULL terminated. + EncoderParameterValueTypeShort : Integer = 3; // 16-bit unsigned int + EncoderParameterValueTypeLong : Integer = 4; // 32-bit unsigned int + EncoderParameterValueTypeRational : Integer = 5; // Two Longs. The first Long is the + // numerator, the second Long expresses the + // denomintor. + EncoderParameterValueTypeLongRange : Integer = 6; // Two longs which specify a range of + // integer values. The first Long specifies + // the lower end and the second one + // specifies the higher end. All values + // are inclusive at both ends + EncoderParameterValueTypeUndefined : Integer = 7; // 8-bit byte that can take any value + // depending on field definition + EncoderParameterValueTypeRationalRange : Integer = 8; // Two Rationals. The first Rational + // specifies the lower end and the second + // specifies the higher end. All values + // are inclusive at both ends +type + TEncoderParameterValueType = EncoderParameterValueType; + +//--------------------------------------------------------------------------- +// Image encoder value types +//--------------------------------------------------------------------------- + + {$EXTERNALSYM EncoderValue} + EncoderValue = ( + EncoderValueColorTypeCMYK, + EncoderValueColorTypeYCCK, + EncoderValueCompressionLZW, + EncoderValueCompressionCCITT3, + EncoderValueCompressionCCITT4, + EncoderValueCompressionRle, + EncoderValueCompressionNone, + EncoderValueScanMethodInterlaced, + EncoderValueScanMethodNonInterlaced, + EncoderValueVersionGif87, + EncoderValueVersionGif89, + EncoderValueRenderProgressive, + EncoderValueRenderNonProgressive, + EncoderValueTransformRotate90, + EncoderValueTransformRotate180, + EncoderValueTransformRotate270, + EncoderValueTransformFlipHorizontal, + EncoderValueTransformFlipVertical, + EncoderValueMultiFrame, + EncoderValueLastFrame, + EncoderValueFlush, + EncoderValueFrameDimensionTime, + EncoderValueFrameDimensionResolution, + EncoderValueFrameDimensionPage + ); + TEncoderValue = EncoderValue; + +//--------------------------------------------------------------------------- +// Conversion of Emf To WMF Bits flags +//--------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM EmfToWmfBitsFlags} + EmfToWmfBitsFlags = ( + EmfToWmfBitsFlagsDefault = $00000000, + EmfToWmfBitsFlagsEmbedEmf = $00000001, + EmfToWmfBitsFlagsIncludePlaceable = $00000002, + EmfToWmfBitsFlagsNoXORClip = $00000004 + ); + TEmfToWmfBitsFlags = EmfToWmfBitsFlags; +{$ELSE} + {$EXTERNALSYM EmfToWmfBitsFlags} + EmfToWmfBitsFlags = Integer; + const + EmfToWmfBitsFlagsDefault = $00000000; + EmfToWmfBitsFlagsEmbedEmf = $00000001; + EmfToWmfBitsFlagsIncludePlaceable = $00000002; + EmfToWmfBitsFlagsNoXORClip = $00000004; + +type + TEmfToWmfBitsFlags = EmfToWmfBitsFlags; +{$ENDIF} +(**************************************************************************\ +* +* GDI+ Types +* +\**************************************************************************) + +//-------------------------------------------------------------------------- +// Callback functions +//-------------------------------------------------------------------------- + + {$EXTERNALSYM ImageAbort} + ImageAbort = function: BOOL; stdcall; + {$EXTERNALSYM DrawImageAbort} + DrawImageAbort = ImageAbort; + {$EXTERNALSYM GetThumbnailImageAbort} + GetThumbnailImageAbort = ImageAbort; + + + // Callback for EnumerateMetafile methods. The parameters are: + + // recordType WMF, EMF, or EMF+ record type + // flags (always 0 for WMF/EMF records) + // dataSize size of the record data (in bytes), or 0 if no data + // data pointer to the record data, or NULL if no data + // callbackData pointer to callbackData, if any + + // This method can then call Metafile::PlayRecord to play the + // record that was just enumerated. If this method returns + // FALSE, the enumeration process is aborted. Otherwise, it continues. + + {$EXTERNALSYM EnumerateMetafileProc} + EnumerateMetafileProc = function(recordType: EmfPlusRecordType; flags: UINT; + dataSize: UINT; data: PBYTE; callbackData: pointer): BOOL; stdcall; + +//-------------------------------------------------------------------------- +// Primitive data types +// +// NOTE: +// Types already defined in standard header files: +// INT8 +// UINT8 +// INT16 +// UINT16 +// INT32 +// UINT32 +// INT64 +// UINT64 +// +// Avoid using the following types: +// LONG - use INT +// ULONG - use UINT +// DWORD - use UINT32 +//-------------------------------------------------------------------------- + +const + { from float.h } + FLT_MAX = 3.402823466e+38; // max value + FLT_MIN = 1.175494351e-38; // min positive value + + REAL_MAX = FLT_MAX; + {$EXTERNALSYM REAL_MAX} + REAL_MIN = FLT_MIN; + {$EXTERNALSYM REAL_MIN} + REAL_TOLERANCE = (FLT_MIN * 100); + {$EXTERNALSYM REAL_TOLERANCE} + REAL_EPSILON = 1.192092896e-07; // FLT_EPSILON + {$EXTERNALSYM REAL_EPSILON} + +//-------------------------------------------------------------------------- +// Status return values from GDI+ methods +//-------------------------------------------------------------------------- +type + {$EXTERNALSYM Status} + Status = ( + Ok, + GenericError, + InvalidParameter, + OutOfMemory, + ObjectBusy, + InsufficientBuffer, + NotImplemented, + Win32Error, + WrongState, + Aborted, + FileNotFound, + ValueOverflow, + AccessDenied, + UnknownImageFormat, + FontFamilyNotFound, + FontStyleNotFound, + NotTrueTypeFont, + UnsupportedGdiplusVersion, + GdiplusNotInitialized, + PropertyNotFound, + PropertyNotSupported + ); + TStatus = Status; + +//-------------------------------------------------------------------------- +// Represents a dimension in a 2D coordinate system (floating-point coordinates) +//-------------------------------------------------------------------------- + +type + PGPSizeF = ^TGPSizeF; + TGPSizeF = packed record + Width : Single; + Height : Single; + end; + + function MakeSize(Width, Height: Single): TGPSizeF; overload; + +//-------------------------------------------------------------------------- +// Represents a dimension in a 2D coordinate system (integer coordinates) +//-------------------------------------------------------------------------- + +type + PGPSize = ^TGPSize; + TGPSize = packed record + Width : Integer; + Height : Integer; + end; + + function MakeSize(Width, Height: Integer): TGPSize; overload; + +//-------------------------------------------------------------------------- +// Represents a location in a 2D coordinate system (floating-point coordinates) +//-------------------------------------------------------------------------- + +type + PGPPointF = ^TGPPointF; + TGPPointF = packed record + X : Single; + Y : Single; + end; + TPointFDynArray = array of TGPPointF; + + function MakePoint(X, Y: Single): TGPPointF; overload; + +//-------------------------------------------------------------------------- +// Represents a location in a 2D coordinate system (integer coordinates) +//-------------------------------------------------------------------------- + +type + PGPPoint = ^TGPPoint; + TGPPoint = packed record + X : Integer; + Y : Integer; + end; + TPointDynArray = array of TGPPoint; + + function MakePoint(X, Y: Integer): TGPPoint; overload; + +//-------------------------------------------------------------------------- +// Represents a rectangle in a 2D coordinate system (floating-point coordinates) +//-------------------------------------------------------------------------- + +type + PGPRectF = ^TGPRectF; + TGPRectF = packed record + X : Single; + Y : Single; + Width : Single; + Height: Single; + end; + TRectFDynArray = array of TGPRectF; + + function MakeRect(x, y, width, height: Single): TGPRectF; overload; + function MakeRect(location: TGPPointF; size: TGPSizeF): TGPRectF; overload; + +type + PGPRect = ^TGPRect; + TGPRect = packed record + X : Integer; + Y : Integer; + Width : Integer; + Height: Integer; + end; + TRectDynArray = array of TGPRect; + + function MakeRect(x, y, width, height: Integer): TGPRect; overload; + function MakeRect(location: TGPPoint; size: TGPSize): TGPRect; overload; + function MakeRect(const Rect: TRect): TGPRect; overload; + +type + TPathData = packed class + public + Count : Integer; + Points : PGPPointF; + Types : PBYTE; + constructor Create; + destructor destroy; override; + end; + + PCharacterRange = ^TCharacterRange; + TCharacterRange = packed record + First : Integer; + Length : Integer; + end; + + function MakeCharacterRange(First, Length: Integer): TCharacterRange; + +(************************************************************************** +* +* GDI+ Startup and Shutdown APIs +* +**************************************************************************) +type + {$EXTERNALSYM DebugEventLevel} + DebugEventLevel = ( + DebugEventLevelFatal, + DebugEventLevelWarning + ); + TDebugEventLevel = DebugEventLevel; + + // Callback function that GDI+ can call, on debug builds, for assertions + // and warnings. + + {$EXTERNALSYM DebugEventProc} + DebugEventProc = procedure(level: DebugEventLevel; message: PChar); stdcall; + + // Notification functions which the user must call appropriately if + // "SuppressBackgroundThread" (below) is set. + + {$EXTERNALSYM NotificationHookProc} + NotificationHookProc = function(out token: ULONG): Status; stdcall; + {$EXTERNALSYM NotificationUnhookProc} + NotificationUnhookProc = procedure(token: ULONG); stdcall; + + // Input structure for GdiplusStartup + + {$EXTERNALSYM GdiplusStartupInput} + GdiplusStartupInput = packed record + GdiplusVersion : Cardinal; // Must be 1 + DebugEventCallback : DebugEventProc; // Ignored on free builds + SuppressBackgroundThread: BOOL; // FALSE unless you're prepared to call + // the hook/unhook functions properly + SuppressExternalCodecs : BOOL; // FALSE unless you want GDI+ only to use + end; // its internal image codecs. + TGdiplusStartupInput = GdiplusStartupInput; + PGdiplusStartupInput = ^TGdiplusStartupInput; + + // Output structure for GdiplusStartup() + + {$EXTERNALSYM GdiplusStartupOutput} + GdiplusStartupOutput = packed record + // The following 2 fields are NULL if SuppressBackgroundThread is FALSE. + // Otherwise, they are functions which must be called appropriately to + // replace the background thread. + // + // These should be called on the application's main message loop - i.e. + // a message loop which is active for the lifetime of GDI+. + // "NotificationHook" should be called before starting the loop, + // and "NotificationUnhook" should be called after the loop ends. + + NotificationHook : NotificationHookProc; + NotificationUnhook: NotificationUnhookProc; + end; + TGdiplusStartupOutput = GdiplusStartupOutput; + PGdiplusStartupOutput = ^TGdiplusStartupOutput; + + // GDI+ initialization. Must not be called from DllMain - can cause deadlock. + // + // Must be called before GDI+ API's or constructors are used. + // + // token - may not be NULL - accepts a token to be passed in the corresponding + // GdiplusShutdown call. + // input - may not be NULL + // output - may be NULL only if input->SuppressBackgroundThread is FALSE. + + {$EXTERNALSYM GdiplusStartup} + function GdiplusStartup(out token: ULONG; input: PGdiplusStartupInput; + output: PGdiplusStartupOutput): Status; stdcall; + + // GDI+ termination. Must be called before GDI+ is unloaded. + // Must not be called from DllMain - can cause deadlock. + // + // GDI+ API's may not be called after GdiplusShutdown. Pay careful attention + // to GDI+ object destructors. + + {$EXTERNALSYM GdiplusShutdown} + procedure GdiplusShutdown(token: ULONG); stdcall; + + +(**************************************************************************\ +* +* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved. +* Module Name: +* Gdiplus Pixel Formats +* Abstract: +* GDI+ Pixel Formats +* +\**************************************************************************) + +type + PARGB = ^ARGB; + ARGB = DWORD; + {$EXTERNALSYM ARGB} + ARGB64 = Int64; + {$EXTERNALSYM ARGB64} + +const + ALPHA_SHIFT = 24; + {$EXTERNALSYM ALPHA_SHIFT} + RED_SHIFT = 16; + {$EXTERNALSYM RED_SHIFT} + GREEN_SHIFT = 8; + {$EXTERNALSYM GREEN_SHIFT} + BLUE_SHIFT = 0; + {$EXTERNALSYM BLUE_SHIFT} + ALPHA_MASK = (ARGB($ff) shl ALPHA_SHIFT); + {$EXTERNALSYM ALPHA_MASK} + + // In-memory pixel data formats: + // bits 0-7 = format index + // bits 8-15 = pixel size (in bits) + // bits 16-23 = flags + // bits 24-31 = reserved + +type + PixelFormat = Integer; + {$EXTERNALSYM PixelFormat} + TPixelFormat = PixelFormat; + +const + PixelFormatIndexed = $00010000; // Indexes into a palette + {$EXTERNALSYM PixelFormatIndexed} + PixelFormatGDI = $00020000; // Is a GDI-supported format + {$EXTERNALSYM PixelFormatGDI} + PixelFormatAlpha = $00040000; // Has an alpha component + {$EXTERNALSYM PixelFormatAlpha} + PixelFormatPAlpha = $00080000; // Pre-multiplied alpha + {$EXTERNALSYM PixelFormatPAlpha} + PixelFormatExtended = $00100000; // Extended color 16 bits/channel + {$EXTERNALSYM PixelFormatExtended} + PixelFormatCanonical = $00200000; + {$EXTERNALSYM PixelFormatCanonical} + + PixelFormatUndefined = 0; + {$EXTERNALSYM PixelFormatUndefined} + PixelFormatDontCare = 0; + {$EXTERNALSYM PixelFormatDontCare} + + PixelFormat1bppIndexed = (1 or ( 1 shl 8) or PixelFormatIndexed or PixelFormatGDI); + {$EXTERNALSYM PixelFormat1bppIndexed} + PixelFormat4bppIndexed = (2 or ( 4 shl 8) or PixelFormatIndexed or PixelFormatGDI); + {$EXTERNALSYM PixelFormat4bppIndexed} + PixelFormat8bppIndexed = (3 or ( 8 shl 8) or PixelFormatIndexed or PixelFormatGDI); + {$EXTERNALSYM PixelFormat8bppIndexed} + PixelFormat16bppGrayScale = (4 or (16 shl 8) or PixelFormatExtended); + {$EXTERNALSYM PixelFormat16bppGrayScale} + PixelFormat16bppRGB555 = (5 or (16 shl 8) or PixelFormatGDI); + {$EXTERNALSYM PixelFormat16bppRGB555} + PixelFormat16bppRGB565 = (6 or (16 shl 8) or PixelFormatGDI); + {$EXTERNALSYM PixelFormat16bppRGB565} + PixelFormat16bppARGB1555 = (7 or (16 shl 8) or PixelFormatAlpha or PixelFormatGDI); + {$EXTERNALSYM PixelFormat16bppARGB1555} + PixelFormat24bppRGB = (8 or (24 shl 8) or PixelFormatGDI); + {$EXTERNALSYM PixelFormat24bppRGB} + PixelFormat32bppRGB = (9 or (32 shl 8) or PixelFormatGDI); + {$EXTERNALSYM PixelFormat32bppRGB} + PixelFormat32bppARGB = (10 or (32 shl 8) or PixelFormatAlpha or PixelFormatGDI or PixelFormatCanonical); + {$EXTERNALSYM PixelFormat32bppARGB} + PixelFormat32bppPARGB = (11 or (32 shl 8) or PixelFormatAlpha or PixelFormatPAlpha or PixelFormatGDI); + {$EXTERNALSYM PixelFormat32bppPARGB} + PixelFormat48bppRGB = (12 or (48 shl 8) or PixelFormatExtended); + {$EXTERNALSYM PixelFormat48bppRGB} + PixelFormat64bppARGB = (13 or (64 shl 8) or PixelFormatAlpha or PixelFormatCanonical or PixelFormatExtended); + {$EXTERNALSYM PixelFormat64bppARGB} + PixelFormat64bppPARGB = (14 or (64 shl 8) or PixelFormatAlpha or PixelFormatPAlpha or PixelFormatExtended); + {$EXTERNALSYM PixelFormat64bppPARGB} + PixelFormatMax = 15; + {$EXTERNALSYM PixelFormatMax} + +{$EXTERNALSYM GetPixelFormatSize} +function GetPixelFormatSize(pixfmt: PixelFormat): UINT; +{$EXTERNALSYM IsIndexedPixelFormat} +function IsIndexedPixelFormat(pixfmt: PixelFormat): BOOL; +{$EXTERNALSYM IsAlphaPixelFormat} +function IsAlphaPixelFormat(pixfmt: PixelFormat): BOOL; +{$EXTERNALSYM IsExtendedPixelFormat} +function IsExtendedPixelFormat(pixfmt: PixelFormat): BOOL; + +//-------------------------------------------------------------------------- +// Determine if the Pixel Format is Canonical format: +// PixelFormat32bppARGB +// PixelFormat32bppPARGB +// PixelFormat64bppARGB +// PixelFormat64bppPARGB +//-------------------------------------------------------------------------- + +{$EXTERNALSYM IsCanonicalPixelFormat} +function IsCanonicalPixelFormat(pixfmt: PixelFormat): BOOL; + +{$IFDEF DELPHI6_UP} +type + {$EXTERNALSYM PaletteFlags} + PaletteFlags = ( + PaletteFlagsHasAlpha = $0001, + PaletteFlagsGrayScale = $0002, + PaletteFlagsHalftone = $0004 + ); + TPaletteFlags = PaletteFlags; +{$ELSE} +type + {$EXTERNALSYM PaletteFlags} + PaletteFlags = Integer; + const + PaletteFlagsHasAlpha = $0001; + PaletteFlagsGrayScale = $0002; + PaletteFlagsHalftone = $0004; + +type + TPaletteFlags = PaletteFlags; +{$ENDIF} + + {$EXTERNALSYM ColorPalette} + ColorPalette = packed record + Flags : UINT ; // Palette flags + Count : UINT ; // Number of color entries + Entries: array [0..0] of ARGB ; // Palette color entries + end; + + TColorPalette = ColorPalette; + PColorPalette = ^TColorPalette; + +(**************************************************************************\ +* +* GDI+ Color Object +* +\**************************************************************************) + +//---------------------------------------------------------------------------- +// Color mode +//---------------------------------------------------------------------------- + + {$EXTERNALSYM ColorMode} + ColorMode = ( + ColorModeARGB32, + ColorModeARGB64 + ); + TColorMode = ColorMode; + +//---------------------------------------------------------------------------- +// Color Channel flags +//---------------------------------------------------------------------------- + + {$EXTERNALSYM ColorChannelFlags} + ColorChannelFlags = ( + ColorChannelFlagsC, + ColorChannelFlagsM, + ColorChannelFlagsY, + ColorChannelFlagsK, + ColorChannelFlagsLast + ); + TColorChannelFlags = ColorChannelFlags; + +//---------------------------------------------------------------------------- +// Color +//---------------------------------------------------------------------------- + + // Common color constants +const + aclAliceBlue = $FFF0F8FF; + aclAntiqueWhite = $FFFAEBD7; + aclAqua = $FF00FFFF; + aclAquamarine = $FF7FFFD4; + aclAzure = $FFF0FFFF; + aclBeige = $FFF5F5DC; + aclBisque = $FFFFE4C4; + aclBlack = $FF000000; + aclBlanchedAlmond = $FFFFEBCD; + aclBlue = $FF0000FF; + aclBlueViolet = $FF8A2BE2; + aclBrown = $FFA52A2A; + aclBurlyWood = $FFDEB887; + aclCadetBlue = $FF5F9EA0; + aclChartreuse = $FF7FFF00; + aclChocolate = $FFD2691E; + aclCoral = $FFFF7F50; + aclCornflowerBlue = $FF6495ED; + aclCornsilk = $FFFFF8DC; + aclCrimson = $FFDC143C; + aclCyan = $FF00FFFF; + aclDarkBlue = $FF00008B; + aclDarkCyan = $FF008B8B; + aclDarkGoldenrod = $FFB8860B; + aclDarkGray = $FFA9A9A9; + aclDarkGreen = $FF006400; + aclDarkKhaki = $FFBDB76B; + aclDarkMagenta = $FF8B008B; + aclDarkOliveGreen = $FF556B2F; + aclDarkOrange = $FFFF8C00; + aclDarkOrchid = $FF9932CC; + aclDarkRed = $FF8B0000; + aclDarkSalmon = $FFE9967A; + aclDarkSeaGreen = $FF8FBC8B; + aclDarkSlateBlue = $FF483D8B; + aclDarkSlateGray = $FF2F4F4F; + aclDarkTurquoise = $FF00CED1; + aclDarkViolet = $FF9400D3; + aclDeepPink = $FFFF1493; + aclDeepSkyBlue = $FF00BFFF; + aclDimGray = $FF696969; + aclDodgerBlue = $FF1E90FF; + aclFirebrick = $FFB22222; + aclFloralWhite = $FFFFFAF0; + aclForestGreen = $FF228B22; + aclFuchsia = $FFFF00FF; + aclGainsboro = $FFDCDCDC; + aclGhostWhite = $FFF8F8FF; + aclGold = $FFFFD700; + aclGoldenrod = $FFDAA520; + aclGray = $FF808080; + aclGreen = $FF008000; + aclGreenYellow = $FFADFF2F; + aclHoneydew = $FFF0FFF0; + aclHotPink = $FFFF69B4; + aclIndianRed = $FFCD5C5C; + aclIndigo = $FF4B0082; + aclIvory = $FFFFFFF0; + aclKhaki = $FFF0E68C; + aclLavender = $FFE6E6FA; + aclLavenderBlush = $FFFFF0F5; + aclLawnGreen = $FF7CFC00; + aclLemonChiffon = $FFFFFACD; + aclLightBlue = $FFADD8E6; + aclLightCoral = $FFF08080; + aclLightCyan = $FFE0FFFF; + aclLightGoldenrodYellow = $FFFAFAD2; + aclLightGray = $FFD3D3D3; + aclLightGreen = $FF90EE90; + aclLightPink = $FFFFB6C1; + aclLightSalmon = $FFFFA07A; + aclLightSeaGreen = $FF20B2AA; + aclLightSkyBlue = $FF87CEFA; + aclLightSlateGray = $FF778899; + aclLightSteelBlue = $FFB0C4DE; + aclLightYellow = $FFFFFFE0; + aclLime = $FF00FF00; + aclLimeGreen = $FF32CD32; + aclLinen = $FFFAF0E6; + aclMagenta = $FFFF00FF; + aclMaroon = $FF800000; + aclMediumAquamarine = $FF66CDAA; + aclMediumBlue = $FF0000CD; + aclMediumOrchid = $FFBA55D3; + aclMediumPurple = $FF9370DB; + aclMediumSeaGreen = $FF3CB371; + aclMediumSlateBlue = $FF7B68EE; + aclMediumSpringGreen = $FF00FA9A; + aclMediumTurquoise = $FF48D1CC; + aclMediumVioletRed = $FFC71585; + aclMidnightBlue = $FF191970; + aclMintCream = $FFF5FFFA; + aclMistyRose = $FFFFE4E1; + aclMoccasin = $FFFFE4B5; + aclNavajoWhite = $FFFFDEAD; + aclNavy = $FF000080; + aclOldLace = $FFFDF5E6; + aclOlive = $FF808000; + aclOliveDrab = $FF6B8E23; + aclOrange = $FFFFA500; + aclOrangeRed = $FFFF4500; + aclOrchid = $FFDA70D6; + aclPaleGoldenrod = $FFEEE8AA; + aclPaleGreen = $FF98FB98; + aclPaleTurquoise = $FFAFEEEE; + aclPaleVioletRed = $FFDB7093; + aclPapayaWhip = $FFFFEFD5; + aclPeachPuff = $FFFFDAB9; + aclPeru = $FFCD853F; + aclPink = $FFFFC0CB; + aclPlum = $FFDDA0DD; + aclPowderBlue = $FFB0E0E6; + aclPurple = $FF800080; + aclRed = $FFFF0000; + aclRosyBrown = $FFBC8F8F; + aclRoyalBlue = $FF4169E1; + aclSaddleBrown = $FF8B4513; + aclSalmon = $FFFA8072; + aclSandyBrown = $FFF4A460; + aclSeaGreen = $FF2E8B57; + aclSeaShell = $FFFFF5EE; + aclSienna = $FFA0522D; + aclSilver = $FFC0C0C0; + aclSkyBlue = $FF87CEEB; + aclSlateBlue = $FF6A5ACD; + aclSlateGray = $FF708090; + aclSnow = $FFFFFAFA; + aclSpringGreen = $FF00FF7F; + aclSteelBlue = $FF4682B4; + aclTan = $FFD2B48C; + aclTeal = $FF008080; + aclThistle = $FFD8BFD8; + aclTomato = $FFFF6347; + aclTransparent = $00FFFFFF; + aclTurquoise = $FF40E0D0; + aclViolet = $FFEE82EE; + aclWheat = $FFF5DEB3; + aclWhite = $FFFFFFFF; + aclWhiteSmoke = $FFF5F5F5; + aclYellow = $FFFFFF00; + aclYellowGreen = $FF9ACD32; + + // Shift count and bit mask for A, R, G, B components + AlphaShift = 24; + {$EXTERNALSYM AlphaShift} + RedShift = 16; + {$EXTERNALSYM RedShift} + GreenShift = 8; + {$EXTERNALSYM GreenShift} + BlueShift = 0; + {$EXTERNALSYM BlueShift} + + AlphaMask = $ff000000; + {$EXTERNALSYM AlphaMask} + RedMask = $00ff0000; + {$EXTERNALSYM RedMask} + GreenMask = $0000ff00; + {$EXTERNALSYM GreenMask} + BlueMask = $000000ff; + {$EXTERNALSYM BlueMask} + + +type +{ TGPColor = class + protected + Argb: ARGB; + public + constructor Create; overload; + constructor Create(r, g, b: Byte); overload; + constructor Create(a, r, g, b: Byte); overload; + constructor Create(Value: ARGB); overload; + function GetAlpha: BYTE; + function GetA: BYTE; + function GetRed: BYTE; + function GetR: BYTE; + function GetGreen: Byte; + function GetG: Byte; + function GetBlue: Byte; + function GetB: Byte; + function GetValue: ARGB; + procedure SetValue(Value: ARGB); + procedure SetFromCOLORREF(rgb: COLORREF); + function ToCOLORREF: COLORREF; + function MakeARGB(a, r, g, b: Byte): ARGB; + end; } + + PGPColor = ^TGPColor; + TGPColor = ARGB; + TColorDynArray = array of TGPColor; + + function MakeColor(r, g, b: Byte): ARGB; overload; + function MakeColor(a, r, g, b: Byte): ARGB; overload; + function GetAlpha(color: ARGB): BYTE; + function GetRed(color: ARGB): BYTE; + function GetGreen(color: ARGB): BYTE; + function GetBlue(color: ARGB): BYTE; + function ColorRefToARGB(rgb: COLORREF): ARGB; + function ARGBToColorRef(Color: ARGB): COLORREF; + + +(**************************************************************************\ +* +* GDI+ Metafile Related Structures +* +\**************************************************************************) + +type + { from Windef.h } + RECTL = Windows.TRect; + SIZEL = Windows.TSize; + + {$EXTERNALSYM ENHMETAHEADER3} + ENHMETAHEADER3 = packed record + iType : DWORD; // Record type EMR_HEADER + nSize : DWORD; // Record size in bytes. This may be greater + // than the sizeof(ENHMETAHEADER). + rclBounds : RECTL; // Inclusive-inclusive bounds in device units + rclFrame : RECTL; // Inclusive-inclusive Picture Frame .01mm unit + dSignature : DWORD; // Signature. Must be ENHMETA_SIGNATURE. + nVersion : DWORD; // Version number + nBytes : DWORD; // Size of the metafile in bytes + nRecords : DWORD; // Number of records in the metafile + nHandles : WORD; // Number of handles in the handle table + // Handle index zero is reserved. + sReserved : WORD; // Reserved. Must be zero. + nDescription : DWORD; // Number of chars in the unicode desc string + // This is 0 if there is no description string + offDescription : DWORD; // Offset to the metafile description record. + // This is 0 if there is no description string + nPalEntries : DWORD; // Number of entries in the metafile palette. + szlDevice : SIZEL; // Size of the reference device in pels + szlMillimeters : SIZEL; // Size of the reference device in millimeters + end; + TENHMETAHEADER3 = ENHMETAHEADER3; + PENHMETAHEADER3 = ^TENHMETAHEADER3; + + // Placeable WMFs + + // Placeable Metafiles were created as a non-standard way of specifying how + // a metafile is mapped and scaled on an output device. + // Placeable metafiles are quite wide-spread, but not directly supported by + // the Windows API. To playback a placeable metafile using the Windows API, + // you will first need to strip the placeable metafile header from the file. + // This is typically performed by copying the metafile to a temporary file + // starting at file offset 22 (0x16). The contents of the temporary file may + // then be used as input to the Windows GetMetaFile(), PlayMetaFile(), + // CopyMetaFile(), etc. GDI functions. + + // Each placeable metafile begins with a 22-byte header, + // followed by a standard metafile: + + {$EXTERNALSYM PWMFRect16} + PWMFRect16 = packed record + Left : INT16; + Top : INT16; + Right : INT16; + Bottom : INT16; + end; + TPWMFRect16 = PWMFRect16; + PPWMFRect16 = ^TPWMFRect16; + + {$EXTERNALSYM WmfPlaceableFileHeader} + WmfPlaceableFileHeader = packed record + Key : UINT32; // GDIP_WMF_PLACEABLEKEY + Hmf : INT16; // Metafile HANDLE number (always 0) + BoundingBox : PWMFRect16; // Coordinates in metafile units + Inch : INT16; // Number of metafile units per inch + Reserved : UINT32; // Reserved (always 0) + Checksum : INT16; // Checksum value for previous 10 WORDs + end; + TWmfPlaceableFileHeader = WmfPlaceableFileHeader; + PWmfPlaceableFileHeader = ^TWmfPlaceableFileHeader; + + // Key contains a special identification value that indicates the presence + // of a placeable metafile header and is always 0x9AC6CDD7. + + // Handle is used to stored the handle of the metafile in memory. When written + // to disk, this field is not used and will always contains the value 0. + + // Left, Top, Right, and Bottom contain the coordinates of the upper-left + // and lower-right corners of the image on the output device. These are + // measured in twips. + + // A twip (meaning "twentieth of a point") is the logical unit of measurement + // used in Windows Metafiles. A twip is equal to 1/1440 of an inch. Thus 720 + // twips equal 1/2 inch, while 32,768 twips is 22.75 inches. + + // Inch contains the number of twips per inch used to represent the image. + // Normally, there are 1440 twips per inch; however, this number may be + // changed to scale the image. A value of 720 indicates that the image is + // double its normal size, or scaled to a factor of 2:1. A value of 360 + // indicates a scale of 4:1, while a value of 2880 indicates that the image + // is scaled down in size by a factor of two. A value of 1440 indicates + // a 1:1 scale ratio. + + // Reserved is not used and is always set to 0. + + // Checksum contains a checksum value for the previous 10 WORDs in the header. + // This value can be used in an attempt to detect if the metafile has become + // corrupted. The checksum is calculated by XORing each WORD value to an + // initial value of 0. + + // If the metafile was recorded with a reference Hdc that was a display. + +const + GDIP_EMFPLUSFLAGS_DISPLAY = $00000001; + {$EXTERNALSYM GDIP_EMFPLUSFLAGS_DISPLAY} + +type + TMetafileHeader = packed class + public + Type_ : TMetafileType; + Size : UINT; // Size of the metafile (in bytes) + Version : UINT; // EMF+, EMF, or WMF version + EmfPlusFlags : UINT; + DpiX : Single; + DpiY : Single; + X : Integer; // Bounds in device units + Y : Integer; + Width : Integer; + Height : Integer; + Header : record + case integer of + 0: (WmfHeader: TMETAHEADER;); + 1: (EmfHeader: TENHMETAHEADER3); + end; + EmfPlusHeaderSize : Integer; // size of the EMF+ header in file + LogicalDpiX : Integer; // Logical Dpi of reference Hdc + LogicalDpiY : Integer; // usually valid only for EMF+ + public + property GetType: TMetafileType read Type_; + property GetMetafileSize: UINT read Size; + // If IsEmfPlus, this is the EMF+ version; else it is the WMF or EMF ver + property GetVersion: UINT read Version; + // Get the EMF+ flags associated with the metafile + property GetEmfPlusFlags: UINT read EmfPlusFlags; + property GetDpiX: Single read DpiX; + property GetDpiY: Single read DpiY; + procedure GetBounds(out Rect: TGPRect); + // Is it any type of WMF (standard or Placeable Metafile)? + function IsWmf: BOOL; + // Is this an Placeable Metafile? + function IsWmfPlaceable: BOOL; + // Is this an EMF (not an EMF+)? + function IsEmf: BOOL; + // Is this an EMF or EMF+ file? + function IsEmfOrEmfPlus: BOOL; + // Is this an EMF+ file? + function IsEmfPlus: BOOL; + // Is this an EMF+ dual (has dual, down-level records) file? + function IsEmfPlusDual: BOOL; + // Is this an EMF+ only (no dual records) file? + function IsEmfPlusOnly: BOOL; + // If it's an EMF+ file, was it recorded against a display Hdc? + function IsDisplay: BOOL; + // Get the WMF header of the metafile (if it is a WMF) + function GetWmfHeader: PMetaHeader; + // Get the EMF header of the metafile (if it is an EMF) + function GetEmfHeader: PENHMETAHEADER3; + end; + +(**************************************************************************\ +* +* GDI+ Imaging GUIDs +* +\**************************************************************************) + +//--------------------------------------------------------------------------- +// Image file format identifiers +//--------------------------------------------------------------------------- + +const + ImageFormatUndefined : TGUID = '{b96b3ca9-0728-11d3-9d7b-0000f81ef32e}'; + {$EXTERNALSYM ImageFormatUndefined} + ImageFormatMemoryBMP : TGUID = '{b96b3caa-0728-11d3-9d7b-0000f81ef32e}'; + {$EXTERNALSYM ImageFormatMemoryBMP} + ImageFormatBMP : TGUID = '{b96b3cab-0728-11d3-9d7b-0000f81ef32e}'; + {$EXTERNALSYM ImageFormatBMP} + ImageFormatEMF : TGUID = '{b96b3cac-0728-11d3-9d7b-0000f81ef32e}'; + {$EXTERNALSYM ImageFormatEMF} + ImageFormatWMF : TGUID = '{b96b3cad-0728-11d3-9d7b-0000f81ef32e}'; + {$EXTERNALSYM ImageFormatWMF} + ImageFormatJPEG : TGUID = '{b96b3cae-0728-11d3-9d7b-0000f81ef32e}'; + {$EXTERNALSYM ImageFormatJPEG} + ImageFormatPNG : TGUID = '{b96b3caf-0728-11d3-9d7b-0000f81ef32e}'; + {$EXTERNALSYM ImageFormatPNG} + ImageFormatGIF : TGUID = '{b96b3cb0-0728-11d3-9d7b-0000f81ef32e}'; + {$EXTERNALSYM ImageFormatGIF} + ImageFormatTIFF : TGUID = '{b96b3cb1-0728-11d3-9d7b-0000f81ef32e}'; + {$EXTERNALSYM ImageFormatTIFF} + ImageFormatEXIF : TGUID = '{b96b3cb2-0728-11d3-9d7b-0000f81ef32e}'; + {$EXTERNALSYM ImageFormatEXIF} + ImageFormatIcon : TGUID = '{b96b3cb5-0728-11d3-9d7b-0000f81ef32e}'; + {$EXTERNALSYM ImageFormatIcon} + +//--------------------------------------------------------------------------- +// Predefined multi-frame dimension IDs +//--------------------------------------------------------------------------- + + FrameDimensionTime : TGUID = '{6aedbd6d-3fb5-418a-83a6-7f45229dc872}'; + {$EXTERNALSYM FrameDimensionTime} + FrameDimensionResolution : TGUID = '{84236f7b-3bd3-428f-8dab-4ea1439ca315}'; + {$EXTERNALSYM FrameDimensionResolution} + FrameDimensionPage : TGUID = '{7462dc86-6180-4c7e-8e3f-ee7333a7a483}'; + {$EXTERNALSYM FrameDimensionPage} + +//--------------------------------------------------------------------------- +// Property sets +//--------------------------------------------------------------------------- + + FormatIDImageInformation : TGUID = '{e5836cbe-5eef-4f1d-acde-ae4c43b608ce}'; + {$EXTERNALSYM FormatIDImageInformation} + FormatIDJpegAppHeaders : TGUID = '{1c4afdcd-6177-43cf-abc7-5f51af39ee85}'; + {$EXTERNALSYM FormatIDJpegAppHeaders} + +//--------------------------------------------------------------------------- +// Encoder parameter sets +//--------------------------------------------------------------------------- + + EncoderCompression : TGUID = '{e09d739d-ccd4-44ee-8eba-3fbf8be4fc58}'; + {$EXTERNALSYM EncoderCompression} + EncoderColorDepth : TGUID = '{66087055-ad66-4c7c-9a18-38a2310b8337}'; + {$EXTERNALSYM EncoderColorDepth} + EncoderScanMethod : TGUID = '{3a4e2661-3109-4e56-8536-42c156e7dcfa}'; + {$EXTERNALSYM EncoderScanMethod} + EncoderVersion : TGUID = '{24d18c76-814a-41a4-bf53-1c219cccf797}'; + {$EXTERNALSYM EncoderVersion} + EncoderRenderMethod : TGUID = '{6d42c53a-229a-4825-8bb7-5c99e2b9a8b8}'; + {$EXTERNALSYM EncoderRenderMethod} + EncoderQuality : TGUID = '{1d5be4b5-fa4a-452d-9cdd-5db35105e7eb}'; + {$EXTERNALSYM EncoderQuality} + EncoderTransformation : TGUID = '{8d0eb2d1-a58e-4ea8-aa14-108074b7b6f9}'; + {$EXTERNALSYM EncoderTransformation} + EncoderLuminanceTable : TGUID = '{edb33bce-0266-4a77-b904-27216099e717}'; + {$EXTERNALSYM EncoderLuminanceTable} + EncoderChrominanceTable : TGUID = '{f2e455dc-09b3-4316-8260-676ada32481c}'; + {$EXTERNALSYM EncoderChrominanceTable} + EncoderSaveFlag : TGUID = '{292266fc-ac40-47bf-8cfc-a85b89a655de}'; + {$EXTERNALSYM EncoderSaveFlag} + + CodecIImageBytes : TGUID = '{025d1823-6c7d-447b-bbdb-a3cbc3dfa2fc}'; + {$EXTERNALSYM CodecIImageBytes} + +type + {$EXTERNALSYM IImageBytes} + IImageBytes = Interface(IUnknown) + ['{025D1823-6C7D-447B-BBDB-A3CBC3DFA2FC}'] + // Return total number of bytes in the IStream + function CountBytes(out pcb: UINT): HRESULT; stdcall; + // Locks "cb" bytes, starting from "ulOffset" in the stream, and returns the + // pointer to the beginning of the locked memory chunk in "ppvBytes" + function LockBytes(cb: UINT; ulOffset: ULONG; out ppvBytes: pointer): HRESULT; stdcall; + // Unlocks "cb" bytes, pointed by "pvBytes", starting from "ulOffset" in the + // stream + function UnlockBytes(pvBytes: pointer; cb: UINT; ulOffset: ULONG): HRESULT; stdcall; + end; + +//-------------------------------------------------------------------------- +// ImageCodecInfo structure +//-------------------------------------------------------------------------- + + {$EXTERNALSYM ImageCodecInfo} + ImageCodecInfo = packed record + Clsid : TGUID; + FormatID : TGUID; + CodecName : PWCHAR; + DllName : PWCHAR; + FormatDescription : PWCHAR; + FilenameExtension : PWCHAR; + MimeType : PWCHAR; + Flags : DWORD; + Version : DWORD; + SigCount : DWORD; + SigSize : DWORD; + SigPattern : PBYTE; + SigMask : PBYTE; + end; + TImageCodecInfo = ImageCodecInfo; + PImageCodecInfo = ^TImageCodecInfo; + +//-------------------------------------------------------------------------- +// Information flags about image codecs +//-------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM ImageCodecFlags} + ImageCodecFlags = ( + ImageCodecFlagsEncoder = $00000001, + ImageCodecFlagsDecoder = $00000002, + ImageCodecFlagsSupportBitmap = $00000004, + ImageCodecFlagsSupportVector = $00000008, + ImageCodecFlagsSeekableEncode = $00000010, + ImageCodecFlagsBlockingDecode = $00000020, + + ImageCodecFlagsBuiltin = $00010000, + ImageCodecFlagsSystem = $00020000, + ImageCodecFlagsUser = $00040000 + ); + TImageCodecFlags = ImageCodecFlags; +{$ELSE} + {$EXTERNALSYM ImageCodecFlags} + ImageCodecFlags = Integer; + const + ImageCodecFlagsEncoder = $00000001; + ImageCodecFlagsDecoder = $00000002; + ImageCodecFlagsSupportBitmap = $00000004; + ImageCodecFlagsSupportVector = $00000008; + ImageCodecFlagsSeekableEncode = $00000010; + ImageCodecFlagsBlockingDecode = $00000020; + + ImageCodecFlagsBuiltin = $00010000; + ImageCodecFlagsSystem = $00020000; + ImageCodecFlagsUser = $00040000; + +type + TImageCodecFlags = ImageCodecFlags; +{$ENDIF} +//--------------------------------------------------------------------------- +// Access modes used when calling Image::LockBits +//--------------------------------------------------------------------------- + + {$EXTERNALSYM ImageLockMode} + ImageLockMode = Integer; + const + ImageLockModeRead = $0001; + ImageLockModeWrite = $0002; + ImageLockModeUserInputBuf = $0004; +type + TImageLockMode = ImageLockMode; + +//--------------------------------------------------------------------------- +// Information about image pixel data +//--------------------------------------------------------------------------- + + {$EXTERNALSYM BitmapData} + BitmapData = packed record + Width : UINT; + Height : UINT; + Stride : Integer; + PixelFormat : PixelFormat; + Scan0 : Pointer; + Reserved : UINT; + end; + TBitmapData = BitmapData; + PBitmapData = ^TBitmapData; + +//--------------------------------------------------------------------------- +// Image flags +//--------------------------------------------------------------------------- +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM ImageFlags} + ImageFlags = ( + ImageFlagsNone = 0, + + // Low-word: shared with SINKFLAG_x + + ImageFlagsScalable = $0001, + ImageFlagsHasAlpha = $0002, + ImageFlagsHasTranslucent = $0004, + ImageFlagsPartiallyScalable = $0008, + + // Low-word: color space definition + + ImageFlagsColorSpaceRGB = $0010, + ImageFlagsColorSpaceCMYK = $0020, + ImageFlagsColorSpaceGRAY = $0040, + ImageFlagsColorSpaceYCBCR = $0080, + ImageFlagsColorSpaceYCCK = $0100, + + // Low-word: image size info + + ImageFlagsHasRealDPI = $1000, + ImageFlagsHasRealPixelSize = $2000, + + // High-word + + ImageFlagsReadOnly = $00010000, + ImageFlagsCaching = $00020000 + ); + TImageFlags = ImageFlags; +{$ELSE} + {$EXTERNALSYM ImageFlags} + ImageFlags = Integer; + const + ImageFlagsNone = 0; + + // Low-word: shared with SINKFLAG_x + + ImageFlagsScalable = $0001; + ImageFlagsHasAlpha = $0002; + ImageFlagsHasTranslucent = $0004; + ImageFlagsPartiallyScalable = $0008; + + // Low-word: color space definition + + ImageFlagsColorSpaceRGB = $0010; + ImageFlagsColorSpaceCMYK = $0020; + ImageFlagsColorSpaceGRAY = $0040; + ImageFlagsColorSpaceYCBCR = $0080; + ImageFlagsColorSpaceYCCK = $0100; + + // Low-word: image size info + + ImageFlagsHasRealDPI = $1000; + ImageFlagsHasRealPixelSize = $2000; + + // High-word + + ImageFlagsReadOnly = $00010000; + ImageFlagsCaching = $00020000; + +type + TImageFlags = ImageFlags; +{$ENDIF} + + +{$IFDEF DELPHI6_UP} + {$EXTERNALSYM RotateFlipType} + RotateFlipType = ( + RotateNoneFlipNone = 0, + Rotate90FlipNone = 1, + Rotate180FlipNone = 2, + Rotate270FlipNone = 3, + + RotateNoneFlipX = 4, + Rotate90FlipX = 5, + Rotate180FlipX = 6, + Rotate270FlipX = 7, + + RotateNoneFlipY = Rotate180FlipX, + Rotate90FlipY = Rotate270FlipX, + Rotate180FlipY = RotateNoneFlipX, + Rotate270FlipY = Rotate90FlipX, + + RotateNoneFlipXY = Rotate180FlipNone, + Rotate90FlipXY = Rotate270FlipNone, + Rotate180FlipXY = RotateNoneFlipNone, + Rotate270FlipXY = Rotate90FlipNone + ); + TRotateFlipType = RotateFlipType; +{$ELSE} + {$EXTERNALSYM RotateFlipType} + RotateFlipType = ( + RotateNoneFlipNone, // = 0, + Rotate90FlipNone, // = 1, + Rotate180FlipNone, // = 2, + Rotate270FlipNone, // = 3, + + RotateNoneFlipX, // = 4, + Rotate90FlipX, // = 5, + Rotate180FlipX, // = 6, + Rotate270FlipX // = 7, + ); + const + RotateNoneFlipY = Rotate180FlipX; + Rotate90FlipY = Rotate270FlipX; + Rotate180FlipY = RotateNoneFlipX; + Rotate270FlipY = Rotate90FlipX; + + RotateNoneFlipXY = Rotate180FlipNone; + Rotate90FlipXY = Rotate270FlipNone; + Rotate180FlipXY = RotateNoneFlipNone; + Rotate270FlipXY = Rotate90FlipNone; + +type + TRotateFlipType = RotateFlipType; +{$ENDIF} + +//--------------------------------------------------------------------------- +// Encoder Parameter structure +//--------------------------------------------------------------------------- + + {$EXTERNALSYM EncoderParameter} + EncoderParameter = packed record + Guid : TGUID; // GUID of the parameter + NumberOfValues : ULONG; // Number of the parameter values + Type_ : ULONG; // Value type, like ValueTypeLONG etc. + Value : Pointer; // A pointer to the parameter values + end; + TEncoderParameter = EncoderParameter; + PEncoderParameter = ^TEncoderParameter; + +//--------------------------------------------------------------------------- +// Encoder Parameters structure +//--------------------------------------------------------------------------- + + {$EXTERNALSYM EncoderParameters} + EncoderParameters = packed record + Count : UINT; // Number of parameters in this structure + Parameter : array[0..0] of TEncoderParameter; // Parameter values + end; + TEncoderParameters = EncoderParameters; + PEncoderParameters = ^TEncoderParameters; + +//--------------------------------------------------------------------------- +// Property Item +//--------------------------------------------------------------------------- + + {$EXTERNALSYM PropertyItem} + PropertyItem = record // NOT PACKED !! + id : PROPID; // ID of this property + length : ULONG; // Length of the property value, in bytes + type_ : WORD; // Type of the value, as one of TAG_TYPE_XXX + value : Pointer; // property value + end; + TPropertyItem = PropertyItem; + PPropertyItem = ^TPropertyItem; + +//--------------------------------------------------------------------------- +// Image property types +//--------------------------------------------------------------------------- + +const + PropertyTagTypeByte : Integer = 1; + {$EXTERNALSYM PropertyTagTypeByte} + PropertyTagTypeASCII : Integer = 2; + {$EXTERNALSYM PropertyTagTypeASCII} + PropertyTagTypeShort : Integer = 3; + {$EXTERNALSYM PropertyTagTypeShort} + PropertyTagTypeLong : Integer = 4; + {$EXTERNALSYM PropertyTagTypeLong} + PropertyTagTypeRational : Integer = 5; + {$EXTERNALSYM PropertyTagTypeRational} + PropertyTagTypeUndefined : Integer = 7; + {$EXTERNALSYM PropertyTagTypeUndefined} + PropertyTagTypeSLONG : Integer = 9; + {$EXTERNALSYM PropertyTagTypeSLONG} + PropertyTagTypeSRational : Integer = 10; + {$EXTERNALSYM PropertyTagTypeSRational} + +//--------------------------------------------------------------------------- +// Image property ID tags +//--------------------------------------------------------------------------- + + PropertyTagExifIFD = $8769; + {$EXTERNALSYM PropertyTagExifIFD} + PropertyTagGpsIFD = $8825; + {$EXTERNALSYM PropertyTagGpsIFD} + + PropertyTagNewSubfileType = $00FE; + {$EXTERNALSYM PropertyTagNewSubfileType} + PropertyTagSubfileType = $00FF; + {$EXTERNALSYM PropertyTagSubfileType} + PropertyTagImageWidth = $0100; + {$EXTERNALSYM PropertyTagImageWidth} + PropertyTagImageHeight = $0101; + {$EXTERNALSYM PropertyTagImageHeight} + PropertyTagBitsPerSample = $0102; + {$EXTERNALSYM PropertyTagBitsPerSample} + PropertyTagCompression = $0103; + {$EXTERNALSYM PropertyTagCompression} + PropertyTagPhotometricInterp = $0106; + {$EXTERNALSYM PropertyTagPhotometricInterp} + PropertyTagThreshHolding = $0107; + {$EXTERNALSYM PropertyTagThreshHolding} + PropertyTagCellWidth = $0108; + {$EXTERNALSYM PropertyTagCellWidth} + PropertyTagCellHeight = $0109; + {$EXTERNALSYM PropertyTagCellHeight} + PropertyTagFillOrder = $010A; + {$EXTERNALSYM PropertyTagFillOrder} + PropertyTagDocumentName = $010D; + {$EXTERNALSYM PropertyTagDocumentName} + PropertyTagImageDescription = $010E; + {$EXTERNALSYM PropertyTagImageDescription} + PropertyTagEquipMake = $010F; + {$EXTERNALSYM PropertyTagEquipMake} + PropertyTagEquipModel = $0110; + {$EXTERNALSYM PropertyTagEquipModel} + PropertyTagStripOffsets = $0111; + {$EXTERNALSYM PropertyTagStripOffsets} + PropertyTagOrientation = $0112; + {$EXTERNALSYM PropertyTagOrientation} + PropertyTagSamplesPerPixel = $0115; + {$EXTERNALSYM PropertyTagSamplesPerPixel} + PropertyTagRowsPerStrip = $0116; + {$EXTERNALSYM PropertyTagRowsPerStrip} + PropertyTagStripBytesCount = $0117; + {$EXTERNALSYM PropertyTagStripBytesCount} + PropertyTagMinSampleValue = $0118; + {$EXTERNALSYM PropertyTagMinSampleValue} + PropertyTagMaxSampleValue = $0119; + {$EXTERNALSYM PropertyTagMaxSampleValue} + PropertyTagXResolution = $011A; // Image resolution in width direction + {$EXTERNALSYM PropertyTagXResolution} + PropertyTagYResolution = $011B; // Image resolution in height direction + {$EXTERNALSYM PropertyTagYResolution} + PropertyTagPlanarConfig = $011C; // Image data arrangement + {$EXTERNALSYM PropertyTagPlanarConfig} + PropertyTagPageName = $011D; + {$EXTERNALSYM PropertyTagPageName} + PropertyTagXPosition = $011E; + {$EXTERNALSYM PropertyTagXPosition} + PropertyTagYPosition = $011F; + {$EXTERNALSYM PropertyTagYPosition} + PropertyTagFreeOffset = $0120; + {$EXTERNALSYM PropertyTagFreeOffset} + PropertyTagFreeByteCounts = $0121; + {$EXTERNALSYM PropertyTagFreeByteCounts} + PropertyTagGrayResponseUnit = $0122; + {$EXTERNALSYM PropertyTagGrayResponseUnit} + PropertyTagGrayResponseCurve = $0123; + {$EXTERNALSYM PropertyTagGrayResponseCurve} + PropertyTagT4Option = $0124; + {$EXTERNALSYM PropertyTagT4Option} + PropertyTagT6Option = $0125; + {$EXTERNALSYM PropertyTagT6Option} + PropertyTagResolutionUnit = $0128; // Unit of X and Y resolution + {$EXTERNALSYM PropertyTagResolutionUnit} + PropertyTagPageNumber = $0129; + {$EXTERNALSYM PropertyTagPageNumber} + PropertyTagTransferFuncition = $012D; + {$EXTERNALSYM PropertyTagTransferFuncition} + PropertyTagSoftwareUsed = $0131; + {$EXTERNALSYM PropertyTagSoftwareUsed} + PropertyTagDateTime = $0132; + {$EXTERNALSYM PropertyTagDateTime} + PropertyTagArtist = $013B; + {$EXTERNALSYM PropertyTagArtist} + PropertyTagHostComputer = $013C; + {$EXTERNALSYM PropertyTagHostComputer} + PropertyTagPredictor = $013D; + {$EXTERNALSYM PropertyTagPredictor} + PropertyTagWhitePoint = $013E; + {$EXTERNALSYM PropertyTagWhitePoint} + PropertyTagPrimaryChromaticities = $013F; + {$EXTERNALSYM PropertyTagPrimaryChromaticities} + PropertyTagColorMap = $0140; + {$EXTERNALSYM PropertyTagColorMap} + PropertyTagHalftoneHints = $0141; + {$EXTERNALSYM PropertyTagHalftoneHints} + PropertyTagTileWidth = $0142; + {$EXTERNALSYM PropertyTagTileWidth} + PropertyTagTileLength = $0143; + {$EXTERNALSYM PropertyTagTileLength} + PropertyTagTileOffset = $0144; + {$EXTERNALSYM PropertyTagTileOffset} + PropertyTagTileByteCounts = $0145; + {$EXTERNALSYM PropertyTagTileByteCounts} + PropertyTagInkSet = $014C; + {$EXTERNALSYM PropertyTagInkSet} + PropertyTagInkNames = $014D; + {$EXTERNALSYM PropertyTagInkNames} + PropertyTagNumberOfInks = $014E; + {$EXTERNALSYM PropertyTagNumberOfInks} + PropertyTagDotRange = $0150; + {$EXTERNALSYM PropertyTagDotRange} + PropertyTagTargetPrinter = $0151; + {$EXTERNALSYM PropertyTagTargetPrinter} + PropertyTagExtraSamples = $0152; + {$EXTERNALSYM PropertyTagExtraSamples} + PropertyTagSampleFormat = $0153; + {$EXTERNALSYM PropertyTagSampleFormat} + PropertyTagSMinSampleValue = $0154; + {$EXTERNALSYM PropertyTagSMinSampleValue} + PropertyTagSMaxSampleValue = $0155; + {$EXTERNALSYM PropertyTagSMaxSampleValue} + PropertyTagTransferRange = $0156; + {$EXTERNALSYM PropertyTagTransferRange} + + PropertyTagJPEGProc = $0200; + {$EXTERNALSYM PropertyTagJPEGProc} + PropertyTagJPEGInterFormat = $0201; + {$EXTERNALSYM PropertyTagJPEGInterFormat} + PropertyTagJPEGInterLength = $0202; + {$EXTERNALSYM PropertyTagJPEGInterLength} + PropertyTagJPEGRestartInterval = $0203; + {$EXTERNALSYM PropertyTagJPEGRestartInterval} + PropertyTagJPEGLosslessPredictors = $0205; + {$EXTERNALSYM PropertyTagJPEGLosslessPredictors} + PropertyTagJPEGPointTransforms = $0206; + {$EXTERNALSYM PropertyTagJPEGPointTransforms} + PropertyTagJPEGQTables = $0207; + {$EXTERNALSYM PropertyTagJPEGQTables} + PropertyTagJPEGDCTables = $0208; + {$EXTERNALSYM PropertyTagJPEGDCTables} + PropertyTagJPEGACTables = $0209; + {$EXTERNALSYM PropertyTagJPEGACTables} + + PropertyTagYCbCrCoefficients = $0211; + {$EXTERNALSYM PropertyTagYCbCrCoefficients} + PropertyTagYCbCrSubsampling = $0212; + {$EXTERNALSYM PropertyTagYCbCrSubsampling} + PropertyTagYCbCrPositioning = $0213; + {$EXTERNALSYM PropertyTagYCbCrPositioning} + PropertyTagREFBlackWhite = $0214; + {$EXTERNALSYM PropertyTagREFBlackWhite} + + PropertyTagICCProfile = $8773; // This TAG is defined by ICC + {$EXTERNALSYM PropertyTagICCProfile} + // for embedded ICC in TIFF + PropertyTagGamma = $0301; + {$EXTERNALSYM PropertyTagGamma} + PropertyTagICCProfileDescriptor = $0302; + {$EXTERNALSYM PropertyTagICCProfileDescriptor} + PropertyTagSRGBRenderingIntent = $0303; + {$EXTERNALSYM PropertyTagSRGBRenderingIntent} + + PropertyTagImageTitle = $0320; + {$EXTERNALSYM PropertyTagImageTitle} + PropertyTagCopyright = $8298; + {$EXTERNALSYM PropertyTagCopyright} + +// Extra TAGs (Like Adobe Image Information tags etc.) + + PropertyTagResolutionXUnit = $5001; + {$EXTERNALSYM PropertyTagResolutionXUnit} + PropertyTagResolutionYUnit = $5002; + {$EXTERNALSYM PropertyTagResolutionYUnit} + PropertyTagResolutionXLengthUnit = $5003; + {$EXTERNALSYM PropertyTagResolutionXLengthUnit} + PropertyTagResolutionYLengthUnit = $5004; + {$EXTERNALSYM PropertyTagResolutionYLengthUnit} + PropertyTagPrintFlags = $5005; + {$EXTERNALSYM PropertyTagPrintFlags} + PropertyTagPrintFlagsVersion = $5006; + {$EXTERNALSYM PropertyTagPrintFlagsVersion} + PropertyTagPrintFlagsCrop = $5007; + {$EXTERNALSYM PropertyTagPrintFlagsCrop} + PropertyTagPrintFlagsBleedWidth = $5008; + {$EXTERNALSYM PropertyTagPrintFlagsBleedWidth} + PropertyTagPrintFlagsBleedWidthScale = $5009; + {$EXTERNALSYM PropertyTagPrintFlagsBleedWidthScale} + PropertyTagHalftoneLPI = $500A; + {$EXTERNALSYM PropertyTagHalftoneLPI} + PropertyTagHalftoneLPIUnit = $500B; + {$EXTERNALSYM PropertyTagHalftoneLPIUnit} + PropertyTagHalftoneDegree = $500C; + {$EXTERNALSYM PropertyTagHalftoneDegree} + PropertyTagHalftoneShape = $500D; + {$EXTERNALSYM PropertyTagHalftoneShape} + PropertyTagHalftoneMisc = $500E; + {$EXTERNALSYM PropertyTagHalftoneMisc} + PropertyTagHalftoneScreen = $500F; + {$EXTERNALSYM PropertyTagHalftoneScreen} + PropertyTagJPEGQuality = $5010; + {$EXTERNALSYM PropertyTagJPEGQuality} + PropertyTagGridSize = $5011; + {$EXTERNALSYM PropertyTagGridSize} + PropertyTagThumbnailFormat = $5012; // 1 = JPEG, 0 = RAW RGB + {$EXTERNALSYM PropertyTagThumbnailFormat} + PropertyTagThumbnailWidth = $5013; + {$EXTERNALSYM PropertyTagThumbnailWidth} + PropertyTagThumbnailHeight = $5014; + {$EXTERNALSYM PropertyTagThumbnailHeight} + PropertyTagThumbnailColorDepth = $5015; + {$EXTERNALSYM PropertyTagThumbnailColorDepth} + PropertyTagThumbnailPlanes = $5016; + {$EXTERNALSYM PropertyTagThumbnailPlanes} + PropertyTagThumbnailRawBytes = $5017; + {$EXTERNALSYM PropertyTagThumbnailRawBytes} + PropertyTagThumbnailSize = $5018; + {$EXTERNALSYM PropertyTagThumbnailSize} + PropertyTagThumbnailCompressedSize = $5019; + {$EXTERNALSYM PropertyTagThumbnailCompressedSize} + PropertyTagColorTransferFunction = $501A; + {$EXTERNALSYM PropertyTagColorTransferFunction} + PropertyTagThumbnailData = $501B; // RAW thumbnail bits in + {$EXTERNALSYM PropertyTagThumbnailData} + // JPEG format or RGB format + // depends on + // PropertyTagThumbnailFormat + + // Thumbnail related TAGs + + PropertyTagThumbnailImageWidth = $5020; // Thumbnail width + {$EXTERNALSYM PropertyTagThumbnailImageWidth} + PropertyTagThumbnailImageHeight = $5021; // Thumbnail height + {$EXTERNALSYM PropertyTagThumbnailImageHeight} + PropertyTagThumbnailBitsPerSample = $5022; // Number of bits per + {$EXTERNALSYM PropertyTagThumbnailBitsPerSample} + // component + PropertyTagThumbnailCompression = $5023; // Compression Scheme + {$EXTERNALSYM PropertyTagThumbnailCompression} + PropertyTagThumbnailPhotometricInterp = $5024; // Pixel composition + {$EXTERNALSYM PropertyTagThumbnailPhotometricInterp} + PropertyTagThumbnailImageDescription = $5025; // Image Tile + {$EXTERNALSYM PropertyTagThumbnailImageDescription} + PropertyTagThumbnailEquipMake = $5026; // Manufacturer of Image + {$EXTERNALSYM PropertyTagThumbnailEquipMake} + // Input equipment + PropertyTagThumbnailEquipModel = $5027; // Model of Image input + {$EXTERNALSYM PropertyTagThumbnailEquipModel} + // equipment + PropertyTagThumbnailStripOffsets = $5028; // Image data location + {$EXTERNALSYM PropertyTagThumbnailStripOffsets} + PropertyTagThumbnailOrientation = $5029; // Orientation of image + {$EXTERNALSYM PropertyTagThumbnailOrientation} + PropertyTagThumbnailSamplesPerPixel = $502A; // Number of components + {$EXTERNALSYM PropertyTagThumbnailSamplesPerPixel} + PropertyTagThumbnailRowsPerStrip = $502B; // Number of rows per strip + {$EXTERNALSYM PropertyTagThumbnailRowsPerStrip} + PropertyTagThumbnailStripBytesCount = $502C; // Bytes per compressed + {$EXTERNALSYM PropertyTagThumbnailStripBytesCount} + // strip + PropertyTagThumbnailResolutionX = $502D; // Resolution in width + {$EXTERNALSYM PropertyTagThumbnailResolutionX} + // direction + PropertyTagThumbnailResolutionY = $502E; // Resolution in height + {$EXTERNALSYM PropertyTagThumbnailResolutionY} + // direction + PropertyTagThumbnailPlanarConfig = $502F; // Image data arrangement + {$EXTERNALSYM PropertyTagThumbnailPlanarConfig} + PropertyTagThumbnailResolutionUnit = $5030; // Unit of X and Y + {$EXTERNALSYM PropertyTagThumbnailResolutionUnit} + // Resolution + PropertyTagThumbnailTransferFunction = $5031; // Transfer function + {$EXTERNALSYM PropertyTagThumbnailTransferFunction} + PropertyTagThumbnailSoftwareUsed = $5032; // Software used + {$EXTERNALSYM PropertyTagThumbnailSoftwareUsed} + PropertyTagThumbnailDateTime = $5033; // File change date and + {$EXTERNALSYM PropertyTagThumbnailDateTime} + // time + PropertyTagThumbnailArtist = $5034; // Person who created the + {$EXTERNALSYM PropertyTagThumbnailArtist} + // image + PropertyTagThumbnailWhitePoint = $5035; // White point chromaticity + {$EXTERNALSYM PropertyTagThumbnailWhitePoint} + PropertyTagThumbnailPrimaryChromaticities = $5036; + {$EXTERNALSYM PropertyTagThumbnailPrimaryChromaticities} + // Chromaticities of + // primaries + PropertyTagThumbnailYCbCrCoefficients = $5037; // Color space transforma- + {$EXTERNALSYM PropertyTagThumbnailYCbCrCoefficients} + // tion coefficients + PropertyTagThumbnailYCbCrSubsampling = $5038; // Subsampling ratio of Y + {$EXTERNALSYM PropertyTagThumbnailYCbCrSubsampling} + // to C + PropertyTagThumbnailYCbCrPositioning = $5039; // Y and C position + {$EXTERNALSYM PropertyTagThumbnailYCbCrPositioning} + PropertyTagThumbnailRefBlackWhite = $503A; // Pair of black and white + {$EXTERNALSYM PropertyTagThumbnailRefBlackWhite} + // reference values + PropertyTagThumbnailCopyRight = $503B; // CopyRight holder + {$EXTERNALSYM PropertyTagThumbnailCopyRight} + + PropertyTagLuminanceTable = $5090; + {$EXTERNALSYM PropertyTagLuminanceTable} + PropertyTagChrominanceTable = $5091; + {$EXTERNALSYM PropertyTagChrominanceTable} + + PropertyTagFrameDelay = $5100; + {$EXTERNALSYM PropertyTagFrameDelay} + PropertyTagLoopCount = $5101; + {$EXTERNALSYM PropertyTagLoopCount} + + PropertyTagPixelUnit = $5110; // Unit specifier for pixel/unit + {$EXTERNALSYM PropertyTagPixelUnit} + PropertyTagPixelPerUnitX = $5111; // Pixels per unit in X + {$EXTERNALSYM PropertyTagPixelPerUnitX} + PropertyTagPixelPerUnitY = $5112; // Pixels per unit in Y + {$EXTERNALSYM PropertyTagPixelPerUnitY} + PropertyTagPaletteHistogram = $5113; // Palette histogram + {$EXTERNALSYM PropertyTagPaletteHistogram} + + // EXIF specific tag + + PropertyTagExifExposureTime = $829A; + {$EXTERNALSYM PropertyTagExifExposureTime} + PropertyTagExifFNumber = $829D; + {$EXTERNALSYM PropertyTagExifFNumber} + + PropertyTagExifExposureProg = $8822; + {$EXTERNALSYM PropertyTagExifExposureProg} + PropertyTagExifSpectralSense = $8824; + {$EXTERNALSYM PropertyTagExifSpectralSense} + PropertyTagExifISOSpeed = $8827; + {$EXTERNALSYM PropertyTagExifISOSpeed} + PropertyTagExifOECF = $8828; + {$EXTERNALSYM PropertyTagExifOECF} + + PropertyTagExifVer = $9000; + {$EXTERNALSYM PropertyTagExifVer} + PropertyTagExifDTOrig = $9003; // Date & time of original + {$EXTERNALSYM PropertyTagExifDTOrig} + PropertyTagExifDTDigitized = $9004; // Date & time of digital data generation + {$EXTERNALSYM PropertyTagExifDTDigitized} + + PropertyTagExifCompConfig = $9101; + {$EXTERNALSYM PropertyTagExifCompConfig} + PropertyTagExifCompBPP = $9102; + {$EXTERNALSYM PropertyTagExifCompBPP} + + PropertyTagExifShutterSpeed = $9201; + {$EXTERNALSYM PropertyTagExifShutterSpeed} + PropertyTagExifAperture = $9202; + {$EXTERNALSYM PropertyTagExifAperture} + PropertyTagExifBrightness = $9203; + {$EXTERNALSYM PropertyTagExifBrightness} + PropertyTagExifExposureBias = $9204; + {$EXTERNALSYM PropertyTagExifExposureBias} + PropertyTagExifMaxAperture = $9205; + {$EXTERNALSYM PropertyTagExifMaxAperture} + PropertyTagExifSubjectDist = $9206; + {$EXTERNALSYM PropertyTagExifSubjectDist} + PropertyTagExifMeteringMode = $9207; + {$EXTERNALSYM PropertyTagExifMeteringMode} + PropertyTagExifLightSource = $9208; + {$EXTERNALSYM PropertyTagExifLightSource} + PropertyTagExifFlash = $9209; + {$EXTERNALSYM PropertyTagExifFlash} + PropertyTagExifFocalLength = $920A; + {$EXTERNALSYM PropertyTagExifFocalLength} + PropertyTagExifMakerNote = $927C; + {$EXTERNALSYM PropertyTagExifMakerNote} + PropertyTagExifUserComment = $9286; + {$EXTERNALSYM PropertyTagExifUserComment} + PropertyTagExifDTSubsec = $9290; // Date & Time subseconds + {$EXTERNALSYM PropertyTagExifDTSubsec} + PropertyTagExifDTOrigSS = $9291; // Date & Time original subseconds + {$EXTERNALSYM PropertyTagExifDTOrigSS} + PropertyTagExifDTDigSS = $9292; // Date & TIme digitized subseconds + {$EXTERNALSYM PropertyTagExifDTDigSS} + + PropertyTagExifFPXVer = $A000; + {$EXTERNALSYM PropertyTagExifFPXVer} + PropertyTagExifColorSpace = $A001; + {$EXTERNALSYM PropertyTagExifColorSpace} + PropertyTagExifPixXDim = $A002; + {$EXTERNALSYM PropertyTagExifPixXDim} + PropertyTagExifPixYDim = $A003; + {$EXTERNALSYM PropertyTagExifPixYDim} + PropertyTagExifRelatedWav = $A004; // related sound file + {$EXTERNALSYM PropertyTagExifRelatedWav} + PropertyTagExifInterop = $A005; + {$EXTERNALSYM PropertyTagExifInterop} + PropertyTagExifFlashEnergy = $A20B; + {$EXTERNALSYM PropertyTagExifFlashEnergy} + PropertyTagExifSpatialFR = $A20C; // Spatial Frequency Response + {$EXTERNALSYM PropertyTagExifSpatialFR} + PropertyTagExifFocalXRes = $A20E; // Focal Plane X Resolution + {$EXTERNALSYM PropertyTagExifFocalXRes} + PropertyTagExifFocalYRes = $A20F; // Focal Plane Y Resolution + {$EXTERNALSYM PropertyTagExifFocalYRes} + PropertyTagExifFocalResUnit = $A210; // Focal Plane Resolution Unit + {$EXTERNALSYM PropertyTagExifFocalResUnit} + PropertyTagExifSubjectLoc = $A214; + {$EXTERNALSYM PropertyTagExifSubjectLoc} + PropertyTagExifExposureIndex = $A215; + {$EXTERNALSYM PropertyTagExifExposureIndex} + PropertyTagExifSensingMethod = $A217; + {$EXTERNALSYM PropertyTagExifSensingMethod} + PropertyTagExifFileSource = $A300; + {$EXTERNALSYM PropertyTagExifFileSource} + PropertyTagExifSceneType = $A301; + {$EXTERNALSYM PropertyTagExifSceneType} + PropertyTagExifCfaPattern = $A302; + {$EXTERNALSYM PropertyTagExifCfaPattern} + + PropertyTagGpsVer = $0000; + {$EXTERNALSYM PropertyTagGpsVer} + PropertyTagGpsLatitudeRef = $0001; + {$EXTERNALSYM PropertyTagGpsLatitudeRef} + PropertyTagGpsLatitude = $0002; + {$EXTERNALSYM PropertyTagGpsLatitude} + PropertyTagGpsLongitudeRef = $0003; + {$EXTERNALSYM PropertyTagGpsLongitudeRef} + PropertyTagGpsLongitude = $0004; + {$EXTERNALSYM PropertyTagGpsLongitude} + PropertyTagGpsAltitudeRef = $0005; + {$EXTERNALSYM PropertyTagGpsAltitudeRef} + PropertyTagGpsAltitude = $0006; + {$EXTERNALSYM PropertyTagGpsAltitude} + PropertyTagGpsGpsTime = $0007; + {$EXTERNALSYM PropertyTagGpsGpsTime} + PropertyTagGpsGpsSatellites = $0008; + {$EXTERNALSYM PropertyTagGpsGpsSatellites} + PropertyTagGpsGpsStatus = $0009; + {$EXTERNALSYM PropertyTagGpsGpsStatus} + PropertyTagGpsGpsMeasureMode = $00A; + {$EXTERNALSYM PropertyTagGpsGpsMeasureMode} + PropertyTagGpsGpsDop = $000B; // Measurement precision + {$EXTERNALSYM PropertyTagGpsGpsDop} + PropertyTagGpsSpeedRef = $000C; + {$EXTERNALSYM PropertyTagGpsSpeedRef} + PropertyTagGpsSpeed = $000D; + {$EXTERNALSYM PropertyTagGpsSpeed} + PropertyTagGpsTrackRef = $000E; + {$EXTERNALSYM PropertyTagGpsTrackRef} + PropertyTagGpsTrack = $000F; + {$EXTERNALSYM PropertyTagGpsTrack} + PropertyTagGpsImgDirRef = $0010; + {$EXTERNALSYM PropertyTagGpsImgDirRef} + PropertyTagGpsImgDir = $0011; + {$EXTERNALSYM PropertyTagGpsImgDir} + PropertyTagGpsMapDatum = $0012; + {$EXTERNALSYM PropertyTagGpsMapDatum} + PropertyTagGpsDestLatRef = $0013; + {$EXTERNALSYM PropertyTagGpsDestLatRef} + PropertyTagGpsDestLat = $0014; + {$EXTERNALSYM PropertyTagGpsDestLat} + PropertyTagGpsDestLongRef = $0015; + {$EXTERNALSYM PropertyTagGpsDestLongRef} + PropertyTagGpsDestLong = $0016; + {$EXTERNALSYM PropertyTagGpsDestLong} + PropertyTagGpsDestBearRef = $0017; + {$EXTERNALSYM PropertyTagGpsDestBearRef} + PropertyTagGpsDestBear = $0018; + {$EXTERNALSYM PropertyTagGpsDestBear} + PropertyTagGpsDestDistRef = $0019; + {$EXTERNALSYM PropertyTagGpsDestDistRef} + PropertyTagGpsDestDist = $001A; + {$EXTERNALSYM PropertyTagGpsDestDist} + +(**************************************************************************\ +* +* GDI+ Color Matrix object, used with Graphics.DrawImage +* +\**************************************************************************) + +//---------------------------------------------------------------------------- +// Color matrix +//---------------------------------------------------------------------------- + +type + {$EXTERNALSYM ColorMatrix} + ColorMatrix = packed array[0..4, 0..4] of Single; + TColorMatrix = ColorMatrix; + PColorMatrix = ^TColorMatrix; + +//---------------------------------------------------------------------------- +// Color Matrix flags +//---------------------------------------------------------------------------- + + {$EXTERNALSYM ColorMatrixFlags} + ColorMatrixFlags = ( + ColorMatrixFlagsDefault, + ColorMatrixFlagsSkipGrays, + ColorMatrixFlagsAltGray + ); + TColorMatrixFlags = ColorMatrixFlags; + +//---------------------------------------------------------------------------- +// Color Adjust Type +//---------------------------------------------------------------------------- + + {$EXTERNALSYM ColorAdjustType} + ColorAdjustType = ( + ColorAdjustTypeDefault, + ColorAdjustTypeBitmap, + ColorAdjustTypeBrush, + ColorAdjustTypePen, + ColorAdjustTypeText, + ColorAdjustTypeCount, + ColorAdjustTypeAny // Reserved + ); + TColorAdjustType = ColorAdjustType; + +//---------------------------------------------------------------------------- +// Color Map +//---------------------------------------------------------------------------- + + {$EXTERNALSYM ColorMap} + ColorMap = packed record + oldColor: TGPColor; + newColor: TGPColor; + end; + TColorMap = ColorMap; + PColorMap = ^TColorMap; + +//--------------------------------------------------------------------------- +// Private GDI+ classes for internal type checking +//--------------------------------------------------------------------------- + + GpGraphics = Pointer; + + GpBrush = Pointer; + GpTexture = Pointer; + GpSolidFill = Pointer; + GpLineGradient = Pointer; + GpPathGradient = Pointer; + GpHatch = Pointer; + + GpPen = Pointer; + GpCustomLineCap = Pointer; + GpAdjustableArrowCap = Pointer; + + GpImage = Pointer; + GpBitmap = Pointer; + GpMetafile = Pointer; + GpImageAttributes = Pointer; + + GpPath = Pointer; + GpRegion = Pointer; + GpPathIterator = Pointer; + + GpFontFamily = Pointer; + GpFont = Pointer; + GpStringFormat = Pointer; + GpFontCollection = Pointer; + GpCachedBitmap = Pointer; + + GpStatus = TStatus; + GpFillMode = TFillMode; + GpWrapMode = TWrapMode; + GpUnit = TUnit; + GpCoordinateSpace = TCoordinateSpace; + GpPointF = PGPPointF; + GpPoint = PGPPoint; + GpRectF = PGPRectF; + GpRect = PGPRect; + GpSizeF = PGPSizeF; + GpHatchStyle = THatchStyle; + GpDashStyle = TDashStyle; + GpLineCap = TLineCap; + GpDashCap = TDashCap; + + GpPenAlignment = TPenAlignment; + + GpLineJoin = TLineJoin; + GpPenType = TPenType; + + GpMatrix = Pointer; + GpBrushType = TBrushType; + GpMatrixOrder = TMatrixOrder; + GpFlushIntention = TFlushIntention; + GpPathData = TPathData; + +(**************************************************************************\ +* +* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved. +* Module Name: +* GdiplusFlat.h +* Abstract: +* Private GDI+ header file. +* +\**************************************************************************) + + function GdipCreatePath(brushMode: GPFILLMODE; + out path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreatePath} + + function GdipCreatePath2(v1: GPPOINTF; v2: PBYTE; v3: Integer; v4: GPFILLMODE; + out path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreatePath2} + + function GdipCreatePath2I(v1: GPPOINT; v2: PBYTE; v3: Integer; v4: GPFILLMODE; + out path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreatePath2I} + + function GdipClonePath(path: GPPATH; + out clonePath: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipClonePath} + + function GdipDeletePath(path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeletePath} + + function GdipResetPath(path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipResetPath} + + function GdipGetPointCount(path: GPPATH; + out count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPointCount} + + function GdipGetPathTypes(path: GPPATH; types: PBYTE; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathTypes} + + function GdipGetPathPoints(v1: GPPATH; points: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathPoints} + + function GdipGetPathPointsI(v1: GPPATH; points: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathPointsI} + + function GdipGetPathFillMode(path: GPPATH; + var fillmode: GPFILLMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathFillMode} + + function GdipSetPathFillMode(path: GPPATH; + fillmode: GPFILLMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathFillMode} + + function GdipGetPathData(path: GPPATH; + pathData: Pointer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathData} + + function GdipStartPathFigure(path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipStartPathFigure} + + function GdipClosePathFigure(path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipClosePathFigure} + + function GdipClosePathFigures(path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipClosePathFigures} + + function GdipSetPathMarker(path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathMarker} + + function GdipClearPathMarkers(path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipClearPathMarkers} + + function GdipReversePath(path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipReversePath} + + function GdipGetPathLastPoint(path: GPPATH; + lastPoint: GPPOINTF): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathLastPoint} + + function GdipAddPathLine(path: GPPATH; + x1, y1, x2, y2: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathLine} + + function GdipAddPathLine2(path: GPPATH; points: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathLine2} + + function GdipAddPathArc(path: GPPATH; x, y, width, height, startAngle, + sweepAngle: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathArc} + + function GdipAddPathBezier(path: GPPATH; + x1, y1, x2, y2, x3, y3, x4, y4: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathBezier} + + function GdipAddPathBeziers(path: GPPATH; points: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathBeziers} + + function GdipAddPathCurve(path: GPPATH; points: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathCurve} + + function GdipAddPathCurve2(path: GPPATH; points: GPPOINTF; count: Integer; + tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathCurve2} + + function GdipAddPathCurve3(path: GPPATH; points: GPPOINTF; count: Integer; + offset: Integer; numberOfSegments: Integer; + tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathCurve3} + + function GdipAddPathClosedCurve(path: GPPATH; points: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathClosedCurve} + + function GdipAddPathClosedCurve2(path: GPPATH; points: GPPOINTF; + count: Integer; tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathClosedCurve2} + + function GdipAddPathRectangle(path: GPPATH; x: Single; y: Single; + width: Single; height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathRectangle} + + function GdipAddPathRectangles(path: GPPATH; rects: GPRECTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathRectangles} + + function GdipAddPathEllipse(path: GPPATH; x: Single; y: Single; + width: Single; height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathEllipse} + + function GdipAddPathPie(path: GPPATH; x: Single; y: Single; width: Single; + height: Single; startAngle: Single; sweepAngle: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathPie} + + function GdipAddPathPolygon(path: GPPATH; points: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathPolygon} + + function GdipAddPathPath(path: GPPATH; addingPath: GPPATH; + connect: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathPath} + + function GdipAddPathString(path: GPPATH; string_: PWCHAR; length: Integer; + family: GPFONTFAMILY; style: Integer; emSize: Single; layoutRect: PGPRectF; + format: GPSTRINGFORMAT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathString} + + function GdipAddPathStringI(path: GPPATH; string_: PWCHAR; length: Integer; + family: GPFONTFAMILY; style: Integer; emSize: Single; layoutRect: PGPRect; + format: GPSTRINGFORMAT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathStringI} + + function GdipAddPathLineI(path: GPPATH; x1: Integer; y1: Integer; x2: Integer; + y2: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathLineI} + + function GdipAddPathLine2I(path: GPPATH; points: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathLine2I} + + function GdipAddPathArcI(path: GPPATH; x: Integer; y: Integer; width: Integer; + height: Integer; startAngle: Single; sweepAngle: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathArcI} + + function GdipAddPathBezierI(path: GPPATH; x1: Integer; y1: Integer; + x2: Integer; y2: Integer; x3: Integer; y3: Integer; x4: Integer; + y4: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathBezierI} + + function GdipAddPathBeziersI(path: GPPATH; points: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathBeziersI} + + function GdipAddPathCurveI(path: GPPATH; points: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathCurveI} + + function GdipAddPathCurve2I(path: GPPATH; points: GPPOINT; count: Integer; + tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathCurve2I} + + function GdipAddPathCurve3I(path: GPPATH; points: GPPOINT; count: Integer; + offset: Integer; numberOfSegments: Integer; + tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathCurve3I} + + function GdipAddPathClosedCurveI(path: GPPATH; points: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathClosedCurveI} + + function GdipAddPathClosedCurve2I(path: GPPATH; points: GPPOINT; + count: Integer; tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathClosedCurve2I} + + function GdipAddPathRectangleI(path: GPPATH; x: Integer; y: Integer; + width: Integer; height: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathRectangleI} + + function GdipAddPathRectanglesI(path: GPPATH; rects: GPRECT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathRectanglesI} + + function GdipAddPathEllipseI(path: GPPATH; x: Integer; y: Integer; + width: Integer; height: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathEllipseI} + + function GdipAddPathPieI(path: GPPATH; x: Integer; y: Integer; width: Integer; + height: Integer; startAngle: Single; sweepAngle: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathPieI} + + function GdipAddPathPolygonI(path: GPPATH; points: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipAddPathPolygonI} + + function GdipFlattenPath(path: GPPATH; matrix: GPMATRIX; + flatness: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFlattenPath} + + function GdipWindingModeOutline(path: GPPATH; matrix: GPMATRIX; + flatness: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipWindingModeOutline} + + function GdipWidenPath(nativePath: GPPATH; pen: GPPEN; matrix: GPMATRIX; + flatness: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipWidenPath} + + function GdipWarpPath(path: GPPATH; matrix: GPMATRIX; points: GPPOINTF; + count: Integer; srcx: Single; srcy: Single; srcwidth: Single; + srcheight: Single; warpMode: WARPMODE; flatness: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipWarpPath} + + function GdipTransformPath(path: GPPATH; matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTransformPath} + + function GdipGetPathWorldBounds(path: GPPATH; bounds: GPRECTF; + matrix: GPMATRIX; pen: GPPEN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathWorldBounds} + + function GdipGetPathWorldBoundsI(path: GPPATH; bounds: GPRECT; + matrix: GPMATRIX; pen: GPPEN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathWorldBoundsI} + + function GdipIsVisiblePathPoint(path: GPPATH; x: Single; y: Single; + graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsVisiblePathPoint} + + function GdipIsVisiblePathPointI(path: GPPATH; x: Integer; y: Integer; + graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsVisiblePathPointI} + + function GdipIsOutlineVisiblePathPoint(path: GPPATH; x: Single; y: Single; + pen: GPPEN; graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsOutlineVisiblePathPoint} + + function GdipIsOutlineVisiblePathPointI(path: GPPATH; x: Integer; y: Integer; + pen: GPPEN; graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsOutlineVisiblePathPointI} + +//---------------------------------------------------------------------------- +// PathIterator APIs +//---------------------------------------------------------------------------- + + function GdipCreatePathIter(out iterator: GPPATHITERATOR; + path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreatePathIter} + + function GdipDeletePathIter(iterator: GPPATHITERATOR): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeletePathIter} + + function GdipPathIterNextSubpath(iterator: GPPATHITERATOR; + var resultCount: Integer; var startIndex: Integer; var endIndex: Integer; + out isClosed: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterNextSubpath} + + function GdipPathIterNextSubpathPath(iterator: GPPATHITERATOR; + var resultCount: Integer; path: GPPATH; + out isClosed: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterNextSubpathPath} + + function GdipPathIterNextPathType(iterator: GPPATHITERATOR; + var resultCount: Integer; pathType: PBYTE; var startIndex: Integer; + var endIndex: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterNextPathType} + + function GdipPathIterNextMarker(iterator: GPPATHITERATOR; + var resultCount: Integer; var startIndex: Integer; + var endIndex: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterNextMarker} + + function GdipPathIterNextMarkerPath(iterator: GPPATHITERATOR; + var resultCount: Integer; path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterNextMarkerPath} + + function GdipPathIterGetCount(iterator: GPPATHITERATOR; + out count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterGetCount} + + function GdipPathIterGetSubpathCount(iterator: GPPATHITERATOR; + out count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterGetSubpathCount} + + function GdipPathIterIsValid(iterator: GPPATHITERATOR; + out valid: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterIsValid} + + function GdipPathIterHasCurve(iterator: GPPATHITERATOR; + out hasCurve: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterHasCurve} + + function GdipPathIterRewind(iterator: GPPATHITERATOR): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterRewind} + + function GdipPathIterEnumerate(iterator: GPPATHITERATOR; + var resultCount: Integer; points: GPPOINTF; types: PBYTE; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterEnumerate} + + function GdipPathIterCopyData(iterator: GPPATHITERATOR; + var resultCount: Integer; points: GPPOINTF; types: PBYTE; + startIndex: Integer; endIndex: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPathIterCopyData} + +//---------------------------------------------------------------------------- +// Matrix APIs +//---------------------------------------------------------------------------- + + function GdipCreateMatrix(out matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateMatrix} + + function GdipCreateMatrix2(m11: Single; m12: Single; m21: Single; m22: Single; + dx: Single; dy: Single; out matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateMatrix2} + + function GdipCreateMatrix3(rect: GPRECTF; dstplg: GPPOINTF; + out matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateMatrix3} + + function GdipCreateMatrix3I(rect: GPRECT; dstplg: GPPOINT; + out matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateMatrix3I} + + function GdipCloneMatrix(matrix: GPMATRIX; + out cloneMatrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCloneMatrix} + + function GdipDeleteMatrix(matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeleteMatrix} + + function GdipSetMatrixElements(matrix: GPMATRIX; m11: Single; m12: Single; + m21: Single; m22: Single; dx: Single; dy: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetMatrixElements} + + function GdipMultiplyMatrix(matrix: GPMATRIX; matrix2: GPMATRIX; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipMultiplyMatrix} + + function GdipTranslateMatrix(matrix: GPMATRIX; offsetX: Single; + offsetY: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTranslateMatrix} + + function GdipScaleMatrix(matrix: GPMATRIX; scaleX: Single; scaleY: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipScaleMatrix} + + function GdipRotateMatrix(matrix: GPMATRIX; angle: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRotateMatrix} + + function GdipShearMatrix(matrix: GPMATRIX; shearX: Single; shearY: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipShearMatrix} + + function GdipInvertMatrix(matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipInvertMatrix} + + function GdipTransformMatrixPoints(matrix: GPMATRIX; pts: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTransformMatrixPoints} + + function GdipTransformMatrixPointsI(matrix: GPMATRIX; pts: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTransformMatrixPointsI} + + function GdipVectorTransformMatrixPoints(matrix: GPMATRIX; pts: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipVectorTransformMatrixPoints} + + function GdipVectorTransformMatrixPointsI(matrix: GPMATRIX; pts: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipVectorTransformMatrixPointsI} + + function GdipGetMatrixElements(matrix: GPMATRIX; + matrixOut: PSingle): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetMatrixElements} + + function GdipIsMatrixInvertible(matrix: GPMATRIX; + out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsMatrixInvertible} + + function GdipIsMatrixIdentity(matrix: GPMATRIX; + out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsMatrixIdentity} + + function GdipIsMatrixEqual(matrix: GPMATRIX; matrix2: GPMATRIX; + out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsMatrixEqual} + +//---------------------------------------------------------------------------- +// Region APIs +//---------------------------------------------------------------------------- + + function GdipCreateRegion(out region: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateRegion} + + function GdipCreateRegionRect(rect: GPRECTF; + out region: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateRegionRect} + + function GdipCreateRegionRectI(rect: GPRECT; + out region: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateRegionRectI} + + function GdipCreateRegionPath(path: GPPATH; + out region: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateRegionPath} + + function GdipCreateRegionRgnData(regionData: PBYTE; size: Integer; + out region: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateRegionRgnData} + + function GdipCreateRegionHrgn(hRgn: HRGN; + out region: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateRegionHrgn} + + function GdipCloneRegion(region: GPREGION; + out cloneRegion: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCloneRegion} + + function GdipDeleteRegion(region: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeleteRegion} + + function GdipSetInfinite(region: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetInfinite} + + function GdipSetEmpty(region: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetEmpty} + + function GdipCombineRegionRect(region: GPREGION; rect: GPRECTF; + combineMode: COMBINEMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCombineRegionRect} + + function GdipCombineRegionRectI(region: GPREGION; rect: GPRECT; + combineMode: COMBINEMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCombineRegionRectI} + + function GdipCombineRegionPath(region: GPREGION; path: GPPATH; + combineMode: COMBINEMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCombineRegionPath} + + function GdipCombineRegionRegion(region: GPREGION; region2: GPREGION; + combineMode: COMBINEMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCombineRegionRegion} + + function GdipTranslateRegion(region: GPREGION; dx: Single; + dy: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTranslateRegion} + + function GdipTranslateRegionI(region: GPREGION; dx: Integer; + dy: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTranslateRegionI} + + function GdipTransformRegion(region: GPREGION; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTransformRegion} + + function GdipGetRegionBounds(region: GPREGION; graphics: GPGRAPHICS; + rect: GPRECTF): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetRegionBounds} + + function GdipGetRegionBoundsI(region: GPREGION; graphics: GPGRAPHICS; + rect: GPRECT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetRegionBoundsI} + + function GdipGetRegionHRgn(region: GPREGION; graphics: GPGRAPHICS; + out hRgn: HRGN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetRegionHRgn} + + function GdipIsEmptyRegion(region: GPREGION; graphics: GPGRAPHICS; + out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsEmptyRegion} + + function GdipIsInfiniteRegion(region: GPREGION; graphics: GPGRAPHICS; + out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsInfiniteRegion} + + function GdipIsEqualRegion(region: GPREGION; region2: GPREGION; + graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsEqualRegion} + + function GdipGetRegionDataSize(region: GPREGION; + out bufferSize: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetRegionDataSize} + + function GdipGetRegionData(region: GPREGION; buffer: PBYTE; + bufferSize: UINT; sizeFilled: PUINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetRegionData} + + function GdipIsVisibleRegionPoint(region: GPREGION; x: Single; y: Single; + graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsVisibleRegionPoint} + + function GdipIsVisibleRegionPointI(region: GPREGION; x: Integer; y: Integer; + graphics: GPGRAPHICS; out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsVisibleRegionPointI} + + function GdipIsVisibleRegionRect(region: GPREGION; x: Single; y: Single; + width: Single; height: Single; graphics: GPGRAPHICS; + out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsVisibleRegionRect} + + function GdipIsVisibleRegionRectI(region: GPREGION; x: Integer; y: Integer; + width: Integer; height: Integer; graphics: GPGRAPHICS; + out result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsVisibleRegionRectI} + + function GdipGetRegionScansCount(region: GPREGION; out count: UINT; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetRegionScansCount} + + function GdipGetRegionScans(region: GPREGION; rects: GPRECTF; + out count: Integer; matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetRegionScans} + + function GdipGetRegionScansI(region: GPREGION; rects: GPRECT; + out count: Integer; matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetRegionScansI} + +//---------------------------------------------------------------------------- +// Brush APIs +//---------------------------------------------------------------------------- + + function GdipCloneBrush(brush: GPBRUSH; + out cloneBrush: GPBRUSH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCloneBrush} + + function GdipDeleteBrush(brush: GPBRUSH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeleteBrush} + + function GdipGetBrushType(brush: GPBRUSH; + out type_: GPBRUSHTYPE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetBrushType} + +//---------------------------------------------------------------------------- +// HatchBrush APIs +//---------------------------------------------------------------------------- + + function GdipCreateHatchBrush(hatchstyle: Integer; forecol: ARGB; + backcol: ARGB; out brush: GPHATCH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateHatchBrush} + + function GdipGetHatchStyle(brush: GPHATCH; + out hatchstyle: GPHATCHSTYLE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetHatchStyle} + + function GdipGetHatchForegroundColor(brush: GPHATCH; + out forecol: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetHatchForegroundColor} + + function GdipGetHatchBackgroundColor(brush: GPHATCH; + out backcol: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetHatchBackgroundColor} + +//---------------------------------------------------------------------------- +// TextureBrush APIs +//---------------------------------------------------------------------------- + + + function GdipCreateTexture(image: GPIMAGE; wrapmode: GPWRAPMODE; + var texture: GPTEXTURE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateTexture} + + function GdipCreateTexture2(image: GPIMAGE; wrapmode: GPWRAPMODE; + x: Single; y: Single; width: Single; height: Single; + out texture: GPTEXTURE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateTexture2} + + function GdipCreateTextureIA(image: GPIMAGE; + imageAttributes: GPIMAGEATTRIBUTES; x: Single; y: Single; width: Single; + height: Single; out texture: GPTEXTURE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateTextureIA} + + function GdipCreateTexture2I(image: GPIMAGE; wrapmode: GPWRAPMODE; x: Integer; + y: Integer; width: Integer; height: Integer; + out texture: GPTEXTURE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateTexture2I} + + function GdipCreateTextureIAI(image: GPIMAGE; + imageAttributes: GPIMAGEATTRIBUTES; x: Integer; y: Integer; width: Integer; + height: Integer; out texture: GPTEXTURE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateTextureIAI} + + function GdipGetTextureTransform(brush: GPTEXTURE; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetTextureTransform} + + function GdipSetTextureTransform(brush: GPTEXTURE; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetTextureTransform} + + function GdipResetTextureTransform(brush: GPTEXTURE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipResetTextureTransform} + + function GdipMultiplyTextureTransform(brush: GPTEXTURE; matrix: GPMATRIX; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipMultiplyTextureTransform} + + function GdipTranslateTextureTransform(brush: GPTEXTURE; dx: Single; + dy: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTranslateTextureTransform} + + function GdipScaleTextureTransform(brush: GPTEXTURE; sx: Single; sy: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipScaleTextureTransform} + + function GdipRotateTextureTransform(brush: GPTEXTURE; angle: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRotateTextureTransform} + + function GdipSetTextureWrapMode(brush: GPTEXTURE; + wrapmode: GPWRAPMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetTextureWrapMode} + + function GdipGetTextureWrapMode(brush: GPTEXTURE; + var wrapmode: GPWRAPMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetTextureWrapMode} + + function GdipGetTextureImage(brush: GPTEXTURE; + out image: GPIMAGE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetTextureImage} + +//---------------------------------------------------------------------------- +// SolidBrush APIs +//---------------------------------------------------------------------------- + + function GdipCreateSolidFill(color: ARGB; + out brush: GPSOLIDFILL): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateSolidFill} + + function GdipSetSolidFillColor(brush: GPSOLIDFILL; + color: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetSolidFillColor} + + function GdipGetSolidFillColor(brush: GPSOLIDFILL; + out color: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetSolidFillColor} + +//---------------------------------------------------------------------------- +// LineBrush APIs +//---------------------------------------------------------------------------- + + function GdipCreateLineBrush(point1: GPPOINTF; point2: GPPOINTF; color1: ARGB; + color2: ARGB; wrapMode: GPWRAPMODE; + out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateLineBrush} + + function GdipCreateLineBrushI(point1: GPPOINT; point2: GPPOINT; color1: ARGB; + color2: ARGB; wrapMode: GPWRAPMODE; + out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateLineBrushI} + + function GdipCreateLineBrushFromRect(rect: GPRECTF; color1: ARGB; + color2: ARGB; mode: LINEARGRADIENTMODE; wrapMode: GPWRAPMODE; + out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateLineBrushFromRect} + + function GdipCreateLineBrushFromRectI(rect: GPRECT; color1: ARGB; + color2: ARGB; mode: LINEARGRADIENTMODE; wrapMode: GPWRAPMODE; + out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateLineBrushFromRectI} + + function GdipCreateLineBrushFromRectWithAngle(rect: GPRECTF; color1: ARGB; + color2: ARGB; angle: Single; isAngleScalable: Bool; wrapMode: GPWRAPMODE; + out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateLineBrushFromRectWithAngle} + + function GdipCreateLineBrushFromRectWithAngleI(rect: GPRECT; color1: ARGB; + color2: ARGB; angle: Single; isAngleScalable: Bool; wrapMode: GPWRAPMODE; + out lineGradient: GPLINEGRADIENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateLineBrushFromRectWithAngleI} + + function GdipSetLineColors(brush: GPLINEGRADIENT; color1: ARGB; + color2: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetLineColors} + + function GdipGetLineColors(brush: GPLINEGRADIENT; + colors: PARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLineColors} + + function GdipGetLineRect(brush: GPLINEGRADIENT; + rect: GPRECTF): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLineRect} + + function GdipGetLineRectI(brush: GPLINEGRADIENT; + rect: GPRECT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLineRectI} + + function GdipSetLineGammaCorrection(brush: GPLINEGRADIENT; + useGammaCorrection: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetLineGammaCorrection} + + function GdipGetLineGammaCorrection(brush: GPLINEGRADIENT; + out useGammaCorrection: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLineGammaCorrection} + + function GdipGetLineBlendCount(brush: GPLINEGRADIENT; + out count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLineBlendCount} + + function GdipGetLineBlend(brush: GPLINEGRADIENT; blend: PSingle; + positions: PSingle; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLineBlend} + + function GdipSetLineBlend(brush: GPLINEGRADIENT; blend: PSingle; + positions: PSingle; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetLineBlend} + + function GdipGetLinePresetBlendCount(brush: GPLINEGRADIENT; + out count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLinePresetBlendCount} + + function GdipGetLinePresetBlend(brush: GPLINEGRADIENT; blend: PARGB; + positions: PSingle; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLinePresetBlend} + + function GdipSetLinePresetBlend(brush: GPLINEGRADIENT; blend: PARGB; + positions: PSingle; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetLinePresetBlend} + + function GdipSetLineSigmaBlend(brush: GPLINEGRADIENT; focus: Single; + scale: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetLineSigmaBlend} + + function GdipSetLineLinearBlend(brush: GPLINEGRADIENT; focus: Single; + scale: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetLineLinearBlend} + + function GdipSetLineWrapMode(brush: GPLINEGRADIENT; + wrapmode: GPWRAPMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetLineWrapMode} + + function GdipGetLineWrapMode(brush: GPLINEGRADIENT; + out wrapmode: GPWRAPMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLineWrapMode} + + function GdipGetLineTransform(brush: GPLINEGRADIENT; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLineTransform} + + function GdipSetLineTransform(brush: GPLINEGRADIENT; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetLineTransform} + + function GdipResetLineTransform(brush: GPLINEGRADIENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipResetLineTransform} + + function GdipMultiplyLineTransform(brush: GPLINEGRADIENT; matrix: GPMATRIX; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipMultiplyLineTransform} + + function GdipTranslateLineTransform(brush: GPLINEGRADIENT; dx: Single; + dy: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTranslateLineTransform} + + function GdipScaleLineTransform(brush: GPLINEGRADIENT; sx: Single; sy: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipScaleLineTransform} + + function GdipRotateLineTransform(brush: GPLINEGRADIENT; angle: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRotateLineTransform} + +//---------------------------------------------------------------------------- +// PathGradientBrush APIs +//---------------------------------------------------------------------------- + + function GdipCreatePathGradient(points: GPPOINTF; count: Integer; + wrapMode: GPWRAPMODE; out polyGradient: GPPATHGRADIENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreatePathGradient} + + function GdipCreatePathGradientI(points: GPPOINT; count: Integer; + wrapMode: GPWRAPMODE; out polyGradient: GPPATHGRADIENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreatePathGradientI} + + function GdipCreatePathGradientFromPath(path: GPPATH; + out polyGradient: GPPATHGRADIENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreatePathGradientFromPath} + + function GdipGetPathGradientCenterColor(brush: GPPATHGRADIENT; + out colors: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientCenterColor} + + function GdipSetPathGradientCenterColor(brush: GPPATHGRADIENT; + colors: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientCenterColor} + + function GdipGetPathGradientSurroundColorsWithCount(brush: GPPATHGRADIENT; + color: PARGB; var count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientSurroundColorsWithCount} + + function GdipSetPathGradientSurroundColorsWithCount(brush: GPPATHGRADIENT; + color: PARGB; var count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientSurroundColorsWithCount} + + function GdipGetPathGradientPath(brush: GPPATHGRADIENT; + path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientPath} + + function GdipSetPathGradientPath(brush: GPPATHGRADIENT; + path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientPath} + + function GdipGetPathGradientCenterPoint(brush: GPPATHGRADIENT; + points: GPPOINTF): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientCenterPoint} + + function GdipGetPathGradientCenterPointI(brush: GPPATHGRADIENT; + points: GPPOINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientCenterPointI} + + function GdipSetPathGradientCenterPoint(brush: GPPATHGRADIENT; + points: GPPOINTF): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientCenterPoint} + + function GdipSetPathGradientCenterPointI(brush: GPPATHGRADIENT; + points: GPPOINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientCenterPointI} + + function GdipGetPathGradientRect(brush: GPPATHGRADIENT; + rect: GPRECTF): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientRect} + + function GdipGetPathGradientRectI(brush: GPPATHGRADIENT; + rect: GPRECT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientRectI} + + function GdipGetPathGradientPointCount(brush: GPPATHGRADIENT; + var count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientPointCount} + + function GdipGetPathGradientSurroundColorCount(brush: GPPATHGRADIENT; + var count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientSurroundColorCount} + + function GdipSetPathGradientGammaCorrection(brush: GPPATHGRADIENT; + useGammaCorrection: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientGammaCorrection} + + function GdipGetPathGradientGammaCorrection(brush: GPPATHGRADIENT; + var useGammaCorrection: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientGammaCorrection} + + function GdipGetPathGradientBlendCount(brush: GPPATHGRADIENT; + var count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientBlendCount} + + function GdipGetPathGradientBlend(brush: GPPATHGRADIENT; + blend: PSingle; positions: PSingle; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientBlend} + + function GdipSetPathGradientBlend(brush: GPPATHGRADIENT; + blend: PSingle; positions: PSingle; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientBlend} + + function GdipGetPathGradientPresetBlendCount(brush: GPPATHGRADIENT; + var count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientPresetBlendCount} + + function GdipGetPathGradientPresetBlend(brush: GPPATHGRADIENT; + blend: PARGB; positions: PSingle; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientPresetBlend} + + function GdipSetPathGradientPresetBlend(brush: GPPATHGRADIENT; + blend: PARGB; positions: PSingle; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientPresetBlend} + + function GdipSetPathGradientSigmaBlend(brush: GPPATHGRADIENT; + focus: Single; scale: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientSigmaBlend} + + function GdipSetPathGradientLinearBlend(brush: GPPATHGRADIENT; + focus: Single; scale: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientLinearBlend} + + function GdipGetPathGradientWrapMode(brush: GPPATHGRADIENT; + var wrapmode: GPWRAPMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientWrapMode} + + function GdipSetPathGradientWrapMode(brush: GPPATHGRADIENT; + wrapmode: GPWRAPMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientWrapMode} + + function GdipGetPathGradientTransform(brush: GPPATHGRADIENT; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientTransform} + + function GdipSetPathGradientTransform(brush: GPPATHGRADIENT; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientTransform} + + function GdipResetPathGradientTransform( + brush: GPPATHGRADIENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipResetPathGradientTransform} + + function GdipMultiplyPathGradientTransform(brush: GPPATHGRADIENT; + matrix: GPMATRIX; order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipMultiplyPathGradientTransform} + + function GdipTranslatePathGradientTransform(brush: GPPATHGRADIENT; + dx: Single; dy: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTranslatePathGradientTransform} + + function GdipScalePathGradientTransform(brush: GPPATHGRADIENT; + sx: Single; sy: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipScalePathGradientTransform} + + function GdipRotatePathGradientTransform(brush: GPPATHGRADIENT; + angle: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRotatePathGradientTransform} + + function GdipGetPathGradientFocusScales(brush: GPPATHGRADIENT; + var xScale: Single; var yScale: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPathGradientFocusScales} + + function GdipSetPathGradientFocusScales(brush: GPPATHGRADIENT; + xScale: Single; yScale: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPathGradientFocusScales} + +//---------------------------------------------------------------------------- +// Pen APIs +//---------------------------------------------------------------------------- + + function GdipCreatePen1(color: ARGB; width: Single; unit_: GPUNIT; + out pen: GPPEN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreatePen1} + + function GdipCreatePen2(brush: GPBRUSH; width: Single; unit_: GPUNIT; + out pen: GPPEN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreatePen2} + + function GdipClonePen(pen: GPPEN; out clonepen: GPPEN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipClonePen} + + function GdipDeletePen(pen: GPPEN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeletePen} + + function GdipSetPenWidth(pen: GPPEN; width: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenWidth} + + function GdipGetPenWidth(pen: GPPEN; out width: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenWidth} + + function GdipSetPenUnit(pen: GPPEN; unit_: GPUNIT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenUnit} + + function GdipGetPenUnit(pen: GPPEN; var unit_: GPUNIT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenUnit} + + function GdipSetPenLineCap197819(pen: GPPEN; startCap: GPLINECAP; + endCap: GPLINECAP; dashCap: GPDASHCAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenLineCap197819} + + function GdipSetPenStartCap(pen: GPPEN; + startCap: GPLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenStartCap} + + function GdipSetPenEndCap(pen: GPPEN; endCap: GPLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenEndCap} + + function GdipSetPenDashCap197819(pen: GPPEN; + dashCap: GPDASHCAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenDashCap197819} + + function GdipGetPenStartCap(pen: GPPEN; + out startCap: GPLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenStartCap} + + function GdipGetPenEndCap(pen: GPPEN; + out endCap: GPLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenEndCap} + + function GdipGetPenDashCap197819(pen: GPPEN; + out dashCap: GPDASHCAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenDashCap197819} + + function GdipSetPenLineJoin(pen: GPPEN; + lineJoin: GPLINEJOIN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenLineJoin} + + function GdipGetPenLineJoin(pen: GPPEN; + var lineJoin: GPLINEJOIN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenLineJoin} + + function GdipSetPenCustomStartCap(pen: GPPEN; + customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenCustomStartCap} + + function GdipGetPenCustomStartCap(pen: GPPEN; + out customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenCustomStartCap} + + function GdipSetPenCustomEndCap(pen: GPPEN; + customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenCustomEndCap} + + function GdipGetPenCustomEndCap(pen: GPPEN; + out customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenCustomEndCap} + + function GdipSetPenMiterLimit(pen: GPPEN; + miterLimit: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenMiterLimit} + + function GdipGetPenMiterLimit(pen: GPPEN; + out miterLimit: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenMiterLimit} + + function GdipSetPenMode(pen: GPPEN; + penMode: GPPENALIGNMENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenMode} + + function GdipGetPenMode(pen: GPPEN; + var penMode: GPPENALIGNMENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenMode} + + function GdipSetPenTransform(pen: GPPEN; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenTransform} + + function GdipGetPenTransform(pen: GPPEN; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenTransform} + + function GdipResetPenTransform(pen: GPPEN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipResetPenTransform} + + function GdipMultiplyPenTransform(pen: GPPEN; matrix: GPMATRIX; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipMultiplyPenTransform} + + function GdipTranslatePenTransform(pen: GPPEN; dx: Single; dy: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTranslatePenTransform} + + function GdipScalePenTransform(pen: GPPEN; sx: Single; sy: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipScalePenTransform} + + function GdipRotatePenTransform(pen: GPPEN; angle: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRotatePenTransform} + + function GdipSetPenColor(pen: GPPEN; argb: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenColor} + + function GdipGetPenColor(pen: GPPEN; out argb: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenColor} + + function GdipSetPenBrushFill(pen: GPPEN; brush: GPBRUSH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenBrushFill} + + function GdipGetPenBrushFill(pen: GPPEN; + out brush: GPBRUSH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenBrushFill} + + function GdipGetPenFillType(pen: GPPEN; + out type_: GPPENTYPE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenFillType} + + function GdipGetPenDashStyle(pen: GPPEN; + out dashstyle: GPDASHSTYLE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenDashStyle} + + function GdipSetPenDashStyle(pen: GPPEN; + dashstyle: GPDASHSTYLE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenDashStyle} + + function GdipGetPenDashOffset(pen: GPPEN; + out offset: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenDashOffset} + + function GdipSetPenDashOffset(pen: GPPEN; offset: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenDashOffset} + + function GdipGetPenDashCount(pen: GPPEN; + var count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenDashCount} + + function GdipSetPenDashArray(pen: GPPEN; dash: PSingle; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenDashArray} + + function GdipGetPenDashArray(pen: GPPEN; dash: PSingle; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenDashArray} + + function GdipGetPenCompoundCount(pen: GPPEN; + out count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenCompoundCount} + + function GdipSetPenCompoundArray(pen: GPPEN; dash: PSingle; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPenCompoundArray} + + function GdipGetPenCompoundArray(pen: GPPEN; dash: PSingle; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPenCompoundArray} + +//---------------------------------------------------------------------------- +// CustomLineCap APIs +//---------------------------------------------------------------------------- + + function GdipCreateCustomLineCap(fillPath: GPPATH; strokePath: GPPATH; + baseCap: GPLINECAP; baseInset: Single; + out customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateCustomLineCap} + + function GdipDeleteCustomLineCap( + customCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeleteCustomLineCap} + + function GdipCloneCustomLineCap(customCap: GPCUSTOMLINECAP; + out clonedCap: GPCUSTOMLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCloneCustomLineCap} + + function GdipGetCustomLineCapType(customCap: GPCUSTOMLINECAP; + var capType: CUSTOMLINECAPTYPE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetCustomLineCapType} + + function GdipSetCustomLineCapStrokeCaps(customCap: GPCUSTOMLINECAP; + startCap: GPLINECAP; endCap: GPLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetCustomLineCapStrokeCaps} + + function GdipGetCustomLineCapStrokeCaps(customCap: GPCUSTOMLINECAP; + var startCap: GPLINECAP; var endCap: GPLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetCustomLineCapStrokeCaps} + + function GdipSetCustomLineCapStrokeJoin(customCap: GPCUSTOMLINECAP; + lineJoin: GPLINEJOIN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetCustomLineCapStrokeJoin} + + function GdipGetCustomLineCapStrokeJoin(customCap: GPCUSTOMLINECAP; + var lineJoin: GPLINEJOIN): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetCustomLineCapStrokeJoin} + + function GdipSetCustomLineCapBaseCap(customCap: GPCUSTOMLINECAP; + baseCap: GPLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetCustomLineCapBaseCap} + + function GdipGetCustomLineCapBaseCap(customCap: GPCUSTOMLINECAP; + var baseCap: GPLINECAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetCustomLineCapBaseCap} + + function GdipSetCustomLineCapBaseInset(customCap: GPCUSTOMLINECAP; + inset: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetCustomLineCapBaseInset} + + function GdipGetCustomLineCapBaseInset(customCap: GPCUSTOMLINECAP; + var inset: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetCustomLineCapBaseInset} + + function GdipSetCustomLineCapWidthScale(customCap: GPCUSTOMLINECAP; + widthScale: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetCustomLineCapWidthScale} + + function GdipGetCustomLineCapWidthScale(customCap: GPCUSTOMLINECAP; + var widthScale: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetCustomLineCapWidthScale} + +//---------------------------------------------------------------------------- +// AdjustableArrowCap APIs +//---------------------------------------------------------------------------- + + function GdipCreateAdjustableArrowCap(height: Single; + width: Single; + isFilled: Bool; + out cap: GPADJUSTABLEARROWCAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateAdjustableArrowCap} + + function GdipSetAdjustableArrowCapHeight(cap: GPADJUSTABLEARROWCAP; + height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetAdjustableArrowCapHeight} + + function GdipGetAdjustableArrowCapHeight(cap: GPADJUSTABLEARROWCAP; + var height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetAdjustableArrowCapHeight} + + function GdipSetAdjustableArrowCapWidth(cap: GPADJUSTABLEARROWCAP; + width: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetAdjustableArrowCapWidth} + + function GdipGetAdjustableArrowCapWidth(cap: GPADJUSTABLEARROWCAP; + var width: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetAdjustableArrowCapWidth} + + function GdipSetAdjustableArrowCapMiddleInset(cap: GPADJUSTABLEARROWCAP; + middleInset: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetAdjustableArrowCapMiddleInset} + + function GdipGetAdjustableArrowCapMiddleInset(cap: GPADJUSTABLEARROWCAP; + var middleInset: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetAdjustableArrowCapMiddleInset} + + function GdipSetAdjustableArrowCapFillState(cap: GPADJUSTABLEARROWCAP; + fillState: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetAdjustableArrowCapFillState} + + function GdipGetAdjustableArrowCapFillState(cap: GPADJUSTABLEARROWCAP; + var fillState: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetAdjustableArrowCapFillState} + +//---------------------------------------------------------------------------- +// Image APIs +//---------------------------------------------------------------------------- + + function GdipLoadImageFromStream(stream: ISTREAM; + out image: GPIMAGE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipLoadImageFromStream} + + function GdipLoadImageFromFile(filename: PWCHAR; + out image: GPIMAGE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipLoadImageFromFile} + + function GdipLoadImageFromStreamICM(stream: ISTREAM; + out image: GPIMAGE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipLoadImageFromStreamICM} + + function GdipLoadImageFromFileICM(filename: PWCHAR; + out image: GPIMAGE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipLoadImageFromFileICM} + + function GdipCloneImage(image: GPIMAGE; + out cloneImage: GPIMAGE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCloneImage} + + function GdipDisposeImage(image: GPIMAGE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDisposeImage} + + function GdipSaveImageToFile(image: GPIMAGE; + filename: PWCHAR; + clsidEncoder: PGUID; + encoderParams: PENCODERPARAMETERS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSaveImageToFile} + + function GdipSaveImageToStream(image: GPIMAGE; + stream: ISTREAM; + clsidEncoder: PGUID; + encoderParams: PENCODERPARAMETERS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSaveImageToStream} + + function GdipSaveAdd(image: GPIMAGE; + encoderParams: PENCODERPARAMETERS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSaveAdd} + + function GdipSaveAddImage(image: GPIMAGE; + newImage: GPIMAGE; + encoderParams: PENCODERPARAMETERS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSaveAddImage} + + function GdipGetImageGraphicsContext(image: GPIMAGE; + out graphics: GPGRAPHICS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageGraphicsContext} + + function GdipGetImageBounds(image: GPIMAGE; + srcRect: GPRECTF; + var srcUnit: GPUNIT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageBounds} + + function GdipGetImageDimension(image: GPIMAGE; + var width: Single; + var height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageDimension} + + function GdipGetImageType(image: GPIMAGE; + var type_: IMAGETYPE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageType} + + function GdipGetImageWidth(image: GPIMAGE; + var width: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageWidth} + + function GdipGetImageHeight(image: GPIMAGE; + var height: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageHeight} + + function GdipGetImageHorizontalResolution(image: GPIMAGE; + var resolution: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageHorizontalResolution} + + function GdipGetImageVerticalResolution(image: GPIMAGE; + var resolution: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageVerticalResolution} + + function GdipGetImageFlags(image: GPIMAGE; + var flags: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageFlags} + + function GdipGetImageRawFormat(image: GPIMAGE; + format: PGUID): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageRawFormat} + + function GdipGetImagePixelFormat(image: GPIMAGE; + out format: TPIXELFORMAT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImagePixelFormat} + + function GdipGetImageThumbnail(image: GPIMAGE; thumbWidth: UINT; + thumbHeight: UINT; out thumbImage: GPIMAGE; + callback: GETTHUMBNAILIMAGEABORT; callbackData: Pointer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageThumbnail} + + function GdipGetEncoderParameterListSize(image: GPIMAGE; + clsidEncoder: PGUID; out size: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetEncoderParameterListSize} + + function GdipGetEncoderParameterList(image: GPIMAGE; clsidEncoder: PGUID; + size: UINT; buffer: PENCODERPARAMETERS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetEncoderParameterList} + + function GdipImageGetFrameDimensionsCount(image: GPIMAGE; + var count: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipImageGetFrameDimensionsCount} + + function GdipImageGetFrameDimensionsList(image: GPIMAGE; dimensionIDs: PGUID; + count: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipImageGetFrameDimensionsList} + + function GdipImageGetFrameCount(image: GPIMAGE; dimensionID: PGUID; + var count: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipImageGetFrameCount} + + function GdipImageSelectActiveFrame(image: GPIMAGE; dimensionID: PGUID; + frameIndex: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipImageSelectActiveFrame} + + function GdipImageRotateFlip(image: GPIMAGE; + rfType: ROTATEFLIPTYPE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipImageRotateFlip} + + function GdipGetImagePalette(image: GPIMAGE; palette: PCOLORPALETTE; + size: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImagePalette} + + function GdipSetImagePalette(image: GPIMAGE; + palette: PCOLORPALETTE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImagePalette} + + function GdipGetImagePaletteSize(image: GPIMAGE; + var size: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImagePaletteSize} + + function GdipGetPropertyCount(image: GPIMAGE; + var numOfProperty: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPropertyCount} + + function GdipGetPropertyIdList(image: GPIMAGE; numOfProperty: UINT; + list: PPROPID): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPropertyIdList} + + function GdipGetPropertyItemSize(image: GPIMAGE; propId: PROPID; + var size: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPropertyItemSize} + + function GdipGetPropertyItem(image: GPIMAGE; propId: PROPID; propSize: UINT; + buffer: PPROPERTYITEM): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPropertyItem} + + function GdipGetPropertySize(image: GPIMAGE; var totalBufferSize: UINT; + var numProperties: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPropertySize} + + function GdipGetAllPropertyItems(image: GPIMAGE; totalBufferSize: UINT; + numProperties: UINT; allItems: PPROPERTYITEM): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetAllPropertyItems} + + function GdipRemovePropertyItem(image: GPIMAGE; + propId: PROPID): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRemovePropertyItem} + + function GdipSetPropertyItem(image: GPIMAGE; + item: PPROPERTYITEM): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPropertyItem} + + function GdipImageForceValidation(image: GPIMAGE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipImageForceValidation} + +//---------------------------------------------------------------------------- +// Bitmap APIs +//---------------------------------------------------------------------------- + + function GdipCreateBitmapFromStream(stream: ISTREAM; + out bitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateBitmapFromStream} + + function GdipCreateBitmapFromFile(filename: PWCHAR; + out bitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateBitmapFromFile} + + function GdipCreateBitmapFromStreamICM(stream: ISTREAM; + out bitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateBitmapFromStreamICM} + + function GdipCreateBitmapFromFileICM(filename: PWCHAR; + var bitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateBitmapFromFileICM} + + function GdipCreateBitmapFromScan0(width: Integer; height: Integer; + stride: Integer; format: PIXELFORMAT; scan0: PBYTE; + out bitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateBitmapFromScan0} + + function GdipCreateBitmapFromGraphics(width: Integer; height: Integer; + target: GPGRAPHICS; out bitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateBitmapFromGraphics} + + function GdipCreateBitmapFromGdiDib(gdiBitmapInfo: PBitmapInfo; + gdiBitmapData: Pointer; out bitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateBitmapFromGdiDib} + + function GdipCreateBitmapFromHBITMAP(hbm: HBITMAP; hpal: HPALETTE; + out bitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateBitmapFromHBITMAP} + + function GdipCreateHBITMAPFromBitmap(bitmap: GPBITMAP; out hbmReturn: HBITMAP; + background: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateHBITMAPFromBitmap} + + function GdipCreateBitmapFromHICON(hicon: HICON; + out bitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateBitmapFromHICON} + + function GdipCreateHICONFromBitmap(bitmap: GPBITMAP; + out hbmReturn: HICON): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateHICONFromBitmap} + + function GdipCreateBitmapFromResource(hInstance: HMODULE; + lpBitmapName: PWCHAR; out bitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateBitmapFromResource} + + function GdipCloneBitmapArea(x: Single; y: Single; width: Single; + height: Single; format: PIXELFORMAT; srcBitmap: GPBITMAP; + out dstBitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCloneBitmapArea} + + function GdipCloneBitmapAreaI(x: Integer; y: Integer; width: Integer; + height: Integer; format: PIXELFORMAT; srcBitmap: GPBITMAP; + out dstBitmap: GPBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCloneBitmapAreaI} + + function GdipBitmapLockBits(bitmap: GPBITMAP; rect: GPRECT; flags: UINT; + format: PIXELFORMAT; lockedBitmapData: PBITMAPDATA): GPSTATUS; stdcall; + {$EXTERNALSYM GdipBitmapLockBits} + + function GdipBitmapUnlockBits(bitmap: GPBITMAP; + lockedBitmapData: PBITMAPDATA): GPSTATUS; stdcall; + {$EXTERNALSYM GdipBitmapUnlockBits} + + function GdipBitmapGetPixel(bitmap: GPBITMAP; x: Integer; y: Integer; + var color: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipBitmapGetPixel} + + function GdipBitmapSetPixel(bitmap: GPBITMAP; x: Integer; y: Integer; + color: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipBitmapSetPixel} + + function GdipBitmapSetResolution(bitmap: GPBITMAP; xdpi: Single; + ydpi: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipBitmapSetResolution} + +//---------------------------------------------------------------------------- +// ImageAttributes APIs +//---------------------------------------------------------------------------- + + function GdipCreateImageAttributes( + out imageattr: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateImageAttributes} + + function GdipCloneImageAttributes(imageattr: GPIMAGEATTRIBUTES; + out cloneImageattr: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCloneImageAttributes} + + function GdipDisposeImageAttributes( + imageattr: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDisposeImageAttributes} + + function GdipSetImageAttributesToIdentity(imageattr: GPIMAGEATTRIBUTES; + type_: COLORADJUSTTYPE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImageAttributesToIdentity} + + function GdipResetImageAttributes(imageattr: GPIMAGEATTRIBUTES; + type_: COLORADJUSTTYPE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipResetImageAttributes} + + function GdipSetImageAttributesColorMatrix(imageattr: GPIMAGEATTRIBUTES; + type_: COLORADJUSTTYPE; enableFlag: Bool; colorMatrix: PCOLORMATRIX; + grayMatrix: PCOLORMATRIX; flags: COLORMATRIXFLAGS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImageAttributesColorMatrix} + + function GdipSetImageAttributesThreshold(imageattr: GPIMAGEATTRIBUTES; + type_: COLORADJUSTTYPE; enableFlag: Bool; + threshold: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImageAttributesThreshold} + + function GdipSetImageAttributesGamma(imageattr: GPIMAGEATTRIBUTES; + type_: COLORADJUSTTYPE; enableFlag: Bool; gamma: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImageAttributesGamma} + + function GdipSetImageAttributesNoOp(imageattr: GPIMAGEATTRIBUTES; + type_: COLORADJUSTTYPE; enableFlag: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImageAttributesNoOp} + + function GdipSetImageAttributesColorKeys(imageattr: GPIMAGEATTRIBUTES; + type_: COLORADJUSTTYPE; enableFlag: Bool; colorLow: ARGB; + colorHigh: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImageAttributesColorKeys} + + function GdipSetImageAttributesOutputChannel(imageattr: GPIMAGEATTRIBUTES; + type_: COLORADJUSTTYPE; enableFlag: Bool; + channelFlags: COLORCHANNELFLAGS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImageAttributesOutputChannel} + + function GdipSetImageAttributesOutputChannelColorProfile(imageattr: GPIMAGEATTRIBUTES; + type_: COLORADJUSTTYPE; enableFlag: Bool; + colorProfileFilename: PWCHAR): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImageAttributesOutputChannelColorProfile} + + function GdipSetImageAttributesRemapTable(imageattr: GPIMAGEATTRIBUTES; + type_: COLORADJUSTTYPE; enableFlag: Bool; mapSize: UINT; + map: PCOLORMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImageAttributesRemapTable} + + function GdipSetImageAttributesWrapMode(imageAttr: GPIMAGEATTRIBUTES; + wrap: WRAPMODE; argb: ARGB; clamp: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImageAttributesWrapMode} + + function GdipSetImageAttributesICMMode(imageAttr: GPIMAGEATTRIBUTES; + on_: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetImageAttributesICMMode} + + function GdipGetImageAttributesAdjustedPalette(imageAttr: GPIMAGEATTRIBUTES; + colorPalette: PCOLORPALETTE; + colorAdjustType: COLORADJUSTTYPE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageAttributesAdjustedPalette} + +//---------------------------------------------------------------------------- +// Graphics APIs +//---------------------------------------------------------------------------- + + function GdipFlush(graphics: GPGRAPHICS; + intention: GPFLUSHINTENTION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFlush} + + function GdipCreateFromHDC(hdc: HDC; + out graphics: GPGRAPHICS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateFromHDC} + + function GdipCreateFromHDC2(hdc: HDC; hDevice: THandle; + out graphics: GPGRAPHICS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateFromHDC2} + + function GdipCreateFromHWND(hwnd: HWND; + out graphics: GPGRAPHICS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateFromHWND} + + function GdipCreateFromHWNDICM(hwnd: HWND; + out graphics: GPGRAPHICS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateFromHWNDICM} + + function GdipDeleteGraphics(graphics: GPGRAPHICS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeleteGraphics} + + function GdipGetDC(graphics: GPGRAPHICS; var hdc: HDC): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetDC} + + function GdipReleaseDC(graphics: GPGRAPHICS; hdc: HDC): GPSTATUS; stdcall; + {$EXTERNALSYM GdipReleaseDC} + + function GdipSetCompositingMode(graphics: GPGRAPHICS; + compositingMode: COMPOSITINGMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetCompositingMode} + + function GdipGetCompositingMode(graphics: GPGRAPHICS; + var compositingMode: COMPOSITINGMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetCompositingMode} + + function GdipSetRenderingOrigin(graphics: GPGRAPHICS; x: Integer; + y: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetRenderingOrigin} + + function GdipGetRenderingOrigin(graphics: GPGRAPHICS; var x: Integer; + var y: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetRenderingOrigin} + + function GdipSetCompositingQuality(graphics: GPGRAPHICS; + compositingQuality: COMPOSITINGQUALITY): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetCompositingQuality} + + function GdipGetCompositingQuality(graphics: GPGRAPHICS; + var compositingQuality: COMPOSITINGQUALITY): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetCompositingQuality} + + function GdipSetSmoothingMode(graphics: GPGRAPHICS; + smoothingMode: SMOOTHINGMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetSmoothingMode} + + function GdipGetSmoothingMode(graphics: GPGRAPHICS; + var smoothingMode: SMOOTHINGMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetSmoothingMode} + + function GdipSetPixelOffsetMode(graphics: GPGRAPHICS; + pixelOffsetMode: PIXELOFFSETMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPixelOffsetMode} + + function GdipGetPixelOffsetMode(graphics: GPGRAPHICS; + var pixelOffsetMode: PIXELOFFSETMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPixelOffsetMode} + + function GdipSetTextRenderingHint(graphics: GPGRAPHICS; + mode: TEXTRENDERINGHINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetTextRenderingHint} + + function GdipGetTextRenderingHint(graphics: GPGRAPHICS; + var mode: TEXTRENDERINGHINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetTextRenderingHint} + + function GdipSetTextContrast(graphics: GPGRAPHICS; + contrast: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetTextContrast} + + function GdipGetTextContrast(graphics: GPGRAPHICS; + var contrast: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetTextContrast} + + function GdipSetInterpolationMode(graphics: GPGRAPHICS; + interpolationMode: INTERPOLATIONMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetInterpolationMode} + + function GdipGetInterpolationMode(graphics: GPGRAPHICS; + var interpolationMode: INTERPOLATIONMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetInterpolationMode} + + function GdipSetWorldTransform(graphics: GPGRAPHICS; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetWorldTransform} + + function GdipResetWorldTransform(graphics: GPGRAPHICS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipResetWorldTransform} + + function GdipMultiplyWorldTransform(graphics: GPGRAPHICS; matrix: GPMATRIX; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipMultiplyWorldTransform} + + function GdipTranslateWorldTransform(graphics: GPGRAPHICS; dx: Single; + dy: Single; order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTranslateWorldTransform} + + function GdipScaleWorldTransform(graphics: GPGRAPHICS; sx: Single; sy: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipScaleWorldTransform} + + function GdipRotateWorldTransform(graphics: GPGRAPHICS; angle: Single; + order: GPMATRIXORDER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRotateWorldTransform} + + function GdipGetWorldTransform(graphics: GPGRAPHICS; + matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetWorldTransform} + + function GdipResetPageTransform(graphics: GPGRAPHICS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipResetPageTransform} + + function GdipGetPageUnit(graphics: GPGRAPHICS; + var unit_: GPUNIT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPageUnit} + + function GdipGetPageScale(graphics: GPGRAPHICS; + var scale: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetPageScale} + + function GdipSetPageUnit(graphics: GPGRAPHICS; + unit_: GPUNIT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPageUnit} + + function GdipSetPageScale(graphics: GPGRAPHICS; + scale: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetPageScale} + + function GdipGetDpiX(graphics: GPGRAPHICS; + var dpi: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetDpiX} + + function GdipGetDpiY(graphics: GPGRAPHICS; + var dpi: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetDpiY} + + function GdipTransformPoints(graphics: GPGRAPHICS; + destSpace: GPCOORDINATESPACE; srcSpace: GPCOORDINATESPACE; + points: GPPOINTF; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTransformPoints} + + function GdipTransformPointsI(graphics: GPGRAPHICS; + destSpace: GPCOORDINATESPACE; srcSpace: GPCOORDINATESPACE; + points: GPPOINT; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTransformPointsI} + + function GdipGetNearestColor(graphics: GPGRAPHICS; + argb: PARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetNearestColor} + +// Creates the Win9x Halftone Palette (even on NT) with correct Desktop colors + + function GdipCreateHalftonePalette: HPALETTE; stdcall; + {$EXTERNALSYM GdipCreateHalftonePalette} + + function GdipDrawLine(graphics: GPGRAPHICS; pen: GPPEN; x1: Single; + y1: Single; x2: Single; y2: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawLine} + + function GdipDrawLineI(graphics: GPGRAPHICS; pen: GPPEN; x1: Integer; + y1: Integer; x2: Integer; y2: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawLineI} + + function GdipDrawLines(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawLines} + + function GdipDrawLinesI(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawLinesI} + + function GdipDrawArc(graphics: GPGRAPHICS; pen: GPPEN; x: Single; y: Single; + width: Single; height: Single; startAngle: Single; + sweepAngle: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawArc} + + function GdipDrawArcI(graphics: GPGRAPHICS; pen: GPPEN; x: Integer; + y: Integer; width: Integer; height: Integer; startAngle: Single; + sweepAngle: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawArcI} + + function GdipDrawBezier(graphics: GPGRAPHICS; pen: GPPEN; x1: Single; + y1: Single; x2: Single; y2: Single; x3: Single; y3: Single; x4: Single; + y4: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawBezier} + + function GdipDrawBezierI(graphics: GPGRAPHICS; pen: GPPEN; x1: Integer; + y1: Integer; x2: Integer; y2: Integer; x3: Integer; y3: Integer; + x4: Integer; y4: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawBezierI} + + function GdipDrawBeziers(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawBeziers} + + function GdipDrawBeziersI(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawBeziersI} + + function GdipDrawRectangle(graphics: GPGRAPHICS; pen: GPPEN; x: Single; + y: Single; width: Single; height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawRectangle} + + function GdipDrawRectangleI(graphics: GPGRAPHICS; pen: GPPEN; x: Integer; + y: Integer; width: Integer; height: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawRectangleI} + + function GdipDrawRectangles(graphics: GPGRAPHICS; pen: GPPEN; rects: GPRECTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawRectangles} + + function GdipDrawRectanglesI(graphics: GPGRAPHICS; pen: GPPEN; rects: GPRECT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawRectanglesI} + + function GdipDrawEllipse(graphics: GPGRAPHICS; pen: GPPEN; x: Single; + y: Single; width: Single; height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawEllipse} + + function GdipDrawEllipseI(graphics: GPGRAPHICS; pen: GPPEN; x: Integer; + y: Integer; width: Integer; height: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawEllipseI} + + function GdipDrawPie(graphics: GPGRAPHICS; pen: GPPEN; x: Single; y: Single; + width: Single; height: Single; startAngle: Single; + sweepAngle: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawPie} + + function GdipDrawPieI(graphics: GPGRAPHICS; pen: GPPEN; x: Integer; + y: Integer; width: Integer; height: Integer; startAngle: Single; + sweepAngle: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawPieI} + + function GdipDrawPolygon(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawPolygon} + + function GdipDrawPolygonI(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawPolygonI} + + function GdipDrawPath(graphics: GPGRAPHICS; pen: GPPEN; + path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawPath} + + function GdipDrawCurve(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawCurve} + + function GdipDrawCurveI(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT; + count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawCurveI} + + function GdipDrawCurve2(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF; + count: Integer; tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawCurve2} + + function GdipDrawCurve2I(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT; + count: Integer; tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawCurve2I} + + function GdipDrawCurve3(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINTF; + count: Integer; offset: Integer; numberOfSegments: Integer; + tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawCurve3} + + function GdipDrawCurve3I(graphics: GPGRAPHICS; pen: GPPEN; points: GPPOINT; + count: Integer; offset: Integer; numberOfSegments: Integer; + tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawCurve3I} + + function GdipDrawClosedCurve(graphics: GPGRAPHICS; pen: GPPEN; + points: GPPOINTF; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawClosedCurve} + + function GdipDrawClosedCurveI(graphics: GPGRAPHICS; pen: GPPEN; + points: GPPOINT; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawClosedCurveI} + + function GdipDrawClosedCurve2(graphics: GPGRAPHICS; pen: GPPEN; + points: GPPOINTF; count: Integer; tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawClosedCurve2} + + function GdipDrawClosedCurve2I(graphics: GPGRAPHICS; pen: GPPEN; + points: GPPOINT; count: Integer; tension: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawClosedCurve2I} + + function GdipGraphicsClear(graphics: GPGRAPHICS; + color: ARGB): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGraphicsClear} + + function GdipFillRectangle(graphics: GPGRAPHICS; brush: GPBRUSH; x: Single; + y: Single; width: Single; height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillRectangle} + + function GdipFillRectangleI(graphics: GPGRAPHICS; brush: GPBRUSH; x: Integer; + y: Integer; width: Integer; height: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillRectangleI} + + function GdipFillRectangles(graphics: GPGRAPHICS; brush: GPBRUSH; + rects: GPRECTF; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillRectangles} + + function GdipFillRectanglesI(graphics: GPGRAPHICS; brush: GPBRUSH; + rects: GPRECT; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillRectanglesI} + + function GdipFillPolygon(graphics: GPGRAPHICS; brush: GPBRUSH; + points: GPPOINTF; count: Integer; fillMode: GPFILLMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillPolygon} + + function GdipFillPolygonI(graphics: GPGRAPHICS; brush: GPBRUSH; + points: GPPOINT; count: Integer; fillMode: GPFILLMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillPolygonI} + + function GdipFillPolygon2(graphics: GPGRAPHICS; brush: GPBRUSH; + points: GPPOINTF; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillPolygon2} + + function GdipFillPolygon2I(graphics: GPGRAPHICS; brush: GPBRUSH; + points: GPPOINT; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillPolygon2I} + + function GdipFillEllipse(graphics: GPGRAPHICS; brush: GPBRUSH; x: Single; + y: Single; width: Single; height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillEllipse} + + function GdipFillEllipseI(graphics: GPGRAPHICS; brush: GPBRUSH; x: Integer; + y: Integer; width: Integer; height: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillEllipseI} + + function GdipFillPie(graphics: GPGRAPHICS; brush: GPBRUSH; x: Single; + y: Single; width: Single; height: Single; startAngle: Single; + sweepAngle: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillPie} + + function GdipFillPieI(graphics: GPGRAPHICS; brush: GPBRUSH; x: Integer; + y: Integer; width: Integer; height: Integer; startAngle: Single; + sweepAngle: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillPieI} + + function GdipFillPath(graphics: GPGRAPHICS; brush: GPBRUSH; + path: GPPATH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillPath} + + function GdipFillClosedCurve(graphics: GPGRAPHICS; brush: GPBRUSH; + points: GPPOINTF; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillClosedCurve} + + function GdipFillClosedCurveI(graphics: GPGRAPHICS; brush: GPBRUSH; + points: GPPOINT; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillClosedCurveI} + + function GdipFillClosedCurve2(graphics: GPGRAPHICS; brush: GPBRUSH; + points: GPPOINTF; count: Integer; tension: Single; + fillMode: GPFILLMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillClosedCurve2} + + function GdipFillClosedCurve2I(graphics: GPGRAPHICS; brush: GPBRUSH; + points: GPPOINT; count: Integer; tension: Single; + fillMode: GPFILLMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillClosedCurve2I} + + function GdipFillRegion(graphics: GPGRAPHICS; brush: GPBRUSH; + region: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFillRegion} + + function GdipDrawImage(graphics: GPGRAPHICS; image: GPIMAGE; x: Single; + y: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImage} + + function GdipDrawImageI(graphics: GPGRAPHICS; image: GPIMAGE; x: Integer; + y: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImageI} + + function GdipDrawImageRect(graphics: GPGRAPHICS; image: GPIMAGE; x: Single; + y: Single; width: Single; height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImageRect} + + function GdipDrawImageRectI(graphics: GPGRAPHICS; image: GPIMAGE; x: Integer; + y: Integer; width: Integer; height: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImageRectI} + + function GdipDrawImagePoints(graphics: GPGRAPHICS; image: GPIMAGE; + dstpoints: GPPOINTF; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImagePoints} + + function GdipDrawImagePointsI(graphics: GPGRAPHICS; image: GPIMAGE; + dstpoints: GPPOINT; count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImagePointsI} + + function GdipDrawImagePointRect(graphics: GPGRAPHICS; image: GPIMAGE; + x: Single; y: Single; srcx: Single; srcy: Single; srcwidth: Single; + srcheight: Single; srcUnit: GPUNIT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImagePointRect} + + function GdipDrawImagePointRectI(graphics: GPGRAPHICS; image: GPIMAGE; + x: Integer; y: Integer; srcx: Integer; srcy: Integer; srcwidth: Integer; + srcheight: Integer; srcUnit: GPUNIT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImagePointRectI} + + function GdipDrawImageRectRect(graphics: GPGRAPHICS; image: GPIMAGE; + dstx: Single; dsty: Single; dstwidth: Single; dstheight: Single; + srcx: Single; srcy: Single; srcwidth: Single; srcheight: Single; + srcUnit: GPUNIT; imageAttributes: GPIMAGEATTRIBUTES; + callback: DRAWIMAGEABORT; callbackData: Pointer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImageRectRect} + + function GdipDrawImageRectRectI(graphics: GPGRAPHICS; image: GPIMAGE; + dstx: Integer; dsty: Integer; dstwidth: Integer; dstheight: Integer; + srcx: Integer; srcy: Integer; srcwidth: Integer; srcheight: Integer; + srcUnit: GPUNIT; imageAttributes: GPIMAGEATTRIBUTES; + callback: DRAWIMAGEABORT; callbackData: Pointer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImageRectRectI} + + function GdipDrawImagePointsRect(graphics: GPGRAPHICS; image: GPIMAGE; + points: GPPOINTF; count: Integer; srcx: Single; srcy: Single; + srcwidth: Single; srcheight: Single; srcUnit: GPUNIT; + imageAttributes: GPIMAGEATTRIBUTES; callback: DRAWIMAGEABORT; + callbackData: Pointer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImagePointsRect} + + function GdipDrawImagePointsRectI(graphics: GPGRAPHICS; image: GPIMAGE; + points: GPPOINT; count: Integer; srcx: Integer; srcy: Integer; + srcwidth: Integer; srcheight: Integer; srcUnit: GPUNIT; + imageAttributes: GPIMAGEATTRIBUTES; callback: DRAWIMAGEABORT; + callbackData: Pointer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawImagePointsRectI} + + function GdipEnumerateMetafileDestPoint(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destPoint: PGPPointF; callback: ENUMERATEMETAFILEPROC; + callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileDestPoint} + + function GdipEnumerateMetafileDestPointI(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destPoint: PGPPoint; callback: ENUMERATEMETAFILEPROC; + callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileDestPointI} + + function GdipEnumerateMetafileDestRect(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destRect: PGPRectF; callback: ENUMERATEMETAFILEPROC; + callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileDestRect} + + function GdipEnumerateMetafileDestRectI(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destRect: PGPRect; callback: ENUMERATEMETAFILEPROC; + callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileDestRectI} + + function GdipEnumerateMetafileDestPoints(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destPoints: PGPPointF; count: Integer; + callback: ENUMERATEMETAFILEPROC; callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileDestPoints} + + function GdipEnumerateMetafileDestPointsI(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destPoints: PGPPoint; count: Integer; + callback: ENUMERATEMETAFILEPROC; callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileDestPointsI} + + function GdipEnumerateMetafileSrcRectDestPoint(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destPoint: PGPPointF; srcRect: PGPRectF; srcUnit: TUNIT; + callback: ENUMERATEMETAFILEPROC; callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileSrcRectDestPoint} + + function GdipEnumerateMetafileSrcRectDestPointI(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destPoint: PGPPoint; srcRect: PGPRect; srcUnit: TUNIT; + callback: ENUMERATEMETAFILEPROC; callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileSrcRectDestPointI} + + function GdipEnumerateMetafileSrcRectDestRect(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destRect: PGPRectF; srcRect: PGPRectF; srcUnit: TUNIT; + callback: ENUMERATEMETAFILEPROC; callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileSrcRectDestRect} + + function GdipEnumerateMetafileSrcRectDestRectI(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destRect: PGPRect; srcRect: PGPRect; srcUnit: TUNIT; + callback: ENUMERATEMETAFILEPROC; callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileSrcRectDestRectI} + + function GdipEnumerateMetafileSrcRectDestPoints(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destPoints: PGPPointF; count: Integer; srcRect: PGPRectF; + srcUnit: TUNIT; callback: ENUMERATEMETAFILEPROC; callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileSrcRectDestPoints} + + function GdipEnumerateMetafileSrcRectDestPointsI(graphics: GPGRAPHICS; + metafile: GPMETAFILE; destPoints: PGPPoint; count: Integer; srcRect: PGPRect; + srcUnit: TUNIT; callback: ENUMERATEMETAFILEPROC; callbackData: Pointer; + imageAttributes: GPIMAGEATTRIBUTES): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEnumerateMetafileSrcRectDestPointsI} + + function GdipPlayMetafileRecord(metafile: GPMETAFILE; + recordType: EMFPLUSRECORDTYPE; flags: UINT; dataSize: UINT; + data: PBYTE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPlayMetafileRecord} + + function GdipSetClipGraphics(graphics: GPGRAPHICS; srcgraphics: GPGRAPHICS; + combineMode: COMBINEMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetClipGraphics} + + function GdipSetClipRect(graphics: GPGRAPHICS; x: Single; y: Single; + width: Single; height: Single; combineMode: COMBINEMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetClipRect} + + function GdipSetClipRectI(graphics: GPGRAPHICS; x: Integer; y: Integer; + width: Integer; height: Integer; + combineMode: COMBINEMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetClipRectI} + + function GdipSetClipPath(graphics: GPGRAPHICS; path: GPPATH; + combineMode: COMBINEMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetClipPath} + + function GdipSetClipRegion(graphics: GPGRAPHICS; region: GPREGION; + combineMode: COMBINEMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetClipRegion} + + function GdipSetClipHrgn(graphics: GPGRAPHICS; hRgn: HRGN; + combineMode: COMBINEMODE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetClipHrgn} + + function GdipResetClip(graphics: GPGRAPHICS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipResetClip} + + function GdipTranslateClip(graphics: GPGRAPHICS; dx: Single; + dy: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTranslateClip} + + function GdipTranslateClipI(graphics: GPGRAPHICS; dx: Integer; + dy: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipTranslateClipI} + + function GdipGetClip(graphics: GPGRAPHICS; + region: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetClip} + + function GdipGetClipBounds(graphics: GPGRAPHICS; + rect: GPRECTF): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetClipBounds} + + function GdipGetClipBoundsI(graphics: GPGRAPHICS; + rect: GPRECT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetClipBoundsI} + + function GdipIsClipEmpty(graphics: GPGRAPHICS; + result: PBool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsClipEmpty} + + function GdipGetVisibleClipBounds(graphics: GPGRAPHICS; + rect: GPRECTF): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetVisibleClipBounds} + + function GdipGetVisibleClipBoundsI(graphics: GPGRAPHICS; + rect: GPRECT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetVisibleClipBoundsI} + + function GdipIsVisibleClipEmpty(graphics: GPGRAPHICS; + var result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsVisibleClipEmpty} + + function GdipIsVisiblePoint(graphics: GPGRAPHICS; x: Single; y: Single; + var result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsVisiblePoint} + + function GdipIsVisiblePointI(graphics: GPGRAPHICS; x: Integer; y: Integer; + var result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsVisiblePointI} + + function GdipIsVisibleRect(graphics: GPGRAPHICS; x: Single; y: Single; + width: Single; height: Single; var result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsVisibleRect} + + function GdipIsVisibleRectI(graphics: GPGRAPHICS; x: Integer; y: Integer; + width: Integer; height: Integer; var result: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsVisibleRectI} + + function GdipSaveGraphics(graphics: GPGRAPHICS; + var state: GRAPHICSSTATE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSaveGraphics} + + function GdipRestoreGraphics(graphics: GPGRAPHICS; + state: GRAPHICSSTATE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRestoreGraphics} + + function GdipBeginContainer(graphics: GPGRAPHICS; dstrect: GPRECTF; + srcrect: GPRECTF; unit_: GPUNIT; + var state: GRAPHICSCONTAINER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipBeginContainer} + + function GdipBeginContainerI(graphics: GPGRAPHICS; dstrect: GPRECT; + srcrect: GPRECT; unit_: GPUNIT; + var state: GRAPHICSCONTAINER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipBeginContainerI} + + function GdipBeginContainer2(graphics: GPGRAPHICS; + var state: GRAPHICSCONTAINER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipBeginContainer2} + + function GdipEndContainer(graphics: GPGRAPHICS; + state: GRAPHICSCONTAINER): GPSTATUS; stdcall; + {$EXTERNALSYM GdipEndContainer} + + function GdipGetMetafileHeaderFromWmf(hWmf: HMETAFILE; + wmfPlaceableFileHeader: PWMFPLACEABLEFILEHEADER; + header: Pointer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetMetafileHeaderFromWmf} + + function GdipGetMetafileHeaderFromEmf(hEmf: HENHMETAFILE; + header: Pointer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetMetafileHeaderFromEmf} + + function GdipGetMetafileHeaderFromFile(filename: PWCHAR; + header: Pointer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetMetafileHeaderFromFile} + + function GdipGetMetafileHeaderFromStream(stream: ISTREAM; + header: Pointer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetMetafileHeaderFromStream} + + function GdipGetMetafileHeaderFromMetafile(metafile: GPMETAFILE; + header: Pointer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetMetafileHeaderFromMetafile} + + function GdipGetHemfFromMetafile(metafile: GPMETAFILE; + var hEmf: HENHMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetHemfFromMetafile} + + function GdipCreateStreamOnFile(filename: PWCHAR; access: UINT; + out stream: ISTREAM): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateStreamOnFile} + + function GdipCreateMetafileFromWmf(hWmf: HMETAFILE; deleteWmf: Bool; + wmfPlaceableFileHeader: PWMFPLACEABLEFILEHEADER; + out metafile: GPMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateMetafileFromWmf} + + function GdipCreateMetafileFromEmf(hEmf: HENHMETAFILE; deleteEmf: Bool; + out metafile: GPMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateMetafileFromEmf} + + function GdipCreateMetafileFromFile(file_: PWCHAR; + out metafile: GPMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateMetafileFromFile} + + function GdipCreateMetafileFromWmfFile(file_: PWCHAR; + wmfPlaceableFileHeader: PWMFPLACEABLEFILEHEADER; + out metafile: GPMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateMetafileFromWmfFile} + + function GdipCreateMetafileFromStream(stream: ISTREAM; + out metafile: GPMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateMetafileFromStream} + + function GdipRecordMetafile(referenceHdc: HDC; type_: EMFTYPE; + frameRect: GPRECTF; frameUnit: METAFILEFRAMEUNIT; + description: PWCHAR; out metafile: GPMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRecordMetafile} + + function GdipRecordMetafileI(referenceHdc: HDC; type_: EMFTYPE; + frameRect: GPRECT; frameUnit: METAFILEFRAMEUNIT; description: PWCHAR; + out metafile: GPMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRecordMetafileI} + + function GdipRecordMetafileFileName(fileName: PWCHAR; referenceHdc: HDC; + type_: EMFTYPE; frameRect: GPRECTF; frameUnit: METAFILEFRAMEUNIT; + description: PWCHAR; out metafile: GPMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRecordMetafileFileName} + + function GdipRecordMetafileFileNameI(fileName: PWCHAR; referenceHdc: HDC; + type_: EMFTYPE; frameRect: GPRECT; frameUnit: METAFILEFRAMEUNIT; + description: PWCHAR; out metafile: GPMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRecordMetafileFileNameI} + + function GdipRecordMetafileStream(stream: ISTREAM; referenceHdc: HDC; + type_: EMFTYPE; frameRect: GPRECTF; frameUnit: METAFILEFRAMEUNIT; + description: PWCHAR; out metafile: GPMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRecordMetafileStream} + + function GdipRecordMetafileStreamI(stream: ISTREAM; referenceHdc: HDC; + type_: EMFTYPE; frameRect: GPRECT; frameUnit: METAFILEFRAMEUNIT; + description: PWCHAR; out metafile: GPMETAFILE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipRecordMetafileStreamI} + + function GdipSetMetafileDownLevelRasterizationLimit(metafile: GPMETAFILE; + metafileRasterizationLimitDpi: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetMetafileDownLevelRasterizationLimit} + + function GdipGetMetafileDownLevelRasterizationLimit(metafile: GPMETAFILE; + var metafileRasterizationLimitDpi: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetMetafileDownLevelRasterizationLimit} + + function GdipGetImageDecodersSize(out numDecoders: UINT; + out size: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageDecodersSize} + + function GdipGetImageDecoders(numDecoders: UINT; size: UINT; + decoders: PIMAGECODECINFO): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageDecoders} + + function GdipGetImageEncodersSize(out numEncoders: UINT; + out size: UINT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageEncodersSize} + + function GdipGetImageEncoders(numEncoders: UINT; size: UINT; + encoders: PIMAGECODECINFO): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetImageEncoders} + + function GdipComment(graphics: GPGRAPHICS; sizeData: UINT; + data: PBYTE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipComment} + +//---------------------------------------------------------------------------- +// FontFamily APIs +//---------------------------------------------------------------------------- + + function GdipCreateFontFamilyFromName(name: PWCHAR; + fontCollection: GPFONTCOLLECTION; + out FontFamily: GPFONTFAMILY): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateFontFamilyFromName} + + function GdipDeleteFontFamily(FontFamily: GPFONTFAMILY): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeleteFontFamily} + + function GdipCloneFontFamily(FontFamily: GPFONTFAMILY; + out clonedFontFamily: GPFONTFAMILY): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCloneFontFamily} + + function GdipGetGenericFontFamilySansSerif( + out nativeFamily: GPFONTFAMILY): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetGenericFontFamilySansSerif} + + function GdipGetGenericFontFamilySerif( + out nativeFamily: GPFONTFAMILY): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetGenericFontFamilySerif} + + function GdipGetGenericFontFamilyMonospace( + out nativeFamily: GPFONTFAMILY): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetGenericFontFamilyMonospace} + + function GdipGetFamilyName(family: GPFONTFAMILY; name: PWideChar; + language: LANGID): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetFamilyName} + + function GdipIsStyleAvailable(family: GPFONTFAMILY; style: Integer; + var IsStyleAvailable: Bool): GPSTATUS; stdcall; + {$EXTERNALSYM GdipIsStyleAvailable} + + function GdipFontCollectionEnumerable(fontCollection: GPFONTCOLLECTION; + graphics: GPGRAPHICS; var numFound: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFontCollectionEnumerable} + + function GdipFontCollectionEnumerate(fontCollection: GPFONTCOLLECTION; + numSought: Integer; gpfamilies: array of GPFONTFAMILY; + var numFound: Integer; graphics: GPGRAPHICS): GPSTATUS; stdcall; + {$EXTERNALSYM GdipFontCollectionEnumerate} + + function GdipGetEmHeight(family: GPFONTFAMILY; style: Integer; + out EmHeight: UINT16): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetEmHeight} + + function GdipGetCellAscent(family: GPFONTFAMILY; style: Integer; + var CellAscent: UINT16): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetCellAscent} + + function GdipGetCellDescent(family: GPFONTFAMILY; style: Integer; + var CellDescent: UINT16): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetCellDescent} + + function GdipGetLineSpacing(family: GPFONTFAMILY; style: Integer; + var LineSpacing: UINT16): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLineSpacing} + +//---------------------------------------------------------------------------- +// Font APIs +//---------------------------------------------------------------------------- + + function GdipCreateFontFromDC(hdc: HDC; out font: GPFONT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateFontFromDC} + + function GdipCreateFontFromLogfontA(hdc: HDC; logfont: PLOGFONTA; + out font: GPFONT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateFontFromLogfontA} + + function GdipCreateFontFromLogfontW(hdc: HDC; logfont: PLOGFONTW; + out font: GPFONT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateFontFromLogfontW} + + function GdipCreateFont(fontFamily: GPFONTFAMILY; emSize: Single; + style: Integer; unit_: Integer; out font: GPFONT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateFont} + + function GdipCloneFont(font: GPFONT; + out cloneFont: GPFONT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCloneFont} + + function GdipDeleteFont(font: GPFONT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeleteFont} + + function GdipGetFamily(font: GPFONT; + out family: GPFONTFAMILY): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetFamily} + + function GdipGetFontStyle(font: GPFONT; + var style: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetFontStyle} + + function GdipGetFontSize(font: GPFONT; var size: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetFontSize} + + function GdipGetFontUnit(font: GPFONT; var unit_: TUNIT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetFontUnit} + + function GdipGetFontHeight(font: GPFONT; graphics: GPGRAPHICS; + var height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetFontHeight} + + function GdipGetFontHeightGivenDPI(font: GPFONT; dpi: Single; + var height: Single): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetFontHeightGivenDPI} + + function GdipGetLogFontA(font: GPFONT; graphics: GPGRAPHICS; + var logfontA: LOGFONTA): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLogFontA} + + function GdipGetLogFontW(font: GPFONT; graphics: GPGRAPHICS; + var logfontW: LOGFONTW): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetLogFontW} + + function GdipNewInstalledFontCollection( + out fontCollection: GPFONTCOLLECTION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipNewInstalledFontCollection} + + function GdipNewPrivateFontCollection( + out fontCollection: GPFONTCOLLECTION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipNewPrivateFontCollection} + + function GdipDeletePrivateFontCollection( + out fontCollection: GPFONTCOLLECTION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeletePrivateFontCollection} + + function GdipGetFontCollectionFamilyCount(fontCollection: GPFONTCOLLECTION; + var numFound: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetFontCollectionFamilyCount} + + function GdipGetFontCollectionFamilyList(fontCollection: GPFONTCOLLECTION; + numSought: Integer; gpfamilies: GPFONTFAMILY; + var numFound: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetFontCollectionFamilyList} + + function GdipPrivateAddFontFile(fontCollection: GPFONTCOLLECTION; + filename: PWCHAR): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPrivateAddFontFile} + + function GdipPrivateAddMemoryFont(fontCollection: GPFONTCOLLECTION; + memory: Pointer; length: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipPrivateAddMemoryFont} + +//---------------------------------------------------------------------------- +// Text APIs +//---------------------------------------------------------------------------- + + function GdipDrawString(graphics: GPGRAPHICS; string_: PWCHAR; + length: Integer; font: GPFONT; layoutRect: PGPRectF; + stringFormat: GPSTRINGFORMAT; brush: GPBRUSH): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawString} + + function GdipMeasureString(graphics: GPGRAPHICS; string_: PWCHAR; + length: Integer; font: GPFONT; layoutRect: PGPRectF; + stringFormat: GPSTRINGFORMAT; boundingBox: PGPRectF; + codepointsFitted: PInteger; linesFilled: PInteger): GPSTATUS; stdcall; + {$EXTERNALSYM GdipMeasureString} + + function GdipMeasureCharacterRanges(graphics: GPGRAPHICS; string_: PWCHAR; + length: Integer; font: GPFONT; layoutRect: PGPRectF; + stringFormat: GPSTRINGFORMAT; regionCount: Integer; + const regions: GPREGION): GPSTATUS; stdcall; + {$EXTERNALSYM GdipMeasureCharacterRanges} + + function GdipDrawDriverString(graphics: GPGRAPHICS; const text: PUINT16; + length: Integer; const font: GPFONT; const brush: GPBRUSH; + const positions: PGPPointF; flags: Integer; + const matrix: GPMATRIX): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawDriverString} + + function GdipMeasureDriverString(graphics: GPGRAPHICS; text: PUINT16; + length: Integer; font: GPFONT; positions: PGPPointF; flags: Integer; + matrix: GPMATRIX; boundingBox: PGPRectF): GPSTATUS; stdcall; + {$EXTERNALSYM GdipMeasureDriverString} + +//---------------------------------------------------------------------------- +// String format APIs +//---------------------------------------------------------------------------- + + function GdipCreateStringFormat(formatAttributes: Integer; language: LANGID; + out format: GPSTRINGFORMAT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateStringFormat} + + function GdipStringFormatGetGenericDefault( + out format: GPSTRINGFORMAT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipStringFormatGetGenericDefault} + + function GdipStringFormatGetGenericTypographic( + out format: GPSTRINGFORMAT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipStringFormatGetGenericTypographic} + + function GdipDeleteStringFormat(format: GPSTRINGFORMAT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeleteStringFormat} + + function GdipCloneStringFormat(format: GPSTRINGFORMAT; + out newFormat: GPSTRINGFORMAT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCloneStringFormat} + + function GdipSetStringFormatFlags(format: GPSTRINGFORMAT; + flags: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetStringFormatFlags} + + function GdipGetStringFormatFlags(format: GPSTRINGFORMAT; + out flags: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetStringFormatFlags} + + function GdipSetStringFormatAlign(format: GPSTRINGFORMAT; + align: STRINGALIGNMENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetStringFormatAlign} + + function GdipGetStringFormatAlign(format: GPSTRINGFORMAT; + out align: STRINGALIGNMENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetStringFormatAlign} + + function GdipSetStringFormatLineAlign(format: GPSTRINGFORMAT; + align: STRINGALIGNMENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetStringFormatLineAlign} + + function GdipGetStringFormatLineAlign(format: GPSTRINGFORMAT; + out align: STRINGALIGNMENT): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetStringFormatLineAlign} + + function GdipSetStringFormatTrimming(format: GPSTRINGFORMAT; + trimming: STRINGTRIMMING): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetStringFormatTrimming} + + function GdipGetStringFormatTrimming(format: GPSTRINGFORMAT; + out trimming: STRINGTRIMMING): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetStringFormatTrimming} + + function GdipSetStringFormatHotkeyPrefix(format: GPSTRINGFORMAT; + hotkeyPrefix: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetStringFormatHotkeyPrefix} + + function GdipGetStringFormatHotkeyPrefix(format: GPSTRINGFORMAT; + out hotkeyPrefix: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetStringFormatHotkeyPrefix} + + function GdipSetStringFormatTabStops(format: GPSTRINGFORMAT; + firstTabOffset: Single; count: Integer; + tabStops: PSingle): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetStringFormatTabStops} + + function GdipGetStringFormatTabStops(format: GPSTRINGFORMAT; + count: Integer; firstTabOffset: PSingle; + tabStops: PSingle): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetStringFormatTabStops} + + function GdipGetStringFormatTabStopCount(format: GPSTRINGFORMAT; + out count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetStringFormatTabStopCount} + + function GdipSetStringFormatDigitSubstitution(format: GPSTRINGFORMAT; + language: LANGID; + substitute: STRINGDIGITSUBSTITUTE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetStringFormatDigitSubstitution} + + function GdipGetStringFormatDigitSubstitution(format: GPSTRINGFORMAT; + language: PUINT; substitute: PSTRINGDIGITSUBSTITUTE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetStringFormatDigitSubstitution} + + function GdipGetStringFormatMeasurableCharacterRangeCount(format: GPSTRINGFORMAT; + out count: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipGetStringFormatMeasurableCharacterRangeCount} + + function GdipSetStringFormatMeasurableCharacterRanges(format: GPSTRINGFORMAT; + rangeCount: Integer; ranges: PCHARACTERRANGE): GPSTATUS; stdcall; + {$EXTERNALSYM GdipSetStringFormatMeasurableCharacterRanges} + +//---------------------------------------------------------------------------- +// Cached Bitmap APIs +//---------------------------------------------------------------------------- + + function GdipCreateCachedBitmap(bitmap: GPBITMAP; graphics: GPGRAPHICS; + out cachedBitmap: GPCACHEDBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipCreateCachedBitmap} + + function GdipDeleteCachedBitmap( + cachedBitmap: GPCACHEDBITMAP): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDeleteCachedBitmap} + + function GdipDrawCachedBitmap(graphics: GPGRAPHICS; + cachedBitmap: GPCACHEDBITMAP; x: Integer; + y: Integer): GPSTATUS; stdcall; + {$EXTERNALSYM GdipDrawCachedBitmap} + + function GdipEmfToWmfBits(hemf: HENHMETAFILE; cbData16: UINT; pData16: PBYTE; + iMapMode: Integer; eFlags: Integer): UINT; stdcall; + {$EXTERNALSYM GdipEmfToWmfBits} + +implementation + + function GdipAlloc; external WINGDIPDLL name 'GdipAlloc'; + procedure GdipFree; external WINGDIPDLL name 'GdipFree'; + function GdiplusStartup; external WINGDIPDLL name 'GdiplusStartup'; + procedure GdiplusShutdown; external WINGDIPDLL name 'GdiplusShutdown'; + + function GdipCreatePath; external WINGDIPDLL name 'GdipCreatePath'; + function GdipCreatePath2; external WINGDIPDLL name 'GdipCreatePath2'; + function GdipCreatePath2I; external WINGDIPDLL name 'GdipCreatePath2I'; + function GdipClonePath; external WINGDIPDLL name 'GdipClonePath'; + function GdipDeletePath; external WINGDIPDLL name 'GdipDeletePath'; + function GdipResetPath; external WINGDIPDLL name 'GdipResetPath'; + function GdipGetPointCount; external WINGDIPDLL name 'GdipGetPointCount'; + function GdipGetPathTypes; external WINGDIPDLL name 'GdipGetPathTypes'; + function GdipGetPathPoints; external WINGDIPDLL name 'GdipGetPathPoints'; + function GdipGetPathPointsI; external WINGDIPDLL name 'GdipGetPathPointsI'; + function GdipGetPathFillMode; external WINGDIPDLL name 'GdipGetPathFillMode'; + function GdipSetPathFillMode; external WINGDIPDLL name 'GdipSetPathFillMode'; + function GdipGetPathData; external WINGDIPDLL name 'GdipGetPathData'; + function GdipStartPathFigure; external WINGDIPDLL name 'GdipStartPathFigure'; + function GdipClosePathFigure; external WINGDIPDLL name 'GdipClosePathFigure'; + function GdipClosePathFigures; external WINGDIPDLL name 'GdipClosePathFigures'; + function GdipSetPathMarker; external WINGDIPDLL name 'GdipSetPathMarker'; + function GdipClearPathMarkers; external WINGDIPDLL name 'GdipClearPathMarkers'; + function GdipReversePath; external WINGDIPDLL name 'GdipReversePath'; + function GdipGetPathLastPoint; external WINGDIPDLL name 'GdipGetPathLastPoint'; + function GdipAddPathLine; external WINGDIPDLL name 'GdipAddPathLine'; + function GdipAddPathLine2; external WINGDIPDLL name 'GdipAddPathLine2'; + function GdipAddPathArc; external WINGDIPDLL name 'GdipAddPathArc'; + function GdipAddPathBezier; external WINGDIPDLL name 'GdipAddPathBezier'; + function GdipAddPathBeziers; external WINGDIPDLL name 'GdipAddPathBeziers'; + function GdipAddPathCurve; external WINGDIPDLL name 'GdipAddPathCurve'; + function GdipAddPathCurve2; external WINGDIPDLL name 'GdipAddPathCurve2'; + function GdipAddPathCurve3; external WINGDIPDLL name 'GdipAddPathCurve3'; + function GdipAddPathClosedCurve; external WINGDIPDLL name 'GdipAddPathClosedCurve'; + function GdipAddPathClosedCurve2; external WINGDIPDLL name 'GdipAddPathClosedCurve2'; + function GdipAddPathRectangle; external WINGDIPDLL name 'GdipAddPathRectangle'; + function GdipAddPathRectangles; external WINGDIPDLL name 'GdipAddPathRectangles'; + function GdipAddPathEllipse; external WINGDIPDLL name 'GdipAddPathEllipse'; + function GdipAddPathPie; external WINGDIPDLL name 'GdipAddPathPie'; + function GdipAddPathPolygon; external WINGDIPDLL name 'GdipAddPathPolygon'; + function GdipAddPathPath; external WINGDIPDLL name 'GdipAddPathPath'; + function GdipAddPathString; external WINGDIPDLL name 'GdipAddPathString'; + function GdipAddPathStringI; external WINGDIPDLL name 'GdipAddPathStringI'; + function GdipAddPathLineI; external WINGDIPDLL name 'GdipAddPathLineI'; + function GdipAddPathLine2I; external WINGDIPDLL name 'GdipAddPathLine2I'; + function GdipAddPathArcI; external WINGDIPDLL name 'GdipAddPathArcI'; + function GdipAddPathBezierI; external WINGDIPDLL name 'GdipAddPathBezierI'; + function GdipAddPathBeziersI; external WINGDIPDLL name 'GdipAddPathBeziersI'; + function GdipAddPathCurveI; external WINGDIPDLL name 'GdipAddPathCurveI'; + function GdipAddPathCurve2I; external WINGDIPDLL name 'GdipAddPathCurve2I'; + function GdipAddPathCurve3I; external WINGDIPDLL name 'GdipAddPathCurve3I'; + function GdipAddPathClosedCurveI; external WINGDIPDLL name 'GdipAddPathClosedCurveI'; + function GdipAddPathClosedCurve2I; external WINGDIPDLL name 'GdipAddPathClosedCurve2I'; + function GdipAddPathRectangleI; external WINGDIPDLL name 'GdipAddPathRectangleI'; + function GdipAddPathRectanglesI; external WINGDIPDLL name 'GdipAddPathRectanglesI'; + function GdipAddPathEllipseI; external WINGDIPDLL name 'GdipAddPathEllipseI'; + function GdipAddPathPieI; external WINGDIPDLL name 'GdipAddPathPieI'; + function GdipAddPathPolygonI; external WINGDIPDLL name 'GdipAddPathPolygonI'; + function GdipFlattenPath; external WINGDIPDLL name 'GdipFlattenPath'; + function GdipWindingModeOutline; external WINGDIPDLL name 'GdipWindingModeOutline'; + function GdipWidenPath; external WINGDIPDLL name 'GdipWidenPath'; + function GdipWarpPath; external WINGDIPDLL name 'GdipWarpPath'; + function GdipTransformPath; external WINGDIPDLL name 'GdipTransformPath'; + function GdipGetPathWorldBounds; external WINGDIPDLL name 'GdipGetPathWorldBounds'; + function GdipGetPathWorldBoundsI; external WINGDIPDLL name 'GdipGetPathWorldBoundsI'; + function GdipIsVisiblePathPoint; external WINGDIPDLL name 'GdipIsVisiblePathPoint'; + function GdipIsVisiblePathPointI; external WINGDIPDLL name 'GdipIsVisiblePathPointI'; + function GdipIsOutlineVisiblePathPoint; external WINGDIPDLL name 'GdipIsOutlineVisiblePathPoint'; + function GdipIsOutlineVisiblePathPointI; external WINGDIPDLL name 'GdipIsOutlineVisiblePathPointI'; + function GdipCreatePathIter; external WINGDIPDLL name 'GdipCreatePathIter'; + function GdipDeletePathIter; external WINGDIPDLL name 'GdipDeletePathIter'; + function GdipPathIterNextSubpath; external WINGDIPDLL name 'GdipPathIterNextSubpath'; + function GdipPathIterNextSubpathPath; external WINGDIPDLL name 'GdipPathIterNextSubpathPath'; + function GdipPathIterNextPathType; external WINGDIPDLL name 'GdipPathIterNextPathType'; + function GdipPathIterNextMarker; external WINGDIPDLL name 'GdipPathIterNextMarker'; + function GdipPathIterNextMarkerPath; external WINGDIPDLL name 'GdipPathIterNextMarkerPath'; + function GdipPathIterGetCount; external WINGDIPDLL name 'GdipPathIterGetCount'; + function GdipPathIterGetSubpathCount; external WINGDIPDLL name 'GdipPathIterGetSubpathCount'; + function GdipPathIterIsValid; external WINGDIPDLL name 'GdipPathIterIsValid'; + function GdipPathIterHasCurve; external WINGDIPDLL name 'GdipPathIterHasCurve'; + function GdipPathIterRewind; external WINGDIPDLL name 'GdipPathIterRewind'; + function GdipPathIterEnumerate; external WINGDIPDLL name 'GdipPathIterEnumerate'; + function GdipPathIterCopyData; external WINGDIPDLL name 'GdipPathIterCopyData'; + function GdipCreateMatrix; external WINGDIPDLL name 'GdipCreateMatrix'; + function GdipCreateMatrix2; external WINGDIPDLL name 'GdipCreateMatrix2'; + function GdipCreateMatrix3; external WINGDIPDLL name 'GdipCreateMatrix3'; + function GdipCreateMatrix3I; external WINGDIPDLL name 'GdipCreateMatrix3I'; + function GdipCloneMatrix; external WINGDIPDLL name 'GdipCloneMatrix'; + function GdipDeleteMatrix; external WINGDIPDLL name 'GdipDeleteMatrix'; + function GdipSetMatrixElements; external WINGDIPDLL name 'GdipSetMatrixElements'; + function GdipMultiplyMatrix; external WINGDIPDLL name 'GdipMultiplyMatrix'; + function GdipTranslateMatrix; external WINGDIPDLL name 'GdipTranslateMatrix'; + function GdipScaleMatrix; external WINGDIPDLL name 'GdipScaleMatrix'; + function GdipRotateMatrix; external WINGDIPDLL name 'GdipRotateMatrix'; + function GdipShearMatrix; external WINGDIPDLL name 'GdipShearMatrix'; + function GdipInvertMatrix; external WINGDIPDLL name 'GdipInvertMatrix'; + function GdipTransformMatrixPoints; external WINGDIPDLL name 'GdipTransformMatrixPoints'; + function GdipTransformMatrixPointsI; external WINGDIPDLL name 'GdipTransformMatrixPointsI'; + function GdipVectorTransformMatrixPoints; external WINGDIPDLL name 'GdipVectorTransformMatrixPoints'; + function GdipVectorTransformMatrixPointsI; external WINGDIPDLL name 'GdipVectorTransformMatrixPointsI'; + function GdipGetMatrixElements; external WINGDIPDLL name 'GdipGetMatrixElements'; + function GdipIsMatrixInvertible; external WINGDIPDLL name 'GdipIsMatrixInvertible'; + function GdipIsMatrixIdentity; external WINGDIPDLL name 'GdipIsMatrixIdentity'; + function GdipIsMatrixEqual; external WINGDIPDLL name 'GdipIsMatrixEqual'; + function GdipCreateRegion; external WINGDIPDLL name 'GdipCreateRegion'; + function GdipCreateRegionRect; external WINGDIPDLL name 'GdipCreateRegionRect'; + function GdipCreateRegionRectI; external WINGDIPDLL name 'GdipCreateRegionRectI'; + function GdipCreateRegionPath; external WINGDIPDLL name 'GdipCreateRegionPath'; + function GdipCreateRegionRgnData; external WINGDIPDLL name 'GdipCreateRegionRgnData'; + function GdipCreateRegionHrgn; external WINGDIPDLL name 'GdipCreateRegionHrgn'; + function GdipCloneRegion; external WINGDIPDLL name 'GdipCloneRegion'; + function GdipDeleteRegion; external WINGDIPDLL name 'GdipDeleteRegion'; + function GdipSetInfinite; external WINGDIPDLL name 'GdipSetInfinite'; + function GdipSetEmpty; external WINGDIPDLL name 'GdipSetEmpty'; + function GdipCombineRegionRect; external WINGDIPDLL name 'GdipCombineRegionRect'; + function GdipCombineRegionRectI; external WINGDIPDLL name 'GdipCombineRegionRectI'; + function GdipCombineRegionPath; external WINGDIPDLL name 'GdipCombineRegionPath'; + function GdipCombineRegionRegion; external WINGDIPDLL name 'GdipCombineRegionRegion'; + function GdipTranslateRegion; external WINGDIPDLL name 'GdipTranslateRegion'; + function GdipTranslateRegionI; external WINGDIPDLL name 'GdipTranslateRegionI'; + function GdipTransformRegion; external WINGDIPDLL name 'GdipTransformRegion'; + function GdipGetRegionBounds; external WINGDIPDLL name 'GdipGetRegionBounds'; + function GdipGetRegionBoundsI; external WINGDIPDLL name 'GdipGetRegionBoundsI'; + function GdipGetRegionHRgn; external WINGDIPDLL name 'GdipGetRegionHRgn'; + function GdipIsEmptyRegion; external WINGDIPDLL name 'GdipIsEmptyRegion'; + function GdipIsInfiniteRegion; external WINGDIPDLL name 'GdipIsInfiniteRegion'; + function GdipIsEqualRegion; external WINGDIPDLL name 'GdipIsEqualRegion'; + function GdipGetRegionDataSize; external WINGDIPDLL name 'GdipGetRegionDataSize'; + function GdipGetRegionData; external WINGDIPDLL name 'GdipGetRegionData'; + function GdipIsVisibleRegionPoint; external WINGDIPDLL name 'GdipIsVisibleRegionPoint'; + function GdipIsVisibleRegionPointI; external WINGDIPDLL name 'GdipIsVisibleRegionPointI'; + function GdipIsVisibleRegionRect; external WINGDIPDLL name 'GdipIsVisibleRegionRect'; + function GdipIsVisibleRegionRectI; external WINGDIPDLL name 'GdipIsVisibleRegionRectI'; + function GdipGetRegionScansCount; external WINGDIPDLL name 'GdipGetRegionScansCount'; + function GdipGetRegionScans; external WINGDIPDLL name 'GdipGetRegionScans'; + function GdipGetRegionScansI; external WINGDIPDLL name 'GdipGetRegionScansI'; + function GdipCloneBrush; external WINGDIPDLL name 'GdipCloneBrush'; + function GdipDeleteBrush; external WINGDIPDLL name 'GdipDeleteBrush'; + function GdipGetBrushType; external WINGDIPDLL name 'GdipGetBrushType'; + function GdipCreateHatchBrush; external WINGDIPDLL name 'GdipCreateHatchBrush'; + function GdipGetHatchStyle; external WINGDIPDLL name 'GdipGetHatchStyle'; + function GdipGetHatchForegroundColor; external WINGDIPDLL name 'GdipGetHatchForegroundColor'; + function GdipGetHatchBackgroundColor; external WINGDIPDLL name 'GdipGetHatchBackgroundColor'; + function GdipCreateTexture; external WINGDIPDLL name 'GdipCreateTexture'; + function GdipCreateTexture2; external WINGDIPDLL name 'GdipCreateTexture2'; + function GdipCreateTextureIA; external WINGDIPDLL name 'GdipCreateTextureIA'; + function GdipCreateTexture2I; external WINGDIPDLL name 'GdipCreateTexture2I'; + function GdipCreateTextureIAI; external WINGDIPDLL name 'GdipCreateTextureIAI'; + function GdipGetTextureTransform; external WINGDIPDLL name 'GdipGetTextureTransform'; + function GdipSetTextureTransform; external WINGDIPDLL name 'GdipSetTextureTransform'; + function GdipResetTextureTransform; external WINGDIPDLL name 'GdipResetTextureTransform'; + function GdipMultiplyTextureTransform; external WINGDIPDLL name 'GdipMultiplyTextureTransform'; + function GdipTranslateTextureTransform; external WINGDIPDLL name 'GdipTranslateTextureTransform'; + function GdipScaleTextureTransform; external WINGDIPDLL name 'GdipScaleTextureTransform'; + function GdipRotateTextureTransform; external WINGDIPDLL name 'GdipRotateTextureTransform'; + function GdipSetTextureWrapMode; external WINGDIPDLL name 'GdipSetTextureWrapMode'; + function GdipGetTextureWrapMode; external WINGDIPDLL name 'GdipGetTextureWrapMode'; + function GdipGetTextureImage; external WINGDIPDLL name 'GdipGetTextureImage'; + function GdipCreateSolidFill; external WINGDIPDLL name 'GdipCreateSolidFill'; + function GdipSetSolidFillColor; external WINGDIPDLL name 'GdipSetSolidFillColor'; + function GdipGetSolidFillColor; external WINGDIPDLL name 'GdipGetSolidFillColor'; + function GdipCreateLineBrush; external WINGDIPDLL name 'GdipCreateLineBrush'; + function GdipCreateLineBrushI; external WINGDIPDLL name 'GdipCreateLineBrushI'; + function GdipCreateLineBrushFromRect; external WINGDIPDLL name 'GdipCreateLineBrushFromRect'; + function GdipCreateLineBrushFromRectI; external WINGDIPDLL name 'GdipCreateLineBrushFromRectI'; + function GdipCreateLineBrushFromRectWithAngle; external WINGDIPDLL name 'GdipCreateLineBrushFromRectWithAngle'; + function GdipCreateLineBrushFromRectWithAngleI; external WINGDIPDLL name 'GdipCreateLineBrushFromRectWithAngleI'; + function GdipSetLineColors; external WINGDIPDLL name 'GdipSetLineColors'; + function GdipGetLineColors; external WINGDIPDLL name 'GdipGetLineColors'; + function GdipGetLineRect; external WINGDIPDLL name 'GdipGetLineRect'; + function GdipGetLineRectI; external WINGDIPDLL name 'GdipGetLineRectI'; + function GdipSetLineGammaCorrection; external WINGDIPDLL name 'GdipSetLineGammaCorrection'; + function GdipGetLineGammaCorrection; external WINGDIPDLL name 'GdipGetLineGammaCorrection'; + function GdipGetLineBlendCount; external WINGDIPDLL name 'GdipGetLineBlendCount'; + function GdipGetLineBlend; external WINGDIPDLL name 'GdipGetLineBlend'; + function GdipSetLineBlend; external WINGDIPDLL name 'GdipSetLineBlend'; + function GdipGetLinePresetBlendCount; external WINGDIPDLL name 'GdipGetLinePresetBlendCount'; + function GdipGetLinePresetBlend; external WINGDIPDLL name 'GdipGetLinePresetBlend'; + function GdipSetLinePresetBlend; external WINGDIPDLL name 'GdipSetLinePresetBlend'; + function GdipSetLineSigmaBlend; external WINGDIPDLL name 'GdipSetLineSigmaBlend'; + function GdipSetLineLinearBlend; external WINGDIPDLL name 'GdipSetLineLinearBlend'; + function GdipSetLineWrapMode; external WINGDIPDLL name 'GdipSetLineWrapMode'; + function GdipGetLineWrapMode; external WINGDIPDLL name 'GdipGetLineWrapMode'; + function GdipGetLineTransform; external WINGDIPDLL name 'GdipGetLineTransform'; + function GdipSetLineTransform; external WINGDIPDLL name 'GdipSetLineTransform'; + function GdipResetLineTransform; external WINGDIPDLL name 'GdipResetLineTransform'; + function GdipMultiplyLineTransform; external WINGDIPDLL name 'GdipMultiplyLineTransform'; + function GdipTranslateLineTransform; external WINGDIPDLL name 'GdipTranslateLineTransform'; + function GdipScaleLineTransform; external WINGDIPDLL name 'GdipScaleLineTransform'; + function GdipRotateLineTransform; external WINGDIPDLL name 'GdipRotateLineTransform'; + function GdipCreatePathGradient; external WINGDIPDLL name 'GdipCreatePathGradient'; + function GdipCreatePathGradientI; external WINGDIPDLL name 'GdipCreatePathGradientI'; + function GdipCreatePathGradientFromPath; external WINGDIPDLL name 'GdipCreatePathGradientFromPath'; + function GdipGetPathGradientCenterColor; external WINGDIPDLL name 'GdipGetPathGradientCenterColor'; + function GdipSetPathGradientCenterColor; external WINGDIPDLL name 'GdipSetPathGradientCenterColor'; + function GdipGetPathGradientSurroundColorsWithCount; external WINGDIPDLL name 'GdipGetPathGradientSurroundColorsWithCount'; + function GdipSetPathGradientSurroundColorsWithCount; external WINGDIPDLL name 'GdipSetPathGradientSurroundColorsWithCount'; + function GdipGetPathGradientPath; external WINGDIPDLL name 'GdipGetPathGradientPath'; + function GdipSetPathGradientPath; external WINGDIPDLL name 'GdipSetPathGradientPath'; + function GdipGetPathGradientCenterPoint; external WINGDIPDLL name 'GdipGetPathGradientCenterPoint'; + function GdipGetPathGradientCenterPointI; external WINGDIPDLL name 'GdipGetPathGradientCenterPointI'; + function GdipSetPathGradientCenterPoint; external WINGDIPDLL name 'GdipSetPathGradientCenterPoint'; + function GdipSetPathGradientCenterPointI; external WINGDIPDLL name 'GdipSetPathGradientCenterPointI'; + function GdipGetPathGradientRect; external WINGDIPDLL name 'GdipGetPathGradientRect'; + function GdipGetPathGradientRectI; external WINGDIPDLL name 'GdipGetPathGradientRectI'; + function GdipGetPathGradientPointCount; external WINGDIPDLL name 'GdipGetPathGradientPointCount'; + function GdipGetPathGradientSurroundColorCount; external WINGDIPDLL name 'GdipGetPathGradientSurroundColorCount'; + function GdipSetPathGradientGammaCorrection; external WINGDIPDLL name 'GdipSetPathGradientGammaCorrection'; + function GdipGetPathGradientGammaCorrection; external WINGDIPDLL name 'GdipGetPathGradientGammaCorrection'; + function GdipGetPathGradientBlendCount; external WINGDIPDLL name 'GdipGetPathGradientBlendCount'; + function GdipGetPathGradientBlend; external WINGDIPDLL name 'GdipGetPathGradientBlend'; + function GdipSetPathGradientBlend; external WINGDIPDLL name 'GdipSetPathGradientBlend'; + function GdipGetPathGradientPresetBlendCount; external WINGDIPDLL name 'GdipGetPathGradientPresetBlendCount'; + function GdipGetPathGradientPresetBlend; external WINGDIPDLL name 'GdipGetPathGradientPresetBlend'; + function GdipSetPathGradientPresetBlend; external WINGDIPDLL name 'GdipSetPathGradientPresetBlend'; + function GdipSetPathGradientSigmaBlend; external WINGDIPDLL name 'GdipSetPathGradientSigmaBlend'; + function GdipSetPathGradientLinearBlend; external WINGDIPDLL name 'GdipSetPathGradientLinearBlend'; + function GdipGetPathGradientWrapMode; external WINGDIPDLL name 'GdipGetPathGradientWrapMode'; + function GdipSetPathGradientWrapMode; external WINGDIPDLL name 'GdipSetPathGradientWrapMode'; + function GdipGetPathGradientTransform; external WINGDIPDLL name 'GdipGetPathGradientTransform'; + function GdipSetPathGradientTransform; external WINGDIPDLL name 'GdipSetPathGradientTransform'; + function GdipResetPathGradientTransform; external WINGDIPDLL name 'GdipResetPathGradientTransform'; + function GdipMultiplyPathGradientTransform; external WINGDIPDLL name 'GdipMultiplyPathGradientTransform'; + function GdipTranslatePathGradientTransform; external WINGDIPDLL name 'GdipTranslatePathGradientTransform'; + function GdipScalePathGradientTransform; external WINGDIPDLL name 'GdipScalePathGradientTransform'; + function GdipRotatePathGradientTransform; external WINGDIPDLL name 'GdipRotatePathGradientTransform'; + function GdipGetPathGradientFocusScales; external WINGDIPDLL name 'GdipGetPathGradientFocusScales'; + function GdipSetPathGradientFocusScales; external WINGDIPDLL name 'GdipSetPathGradientFocusScales'; + function GdipCreatePen1; external WINGDIPDLL name 'GdipCreatePen1'; + function GdipCreatePen2; external WINGDIPDLL name 'GdipCreatePen2'; + function GdipClonePen; external WINGDIPDLL name 'GdipClonePen'; + function GdipDeletePen; external WINGDIPDLL name 'GdipDeletePen'; + function GdipSetPenWidth; external WINGDIPDLL name 'GdipSetPenWidth'; + function GdipGetPenWidth; external WINGDIPDLL name 'GdipGetPenWidth'; + function GdipSetPenUnit; external WINGDIPDLL name 'GdipSetPenUnit'; + function GdipGetPenUnit; external WINGDIPDLL name 'GdipGetPenUnit'; + function GdipSetPenLineCap197819; external WINGDIPDLL name 'GdipSetPenLineCap197819'; + function GdipSetPenStartCap; external WINGDIPDLL name 'GdipSetPenStartCap'; + function GdipSetPenEndCap; external WINGDIPDLL name 'GdipSetPenEndCap'; + function GdipSetPenDashCap197819; external WINGDIPDLL name 'GdipSetPenDashCap197819'; + function GdipGetPenStartCap; external WINGDIPDLL name 'GdipGetPenStartCap'; + function GdipGetPenEndCap; external WINGDIPDLL name 'GdipGetPenEndCap'; + function GdipGetPenDashCap197819; external WINGDIPDLL name 'GdipGetPenDashCap197819'; + function GdipSetPenLineJoin; external WINGDIPDLL name 'GdipSetPenLineJoin'; + function GdipGetPenLineJoin; external WINGDIPDLL name 'GdipGetPenLineJoin'; + function GdipSetPenCustomStartCap; external WINGDIPDLL name 'GdipSetPenCustomStartCap'; + function GdipGetPenCustomStartCap; external WINGDIPDLL name 'GdipGetPenCustomStartCap'; + function GdipSetPenCustomEndCap; external WINGDIPDLL name 'GdipSetPenCustomEndCap'; + function GdipGetPenCustomEndCap; external WINGDIPDLL name 'GdipGetPenCustomEndCap'; + function GdipSetPenMiterLimit; external WINGDIPDLL name 'GdipSetPenMiterLimit'; + function GdipGetPenMiterLimit; external WINGDIPDLL name 'GdipGetPenMiterLimit'; + function GdipSetPenMode; external WINGDIPDLL name 'GdipSetPenMode'; + function GdipGetPenMode; external WINGDIPDLL name 'GdipGetPenMode'; + function GdipSetPenTransform; external WINGDIPDLL name 'GdipSetPenTransform'; + function GdipGetPenTransform; external WINGDIPDLL name 'GdipGetPenTransform'; + function GdipResetPenTransform; external WINGDIPDLL name 'GdipResetPenTransform'; + function GdipMultiplyPenTransform; external WINGDIPDLL name 'GdipMultiplyPenTransform'; + function GdipTranslatePenTransform; external WINGDIPDLL name 'GdipTranslatePenTransform'; + function GdipScalePenTransform; external WINGDIPDLL name 'GdipScalePenTransform'; + function GdipRotatePenTransform; external WINGDIPDLL name 'GdipRotatePenTransform'; + function GdipSetPenColor; external WINGDIPDLL name 'GdipSetPenColor'; + function GdipGetPenColor; external WINGDIPDLL name 'GdipGetPenColor'; + function GdipSetPenBrushFill; external WINGDIPDLL name 'GdipSetPenBrushFill'; + function GdipGetPenBrushFill; external WINGDIPDLL name 'GdipGetPenBrushFill'; + function GdipGetPenFillType; external WINGDIPDLL name 'GdipGetPenFillType'; + function GdipGetPenDashStyle; external WINGDIPDLL name 'GdipGetPenDashStyle'; + function GdipSetPenDashStyle; external WINGDIPDLL name 'GdipSetPenDashStyle'; + function GdipGetPenDashOffset; external WINGDIPDLL name 'GdipGetPenDashOffset'; + function GdipSetPenDashOffset; external WINGDIPDLL name 'GdipSetPenDashOffset'; + function GdipGetPenDashCount; external WINGDIPDLL name 'GdipGetPenDashCount'; + function GdipSetPenDashArray; external WINGDIPDLL name 'GdipSetPenDashArray'; + function GdipGetPenDashArray; external WINGDIPDLL name 'GdipGetPenDashArray'; + function GdipGetPenCompoundCount; external WINGDIPDLL name 'GdipGetPenCompoundCount'; + function GdipSetPenCompoundArray; external WINGDIPDLL name 'GdipSetPenCompoundArray'; + function GdipGetPenCompoundArray; external WINGDIPDLL name 'GdipGetPenCompoundArray'; + function GdipCreateCustomLineCap; external WINGDIPDLL name 'GdipCreateCustomLineCap'; + function GdipDeleteCustomLineCap; external WINGDIPDLL name 'GdipDeleteCustomLineCap'; + function GdipCloneCustomLineCap; external WINGDIPDLL name 'GdipCloneCustomLineCap'; + function GdipGetCustomLineCapType; external WINGDIPDLL name 'GdipGetCustomLineCapType'; + function GdipSetCustomLineCapStrokeCaps; external WINGDIPDLL name 'GdipSetCustomLineCapStrokeCaps'; + function GdipGetCustomLineCapStrokeCaps; external WINGDIPDLL name 'GdipGetCustomLineCapStrokeCaps'; + function GdipSetCustomLineCapStrokeJoin; external WINGDIPDLL name 'GdipSetCustomLineCapStrokeJoin'; + function GdipGetCustomLineCapStrokeJoin; external WINGDIPDLL name 'GdipGetCustomLineCapStrokeJoin'; + function GdipSetCustomLineCapBaseCap; external WINGDIPDLL name 'GdipSetCustomLineCapBaseCap'; + function GdipGetCustomLineCapBaseCap; external WINGDIPDLL name 'GdipGetCustomLineCapBaseCap'; + function GdipSetCustomLineCapBaseInset; external WINGDIPDLL name 'GdipSetCustomLineCapBaseInset'; + function GdipGetCustomLineCapBaseInset; external WINGDIPDLL name 'GdipGetCustomLineCapBaseInset'; + function GdipSetCustomLineCapWidthScale; external WINGDIPDLL name 'GdipSetCustomLineCapWidthScale'; + function GdipGetCustomLineCapWidthScale; external WINGDIPDLL name 'GdipGetCustomLineCapWidthScale'; + function GdipCreateAdjustableArrowCap; external WINGDIPDLL name 'GdipCreateAdjustableArrowCap'; + function GdipSetAdjustableArrowCapHeight; external WINGDIPDLL name 'GdipSetAdjustableArrowCapHeight'; + function GdipGetAdjustableArrowCapHeight; external WINGDIPDLL name 'GdipGetAdjustableArrowCapHeight'; + function GdipSetAdjustableArrowCapWidth; external WINGDIPDLL name 'GdipSetAdjustableArrowCapWidth'; + function GdipGetAdjustableArrowCapWidth; external WINGDIPDLL name 'GdipGetAdjustableArrowCapWidth'; + function GdipSetAdjustableArrowCapMiddleInset; external WINGDIPDLL name 'GdipSetAdjustableArrowCapMiddleInset'; + function GdipGetAdjustableArrowCapMiddleInset; external WINGDIPDLL name 'GdipGetAdjustableArrowCapMiddleInset'; + function GdipSetAdjustableArrowCapFillState; external WINGDIPDLL name 'GdipSetAdjustableArrowCapFillState'; + function GdipGetAdjustableArrowCapFillState; external WINGDIPDLL name 'GdipGetAdjustableArrowCapFillState'; + function GdipLoadImageFromStream; external WINGDIPDLL name 'GdipLoadImageFromStream'; + function GdipLoadImageFromFile; external WINGDIPDLL name 'GdipLoadImageFromFile'; + function GdipLoadImageFromStreamICM; external WINGDIPDLL name 'GdipLoadImageFromStreamICM'; + function GdipLoadImageFromFileICM; external WINGDIPDLL name 'GdipLoadImageFromFileICM'; + function GdipCloneImage; external WINGDIPDLL name 'GdipCloneImage'; + function GdipDisposeImage; external WINGDIPDLL name 'GdipDisposeImage'; + function GdipSaveImageToFile; external WINGDIPDLL name 'GdipSaveImageToFile'; + function GdipSaveImageToStream; external WINGDIPDLL name 'GdipSaveImageToStream'; + function GdipSaveAdd; external WINGDIPDLL name 'GdipSaveAdd'; + function GdipSaveAddImage; external WINGDIPDLL name 'GdipSaveAddImage'; + function GdipGetImageGraphicsContext; external WINGDIPDLL name 'GdipGetImageGraphicsContext'; + function GdipGetImageBounds; external WINGDIPDLL name 'GdipGetImageBounds'; + function GdipGetImageDimension; external WINGDIPDLL name 'GdipGetImageDimension'; + function GdipGetImageType; external WINGDIPDLL name 'GdipGetImageType'; + function GdipGetImageWidth; external WINGDIPDLL name 'GdipGetImageWidth'; + function GdipGetImageHeight; external WINGDIPDLL name 'GdipGetImageHeight'; + function GdipGetImageHorizontalResolution; external WINGDIPDLL name 'GdipGetImageHorizontalResolution'; + function GdipGetImageVerticalResolution; external WINGDIPDLL name 'GdipGetImageVerticalResolution'; + function GdipGetImageFlags; external WINGDIPDLL name 'GdipGetImageFlags'; + function GdipGetImageRawFormat; external WINGDIPDLL name 'GdipGetImageRawFormat'; + function GdipGetImagePixelFormat; external WINGDIPDLL name 'GdipGetImagePixelFormat'; + function GdipGetImageThumbnail; external WINGDIPDLL name 'GdipGetImageThumbnail'; + function GdipGetEncoderParameterListSize; external WINGDIPDLL name 'GdipGetEncoderParameterListSize'; + function GdipGetEncoderParameterList; external WINGDIPDLL name 'GdipGetEncoderParameterList'; + function GdipImageGetFrameDimensionsCount; external WINGDIPDLL name 'GdipImageGetFrameDimensionsCount'; + function GdipImageGetFrameDimensionsList; external WINGDIPDLL name 'GdipImageGetFrameDimensionsList'; + function GdipImageGetFrameCount; external WINGDIPDLL name 'GdipImageGetFrameCount'; + function GdipImageSelectActiveFrame; external WINGDIPDLL name 'GdipImageSelectActiveFrame'; + function GdipImageRotateFlip; external WINGDIPDLL name 'GdipImageRotateFlip'; + function GdipGetImagePalette; external WINGDIPDLL name 'GdipGetImagePalette'; + function GdipSetImagePalette; external WINGDIPDLL name 'GdipSetImagePalette'; + function GdipGetImagePaletteSize; external WINGDIPDLL name 'GdipGetImagePaletteSize'; + function GdipGetPropertyCount; external WINGDIPDLL name 'GdipGetPropertyCount'; + function GdipGetPropertyIdList; external WINGDIPDLL name 'GdipGetPropertyIdList'; + function GdipGetPropertyItemSize; external WINGDIPDLL name 'GdipGetPropertyItemSize'; + function GdipGetPropertyItem; external WINGDIPDLL name 'GdipGetPropertyItem'; + function GdipGetPropertySize; external WINGDIPDLL name 'GdipGetPropertySize'; + function GdipGetAllPropertyItems; external WINGDIPDLL name 'GdipGetAllPropertyItems'; + function GdipRemovePropertyItem; external WINGDIPDLL name 'GdipRemovePropertyItem'; + function GdipSetPropertyItem; external WINGDIPDLL name 'GdipSetPropertyItem'; + function GdipImageForceValidation; external WINGDIPDLL name 'GdipImageForceValidation'; + function GdipCreateBitmapFromStream; external WINGDIPDLL name 'GdipCreateBitmapFromStream'; + function GdipCreateBitmapFromFile; external WINGDIPDLL name 'GdipCreateBitmapFromFile'; + function GdipCreateBitmapFromStreamICM; external WINGDIPDLL name 'GdipCreateBitmapFromStreamICM'; + function GdipCreateBitmapFromFileICM; external WINGDIPDLL name 'GdipCreateBitmapFromFileICM'; + function GdipCreateBitmapFromScan0; external WINGDIPDLL name 'GdipCreateBitmapFromScan0'; + function GdipCreateBitmapFromGraphics; external WINGDIPDLL name 'GdipCreateBitmapFromGraphics'; + function GdipCreateBitmapFromGdiDib; external WINGDIPDLL name 'GdipCreateBitmapFromGdiDib'; + function GdipCreateBitmapFromHBITMAP; external WINGDIPDLL name 'GdipCreateBitmapFromHBITMAP'; + function GdipCreateHBITMAPFromBitmap; external WINGDIPDLL name 'GdipCreateHBITMAPFromBitmap'; + function GdipCreateBitmapFromHICON; external WINGDIPDLL name 'GdipCreateBitmapFromHICON'; + function GdipCreateHICONFromBitmap; external WINGDIPDLL name 'GdipCreateHICONFromBitmap'; + function GdipCreateBitmapFromResource; external WINGDIPDLL name 'GdipCreateBitmapFromResource'; + function GdipCloneBitmapArea; external WINGDIPDLL name 'GdipCloneBitmapArea'; + function GdipCloneBitmapAreaI; external WINGDIPDLL name 'GdipCloneBitmapAreaI'; + function GdipBitmapLockBits; external WINGDIPDLL name 'GdipBitmapLockBits'; + function GdipBitmapUnlockBits; external WINGDIPDLL name 'GdipBitmapUnlockBits'; + function GdipBitmapGetPixel; external WINGDIPDLL name 'GdipBitmapGetPixel'; + function GdipBitmapSetPixel; external WINGDIPDLL name 'GdipBitmapSetPixel'; + function GdipBitmapSetResolution; external WINGDIPDLL name 'GdipBitmapSetResolution'; + function GdipCreateImageAttributes; external WINGDIPDLL name 'GdipCreateImageAttributes'; + function GdipCloneImageAttributes; external WINGDIPDLL name 'GdipCloneImageAttributes'; + function GdipDisposeImageAttributes; external WINGDIPDLL name 'GdipDisposeImageAttributes'; + function GdipSetImageAttributesToIdentity; external WINGDIPDLL name 'GdipSetImageAttributesToIdentity'; + function GdipResetImageAttributes; external WINGDIPDLL name 'GdipResetImageAttributes'; + function GdipSetImageAttributesColorMatrix; external WINGDIPDLL name 'GdipSetImageAttributesColorMatrix'; + function GdipSetImageAttributesThreshold; external WINGDIPDLL name 'GdipSetImageAttributesThreshold'; + function GdipSetImageAttributesGamma; external WINGDIPDLL name 'GdipSetImageAttributesGamma'; + function GdipSetImageAttributesNoOp; external WINGDIPDLL name 'GdipSetImageAttributesNoOp'; + function GdipSetImageAttributesColorKeys; external WINGDIPDLL name 'GdipSetImageAttributesColorKeys'; + function GdipSetImageAttributesOutputChannel; external WINGDIPDLL name 'GdipSetImageAttributesOutputChannel'; + function GdipSetImageAttributesOutputChannelColorProfile; external WINGDIPDLL name 'GdipSetImageAttributesOutputChannelColorProfile'; + function GdipSetImageAttributesRemapTable; external WINGDIPDLL name 'GdipSetImageAttributesRemapTable'; + function GdipSetImageAttributesWrapMode; external WINGDIPDLL name 'GdipSetImageAttributesWrapMode'; + function GdipSetImageAttributesICMMode; external WINGDIPDLL name 'GdipSetImageAttributesICMMode'; + function GdipGetImageAttributesAdjustedPalette; external WINGDIPDLL name 'GdipGetImageAttributesAdjustedPalette'; + function GdipFlush; external WINGDIPDLL name 'GdipFlush'; + function GdipCreateFromHDC; external WINGDIPDLL name 'GdipCreateFromHDC'; + function GdipCreateFromHDC2; external WINGDIPDLL name 'GdipCreateFromHDC2'; + function GdipCreateFromHWND; external WINGDIPDLL name 'GdipCreateFromHWND'; + function GdipCreateFromHWNDICM; external WINGDIPDLL name 'GdipCreateFromHWNDICM'; + function GdipDeleteGraphics; external WINGDIPDLL name 'GdipDeleteGraphics'; + function GdipGetDC; external WINGDIPDLL name 'GdipGetDC'; + function GdipReleaseDC; external WINGDIPDLL name 'GdipReleaseDC'; + function GdipSetCompositingMode; external WINGDIPDLL name 'GdipSetCompositingMode'; + function GdipGetCompositingMode; external WINGDIPDLL name 'GdipGetCompositingMode'; + function GdipSetRenderingOrigin; external WINGDIPDLL name 'GdipSetRenderingOrigin'; + function GdipGetRenderingOrigin; external WINGDIPDLL name 'GdipGetRenderingOrigin'; + function GdipSetCompositingQuality; external WINGDIPDLL name 'GdipSetCompositingQuality'; + function GdipGetCompositingQuality; external WINGDIPDLL name 'GdipGetCompositingQuality'; + function GdipSetSmoothingMode; external WINGDIPDLL name 'GdipSetSmoothingMode'; + function GdipGetSmoothingMode; external WINGDIPDLL name 'GdipGetSmoothingMode'; + function GdipSetPixelOffsetMode; external WINGDIPDLL name 'GdipSetPixelOffsetMode'; + function GdipGetPixelOffsetMode; external WINGDIPDLL name 'GdipGetPixelOffsetMode'; + function GdipSetTextRenderingHint; external WINGDIPDLL name 'GdipSetTextRenderingHint'; + function GdipGetTextRenderingHint; external WINGDIPDLL name 'GdipGetTextRenderingHint'; + function GdipSetTextContrast; external WINGDIPDLL name 'GdipSetTextContrast'; + function GdipGetTextContrast; external WINGDIPDLL name 'GdipGetTextContrast'; + function GdipSetInterpolationMode; external WINGDIPDLL name 'GdipSetInterpolationMode'; + function GdipGetInterpolationMode; external WINGDIPDLL name 'GdipGetInterpolationMode'; + function GdipSetWorldTransform; external WINGDIPDLL name 'GdipSetWorldTransform'; + function GdipResetWorldTransform; external WINGDIPDLL name 'GdipResetWorldTransform'; + function GdipMultiplyWorldTransform; external WINGDIPDLL name 'GdipMultiplyWorldTransform'; + function GdipTranslateWorldTransform; external WINGDIPDLL name 'GdipTranslateWorldTransform'; + function GdipScaleWorldTransform; external WINGDIPDLL name 'GdipScaleWorldTransform'; + function GdipRotateWorldTransform; external WINGDIPDLL name 'GdipRotateWorldTransform'; + function GdipGetWorldTransform; external WINGDIPDLL name 'GdipGetWorldTransform'; + function GdipResetPageTransform; external WINGDIPDLL name 'GdipResetPageTransform'; + function GdipGetPageUnit; external WINGDIPDLL name 'GdipGetPageUnit'; + function GdipGetPageScale; external WINGDIPDLL name 'GdipGetPageScale'; + function GdipSetPageUnit; external WINGDIPDLL name 'GdipSetPageUnit'; + function GdipSetPageScale; external WINGDIPDLL name 'GdipSetPageScale'; + function GdipGetDpiX; external WINGDIPDLL name 'GdipGetDpiX'; + function GdipGetDpiY; external WINGDIPDLL name 'GdipGetDpiY'; + function GdipTransformPoints; external WINGDIPDLL name 'GdipTransformPoints'; + function GdipTransformPointsI; external WINGDIPDLL name 'GdipTransformPointsI'; + function GdipGetNearestColor; external WINGDIPDLL name 'GdipGetNearestColor'; + function GdipCreateHalftonePalette; external WINGDIPDLL name 'GdipCreateHalftonePalette'; + function GdipDrawLine; external WINGDIPDLL name 'GdipDrawLine'; + function GdipDrawLineI; external WINGDIPDLL name 'GdipDrawLineI'; + function GdipDrawLines; external WINGDIPDLL name 'GdipDrawLines'; + function GdipDrawLinesI; external WINGDIPDLL name 'GdipDrawLinesI'; + function GdipDrawArc; external WINGDIPDLL name 'GdipDrawArc'; + function GdipDrawArcI; external WINGDIPDLL name 'GdipDrawArcI'; + function GdipDrawBezier; external WINGDIPDLL name 'GdipDrawBezier'; + function GdipDrawBezierI; external WINGDIPDLL name 'GdipDrawBezierI'; + function GdipDrawBeziers; external WINGDIPDLL name 'GdipDrawBeziers'; + function GdipDrawBeziersI; external WINGDIPDLL name 'GdipDrawBeziersI'; + function GdipDrawRectangle; external WINGDIPDLL name 'GdipDrawRectangle'; + function GdipDrawRectangleI; external WINGDIPDLL name 'GdipDrawRectangleI'; + function GdipDrawRectangles; external WINGDIPDLL name 'GdipDrawRectangles'; + function GdipDrawRectanglesI; external WINGDIPDLL name 'GdipDrawRectanglesI'; + function GdipDrawEllipse; external WINGDIPDLL name 'GdipDrawEllipse'; + function GdipDrawEllipseI; external WINGDIPDLL name 'GdipDrawEllipseI'; + function GdipDrawPie; external WINGDIPDLL name 'GdipDrawPie'; + function GdipDrawPieI; external WINGDIPDLL name 'GdipDrawPieI'; + function GdipDrawPolygon; external WINGDIPDLL name 'GdipDrawPolygon'; + function GdipDrawPolygonI; external WINGDIPDLL name 'GdipDrawPolygonI'; + function GdipDrawPath; external WINGDIPDLL name 'GdipDrawPath'; + function GdipDrawCurve; external WINGDIPDLL name 'GdipDrawCurve'; + function GdipDrawCurveI; external WINGDIPDLL name 'GdipDrawCurveI'; + function GdipDrawCurve2; external WINGDIPDLL name 'GdipDrawCurve2'; + function GdipDrawCurve2I; external WINGDIPDLL name 'GdipDrawCurve2I'; + function GdipDrawCurve3; external WINGDIPDLL name 'GdipDrawCurve3'; + function GdipDrawCurve3I; external WINGDIPDLL name 'GdipDrawCurve3I'; + function GdipDrawClosedCurve; external WINGDIPDLL name 'GdipDrawClosedCurve'; + function GdipDrawClosedCurveI; external WINGDIPDLL name 'GdipDrawClosedCurveI'; + function GdipDrawClosedCurve2; external WINGDIPDLL name 'GdipDrawClosedCurve2'; + function GdipDrawClosedCurve2I; external WINGDIPDLL name 'GdipDrawClosedCurve2I'; + function GdipGraphicsClear; external WINGDIPDLL name 'GdipGraphicsClear'; + function GdipFillRectangle; external WINGDIPDLL name 'GdipFillRectangle'; + function GdipFillRectangleI; external WINGDIPDLL name 'GdipFillRectangleI'; + function GdipFillRectangles; external WINGDIPDLL name 'GdipFillRectangles'; + function GdipFillRectanglesI; external WINGDIPDLL name 'GdipFillRectanglesI'; + function GdipFillPolygon; external WINGDIPDLL name 'GdipFillPolygon'; + function GdipFillPolygonI; external WINGDIPDLL name 'GdipFillPolygonI'; + function GdipFillPolygon2; external WINGDIPDLL name 'GdipFillPolygon2'; + function GdipFillPolygon2I; external WINGDIPDLL name 'GdipFillPolygon2I'; + function GdipFillEllipse; external WINGDIPDLL name 'GdipFillEllipse'; + function GdipFillEllipseI; external WINGDIPDLL name 'GdipFillEllipseI'; + function GdipFillPie; external WINGDIPDLL name 'GdipFillPie'; + function GdipFillPieI; external WINGDIPDLL name 'GdipFillPieI'; + function GdipFillPath; external WINGDIPDLL name 'GdipFillPath'; + function GdipFillClosedCurve; external WINGDIPDLL name 'GdipFillClosedCurve'; + function GdipFillClosedCurveI; external WINGDIPDLL name 'GdipFillClosedCurveI'; + function GdipFillClosedCurve2; external WINGDIPDLL name 'GdipFillClosedCurve2'; + function GdipFillClosedCurve2I; external WINGDIPDLL name 'GdipFillClosedCurve2I'; + function GdipFillRegion; external WINGDIPDLL name 'GdipFillRegion'; + function GdipDrawImage; external WINGDIPDLL name 'GdipDrawImage'; + function GdipDrawImageI; external WINGDIPDLL name 'GdipDrawImageI'; + function GdipDrawImageRect; external WINGDIPDLL name 'GdipDrawImageRect'; + function GdipDrawImageRectI; external WINGDIPDLL name 'GdipDrawImageRectI'; + function GdipDrawImagePoints; external WINGDIPDLL name 'GdipDrawImagePoints'; + function GdipDrawImagePointsI; external WINGDIPDLL name 'GdipDrawImagePointsI'; + function GdipDrawImagePointRect; external WINGDIPDLL name 'GdipDrawImagePointRect'; + function GdipDrawImagePointRectI; external WINGDIPDLL name 'GdipDrawImagePointRectI'; + function GdipDrawImageRectRect; external WINGDIPDLL name 'GdipDrawImageRectRect'; + function GdipDrawImageRectRectI; external WINGDIPDLL name 'GdipDrawImageRectRectI'; + function GdipDrawImagePointsRect; external WINGDIPDLL name 'GdipDrawImagePointsRect'; + function GdipDrawImagePointsRectI; external WINGDIPDLL name 'GdipDrawImagePointsRectI'; + function GdipEnumerateMetafileDestPoint; external WINGDIPDLL name 'GdipEnumerateMetafileDestPoint'; + function GdipEnumerateMetafileDestPointI; external WINGDIPDLL name 'GdipEnumerateMetafileDestPointI'; + function GdipEnumerateMetafileDestRect; external WINGDIPDLL name 'GdipEnumerateMetafileDestRect'; + function GdipEnumerateMetafileDestRectI; external WINGDIPDLL name 'GdipEnumerateMetafileDestRectI'; + function GdipEnumerateMetafileDestPoints; external WINGDIPDLL name 'GdipEnumerateMetafileDestPoints'; + function GdipEnumerateMetafileDestPointsI; external WINGDIPDLL name 'GdipEnumerateMetafileDestPointsI'; + function GdipEnumerateMetafileSrcRectDestPoint; external WINGDIPDLL name 'GdipEnumerateMetafileSrcRectDestPoint'; + function GdipEnumerateMetafileSrcRectDestPointI; external WINGDIPDLL name 'GdipEnumerateMetafileSrcRectDestPointI'; + function GdipEnumerateMetafileSrcRectDestRect; external WINGDIPDLL name 'GdipEnumerateMetafileSrcRectDestRect'; + function GdipEnumerateMetafileSrcRectDestRectI; external WINGDIPDLL name 'GdipEnumerateMetafileSrcRectDestRectI'; + function GdipEnumerateMetafileSrcRectDestPoints; external WINGDIPDLL name 'GdipEnumerateMetafileSrcRectDestPoints'; + function GdipEnumerateMetafileSrcRectDestPointsI; external WINGDIPDLL name 'GdipEnumerateMetafileSrcRectDestPointsI'; + function GdipPlayMetafileRecord; external WINGDIPDLL name 'GdipPlayMetafileRecord'; + function GdipSetClipGraphics; external WINGDIPDLL name 'GdipSetClipGraphics'; + function GdipSetClipRect; external WINGDIPDLL name 'GdipSetClipRect'; + function GdipSetClipRectI; external WINGDIPDLL name 'GdipSetClipRectI'; + function GdipSetClipPath; external WINGDIPDLL name 'GdipSetClipPath'; + function GdipSetClipRegion; external WINGDIPDLL name 'GdipSetClipRegion'; + function GdipSetClipHrgn; external WINGDIPDLL name 'GdipSetClipHrgn'; + function GdipResetClip; external WINGDIPDLL name 'GdipResetClip'; + function GdipTranslateClip; external WINGDIPDLL name 'GdipTranslateClip'; + function GdipTranslateClipI; external WINGDIPDLL name 'GdipTranslateClipI'; + function GdipGetClip; external WINGDIPDLL name 'GdipGetClip'; + function GdipGetClipBounds; external WINGDIPDLL name 'GdipGetClipBounds'; + function GdipGetClipBoundsI; external WINGDIPDLL name 'GdipGetClipBoundsI'; + function GdipIsClipEmpty; external WINGDIPDLL name 'GdipIsClipEmpty'; + function GdipGetVisibleClipBounds; external WINGDIPDLL name 'GdipGetVisibleClipBounds'; + function GdipGetVisibleClipBoundsI; external WINGDIPDLL name 'GdipGetVisibleClipBoundsI'; + function GdipIsVisibleClipEmpty; external WINGDIPDLL name 'GdipIsVisibleClipEmpty'; + function GdipIsVisiblePoint; external WINGDIPDLL name 'GdipIsVisiblePoint'; + function GdipIsVisiblePointI; external WINGDIPDLL name 'GdipIsVisiblePointI'; + function GdipIsVisibleRect; external WINGDIPDLL name 'GdipIsVisibleRect'; + function GdipIsVisibleRectI; external WINGDIPDLL name 'GdipIsVisibleRectI'; + function GdipSaveGraphics; external WINGDIPDLL name 'GdipSaveGraphics'; + function GdipRestoreGraphics; external WINGDIPDLL name 'GdipRestoreGraphics'; + function GdipBeginContainer; external WINGDIPDLL name 'GdipBeginContainer'; + function GdipBeginContainerI; external WINGDIPDLL name 'GdipBeginContainerI'; + function GdipBeginContainer2; external WINGDIPDLL name 'GdipBeginContainer2'; + function GdipEndContainer; external WINGDIPDLL name 'GdipEndContainer'; + function GdipGetMetafileHeaderFromWmf; external WINGDIPDLL name 'GdipGetMetafileHeaderFromWmf'; + function GdipGetMetafileHeaderFromEmf; external WINGDIPDLL name 'GdipGetMetafileHeaderFromEmf'; + function GdipGetMetafileHeaderFromFile; external WINGDIPDLL name 'GdipGetMetafileHeaderFromFile'; + function GdipGetMetafileHeaderFromStream; external WINGDIPDLL name 'GdipGetMetafileHeaderFromStream'; + function GdipGetMetafileHeaderFromMetafile; external WINGDIPDLL name 'GdipGetMetafileHeaderFromMetafile'; + function GdipGetHemfFromMetafile; external WINGDIPDLL name 'GdipGetHemfFromMetafile'; + function GdipCreateStreamOnFile; external WINGDIPDLL name 'GdipCreateStreamOnFile'; + function GdipCreateMetafileFromWmf; external WINGDIPDLL name 'GdipCreateMetafileFromWmf'; + function GdipCreateMetafileFromEmf; external WINGDIPDLL name 'GdipCreateMetafileFromEmf'; + function GdipCreateMetafileFromFile; external WINGDIPDLL name 'GdipCreateMetafileFromFile'; + function GdipCreateMetafileFromWmfFile; external WINGDIPDLL name 'GdipCreateMetafileFromWmfFile'; + function GdipCreateMetafileFromStream; external WINGDIPDLL name 'GdipCreateMetafileFromStream'; + function GdipRecordMetafile; external WINGDIPDLL name 'GdipRecordMetafile'; + function GdipRecordMetafileI; external WINGDIPDLL name 'GdipRecordMetafileI'; + function GdipRecordMetafileFileName; external WINGDIPDLL name 'GdipRecordMetafileFileName'; + function GdipRecordMetafileFileNameI; external WINGDIPDLL name 'GdipRecordMetafileFileNameI'; + function GdipRecordMetafileStream; external WINGDIPDLL name 'GdipRecordMetafileStream'; + function GdipRecordMetafileStreamI; external WINGDIPDLL name 'GdipRecordMetafileStreamI'; + function GdipSetMetafileDownLevelRasterizationLimit; external WINGDIPDLL name 'GdipSetMetafileDownLevelRasterizationLimit'; + function GdipGetMetafileDownLevelRasterizationLimit; external WINGDIPDLL name 'GdipGetMetafileDownLevelRasterizationLimit'; + function GdipGetImageDecodersSize; external WINGDIPDLL name 'GdipGetImageDecodersSize'; + function GdipGetImageDecoders; external WINGDIPDLL name 'GdipGetImageDecoders'; + function GdipGetImageEncodersSize; external WINGDIPDLL name 'GdipGetImageEncodersSize'; + function GdipGetImageEncoders; external WINGDIPDLL name 'GdipGetImageEncoders'; + function GdipComment; external WINGDIPDLL name 'GdipComment'; + function GdipCreateFontFamilyFromName; external WINGDIPDLL name 'GdipCreateFontFamilyFromName'; + function GdipDeleteFontFamily; external WINGDIPDLL name 'GdipDeleteFontFamily'; + function GdipCloneFontFamily; external WINGDIPDLL name 'GdipCloneFontFamily'; + function GdipGetGenericFontFamilySansSerif; external WINGDIPDLL name 'GdipGetGenericFontFamilySansSerif'; + function GdipGetGenericFontFamilySerif; external WINGDIPDLL name 'GdipGetGenericFontFamilySerif'; + function GdipGetGenericFontFamilyMonospace; external WINGDIPDLL name 'GdipGetGenericFontFamilyMonospace'; + function GdipGetFamilyName; external WINGDIPDLL name 'GdipGetFamilyName'; + function GdipIsStyleAvailable; external WINGDIPDLL name 'GdipIsStyleAvailable'; + function GdipFontCollectionEnumerable; external WINGDIPDLL name 'GdipFontCollectionEnumerable'; + function GdipFontCollectionEnumerate; external WINGDIPDLL name 'GdipFontCollectionEnumerate'; + function GdipGetEmHeight; external WINGDIPDLL name 'GdipGetEmHeight'; + function GdipGetCellAscent; external WINGDIPDLL name 'GdipGetCellAscent'; + function GdipGetCellDescent; external WINGDIPDLL name 'GdipGetCellDescent'; + function GdipGetLineSpacing; external WINGDIPDLL name 'GdipGetLineSpacing'; + function GdipCreateFontFromDC; external WINGDIPDLL name 'GdipCreateFontFromDC'; + function GdipCreateFontFromLogfontA; external WINGDIPDLL name 'GdipCreateFontFromLogfontA'; + function GdipCreateFontFromLogfontW; external WINGDIPDLL name 'GdipCreateFontFromLogfontW'; + function GdipCreateFont; external WINGDIPDLL name 'GdipCreateFont'; + function GdipCloneFont; external WINGDIPDLL name 'GdipCloneFont'; + function GdipDeleteFont; external WINGDIPDLL name 'GdipDeleteFont'; + function GdipGetFamily; external WINGDIPDLL name 'GdipGetFamily'; + function GdipGetFontStyle; external WINGDIPDLL name 'GdipGetFontStyle'; + function GdipGetFontSize; external WINGDIPDLL name 'GdipGetFontSize'; + function GdipGetFontUnit; external WINGDIPDLL name 'GdipGetFontUnit'; + function GdipGetFontHeight; external WINGDIPDLL name 'GdipGetFontHeight'; + function GdipGetFontHeightGivenDPI; external WINGDIPDLL name 'GdipGetFontHeightGivenDPI'; + function GdipGetLogFontA; external WINGDIPDLL name 'GdipGetLogFontA'; + function GdipGetLogFontW; external WINGDIPDLL name 'GdipGetLogFontW'; + function GdipNewInstalledFontCollection; external WINGDIPDLL name 'GdipNewInstalledFontCollection'; + function GdipNewPrivateFontCollection; external WINGDIPDLL name 'GdipNewPrivateFontCollection'; + function GdipDeletePrivateFontCollection; external WINGDIPDLL name 'GdipDeletePrivateFontCollection'; + function GdipGetFontCollectionFamilyCount; external WINGDIPDLL name 'GdipGetFontCollectionFamilyCount'; + function GdipGetFontCollectionFamilyList; external WINGDIPDLL name 'GdipGetFontCollectionFamilyList'; + function GdipPrivateAddFontFile; external WINGDIPDLL name 'GdipPrivateAddFontFile'; + function GdipPrivateAddMemoryFont; external WINGDIPDLL name 'GdipPrivateAddMemoryFont'; + function GdipDrawString; external WINGDIPDLL name 'GdipDrawString'; + function GdipMeasureString; external WINGDIPDLL name 'GdipMeasureString'; + function GdipMeasureCharacterRanges; external WINGDIPDLL name 'GdipMeasureCharacterRanges'; + function GdipDrawDriverString; external WINGDIPDLL name 'GdipDrawDriverString'; + function GdipMeasureDriverString; external WINGDIPDLL name 'GdipMeasureDriverString'; + function GdipCreateStringFormat; external WINGDIPDLL name 'GdipCreateStringFormat'; + function GdipStringFormatGetGenericDefault; external WINGDIPDLL name 'GdipStringFormatGetGenericDefault'; + function GdipStringFormatGetGenericTypographic; external WINGDIPDLL name 'GdipStringFormatGetGenericTypographic'; + function GdipDeleteStringFormat; external WINGDIPDLL name 'GdipDeleteStringFormat'; + function GdipCloneStringFormat; external WINGDIPDLL name 'GdipCloneStringFormat'; + function GdipSetStringFormatFlags; external WINGDIPDLL name 'GdipSetStringFormatFlags'; + function GdipGetStringFormatFlags; external WINGDIPDLL name 'GdipGetStringFormatFlags'; + function GdipSetStringFormatAlign; external WINGDIPDLL name 'GdipSetStringFormatAlign'; + function GdipGetStringFormatAlign; external WINGDIPDLL name 'GdipGetStringFormatAlign'; + function GdipSetStringFormatLineAlign; external WINGDIPDLL name 'GdipSetStringFormatLineAlign'; + function GdipGetStringFormatLineAlign; external WINGDIPDLL name 'GdipGetStringFormatLineAlign'; + function GdipSetStringFormatTrimming; external WINGDIPDLL name 'GdipSetStringFormatTrimming'; + function GdipGetStringFormatTrimming; external WINGDIPDLL name 'GdipGetStringFormatTrimming'; + function GdipSetStringFormatHotkeyPrefix; external WINGDIPDLL name 'GdipSetStringFormatHotkeyPrefix'; + function GdipGetStringFormatHotkeyPrefix; external WINGDIPDLL name 'GdipGetStringFormatHotkeyPrefix'; + function GdipSetStringFormatTabStops; external WINGDIPDLL name 'GdipSetStringFormatTabStops'; + function GdipGetStringFormatTabStops; external WINGDIPDLL name 'GdipGetStringFormatTabStops'; + function GdipGetStringFormatTabStopCount; external WINGDIPDLL name 'GdipGetStringFormatTabStopCount'; + function GdipSetStringFormatDigitSubstitution; external WINGDIPDLL name 'GdipSetStringFormatDigitSubstitution'; + function GdipGetStringFormatDigitSubstitution; external WINGDIPDLL name 'GdipGetStringFormatDigitSubstitution'; + function GdipGetStringFormatMeasurableCharacterRangeCount; external WINGDIPDLL name 'GdipGetStringFormatMeasurableCharacterRangeCount'; + function GdipSetStringFormatMeasurableCharacterRanges; external WINGDIPDLL name 'GdipSetStringFormatMeasurableCharacterRanges'; + function GdipCreateCachedBitmap; external WINGDIPDLL name 'GdipCreateCachedBitmap'; + function GdipDeleteCachedBitmap; external WINGDIPDLL name 'GdipDeleteCachedBitmap'; + function GdipDrawCachedBitmap; external WINGDIPDLL name 'GdipDrawCachedBitmap'; + function GdipEmfToWmfBits; external WINGDIPDLL name 'GdipEmfToWmfBits'; + +// ----------------------------------------------------------------------------- +// TGdiplusBase class +// ----------------------------------------------------------------------------- + + class function TGdiplusBase.NewInstance: TObject; + begin + Result := InitInstance(GdipAlloc(ULONG(instanceSize))); + end; + + procedure TGdiplusBase.FreeInstance; + begin + CleanupInstance; + GdipFree(Self); + end; + +// ----------------------------------------------------------------------------- +// macros +// ----------------------------------------------------------------------------- + +function ObjectTypeIsValid(type_: ObjectType): BOOL; +begin + result := ((type_ >= ObjectTypeMin) and (type_ <= ObjectTypeMax)); +end; + +function GDIP_WMF_RECORD_TO_EMFPLUS(n: integer): Integer; +begin + result := (n or GDIP_WMF_RECORD_BASE); +end; + +function GDIP_EMFPLUS_RECORD_TO_WMF(n: integer): Integer; +begin + result := n and (not GDIP_WMF_RECORD_BASE); +end; + +function GDIP_IS_WMF_RECORDTYPE(n: integer): BOOL; +begin + result := ((n and GDIP_WMF_RECORD_BASE) <> 0); +end; + + +//-------------------------------------------------------------------------- +// TGPPoint Util +//-------------------------------------------------------------------------- + + function MakePoint(X, Y: Integer): TGPPoint; + begin + result.X := X; + result.Y := Y; + end; + + function MakePoint(X, Y: Single): TGPPointF; + begin + Result.X := X; + result.Y := Y; + end; + +//-------------------------------------------------------------------------- +// TGPSize Util +//-------------------------------------------------------------------------- + + function MakeSize(Width, Height: Single): TGPSizeF; + begin + result.Width := Width; + result.Height := Height; + end; + + function MakeSize(Width, Height: Integer): TGPSize; + begin + result.Width := Width; + result.Height := Height; + end; + +//-------------------------------------------------------------------------- +// TCharacterRange Util +//-------------------------------------------------------------------------- + + function MakeCharacterRange(First, Length: Integer): TCharacterRange; + begin + result.First := First; + result.Length := Length; + end; + +// ----------------------------------------------------------------------------- +// RectF class +// ----------------------------------------------------------------------------- + + function MakeRect(x, y, width, height: Single): TGPRectF; overload; + begin + Result.X := x; + Result.Y := y; + Result.Width := width; + Result.Height := height; + end; + + function MakeRect(location: TGPPointF; size: TGPSizeF): TGPRectF; overload; + begin + Result.X := location.X; + Result.Y := location.Y; + Result.Width := size.Width; + Result.Height := size.Height; + end; + +// ----------------------------------------------------------------------------- +// Rect class +// ----------------------------------------------------------------------------- + + function MakeRect(x, y, width, height: Integer): TGPRect; overload; + begin + Result.X := x; + Result.Y := y; + Result.Width := width; + Result.Height := height; + end; + + function MakeRect(location: TGPPoint; size: TGPSize): TGPRect; overload; + begin + Result.X := location.X; + Result.Y := location.Y; + Result.Width := size.Width; + Result.Height := size.Height; + end; + + function MakeRect(const Rect: TRect): TGPRect; + begin + Result.X := rect.Left; + Result.Y := Rect.Top; + Result.Width := Rect.Right-Rect.Left; + Result.Height:= Rect.Bottom-Rect.Top; + end; + +// ----------------------------------------------------------------------------- +// PathData class +// ----------------------------------------------------------------------------- + + constructor TPathData.Create; + begin + Count := 0; + Points := nil; + Types := nil; + end; + + destructor TPathData.destroy; + begin + if assigned(Points) then freemem(Points); + if assigned(Types) then freemem(Types); + end; + + +function GetPixelFormatSize(pixfmt: PixelFormat): UINT; +begin + result := (pixfmt shr 8) and $ff; +end; + +function IsIndexedPixelFormat(pixfmt: PixelFormat): BOOL; +begin + result := (pixfmt and PixelFormatIndexed) <> 0; +end; + +function IsAlphaPixelFormat(pixfmt: PixelFormat): BOOL; +begin + result := (pixfmt and PixelFormatAlpha) <> 0; +end; + +function IsExtendedPixelFormat(pixfmt: PixelFormat): BOOL; +begin + result := (pixfmt and PixelFormatExtended) <> 0; +end; + +function IsCanonicalPixelFormat(pixfmt: PixelFormat): BOOL; +begin + result := (pixfmt and PixelFormatCanonical) <> 0; +end; + +// ----------------------------------------------------------------------------- +// Color class +// ----------------------------------------------------------------------------- + +{ constructor TGPColor.Create; + begin + Argb := DWORD(Black); + end; + + // Construct an opaque Color object with + // the specified Red, Green, Blue values. + // + // Color values are not premultiplied. + + constructor TGPColor.Create(r, g, b: Byte); + begin + Argb := MakeARGB(255, r, g, b); + end; + + constructor TGPColor.Create(a, r, g, b: Byte); + begin + Argb := MakeARGB(a, r, g, b); + end; + + constructor TGPColor.Create(Value: ARGB); + begin + Argb := Value; + end; + + function TGPColor.GetAlpha: BYTE; + begin + result := BYTE(Argb shr AlphaShift); + end; + + function TGPColor.GetA: BYTE; + begin + result := GetAlpha; + end; + + function TGPColor.GetRed: BYTE; + begin + result := BYTE(Argb shr RedShift); + end; + + function TGPColor.GetR: BYTE; + begin + result := GetRed; + end; + + function TGPColor.GetGreen: Byte; + begin + result := BYTE(Argb shr GreenShift); + end; + + function TGPColor.GetG: Byte; + begin + result := GetGreen; + end; + + function TGPColor.GetBlue: Byte; + begin + result := BYTE(Argb shr BlueShift); + end; + + function TGPColor.GetB: Byte; + begin + result := GetBlue; + end; + + function TGPColor.GetValue: ARGB; + begin + result := Argb; + end; + + procedure TGPColor.SetValue(Value: ARGB); + begin + Argb := Value; + end; + + procedure TGPColor.SetFromCOLORREF(rgb: COLORREF); + begin + Argb := MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); + end; + + function TGPColor.ToCOLORREF: COLORREF; + begin + result := RGB(GetRed, GetGreen, GetBlue); + end; + + function TGPColor.MakeARGB(a, r, g, b: Byte): ARGB; + begin + result := ((DWORD(b) shl BlueShift) or + (DWORD(g) shl GreenShift) or + (DWORD(r) shl RedShift) or + (DWORD(a) shl AlphaShift)); + end; } + + function MakeColor(r, g, b: Byte): ARGB; overload; + begin + result := MakeColor(255, r, g, b); + end; + + function MakeColor(a, r, g, b: Byte): ARGB; overload; + begin + result := ((DWORD(b) shl BlueShift) or + (DWORD(g) shl GreenShift) or + (DWORD(r) shl RedShift) or + (DWORD(a) shl AlphaShift)); + end; + + function GetAlpha(color: ARGB): BYTE; + begin + result := BYTE(color shr AlphaShift); + end; + + function GetRed(color: ARGB): BYTE; + begin + result := BYTE(color shr RedShift); + end; + + function GetGreen(color: ARGB): BYTE; + begin + result := BYTE(color shr GreenShift); + end; + + function GetBlue(color: ARGB): BYTE; + begin + result := BYTE(color shr BlueShift); + end; + + function ColorRefToARGB(rgb: COLORREF): ARGB; + begin + result := MakeColor(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); + end; + + function ARGBToColorRef(Color: ARGB): COLORREF; + begin + result := RGB(GetRed(Color), GetGreen(Color), GetBlue(Color)); + end; + + +// ----------------------------------------------------------------------------- +// MetafileHeader class +// ----------------------------------------------------------------------------- + + procedure TMetafileHeader.GetBounds(out Rect: TGPRect); + begin + rect.X := X; + rect.Y := Y; + rect.Width := Width; + rect.Height := Height; + end; + + function TMetafileHeader.IsWmf: BOOL; + begin + result := ((Type_ = MetafileTypeWmf) or (Type_ = MetafileTypeWmfPlaceable)); + end; + + function TMetafileHeader.IsWmfPlaceable: BOOL; + begin + result := (Type_ = MetafileTypeWmfPlaceable); + end; + + function TMetafileHeader.IsEmf: BOOL; + begin + result := (Type_ = MetafileTypeEmf); + end; + + function TMetafileHeader.IsEmfOrEmfPlus: BOOL; + begin + result := (Type_ >= MetafileTypeEmf); + end; + + function TMetafileHeader.IsEmfPlus: BOOL; + begin + result := (Type_ >= MetafileTypeEmfPlusOnly) + end; + + function TMetafileHeader.IsEmfPlusDual: BOOL; + begin + result := (Type_ = MetafileTypeEmfPlusDual) + end; + + function TMetafileHeader.IsEmfPlusOnly: BOOL; + begin + result := (Type_ = MetafileTypeEmfPlusOnly) + end; + + function TMetafileHeader.IsDisplay: BOOL; + begin + result := (IsEmfPlus and ((EmfPlusFlags and GDIP_EMFPLUSFLAGS_DISPLAY) <> 0)); + end; + + function TMetafileHeader.GetWmfHeader: PMetaHeader; + begin + if IsWmf then result := @Header.WmfHeader + else result := nil; + end; + + function TMetafileHeader.GetEmfHeader: PENHMETAHEADER3; + begin + if IsEmfOrEmfPlus then result := @Header.EmfHeader + else result := nil; + end; + +end. + + + diff --git a/Pramougolnik/GDIPOBJ.dcu b/Pramougolnik/GDIPOBJ.dcu new file mode 100644 index 0000000..d4aed85 Binary files /dev/null and b/Pramougolnik/GDIPOBJ.dcu differ diff --git a/Pramougolnik/GDIPOBJ.pas b/Pramougolnik/GDIPOBJ.pas new file mode 100644 index 0000000..2415a65 --- /dev/null +++ b/Pramougolnik/GDIPOBJ.pas @@ -0,0 +1,7975 @@ + {******************************************************************} + { GDI+ Class } + { } + { home page : http://www.progdigy.com } + { email : hgourvest@progdigy.com } + { } + { date : 15-02-2002 } + { } + { The contents of this file are used with permission, subject to } + { the Mozilla Public License Version 1.1 (the "License"); you may } + { not use this file except in compliance with the License. You may } + { obtain a copy of the License at } + { http://www.mozilla.org/MPL/MPL-1.1.html } + { } + { Software distributed under the License is distributed on an } + { "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } + { implied. See the License for the specific language governing } + { rights and limitations under the License. } + { } + { *****************************************************************} + +unit GDIPOBJ; + +interface +uses + Windows, + ActiveX, + GDIPAPI; + +(**************************************************************************\ +* +* GDI+ Codec Image APIs +* +\**************************************************************************) + +//-------------------------------------------------------------------------- +// Codec Management APIs +//-------------------------------------------------------------------------- + + function GetImageDecodersSize(out numDecoders, size: UINT): TStatus; + function GetImageDecoders(numDecoders, size: UINT; + decoders: PImageCodecInfo): TStatus; + function GetImageEncodersSize(out numEncoders, size: UINT): TStatus; + function GetImageEncoders(numEncoders, size: UINT; + encoders: PImageCodecInfo): TStatus; + +(**************************************************************************\ +* +* Private GDI+ header file. +* +\**************************************************************************) + +//--------------------------------------------------------------------------- +// GDI+ classes for forward reference +//--------------------------------------------------------------------------- + +type + TGPGraphics = class; + TGPPen = class; + TGPBrush = class; + TGPMatrix = class; + TGPBitmap = class; + TGPMetafile = class; + TGPFontFamily = class; + TGPGraphicsPath = class; + TGPRegion = class; + TGPImage = class; + TGPHatchBrush = class; + TGPSolidBrush = class; + TGPLinearGradientBrush = class; + TGPPathGradientBrush = class; + TGPFont = class; + TGPFontCollection = class; + TGPInstalledFontCollection = class; + TGPPrivateFontCollection = class; + TGPImageAttributes = class; + TGPCachedBitmap = class; + +(**************************************************************************\ +* +* GDI+ Region, Font, Image, CustomLineCap class definitions. +* +\**************************************************************************) + + TGPRegion = class(TGdiplusBase) + protected + nativeRegion: GpRegion; + lastResult: TStatus; + function SetStatus(status: TStatus): TStatus; + procedure SetNativeRegion(nativeRegion: GpRegion); + constructor Create(nativeRegion: GpRegion); reintroduce; overload; + public + constructor Create; reintroduce; overload; + constructor Create(rect: TGPRectF); reintroduce; overload; + constructor Create(rect: TGPRect); reintroduce; overload; + constructor Create(path: TGPGraphicsPath); reintroduce; overload; + constructor Create(regionData: PBYTE; size: Integer); reintroduce; overload; + constructor Create(hRgn: HRGN); reintroduce; overload; + function FromHRGN(hRgn: HRGN): TGPRegion; + destructor Destroy; override; + function Clone: TGPRegion; + function MakeInfinite: TStatus; + function MakeEmpty: TStatus; + function GetDataSize: UINT; + // buffer - where to put the data + // bufferSize - how big the buffer is (should be at least as big as GetDataSize()) + // sizeFilled - if not NULL, this is an OUT param that says how many bytes + // of data were written to the buffer. + function GetData(buffer: PBYTE; bufferSize: UINT; + sizeFilled: PUINT = nil): TStatus; + function Intersect(const rect: TGPRect): TStatus; overload; + function Intersect(const rect: TGPRectF): TStatus; overload; + function Intersect(path: TGPGraphicsPath): TStatus; overload; + function Intersect(region: TGPRegion): TStatus; overload; + function Union(const rect: TGPRect): TStatus; overload; + function Union(const rect: TGPRectF): TStatus; overload; + function Union(path: TGPGraphicsPath): TStatus; overload; + function Union(region: TGPRegion): TStatus; overload; + function Xor_(const rect: TGPRect): TStatus; overload; + function Xor_(const rect: TGPRectF): TStatus; overload; + function Xor_(path: TGPGraphicsPath): TStatus; overload; + function Xor_(region: TGPRegion): TStatus; overload; + function Exclude(const rect: TGPRect): TStatus; overload; + function Exclude(const rect: TGPRectF): TStatus; overload; + function Exclude(path: TGPGraphicsPath): TStatus; overload; + function Exclude(region: TGPRegion): TStatus; overload; + function Complement(const rect: TGPRect): TStatus; overload; + function Complement(const rect: TGPRectF): TStatus; overload; + function Complement(path: TGPGraphicsPath): TStatus; overload; + function Complement(region: TGPRegion): TStatus; overload; + function Translate(dx, dy: Single): TStatus; overload; + function Translate(dx, dy: Integer): TStatus; overload; + function Transform(matrix: TGPMatrix): TStatus; + function GetBounds(out rect: TGPRect; g: TGPGraphics): TStatus; overload; + function GetBounds(out rect: TGPRectF; g: TGPGraphics): TStatus; overload; + function GetHRGN(g: TGPGraphics): HRGN; + function IsEmpty(g: TGPGraphics): BOOL; + function IsInfinite(g: TGPGraphics): BOOL ; + function IsVisible(x, y: Integer; g: TGPGraphics = nil): BOOL; overload; + function IsVisible(const point: TGPPoint; g: TGPGraphics = nil): BOOL; overload; + function IsVisible(x, y: Single; g: TGPGraphics = nil): BOOL; overload; + function IsVisible(const point: TGPPointF; g: TGPGraphics = nil): BOOL; overload; + function IsVisible(x, y, width, height: Integer; g: TGPGraphics): BOOL; overload; + function IsVisible(const rect: TGPRect; g: TGPGraphics = nil): BOOL; overload; + function IsVisible(x, y, width, height: Single; g: TGPGraphics = nil): BOOL; overload; + function IsVisible(const rect: TGPRectF; g: TGPGraphics = nil): BOOL; overload; + function Equals(region: TGPRegion; g: TGPGraphics): BOOL; + function GetRegionScansCount(matrix: TGPMatrix): UINT; + function GetRegionScans(matrix: TGPMatrix ;rects: PGPRectF; out count: Integer): TStatus; overload; + function GetRegionScans(matrix: TGPMatrix; rects: PGPRect; out count: Integer): TStatus; overload; + function GetLastStatus: TStatus; + end; + +//-------------------------------------------------------------------------- +// FontFamily +//-------------------------------------------------------------------------- + + TGPFontFamily = class(TGdiplusBase) + protected + nativeFamily: GpFontFamily; + lastResult: TStatus; + function SetStatus(status: TStatus): TStatus; + constructor Create(nativeOrig: GpFontFamily; + status: TStatus); reintroduce; overload; + public + constructor Create; reintroduce; overload; + constructor Create(name: WideString; fontCollection: TGPFontCollection = nil); reintroduce; overload; + destructor Destroy; override; + class function GenericSansSerif: TGPFontFamily; + class function GenericSerif: TGPFontFamily; + class function GenericMonospace: TGPFontFamily; + function GetFamilyName(out name: String; language: LANGID = 0): TStatus; + function Clone: TGPFontFamily; + function IsAvailable: BOOL; + function IsStyleAvailable(style: Integer): BOOL; + function GetEmHeight(style: Integer): UINT16; + function GetCellAscent(style: Integer): UINT16; + function GetCellDescent(style: Integer): UINT16; + function GetLineSpacing(style: Integer): UINT16; + function GetLastStatus: TStatus; + end; + +//-------------------------------------------------------------------------- +// Font Collection +//-------------------------------------------------------------------------- + + TGPFontCollection = class(TGdiplusBase) + protected + nativeFontCollection: GpFontCollection; + lastResult: TStatus; + function SetStatus(status: TStatus): TStatus; + public + constructor Create; + destructor Destroy; override; + function GetFamilyCount: Integer; + function GetFamilies(numSought: Integer; out gpfamilies: array of TGPFontFamily; + out numFound: Integer): TStatus; + function GetLastStatus: TStatus; + end; + + TGPInstalledFontCollection = class(TGPFontCollection) + public + constructor Create; reintroduce; + destructor Destroy; override; + end; + + TGPPrivateFontCollection = class(TGPFontCollection) + public + constructor Create; reintroduce; + destructor destroy; override; + function AddFontFile(filename: WideString): TStatus; + function AddMemoryFont(memory: Pointer; length: Integer): TStatus; + end; + +//-------------------------------------------------------------------------- +// TFont +//-------------------------------------------------------------------------- + + TGPFont = class(TGdiplusBase) + protected + nativeFont: GpFont; + lastResult: TStatus; + procedure SetNativeFont(Font: GpFont); + function SetStatus(status: TStatus): TStatus; + constructor Create(font: GpFont; status: TStatus); overload; + public + constructor Create(hdc: HDC); reintroduce; overload; + constructor Create(hdc: HDC; logfont: PLogFontA); reintroduce; overload; + constructor Create(hdc: HDC; logfont: PLogFontW); reintroduce; overload; + constructor Create(hdc: HDC; hfont: HFONT); reintroduce; overload; + constructor Create(family: TGPFontFamily; emSize: Single; + style: TFontStyle = FontStyleRegular; + unit_: TUnit = UnitPoint); reintroduce; overload; + constructor Create(familyName: WideString; emSize: Single; + style: TFontStyle = FontStyleRegular; unit_: TUnit = UnitPoint; + fontCollection: TGPFontCollection = nil); reintroduce; overload; + function GetLogFontA(g: TGPGraphics; out logfontA: TLogFontA): TStatus; + function GetLogFontW(g: TGPGraphics; out logfontW: TLogFontW): TStatus; + function Clone: TGPFont; + destructor Destroy; override; + function IsAvailable: BOOL; + function GetStyle: Integer; + function GetSize: Single; + function GetUnit: TUnit; + function GetLastStatus: TStatus; + function GetHeight(graphics: TGPGraphics): Single; overload; + function GetHeight(dpi: Single): Single; overload; + function GetFamily(family: TGPFontFamily): TStatus; + end; + +//-------------------------------------------------------------------------- +// Abstract base class for Image and Metafile +//-------------------------------------------------------------------------- + + TGPImage = class(TGdiplusBase) + protected + nativeImage: GpImage; + lastResult: TStatus; + loadStatus: TStatus; + procedure SetNativeImage(nativeImage: GpImage); + function SetStatus(status: TStatus): TStatus; + constructor Create(nativeImage: GpImage; status: TStatus); reintroduce; overload; + public + constructor Create(filename: WideString; useEmbeddedColorManagement: BOOL = FALSE); reintroduce; overload; + constructor Create(stream: IStream; useEmbeddedColorManagement: BOOL = FALSE); reintroduce; overload; + function FromFile(filename: WideString; useEmbeddedColorManagement: BOOL = FALSE): TGPImage; + function FromStream(stream: IStream; useEmbeddedColorManagement: BOOL = FALSE): TGPImage; + destructor destroy; override; + function Clone: TGPImage; + function Save(filename: WideString; const clsidEncoder: TGUID; + encoderParams: PEncoderParameters = nil): TStatus; overload; + function Save(stream: IStream; const clsidEncoder: TGUID; + encoderParams: PEncoderParameters = nil): TStatus; overload; + function SaveAdd(encoderParams: PEncoderParameters): TStatus; overload; + function SaveAdd(newImage: TGPImage; encoderParams: PEncoderParameters): TStatus; overload; + function GetType: TImageType; + function GetPhysicalDimension(out size: TGPSizeF): TStatus; + function GetBounds(out srcRect: TGPRectF; out srcUnit: TUnit): TStatus; + function GetWidth: UINT; + function GetHeight: UINT; + function GetHorizontalResolution: Single; + function GetVerticalResolution: Single; + function GetFlags: UINT; + function GetRawFormat(out format: TGUID): TStatus; + function GetPixelFormat: TPixelFormat; + function GetPaletteSize: Integer; + function GetPalette(palette: PColorPalette; size: Integer): TStatus; + function SetPalette(palette: PColorPalette): TStatus; + function GetThumbnailImage(thumbWidth, thumbHeight: UINT; + callback: GetThumbnailImageAbort = nil; callbackData: pointer = nil): TGPImage; + function GetFrameDimensionsCount: UINT; + function GetFrameDimensionsList(dimensionIDs: PGUID; count: UINT): TStatus; + function GetFrameCount(const dimensionID: TGUID): UINT; + function SelectActiveFrame(const dimensionID: TGUID; frameIndex: UINT): TStatus; + function RotateFlip(rotateFlipType: TRotateFlipType): TStatus; + function GetPropertyCount: UINT; + function GetPropertyIdList(numOfProperty: UINT; list: PPropID): TStatus; + function GetPropertyItemSize(propId: PROPID): UINT; + function GetPropertyItem(propId: PROPID; propSize: UINT; buffer: PPropertyItem): TStatus; + function GetPropertySize(out totalBufferSize, numProperties : UINT): TStatus; + function GetAllPropertyItems(totalBufferSize, numProperties: UINT; + allItems: PPROPERTYITEM): TStatus; + function RemovePropertyItem(propId: TPROPID): TStatus; + function SetPropertyItem(const item: TPropertyItem): TStatus; + function GetEncoderParameterListSize(const clsidEncoder: TGUID): UINT; + function GetEncoderParameterList(const clsidEncoder: TGUID; size: UINT; + buffer: PEncoderParameters): TStatus; + function GetLastStatus: TStatus; + end; + + TGPBitmap = class(TGPImage) + protected + constructor Create(nativeBitmap: GpBitmap); reintroduce; overload; + public + constructor Create(filename: WideString; useEmbeddedColorManagement: BOOL = FALSE); reintroduce; overload; + constructor Create(stream: IStream; useEmbeddedColorManagement: BOOL = FALSE); reintroduce; overload; + function FromFile(filename: WideString; useEmbeddedColorManagement: BOOL = FALSE): TGPBitmap; + function FromStream(stream: IStream; useEmbeddedColorManagement: BOOL = FALSE): TGPBitmap; + constructor Create(width, height, stride: Integer; format: TPixelFormat; scan0: PBYTE); reintroduce; overload; + constructor Create(width, height: Integer; format: TPixelFormat = PixelFormat32bppARGB); reintroduce; overload; + constructor Create(width, height: Integer; target: TGPGraphics); reintroduce; overload; + function Clone(rect: TGPRect; format: TPixelFormat): TGPBitmap; overload; + function Clone(x, y, width, height: Integer; format: TPixelFormat): TGPBitmap; overload; + function Clone(rect: TGPRectF; format: TPixelFormat): TGPBitmap; overload; + function Clone(x, y, width, height: Single; format: TPixelFormat): TGPBitmap; overload; + function LockBits(rect: TGPRect; flags: UINT; format: TPixelFormat; out lockedBitmapData: TBitmapData): TStatus; + function UnlockBits(var lockedBitmapData: TBitmapData): TStatus; + function GetPixel(x, y: Integer; out color: TGPColor): TStatus; + function SetPixel(x, y: Integer; color: TGPColor): TStatus; + function SetResolution(xdpi, ydpi: Single): TStatus; + constructor Create(var gdiBitmapInfo: TBITMAPINFO; gdiBitmapData: Pointer); reintroduce; overload; + constructor Create(hbm: HBITMAP; hpal: HPALETTE); reintroduce; overload; + constructor Create(hicon: HICON); reintroduce; overload; + constructor Create(hInstance: HMODULE; bitmapName: WideString); reintroduce; overload; + function FromBITMAPINFO(var gdiBitmapInfo: TBITMAPINFO; gdiBitmapData: Pointer): TGPBitmap; + function FromHBITMAP(hbm: HBITMAP; hpal: HPALETTE): TGPBitmap; + function FromHICON(hicon: HICON): TGPBitmap; + function FromResource(hInstance: HMODULE; bitmapName: WideString): TGPBitmap; + function GetHBITMAP(colorBackground: TGPColor; out hbmReturn: HBITMAP): TStatus; + function GetHICON(out hicon: HICON): TStatus; + end; + + TGPCustomLineCap = class(TGdiplusBase) + protected + nativeCap: GpCustomLineCap; + lastResult: TStatus; + procedure SetNativeCap(nativeCap: GpCustomLineCap); + function SetStatus(status: TStatus): TStatus; + constructor Create(nativeCap: GpCustomLineCap; + status: TStatus); reintroduce; overload; + public + constructor Create; reintroduce; overload; + constructor Create(fillPath, strokePath: TGPGraphicsPath; + baseCap: TLineCap = LineCapFlat; + baseInset: Single = 0); reintroduce; overload; + destructor Destroy; override; + function Clone: TGPCustomLineCap; + function SetStrokeCap(strokeCap: TLineCap): TStatus; + function SetStrokeCaps(startCap, endCap: TLineCap): TStatus; + function GetStrokeCaps(out startCap, endCap: TLineCap): TStatus; + function SetStrokeJoin(lineJoin: TLineJoin): TStatus; + function GetStrokeJoin: TLineJoin; + function SetBaseCap(baseCap: TLineCap): TStatus; + function GetBaseCap: TLineCap; + function SetBaseInset(inset: Single): TStatus; + function GetBaseInset: Single; + function SetWidthScale(widthScale: Single): TStatus; + function GetWidthScale: Single; + function GetLastStatus: TStatus; + end; + + TGPCachedBitmap = class(TGdiplusBase) + protected + nativeCachedBitmap: GpCachedBitmap; + lastResult: TStatus; + public + constructor Create(bitmap: TGPBitmap; graphics: TGPGraphics); reintroduce; + destructor Destroy; override; + function GetLastStatus: TStatus; + end; + +(**************************************************************************\ +* +* GDI+ Image Attributes used with Graphics.DrawImage +* +* There are 5 possible sets of color adjustments: +* ColorAdjustDefault, +* ColorAdjustBitmap, +* ColorAdjustBrush, +* ColorAdjustPen, +* ColorAdjustText, +* +* Bitmaps, Brushes, Pens, and Text will all use any color adjustments +* that have been set into the default ImageAttributes until their own +* color adjustments have been set. So as soon as any "Set" method is +* called for Bitmaps, Brushes, Pens, or Text, then they start from +* scratch with only the color adjustments that have been set for them. +* Calling Reset removes any individual color adjustments for a type +* and makes it revert back to using all the default color adjustments +* (if any). The SetToIdentity method is a way to force a type to +* have no color adjustments at all, regardless of what previous adjustments +* have been set for the defaults or for that type. +* +\********************************************************************F******) + + TGPImageAttributes = class(TGdiplusBase) + protected + nativeImageAttr: GpImageAttributes; + lastResult: TStatus; + procedure SetNativeImageAttr(nativeImageAttr: GpImageAttributes); + function SetStatus(status: TStatus): TStatus; + constructor Create(imageAttr: GpImageAttributes; + status: GpStatus); reintroduce; overload; + public + constructor Create; reintroduce; overload; + destructor Destroy; override; + function Clone: TGPImageAttributes; + function SetToIdentity(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function Reset(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function SetColorMatrix(const colorMatrix: TColorMatrix; + mode: TColorMatrixFlags = ColorMatrixFlagsDefault; + type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function ClearColorMatrix(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function SetColorMatrices(const colorMatrix: TColorMatrix; const grayMatrix: TColorMatrix; + mode: TColorMatrixFlags = ColorMatrixFlagsDefault; + type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function ClearColorMatrices(Type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function SetThreshold(threshold: Single; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function ClearThreshold(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function SetGamma(gamma: Single; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function ClearGamma( type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function SetNoOp(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function ClearNoOp(Type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function SetColorKey(colorLow, colorHigh: TGPColor; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function ClearColorKey(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function SetOutputChannel(channelFlags: TColorChannelFlags; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function ClearOutputChannel(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function SetOutputChannelColorProfile(colorProfileFilename: WideString; + type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function ClearOutputChannelColorProfile(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function SetRemapTable(mapSize: Cardinal; map: PColorMap; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function ClearRemapTable(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + function SetBrushRemapTable(mapSize: Cardinal; map: PColorMap): TStatus; + function ClearBrushRemapTable: TStatus; + function SetWrapMode(wrap: TWrapMode; color: TGPColor = aclBlack; clamp: BOOL = FALSE): TStatus; + // The flags of the palette are ignored. + function GetAdjustedPalette(colorPalette: PColorPalette; colorAdjustType: TColorAdjustType): TStatus; + function GetLastStatus: TStatus; + end; + +(**************************************************************************\ +* +* GDI+ Matrix class +* +\**************************************************************************) + + TMatrixArray = array[0..5] of Single; + + TGPMatrix = class(TGdiplusBase) + protected + nativeMatrix: GpMatrix; + lastResult: GpStatus ; + procedure SetNativeMatrix(nativeMatrix: GpMatrix); + function SetStatus(status: GpStatus): TStatus; + constructor Create(nativeMatrix: GpMatrix); reintroduce; overload; + public + // Default constructor is set to identity matrix. + constructor Create; reintroduce; overload; + constructor Create(m11, m12, m21, m22, dx, dy: Single); reintroduce; overload; + constructor Create(const rect: TGPRectF; const dstplg: TGPPointF); reintroduce; overload; + constructor Create(const rect: TGPRect; const dstplg: TGPPoint); reintroduce; overload; + destructor Destroy; override; + function Clone: TGPMatrix; + function GetElements(const m: TMatrixArray): TStatus; + function SetElements(m11, m12, m21, m22, dx, dy: Single): TStatus; + function OffsetX: Single; + function OffsetY: Single; + function Reset: TStatus; + function Multiply(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok + function Translate(offsetX, offsetY: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok + function Scale(scaleX, scaleY: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok + function Rotate(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok + function RotateAt(angle: Single; const center: TGPPointF; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok + function Shear(shearX, shearY: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok + function Invert: TStatus; // ok + + function TransformPoints(pts: PGPPointF; count: Integer = 1): TStatus; overload; + function TransformPoints(pts: PGPPoint; count: Integer = 1): TStatus; overload; + + function TransformVectors(pts: PGPPointF; count: Integer = 1): TStatus; overload; + function TransformVectors(pts: PGPPoint; count: Integer = 1): TStatus; overload; + + function IsInvertible: BOOL; + function IsIdentity: BOOL; + function Equals(matrix: TGPMatrix): BOOL; + function GetLastStatus: TStatus; + end; + +(**************************************************************************\ +* +* GDI+ Brush class +* +\**************************************************************************) + + //-------------------------------------------------------------------------- + // Abstract base class for various brush types + //-------------------------------------------------------------------------- + + TGPBrush = class(TGdiplusBase) + protected + nativeBrush: GpBrush; + lastResult: TStatus; + procedure SetNativeBrush(nativeBrush: GpBrush); + function SetStatus(status: TStatus): TStatus; + constructor Create(nativeBrush: GpBrush; status: TStatus); overload; + public + constructor Create; overload; + destructor Destroy; override; + function Clone: TGPBrush; virtual; + function GetType: TBrushType; + function GetLastStatus: TStatus; + end; + + //-------------------------------------------------------------------------- + // Solid Fill Brush Object + //-------------------------------------------------------------------------- + + TGPSolidBrush = class(TGPBrush) + public + constructor Create(color: TGPColor); reintroduce; overload; + constructor Create; reintroduce; overload; + function GetColor(out color: TGPColor): TStatus; + function SetColor(color: TGPColor): TStatus; + end; + + //-------------------------------------------------------------------------- + // Texture Brush Fill Object + //-------------------------------------------------------------------------- + + TGPTextureBrush = class(TGPBrush) + public + constructor Create(image: TGPImage; wrapMode: TWrapMode = WrapModeTile); reintroduce; overload; + constructor Create(image: TGPImage; wrapMode: TWrapMode; dstRect: TGPRectF); reintroduce; overload; + constructor Create(image: TGPImage; dstRect: TGPRectF; imageAttributes: TGPImageAttributes = nil); reintroduce; overload; + constructor Create(image: TGPImage; dstRect: TGPRect; imageAttributes: TGPImageAttributes = nil); reintroduce; overload; + constructor Create(image: TGPImage; wrapMode: TWrapMode; dstRect: TGPRect); reintroduce; overload; + constructor Create(image: TGPImage; wrapMode: TWrapMode; dstX, dstY, dstWidth, + dstHeight: Single); reintroduce; overload; + constructor Create(image: TGPImage; wrapMode: TWrapMode; dstX, dstY, dstWidth, + dstHeight: Integer); reintroduce; overload; + constructor Create; reintroduce; overload; + function SetTransform(matrix: TGPMatrix): TStatus; + function GetTransform(matrix: TGPMatrix): TStatus; + function ResetTransform: TStatus; + function MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function TranslateTransform(dx, dy: Single; order: MatrixOrder = MatrixOrderPrepend): TStatus; + function ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function SetWrapMode(wrapMode: TWrapMode): TStatus; + function GetWrapMode: TWrapMode; + function GetImage: TGPImage; + end; + + //-------------------------------------------------------------------------- + // Linear Gradient Brush Object + //-------------------------------------------------------------------------- + + TGPLinearGradientBrush = class(TGPBrush) + public + constructor Create; reintroduce; overload; + constructor Create(const point1, point2: TGPPointF; color1, + color2: TGPColor); reintroduce; overload; + constructor Create(const point1, point2: TGPPoint; color1, + color2: TGPColor); reintroduce; overload; + constructor Create(rect: TGPRectF; color1, color2: TGPColor; + mode: TLinearGradientMode); reintroduce; overload; + constructor Create(rect: TGPRect; color1, color2: TGPColor; + mode: TLinearGradientMode); reintroduce; overload; + constructor Create(rect: TGPRectF; color1, color2: TGPColor; angle: Single; + isAngleScalable: BOOL = FALSE); overload; + constructor Create(rect: TGPRect; color1, color2: TGPColor; angle: Single; + isAngleScalable: BOOL = FALSE); overload; + function SetLinearColors(color1, color2: TGPColor): TStatus; + function GetLinearColors(out color1, color2: TGPColor): TStatus; + function GetRectangle(out rect: TGPRectF): TStatus; overload; + function GetRectangle(out rect: TGPRect): TStatus; overload; + function SetGammaCorrection(useGammaCorrection: BOOL): TStatus; + function GetGammaCorrection: BOOL; + function GetBlendCount: Integer; + function SetBlend(blendFactors, blendPositions: PSingle; count: Integer): TStatus; + function GetBlend(blendFactors, blendPositions: PSingle; count: Integer): TStatus; + function GetInterpolationColorCount: Integer; + function SetInterpolationColors(presetColors: PGPColor; blendPositions: PSingle; count: Integer): TStatus; + function GetInterpolationColors(presetColors: PGPColor; blendPositions: PSingle; count: Integer): TStatus; + function SetBlendBellShape(focus: Single; scale: Single = 1.0): TStatus; + function SetBlendTriangularShape(focus: Single; scale: Single = 1.0): TStatus; + function SetTransform(matrix: TGPMatrix): TStatus; + function GetTransform(matrix: TGPMatrix): TStatus; + function ResetTransform: TStatus; + function MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function TranslateTransform(dx, dy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function SetWrapMode(wrapMode: TWrapMode): TStatus; + function GetWrapMode: TWrapMode; + end; + + //-------------------------------------------------------------------------- + // Hatch Brush Object + //-------------------------------------------------------------------------- + + TGPHatchBrush = class(TGPBrush) + public + constructor Create; reintroduce; overload; + constructor Create(hatchStyle: THatchStyle; foreColor: TGPColor; backColor: TGPColor = aclBlack); reintroduce; overload; // ok + function GetHatchStyle: THatchStyle; + function GetForegroundColor(out color: TGPColor): TStatus; + function GetBackgroundColor(out color: TGPColor): TStatus; + end; + +(**************************************************************************\ +* +* GDI+ Pen class +* +\**************************************************************************) + +//-------------------------------------------------------------------------- +// Pen class +//-------------------------------------------------------------------------- + + TGPPen = class(TGdiplusBase) + protected + nativePen: GpPen; + lastResult: TStatus; + procedure SetNativePen(nativePen: GpPen); + function SetStatus(status: TStatus): TStatus; + constructor Create(nativePen: GpPen; status: TStatus); reintroduce; overload; + public + constructor Create(color: TGPColor; width: Single = 1.0); reintroduce; overload; + constructor Create(brush: TGPBrush; width: Single = 1.0); reintroduce; overload; + destructor Destroy; override; + function Clone: TGPPen; + function SetWidth(width: Single): TStatus; + function GetWidth: Single; + // Set/get line caps: start, end, and dash + // Line cap and join APIs by using LineCap and LineJoin enums. + function SetLineCap(startCap, endCap: TLineCap; dashCap: TDashCap): TStatus; + function SetStartCap(startCap: TLineCap): TStatus; + function SetEndCap(endCap: TLineCap): TStatus; + function SetDashCap(dashCap: TDashCap): TStatus; + function GetStartCap: TLineCap; + function GetEndCap: TLineCap; + function GetDashCap: TDashCap; + function SetLineJoin(lineJoin: TLineJoin): TStatus; + function GetLineJoin: TLineJoin; + function SetCustomStartCap(customCap: TGPCustomLineCap): TStatus; + function GetCustomStartCap(customCap: TGPCustomLineCap): TStatus; + function SetCustomEndCap(customCap: TGPCustomLineCap): TStatus; + function GetCustomEndCap(customCap: TGPCustomLineCap): TStatus; + function SetMiterLimit(miterLimit: Single): TStatus; + function GetMiterLimit: Single; + function SetAlignment(penAlignment: TPenAlignment): TStatus; + function GetAlignment: TPenAlignment; + function SetTransform(matrix: TGPMatrix): TStatus; + function GetTransform(matrix: TGPMatrix): TStatus; + function ResetTransform: TStatus; + function MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function TranslateTransform(dx, dy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function GetPenType: TPenType; + function SetColor(color: TGPColor): TStatus; + function SetBrush(brush: TGPBrush): TStatus; + function GetColor(out Color: TGPColor): TStatus; + function GetBrush: TGPBrush; + function GetDashStyle: TDashStyle; + function SetDashStyle(dashStyle: TDashStyle): TStatus; + function GetDashOffset: Single; + function SetDashOffset(dashOffset: Single): TStatus; + function SetDashPattern(dashArray: PSingle; count: Integer): TStatus; + function GetDashPatternCount: Integer; + function GetDashPattern(dashArray: PSingle; count: Integer): TStatus; + function SetCompoundArray(compoundArray: PSingle; count: Integer): TStatus; + function GetCompoundArrayCount: Integer; + function GetCompoundArray(compoundArray: PSingle; count: Integer): TStatus; + function GetLastStatus: TStatus; + end; + +(**************************************************************************\ +* +* GDI+ StringFormat class +* +\**************************************************************************) + + TGPStringFormat = class(TGdiplusBase) + protected + nativeFormat: GpStringFormat; + lastError: TStatus; + function SetStatus(newStatus: GpStatus): TStatus; + procedure Assign(source: TGPStringFormat); + constructor Create(clonedStringFormat: GpStringFormat; status: TStatus); reintroduce; overload; + public + constructor Create(formatFlags: Integer = 0; language: LANGID = LANG_NEUTRAL); reintroduce; overload; + constructor Create(format: TGPStringFormat); reintroduce; overload; + destructor Destroy; override; + class function GenericDefault: TGPStringFormat; + class function GenericTypographic: TGPStringFormat; + function Clone: TGPStringFormat; + function SetFormatFlags(flags: Integer): TStatus; + function GetFormatFlags: Integer; + function SetAlignment(align: TStringAlignment): TStatus; + function GetAlignment: TStringAlignment; + function SetLineAlignment(align: TStringAlignment): TStatus; + function GetLineAlignment: TStringAlignment; + function SetHotkeyPrefix(hotkeyPrefix: THotkeyPrefix): TStatus; + function GetHotkeyPrefix: THotkeyPrefix; + function SetTabStops(firstTabOffset: Single; count: Integer; tabStops: PSingle): TStatus; + function GetTabStopCount: Integer; + function GetTabStops(count: Integer; firstTabOffset, tabStops: PSingle): TStatus; + function SetDigitSubstitution(language: LANGID; substitute: TStringDigitSubstitute): TStatus; + function GetDigitSubstitutionLanguage: LANGID; + function GetDigitSubstitutionMethod: TStringDigitSubstitute; + function SetTrimming(trimming: TStringTrimming): TStatus; + function GetTrimming: TStringTrimming; + function SetMeasurableCharacterRanges(rangeCount: Integer; ranges: PCharacterRange): TStatus; + function GetMeasurableCharacterRangeCount: Integer; + function GetLastStatus: TStatus; + end; + +(**************************************************************************\ +* +* GDI+ Graphics Path class +* +\**************************************************************************) + + TGPGraphicsPath = class(TGdiplusBase) + protected + nativePath: GpPath; + lastResult: TStatus; + procedure SetNativePath(nativePath: GpPath); + function SetStatus(status: TStatus): TStatus; + constructor Create(nativePath: GpPath); reintroduce; overload; + public + constructor Create(path: TGPGraphicsPath); reintroduce; overload; + constructor Create(fillMode: TFillMode = FillModeAlternate); reintroduce; overload; + constructor Create(points: PGPPointF; types: PBYTE; count: Integer; + fillMode: TFillMode = FillModeAlternate); reintroduce; overload; + constructor Create(points: PGPPoint; types: PBYTE; count: Integer; + fillMode: TFillMode = FillModeAlternate); reintroduce; overload; + destructor destroy; override; + function Clone: TGPGraphicsPath; + // Reset the path object to empty (and fill mode to FillModeAlternate) + function Reset: TStatus; + function GetFillMode: TFillMode; + function SetFillMode(fillmode: TFillMode): TStatus; + function GetPathData(pathData: TPathData): TStatus; + function StartFigure: TStatus; + function CloseFigure: TStatus; + function CloseAllFigures: TStatus; + function SetMarker: TStatus; + function ClearMarkers: TStatus; + function Reverse: TStatus; + function GetLastPoint(out lastPoint: TGPPointF): TStatus; + + function AddLine(const pt1, pt2: TGPPointF): TStatus; overload; + function AddLine(x1, y1, x2, y2: Single): TStatus; overload; + function AddLines(points: PGPPointF; count: Integer): TStatus; overload; + function AddLine(const pt1, pt2: TGPPoint): TStatus; overload; + function AddLine(x1, y1, x2, y2: Integer): TStatus; overload; + function AddLines(points: PGPPoint; count: Integer): TStatus; overload; + + function AddArc(rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; overload; + function AddArc(x, y, width, height, startAngle, sweepAngle: Single): TStatus; overload; + function AddArc(rect: TGPRect; startAngle, sweepAngle: Single): TStatus; overload; + function AddArc(x, y, width, height: Integer; startAngle, sweepAngle: Single): TStatus; overload; + + function AddBezier(pt1, pt2, pt3, pt4: TGPPointF): TStatus; overload; + function AddBezier(x1, y1, x2, y2, x3, y3, x4, y4: Single): TStatus; overload; + function AddBeziers(points: PGPPointF; count: Integer): TStatus; overload; + function AddBezier(pt1, pt2, pt3, pt4: TGPPoint): TStatus; overload; + function AddBezier(x1, y1, x2, y2, x3, y3, x4, y4: Integer): TStatus; overload; + function AddBeziers(points: PGPPoint; count: Integer): TStatus; overload; + + function AddCurve(points: PGPPointF; count: Integer): TStatus; overload; + function AddCurve(points: PGPPointF; count: Integer; tension: Single): TStatus; overload; + function AddCurve(points: PGPPointF; count, offset, numberOfSegments: Integer; tension: Single): TStatus; overload; + function AddCurve(points: PGPPoint; count: Integer): TStatus; overload; + function AddCurve(points: PGPPoint; count: Integer; tension: Single): TStatus; overload; + function AddCurve(points: PGPPoint; count, offset, numberOfSegments: Integer; tension: Single): TStatus; overload; + + function AddClosedCurve(points: PGPPointF; count: Integer): TStatus; overload; + function AddClosedCurve(points: PGPPointF; count: Integer; tension: Single): TStatus; overload; + function AddClosedCurve(points: PGPPoint; count: Integer): TStatus; overload; + function AddClosedCurve(points: PGPPoint; count: Integer; tension: Single): TStatus; overload; + + function AddRectangle(rect: TGPRectF): TStatus; overload; + function AddRectangles(rects: PGPRectF; count: Integer): TStatus; overload; + function AddRectangle(rect: TGPRect): TStatus; overload; + function AddRectangles(rects: PGPRect; count: Integer): TStatus; overload; + + function AddEllipse(rect: TGPRectF): TStatus; overload; + function AddEllipse(x, y, width, height: Single): TStatus; overload; + function AddEllipse(rect: TGPRect): TStatus; overload; + function AddEllipse(x, y, width, height: Integer): TStatus; overload; + + function AddPie(rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; overload; + function AddPie(x, y, width, height, startAngle, sweepAngle: Single): TStatus; overload; + function AddPie(rect: TGPRect; startAngle, sweepAngle: Single): TStatus; overload; + function AddPie(x, y, width, height: Integer; startAngle, sweepAngle: Single): TStatus; overload; + + function AddPolygon(points: PGPPointF; count: Integer): TStatus; overload; + function AddPolygon(points: PGPPoint; count: Integer): TStatus; overload; + + function AddPath(addingPath: TGPGraphicsPath; connect: Bool): TStatus; + + function AddString(string_: WideString; length: Integer; family : TGPFontFamily; + style : Integer; emSize : Single; origin : TGPPointF; format : TGPStringFormat): TStatus; overload; + function AddString(string_: WideString; length : Integer; family : TGPFontFamily; + style : Integer; emSize : Single; layoutRect: TGPRectF; format : TGPStringFormat): TStatus; overload; + function AddString(string_: WideString; length : Integer; family : TGPFontFamily; + style : Integer; emSize : Single; origin : TGPPoint; format : TGPStringFormat): TStatus; overload; + function AddString(string_: WideString; length : Integer; family : TGPFontFamily; + style : Integer; emSize : Single; layoutRect: TGPRect; format : TGPStringFormat): TStatus; overload; + + function Transform(matrix: TGPMatrix): TStatus; + + // This is not always the tightest bounds. + function GetBounds(out bounds: TGPRectF; matrix: TGPMatrix = nil; pen: TGPPen = nil): TStatus; overload; + function GetBounds(out bounds: TGPRect; matrix: TGPMatrix = nil; pen: TGPPen = nil): TStatus; overload; + // Once flattened, the resultant path is made of line segments and + // the original path information is lost. When matrix is NULL the + // identity matrix is assumed. + function Flatten(matrix: TGPMatrix = nil; flatness: Single = FlatnessDefault): TStatus; + function Widen(pen: TGPPen; matrix: TGPMatrix = nil; flatness: Single = FlatnessDefault): TStatus; + function Outline(matrix: TGPMatrix = nil; flatness: Single = FlatnessDefault): TStatus; + // Once this is called, the resultant path is made of line segments and + // the original path information is lost. When matrix is NULL, the + // identity matrix is assumed. + function Warp(destPoints: PGPPointF; count: Integer; srcRect: TGPRectF; + matrix: TGPMatrix = nil; warpMode: TWarpMode = WarpModePerspective; + flatness: Single = FlatnessDefault): TStatus; + function GetPointCount: Integer; + function GetPathTypes(types: PBYTE; count: Integer): TStatus; + function GetPathPoints(points: PGPPointF; count: Integer): TStatus; overload; + function GetPathPoints(points: PGPPoint; count: Integer): TStatus; overload; + function GetLastStatus: TStatus; + + function IsVisible(point: TGPPointF; g: TGPGraphics = nil): BOOL; overload; + function IsVisible(x, y: Single; g: TGPGraphics = nil): BOOL; overload; + function IsVisible(point: TGPPoint; g : TGPGraphics = nil): BOOL; overload; + function IsVisible(x, y: Integer; g: TGPGraphics = nil): BOOL; overload; + + function IsOutlineVisible(point: TGPPointF; pen: TGPPen; g: TGPGraphics = nil): BOOL; overload; + function IsOutlineVisible(x, y: Single; pen: TGPPen; g: TGPGraphics = nil): BOOL; overload; + function IsOutlineVisible(point: TGPPoint; pen: TGPPen; g: TGPGraphics = nil): BOOL; overload; + function IsOutlineVisible(x, y: Integer; pen: TGPPen; g: TGPGraphics = nil): BOOL; overload; + end; + +//-------------------------------------------------------------------------- +// GraphisPathIterator class +//-------------------------------------------------------------------------- + + TGPGraphicsPathIterator = class(TGdiplusBase) + protected + nativeIterator: GpPathIterator; + lastResult : TStatus; + procedure SetNativeIterator(nativeIterator: GpPathIterator); + function SetStatus(status: TStatus): TStatus; + public + constructor Create(path: TGPGraphicsPath); reintroduce; + destructor Destroy; override; + function NextSubpath(out startIndex, endIndex: Integer; out isClosed: bool): Integer; overload; + function NextSubpath(path: TGPGraphicsPath; out isClosed: BOOL): Integer; overload; + function NextPathType(out pathType: TPathPointType; out startIndex, endIndex: Integer): Integer; + function NextMarker(out startIndex, endIndex: Integer): Integer; overload; + function NextMarker(path: TGPGraphicsPath): Integer; overload; + function GetCount: Integer; + function GetSubpathCount: Integer; + function HasCurve: BOOL; + procedure Rewind; + function Enumerate(points: PGPPointF; types: PBYTE; count: Integer): Integer; + function CopyData(points: PGPPointF; types: PBYTE; startIndex, endIndex: Integer): Integer; + function GetLastStatus: TStatus; + end; + +//-------------------------------------------------------------------------- +// Path Gradient Brush +//-------------------------------------------------------------------------- + + TGPPathGradientBrush = class(TGPBrush) + public + constructor Create(points: PGPPointF; count: Integer; + wrapMode: TWrapMode = WrapModeClamp); reintroduce; overload; + constructor Create(points: PGPPoint; count: Integer; + wrapMode: TWrapMode = WrapModeClamp); reintroduce; overload; + constructor Create(path: TGPGraphicsPath); reintroduce; overload; + constructor Create; reintroduce; overload; + function GetCenterColor(out Color: TGPColor): TStatus; + function SetCenterColor(color: TGPColor): TStatus; + function GetPointCount: Integer; + function GetSurroundColorCount: Integer; + function GetSurroundColors(colors: PARGB; var count: Integer): TStatus; + function SetSurroundColors(colors: PARGB; var count: Integer): TStatus; + function GetGraphicsPath(path: TGPGraphicsPath): TStatus; + function SetGraphicsPath(path: TGPGraphicsPath): TStatus; + function GetCenterPoint(out point: TGPPointF): TStatus; overload; + function GetCenterPoint(out point: TGPPoint): TStatus; overload; + function SetCenterPoint(point: TGPPointF): TStatus; overload; + function SetCenterPoint(point: TGPPoint): TStatus; overload; + function GetRectangle(out rect: TGPRectF): TStatus; overload; + function GetRectangle(out rect: TGPRect): TStatus; overload; + function SetGammaCorrection(useGammaCorrection: BOOL): TStatus; overload; + function GetGammaCorrection: BOOL; overload; + function GetBlendCount: Integer; + function GetBlend(blendFactors, blendPositions: PSingle; count: Integer): TStatus; + function SetBlend(blendFactors, blendPositions: PSingle; count: Integer): TStatus; + function GetInterpolationColorCount: Integer; + function SetInterpolationColors(presetColors: PARGB; blendPositions: PSingle; + count: Integer): TStatus; + function GetInterpolationColors(presetColors: PARGB; + blendPositions: PSingle; count: Integer): TStatus; + function SetBlendBellShape(focus: Single; scale: Single = 1.0): TStatus; + function SetBlendTriangularShape(focus: Single; scale: Single = 1.0): TStatus; + function GetTransform(matrix: TGPMatrix): TStatus; + function SetTransform(matrix: TGPMatrix): TStatus; + function ResetTransform: TStatus; + function MultiplyTransform(matrix: TGPMatrix; + order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function TranslateTransform(dx, dy: Single; + order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function ScaleTransform(sx, sy: Single; + order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function RotateTransform(angle: Single; + order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function GetFocusScales(out xScale, yScale: Single): TStatus; + function SetFocusScales(xScale, yScale: Single): TStatus; + function GetWrapMode: TWrapMode; + function SetWrapMode(wrapMode: TWrapMode): TStatus; + end; + +(**************************************************************************\ +* +* GDI+ Graphics Object +* +\**************************************************************************) + + TGPGraphics = class(TGdiplusBase) + protected + nativeGraphics: GpGraphics; + lastResult: TStatus; + procedure SetNativeGraphics(graphics: GpGraphics); + function SetStatus(status: TStatus): TStatus; + function GetNativeGraphics: GpGraphics; + function GetNativePen(pen: TGPPen): GpPen; + constructor Create(graphics: GpGraphics); reintroduce; overload; + public + function FromHDC(hdc: HDC): TGPGraphics; overload; + function FromHDC(hdc: HDC; hdevice: THANDLE): TGPGraphics; overload; + function FromHWND(hwnd: HWND; icm: BOOL = FALSE): TGPGraphics; + function FromImage(image: TGPImage): TGPGraphics; + constructor Create(hdc: HDC); reintroduce; overload; + constructor Create(hdc: HDC; hdevice: THANDLE); reintroduce; overload; + constructor Create(hwnd: HWND; icm: BOOL{ = FALSE}); reintroduce; overload; + constructor Create(image: TGPImage); reintroduce; overload; + destructor destroy; override; + procedure Flush(intention: TFlushIntention = FlushIntentionFlush); + //------------------------------------------------------------------------ + // GDI Interop methods + //------------------------------------------------------------------------ + // Locks the graphics until ReleaseDC is called + function GetHDC: HDC; + procedure ReleaseHDC(hdc: HDC); + //------------------------------------------------------------------------ + // Rendering modes + //------------------------------------------------------------------------ + function SetRenderingOrigin(x, y: Integer): TStatus; + function GetRenderingOrigin(out x, y: Integer): TStatus; + function SetCompositingMode(compositingMode: TCompositingMode): TStatus; + function GetCompositingMode: TCompositingMode; + function SetCompositingQuality(compositingQuality: TCompositingQuality): TStatus; + function GetCompositingQuality: TCompositingQuality; + function SetTextRenderingHint(newMode: TTextRenderingHint): TStatus; + function GetTextRenderingHint: TTextRenderingHint; + function SetTextContrast(contrast: UINT): TStatus; // 0..12 + function GetTextContrast: UINT; + function GetInterpolationMode: TInterpolationMode; + function SetInterpolationMode(interpolationMode: TInterpolationMode): TStatus; + function GetSmoothingMode: TSmoothingMode; + function SetSmoothingMode(smoothingMode: TSmoothingMode): TStatus; + function GetPixelOffsetMode: TPixelOffsetMode; + function SetPixelOffsetMode(pixelOffsetMode: TPixelOffsetMode): TStatus; + //------------------------------------------------------------------------ + // Manipulate current world transform + //------------------------------------------------------------------------ + function SetTransform(matrix: TGPMatrix): TStatus; + function ResetTransform: TStatus; + function MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function TranslateTransform(dx, dy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + function GetTransform(matrix: TGPMatrix): TStatus; + function SetPageUnit(unit_: TUnit): TStatus; + function SetPageScale(scale: Single): TStatus; + function GetPageUnit: TUnit; + function GetPageScale: Single; + function GetDpiX: Single; + function GetDpiY: Single; + function TransformPoints(destSpace: TCoordinateSpace; srcSpace: TCoordinateSpace; + pts: PGPPointF; count: Integer): TStatus; overload; + function TransformPoints(destSpace: TCoordinateSpace; srcSpace: TCoordinateSpace; + pts: PGPPoint; count: Integer): TStatus; overload; + //------------------------------------------------------------------------ + // GetNearestColor (for <= 8bpp surfaces). Note: Alpha is ignored. + //------------------------------------------------------------------------ + function GetNearestColor(var color: TGPColor): TStatus; + + // DrawLine(s) + function DrawLine(pen: TGPPen; x1, y1, x2, y2: Single): TStatus; overload; + function DrawLine(pen: TGPPen; const pt1, pt2: TGPPointF): TStatus; overload; + function DrawLines(pen: TGPPen; points: PGPPointF; count: Integer): TStatus; overload; + function DrawLine(pen: TGPPen; x1, y1, x2, y2: Integer): TStatus; overload; + function DrawLine(pen: TGPPen; const pt1, pt2: TGPPoint): TStatus; overload; + function DrawLines(pen: TGPPen; points: PGPPoint; count: Integer): TStatus; overload; + + // DrawArc + function DrawArc(pen: TGPPen; x, y, width, height, startAngle, sweepAngle: Single): TStatus; overload; + function DrawArc(pen: TGPPen; const rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; overload; + function DrawArc(pen: TGPPen; x, y, width, height: Integer; startAngle, sweepAngle: Single): TStatus; overload; + function DrawArc(pen: TGPPen; const rect: TGPRect; startAngle, sweepAngle: Single): TStatus; overload; + + // DrawBezier(s) + function DrawBezier(pen: TGPPen; x1, y1, x2, y2, x3, y3, x4, y4: Single): TStatus; overload; + function DrawBezier(pen: TGPPen; const pt1, pt2, pt3, pt4: TGPPointF): TStatus; overload; + function DrawBeziers(pen: TGPPen; points: PGPPointF; count: Integer): TStatus; overload; + function DrawBezier(pen: TGPPen; x1, y1, x2, y2, x3, y3, x4, y4: Integer): TStatus; overload; + function DrawBezier(pen: TGPPen; const pt1, pt2, pt3, pt4: TGPPoint): TStatus; overload; + function DrawBeziers(pen: TGPPen; points: PGPPoint; count: Integer): TStatus; overload; + + // DrawRectangle(s) + function DrawRectangle(pen: TGPPen; const rect: TGPRectF): TStatus; overload; + function DrawRectangle(pen: TGPPen; x, y, width, height: Single): TStatus; overload; + function DrawRectangles(pen: TGPPen; rects: PGPRectF; count: Integer): TStatus; overload; + function DrawRectangle(pen: TGPPen; const rect: TGPRect): TStatus; overload; + function DrawRectangle(pen: TGPPen; x, y, width, height: Integer): TStatus; overload; + function DrawRectangles(pen: TGPPen; rects: PGPRect; count: Integer): TStatus; overload; + + // DrawEllipse + function DrawEllipse(pen: TGPPen; const rect: TGPRectF): TStatus; overload; + function DrawEllipse(pen: TGPPen; x, y, width, height: Single): TStatus; overload; + function DrawEllipse(pen: TGPPen; const rect: TGPRect): TStatus; overload; + function DrawEllipse(pen: TGPPen; x, y, width, height: Integer): TStatus; overload; + + // DrawPie + function DrawPie(pen: TGPPen; const rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; overload; + function DrawPie(pen: TGPPen; x, y, width, height, startAngle, sweepAngle: Single): TStatus; overload; + function DrawPie(pen: TGPPen; const rect: TGPRect; startAngle, sweepAngle: Single): TStatus; overload; + function DrawPie(pen: TGPPen; x, y, width, height: Integer; startAngle, sweepAngle: Single): TStatus; overload; + + // DrawPolygon + function DrawPolygon(pen: TGPPen; points: PGPPointF; count: Integer): TStatus; overload; + function DrawPolygon(pen: TGPPen; points: PGPPoint; count: Integer): TStatus; overload; + + // DrawPath + function DrawPath(pen: TGPPen; path: TGPGraphicsPath): TStatus; + + // DrawCurve + function DrawCurve(pen: TGPPen; points: PGPPointF; count: Integer): TStatus; overload; + function DrawCurve(pen: TGPPen; points: PGPPointF; count: Integer; tension: Single): TStatus; overload; + function DrawCurve(pen: TGPPen; points: PGPPointF; count, offset, + numberOfSegments: Integer; tension: Single = 0.5): TStatus; overload; + function DrawCurve(pen: TGPPen; points: PGPPoint; count: Integer): TStatus; overload; + function DrawCurve(pen: TGPPen; points: PGPPoint; count: Integer; tension: Single): TStatus; overload; + function DrawCurve(pen: TGPPen; points: PGPPoint; count, offset, numberOfSegments: Integer; + tension: Single = 0.5): TStatus; overload; + + // DrawClosedCurve + function DrawClosedCurve(pen: TGPPen; points: PGPPointF; count: Integer): TStatus; overload; + function DrawClosedCurve(pen: TGPPen; points: PGPPointF; count: Integer; tension: Single): TStatus; overload; + function DrawClosedCurve(pen: TGPPen; points: PGPPoint; count: Integer): TStatus; overload; + function DrawClosedCurve(pen: TGPPen; points: PGPPoint; count: Integer; tension: Single): TStatus; overload; + + // Clear + function Clear(color: TGPColor): TStatus; + + // FillRectangle(s) + function FillRectangle(brush: TGPBrush; const rect: TGPRectF): TStatus; overload; + function FillRectangle(brush: TGPBrush; x, y, width, height: Single): TStatus; overload; + function FillRectangles(brush: TGPBrush; rects: PGPRectF; count: Integer): TStatus; overload; + function FillRectangle(brush: TGPBrush; const rect: TGPRect): TStatus; overload; + function FillRectangle(brush: TGPBrush; x, y, width, height: Integer): TStatus; overload; + function FillRectangles(brush: TGPBrush; rects: PGPRect; count: Integer): TStatus; overload; + + // FillPolygon + function FillPolygon(brush: TGPBrush; points: PGPPointF; count: Integer): TStatus; overload; + function FillPolygon(brush: TGPBrush; points: PGPPointF; count: Integer; fillMode: TFillMode): TStatus; overload; + function FillPolygon(brush: TGPBrush; points: PGPPoint; count: Integer): TStatus; overload; + function FillPolygon(brush: TGPBrush; points: PGPPoint; count: Integer; fillMode: TFillMode): TStatus; overload; + + // FillEllipse + function FillEllipse(brush: TGPBrush; const rect: TGPRectF): TStatus; overload; + function FillEllipse(brush: TGPBrush; x, y, width, height: Single): TStatus; overload; + function FillEllipse(brush: TGPBrush; const rect: TGPRect): TStatus; overload; + function FillEllipse(brush: TGPBrush; x, y, width, height: Integer): TStatus; overload; + + // FillPie + function FillPie(brush: TGPBrush; const rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; overload; + function FillPie(brush: TGPBrush; x, y, width, height, startAngle, sweepAngle: Single): TStatus; overload; + function FillPie(brush: TGPBrush; const rect: TGPRect; startAngle, sweepAngle: Single): TStatus; overload; + function FillPie(brush: TGPBrush; x, y, width, height: Integer; startAngle, sweepAngle: Single): TStatus; overload; + + // FillPath + function FillPath(brush: TGPBrush; path: TGPGraphicsPath): TStatus; + + // FillClosedCurve + function FillClosedCurve(brush: TGPBrush; points: PGPPointF; count: Integer): TStatus; overload; + function FillClosedCurve(brush: TGPBrush; points: PGPPointF; count: Integer; + fillMode: TFillMode; tension: Single = 0.5 ): TStatus; overload; + function FillClosedCurve(brush: TGPBrush; points: PGPPoint; count: Integer): TStatus; overload; + function FillClosedCurve(brush: TGPBrush; points: PGPPoint; count: Integer; + fillMode: TFillMode; tension: Single = 0.5): TStatus; overload; + + // FillRegion + function FillRegion(brush: TGPBrush; region: TGPRegion): TStatus; + + // DrawString + function DrawString(string_: WideString; length: Integer; font: TGPFont; + const layoutRect: TGPRectF; stringFormat: TGPStringFormat; brush: TGPBrush): TStatus; overload; + function DrawString(string_: WideString; length: Integer; font: TGPFont; + const origin: TGPPointF; brush: TGPBrush): TStatus; overload; + function DrawString(string_: WideString; length: Integer; font: TGPFont; + const origin: TGPPointF; stringFormat: TGPStringFormat; brush: TGPBrush): TStatus; overload; + + // MeasureString + function MeasureString(string_: WideString; length: Integer; font: TGPFont; + const layoutRect: TGPRectF; stringFormat: TGPStringFormat; out boundingBox: TGPRectF; + codepointsFitted: PInteger = nil; linesFilled: PInteger = nil): TStatus; overload; + function MeasureString(string_: WideString; length: Integer; font: TGPFont; + const layoutRectSize: TGPSizeF; stringFormat: TGPStringFormat; out size: TGPSizeF; + codepointsFitted: PInteger = nil; linesFilled: PInteger = nil): TStatus; overload; + function MeasureString(string_: WideString ; length: Integer; font: TGPFont; + const origin: TGPPointF; stringFormat: TGPStringFormat; + out boundingBox: TGPRectF): TStatus; overload; + function MeasureString(string_: WideString; length: Integer; font: TGPFont; + const layoutRect: TGPRectF; out boundingBox: TGPRectF): TStatus; overload; + function MeasureString(string_: WideString; length: Integer; font: TGPFont; + const origin: TGPPointF; out boundingBox: TGPRectF): TStatus; overload; + + // MeasureCharacterRanges + function MeasureCharacterRanges(string_: WideString; length: Integer; font: TGPFont; + const layoutRect: TGPRectF; stringFormat: TGPStringFormat; regionCount: Integer; + const regions: array of TGPRegion): TStatus; overload; + + // DrawDriverString + function DrawDriverString(text: PUINT16; length: Integer; font: TGPFont; + brush: TGPBrush; positions: PGPPointF; flags: Integer; matrix: TGPMatrix): TStatus; + + // MeasureDriverString + function MeasureDriverString(text: PUINT16; length: Integer; font: TGPFont; + positions: PGPPointF; flags: Integer; matrix: TGPMatrix; + out boundingBox: TGPRectF): TStatus; + + // Draw a cached bitmap on this graphics destination offset by + // x, y. Note this will fail with WrongState if the CachedBitmap + // native format differs from this Graphics. + function DrawCachedBitmap(cb: TGPCachedBitmap; x, y: Integer): TStatus; + function DrawImage(image: TGPImage; const point: TGPPointF): TStatus; overload; + function DrawImage(image: TGPImage; x, y: Single): TStatus; overload; + function DrawImage(image: TGPImage; const rect: TGPRectF): TStatus; overload; + function DrawImage(image: TGPImage; x, y, width, height: Single): TStatus; overload; + function DrawImage(image: TGPImage; const point: TGPPoint): TStatus; overload; + function DrawImage(image: TGPImage; x, y: Integer): TStatus; overload; + function DrawImage(image: TGPImage; const rect: TGPRect): TStatus; overload; + function DrawImage(image: TGPImage; x, y, width, height: Integer): TStatus; overload; + + // Affine Draw Image + // destPoints.length = 3: rect => parallelogram + // destPoints[0] <=> top-left corner of the source rectangle + // destPoints[1] <=> top-right corner + // destPoints[2] <=> bottom-left corner + // destPoints.length = 4: rect => quad + // destPoints[3] <=> bottom-right corner + function DrawImage(image: TGPImage; destPoints: PGPPointF; count: Integer): TStatus; overload; + function DrawImage(image: TGPImage; destPoints: PGPPoint; count: Integer): TStatus; overload; + function DrawImage(image: TGPImage; x, y, srcx, srcy, srcwidth, srcheight: Single; srcUnit: TUnit): TStatus; overload; + function DrawImage(image: TGPImage; const destRect: TGPRectF; srcx, srcy, + srcwidth, srcheight: Single; srcUnit: TUnit; + imageAttributes: TGPImageAttributes = nil; callback: DrawImageAbort = nil; + callbackData: Pointer = nil): TStatus; overload; + function DrawImage(image: TGPImage; destPoints: PGPPointF; count: Integer; + srcx, srcy, srcwidth, srcheight: Single; srcUnit: TUnit; + imageAttributes: TGPImageAttributes = nil; callback: DrawImageAbort = nil; + callbackData: Pointer = nil): TStatus; overload; + function DrawImage(image: TGPImage; x, y, srcx, srcy, srcwidth, + srcheight: Integer; srcUnit: TUnit): TStatus; overload; + function DrawImage(image: TGPImage; const destRect: TGPRect; srcx, srcy, + srcwidth, srcheight: Integer; srcUnit: TUnit; + imageAttributes: TGPImageAttributes = nil; callback: DrawImageAbort = nil; + callbackData: Pointer = nil): TStatus; overload; + function DrawImage(image: TGPImage; destPoints: PGPPoint; + count, srcx, srcy, srcwidth, srcheight: Integer; srcUnit: TUnit; + imageAttributes: TGPImageAttributes = nil; callback: DrawImageAbort = nil; + callbackData: Pointer = nil): TStatus; overload; + + // The following methods are for playing an EMF+ to a graphics + // via the enumeration interface. Each record of the EMF+ is + // sent to the callback (along with the callbackData). Then + // the callback can invoke the Metafile::PlayRecord method + // to play the particular record. + function EnumerateMetafile(metafile: TGPMetafile; const destPoint: TGPPointF; + callback: EnumerateMetafileProc; callbackData: Pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; overload; + function EnumerateMetafile(metafile: TGPMetafile; const destPoint: TGPPoint; + callback: EnumerateMetafileProc; callbackData: pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; overload; + function EnumerateMetafile(metafile: TGPMetafile; const destRect: TGPRectF; + callback: EnumerateMetafileProc; callbackData: Pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; overload; + function EnumerateMetafile(metafile: TGPMetafile; const destRect: TGPRect; + callback: EnumerateMetafileProc; callbackData: Pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; overload; + function EnumerateMetafile(metafile: TGPMetafile; destPoints: PGPPointF; + count: Integer; callback: EnumerateMetafileProc; callbackData: Pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; overload; + function EnumerateMetafile(metafile: TGPMetafile; destPoints: PGPPoint; + count: Integer; callback: EnumerateMetafileProc; callbackData: Pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; overload; + function EnumerateMetafile(metafile: TGPMetafile; const destPoint: TGPPointF; + const srcRect: TGPRectF; srcUnit: TUnit; callback: EnumerateMetafileProc; + callbackData: pointer = nil; imageAttributes: TGPImageAttributes = nil + ): TStatus; overload; + function EnumerateMetafile(metafile : TGPMetafile; const destPoint : TGPPoint; + const srcRect : TGPRect; srcUnit : TUnit; callback : EnumerateMetafileProc; + callbackData : Pointer = nil; imageAttributes : TGPImageAttributes = nil + ): TStatus; overload; + function EnumerateMetafile(metafile: TGPMetafile; const destRect: TGPRectF; + const srcRect: TGPRectF; srcUnit: TUnit; callback: EnumerateMetafileProc; + callbackData: Pointer = nil; imageAttributes: TGPImageAttributes = nil): TStatus; overload; + function EnumerateMetafile(metafile : TGPMetafile; const destRect, srcRect: TGPRect; + srcUnit : TUnit; callback : EnumerateMetafileProc; callbackData : Pointer = nil; + imageAttributes : TGPImageAttributes = nil): TStatus; overload; + function EnumerateMetafile( metafile: TGPMetafile; destPoints: PGPPointF; + count: Integer; const srcRect: TGPRectF; srcUnit: TUnit; callback: EnumerateMetafileProc; + callbackData: Pointer = nil; imageAttributes: TGPImageAttributes = nil): TStatus; overload; + function EnumerateMetafile(metafile: TGPMetafile; destPoints: PGPPoint; + count: Integer; const srcRect: TGPRect; srcUnit: TUnit; callback: EnumerateMetafileProc; + callbackData: Pointer = nil; imageAttributes: TGPImageAttributes = nil): TStatus; overload; + + // SetClip + function SetClip(g: TGPGraphics; combineMode: TCombineMode = CombineModeReplace): TStatus; overload; + function SetClip(rect: TGPRectF; combineMode: TCombineMode = CombineModeReplace): TStatus; overload; + function SetClip(rect: TGPRect; combineMode: TCombineMode = CombineModeReplace): TStatus; overload; + function SetClip(path: TGPGraphicsPath; combineMode: TCombineMode = CombineModeReplace): TStatus; overload; + function SetClip(region: TGPRegion; combineMode: TCombineMode = CombineModeReplace): TStatus; overload; + // This is different than the other SetClip methods because it assumes + // that the HRGN is already in device units, so it doesn't transform + // the coordinates in the HRGN. + function SetClip(hRgn: HRGN; combineMode: TCombineMode = CombineModeReplace): TStatus; overload; + + // IntersectClip + function IntersectClip(const rect: TGPRectF): TStatus; overload; + function IntersectClip(const rect: TGPRect): TStatus; overload; + function IntersectClip(region: TGPRegion): TStatus; overload; + // ExcludeClip + function ExcludeClip(const rect: TGPRectF): TStatus; overload; + function ExcludeClip(const rect: TGPRect): TStatus; overload; + function ExcludeClip(region: TGPRegion): TStatus; overload; + + function ResetClip: TStatus; + + function TranslateClip(dx, dy: Single): TStatus; overload; + function TranslateClip(dx, dy: Integer): TStatus; overload; + + function GetClip(region: TGPRegion): TStatus; + + function GetClipBounds(out rect: TGPRectF): TStatus; overload; + function GetClipBounds(out rect: TGPRect): TStatus; overload; + + function IsClipEmpty: Bool; + + function GetVisibleClipBounds(out rect: TGPRectF): TStatus; overload; + function GetVisibleClipBounds(out rect: TGPRect): TStatus; overload; + + function IsVisibleClipEmpty: BOOL; + + function IsVisible(x, y: Integer): BOOL; overload; + function IsVisible(const point: TGPPoint): BOOL; overload; + function IsVisible(x, y, width, height: Integer): BOOL; overload; + function IsVisible(const rect: TGPRect): BOOL; overload; + function IsVisible(x, y: Single): BOOL; overload; + function IsVisible(const point: TGPPointF): BOOL; overload; + function IsVisible(x, y, width, height: Single): BOOL; overload; + function IsVisible(const rect: TGPRectF): BOOL; overload; + + function Save: GraphicsState; + function Restore(gstate: GraphicsState): TStatus; + + function BeginContainer(const dstrect,srcrect: TGPRectF; unit_: TUnit): GraphicsContainer; overload; + function BeginContainer(const dstrect, srcrect: TGPRect; unit_: TUnit): GraphicsContainer; overload; + function BeginContainer: GraphicsContainer; overload; + function EndContainer(state: GraphicsContainer): TStatus; + + // Only valid when recording metafiles. + function AddMetafileComment(data: PBYTE; sizeData: UINT): TStatus; + + function GetHalftonePalette: HPALETTE; + function GetLastStatus: TStatus; + end; + + +(**************************************************************************\ +* +* GDI+ CustomLineCap APIs +* +\**************************************************************************) + + TGPAdjustableArrowCap = class(TGPCustomLineCap) + public + constructor Create(height, width: Single; isFilled: Bool = TRUE); + function SetHeight(height: Single): TStatus; + function GetHeight: Single; + function SetWidth(width: Single): TStatus; + function GetWidth: Single; + function SetMiddleInset(middleInset: Single): TStatus; + function GetMiddleInset: Single; + function SetFillState(isFilled: Bool): TStatus; + function IsFilled: BOOL; + end; + +(**************************************************************************\ +* +* GDI+ Metafile class +* +\**************************************************************************) + + TGPMetafile = class(TGPImage) + public + // Playback a metafile from a HMETAFILE + // If deleteWmf is TRUE, then when the metafile is deleted, + // the hWmf will also be deleted. Otherwise, it won't be. + constructor Create(hWmf: HMETAFILE; var wmfPlaceableFileHeader: TWmfPlaceableFileHeader; + deleteWmf: BOOL = FALSE); overload; + // Playback a metafile from a HENHMETAFILE + // If deleteEmf is TRUE, then when the metafile is deleted, + // the hEmf will also be deleted. Otherwise, it won't be. + constructor Create(hEmf: HENHMETAFILE; deleteEmf: BOOL = FALSE); overload; + constructor Create(filename: WideString); overload; + // Playback a WMF metafile from a file. + constructor Create(filename: WideString; var wmfPlaceableFileHeader: TWmfPlaceableFileHeader); overload; + constructor Create(stream: IStream); overload; + // Record a metafile to memory. + constructor Create(referenceHdc: HDC; type_: TEmfType = EmfTypeEmfPlusDual; + description: PWCHAR = nil); overload; + // Record a metafile to memory. + constructor Create(referenceHdc: HDC; frameRect: TGPRectF; + frameUnit: TMetafileFrameUnit = MetafileFrameUnitGdi; + type_: TEmfType = EmfTypeEmfPlusDual; description: PWCHAR = nil); overload; + // Record a metafile to memory. + constructor Create(referenceHdc: HDC; frameRect: TGPRect; + frameUnit: TMetafileFrameUnit = MetafileFrameUnitGdi; + type_: TEmfType = EmfTypeEmfPlusDual; description: PWCHAR = nil); overload; + constructor Create(fileName: WideString;referenceHdc: HDC; + type_: TEmfType = EmfTypeEmfPlusDual; description: PWCHAR = nil); overload; + constructor Create(fileName: WideString; referenceHdc: HDC; frameRect: TGPRectF; + frameUnit: TMetafileFrameUnit = MetafileFrameUnitGdi; + type_: TEmfType = EmfTypeEmfPlusDual; description: PWCHAR = nil); overload; + constructor Create( fileName: WideString; referenceHdc: HDC; frameRect: TGPRect; + frameUnit: TMetafileFrameUnit = MetafileFrameUnitGdi; + type_: TEmfType = EmfTypeEmfPlusDual; description: PWCHAR = nil); overload; + constructor Create(stream: IStream; referenceHdc: HDC; + type_: TEmfType = EmfTypeEmfPlusDual; description: PWCHAR = nil); overload; + constructor Create(stream: IStream; referenceHdc: HDC; frameRect: TGPRectF; + frameUnit: TMetafileFrameUnit = MetafileFrameUnitGdi; + type_: TEmfType = EmfTypeEmfPlusDual; description: PWCHAR = nil); overload; + constructor Create(stream : IStream; referenceHdc : HDC; frameRect : TGPRect; + frameUnit : TMetafileFrameUnit = MetafileFrameUnitGdi; + type_ : TEmfType = EmfTypeEmfPlusDual; description : PWCHAR = nil); overload; + constructor Create; reintroduce; overload; + function GetMetafileHeader(hWmf: HMETAFILE; var wmfPlaceableFileHeader: TWmfPlaceableFileHeader; + header: TMetafileHeader): TStatus; overload; + function GetMetafileHeader(hEmf: HENHMETAFILE; header: TMetafileHeader): TStatus; overload; // ok + function GetMetafileHeader(filename: WideString; header: TMetafileHeader): TStatus; overload; // ok + function GetMetafileHeader(stream: IStream; header: TMetafileHeader): TStatus; overload; // ok + function GetMetafileHeader(header: TMetafileHeader): TStatus; overload; // ok + // Once this method is called, the Metafile object is in an invalid state + // and can no longer be used. It is the responsiblity of the caller to + // invoke DeleteEnhMetaFile to delete this hEmf. // ok + function GetHENHMETAFILE: HENHMETAFILE; + // Used in conjuction with Graphics::EnumerateMetafile to play an EMF+ + // The data must be DWORD aligned if it's an EMF or EMF+. It must be + // WORD aligned if it's a WMF. + function PlayRecord(recordType: TEmfPlusRecordType; flags, dataSize: UINT; data: PBYTE): TStatus; + // If you're using a printer HDC for the metafile, but you want the + // metafile rasterized at screen resolution, then use this API to set + // the rasterization dpi of the metafile to the screen resolution, + // e.g. 96 dpi or 120 dpi. + function SetDownLevelRasterizationLimit(metafileRasterizationLimitDpi: UINT): TStatus; + function GetDownLevelRasterizationLimit: UINT; + function EmfToWmfBits(hemf: HENHMETAFILE; cbData16: UINT; pData16: PBYTE; + iMapMode: Integer = MM_ANISOTROPIC; eFlags: TEmfToWmfBitsFlags = EmfToWmfBitsFlagsDefault): UINT; + end; + +//////////////////////////////////////////////////////////////////////////////// + +var + GenericSansSerifFontFamily : TGPFontFamily = nil; + GenericSerifFontFamily : TGPFontFamily = nil; + GenericMonospaceFontFamily : TGPFontFamily = nil; + + GenericTypographicStringFormatBuffer: TGPStringFormat = nil; + GenericDefaultStringFormatBuffer : TGPStringFormat = nil; + + StartupInput: TGDIPlusStartupInput; + gdiplusToken: ULONG; + +//////////////////////////////////////////////////////////////////////////////// + +implementation + +(**************************************************************************\ +* +* Image Attributes +* +* Abstract: +* +* GDI+ Image Attributes used with Graphics.DrawImage +* +* There are 5 possible sets of color adjustments: +* ColorAdjustDefault, +* ColorAdjustBitmap, +* ColorAdjustBrush, +* ColorAdjustPen, +* ColorAdjustText, +* +* Bitmaps, Brushes, Pens, and Text will all use any color adjustments +* that have been set into the default ImageAttributes until their own +* color adjustments have been set. So as soon as any "Set" method is +* called for Bitmaps, Brushes, Pens, or Text, then they start from +* scratch with only the color adjustments that have been set for them. +* Calling Reset removes any individual color adjustments for a type +* and makes it revert back to using all the default color adjustments +* (if any). The SetToIdentity method is a way to force a type to +* have no color adjustments at all, regardless of what previous adjustments +* have been set for the defaults or for that type. +* +\********************************************************************F******) + + constructor TGPImageAttributes.Create; + begin + nativeImageAttr := nil; + lastResult := GdipCreateImageAttributes(nativeImageAttr); + end; + + destructor TGPImageAttributes.Destroy; + begin + GdipDisposeImageAttributes(nativeImageAttr); + inherited Destroy; + end; + + function TGPImageAttributes.Clone: TGPImageAttributes; + var clone: GpImageAttributes; + begin + SetStatus(GdipCloneImageAttributes(nativeImageAttr, clone)); + result := TGPImageAttributes.Create(clone, lastResult); + end; + + function TGPImageAttributes.SetToIdentity(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesToIdentity(nativeImageAttr, type_)); + end; + + function TGPImageAttributes.Reset(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipResetImageAttributes(nativeImageAttr, type_)); + end; + + function TGPImageAttributes.SetColorMatrix(const colorMatrix: TColorMatrix; + mode: TColorMatrixFlags = ColorMatrixFlagsDefault; + type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesColorMatrix(nativeImageAttr, + type_, TRUE, @colorMatrix, nil, mode)); + end; + + function TGPImageAttributes.ClearColorMatrix(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesColorMatrix(nativeImageAttr, type_, + FALSE, nil, nil, ColorMatrixFlagsDefault)); + end; + + + function TGPImageAttributes.SetColorMatrices(const colorMatrix: TColorMatrix; + const grayMatrix: TColorMatrix; mode: TColorMatrixFlags = ColorMatrixFlagsDefault; + type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesColorMatrix(nativeImageAttr, type_, + TRUE, @colorMatrix, @grayMatrix, mode)); + end; + + function TGPImageAttributes.ClearColorMatrices(Type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesColorMatrix( nativeImageAttr, + type_, FALSE, nil, nil, ColorMatrixFlagsDefault)); + end; + + function TGPImageAttributes.SetThreshold(threshold: Single; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesThreshold( nativeImageAttr, type_, + TRUE, threshold)); + end; + + function TGPImageAttributes.ClearThreshold(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesThreshold(nativeImageAttr, type_, + FALSE, 0.0)); + end; + + function TGPImageAttributes.SetGamma(gamma: Single; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesGamma(nativeImageAttr, type_, TRUE, gamma)); + end; + + function TGPImageAttributes.ClearGamma(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesGamma(nativeImageAttr, type_, FALSE, 0.0)); + end; + + function TGPImageAttributes.SetNoOp(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesNoOp(nativeImageAttr, type_, TRUE)); + end; + + function TGPImageAttributes.ClearNoOp(Type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesNoOp( nativeImageAttr, type_, FALSE)); + end; + + function TGPImageAttributes.SetColorKey(colorLow, colorHigh: TGPColor; + type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesColorKeys(nativeImageAttr, type_, + TRUE, colorLow, colorHigh)); + end; + + function TGPImageAttributes.ClearColorKey(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesColorKeys(nativeImageAttr, type_, + FALSE, 0, 0)); + end; + + function TGPImageAttributes.SetOutputChannel(channelFlags: TColorChannelFlags; + type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesOutputChannel(nativeImageAttr, + type_, TRUE, channelFlags)); + end; + + function TGPImageAttributes.ClearOutputChannel(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesOutputChannel(nativeImageAttr, + type_, FALSE, ColorChannelFlagsLast)); + end; + + function TGPImageAttributes.SetOutputChannelColorProfile(colorProfileFilename: WideString; + type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesOutputChannelColorProfile(nativeImageAttr, + type_, TRUE, PWideChar(colorProfileFilename))); + end; + + function TGPImageAttributes.ClearOutputChannelColorProfile(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesOutputChannelColorProfile(nativeImageAttr, + type_, FALSE, nil)); + end; + + function TGPImageAttributes.SetRemapTable(mapSize: Cardinal; map: PColorMap; + type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesRemapTable(nativeImageAttr, type_, + TRUE, mapSize, map)); + end; + + function TGPImageAttributes.ClearRemapTable(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus; + begin + result := SetStatus(GdipSetImageAttributesRemapTable(nativeImageAttr, type_, + FALSE, 0, nil)); + end; + + function TGPImageAttributes.SetBrushRemapTable(mapSize: Cardinal; map: PColorMap): TStatus; + begin + result := SetRemapTable(mapSize, map, ColorAdjustTypeBrush); + end; + + function TGPImageAttributes.ClearBrushRemapTable: TStatus; + begin + result := ClearRemapTable(ColorAdjustTypeBrush); + end; + + function TGPImageAttributes.SetWrapMode(wrap: TWrapMode; color: TGPColor = aclBlack; + clamp: BOOL = FALSE): TStatus; + begin + result := SetStatus(GdipSetImageAttributesWrapMode(nativeImageAttr, wrap, color, clamp)); + end; + + // The flags of the palette are ignored. + + function TGPImageAttributes.GetAdjustedPalette(colorPalette: PColorPalette; + colorAdjustType: TColorAdjustType): TStatus; + begin + result := SetStatus(GdipGetImageAttributesAdjustedPalette(nativeImageAttr, + colorPalette, colorAdjustType)); + end; + + function TGPImageAttributes.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + + constructor TGPImageAttributes.Create(imageAttr: GpImageAttributes; status: TStatus); + begin + SetNativeImageAttr(imageAttr); + lastResult := status; + end; + + procedure TGPImageAttributes.SetNativeImageAttr(nativeImageAttr: GpImageAttributes); + begin + self.nativeImageAttr := nativeImageAttr; + end; + + function TGPImageAttributes.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then lastResult := status; + result := status; + end; + +(**************************************************************************\ +* +* GDI+ Matrix class +* +\**************************************************************************) + + // Default constructor is set to identity matrix. + constructor TGPMatrix.Create; + var matrix: GpMatrix; + begin + matrix := nil; + lastResult := GdipCreateMatrix(matrix); + SetNativeMatrix(matrix); + end; + + constructor TGPMatrix.Create(m11, m12, m21, m22, dx, dy: Single); + var matrix: GpMatrix; + begin + matrix := nil; + lastResult := GdipCreateMatrix2(m11, m12, m21, m22, dx, dy, matrix); + SetNativeMatrix(matrix); + end; + + constructor TGPMatrix.Create(const rect: TGPRectF; const dstplg: TGPPointF); + var matrix: GpMatrix; + begin + matrix := nil; + lastResult := GdipCreateMatrix3(@rect, @dstplg, matrix); + SetNativeMatrix(matrix); + end; + + constructor TGPMatrix.Create(const rect: TGPRect; const dstplg: TGPPoint); + var matrix: GpMatrix; + begin + matrix := nil; + lastResult := GdipCreateMatrix3I(@rect, @dstplg, matrix); + SetNativeMatrix(matrix); + end; + + destructor TGPMatrix.Destroy; + begin + GdipDeleteMatrix(nativeMatrix); + end; + + function TGPMatrix.Clone: TGPMatrix; + var cloneMatrix: GpMatrix; + begin + cloneMatrix := nil; + SetStatus(GdipCloneMatrix(nativeMatrix, cloneMatrix)); + if (lastResult <> Ok) then + begin + result := nil; + exit; + end; + result := TGPMatrix.Create(cloneMatrix); + end; + + function TGPMatrix.GetElements(const m: TMatrixArray): TStatus; + begin + result := SetStatus(GdipGetMatrixElements(nativeMatrix, @m)); + end; + + function TGPMatrix.SetElements(m11, m12, m21, m22, dx, dy: Single): TStatus; + begin + result := SetStatus(GdipSetMatrixElements(nativeMatrix, + m11, m12, m21, m22, dx, dy)); + end; + + function TGPMatrix.OffsetX: Single; + var elements: TMatrixArray; + begin + if (GetElements(elements) = Ok) then + result := elements[4] + else + result := 0.0; + end; + + function TGPMatrix.OffsetY: Single; + var elements: TMatrixArray; + begin + if (GetElements(elements) = Ok) then result := elements[5] + else result := 0.0; + end; + + function TGPMatrix.Reset: TStatus; + begin + // set identity matrix elements + result := SetStatus(GdipSetMatrixElements(nativeMatrix, 1.0, 0.0, 0.0, 1.0, + 0.0, 0.0)); + end; + + function TGPMatrix.Multiply(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipMultiplyMatrix(nativeMatrix, matrix.nativeMatrix, order)); + end; + + function TGPMatrix.Translate(offsetX, offsetY: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipTranslateMatrix(nativeMatrix, offsetX, offsetY, order)); + end; + + function TGPMatrix.Scale(scaleX, scaleY: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipScaleMatrix(nativeMatrix, scaleX, scaleY, order)); + end; + + function TGPMatrix.Rotate(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipRotateMatrix(nativeMatrix, angle, order)); + end; + + function TGPMatrix.RotateAt(angle: Single; const center: TGPPointF; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + if(order = MatrixOrderPrepend) then + begin + SetStatus(GdipTranslateMatrix(nativeMatrix, center.X, center.Y, order)); + SetStatus(GdipRotateMatrix(nativeMatrix, angle, order)); + result := SetStatus(GdipTranslateMatrix(nativeMatrix, -center.X, -center.Y, + order)); + end + else + begin + SetStatus(GdipTranslateMatrix(nativeMatrix, - center.X, - center.Y, order)); + SetStatus(GdipRotateMatrix(nativeMatrix, angle, order)); + result := SetStatus(GdipTranslateMatrix(nativeMatrix, center.X, center.Y, + order)); + end; + end; + + function TGPMatrix.Shear(shearX, shearY: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipShearMatrix(nativeMatrix, shearX, shearY, order)); + end; + + function TGPMatrix.Invert: TStatus; + begin + result := SetStatus(GdipInvertMatrix(nativeMatrix)); + end; + + // float version + function TGPMatrix.TransformPoints(pts: PGPPointF; count: Integer = 1): TStatus; + begin + result := SetStatus(GdipTransformMatrixPoints(nativeMatrix, pts, count)); + end; + + function TGPMatrix.TransformPoints(pts: PGPPoint; count: Integer = 1): TStatus; + begin + result := SetStatus(GdipTransformMatrixPointsI(nativeMatrix, pts, count)); + end; + + function TGPMatrix.TransformVectors(pts: PGPPointF; count: Integer = 1): TStatus; + begin + result := SetStatus(GdipVectorTransformMatrixPoints( nativeMatrix, pts, count)); + end; + + function TGPMatrix.TransformVectors(pts: PGPPoint; count: Integer = 1): TStatus; + begin + result := SetStatus(GdipVectorTransformMatrixPointsI(nativeMatrix, pts, count)); + end; + + function TGPMatrix.IsInvertible: BOOL; + begin + result := FALSE; + SetStatus(GdipIsMatrixInvertible(nativeMatrix, result)); + end; + + function TGPMatrix.IsIdentity: BOOL; + begin + result := False; + SetStatus(GdipIsMatrixIdentity(nativeMatrix, result)); + end; + + function TGPMatrix.Equals(matrix: TGPMatrix): BOOL; + begin + result := FALSE; + SetStatus(GdipIsMatrixEqual(nativeMatrix, matrix.nativeMatrix, result)); + end; + + function TGPMatrix.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + + constructor TGPMatrix.Create(nativeMatrix: GpMatrix); + begin + lastResult := Ok; + SetNativeMatrix(nativeMatrix); + end; + + procedure TGPMatrix.SetNativeMatrix(nativeMatrix: GpMatrix); + begin + self.nativeMatrix := nativeMatrix; + end; + + function TGPMatrix.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then lastResult := status; + result := status; + end; + + +(**************************************************************************\ +* +* GDI+ StringFormat class +* +\**************************************************************************) + + constructor TGPStringFormat.Create(formatFlags: Integer = 0; language: LANGID = LANG_NEUTRAL); + begin + nativeFormat := nil; + lastError := GdipCreateStringFormat(formatFlags, language, nativeFormat); + end; + + class function TGPStringFormat.GenericDefault: TGPStringFormat; + begin + if not assigned(GenericDefaultStringFormatBuffer) then + begin + GenericDefaultStringFormatBuffer := TGPStringFormat.Create; + GenericDefaultStringFormatBuffer.lastError := + GdipStringFormatGetGenericDefault(GenericDefaultStringFormatBuffer.nativeFormat); + end; + result := GenericDefaultStringFormatBuffer; + end; + + class function TGPStringFormat.GenericTypographic: TGPStringFormat; + begin + if not assigned(GenericTypographicStringFormatBuffer) then + begin + GenericTypographicStringFormatBuffer := TGPStringFormat.Create; + GenericTypographicStringFormatBuffer.lastError := + GdipStringFormatGetGenericTypographic(GenericTypographicStringFormatBuffer.nativeFormat); + end; + result := GenericTypographicStringFormatBuffer; + end; + + constructor TGPStringFormat.Create(format: TGPStringFormat); + var gpstf: GPSTRINGFORMAT; + begin + nativeFormat := nil; + if assigned(format) then gpstf := format.nativeFormat + else gpstf := nil; + lastError := GdipCloneStringFormat(gpstf, nativeFormat); + end; + + function TGPStringFormat.Clone: TGPStringFormat; + var + clonedStringFormat: GpStringFormat; + begin + clonedStringFormat := nil; + lastError := GdipCloneStringFormat(nativeFormat, clonedStringFormat); + if (lastError = Ok) then + result := TGPStringFormat.Create(clonedStringFormat, lastError) + else + result := nil; + end; + + destructor TGPStringFormat.Destroy; + begin + GdipDeleteStringFormat(nativeFormat); + end; + + function TGPStringFormat.SetFormatFlags(flags: Integer): TStatus; + begin + result := SetStatus(GdipSetStringFormatFlags(nativeFormat, flags)); + end; + + function TGPStringFormat.GetFormatFlags: Integer; + begin + SetStatus(GdipGetStringFormatFlags(nativeFormat, result)); + end; + + function TGPStringFormat.SetAlignment(align: TStringAlignment): TStatus; + begin + result := SetStatus(GdipSetStringFormatAlign(nativeFormat, align)); + end; + + function TGPStringFormat.GetAlignment: TStringAlignment; + begin + SetStatus(GdipGetStringFormatAlign(nativeFormat, result)); + end; + + function TGPStringFormat.SetLineAlignment(align: TStringAlignment): TStatus; + begin + result := SetStatus(GdipSetStringFormatLineAlign(nativeFormat, align)); + end; + + function TGPStringFormat.GetLineAlignment: TStringAlignment; + begin + SetStatus(GdipGetStringFormatLineAlign(nativeFormat, result)); + end; + + function TGPStringFormat.SetHotkeyPrefix(hotkeyPrefix: THotkeyPrefix): TStatus; + begin + result := SetStatus(GdipSetStringFormatHotkeyPrefix(nativeFormat, Integer(hotkeyPrefix))); + end; + + function TGPStringFormat.GetHotkeyPrefix: THotkeyPrefix; + var HotkeyPrefix: Integer; + begin + SetStatus(GdipGetStringFormatHotkeyPrefix(nativeFormat, HotkeyPrefix)); + result := THotkeyPrefix(HotkeyPrefix); + end; + + function TGPStringFormat.SetTabStops(firstTabOffset: Single; count: Integer; tabStops: PSingle): TStatus; + begin + result := SetStatus(GdipSetStringFormatTabStops(nativeFormat, firstTabOffset, count, tabStops)); + end; + + function TGPStringFormat.GetTabStopCount: Integer; + begin + SetStatus(GdipGetStringFormatTabStopCount(nativeFormat, result)); + end; + + function TGPStringFormat.GetTabStops(count: Integer; firstTabOffset, tabStops: PSingle): TStatus; + begin + result := SetStatus(GdipGetStringFormatTabStops(nativeFormat, count, firstTabOffset, tabStops)); + end; + + function TGPStringFormat.SetDigitSubstitution(language: LANGID; substitute: TStringDigitSubstitute): TStatus; + begin + result := SetStatus(GdipSetStringFormatDigitSubstitution(nativeFormat, language, substitute)); + end; + + function TGPStringFormat.GetDigitSubstitutionLanguage: LANGID; + begin + SetStatus(GdipGetStringFormatDigitSubstitution(nativeFormat, @result, nil)); + end; + + function TGPStringFormat.GetDigitSubstitutionMethod: TStringDigitSubstitute; + begin + SetStatus(GdipGetStringFormatDigitSubstitution(nativeFormat, nil, @result)); + end; + + function TGPStringFormat.SetTrimming(trimming: TStringTrimming): TStatus; + begin + result := SetStatus(GdipSetStringFormatTrimming(nativeFormat, trimming)); + end; + + function TGPStringFormat.GetTrimming: TStringTrimming; + begin + SetStatus(GdipGetStringFormatTrimming(nativeFormat, result)); + end; + + function TGPStringFormat.SetMeasurableCharacterRanges(rangeCount: Integer; + ranges: PCharacterRange): TStatus; + begin + result := SetStatus(GdipSetStringFormatMeasurableCharacterRanges(nativeFormat, + rangeCount, ranges)); + end; + + function TGPStringFormat.GetMeasurableCharacterRangeCount: Integer; + begin + SetStatus(GdipGetStringFormatMeasurableCharacterRangeCount(nativeFormat, result)); + end; + + function TGPStringFormat.GetLastStatus: TStatus; + begin + result := lastError; + lastError := Ok; + end; + + function TGPStringFormat.SetStatus(newStatus: GpStatus): TStatus; + begin + if (newStatus <> Ok) then lastError := newStatus; + result := newStatus; + end; + + // operator = + procedure TGPStringFormat.Assign(source: TGPStringFormat); + begin + assert(assigned(source)); + GdipDeleteStringFormat(nativeFormat); + lastError := GdipCloneStringFormat(source.nativeFormat, nativeFormat); + end; + + constructor TGPStringFormat.Create(clonedStringFormat: GpStringFormat; status: TStatus); + begin + lastError := status; + nativeFormat := clonedStringFormat; + end; + + + + // --------------------------------------------------------------------------- + // TAdjustableArrowCap + // --------------------------------------------------------------------------- + + constructor TGPAdjustableArrowCap.Create(height, width: Single; isFilled: Bool = TRUE); + var cap: GpAdjustableArrowCap; + begin + cap := nil; + lastResult := GdipCreateAdjustableArrowCap(height, width, isFilled, cap); + SetNativeCap(cap); + end; + + function TGPAdjustableArrowCap.SetHeight(height: Single): TStatus; + begin + result := SetStatus(GdipSetAdjustableArrowCapHeight(GpAdjustableArrowCap(nativeCap), height)); + end; + + function TGPAdjustableArrowCap.GetHeight: Single; + begin + SetStatus(GdipGetAdjustableArrowCapHeight(GpAdjustableArrowCap(nativeCap), result)); + end; + + function TGPAdjustableArrowCap.SetWidth(width: Single): TStatus; + begin + result := SetStatus(GdipSetAdjustableArrowCapWidth(GpAdjustableArrowCap(nativeCap), width)); + end; + + function TGPAdjustableArrowCap.GetWidth: Single; + begin + SetStatus(GdipGetAdjustableArrowCapWidth(GpAdjustableArrowCap(nativeCap), result)); + end; + + function TGPAdjustableArrowCap.SetMiddleInset(middleInset: Single): TStatus; + begin + result := SetStatus(GdipSetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap(nativeCap), middleInset)); + end; + + function TGPAdjustableArrowCap.GetMiddleInset: Single; + begin + SetStatus(GdipGetAdjustableArrowCapMiddleInset( + GpAdjustableArrowCap(nativeCap), result)); + end; + + function TGPAdjustableArrowCap.SetFillState(isFilled: Bool): TStatus; + begin + result := SetStatus(GdipSetAdjustableArrowCapFillState( + GpAdjustableArrowCap(nativeCap), isFilled)); + end; + + function TGPAdjustableArrowCap.IsFilled: BOOL; + begin + SetStatus(GdipGetAdjustableArrowCapFillState( + GpAdjustableArrowCap(nativeCap), result)); + end; + +(**************************************************************************\ +* +* GDI+ Metafile class +* +\**************************************************************************) + + // Playback a metafile from a HMETAFILE + // If deleteWmf is TRUE, then when the metafile is deleted, + // the hWmf will also be deleted. Otherwise, it won't be. + + constructor TGPMetafile.Create(hWmf: HMETAFILE; + var wmfPlaceableFileHeader: TWmfPlaceableFileHeader; deleteWmf: BOOL = FALSE); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipCreateMetafileFromWmf(hWmf, deleteWmf, @wmfPlaceableFileHeader, metafile); + SetNativeImage(metafile); + end; + + // Playback a metafile from a HENHMETAFILE + // If deleteEmf is TRUE, then when the metafile is deleted, + // the hEmf will also be deleted. Otherwise, it won't be. + + constructor TGPMetafile.Create(hEmf: HENHMETAFILE; deleteEmf: BOOL = FALSE); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipCreateMetafileFromEmf(hEmf, deleteEmf, metafile); + SetNativeImage(metafile); + end; + + constructor TGPMetafile.Create(filename: WideString); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipCreateMetafileFromFile(PWideChar(filename), metafile); + SetNativeImage(metafile); + end; + + // Playback a WMF metafile from a file. + + constructor TGPMetafile.Create(filename: Widestring; var wmfPlaceableFileHeader: TWmfPlaceableFileHeader); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipCreateMetafileFromWmfFile(PWideChar(filename), @wmfPlaceableFileHeader, metafile); + SetNativeImage(metafile); + end; + + constructor TGPMetafile.Create(stream: IStream); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipCreateMetafileFromStream(stream, metafile); + SetNativeImage(metafile); + end; + + // Record a metafile to memory. + + constructor TGPMetafile.Create(referenceHdc: HDC; type_: TEmfType = EmfTypeEmfPlusDual; + description: PWCHAR = nil); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipRecordMetafile(referenceHdc, type_, nil, MetafileFrameUnitGdi, + description, metafile); + SetNativeImage(metafile); + end; + + // Record a metafile to memory. + + constructor TGPMetafile.Create(referenceHdc: HDC; frameRect: TGPRectF; + frameUnit: TMetafileFrameUnit = MetafileFrameUnitGdi; + type_: TEmfType = EmfTypeEmfPlusDual; description: PWCHAR = nil); + var metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipRecordMetafile(referenceHdc, type_, @frameRect, frameUnit, + description, metafile); + SetNativeImage(metafile); + end; + + // Record a metafile to memory. + + constructor TGPMetafile.Create(referenceHdc: HDC; frameRect: TGPRect; + frameUnit: TMetafileFrameUnit = MetafileFrameUnitGdi; + type_: TEmfType = EmfTypeEmfPlusDual; description: PWCHAR = nil); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipRecordMetafileI(referenceHdc, type_, @frameRect, frameUnit, + description, metafile); + SetNativeImage(metafile); + end; + + constructor TGPMetafile.Create(fileName: WideString; referenceHdc: HDC; + type_: TEmfType = EmfTypeEmfPlusDual; description: PWCHAR = nil); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipRecordMetafileFileName(PWideChar(fileName), + referenceHdc, type_, nil, MetafileFrameUnitGdi, description, metafile); + SetNativeImage(metafile); + end; + + constructor TGPMetafile.Create(fileName: WideString; referenceHdc: HDC; frameRect: TGPRectF; + frameUnit: TMetafileFrameUnit = MetafileFrameUnitGdi; type_: TEmfType = EmfTypeEmfPlusDual; + description: PWCHAR = nil); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipRecordMetafileFileName(PWideChar(fileName), referenceHdc, + type_, @frameRect, frameUnit, description, metafile); + SetNativeImage(metafile); + end; + + constructor TGPMetafile.Create(fileName: WideString; referenceHdc: HDC; frameRect: TGPRect; + frameUnit: TMetafileFrameUnit = MetafileFrameUnitGdi; type_: TEmfType = EmfTypeEmfPlusDual; + description: PWCHAR = nil); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipRecordMetafileFileNameI(PWideChar(fileName), + referenceHdc, type_, @frameRect, frameUnit, description, metafile); + SetNativeImage(metafile); + end; + + constructor TGPMetafile.Create(stream: IStream; referenceHdc: HDC; + type_: TEmfType = EmfTypeEmfPlusDual; description: PWCHAR = nil); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipRecordMetafileStream(stream, referenceHdc, type_, nil, + MetafileFrameUnitGdi, description, metafile); + SetNativeImage(metafile); + end; + + constructor TGPMetafile.Create(stream: IStream; referenceHdc: HDC; frameRect: TGPRectF; + frameUnit: TMetafileFrameUnit = MetafileFrameUnitGdi; type_: TEmfType = EmfTypeEmfPlusDual; + description: PWCHAR = nil); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipRecordMetafileStream(stream, referenceHdc, type_, + @frameRect, frameUnit, description, metafile); + SetNativeImage(metafile); + end; + + constructor TGPMetafile.Create(stream : IStream; referenceHdc : HDC; frameRect : TGPRect; + frameUnit : TMetafileFrameUnit = MetafileFrameUnitGdi; type_ : TEmfType = EmfTypeEmfPlusDual; + description : PWCHAR = nil); + var + metafile: GpMetafile; + begin + metafile := nil; + lastResult := GdipRecordMetafileStreamI(stream, referenceHdc, type_, + @frameRect, frameUnit, description, metafile); + SetNativeImage(metafile); + end; + + function TGPMetafile.GetMetafileHeader(hWmf: HMETAFILE; + var wmfPlaceableFileHeader: TWmfPlaceableFileHeader; header: TMetafileHeader): TStatus; + begin + result := GdipGetMetafileHeaderFromWmf(hWmf, @wmfPlaceableFileHeader, @header.Type_); + end; + + function TGPMetafile.GetMetafileHeader(hEmf: HENHMETAFILE; header: TMetafileHeader): TStatus; + begin + result := GdipGetMetafileHeaderFromEmf(hEmf, @header.Type_); + end; + + function TGPMetafile.GetMetafileHeader(filename: WideString; header: TMetafileHeader): TStatus; + begin + result := GdipGetMetafileHeaderFromFile(PWideChar(filename), @header.Type_); + end; + + function TGPMetafile.GetMetafileHeader(stream: IStream; header: TMetafileHeader): TStatus; + begin + result := GdipGetMetafileHeaderFromStream(stream, @header.Type_); + end; + + function TGPMetafile.GetMetafileHeader(header: TMetafileHeader): TStatus; + begin + result := SetStatus(GdipGetMetafileHeaderFromMetafile(GpMetafile(nativeImage), + @header.Type_)); + end; + + // Once this method is called, the Metafile object is in an invalid state + // and can no longer be used. It is the responsiblity of the caller to + // invoke DeleteEnhMetaFile to delete this hEmf. + + function TGPMetafile.GetHENHMETAFILE: HENHMETAFILE; + begin + SetStatus(GdipGetHemfFromMetafile(GpMetafile(nativeImage), result)); + end; + + // Used in conjuction with Graphics::EnumerateMetafile to play an EMF+ + // The data must be DWORD aligned if it's an EMF or EMF+. It must be + // WORD aligned if it's a WMF. + + function TGPMetafile.PlayRecord(recordType: TEmfPlusRecordType; flags, dataSize: UINT; + data: PBYTE): TStatus; + begin + result := SetStatus(GdipPlayMetafileRecord(GpMetafile(nativeImage), + recordType, flags, dataSize, data)); + end; + + // If you're using a printer HDC for the metafile, but you want the + // metafile rasterized at screen resolution, then use this API to set + // the rasterization dpi of the metafile to the screen resolution, + // e.g. 96 dpi or 120 dpi. + + function TGPMetafile.SetDownLevelRasterizationLimit(metafileRasterizationLimitDpi: UINT): TStatus; + begin + result := SetStatus(GdipSetMetafileDownLevelRasterizationLimit( + GpMetafile(nativeImage), metafileRasterizationLimitDpi)); + end; + + function TGPMetafile.GetDownLevelRasterizationLimit: UINT; + var metafileRasterizationLimitDpi: UINT; + begin + metafileRasterizationLimitDpi := 0; + SetStatus(GdipGetMetafileDownLevelRasterizationLimit( + GpMetafile(nativeImage), metafileRasterizationLimitDpi)); + result := metafileRasterizationLimitDpi; + end; + + function TGPMetafile.EmfToWmfBits(hemf: HENHMETAFILE; cbData16: UINT; pData16: PBYTE; + iMapMode: Integer = MM_ANISOTROPIC; eFlags: TEmfToWmfBitsFlags = EmfToWmfBitsFlagsDefault): UINT; + begin + result := GdipEmfToWmfBits(hemf, cbData16, pData16, iMapMode, Integer(eFlags)); + end; + + constructor TGPMetafile.Create; + begin + SetNativeImage(nil); + lastResult := Ok; + end; + +(**************************************************************************\ +* +* GDI+ Codec Image APIs +* +\**************************************************************************) + +//-------------------------------------------------------------------------- +// Codec Management APIs +//-------------------------------------------------------------------------- + + function GetImageDecodersSize(out numDecoders, size: UINT): TStatus; + begin + result := GdipGetImageDecodersSize(numDecoders, size); + end; + + function GetImageDecoders(numDecoders, size: UINT; + decoders: PImageCodecInfo): TStatus; + begin + result := GdipGetImageDecoders(numDecoders, size, decoders); + end; + + + function GetImageEncodersSize(out numEncoders, size: UINT): TStatus; + begin + result := GdipGetImageEncodersSize(numEncoders, size); + end; + + function GetImageEncoders(numEncoders, size: UINT; + encoders: PImageCodecInfo): TStatus; + begin + result := GdipGetImageEncoders(numEncoders, size, encoders); + end; + +(**************************************************************************\ +* +* GDI+ Region class implementation +* +\**************************************************************************) + + constructor TGPRegion.Create; + var + region: GpRegion; + begin + region := nil; + lastResult := GdipCreateRegion(region); + SetNativeRegion(region); + end; + + constructor TGPRegion.Create(rect: TGPRectF); + var + region: GpRegion; + begin + region := nil; + lastResult := GdipCreateRegionRect(@rect, region); + SetNativeRegion(region); + end; + + constructor TGPRegion.Create(rect: TGPRect); + var + region: GpRegion; + begin + region := nil; + lastResult := GdipCreateRegionRectI(@rect, region); + SetNativeRegion(region); + end; + + constructor TGPRegion.Create(path: TGPGraphicsPath); + var + region: GpRegion; + begin + region := nil; + lastResult := GdipCreateRegionPath(path.nativePath, region); + SetNativeRegion(region); + end; + + constructor TGPRegion.Create(regionData: PBYTE; size: Integer); + var + region: GpRegion; + begin + region := nil; + lastResult := GdipCreateRegionRgnData(regionData, size, region); + SetNativeRegion(region); + end; + + constructor TGPRegion.Create(hRgn: HRGN); + var + region: GpRegion; + begin + region := nil; + lastResult := GdipCreateRegionHrgn(hRgn, region); + SetNativeRegion(region); + end; + + function TGPRegion.FromHRGN(hRgn: HRGN): TGPRegion; + var + region: GpRegion; + begin + region := nil; + if (GdipCreateRegionHrgn(hRgn, region) = Ok) then + begin + result := TGPRegion.Create(region); + if (result = nil) then + GdipDeleteRegion(region); + exit; + end + else + result := nil; + end; + + destructor TGPRegion.Destroy; + begin + GdipDeleteRegion(nativeRegion); + end; + + function TGPRegion.Clone: TGPRegion; + var region: GpRegion; + begin + region := nil; + SetStatus(GdipCloneRegion(nativeRegion, region)); + result := TGPRegion.Create(region); + end; + + function TGPRegion.MakeInfinite: TStatus; + begin + result := SetStatus(GdipSetInfinite(nativeRegion)); + end; + + function TGPRegion.MakeEmpty: TStatus; + begin + result := SetStatus(GdipSetEmpty(nativeRegion)); + end; + + // Get the size of the buffer needed for the GetData method + function TGPRegion.GetDataSize: UINT; + var bufferSize: UINT; + begin + bufferSize := 0; + SetStatus(GdipGetRegionDataSize(nativeRegion, bufferSize)); + result := bufferSize; + end; + + + // buffer - where to put the data + // bufferSize - how big the buffer is (should be at least as big as GetDataSize()) + // sizeFilled - if not nil, this is an OUT param that says how many bytes + // of data were written to the buffer. + + function TGPRegion.GetData(buffer: PBYTE; bufferSize: UINT; sizeFilled: PUINT = nil): TStatus; + begin + result := SetStatus(GdipGetRegionData(nativeRegion, buffer, bufferSize, sizeFilled)); + end; + + function TGPRegion.Intersect(const rect: TGPRect): TStatus; + begin + result := SetStatus(GdipCombineRegionRectI(nativeRegion, @rect, CombineModeIntersect)); + end; + + function TGPRegion.Intersect(const rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipCombineRegionRect(nativeRegion, @rect, CombineModeIntersect)); + end; + + function TGPRegion.Intersect(path: TGPGraphicsPath): TStatus; + begin + result := SetStatus(GdipCombineRegionPath(nativeRegion, path.nativePath, + CombineModeIntersect)); + end; + + function TGPRegion.Intersect(region: TGPRegion): TStatus; + begin + result := SetStatus(GdipCombineRegionRegion(nativeRegion, region.nativeRegion, + CombineModeIntersect)); + end; + + function TGPRegion.Union(const rect: TGPRect): TStatus; + begin + result := SetStatus(GdipCombineRegionRectI(nativeRegion, @rect, CombineModeUnion)); + end; + + function TGPRegion.Union(const rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipCombineRegionRect(nativeRegion, @rect, CombineModeUnion)); + end; + + function TGPRegion.Union(path: TGPGraphicsPath): TStatus; + begin + result := SetStatus(GdipCombineRegionPath(nativeRegion, path.nativePath, CombineModeUnion)); + end; + + function TGPRegion.Union(region: TGPRegion): TStatus; + begin + result := SetStatus(GdipCombineRegionRegion(nativeRegion, region.nativeRegion, + CombineModeUnion)); + end; + + function TGPRegion.Xor_(const rect: TGPRect): TStatus; + begin + result := SetStatus(GdipCombineRegionRectI(nativeRegion, @rect, CombineModeXor)); + end; + + function TGPRegion.Xor_(const rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipCombineRegionRect(nativeRegion, @rect, CombineModeXor)); + end; + + function TGPRegion.Xor_(path: TGPGraphicsPath): TStatus; + begin + result := SetStatus(GdipCombineRegionPath(nativeRegion, path.nativePath, CombineModeXor)); + end; + + function TGPRegion.Xor_(region: TGPRegion): TStatus; + begin + result := SetStatus(GdipCombineRegionRegion(nativeRegion, region.nativeRegion, + CombineModeXor)); + end; + + function TGPRegion.Exclude(const rect: TGPRect): TStatus; + begin + result := SetStatus(GdipCombineRegionRectI(nativeRegion, @rect, CombineModeExclude)); + end; + + function TGPRegion.Exclude(const rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipCombineRegionRect(nativeRegion, @rect, CombineModeExclude)); + end; + + function TGPRegion.Exclude(path: TGPGraphicsPath): TStatus; + begin + result := SetStatus(GdipCombineRegionPath(nativeRegion, path.nativePath, CombineModeExclude)); + end; + + function TGPRegion.Exclude(region: TGPRegion): TStatus; + begin + result := SetStatus(GdipCombineRegionRegion(nativeRegion, + region.nativeRegion, + CombineModeExclude)); + end; + + function TGPRegion.Complement(const rect: TGPRect): TStatus; + begin + result := SetStatus(GdipCombineRegionRectI(nativeRegion, @rect, + CombineModeComplement)); + end; + + function TGPRegion.Complement(const rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipCombineRegionRect(nativeRegion, @rect, + CombineModeComplement)); + end; + + function TGPRegion.Complement(path: TGPGraphicsPath): TStatus; + begin + result := SetStatus(GdipCombineRegionPath(nativeRegion, + path.nativePath, + CombineModeComplement)); + end; + + function TGPRegion.Complement(region: TGPRegion): TStatus; + begin + result := SetStatus(GdipCombineRegionRegion(nativeRegion, + region.nativeRegion, + CombineModeComplement)); + end; + + function TGPRegion.Translate(dx, dy: Single): TStatus; + begin + result := SetStatus(GdipTranslateRegion(nativeRegion, dx, dy)); + end; + + function TGPRegion.Translate(dx, dy: Integer): TStatus; + begin + result := SetStatus(GdipTranslateRegionI(nativeRegion, dx, dy)); + end; + + function TGPRegion.Transform(matrix: TGPMatrix): TStatus; + begin + result := SetStatus(GdipTransformRegion(nativeRegion, + matrix.nativeMatrix)); + end; + + function TGPRegion.GetBounds(out rect: TGPRect; g: TGPGraphics): TStatus; + begin + result := SetStatus(GdipGetRegionBoundsI(nativeRegion, + g.nativeGraphics, + @rect)); + end; + + function TGPRegion.GetBounds(out rect: TGPRectF; g: TGPGraphics): TStatus; + begin + result := SetStatus(GdipGetRegionBounds(nativeRegion, + g.nativeGraphics, + @rect)); + end; + + function TGPRegion.GetHRGN(g: TGPGraphics): HRGN; + begin + SetStatus(GdipGetRegionHRgn(nativeRegion, g.nativeGraphics, result)); + end; + + function TGPRegion.IsEmpty(g: TGPGraphics): BOOL; + var booln: BOOL; + begin + booln := FALSE; + SetStatus(GdipIsEmptyRegion(nativeRegion, g.nativeGraphics, booln)); + result := booln; + end; + + function TGPRegion.IsInfinite(g: TGPGraphics): BOOL ; + var booln: BOOL; + begin + booln := FALSE; + SetStatus(GdipIsInfiniteRegion(nativeRegion, g.nativeGraphics, booln)); + result := booln; + end; + + function TGPRegion.IsVisible(x, y: Integer; g: TGPGraphics = nil): BOOL; + var + booln: BOOL; + GPX: GpGraphics; + begin + booln := FALSE; + if assigned(g) then gpx := g.nativeGraphics else gpx := nil; + SetStatus(GdipIsVisibleRegionPointI(nativeRegion, X, Y, gpx, booln)); + result := booln; + end; + + function TGPRegion.IsVisible(const point: TGPPoint; g: TGPGraphics = nil): BOOL; + var + booln: BOOL; + GPX: GpGraphics; + begin + booln := FALSE; + if assigned(g) then gpx := g.nativeGraphics else gpx := nil; + SetStatus(GdipIsVisibleRegionPointI(nativeRegion, point.X, point.Y, gpx, booln)); + result := booln; + end; + + function TGPRegion.IsVisible(x, y: Single; g: TGPGraphics = nil): BOOL; + var + booln: BOOL; + GPX: GpGraphics; + begin + booln := FALSE; + if assigned(g) then gpx := g.nativeGraphics else gpx := nil; + SetStatus(GdipIsVisibleRegionPoint(nativeRegion, X, Y, gpx, booln)); + result := booln; + end; + + function TGPRegion.IsVisible(const point: TGPPointF; g: TGPGraphics = nil): BOOL; + var + booln: BOOL; + GPX: GpGraphics; + begin + booln := FALSE; + if assigned(g) then gpx := g.nativeGraphics else gpx := nil; + SetStatus(GdipIsVisibleRegionPoint(nativeRegion, point.X, point.Y, gpx, booln)); + result := booln; + end; + + function TGPRegion.IsVisible(x, y, width, height: Integer; g: TGPGraphics): BOOL; + var + booln: BOOL; + GPX: GpGraphics; + begin + booln := FALSE; + if assigned(g) then gpx := g.nativeGraphics else gpx := nil; + SetStatus(GdipIsVisibleRegionRectI(nativeRegion, + X, + Y, + Width, + Height, + gpx, + booln)); + result := booln; + end; + + function TGPRegion.IsVisible(const rect: TGPRect; g: TGPGraphics = nil): BOOL; + var + booln: BOOL; + GPX: GpGraphics; + begin + booln := FALSE; + if assigned(g) then gpx := g.nativeGraphics else gpx := nil; + SetStatus(GdipIsVisibleRegionRectI(nativeRegion, + rect.X, + rect.Y, + rect.Width, + rect.Height, + gpx, + booln)); + result := booln; + end; + + function TGPRegion.IsVisible(x, y, width, height: Single; g: TGPGraphics = nil): BOOL; + var + booln: BOOL; + GPX: GpGraphics; + begin + booln := FALSE; + if assigned(g) then gpx := g.nativeGraphics else gpx := nil; + SetStatus(GdipIsVisibleRegionRect(nativeRegion, X, + Y, Width, + Height, + gpx, + booln)); + result := booln; + end; + + function TGPRegion.IsVisible(const rect: TGPRectF; g: TGPGraphics = nil): BOOL; + var + booln: BOOL; + GPX: GpGraphics; + begin + booln := FALSE; + if assigned(g) then gpx := g.nativeGraphics else gpx := nil; + SetStatus(GdipIsVisibleRegionRect(nativeRegion, rect.X, + rect.Y, rect.Width, + rect.Height, + gpx, + booln)); + result := booln; + end; + + function TGPRegion.Equals(region: TGPRegion; g: TGPGraphics): BOOL; + var + booln: BOOL; + begin + booln := FALSE; + SetStatus(GdipIsEqualRegion(nativeRegion, + region.nativeRegion, + g.nativeGraphics, + booln)); + result := booln; + end; + + function TGPRegion.GetRegionScansCount(matrix: TGPMatrix): UINT; + var Count: UINT; + begin + count := 0; + SetStatus(GdipGetRegionScansCount(nativeRegion, count, matrix.nativeMatrix)); + result := count; + end; + + // If rects is nil, result := the count of rects in the region. + // Otherwise, assume rects is big enough to hold all the region rects + // and fill them in and result := the number of rects filled in. + // The rects are result :=ed in the units specified by the matrix + // (which is typically a world-to-device transform). + // Note that the number of rects result :=ed can vary, depending on the + // matrix that is used. + + function TGPRegion.GetRegionScans(matrix: TGPMatrix; rects: PGPRectF; out count: Integer): TStatus; + begin + result := SetStatus(GdipGetRegionScans(nativeRegion, + rects, + count, + matrix.nativeMatrix)); + end; + + function TGPRegion.GetRegionScans(matrix: TGPMatrix; rects: PGPRect; out count: Integer): TStatus; + begin + result := SetStatus(GdipGetRegionScansI(nativeRegion, + rects, + count, + matrix.nativeMatrix)); + end; + + function TGPRegion.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + + function TGPRegion.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then lastResult := status; + result := status; + end; + + constructor TGPRegion.Create(nativeRegion: GpRegion); + begin + SetNativeRegion(nativeRegion); + end; + + procedure TGPRegion.SetNativeRegion(nativeRegion: GpRegion); + begin + self.nativeRegion := nativeRegion; + end; + +(**************************************************************************\ +* +* GDI+ CustomLineCap APIs +* +\**************************************************************************) + + constructor TGPCustomLineCap.Create(fillPath, strokePath: TGPGraphicsPath; + baseCap: TLineCap = LineCapFlat; baseInset: Single = 0); + var nativeFillPath, nativeStrokePath: GpPath; + begin + nativeCap := nil; + nativeFillPath := nil; + nativeStrokePath := nil; + + if assigned(fillPath) then nativeFillPath := fillPath.nativePath; + if assigned(strokePath) then nativeStrokePath := strokePath.nativePath; + + lastResult := GdipCreateCustomLineCap(nativeFillPath, nativeStrokePath, + baseCap, baseInset, nativeCap); + end; + + destructor TGPCustomLineCap.Destroy; + begin + GdipDeleteCustomLineCap(nativeCap); + end; + + function TGPCustomLineCap.Clone: TGPCustomLineCap; + var newNativeLineCap: GpCustomLineCap; + begin + newNativeLineCap := nil; + SetStatus(GdipCloneCustomLineCap(nativeCap, newNativeLineCap)); + if (lastResult = Ok) then + begin + result := TGPCustomLineCap.Create(newNativeLineCap, lastResult); + if (result = nil) then + SetStatus(GdipDeleteCustomLineCap(newNativeLineCap)); + end + else + result := nil; + end; + + // This changes both the start and end cap. + function TGPCustomLineCap.SetStrokeCap(strokeCap: TLineCap): TStatus; + begin + result := SetStrokeCaps(strokeCap, strokeCap); + end; + + function TGPCustomLineCap.SetStrokeCaps(startCap, endCap: TLineCap): TStatus; + begin + result := SetStatus(GdipSetCustomLineCapStrokeCaps(nativeCap, startCap, endCap)); + end; + + function TGPCustomLineCap.GetStrokeCaps(out startCap, endCap: TLineCap): TStatus; + begin + result := SetStatus(GdipGetCustomLineCapStrokeCaps(nativeCap, startCap, endCap)); + end; + + function TGPCustomLineCap.SetStrokeJoin(lineJoin: TLineJoin): TStatus; + begin + result := SetStatus(GdipSetCustomLineCapStrokeJoin(nativeCap, lineJoin)); + end; + + function TGPCustomLineCap.GetStrokeJoin: TLineJoin; + begin + SetStatus(GdipGetCustomLineCapStrokeJoin(nativeCap, result)); + end; + + function TGPCustomLineCap.SetBaseCap(baseCap: TLineCap): TStatus; + begin + result := SetStatus(GdipSetCustomLineCapBaseCap(nativeCap, baseCap)); + end; + + function TGPCustomLineCap.GetBaseCap: TLineCap; + begin + SetStatus(GdipGetCustomLineCapBaseCap(nativeCap, result)); + end; + + function TGPCustomLineCap.SetBaseInset(inset: Single): TStatus; + begin + result := SetStatus(GdipSetCustomLineCapBaseInset(nativeCap, inset)); + end; + + function TGPCustomLineCap.GetBaseInset: Single; + begin + SetStatus(GdipGetCustomLineCapBaseInset(nativeCap, result)); + end; + + function TGPCustomLineCap.SetWidthScale(widthScale: Single): TStatus; + begin + result := SetStatus(GdipSetCustomLineCapWidthScale(nativeCap, widthScale)); + end; + + function TGPCustomLineCap.GetWidthScale: Single; + begin + SetStatus(GdipGetCustomLineCapWidthScale(nativeCap, result)); + end; + + function TGPCustomLineCap.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + + constructor TGPCustomLineCap.Create; + begin + nativeCap := nil; + lastResult := Ok; + end; + + constructor TGPCustomLineCap.Create(nativeCap: GpCustomLineCap; status: TStatus); + begin + lastResult := status; + SetNativeCap(nativeCap); + end; + + procedure TGPCustomLineCap.SetNativeCap(nativeCap: GpCustomLineCap); + begin + self.nativeCap := nativeCap; + end; + + function TGPCustomLineCap.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then lastResult := status; + result := status; + end; + +(************************************************************************** +* +* CachedBitmap class definition +* +* GDI+ CachedBitmap is a representation of an accelerated drawing +* that has restrictions on what operations are allowed in order +* to accelerate the drawing to the destination. +* +**************************************************************************) + + constructor TGPCachedBitmap.Create(bitmap: TGPBitmap; graphics: TGPGraphics); + begin + nativeCachedBitmap := nil; + lastResult := GdipCreateCachedBitmap( + GpBitmap(bitmap.nativeImage), + graphics.nativeGraphics, + nativeCachedBitmap); + end; + + destructor TGPCachedBitmap.Destroy; + begin + GdipDeleteCachedBitmap(nativeCachedBitmap); + end; + + function TGPCachedBitmap.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + +(**************************************************************************\ +* +* GDI+ Pen class +* +\**************************************************************************) + + //-------------------------------------------------------------------------- + // Pen class + //-------------------------------------------------------------------------- + + constructor TGPPen.Create(color: TGPColor; width: Single = 1.0); + var unit_: TUnit; + begin + unit_ := UnitWorld; + nativePen := nil; + lastResult := GdipCreatePen1(color, width, unit_, nativePen); + end; + + constructor TGPPen.Create(brush: TGPBrush; width: Single = 1.0); + var unit_: TUnit; + begin + unit_ := UnitWorld; + nativePen := nil; + lastResult := GdipCreatePen2(brush.nativeBrush, width, unit_, nativePen); + end; + + destructor TGPPen.Destroy; + begin + GdipDeletePen(nativePen); + end; + + function TGPPen.Clone: TGPPen; + var clonePen: GpPen; + begin + clonePen := nil; + lastResult := GdipClonePen(nativePen, clonePen); + result := TGPPen.Create(clonePen, lastResult); + end; + + function TGPPen.SetWidth(width: Single): TStatus; + begin + result := SetStatus(GdipSetPenWidth(nativePen, width)); + end; + + function TGPPen.GetWidth: Single; + begin + SetStatus(GdipGetPenWidth(nativePen, result)); + end; + + // Set/get line caps: start, end, and dash + // Line cap and join APIs by using LineCap and LineJoin enums. + + function TGPPen.SetLineCap(startCap, endCap: TLineCap; dashCap: TDashCap): TStatus; + begin + result := SetStatus(GdipSetPenLineCap197819(nativePen, startCap, endCap, dashCap)); + end; + + function TGPPen.SetStartCap(startCap: TLineCap): TStatus; + begin + result := SetStatus(GdipSetPenStartCap(nativePen, startCap)); + end; + + function TGPPen.SetEndCap(endCap: TLineCap): TStatus; + begin + result := SetStatus(GdipSetPenEndCap(nativePen, endCap)); + end; + + function TGPPen.SetDashCap(dashCap: TDashCap): TStatus; + begin + result := SetStatus(GdipSetPenDashCap197819(nativePen, dashCap)); + end; + + function TGPPen.GetStartCap: TLineCap; + begin + SetStatus(GdipGetPenStartCap(nativePen, result)); + end; + + function TGPPen.GetEndCap: TLineCap; + begin + SetStatus(GdipGetPenEndCap(nativePen, result)); + end; + + function TGPPen.GetDashCap: TDashCap; + begin + SetStatus(GdipGetPenDashCap197819(nativePen, result)); + end; + + function TGPPen.SetLineJoin(lineJoin: TLineJoin): TStatus; + begin + result := SetStatus(GdipSetPenLineJoin(nativePen, lineJoin)); + end; + + function TGPPen.GetLineJoin: TLineJoin; + begin + SetStatus(GdipGetPenLineJoin(nativePen, result)); + end; + + function TGPPen.SetCustomStartCap(customCap: TGPCustomLineCap): TStatus; + var nativeCap: GpCustomLineCap; + begin + nativeCap := nil; + if assigned(customCap) then nativeCap := customCap.nativeCap; + result := SetStatus(GdipSetPenCustomStartCap(nativePen, nativeCap)); + end; + + function TGPPen.GetCustomStartCap(customCap: TGPCustomLineCap): TStatus; + begin + if(customCap = nil) then + result := SetStatus(InvalidParameter) + else + result := SetStatus(GdipGetPenCustomStartCap(nativePen, customCap.nativeCap)); + end; + + function TGPPen.SetCustomEndCap(customCap: TGPCustomLineCap): TStatus; + var nativeCap: GpCustomLineCap; + begin + nativeCap := nil; + if assigned(customCap) then nativeCap := customCap.nativeCap; + result := SetStatus(GdipSetPenCustomEndCap(nativePen, nativeCap)); + end; + + function TGPPen.GetCustomEndCap(customCap: TGPCustomLineCap): TStatus; + begin + if(customCap = nil) then + result := SetStatus(InvalidParameter) + else + result := SetStatus(GdipGetPenCustomEndCap(nativePen, customCap.nativeCap)); + end; + + function TGPPen.SetMiterLimit(miterLimit: Single): TStatus; + begin + result := SetStatus(GdipSetPenMiterLimit(nativePen, miterLimit)); + end; + + function TGPPen.GetMiterLimit: Single; + begin + SetStatus(GdipGetPenMiterLimit(nativePen, result)); + end; + + function TGPPen.SetAlignment(penAlignment: TPenAlignment): TStatus; + begin + result := SetStatus(GdipSetPenMode(nativePen, penAlignment)); + end; + + function TGPPen.GetAlignment: TPenAlignment; + begin + SetStatus(GdipGetPenMode(nativePen, result)); + end; + + function TGPPen.SetTransform(matrix: TGPMatrix): TStatus; + begin + result := SetStatus(GdipSetPenTransform(nativePen, matrix.nativeMatrix)); + end; + + function TGPPen.GetTransform(matrix: TGPMatrix): TStatus; + begin + result := SetStatus(GdipGetPenTransform(nativePen, matrix.nativeMatrix)); + end; + + function TGPPen.ResetTransform: TStatus; + begin + result := SetStatus(GdipResetPenTransform(nativePen)); + end; + + function TGPPen.MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipMultiplyPenTransform(nativePen, matrix.nativeMatrix, order)); + end; + + function TGPPen.TranslateTransform(dx, dy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipTranslatePenTransform(nativePen, dx, dy, order)); + end; + + function TGPPen.ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipScalePenTransform(nativePen, sx, sy, order)); + end; + + function TGPPen.RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipRotatePenTransform(nativePen, angle, order)); + end; + + function TGPPen.GetPenType: TPenType; + begin + SetStatus(GdipGetPenFillType(nativePen, result)); + end; + + function TGPPen.SetColor(color: TGPColor): TStatus; + begin + result := SetStatus(GdipSetPenColor(nativePen, color)); + end; + + function TGPPen.SetBrush(brush: TGPBrush): TStatus; + begin + result := SetStatus(GdipSetPenBrushFill(nativePen, brush.nativeBrush)); + end; + + function TGPPen.GetColor(out Color: TGPColor): TStatus; + var + type_: TPenType; + argb: DWORD; + begin + type_ := GetPenType; + + if (type_ <> PenTypeSolidColor) then + begin + result := WrongState; + exit; + end; + + SetStatus(GdipGetPenColor(nativePen, argb)); + if (lastResult = Ok) then color := argb; + result := lastResult; + end; + + function TGPPen.GetBrush: TGPBrush; + var + type_: TPenType; + Brush: TGPBrush; + nativeBrush: GpBrush; + begin + type_ := GetPenType; + brush := nil; + + case type_ of + PenTypeSolidColor : brush := TGPSolidBrush.Create; + PenTypeHatchFill : brush := TGPHatchBrush.Create; + PenTypeTextureFill : brush := TGPTextureBrush.Create; + PenTypePathGradient : brush := TGPBrush.Create; + PenTypeLinearGradient : brush := TGPLinearGradientBrush.Create; + end; + + if (brush <> nil) then + begin + SetStatus(GdipGetPenBrushFill(nativePen, nativeBrush)); + brush.SetNativeBrush(nativeBrush); + end; + + result := brush; + end; + + function TGPPen.GetDashStyle: TDashStyle; + begin + SetStatus(GdipGetPenDashStyle(nativePen, result)); + end; + + function TGPPen.SetDashStyle(dashStyle: TDashStyle): TStatus; + begin + result := SetStatus(GdipSetPenDashStyle(nativePen, dashStyle)); + end; + + function TGPPen.GetDashOffset: Single; + begin + SetStatus(GdipGetPenDashOffset(nativePen, result)); + end; + + function TGPPen.SetDashOffset(dashOffset: Single): TStatus; + begin + result := SetStatus(GdipSetPenDashOffset(nativePen, dashOffset)); + end; + + function TGPPen.SetDashPattern(dashArray: PSingle; count: Integer): TStatus; + begin + result := SetStatus(GdipSetPenDashArray(nativePen, dashArray, count)); + end; + + function TGPPen.GetDashPatternCount: Integer; + begin + SetStatus(GdipGetPenDashCount(nativePen, result)); + end; + + function TGPPen.GetDashPattern(dashArray: PSingle; count: Integer): TStatus; + begin + result := SetStatus(GdipGetPenDashArray(nativePen, dashArray, count)); + end; + + function TGPPen.SetCompoundArray(compoundArray: PSingle; count: Integer): TStatus; + begin + result := SetStatus(GdipSetPenCompoundArray(nativePen, compoundArray, count)); + end; + + function TGPPen.GetCompoundArrayCount: Integer; + begin + SetStatus(GdipGetPenCompoundCount(nativePen, result)); + end; + + function TGPPen.GetCompoundArray(compoundArray: PSingle; count: Integer): TStatus; + begin + if (count <= 0) then + result := SetStatus(InvalidParameter) + else + result := SetStatus(GdipGetPenCompoundArray(nativePen, compoundArray, count)); + end; + + function TGPPen.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + + constructor TGPPen.Create(nativePen: GpPen; status: TStatus); + begin + lastResult := status; + SetNativePen(nativePen); + end; + + procedure TGPPen.SetNativePen(nativePen: GpPen); + begin + self.nativePen := nativePen; + end; + + function TGPPen.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then lastResult := status; + result := status; + end; + +(**************************************************************************\ +* +* GDI+ Brush class +* +\**************************************************************************) + +//-------------------------------------------------------------------------- +// Abstract base class for various brush types +//-------------------------------------------------------------------------- + + destructor TGPBrush.Destroy; + begin + GdipDeleteBrush(nativeBrush); + end; + + function TGPBrush.Clone: TGPBrush; + var + brush: GpBrush; + newBrush: TGPBrush; + begin + brush := nil; + SetStatus(GdipCloneBrush(nativeBrush, brush)); + newBrush := TGPBrush.Create(brush, lastResult); + if (newBrush = nil) then + GdipDeleteBrush(brush); + result := newBrush; + end; + + function TGPBrush.GetType: TBrushType; + var type_: TBrushType; + begin + type_ := TBrushType(-1); + SetStatus(GdipGetBrushType(nativeBrush, type_)); + result := type_; + end; + + function TGPBrush.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + + constructor TGPBrush.Create; + begin + SetStatus(NotImplemented); + end; + + constructor TGPBrush.Create(nativeBrush: GpBrush; status: TStatus); + begin + lastResult := status; + SetNativeBrush(nativeBrush); + end; + + procedure TGPBrush.SetNativeBrush(nativeBrush: GpBrush); + begin + self.nativeBrush := nativeBrush; + end; + + function TGPBrush.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then lastResult := status; + result := status; + end; + +//-------------------------------------------------------------------------- +// Solid Fill Brush Object +//-------------------------------------------------------------------------- + + constructor TGPSolidBrush.Create(color: TGPColor); + var + brush: GpSolidFill; + begin + brush := nil; + lastResult := GdipCreateSolidFill(color, brush); + SetNativeBrush(brush); + end; + + function TGPSolidBrush.GetColor(out color: TGPColor): TStatus; + begin + SetStatus(GdipGetSolidFillColor(GPSOLIDFILL(nativeBrush), color)); + result := lastResult; + end; + + function TGPSolidBrush.SetColor(color: TGPColor): TStatus; + begin + result := SetStatus(GdipSetSolidFillColor(GpSolidFill(nativeBrush), + color)); + end; + + constructor TGPSolidBrush.Create; + begin + // hide parent function + end; + +//-------------------------------------------------------------------------- +// Texture Brush Fill Object +//-------------------------------------------------------------------------- + + constructor TGPTextureBrush.Create(image: TGPImage; wrapMode: TWrapMode = WrapModeTile); + var texture: GpTexture; + begin + //texture := nil; + lastResult := GdipCreateTexture(image.nativeImage, wrapMode, texture); + SetNativeBrush(texture); + end; + + // When creating a texture brush from a metafile image, the dstRect + // is used to specify the size that the metafile image should be + // rendered at in the device units of the destination graphics. + // It is NOT used to crop the metafile image, so only the width + // and height values matter for metafiles. + + constructor TGPTextureBrush.Create(image: TGPImage; wrapMode: TWrapMode; dstRect: TGPRectF); + var texture: GpTexture; + begin + texture := nil; + lastResult := GdipCreateTexture2(image.nativeImage, wrapMode, dstRect.X, + dstRect.Y, dstRect.Width, dstRect.Height, texture); + SetNativeBrush(texture); + end; + + constructor TGPTextureBrush.Create(image: TGPImage; dstRect: TGPRectF; imageAttributes: TGPImageAttributes = nil); + var texture: GpTexture; + ImgAtt: GpImageAttributes; + begin + texture := nil; + if assigned(imageAttributes) then ImgAtt := imageAttributes.nativeImageAttr + else ImgAtt := nil; + + lastResult := GdipCreateTextureIA(image.nativeImage, ImgAtt, dstRect.X, + dstRect.Y, dstRect.Width, dstRect.Height, texture); + SetNativeBrush(texture); + end; + + constructor TGPTextureBrush.Create(image: TGPImage; dstRect: TGPRect; imageAttributes: TGPImageAttributes = nil); + var texture: GpTexture; + ImgAtt: GpImageAttributes; + begin + texture := nil; + if assigned(imageAttributes) then ImgAtt := imageAttributes.nativeImageAttr + else ImgAtt := nil; + lastResult := GdipCreateTextureIAI(image.nativeImage, ImgAtt, dstRect.X, + dstRect.Y, dstRect.Width, dstRect.Height, texture); + SetNativeBrush(texture); + end; + + constructor TGPTextureBrush.Create(image: TGPImage; wrapMode: TWrapMode; dstRect: TGPRect); + var texture: GpTexture; + begin + texture := nil; + lastResult := GdipCreateTexture2I(image.nativeImage, wrapMode, dstRect.X, + dstRect.Y, dstRect.Width, dstRect.Height, texture); + SetNativeBrush(texture); + end; + + constructor TGPTextureBrush.Create(image: TGPImage; wrapMode: TWrapMode; dstX, dstY, dstWidth, dstHeight: Single); + var texture: GpTexture; + begin + texture := nil; + lastResult := GdipCreateTexture2(image.nativeImage, wrapMode, dstX, dstY, + dstWidth, dstHeight, texture); + SetNativeBrush(texture); + end; + + constructor TGPTextureBrush.Create(image: TGPImage; wrapMode: TWrapMode; dstX, dstY, dstWidth, dstHeight: Integer); + var texture: GpTexture; + begin + texture := nil; + lastResult := GdipCreateTexture2I(image.nativeImage, wrapMode, dstX, dstY, + dstWidth, dstHeight, texture); + SetNativeBrush(texture); + end; + + function TGPTextureBrush.SetTransform(matrix: TGPMatrix): TStatus; + begin + result := SetStatus(GdipSetTextureTransform(GpTexture(nativeBrush), + matrix.nativeMatrix)); + end; + + function TGPTextureBrush.GetTransform(matrix: TGPMatrix): TStatus; + begin + result := SetStatus(GdipGetTextureTransform(GpTexture(nativeBrush), + matrix.nativeMatrix)); + end; + + function TGPTextureBrush.ResetTransform: TStatus; + begin + result := SetStatus(GdipResetTextureTransform(GpTexture(nativeBrush))); + end; + + function TGPTextureBrush.MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipMultiplyTextureTransform(GpTexture(nativeBrush), + matrix.nativeMatrix, order)); + end; + + function TGPTextureBrush.TranslateTransform(dx, dy: Single; order: MatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipTranslateTextureTransform(GpTexture(nativeBrush), + dx, dy, order)); + end; + + function TGPTextureBrush.ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipScaleTextureTransform(GpTexture(nativeBrush), + sx, sy, order)); + end; + + function TGPTextureBrush.RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipRotateTextureTransform(GpTexture(nativeBrush), + angle, order)); + end; + + function TGPTextureBrush.SetWrapMode(wrapMode: TWrapMode): TStatus; + begin + result := SetStatus(GdipSetTextureWrapMode(GpTexture(nativeBrush), wrapMode)); + end; + + function TGPTextureBrush.GetWrapMode: TWrapMode; + begin + SetStatus(GdipGetTextureWrapMode(GpTexture(nativeBrush), result)); + end; + + function TGPTextureBrush.GetImage: TGPImage; + var image: GpImage; + begin + SetStatus(GdipGetTextureImage(GpTexture(nativeBrush), image)); + result := TGPImage.Create(image, lastResult); + if (result = nil) then + GdipDisposeImage(image); + end; + + constructor TGPTextureBrush.Create; + begin + // hide parent function + end; + +//-------------------------------------------------------------------------- +// Linear Gradient Brush Object +//-------------------------------------------------------------------------- + + constructor TGPLinearGradientBrush.Create(const point1, point2: TGPPointF; color1, color2: TGPColor); + var brush: GpLineGradient; + begin + brush := nil; + lastResult := GdipCreateLineBrush(@point1, @point2, color1, color2, WrapModeTile, brush); + SetNativeBrush(brush); + end; + + constructor TGPLinearGradientBrush.Create(const point1, point2: TGPPoint; color1, color2: TGPColor); + var brush: GpLineGradient; + begin + brush := nil; + lastResult := GdipCreateLineBrushI(@point1, @point2, color1, + color2, WrapModeTile, brush); + SetNativeBrush(brush); + end; + + constructor TGPLinearGradientBrush.Create(rect: TGPRectF; color1, color2: TGPColor; mode: TLinearGradientMode); + var brush: GpLineGradient; + begin + brush := nil; + lastResult := GdipCreateLineBrushFromRect(@rect, color1, + color2, mode, WrapModeTile, brush); + SetNativeBrush(brush); + end; + + constructor TGPLinearGradientBrush.Create(rect: TGPRect; color1, color2: TGPColor; mode: TLinearGradientMode); + var brush: GpLineGradient; + begin + brush := nil; + lastResult := GdipCreateLineBrushFromRectI(@rect, color1, + color2, mode, WrapModeTile, brush); + SetNativeBrush(brush); + end; + + constructor TGPLinearGradientBrush.Create(rect: TGPRectF; color1, color2: TGPColor; angle: Single; isAngleScalable: BOOL = FALSE); + var brush: GpLineGradient; + begin + brush := nil; + lastResult := GdipCreateLineBrushFromRectWithAngle(@rect, color1, + color2, angle, isAngleScalable, WrapModeTile, brush); + SetNativeBrush(brush); + end; + + constructor TGPLinearGradientBrush.Create(rect: TGPRect; color1, color2: TGPColor; angle: Single; isAngleScalable: BOOL = FALSE); + var brush: GpLineGradient; + begin + brush := nil; + lastResult := GdipCreateLineBrushFromRectWithAngleI(@rect, color1, + color2, angle, isAngleScalable, WrapModeTile, brush); + SetNativeBrush(brush); + end; + + function TGPLinearGradientBrush.SetLinearColors(color1, color2: TGPColor): TStatus; + begin + result := SetStatus(GdipSetLineColors(GpLineGradient(nativeBrush), + color1, color2)); + end; + + function TGPLinearGradientBrush.GetLinearColors(out color1, color2: TGPColor): TStatus; + var colors: array[0..1] of TGPColor; + begin + SetStatus(GdipGetLineColors(GpLineGradient(nativeBrush), @colors)); + if (lastResult = Ok) then + begin + color1 := colors[0]; + color2 := colors[1]; + end; + result := lastResult; + end; + + function TGPLinearGradientBrush.GetRectangle(out rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipGetLineRect(GpLineGradient(nativeBrush), @rect)); + end; + + function TGPLinearGradientBrush.GetRectangle(out rect: TGPRect): TStatus; + begin + result := SetStatus(GdipGetLineRectI(GpLineGradient(nativeBrush), @rect)); + end; + + function TGPLinearGradientBrush.SetGammaCorrection(useGammaCorrection: BOOL): TStatus; + begin + result := SetStatus(GdipSetLineGammaCorrection(GpLineGradient(nativeBrush), + useGammaCorrection)); + end; + + function TGPLinearGradientBrush.GetGammaCorrection: BOOL; + var useGammaCorrection: BOOL; + begin + SetStatus(GdipGetLineGammaCorrection(GpLineGradient(nativeBrush), + useGammaCorrection)); + result := useGammaCorrection; + end; + + function TGPLinearGradientBrush.GetBlendCount: Integer; + var count: Integer; + begin + count := 0; + SetStatus(GdipGetLineBlendCount(GpLineGradient(nativeBrush), count)); + result := count; + end; + + function TGPLinearGradientBrush.SetBlend(blendFactors, blendPositions: PSingle; count: Integer): TStatus; + begin + result := SetStatus(GdipSetLineBlend(GpLineGradient(nativeBrush), + blendFactors, blendPositions, count)); + end; + + function TGPLinearGradientBrush.GetBlend(blendFactors, blendPositions: PSingle; count: Integer): TStatus; + begin + if ((count <= 0) or (blendFactors = nil) or (blendPositions = nil)) then + result := SetStatus(InvalidParameter) + else + result := SetStatus(GdipGetLineBlend(GpLineGradient(nativeBrush), blendFactors, + blendPositions, count)); + end; + + function TGPLinearGradientBrush.GetInterpolationColorCount: Integer; + var count: Integer; + begin + count := 0; + SetStatus(GdipGetLinePresetBlendCount(GpLineGradient(nativeBrush), count)); + result := count; + end; + + function TGPLinearGradientBrush.SetInterpolationColors(presetColors: PGPColor; + blendPositions: PSingle; count: Integer): TStatus; + begin + if (count <= 0) then + result := SetStatus(InvalidParameter) + else + result := SetStatus(GdipSetLinePresetBlend(GpLineGradient(nativeBrush), + PARGB(presetColors), blendPositions, count)); + end; + + function TGPLinearGradientBrush.GetInterpolationColors(presetColors: PGPColor; blendPositions: PSingle; count: Integer): TStatus; + begin + if (count <= 0) then + result := SetStatus(InvalidParameter) + else + result := SetStatus(GdipGetLinePresetBlend(GpLineGradient(nativeBrush), + PARGB(presetColors), blendPositions, count)); + end; + + function TGPLinearGradientBrush.SetBlendBellShape(focus: Single; scale: Single = 1.0): TStatus; + begin + result := SetStatus(GdipSetLineSigmaBlend(GpLineGradient(nativeBrush), focus, scale)); + end; + + function TGPLinearGradientBrush.SetBlendTriangularShape(focus: Single; scale: Single = 1.0): TStatus; + begin + result := SetStatus(GdipSetLineLinearBlend(GpLineGradient(nativeBrush), focus, scale)); + end; + + function TGPLinearGradientBrush.SetTransform(matrix: TGPMatrix): TStatus; + begin + result := SetStatus(GdipSetLineTransform(GpLineGradient(nativeBrush), + matrix.nativeMatrix)); + end; + + function TGPLinearGradientBrush.GetTransform(matrix: TGPMatrix): TStatus; + begin + result := SetStatus(GdipGetLineTransform(GpLineGradient(nativeBrush), + matrix.nativeMatrix)); + end; + + function TGPLinearGradientBrush.ResetTransform: TStatus; + begin + result := SetStatus(GdipResetLineTransform(GpLineGradient(nativeBrush))); + end; + + function TGPLinearGradientBrush.MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipMultiplyLineTransform(GpLineGradient(nativeBrush), + matrix.nativeMatrix, + order)); + end; + + function TGPLinearGradientBrush.TranslateTransform(dx, dy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipTranslateLineTransform(GpLineGradient(nativeBrush), + dx, dy, order)); + end; + + function TGPLinearGradientBrush.ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipScaleLineTransform(GpLineGradient(nativeBrush), + sx, sy, order)); + end; + + function TGPLinearGradientBrush.RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipRotateLineTransform(GpLineGradient(nativeBrush), + angle, order)); + end; + + function TGPLinearGradientBrush.SetWrapMode(wrapMode: TWrapMode): TStatus; + begin + result := SetStatus(GdipSetLineWrapMode(GpLineGradient(nativeBrush), wrapMode)); + end; + + function TGPLinearGradientBrush.GetWrapMode: TWrapMode; + begin + SetStatus(GdipGetLineWrapMode(GpLineGradient(nativeBrush), result)); + end; + + constructor TGPLinearGradientBrush.Create; + begin + // hide parent function + end; + +//-------------------------------------------------------------------------- +// Hatch Brush Object +//-------------------------------------------------------------------------- + + constructor TGPHatchBrush.Create(hatchStyle: THatchStyle; foreColor: TGPColor; backColor: TGPColor = aclBlack); + var + brush: GpHatch; + begin + brush := nil; + lastResult := GdipCreateHatchBrush(Integer(hatchStyle), foreColor, backColor, brush); + SetNativeBrush(brush); + end; + + function TGPHatchBrush.GetHatchStyle: THatchStyle; + begin + SetStatus(GdipGetHatchStyle(GpHatch(nativeBrush), result)); + end; + + function TGPHatchBrush.GetForegroundColor(out color: TGPColor): TStatus; + begin + result := SetStatus(GdipGetHatchForegroundColor(GpHatch(nativeBrush), color)); + end; + + function TGPHatchBrush.GetBackgroundColor(out color: TGPColor): TStatus; + begin + result := SetStatus(GdipGetHatchBackgroundColor(GpHatch(nativeBrush), color)); + end; + + constructor TGPHatchBrush.Create; + begin + end; + + constructor TGPImage.Create(filename: WideString; + useEmbeddedColorManagement: BOOL = FALSE); + begin + nativeImage := nil; + if(useEmbeddedColorManagement) then + begin + lastResult := GdipLoadImageFromFileICM( + PWideChar(filename), + nativeImage + ); + end + else + begin + lastResult := GdipLoadImageFromFile( + PWideChar(filename), + nativeImage + ); + end; + end; + + constructor TGPImage.Create(stream: IStream; + useEmbeddedColorManagement: BOOL = FALSE); + begin + nativeImage := nil; + if(useEmbeddedColorManagement) then + lastResult := GdipLoadImageFromStreamICM(stream, nativeImage) + else lastResult := GdipLoadImageFromStream(stream, nativeImage); + end; + + function TGPImage.FromFile(filename: WideString; + useEmbeddedColorManagement: BOOL = FALSE): TGPImage; + begin + result := TGPImage.Create( + PWideChar(filename), + useEmbeddedColorManagement + ); + end; + + function TGPImage.FromStream(stream: IStream; + useEmbeddedColorManagement: BOOL = FALSE): TGPImage; + begin + result := TGPImage.Create( + stream, + useEmbeddedColorManagement + ); + end; + + destructor TGPImage.destroy; + begin + GdipDisposeImage(nativeImage); + end; + + function TGPImage.Clone: TGPImage; + var cloneimage: GpImage; + begin + cloneimage := nil; + SetStatus(GdipCloneImage(nativeImage, cloneimage)); + result := TGPImage.Create(cloneimage, lastResult); + end; + + function TGPImage.Save(filename: WideString; const clsidEncoder: TGUID; + encoderParams: PEncoderParameters = nil): TStatus; + begin + result := SetStatus(GdipSaveImageToFile(nativeImage, + PWideChar(filename), + @clsidEncoder, + encoderParams)); + end; + + function TGPImage.Save(stream: IStream; const clsidEncoder: TGUID; + encoderParams: PEncoderParameters = nil): TStatus; + begin + result := SetStatus(GdipSaveImageToStream(nativeImage, + stream, + @clsidEncoder, + encoderParams)); + end; + + function TGPImage.SaveAdd(encoderParams: PEncoderParameters): TStatus; + begin + result := SetStatus(GdipSaveAdd(nativeImage, + encoderParams)); + end; + + function TGPImage.SaveAdd(newImage: TGPImage; + encoderParams: PEncoderParameters): TStatus; + begin + if (newImage = nil) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + result := SetStatus(GdipSaveAddImage(nativeImage, + newImage.nativeImage, + encoderParams)); + end; + + function TGPImage.GetType: TImageType; + begin + SetStatus(GdipGetImageType(nativeImage, result)); + end; + + function TGPImage.GetPhysicalDimension(out size: TGPSizeF): TStatus; + var + width, height: Single; + status: TStatus; + begin + status := SetStatus(GdipGetImageDimension(nativeImage, width, height)); + size.Width := width; + size.Height := height; + result := status; + end; + + function TGPImage.GetBounds(out srcRect: TGPRectF; out srcUnit: TUnit): TStatus; + begin + result := SetStatus(GdipGetImageBounds(nativeImage, @srcRect, srcUnit)); + end; + + function TGPImage.GetWidth: UINT; + var width: UINT; + begin + width := 0; + SetStatus(GdipGetImageWidth(nativeImage, width)); + result := width; + end; + + function TGPImage.GetHeight: UINT; + var height: UINT; + begin + height := 0; + SetStatus(GdipGetImageHeight(nativeImage, height)); + result := height; + end; + + function TGPImage.GetHorizontalResolution: Single; + var resolution: Single; + begin + resolution := 0.0; + SetStatus(GdipGetImageHorizontalResolution(nativeImage, resolution)); + result := resolution; + end; + + function TGPImage.GetVerticalResolution: Single; + var resolution: Single; + begin + resolution := 0.0; + SetStatus(GdipGetImageVerticalResolution(nativeImage, resolution)); + result := resolution; + end; + + function TGPImage.GetFlags: UINT; + var flags: UINT; + begin + flags := 0; + SetStatus(GdipGetImageFlags(nativeImage, flags)); + result := flags; + end; + + function TGPImage.GetRawFormat(out format: TGUID): TStatus; + begin + result := SetStatus(GdipGetImageRawFormat(nativeImage, @format)); + end; + + function TGPImage.GetPixelFormat: TPixelFormat; + begin + SetStatus(GdipGetImagePixelFormat(nativeImage, result)); + end; + + function TGPImage.GetPaletteSize: Integer; + var size: Integer; + begin + size := 0; + SetStatus(GdipGetImagePaletteSize(nativeImage, size)); + result := size; + end; + + function TGPImage.GetPalette(palette: PColorPalette; size: Integer): TStatus; + begin + result := SetStatus(GdipGetImagePalette(nativeImage, palette, size)); + end; + + function TGPImage.SetPalette(palette: PColorPalette): TStatus; + begin + result := SetStatus(GdipSetImagePalette(nativeImage, palette)); + end; + + function TGPImage.GetThumbnailImage(thumbWidth, thumbHeight: UINT; + callback: GetThumbnailImageAbort = nil; + callbackData: pointer = nil): TGPImage; + var + thumbimage: GpImage; + newImage: TGPImage; + begin + thumbimage := nil; + SetStatus(GdipGetImageThumbnail(nativeImage, + thumbWidth, thumbHeight, + thumbimage, + callback, callbackData)); + + newImage := TGPImage.Create(thumbimage, lastResult); + if (newImage = nil) then + GdipDisposeImage(thumbimage); + + result := newImage; + end; + + function TGPImage.GetFrameDimensionsCount: UINT; + var count: UINT; + begin + count := 0; + SetStatus(GdipImageGetFrameDimensionsCount(nativeImage, count)); + result := count; + end; + + function TGPImage.GetFrameDimensionsList(dimensionIDs: PGUID; count: UINT): TStatus; + begin + result := SetStatus(GdipImageGetFrameDimensionsList(nativeImage, dimensionIDs, count)); + end; + + function TGPImage.GetFrameCount(const dimensionID: TGUID): UINT; + var count: UINT; + begin + count := 0; + SetStatus(GdipImageGetFrameCount(nativeImage, @dimensionID, count)); + result := count; + end; + + function TGPImage.SelectActiveFrame(const dimensionID: TGUID; frameIndex: UINT): TStatus; + begin + result := SetStatus(GdipImageSelectActiveFrame(nativeImage, + @dimensionID, + frameIndex)); + end; + + function TGPImage.RotateFlip(rotateFlipType: TRotateFlipType): TStatus; + begin + result := SetStatus(GdipImageRotateFlip(nativeImage, + rotateFlipType)); + end; + + function TGPImage.GetPropertyCount: UINT; + var numProperty: UINT; + begin + numProperty := 0; + SetStatus(GdipGetPropertyCount(nativeImage, numProperty)); + result := numProperty; + end; + + function TGPImage.GetPropertyIdList(numOfProperty: UINT; list: PPropID): TStatus; + begin + result := SetStatus(GdipGetPropertyIdList(nativeImage, numOfProperty, list)); + end; + + function TGPImage.GetPropertyItemSize(propId: PROPID): UINT; + var size: UINT; + begin + size := 0; + SetStatus(GdipGetPropertyItemSize(nativeImage, propId, size)); + result := size; + end; + + function TGPImage.GetPropertyItem(propId: PROPID; propSize: UINT; + buffer: PPropertyItem): TStatus; + begin + result := SetStatus(GdipGetPropertyItem(nativeImage, + propId, propSize, buffer)); + end; + + function TGPImage.GetPropertySize(out totalBufferSize, numProperties : UINT): TStatus; + begin + result := SetStatus(GdipGetPropertySize(nativeImage, + totalBufferSize, + numProperties)); + end; + + function TGPImage.GetAllPropertyItems(totalBufferSize, numProperties: UINT; + allItems: PPROPERTYITEM): TStatus; + begin + result := SetStatus(GdipGetAllPropertyItems(nativeImage, + totalBufferSize, + numProperties, + allItems)); + end; + + function TGPImage.RemovePropertyItem(propId: TPROPID): TStatus; + begin + result := SetStatus(GdipRemovePropertyItem(nativeImage, propId)); + end; + + function TGPImage.SetPropertyItem(const item: TPropertyItem): TStatus; + begin + result := SetStatus(GdipSetPropertyItem(nativeImage, @item)); + end; + + function TGPImage.GetEncoderParameterListSize(const clsidEncoder: TGUID): UINT; + var size: UINT; + begin + size := 0; + SetStatus(GdipGetEncoderParameterListSize(nativeImage, @clsidEncoder, size)); + result := size; + end; + + function TGPImage.GetEncoderParameterList(const clsidEncoder: TGUID; size: UINT; + buffer: PEncoderParameters): TStatus; + begin + result := SetStatus(GdipGetEncoderParameterList(nativeImage, + @clsidEncoder, + size, + buffer)); + end; + + function TGPImage.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + + constructor TGPImage.Create(nativeImage: GpImage; status: TStatus); + begin + SetNativeImage(nativeImage); + lastResult := status; + end; + + procedure TGPImage.SetNativeImage(nativeImage: GpImage); + begin + self.nativeImage := nativeImage; + end; + + function TGPImage.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then lastResult := status; + result := status; + end; + + // TGPBitmap + + constructor TGPBitmap.Create(filename: WideString; useEmbeddedColorManagement: BOOL = FALSE); + var bitmap: GpBitmap; + begin + bitmap := nil; + if(useEmbeddedColorManagement) then + lastResult := GdipCreateBitmapFromFileICM(PWideChar(filename), bitmap) + else + lastResult := GdipCreateBitmapFromFile(PWideChar(filename), bitmap); + SetNativeImage(bitmap); + end; + + constructor TGPBitmap.Create(stream: IStream; useEmbeddedColorManagement: BOOL = FALSE); + var bitmap: GpBitmap; + begin + bitmap := nil; + if(useEmbeddedColorManagement) then + lastResult := GdipCreateBitmapFromStreamICM(stream, bitmap) + else + lastResult := GdipCreateBitmapFromStream(stream, bitmap); + SetNativeImage(bitmap); + end; + + function TGPBitmap.FromFile(filename: WideString; useEmbeddedColorManagement: BOOL = FALSE): TGPBitmap; + begin + result := TGPBitmap.Create( + PWideChar(filename), + useEmbeddedColorManagement + ); + end; + + function TGPBitmap.FromStream(stream: IStream; useEmbeddedColorManagement: BOOL = FALSE): TGPBitmap; + begin + result := TGPBitmap.Create( + stream, + useEmbeddedColorManagement + ); + end; + + constructor TGPBitmap.Create(width, height, stride: Integer; format: TPixelFormat; scan0: PBYTE); + var bitmap: GpBitmap; + begin + bitmap := nil; + lastResult := GdipCreateBitmapFromScan0(width, + height, + stride, + format, + scan0, + bitmap); + + SetNativeImage(bitmap); + end; + + constructor TGPBitmap.Create(width, height: Integer; format: TPixelFormat = PixelFormat32bppARGB); + var bitmap: GpBitmap; + begin + bitmap := nil; + lastResult := GdipCreateBitmapFromScan0(width, + height, + 0, + format, + nil, + bitmap); + + SetNativeImage(bitmap); + end; + + constructor TGPBitmap.Create(width, height: Integer; target: TGPGraphics); + var bitmap: GpBitmap; + begin + bitmap := nil; + lastResult := GdipCreateBitmapFromGraphics(width, + height, + target.nativeGraphics, + bitmap); + + SetNativeImage(bitmap); + end; + + function TGPBitmap.Clone(rect: TGPRect; format: TPixelFormat): TGPBitmap; + begin + result := Clone(rect.X, rect.Y, rect.Width, rect.Height, format); + end; + + function TGPBitmap.Clone(x, y, width, height: Integer; format: TPixelFormat): TGPBitmap; + var + bitmap: TGPBitmap; + gpdstBitmap: GpBitmap; + begin + gpdstBitmap := nil; + lastResult := GdipCloneBitmapAreaI( + x, + y, + width, + height, + format, + GpBitmap(nativeImage), + gpdstBitmap); + + if (lastResult = Ok) then + begin + bitmap := TGPBitmap.Create(gpdstBitmap); + if (bitmap = nil) then + GdipDisposeImage(gpdstBitmap); + result := bitmap; + exit; + end + else + result := nil; + end; + + function TGPBitmap.Clone(rect: TGPRectF; format: TPixelFormat): TGPBitmap; + begin + result := Clone(rect.X, rect.Y, rect.Width, rect.Height, format); + end; + + function TGPBitmap.Clone(x, y, width, height: Single; format: TPixelFormat): TGPBitmap; + var + bitmap: TGPBitmap; + gpdstBitmap: GpBitmap; + begin + gpdstBitmap := nil; + SetStatus(GdipCloneBitmapArea( + x, + y, + width, + height, + format, + GpBitmap(nativeImage), + gpdstBitmap)); + + if (lastResult = Ok) then + begin + bitmap := TGPBitmap.Create(gpdstBitmap); + if (bitmap = nil) then + GdipDisposeImage(gpdstBitmap); + result := bitmap; + end + else + result := nil; + end; + + function TGPBitmap.LockBits(rect: TGPRect; flags: UINT; format: TPixelFormat; + out lockedBitmapData: TBitmapData): TStatus; + begin + result := SetStatus(GdipBitmapLockBits( + GpBitmap(nativeImage), + @rect, + flags, + format, + @lockedBitmapData)); + end; + + function TGPBitmap.UnlockBits(var lockedBitmapData: TBitmapData): TStatus; + begin + result := SetStatus(GdipBitmapUnlockBits( + GpBitmap(nativeImage), + @lockedBitmapData)); + end; + + function TGPBitmap.GetPixel(x, y: Integer; out color: TGPColor): TStatus; + begin + result := SetStatus(GdipBitmapGetPixel(GpBitmap(nativeImage), x, y, color)); + end; + + function TGPBitmap.SetPixel(x, y: Integer; color: TGPColor): TStatus; + begin + result := SetStatus(GdipBitmapSetPixel( + GpBitmap(nativeImage), + x, y, + color)); + end; + + function TGPBitmap.SetResolution(xdpi, ydpi: Single): TStatus; + begin + result := SetStatus(GdipBitmapSetResolution( + GpBitmap(nativeImage), + xdpi, ydpi)); + end; + + constructor TGPBitmap.Create(var gdiBitmapInfo: TBITMAPINFO; gdiBitmapData: Pointer); + var bitmap: GpBitmap; + begin + bitmap := nil; + lastResult := GdipCreateBitmapFromGdiDib(@gdiBitmapInfo, gdiBitmapData, bitmap); + SetNativeImage(bitmap); + end; + + constructor TGPBitmap.Create(hbm: HBITMAP; hpal: HPALETTE); + var bitmap: GpBitmap; + begin + bitmap := nil; + lastResult := GdipCreateBitmapFromHBITMAP(hbm, hpal, bitmap); + SetNativeImage(bitmap); + end; + + constructor TGPBitmap.Create(hicon: HICON); + var bitmap: GpBitmap; + begin + bitmap := nil; + lastResult := GdipCreateBitmapFromHICON(hicon, bitmap); + SetNativeImage(bitmap); + end; + + constructor TGPBitmap.Create(hInstance: HMODULE; bitmapName: WideString); + var bitmap: GpBitmap; + begin + bitmap := nil; + lastResult := GdipCreateBitmapFromResource(hInstance, PWideChar(bitmapName), bitmap); + SetNativeImage(bitmap); + end; + + function TGPBitmap.FromBITMAPINFO(var gdiBitmapInfo: TBITMAPINFO; gdiBitmapData: Pointer): TGPBitmap; + begin + result := TGPBitmap.Create(gdiBitmapInfo, gdiBitmapData); + end; + + function TGPBitmap.FromHBITMAP(hbm: HBITMAP; hpal: HPALETTE): TGPBitmap; + begin + result := TGPBitmap.Create(hbm, hpal); + end; + + function TGPBitmap.FromHICON(hicon: HICON): TGPBitmap; + begin + result := TGPBitmap.Create(hicon); + end; + + function TGPBitmap.FromResource(hInstance: HMODULE; bitmapName: WideString): TGPBitmap; + begin + result := TGPBitmap.Create(hInstance, PWideChar(bitmapName)); + end; + + function TGPBitmap.GetHBITMAP(colorBackground: TGPColor; out hbmreturn: HBITMAP): TStatus; + begin + result := SetStatus(GdipCreateHBITMAPFromBitmap( + GpBitmap(nativeImage), + hbmreturn, + colorBackground)); + end; + + function TGPBitmap.GetHICON(out hicon: HICON): TStatus; + begin + result := SetStatus(GdipCreateHICONFromBitmap( + GpBitmap(nativeImage), + hicon)); + end; + + constructor TGPBitmap.Create(nativeBitmap: GpBitmap); + begin + lastResult := Ok; + SetNativeImage(nativeBitmap); + end; + +(**************************************************************************\ +* +* GDI+ Graphics Object +* +\**************************************************************************) + + function TGPGraphics.FromHDC(hdc: HDC): TGPGraphics; + begin + result := TGPGraphics.Create(hdc); + end; + + function TGPGraphics.FromHDC(hdc: HDC; hdevice: THANDLE): TGPGraphics; + begin + result := TGPGraphics.Create(hdc, hdevice); + end; + + function TGPGraphics.FromHWND(hwnd: HWND; icm: BOOL = FALSE): TGPGraphics; + begin + result := TGPGraphics.Create(hwnd, icm); + end; + + function TGPGraphics.FromImage(image: TGPImage): TGPGraphics; + begin + result := TGPGraphics.Create(image); + end; + + constructor TGPGraphics.Create(hdc: HDC); + var graphics: GpGraphics; + begin + graphics:= nil; + lastResult := GdipCreateFromHDC(hdc, graphics); + SetNativeGraphics(graphics); + end; + + constructor TGPGraphics.Create(hdc: HDC; hdevice: THANDLE); + var graphics: GpGraphics; + begin + graphics:= nil; + lastResult := GdipCreateFromHDC2(hdc, hdevice, graphics); + SetNativeGraphics(graphics); + end; + + constructor TGPGraphics.Create(hwnd: HWND; icm: BOOL{ = FALSE}); + var graphics: GpGraphics; + begin + graphics:= nil; + if icm then lastResult := GdipCreateFromHWNDICM(hwnd, graphics) + else lastResult := GdipCreateFromHWND(hwnd, graphics); + SetNativeGraphics(graphics); + end; + + constructor TGPGraphics.Create(image: TGPImage); + var graphics: GpGraphics; + begin + graphics:= nil; + if (image <> nil) then + lastResult := GdipGetImageGraphicsContext(image.nativeImage, graphics); + SetNativeGraphics(graphics); + end; + + destructor TGPGraphics.destroy; + begin + GdipDeleteGraphics(nativeGraphics); + end; + + procedure TGPGraphics.Flush(intention: TFlushIntention = FlushIntentionFlush); + begin + GdipFlush(nativeGraphics, intention); + end; + + //------------------------------------------------------------------------ + // GDI Interop methods + //------------------------------------------------------------------------ + + // Locks the graphics until ReleaseDC is called + + function TGPGraphics.GetHDC: HDC; + begin + SetStatus(GdipGetDC(nativeGraphics, result)); + end; + + procedure TGPGraphics.ReleaseHDC(hdc: HDC); + begin + SetStatus(GdipReleaseDC(nativeGraphics, hdc)); + end; + + //------------------------------------------------------------------------ + // Rendering modes + //------------------------------------------------------------------------ + + function TGPGraphics.SetRenderingOrigin(x, y: Integer): TStatus; + begin + result := SetStatus(GdipSetRenderingOrigin(nativeGraphics, x, y)); + end; + + function TGPGraphics.GetRenderingOrigin(out x, y: Integer): TStatus; + begin + result := SetStatus(GdipGetRenderingOrigin(nativeGraphics, x, y)); + end; + + function TGPGraphics.SetCompositingMode(compositingMode: TCompositingMode): TStatus; + begin + result := SetStatus(GdipSetCompositingMode(nativeGraphics, + compositingMode)); + end; + + function TGPGraphics.GetCompositingMode: TCompositingMode; + begin + SetStatus(GdipGetCompositingMode(nativeGraphics, result)); + end; + + function TGPGraphics.SetCompositingQuality(compositingQuality: TCompositingQuality): TStatus; + begin + result := SetStatus(GdipSetCompositingQuality( nativeGraphics, compositingQuality)); + end; + + function TGPGraphics.GetCompositingQuality: TCompositingQuality; + begin + SetStatus(GdipGetCompositingQuality(nativeGraphics, result)); + end; + + function TGPGraphics.SetTextRenderingHint(newMode: TTextRenderingHint): TStatus; + begin + result := SetStatus(GdipSetTextRenderingHint(nativeGraphics, newMode)); + end; + + function TGPGraphics.GetTextRenderingHint: TTextRenderingHint; + begin + SetStatus(GdipGetTextRenderingHint(nativeGraphics, result)); + end; + + function TGPGraphics.SetTextContrast(contrast: UINT): TStatus; + begin + result := SetStatus(GdipSetTextContrast(nativeGraphics, contrast)); + end; + + function TGPGraphics.GetTextContrast: UINT; + begin + SetStatus(GdipGetTextContrast(nativeGraphics, result)); + end; + + function TGPGraphics.GetInterpolationMode: TInterpolationMode; + var mode: TInterpolationMode; + begin + mode := InterpolationModeInvalid; + SetStatus(GdipGetInterpolationMode(nativeGraphics, mode)); + result := mode; + end; + + function TGPGraphics.SetInterpolationMode(interpolationMode: TInterpolationMode): TStatus; + begin + result := SetStatus(GdipSetInterpolationMode(nativeGraphics, + interpolationMode)); + end; + + function TGPGraphics.GetSmoothingMode: TSmoothingMode; + var smoothingMode: TSmoothingMode; + begin + smoothingMode := SmoothingModeInvalid; + SetStatus(GdipGetSmoothingMode(nativeGraphics, smoothingMode)); + result := smoothingMode; + end; + + function TGPGraphics.SetSmoothingMode(smoothingMode: TSmoothingMode): TStatus; + begin + result := SetStatus(GdipSetSmoothingMode(nativeGraphics, smoothingMode)); + end; + + function TGPGraphics.GetPixelOffsetMode: TPixelOffsetMode; + var pixelOffsetMode: TPixelOffsetMode; + begin + pixelOffsetMode := PixelOffsetModeInvalid; + SetStatus(GdipGetPixelOffsetMode(nativeGraphics, pixelOffsetMode)); + result := pixelOffsetMode; + end; + + function TGPGraphics.SetPixelOffsetMode(pixelOffsetMode: TPixelOffsetMode): TStatus; + begin + result := SetStatus(GdipSetPixelOffsetMode(nativeGraphics, pixelOffsetMode)); + end; + + //------------------------------------------------------------------------ + // Manipulate current world transform + //------------------------------------------------------------------------ + + function TGPGraphics.SetTransform(matrix: TGPMatrix): TStatus; + begin + result := SetStatus(GdipSetWorldTransform(nativeGraphics, matrix.nativeMatrix)); + end; + + function TGPGraphics.ResetTransform: TStatus; + begin + result := SetStatus(GdipResetWorldTransform(nativeGraphics)); + end; + + function TGPGraphics.MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipMultiplyWorldTransform(nativeGraphics, + matrix.nativeMatrix, + order)); + end; + + function TGPGraphics.TranslateTransform(dx, dy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipTranslateWorldTransform(nativeGraphics, + dx, dy, order)); + end; + + function TGPGraphics.ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipScaleWorldTransform(nativeGraphics, + sx, sy, order)); + end; + + function TGPGraphics.RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipRotateWorldTransform(nativeGraphics, + angle, order)); + end; + + function TGPGraphics.GetTransform(matrix: TGPMatrix): TStatus; + begin + result := SetStatus(GdipGetWorldTransform(nativeGraphics, + matrix.nativeMatrix)); + end; + + function TGPGraphics.SetPageUnit(unit_: TUnit): TStatus; + begin + result := SetStatus(GdipSetPageUnit(nativeGraphics, + unit_)); + end; + + function TGPGraphics.SetPageScale(scale: Single): TStatus; + begin + result := SetStatus(GdipSetPageScale(nativeGraphics, + scale)); + end; + + function TGPGraphics.GetPageUnit: TUnit; + begin + SetStatus(GdipGetPageUnit(nativeGraphics, result)); + end; + + function TGPGraphics.GetPageScale: Single; + begin + SetStatus(GdipGetPageScale(nativeGraphics, result)); + end; + + function TGPGraphics.GetDpiX: Single; + begin + SetStatus(GdipGetDpiX(nativeGraphics, result)); + end; + + function TGPGraphics.GetDpiY: Single; + begin + SetStatus(GdipGetDpiY(nativeGraphics, result)); + end; + + function TGPGraphics.TransformPoints(destSpace: TCoordinateSpace; + srcSpace: TCoordinateSpace; + pts: PGPPointF; + count: Integer): TStatus; + begin + result := SetStatus(GdipTransformPoints(nativeGraphics, + destSpace, + srcSpace, + pts, + count)); + end; + + function TGPGraphics.TransformPoints(destSpace: TCoordinateSpace; + srcSpace: TCoordinateSpace; + pts: PGPPoint; + count: Integer): TStatus; + begin + + result := SetStatus(GdipTransformPointsI(nativeGraphics, + destSpace, + srcSpace, + pts, + count)); + end; + + //------------------------------------------------------------------------ + // GetNearestColor (for <= 8bpp surfaces). Note: Alpha is ignored. + //------------------------------------------------------------------------ + + function TGPGraphics.GetNearestColor(var color: TGPColor): TStatus; + begin + result := SetStatus(GdipGetNearestColor(nativeGraphics, @color)); + end; + + function TGPGraphics.DrawLine(pen: TGPPen; x1, y1, x2, y2: Single): TStatus; + begin + result := SetStatus(GdipDrawLine(nativeGraphics, + pen.nativePen, x1, y1, x2, + y2)); + end; + + function TGPGraphics.DrawLine(pen: TGPPen; const pt1, pt2: TGPPointF): TStatus; + begin + result := DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y); + end; + + function TGPGraphics.DrawLines(pen: TGPPen; points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawLines(nativeGraphics, + pen.nativePen, + points, count)); + end; + + function TGPGraphics.DrawLine(pen: TGPPen; x1, y1, x2, y2: Integer): TStatus; + begin + result := SetStatus(GdipDrawLineI(nativeGraphics, + pen.nativePen, + x1, + y1, + x2, + y2)); + end; + + function TGPGraphics.DrawLine(pen: TGPPen; const pt1, pt2: TGPPoint): TStatus; + begin + result := DrawLine(pen, + pt1.X, + pt1.Y, + pt2.X, + pt2.Y); + end; + + function TGPGraphics.DrawLines(pen: TGPPen; points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawLinesI(nativeGraphics, + pen.nativePen, + points, + count)); + end; + + function TGPGraphics.DrawArc(pen: TGPPen; x, y, width, height, startAngle, sweepAngle: Single): TStatus; + begin + result := SetStatus(GdipDrawArc(nativeGraphics, + pen.nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + end; + + function TGPGraphics.DrawArc(pen: TGPPen; const rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; + begin + result := DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + end; + + function TGPGraphics.DrawArc(pen: TGPPen; x, y, width, height: Integer; startAngle, + sweepAngle: Single): TStatus; + begin + result := SetStatus(GdipDrawArcI(nativeGraphics, + pen.nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + end; + + + function TGPGraphics.DrawArc(pen: TGPPen; const rect: TGPRect; startAngle, sweepAngle: Single): TStatus; + begin + result := DrawArc(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + end; + + function TGPGraphics.DrawBezier(pen: TGPPen; x1, y1, x2, y2, x3, y3, x4, y4: Single): TStatus; + begin + result := SetStatus(GdipDrawBezier(nativeGraphics, + pen.nativePen, x1, y1, + x2, y2, x3, y3, x4, y4)); + end; + + function TGPGraphics.DrawBezier(pen: TGPPen; const pt1, pt2, pt3, pt4: TGPPointF): TStatus; + begin + result := DrawBezier(pen, + pt1.X, + pt1.Y, + pt2.X, + pt2.Y, + pt3.X, + pt3.Y, + pt4.X, + pt4.Y); + end; + + function TGPGraphics.DrawBeziers(pen: TGPPen; points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawBeziers(nativeGraphics, + pen.nativePen, + points, + count)); + end; + + function TGPGraphics.DrawBezier(pen: TGPPen; x1, y1, x2, y2, x3, y3, x4, y4: Integer): TStatus; + begin + result := SetStatus(GdipDrawBezierI(nativeGraphics, + pen.nativePen, + x1, + y1, + x2, + y2, + x3, + y3, + x4, + y4)); + end; + + function TGPGraphics.DrawBezier(pen: TGPPen; const pt1, pt2, pt3, pt4: TGPPoint): TStatus; + begin + result := DrawBezier(pen, + pt1.X, + pt1.Y, + pt2.X, + pt2.Y, + pt3.X, + pt3.Y, + pt4.X, + pt4.Y); + end; + + function TGPGraphics.DrawBeziers(pen: TGPPen; points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawBeziersI(nativeGraphics, + pen.nativePen, + points, + count)); + end; + + function TGPGraphics.DrawRectangle(pen: TGPPen; const rect: TGPRectF): TStatus; + begin + result := DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); + end; + + function TGPGraphics.DrawRectangle(pen: TGPPen; x, y, width, height: Single): TStatus; + begin + result := SetStatus(GdipDrawRectangle(nativeGraphics, + pen.nativePen, x, y, + width, height)); + end; + + function TGPGraphics.DrawRectangles(pen: TGPPen; rects: PGPRectF; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawRectangles(nativeGraphics, + pen.nativePen, + rects, count)); + end; + + function TGPGraphics.DrawRectangle(pen: TGPPen; const rect: TGPRect): TStatus; + begin + result := DrawRectangle(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height); + end; + + function TGPGraphics.DrawRectangle(pen: TGPPen; x, y, width, height: Integer): TStatus; + begin + result := SetStatus(GdipDrawRectangleI(nativeGraphics, + pen.nativePen, + x, + y, + width, + height)); + end; + + function TGPGraphics.DrawRectangles(pen: TGPPen; rects: PGPRect; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawRectanglesI(nativeGraphics, + pen.nativePen, + rects, + count)); + end; + + function TGPGraphics.DrawEllipse(pen: TGPPen; const rect: TGPRectF): TStatus; + begin + result := DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height); + end; + + function TGPGraphics.DrawEllipse(pen: TGPPen; x, y, width, height: Single): TStatus; + begin + result := SetStatus(GdipDrawEllipse(nativeGraphics, + pen.nativePen, + x, + y, + width, + height)); + end; + + function TGPGraphics.DrawEllipse(pen: TGPPen; const rect: TGPRect): TStatus; + begin + result := DrawEllipse(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height); + end; + + function TGPGraphics.DrawEllipse(pen: TGPPen; x, y, width, height: Integer): TStatus; + begin + result := SetStatus(GdipDrawEllipseI(nativeGraphics, + pen.nativePen, + x, + y, + width, + height)); + end; + + function TGPGraphics.DrawPie(pen: TGPPen; const rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; + begin + result := DrawPie(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + end; + + function TGPGraphics.DrawPie(pen: TGPPen; x, y, width, height, startAngle, sweepAngle: Single): TStatus; + begin + result := SetStatus(GdipDrawPie(nativeGraphics, + pen.nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + end; + + function TGPGraphics.DrawPie(pen: TGPPen; const rect: TGPRect; startAngle, sweepAngle: Single): TStatus; + begin + result := DrawPie(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + end; + + function TGPGraphics.DrawPie(pen: TGPPen; x, y, width, height: Integer; + startAngle, sweepAngle: Single): TStatus; + begin + result := SetStatus(GdipDrawPieI(nativeGraphics, + pen.nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + end; + + function TGPGraphics.DrawPolygon(pen: TGPPen; points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawPolygon(nativeGraphics, + pen.nativePen, + points, + count)); + end; + + function TGPGraphics.DrawPolygon(pen: TGPPen; points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawPolygonI(nativeGraphics, + pen.nativePen, + points, + count)); + end; + + function TGPGraphics.DrawPath(pen: TGPPen; path: TGPGraphicsPath): TStatus; + var + nPen: GpPen; + nPath: GpPath; + begin + if assigned(pen) then nPen := pen.nativePen else nPen := nil; + if assigned(path) then nPath := path.nativePath else nPath := nil; + result := SetStatus(GdipDrawPath(nativeGraphics, nPen, nPath)); + end; + + function TGPGraphics.DrawCurve(pen: TGPPen; points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawCurve(nativeGraphics, + pen.nativePen, points, + count)); + end; + + function TGPGraphics.DrawCurve(pen: TGPPen; points: PGPPointF; count: Integer; tension: Single): TStatus; + begin + result := SetStatus(GdipDrawCurve2(nativeGraphics, + pen.nativePen, points, + count, tension)); + end; + + function TGPGraphics.DrawCurve(pen: TGPPen; points: PGPPointF; count, offset, + numberOfSegments: Integer; tension: Single = 0.5): TStatus; + begin + result := SetStatus(GdipDrawCurve3(nativeGraphics, + pen.nativePen, points, + count, offset, + numberOfSegments, tension)); + end; + + function TGPGraphics.DrawCurve(pen: TGPPen; points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawCurveI(nativeGraphics, + pen.nativePen, + points, + count)); + end; + + function TGPGraphics.DrawCurve(pen: TGPPen; points: PGPPoint; count: Integer; tension: Single): TStatus; + begin + result := SetStatus(GdipDrawCurve2I(nativeGraphics, + pen.nativePen, + points, + count, + tension)); + end; + + function TGPGraphics.DrawCurve(pen: TGPPen; points: PGPPoint; count, offset, + numberOfSegments: Integer; tension: Single = 0.5): TStatus; + begin + result := SetStatus(GdipDrawCurve3I(nativeGraphics, + pen.nativePen, + points, + count, + offset, + numberOfSegments, + tension)); + end; + + function TGPGraphics.DrawClosedCurve(pen: TGPPen; points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawClosedCurve(nativeGraphics, + pen.nativePen, + points, count)); + end; + + function TGPGraphics.DrawClosedCurve(pen: TGPPen; points: PGPPointF; count: Integer; + tension: Single): TStatus; + begin + result := SetStatus(GdipDrawClosedCurve2(nativeGraphics, + pen.nativePen, + points, count, + tension)); + end; + + function TGPGraphics.DrawClosedCurve(pen: TGPPen; points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipDrawClosedCurveI(nativeGraphics, + pen.nativePen, + points, + count)); + end; + + function TGPGraphics.DrawClosedCurve(pen: TGPPen; points: PGPPoint; + count: Integer; tension: Single): TStatus; + begin + result := SetStatus(GdipDrawClosedCurve2I(nativeGraphics, + pen.nativePen, + points, + count, + tension)); + end; + + function TGPGraphics.Clear(color: TGPColor): TStatus; + begin + result := SetStatus(GdipGraphicsClear( + nativeGraphics, + color)); + end; + + function TGPGraphics.FillRectangle(brush: TGPBrush; const rect: TGPRectF): TStatus; + begin + result := FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height); + end; + + function TGPGraphics.FillRectangle(brush: TGPBrush; x, y, width, height: Single): TStatus; + begin + result := SetStatus(GdipFillRectangle(nativeGraphics, + brush.nativeBrush, x, y, + width, height)); + end; + + function TGPGraphics.FillRectangles(brush: TGPBrush; rects: PGPRectF; count: Integer): TStatus; + begin + result := SetStatus(GdipFillRectangles(nativeGraphics, + brush.nativeBrush, + rects, count)); + end; + + function TGPGraphics.FillRectangle(brush: TGPBrush; const rect: TGPRect): TStatus; + begin + result := FillRectangle(brush, + rect.X, + rect.Y, + rect.Width, + rect.Height); + end; + + function TGPGraphics.FillRectangle(brush: TGPBrush; x, y, width, height: Integer): TStatus; + begin + result := SetStatus(GdipFillRectangleI(nativeGraphics, + brush.nativeBrush, + x, + y, + width, + height)); + end; + + function TGPGraphics.FillRectangles(brush: TGPBrush; rects: PGPRect; count: Integer): TStatus; + begin + result := SetStatus(GdipFillRectanglesI(nativeGraphics, + brush.nativeBrush, + rects, + count)); + end; + + function TGPGraphics.FillPolygon(brush: TGPBrush; points: PGPPointF; count: Integer): TStatus; + begin + result := FillPolygon(brush, points, count, FillModeAlternate); + end; + + function TGPGraphics.FillPolygon(brush: TGPBrush; points: PGPPointF; count: Integer; + fillMode: TFillMode): TStatus; + begin + result := SetStatus(GdipFillPolygon(nativeGraphics, + brush.nativeBrush, + points, count, fillMode)); + end; + + function TGPGraphics.FillPolygon(brush: TGPBrush; points: PGPPoint; count: Integer): TStatus; + begin + result := FillPolygon(brush, points, count, FillModeAlternate); + end; + + function TGPGraphics.FillPolygon(brush: TGPBrush; points: PGPPoint; count: Integer; + fillMode: TFillMode): TStatus; + begin + result := SetStatus(GdipFillPolygonI(nativeGraphics, + brush.nativeBrush, + points, count, + fillMode)); + end; + + function TGPGraphics.FillEllipse(brush: TGPBrush; const rect: TGPRectF): TStatus; + begin + result := FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height); + end; + + function TGPGraphics.FillEllipse(brush: TGPBrush; x, y, width, height: Single): TStatus; + begin + result := SetStatus(GdipFillEllipse(nativeGraphics, + brush.nativeBrush, x, y, + width, height)); + end; + + function TGPGraphics.FillEllipse(brush: TGPBrush; const rect: TGPRect): TStatus; + begin + result := FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height); + end; + + function TGPGraphics.FillEllipse(brush: TGPBrush; x, y, width, height: Integer): TStatus; + begin + result := SetStatus(GdipFillEllipseI(nativeGraphics, + brush.nativeBrush, + x, + y, + width, + height)); + end; + + function TGPGraphics.FillPie(brush: TGPBrush; const rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; + begin + result := FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + end; + + function TGPGraphics.FillPie(brush: TGPBrush; x, y, width, height, startAngle, sweepAngle: Single): TStatus; + begin + result := SetStatus(GdipFillPie(nativeGraphics, + brush.nativeBrush, x, y, + width, height, startAngle, + sweepAngle)); + end; + + function TGPGraphics.FillPie(brush: TGPBrush; const rect: TGPRect; startAngle, sweepAngle: Single): TStatus; + begin + result := FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + end; + + function TGPGraphics.FillPie(brush: TGPBrush; x, y, width, height: Integer; startAngle, + sweepAngle: Single): TStatus; + begin + result := SetStatus(GdipFillPieI(nativeGraphics, + brush.nativeBrush, + x, + y, + width, + height, + startAngle, + sweepAngle)); + end; + + function TGPGraphics.FillPath(brush: TGPBrush; path: TGPGraphicsPath): TStatus; + begin + result := SetStatus(GdipFillPath(nativeGraphics, + brush.nativeBrush, + path.nativePath)); + end; + + function TGPGraphics.FillClosedCurve(brush: TGPBrush; points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipFillClosedCurve(nativeGraphics, + brush.nativeBrush, + points, count)); + + end; + + function TGPGraphics.FillClosedCurve(brush: TGPBrush; points: PGPPointF; count: Integer; + fillMode: TFillMode; tension: Single = 0.5): TStatus; + begin + result := SetStatus(GdipFillClosedCurve2(nativeGraphics, + brush.nativeBrush, + points, count, + tension, fillMode)); + end; + + function TGPGraphics.FillClosedCurve(brush: TGPBrush; points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipFillClosedCurveI(nativeGraphics, + brush.nativeBrush, + points, + count)); + end; + + function TGPGraphics.FillClosedCurve(brush: TGPBrush; points: PGPPoint; + count: Integer; fillMode: TFillMode; tension: Single = 0.5): TStatus; + begin + result := SetStatus(GdipFillClosedCurve2I(nativeGraphics, + brush.nativeBrush, + points, count, + tension, fillMode)); + end; + + function TGPGraphics.FillRegion(brush: TGPBrush; region: TGPRegion): TStatus; + begin + result := SetStatus(GdipFillRegion(nativeGraphics, + brush.nativeBrush, + region.nativeRegion)); + end; + + + function TGPGraphics.DrawString( string_: WideString; length: Integer; font: TGPFont; + const layoutRect: TGPRectF; stringFormat: TGPStringFormat; brush: TGPBrush): TStatus; + var + nFont: GpFont; + nStringFormat: GpStringFormat; + nBrush: GpBrush; + begin + if assigned(font) then nfont := font.nativeFont else nfont := nil; + if assigned(stringFormat) then nstringFormat := stringFormat.nativeFormat else nstringFormat := nil; + if assigned(brush) then nbrush := brush.nativeBrush else nbrush := nil; + result := SetStatus(GdipDrawString( + nativeGraphics, + PWideChar(string_), + length, + nfont, + @layoutRect, + nstringFormat, + nbrush)); + end; + + function TGPGraphics.DrawString(string_: WideString; length: Integer; font: TGPFont; + const origin: TGPPointF; brush: TGPBrush): TStatus; + var + rect: TGPRectF; + nfont: Gpfont; + nBrush: GpBrush; + begin + rect.X := origin.X; + rect.Y := origin.Y; + rect.Width := 0.0; + rect.Height := 0.0; + if assigned(font) then nfont := font.nativeFont else nfont := nil; + if assigned(Brush) then nBrush := Brush.nativeBrush else nBrush := nil; + result := SetStatus(GdipDrawString( + nativeGraphics, + PWideChar(string_), + length, + nfont, + @rect, + nil, + nbrush)); + end; + + function TGPGraphics.DrawString(string_: WideString; length: Integer; font: TGPFont; + const origin: TGPPointF; stringFormat: TGPStringFormat; brush: TGPBrush): TStatus; + var + rect: TGPRectF; + nFont: GpFont; + nStringFormat: GpStringFormat; + nBrush: GpBrush; + begin + rect.X := origin.X; + rect.Y := origin.Y; + rect.Width := 0.0; + rect.Height := 0.0; + if assigned(font) then nfont := font.nativeFont else nfont := nil; + if assigned(stringFormat) then nstringFormat := stringFormat.nativeFormat else nstringFormat := nil; + if assigned(brush) then nbrush := brush.nativeBrush else nbrush := nil; + result := SetStatus(GdipDrawString( + nativeGraphics, + PWideChar(string_), + length, + nfont, + @rect, + nstringFormat, + nbrush)); + end; + + + function TGPGraphics.MeasureString(string_: WideString; length: Integer; font: TGPFont; + const layoutRect: TGPRectF; stringFormat: TGPStringFormat; out boundingBox: TGPRectF; + codepointsFitted: PInteger = nil; linesFilled: PInteger = nil): TStatus; + var + nFont: GpFont; + nStringFormat: GpStringFormat; + begin + if assigned(font) then nfont := font.nativeFont else nfont := nil; + if assigned(stringFormat) then nstringFormat := stringFormat.nativeFormat else nstringFormat := nil; + result := SetStatus(GdipMeasureString( + nativeGraphics, + PWideChar(string_), + length, + nfont, + @layoutRect, + nstringFormat, + @boundingBox, + codepointsFitted, + linesFilled + )); + end; + + + function TGPGraphics.MeasureString(string_: WideString; length: Integer; font: TGPFont; + const layoutRectSize: TGPSizeF; stringFormat: TGPStringFormat; out size: TGPSizeF; + codepointsFitted: PInteger = nil; linesFilled: PInteger = nil): TStatus; + var + layoutRect, boundingBox: TGPRectF; + status: TStatus; + nFont: GpFont; + nStringFormat: GpStringFormat; + begin + layoutRect.X := 0; + layoutRect.Y := 0; + layoutRect.Width := layoutRectSize.Width; + layoutRect.Height := layoutRectSize.Height; + + if assigned(font) then nfont := font.nativeFont else nfont := nil; + if assigned(stringFormat) then nstringFormat := stringFormat.nativeFormat else nstringFormat := nil; + + status := SetStatus(GdipMeasureString( + nativeGraphics, + PWideChar(string_), + length, + nfont, + @layoutRect, + nstringFormat, + @boundingBox, + codepointsFitted, + linesFilled + )); + + if (status = Ok) then + begin + size.Width := boundingBox.Width; + size.Height := boundingBox.Height; + end; + result := status; + end; + + + function TGPGraphics.MeasureString(string_: WideString ; length: Integer; font: TGPFont; + const origin: TGPPointF; stringFormat: TGPStringFormat; out boundingBox: TGPRectF): TStatus; + var + rect: TGPRectF; + nFont: GpFont; + nstringFormat: GpstringFormat; + begin + rect.X := origin.X; + rect.Y := origin.Y; + rect.Width := 0.0; + rect.Height := 0.0; + + if assigned(font) then nfont := font.nativeFont else nfont := nil; + if assigned(stringFormat) then nstringFormat := stringFormat.nativeFormat else nstringFormat := nil; + + result := SetStatus(GdipMeasureString( + nativeGraphics, + PWideChar(string_), + length, + nfont, + @rect, + nstringFormat, + @boundingBox, + nil, + nil + )); + end; + + + function TGPGraphics.MeasureString(string_: WideString; length: Integer; font: TGPFont; + const layoutRect: TGPRectF; out boundingBox: TGPRectF): TStatus; + var + nFont: GpFont; + begin + if assigned(font) then nfont := font.nativeFont else nfont := nil; + result := SetStatus(GdipMeasureString( + nativeGraphics, + PWideChar(string_), + length, + nfont, + @layoutRect, + nil, + @boundingBox, + nil, + nil + )); + end; + + + function TGPGraphics.MeasureString(string_: WideString; length: Integer; font: TGPFont; + const origin: TGPPointF; out boundingBox: TGPRectF): TStatus; + var + nFont: GpFont; + rect: TGPRectF; + begin + if assigned(font) then nfont := font.nativeFont else nfont := nil; + rect.X := origin.X; + rect.Y := origin.Y; + rect.Width := 0.0; + rect.Height := 0.0; + + result := SetStatus(GdipMeasureString( + nativeGraphics, + PWideChar(string_), + length, + nfont, + @rect, + nil, + @boundingBox, + nil, + nil + )); + end; + + + + function TGPGraphics.MeasureCharacterRanges(string_: WideString; length: Integer; font: TGPFont; + const layoutRect: TGPRectF; stringFormat: TGPStringFormat; regionCount: Integer; + const regions: array of TGPRegion): TStatus; + var + nativeRegions: Pointer; + i: Integer; + Status: TStatus; + nFont: GpFont; + nstringFormat: GpstringFormat; + type + TArrayGpRegion = array of GpRegion; + begin + if assigned(font) then nfont := font.nativeFont else nfont := nil; + if assigned(stringFormat) then nstringFormat := stringFormat.nativeFormat else nstringFormat := nil; + + if (regionCount <= 0) then + begin + result := InvalidParameter; + exit; + end; + + getmem(nativeRegions, Sizeof(GpRegion)* regionCount); + + for i := 0 to regionCount - 1 do + TArrayGpRegion(nativeRegions)[i] := regions[i].nativeRegion; + + status := SetStatus(GdipMeasureCharacterRanges( + nativeGraphics, + PWideChar(string_), + length, + nfont, + @layoutRect, + nstringFormat, + regionCount, + nativeRegions + )); + + freemem(nativeRegions, Sizeof(GpRegion)* regionCount); + result := status; + end; + + function TGPGraphics.DrawDriverString(text: PUINT16; length: Integer; font: TGPFont + ; brush: TGPBrush; positions: PGPPointF; flags: Integer + ; matrix: TGPMatrix): TStatus; + var + nfont: Gpfont; + nbrush: Gpbrush; + nmatrix: Gpmatrix; + begin + if assigned(font) then nfont := font.nativeFont else nfont := nil; + if assigned(brush) then nbrush := brush.nativeBrush else nbrush := nil; + if assigned(matrix) then nmatrix := matrix.nativeMatrix else nmatrix := nil; + + result := SetStatus(GdipDrawDriverString( + nativeGraphics, + text, + length, + nfont, + nbrush, + positions, + flags, + nmatrix)); + end; + + function TGPGraphics.MeasureDriverString(text: PUINT16; length: Integer; font: TGPFont; + positions: PGPPointF; flags: Integer; matrix: TGPMatrix; + out boundingBox: TGPRectF): TStatus; + var + nfont: Gpfont; + nmatrix: Gpmatrix; + begin + if assigned(font) then nfont := font.nativeFont else nfont := nil; + if assigned(matrix) then nmatrix := matrix.nativeMatrix else nmatrix := nil; + + result := SetStatus(GdipMeasureDriverString( + nativeGraphics, + text, + length, + nfont, + positions, + flags, + nmatrix, + @boundingBox + )); + end; + + // Draw a cached bitmap on this graphics destination offset by + // x, y. Note this will fail with WrongState if the CachedBitmap + // native format differs from this Graphics. + + function TGPGraphics.DrawCachedBitmap(cb: TGPCachedBitmap; x, y: Integer): TStatus; + begin + result := SetStatus(GdipDrawCachedBitmap( + nativeGraphics, + cb.nativeCachedBitmap, + x, y + )); + end; + + function TGPGraphics.DrawImage(image: TGPImage; const point: TGPPointF): TStatus; + begin + result := DrawImage(image, point.X, point.Y); + end; + + function TGPGraphics.DrawImage(image: TGPImage; x, y: Single): TStatus; + var + nImage: GpImage; + begin + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + result := SetStatus(GdipDrawImage(nativeGraphics, nImage, x, y)); + end; + + function TGPGraphics.DrawImage(image: TGPImage; const rect: TGPRectF): TStatus; + begin + result := DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height); + end; + + function TGPGraphics.DrawImage(image: TGPImage; x, y, width, height: Single): TStatus; + var + nImage: GpImage; + begin + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + result := SetStatus(GdipDrawImageRect(nativeGraphics, + nimage, + x, + y, + width, + height)); + end; + + function TGPGraphics.DrawImage(image: TGPImage; const point: TGPPoint): TStatus; + begin + result := DrawImage(image, point.X, point.Y); + end; + + function TGPGraphics.DrawImage(image: TGPImage; x, y: Integer): TStatus; + var + nImage: GpImage; + begin + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + result := SetStatus(GdipDrawImageI(nativeGraphics, + nimage, + x, + y)); + end; + + function TGPGraphics.DrawImage(image: TGPImage; const rect: TGPRect): TStatus; + begin + result := DrawImage(image, + rect.X, + rect.Y, + rect.Width, + rect.Height); + end; + + function TGPGraphics.DrawImage(image: TGPImage; x, y, width, height: Integer): TStatus; + var + nImage: GpImage; + begin + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + result := SetStatus(GdipDrawImageRectI(nativeGraphics, + nimage, + x, + y, + width, + height)); + end; + + + // Affine Draw Image + // destPoints.length = 3: rect => parallelogram + // destPoints[0] <=> top-left corner of the source rectangle + // destPoints[1] <=> top-right corner + // destPoints[2] <=> bottom-left corner + // destPoints.length = 4: rect => quad + // destPoints[3] <=> bottom-right corner + + function TGPGraphics.DrawImage(image: TGPImage; destPoints: PGPPointF; count: Integer): TStatus; + var + nImage: GpImage; + begin + if (((count <> 3) and (count <> 4)) or (destPoints = nil)) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + result := SetStatus(GdipDrawImagePoints(nativeGraphics, + nimage, + destPoints, count)); + end; + + function TGPGraphics.DrawImage(image: TGPImage; destPoints: PGPPoint; count: Integer): TStatus; + var + nImage: GpImage; + begin + if (((count <> 3) and (count <> 4))or (destPoints = nil)) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + result := SetStatus(GdipDrawImagePointsI(nativeGraphics, + nimage, + destPoints, + count)); + end; + + function TGPGraphics.DrawImage(image: TGPImage; x, y, srcx, srcy, srcwidth, srcheight: Single; + srcUnit: TUnit): TStatus; + var + nImage: GpImage; + begin + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + result := SetStatus(GdipDrawImagePointRect(nativeGraphics, + nimage, + x, y, + srcx, srcy, + srcwidth, srcheight, srcUnit)); + end; + + function TGPGraphics.DrawImage(image: TGPImage; const destRect: TGPRectF; srcx, srcy, srcwidth, srcheight: Single; + srcUnit: TUnit; imageAttributes: TGPImageAttributes = nil; callback: DrawImageAbort = nil; + callbackData: Pointer = nil): TStatus; + var + nImage: GpImage; + nimageAttributes: GpimageAttributes; + begin + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipDrawImageRectRect(nativeGraphics, + nimage, + destRect.X, + destRect.Y, + destRect.Width, + destRect.Height, + srcx, srcy, + srcwidth, srcheight, + srcUnit, + nimageAttributes, + callback, + callbackData)); + end; + + function TGPGraphics.DrawImage(image: TGPImage; destPoints: PGPPointF; count: Integer; + srcx, srcy, srcwidth, srcheight: Single; srcUnit: TUnit; + imageAttributes: TGPImageAttributes = nil; callback: DrawImageAbort = nil; + callbackData: Pointer = nil): TStatus; + var + nImage: GpImage; + nimageAttributes: GpimageAttributes; + begin + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipDrawImagePointsRect(nativeGraphics, + nimage, + destPoints, count, + srcx, srcy, + srcwidth, + srcheight, + srcUnit, + nimageAttributes, + callback, + callbackData)); + end; + + function TGPGraphics.DrawImage(image: TGPImage; x, y, srcx, srcy, srcwidth, srcheight: Integer; + srcUnit: TUnit): TStatus; + var + nImage: GpImage; + begin + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + result := SetStatus(GdipDrawImagePointRectI(nativeGraphics, + nimage, + x, + y, + srcx, + srcy, + srcwidth, + srcheight, + srcUnit)); + end; + + function TGPGraphics.DrawImage(image: TGPImage; const destRect: TGPRect; srcx, srcy, srcwidth, + srcheight: Integer; srcUnit: TUnit; imageAttributes: TGPImageAttributes = nil; + callback: DrawImageAbort = nil; callbackData: Pointer = nil): TStatus; + var + nImage: GpImage; + nimageAttributes: GpimageAttributes; + begin + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipDrawImageRectRectI(nativeGraphics, + nimage, + destRect.X, + destRect.Y, + destRect.Width, + destRect.Height, + srcx, + srcy, + srcwidth, + srcheight, + srcUnit, + nimageAttributes, + callback, + callbackData)); + end; + + function TGPGraphics.DrawImage(image: TGPImage; destPoints: PGPPoint; + count, srcx, srcy, srcwidth, srcheight: Integer; srcUnit: TUnit; + imageAttributes: TGPImageAttributes = nil; callback: DrawImageAbort = nil; + callbackData: Pointer = nil): TStatus; + var + nImage: GpImage; + nimageAttributes: GpimageAttributes; + begin + if assigned(Image) then nImage := Image.nativeImage else nImage := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + + result := SetStatus(GdipDrawImagePointsRectI(nativeGraphics, + nimage, + destPoints, + count, + srcx, + srcy, + srcwidth, + srcheight, + srcUnit, + nimageAttributes, + callback, + callbackData)); + end; + + // The following methods are for playing an EMF+ to a graphics + // via the enumeration interface. Each record of the EMF+ is + // sent to the callback (along with the callbackData). Then + // the callback can invoke the Metafile::PlayRecord method + // to play the particular record. + + + function TGPGraphics.EnumerateMetafile(metafile: TGPMetafile; const destPoint: TGPPointF; + callback: EnumerateMetafileProc; callbackData: Pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileDestPoint( + nativeGraphics, + nmetafile, + @destPoint, + callback, + callbackData, + nimageAttributes)); + end; + + + function TGPGraphics.EnumerateMetafile(metafile: TGPMetafile; const destPoint: TGPPoint; + callback: EnumerateMetafileProc; callbackData: pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileDestPointI( + nativeGraphics, + nmetafile, + @destPoint, + callback, + callbackData, + nimageAttributes)); + end; + + + function TGPGraphics.EnumerateMetafile(metafile: TGPMetafile; const destRect: TGPRectF; + callback: EnumerateMetafileProc; callbackData: Pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileDestRect( + nativeGraphics, + nmetafile, + @destRect, + callback, + callbackData, + nimageAttributes)); + end; + + + function TGPGraphics.EnumerateMetafile(metafile: TGPMetafile; const destRect: TGPRect; + callback: EnumerateMetafileProc; callbackData: Pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileDestRectI( + nativeGraphics, + nmetafile, + @destRect, + callback, + callbackData, + nimageAttributes)); + end; + + + function TGPGraphics.EnumerateMetafile(metafile: TGPMetafile; destPoints: PGPPointF; + count: Integer; callback: EnumerateMetafileProc; callbackData: Pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileDestPoints( + nativeGraphics, + nmetafile, + destPoints, + count, + callback, + callbackData, + nimageAttributes)); + end; + + + function TGPGraphics.EnumerateMetafile(metafile: TGPMetafile; destPoints: PGPPoint; + count: Integer; callback: EnumerateMetafileProc; callbackData: Pointer = nil; + imageAttributes: TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileDestPointsI( + nativeGraphics, + nmetafile, + destPoints, + count, + callback, + callbackData, + nimageAttributes)); + end; + + + function TGPGraphics.EnumerateMetafile(metafile: TGPMetafile; const destPoint: TGPPointF; + const srcRect: TGPRectF; srcUnit: TUnit; callback: EnumerateMetafileProc; + callbackData: pointer = nil; imageAttributes: TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileSrcRectDestPoint( + nativeGraphics, + nmetafile, + @destPoint, + @srcRect, + srcUnit, + callback, + callbackData, + nimageAttributes)); + end; + + + function TGPGraphics.EnumerateMetafile(metafile : TGPMetafile; const destPoint : TGPPoint; + const srcRect : TGPRect; srcUnit : TUnit; callback : EnumerateMetafileProc; + callbackData : Pointer = nil; imageAttributes : TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileSrcRectDestPointI( + nativeGraphics, + nmetafile, + @destPoint, + @srcRect, + srcUnit, + callback, + callbackData, + nimageAttributes)); + end; + + + function TGPGraphics.EnumerateMetafile(metafile: TGPMetafile; const destRect: TGPRectF; + const srcRect: TGPRectF; srcUnit: TUnit; callback: EnumerateMetafileProc; + callbackData: Pointer = nil; imageAttributes: TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileSrcRectDestRect( + nativeGraphics, + nmetafile, + @destRect, + @srcRect, + srcUnit, + callback, + callbackData, + nimageAttributes)); + end; + + + function TGPGraphics.EnumerateMetafile(metafile : TGPMetafile; const destRect, srcRect: TGPRect; + srcUnit : TUnit; callback : EnumerateMetafileProc; callbackData : Pointer = nil; + imageAttributes : TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileSrcRectDestRectI( + nativeGraphics, + nmetafile, + @destRect, + @srcRect, + srcUnit, + callback, + callbackData, + nimageAttributes)); + end; + + + function TGPGraphics.EnumerateMetafile( metafile: TGPMetafile; destPoints: PGPPointF; + count: Integer; const srcRect: TGPRectF; srcUnit: TUnit; callback: EnumerateMetafileProc; + callbackData: Pointer = nil; imageAttributes: TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileSrcRectDestPoints( + nativeGraphics, + nmetafile, + destPoints, + count, + @srcRect, + srcUnit, + callback, + callbackData, + nimageAttributes)); + end; + + + function TGPGraphics.EnumerateMetafile(metafile: TGPMetafile; destPoints: PGPPoint; + count: Integer; const srcRect: TGPRect; srcUnit: TUnit; callback: EnumerateMetafileProc; + callbackData: Pointer = nil; imageAttributes: TGPImageAttributes = nil): TStatus; + var + nMetafile: GpMetafile; + nimageAttributes: GpimageAttributes; + begin + if assigned(Metafile) then nMetafile := GpMetafile(Metafile.nativeImage) else nMetafile := nil; + if assigned(imageAttributes) then nimageAttributes := imageAttributes.nativeImageAttr else nimageAttributes := nil; + result := SetStatus(GdipEnumerateMetafileSrcRectDestPointsI( + nativeGraphics, + nmetafile, + destPoints, + count, + @srcRect, + srcUnit, + callback, + callbackData, + nimageAttributes)); + end; + + function TGPGraphics.SetClip(g: TGPGraphics; combineMode: TCombineMode = CombineModeReplace): TStatus; + begin + result := SetStatus(GdipSetClipGraphics(nativeGraphics, + g.nativeGraphics, + combineMode)); + end; + + function TGPGraphics.SetClip(rect: TGPRectF; combineMode: TCombineMode = CombineModeReplace): TStatus; + begin + result := SetStatus(GdipSetClipRect(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + combineMode)); + end; + + function TGPGraphics.SetClip(rect: TGPRect; combineMode: TCombineMode = CombineModeReplace): TStatus; + begin + result := SetStatus(GdipSetClipRectI(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + combineMode)); + end; + + function TGPGraphics.SetClip(path: TGPGraphicsPath; combineMode: TCombineMode = CombineModeReplace): TStatus; + begin + result := SetStatus(GdipSetClipPath(nativeGraphics, + path.nativePath, + combineMode)); + end; + + function TGPGraphics.SetClip(region: TGPRegion; combineMode: TCombineMode = CombineModeReplace): TStatus; + begin + result := SetStatus(GdipSetClipRegion(nativeGraphics, + region.nativeRegion, + combineMode)); + end; + + // This is different than the other SetClip methods because it assumes + // that the HRGN is already in device units, so it doesn't transform + // the coordinates in the HRGN. + + function TGPGraphics.SetClip(hRgn: HRGN; combineMode: TCombineMode = CombineModeReplace): TStatus; + begin + result := SetStatus(GdipSetClipHrgn(nativeGraphics, hRgn, + combineMode)); + end; + + function TGPGraphics.IntersectClip(const rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipSetClipRect(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeIntersect)); + end; + + function TGPGraphics.IntersectClip(const rect: TGPRect): TStatus; + begin + result := SetStatus(GdipSetClipRectI(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeIntersect)); + end; + + function TGPGraphics.IntersectClip(region: TGPRegion): TStatus; + begin + result := SetStatus(GdipSetClipRegion(nativeGraphics, + region.nativeRegion, + CombineModeIntersect)); + end; + + function TGPGraphics.ExcludeClip(const rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipSetClipRect(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeExclude)); + end; + + function TGPGraphics.ExcludeClip(const rect: TGPRect): TStatus; + begin + result := SetStatus(GdipSetClipRectI(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeExclude)); + end; + + function TGPGraphics.ExcludeClip(region: TGPRegion): TStatus; + begin + result := SetStatus(GdipSetClipRegion(nativeGraphics, + region.nativeRegion, + CombineModeExclude)); + end; + + function TGPGraphics.ResetClip: TStatus; + begin + result := SetStatus(GdipResetClip(nativeGraphics)); + end; + + function TGPGraphics.TranslateClip(dx, dy: Single): TStatus; + begin + result := SetStatus(GdipTranslateClip(nativeGraphics, dx, dy)); + end; + + function TGPGraphics.TranslateClip(dx, dy: Integer): TStatus; + begin + result := SetStatus(GdipTranslateClipI(nativeGraphics, + dx, dy)); + end; + + function TGPGraphics.GetClip(region: TGPRegion): TStatus; + begin + result := SetStatus(GdipGetClip(nativeGraphics, + region.nativeRegion)); + end; + + function TGPGraphics.GetClipBounds(out rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipGetClipBounds(nativeGraphics, @rect)); + end; + + function TGPGraphics.GetClipBounds(out rect: TGPRect): TStatus; + begin + result := SetStatus(GdipGetClipBoundsI(nativeGraphics, @rect)); + end; + + function TGPGraphics.IsClipEmpty: Bool; + var booln: BOOL; + begin + booln := FALSE; + SetStatus(GdipIsClipEmpty(nativeGraphics, @booln)); + result := booln; + end; + + function TGPGraphics.GetVisibleClipBounds(out rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipGetVisibleClipBounds(nativeGraphics, @rect)); + end; + + function TGPGraphics.GetVisibleClipBounds(out rect: TGPRect): TStatus; + begin + result := SetStatus(GdipGetVisibleClipBoundsI(nativeGraphics, @rect)); + end; + + function TGPGraphics.IsVisibleClipEmpty: BOOL; + var booln: BOOL; + begin + booln := FALSE; + SetStatus(GdipIsVisibleClipEmpty(nativeGraphics, booln)); + result := booln; + end; + + function TGPGraphics.IsVisible(x, y: Integer): BOOL; + var pt: TGPPoint; + begin + pt.X := x; pt.Y := y; + result := IsVisible(pt); + end; + + function TGPGraphics.IsVisible(const point: TGPPoint): BOOL; + var booln: BOOL; + begin + booln := FALSE; + SetStatus(GdipIsVisiblePointI(nativeGraphics, + point.X, + point.Y, + booln)); + result := booln; + end; + + function TGPGraphics.IsVisible(x, y, width, height: Integer): BOOL; + var booln: BOOL; + begin + booln := TRUE; + SetStatus(GdipIsVisibleRectI(nativeGraphics, + X, + Y, + Width, + Height, + booln)); + result := booln; + end; + + function TGPGraphics.IsVisible(const rect: TGPRect): BOOL; + var booln: BOOL; + begin + booln := TRUE; + SetStatus(GdipIsVisibleRectI(nativeGraphics, + rect.X, + rect.Y, + rect.Width, + rect.Height, + booln)); + result := booln; + end; + + function TGPGraphics.IsVisible(x, y: Single): BOOL; + var booln: BOOL; + begin + booln := FALSE; + SetStatus(GdipIsVisiblePoint(nativeGraphics, + X, + Y, + booln)); + + result := booln; + end; + + function TGPGraphics.IsVisible(const point: TGPPointF): BOOL; + var booln: BOOL; + begin + booln := FALSE; + SetStatus(GdipIsVisiblePoint(nativeGraphics, + point.X, + point.Y, + booln)); + + result := booln; + end; + + function TGPGraphics.IsVisible(x, y, width, height: Single): BOOL; + var booln: BOOL; + begin + booln := TRUE; + SetStatus(GdipIsVisibleRect(nativeGraphics, + X, + Y, + Width, + Height, + booln)); + result := booln; + end; + + function TGPGraphics.IsVisible(const rect: TGPRectF): BOOL; + var booln: BOOL; + begin + booln := TRUE; + SetStatus(GdipIsVisibleRect(nativeGraphics, + rect.X, + rect.Y, + rect.Width, + rect.Height, + booln)); + result := booln; + end; + + function TGPGraphics.Save: GraphicsState; + begin + SetStatus(GdipSaveGraphics(nativeGraphics, result)); + end; + + function TGPGraphics.Restore(gstate: GraphicsState): TStatus; + begin + result := SetStatus(GdipRestoreGraphics(nativeGraphics, + gstate)); + end; + + function TGPGraphics.BeginContainer(const dstrect,srcrect: TGPRectF; unit_: TUnit): GraphicsContainer; + begin + SetStatus(GdipBeginContainer(nativeGraphics, @dstrect, + @srcrect, unit_, result)); + end; + + function TGPGraphics.BeginContainer(const dstrect, srcrect: TGPRect; unit_: TUnit): GraphicsContainer; + begin + SetStatus(GdipBeginContainerI(nativeGraphics, @dstrect, + @srcrect, unit_, result)); + end; + + function TGPGraphics.BeginContainer: GraphicsContainer; + begin + SetStatus(GdipBeginContainer2(nativeGraphics, result)); + end; + + function TGPGraphics.EndContainer(state: GraphicsContainer): TStatus; + begin + result := SetStatus(GdipEndContainer(nativeGraphics, state)); + end; + + // Only valid when recording metafiles. + + function TGPGraphics.AddMetafileComment(data: PBYTE; sizeData: UINT): TStatus; + begin + result := SetStatus(GdipComment(nativeGraphics, sizeData, data)); + end; + + function TGPGraphics.GetHalftonePalette: HPALETTE; + begin + result := GdipCreateHalftonePalette; + end; + + function TGPGraphics.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + + constructor TGPGraphics.Create(graphics: GpGraphics); + begin + lastResult := Ok; + SetNativeGraphics(graphics); + end; + + procedure TGPGraphics.SetNativeGraphics(graphics: GpGraphics); + begin + self.nativeGraphics := graphics; + end; + + function TGPGraphics.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then lastResult := status; + result := status; + end; + + function TGPGraphics.GetNativeGraphics: GpGraphics; + begin + result := self.nativeGraphics; + end; + + function TGPGraphics.GetNativePen(pen: TGPPen): GpPen; + begin + result := pen.nativePen; + end; + +(**************************************************************************\ +* +* GDI+ Font Family class +* +\**************************************************************************) + + constructor TGPFontFamily.Create; + begin + nativeFamily := nil; + lastResult := Ok; + end; + + constructor TGPFontFamily.Create(name: WideString; fontCollection: TGPFontCollection = nil); + var nfontCollection: GpfontCollection; + begin + nativeFamily := nil; + if assigned(fontCollection) then nfontCollection := fontCollection.nativeFontCollection else nfontCollection := nil; + lastResult := GdipCreateFontFamilyFromName(PWideChar(name), nfontCollection, nativeFamily); + end; + + destructor TGPFontFamily.Destroy; + begin + GdipDeleteFontFamily (nativeFamily); + end; + + class function TGPFontFamily.GenericSansSerif: TGPFontFamily; + var + nFontFamily: GpFontFamily; + begin + if (GenericSansSerifFontFamily <> nil) then + begin + result := GenericSansSerifFontFamily; + exit; + end; + GenericSansSerifFontFamily := TGPFontFamily.Create; + GenericSansSerifFontFamily.lastResult := GdipGetGenericFontFamilySansSerif(nFontFamily); + GenericSansSerifFontFamily.nativeFamily := nFontFamily; + result := GenericSansSerifFontFamily; + end; + + class function TGPFontFamily.GenericSerif: TGPFontFamily; + var nFontFamily: GpFontFamily; + begin + if (GenericSerifFontFamily <> nil) then + begin + result := GenericSerifFontFamily; + exit; + end; + + GenericSerifFontFamily := TGPFontFamily.Create;// (GenericSerifFontFamilyBuffer); + GenericSerifFontFamily.lastResult := GdipGetGenericFontFamilySerif(nFontFamily); + GenericSerifFontFamily.nativeFamily := nFontFamily; + result := GenericSerifFontFamily; + end; + + class function TGPFontFamily.GenericMonospace: TGPFontFamily; + var nFontFamily: GpFontFamily; + begin + if (GenericMonospaceFontFamily <> nil) then + begin + result := GenericMonospaceFontFamily; + exit; + end; + GenericMonospaceFontFamily := TGPFontFamily.Create;// (GenericMonospaceFontFamilyBuffer); + GenericMonospaceFontFamily.lastResult := GdipGetGenericFontFamilyMonospace(nFontFamily); + GenericMonospaceFontFamily.nativeFamily := nFontFamily; + result := GenericMonospaceFontFamily; + end; + + function TGPFontFamily.GetFamilyName(out name: string; language: LANGID = 0): TStatus; + var str: array[0..LF_FACESIZE - 1] of WideChar; + begin + result := SetStatus(GdipGetFamilyName(nativeFamily, @str, language)); + name := str; + end; + + function TGPFontFamily.Clone: TGPFontFamily; + var + clonedFamily: GpFontFamily; + begin + clonedFamily := nil; + SetStatus(GdipCloneFontFamily (nativeFamily, clonedFamily)); + result := TGPFontFamily.Create(clonedFamily, lastResult); + end; + + function TGPFontFamily.IsAvailable: BOOL; + begin + result := (nativeFamily <> nil); + end; + + function TGPFontFamily.IsStyleAvailable(style: Integer): BOOL; + var + StyleAvailable: BOOL; + status: TStatus; + begin + status := SetStatus(GdipIsStyleAvailable(nativeFamily, style, StyleAvailable)); + if (status <> Ok) then StyleAvailable := FALSE; + result := StyleAvailable; + end; + + function TGPFontFamily.GetEmHeight(style: Integer): UINT16; + begin + SetStatus(GdipGetEmHeight(nativeFamily, style, result)); + end; + + function TGPFontFamily.GetCellAscent(style: Integer): UINT16; + begin + SetStatus(GdipGetCellAscent(nativeFamily, style, result)); + end; + + function TGPFontFamily.GetCellDescent(style: Integer): UINT16; + begin + SetStatus(GdipGetCellDescent(nativeFamily, style, result)); + end; + + function TGPFontFamily.GetLineSpacing(style: Integer): UINT16; + begin + SetStatus(GdipGetLineSpacing(nativeFamily, style, result)); + end; + + function TGPFontFamily.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + + function TGPFontFamily.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then lastResult := status; + result := status; + end; + + constructor TGPFontFamily.Create(nativeOrig: GpFontFamily; status: TStatus); + begin + lastResult := status; + nativeFamily := nativeOrig; + end; + +(**************************************************************************\ +* +* GDI+ Font class +* +\**************************************************************************) + + constructor TGPFont.Create(hdc: HDC); + var font: GpFont; + begin + font := nil; + lastResult := GdipCreateFontFromDC(hdc, font); + SetNativeFont(font); + end; + + constructor TGPFont.Create(hdc: HDC; logfont: PLogFontA); + var font: GpFont; + begin + font := nil; + if assigned(logfont) then + lastResult := GdipCreateFontFromLogfontA(hdc, logfont, font) + else + lastResult := GdipCreateFontFromDC(hdc, font); + SetNativeFont(font); + end; + + constructor TGPFont.Create(hdc: HDC; logfont: PLogFontW); + var font: GpFont; + begin + font := nil; + if assigned(logfont) then + lastResult := GdipCreateFontFromLogfontW(hdc, logfont, font) + else + lastResult := GdipCreateFontFromDC(hdc, font); + SetNativeFont(font); + end; + + constructor TGPFont.Create(hdc: HDC; hfont: HFONT); + var + font: GpFont; + lf: LOGFONTA; + begin + font := nil; + if BOOL(hfont) then + begin + if( BOOL(GetObjectA(hfont, sizeof(LOGFONTA), @lf))) then + lastResult := GdipCreateFontFromLogfontA(hdc, @lf, font) + else + lastResult := GdipCreateFontFromDC(hdc, font); + end + else + lastResult := GdipCreateFontFromDC(hdc, font); + SetNativeFont(font); + end; + + constructor TGPFont.Create(family: TGPFontFamily; emSize: Single; + style: TFontStyle = FontStyleRegular; unit_: TUnit = UnitPoint); + var + font: GpFont; + nFontFamily: GpFontFamily; + begin + font := nil; + if assigned(Family) then nFontFamily := Family.nativeFamily else nFontFamily := nil; + lastResult := GdipCreateFont(nFontFamily, emSize, Integer(style), Integer(unit_), font); + SetNativeFont(font); + end; + + constructor TGPFont.Create(familyName: WideString; emSize: Single; + style: TFontStyle = FontStyleRegular; unit_: TUnit = UnitPoint; + fontCollection: TGPFontCollection = nil); + var + family: TGPFontFamily; + nativeFamily: GpFontFamily; + begin + nativeFont := nil; + family := TGPFontFamily.Create(familyName, fontCollection); + nativeFamily := family.nativeFamily; + lastResult := family.GetLastStatus; + if (lastResult <> Ok) then + begin + nativeFamily := TGPFontFamily.GenericSansSerif.nativeFamily; + lastResult := TGPFontFamily.GenericSansSerif.lastResult; + if (lastResult <> Ok) then + begin + family.Free; + exit; + end; + end; + + lastResult := GdipCreateFont(nativeFamily, + emSize, + integer(style), + integer(unit_), + nativeFont); + + if (lastResult <> Ok) then + begin + nativeFamily := TGPFontFamily.GenericSansSerif.nativeFamily; + lastResult := TGPFontFamily.GenericSansSerif.lastResult; + if (lastResult <> Ok) then + begin + family.Free; + exit; + end; + + lastResult := GdipCreateFont( + nativeFamily, + emSize, + Integer(style), + Integer(unit_), + nativeFont); + end; + family.Free; + end; + + function TGPFont.GetLogFontA(g: TGPGraphics; out logfontA: TLogFontA): TStatus; + var nGraphics: GpGraphics; + begin + if assigned(g) then nGraphics := g.nativeGraphics else nGraphics := nil; + result := SetStatus(GdipGetLogFontA(nativeFont, nGraphics, logfontA)); + end; + + function TGPFont.GetLogFontW(g: TGPGraphics; out logfontW: TLogFontW): TStatus; + var nGraphics: GpGraphics; + begin + if assigned(g) then nGraphics := g.nativeGraphics else nGraphics := nil; + result := SetStatus(GdipGetLogFontW(nativeFont, nGraphics, logfontW)); + end; + + function TGPFont.Clone: TGPFont; + var cloneFont: GpFont; + begin + cloneFont := nil; + SetStatus(GdipCloneFont(nativeFont, cloneFont)); + result := TGPFont.Create(cloneFont, lastResult); + end; + + destructor TGPFont.Destroy; + begin + GdipDeleteFont(nativeFont); + end; + + function TGPFont.IsAvailable: BOOL; + begin + result := (nativeFont <> nil); + end; + + function TGPFont.GetStyle: Integer; + begin + SetStatus(GdipGetFontStyle(nativeFont, result)); + end; + + function TGPFont.GetSize: Single; + begin + SetStatus(GdipGetFontSize(nativeFont, result)); + end; + + function TGPFont.GetUnit: TUnit; + begin + SetStatus(GdipGetFontUnit(nativeFont, result)); + end; + + function TGPFont.GetLastStatus: TStatus; + begin + result := lastResult; + end; + + function TGPFont.GetHeight(graphics: TGPGraphics): Single; + var ngraphics: Gpgraphics; + begin + if assigned(graphics) then ngraphics := graphics.nativeGraphics else ngraphics := nil; + SetStatus(GdipGetFontHeight(nativeFont, ngraphics, result)); + end; + + function TGPFont.GetHeight(dpi: Single): Single; + begin + SetStatus(GdipGetFontHeightGivenDPI(nativeFont, dpi, result)); + end; + + function TGPFont.GetFamily(family: TGPFontFamily): TStatus; + var + status: TStatus; + nFamily: GpFontFamily; + begin + if (family = nil) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + + status := GdipGetFamily(nativeFont, nFamily); + family.nativeFamily := nFamily; + family.SetStatus(status); + result := SetStatus(status); + end; + + constructor TGPFont.Create(font: GpFont; status: TStatus); + begin + lastResult := status; + SetNativeFont(font); + end; + + procedure TGPFont.SetNativeFont(Font: GpFont); + begin + nativeFont := Font; + end; + + function TGPFont.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then lastResult := status; + result := status; + end; + +(**************************************************************************\ +* +* Font collections (Installed and Private) +* +\**************************************************************************) + + constructor TGPFontCollection.Create; + begin + nativeFontCollection := nil; + end; + + destructor TGPFontCollection.Destroy; + begin + inherited Destroy; + end; + + function TGPFontCollection.GetFamilyCount: Integer; + var + numFound: Integer; + begin + numFound := 0; + lastResult := GdipGetFontCollectionFamilyCount(nativeFontCollection, numFound); + result := numFound; + end; + + function TGPFontCollection.GetFamilies(numSought: Integer; out gpfamilies: array of TGPFontFamily; + out numFound: Integer): TStatus; + var + nativeFamilyList: Pointer; + Status: TStatus; + i: Integer; + type + ArrGpFontFamily = array of GpFontFamily; + begin + if ((numSought <= 0) or (length(gpfamilies) = 0)) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + numFound := 0; + + getMem(nativeFamilyList, numSought * SizeOf(GpFontFamily)); + if nativeFamilyList = nil then + begin + result := SetStatus(OutOfMemory); + exit; + end; + + status := SetStatus(GdipGetFontCollectionFamilyList( + nativeFontCollection, + numSought, + nativeFamilyList, + numFound + )); + + if (status = Ok) then + for i := 0 to numFound - 1 do + GdipCloneFontFamily(ArrGpFontFamily(nativeFamilyList)[i], gpfamilies[i].nativeFamily); + Freemem(nativeFamilyList, numSought * SizeOf(GpFontFamily)); + result := status; + end; + + function TGPFontCollection.GetLastStatus: TStatus; + begin + result := lastResult; + end; + + function TGPFontCollection.SetStatus(status: TStatus): TStatus; + begin + lastResult := status; + result := lastResult; + end; + + + constructor TGPInstalledFontCollection.Create; + begin + nativeFontCollection := nil; + lastResult := GdipNewInstalledFontCollection(nativeFontCollection); + end; + + destructor TGPInstalledFontCollection.Destroy; + begin + inherited Destroy; + end; + + constructor TGPPrivateFontCollection.Create; + begin + nativeFontCollection := nil; + lastResult := GdipNewPrivateFontCollection(nativeFontCollection); + end; + + destructor TGPPrivateFontCollection.destroy; + begin + GdipDeletePrivateFontCollection(nativeFontCollection); + inherited Destroy; + end; + + function TGPPrivateFontCollection.AddFontFile(filename: WideString): TStatus; + begin + result := SetStatus(GdipPrivateAddFontFile(nativeFontCollection, PWideChar(filename))); + end; + + function TGPPrivateFontCollection.AddMemoryFont(memory: Pointer; length: Integer): TStatus; + begin + result := SetStatus(GdipPrivateAddMemoryFont( + nativeFontCollection, + memory, + length)); + end; + +(**************************************************************************\ +* +* GDI+ Graphics Path class +* +\**************************************************************************) + + constructor TGPGraphicsPath.Create(fillMode: TFillMode = FillModeAlternate); + begin + nativePath := nil; + lastResult := GdipCreatePath(fillMode, nativePath); + end; + + constructor TGPGraphicsPath.Create(points: PGPPointF; types: PBYTE; count: Integer; + fillMode: TFillMode = FillModeAlternate); + begin + nativePath := nil; + lastResult := GdipCreatePath2(points, types, count, fillMode, nativePath); + end; + + constructor TGPGraphicsPath.Create(points: PGPPoint; types: PBYTE; count: Integer; + fillMode: TFillMode = FillModeAlternate); + begin + nativePath := nil; + lastResult := GdipCreatePath2I(points, types, count, fillMode, nativePath); + end; + + destructor TGPGraphicsPath.destroy; + begin + GdipDeletePath(nativePath); + end; + + function TGPGraphicsPath.Clone: TGPGraphicsPath; + var + clonepath: GpPath; + begin + clonepath := nil; + SetStatus(GdipClonePath(nativePath, clonepath)); + result := TGPGraphicsPath.Create(clonepath); + end; + + // Reset the path object to empty (and fill mode to FillModeAlternate) + + function TGPGraphicsPath.Reset: TStatus; + begin + result := SetStatus(GdipResetPath(nativePath)); + end; + + function TGPGraphicsPath.GetFillMode: TFillMode; + var FMode: TFillMode; + begin + FMode := FillModeAlternate; + SetStatus(GdipGetPathFillMode(nativePath, result)); + result := FMode; + end; + + function TGPGraphicsPath.SetFillMode(fillmode: TFillMode): TStatus; + begin + result := SetStatus(GdipSetPathFillMode(nativePath, fillmode)); + end; + + function TGPGraphicsPath.GetPathData(pathData: TPathData): TStatus; + var + count: Integer; + begin + count := GetPointCount; + if ((count <= 0) or ((pathData.Count > 0) and (pathData.Count < Count))) then + begin + pathData.Count := 0; + if assigned(pathData.Points) then + begin + FreeMem(pathData.Points); + pathData.Points := nil; + end; + if assigned(pathData.Types) then + begin + freemem(pathData.Types); + pathData.Types := nil; + end; + if (count <= 0) then + begin + result := lastResult; + exit; + end; + end; + + if (pathData.Count = 0) then + begin + getmem(pathData.Points, SizeOf(TGPPointF) * count); + if (pathData.Points = nil) then + begin + result := SetStatus(OutOfMemory); + exit; + end; + Getmem(pathData.Types, count); + if (pathData.Types = nil) then + begin + freemem(pathData.Points); + pathData.Points := nil; + result := SetStatus(OutOfMemory); + exit; + end; + pathData.Count := count; + end; + + result := SetStatus(GdipGetPathData(nativePath, @pathData.Count)); + end; + + function TGPGraphicsPath.StartFigure: TStatus; + begin + result := SetStatus(GdipStartPathFigure(nativePath)); + end; + + function TGPGraphicsPath.CloseFigure: TStatus; + begin + result := SetStatus(GdipClosePathFigure(nativePath)); + end; + + function TGPGraphicsPath.CloseAllFigures: TStatus; + begin + result := SetStatus(GdipClosePathFigures(nativePath)); + end; + + function TGPGraphicsPath.SetMarker: TStatus; + begin + result := SetStatus(GdipSetPathMarker(nativePath)); + end; + + function TGPGraphicsPath.ClearMarkers: TStatus; + begin + result := SetStatus(GdipClearPathMarkers(nativePath)); + end; + + function TGPGraphicsPath.Reverse: TStatus; + begin + result := SetStatus(GdipReversePath(nativePath)); + end; + + function TGPGraphicsPath.GetLastPoint(out lastPoint: TGPPointF): TStatus; + begin + result := SetStatus(GdipGetPathLastPoint(nativePath, + @lastPoint)); + end; + + function TGPGraphicsPath.AddLine(const pt1, pt2: TGPPointF): TStatus; + begin + result := AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y); + end; + + function TGPGraphicsPath.AddLine(x1, y1, x2, y2: Single): TStatus; + begin + result := SetStatus(GdipAddPathLine(nativePath, x1, y1, + x2, y2)); + end; + + function TGPGraphicsPath.AddLines(points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathLine2(nativePath, points, count)); + end; + + function TGPGraphicsPath.AddLine(const pt1, pt2: TGPPoint): TStatus; + begin + result := AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y); + end; + + function TGPGraphicsPath.AddLine(x1, y1, x2, y2: Integer): TStatus; + begin + result := SetStatus(GdipAddPathLineI(nativePath, x1, y1, x2, y2)); + end; + + function TGPGraphicsPath.AddLines(points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathLine2I(nativePath, points, count)); + end; + + function TGPGraphicsPath.AddArc(rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; + begin + result := AddArc(rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + end; + + function TGPGraphicsPath.AddArc(x, y, width, height, startAngle, sweepAngle: Single): TStatus; + begin + result := SetStatus(GdipAddPathArc(nativePath, x, y, width, height, startAngle, sweepAngle)); + end; + + function TGPGraphicsPath.AddArc(rect: TGPRect; startAngle, sweepAngle: Single): TStatus; + begin + result := AddArc(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); + end; + + function TGPGraphicsPath.AddArc(x, y, width, height: Integer; startAngle, sweepAngle: Single): TStatus; + begin + result := SetStatus(GdipAddPathArcI(nativePath, x, y, width, height, startAngle, sweepAngle)); + end; + + function TGPGraphicsPath.AddBezier(pt1, pt2, pt3, pt4: TGPPointF): TStatus; + begin + result := AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y); + end; + + function TGPGraphicsPath.AddBezier(x1, y1, x2, y2, x3, y3, x4, y4: Single): TStatus; + begin + result := SetStatus(GdipAddPathBezier(nativePath, x1, y1, x2, y2, x3, y3, x4, y4)); + end; + + function TGPGraphicsPath.AddBeziers(points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathBeziers(nativePath, points, count)); + end; + + function TGPGraphicsPath.AddBezier(pt1, pt2, pt3, pt4: TGPPoint): TStatus; + begin + result := AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y); + end; + + function TGPGraphicsPath.AddBezier(x1, y1, x2, y2, x3, y3, x4, y4: Integer): TStatus; + begin + result := SetStatus(GdipAddPathBezierI(nativePath, x1, y1, x2, y2, x3, y3, x4, y4)); + end; + + function TGPGraphicsPath.AddBeziers(points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathBeziersI(nativePath, points, count)); + end; + + function TGPGraphicsPath.AddCurve(points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathCurve(nativePath, points, count)); + end; + + function TGPGraphicsPath.AddCurve(points: PGPPointF; count: Integer; + tension: Single): TStatus; + begin + result := SetStatus(GdipAddPathCurve2(nativePath, points, count, tension)); + end; + + function TGPGraphicsPath.AddCurve(points: PGPPointF; count, offset, + numberOfSegments: Integer; tension: Single): TStatus; + begin + result := SetStatus(GdipAddPathCurve3(nativePath, points, count, offset, + numberOfSegments, tension)); + end; + + function TGPGraphicsPath.AddCurve(points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathCurveI(nativePath, points, count)); + end; + + function TGPGraphicsPath.AddCurve(points: PGPPoint; count: Integer; tension: Single): TStatus; + begin + result := SetStatus(GdipAddPathCurve2I(nativePath, points, count, tension)); + end; + + function TGPGraphicsPath.AddCurve(points: PGPPoint; count, offset, + numberOfSegments: Integer; tension: Single): TStatus; + begin + result := SetStatus(GdipAddPathCurve3I(nativePath, points, count, offset, + numberOfSegments, tension)); + end; + + function TGPGraphicsPath.AddClosedCurve(points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathClosedCurve(nativePath, points, count)); + end; + + function TGPGraphicsPath.AddClosedCurve(points: PGPPointF; count: Integer; tension: Single): TStatus; + begin + result := SetStatus(GdipAddPathClosedCurve2(nativePath, points, count, tension)); + end; + + function TGPGraphicsPath.AddClosedCurve(points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathClosedCurveI(nativePath, points, count)); + end; + + + function TGPGraphicsPath.AddClosedCurve(points: PGPPoint; count: Integer; tension: Single): TStatus; + begin + result := SetStatus(GdipAddPathClosedCurve2I(nativePath, points, count, tension)); + end; + + function TGPGraphicsPath.AddRectangle(rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipAddPathRectangle(nativePath, + rect.X, + rect.Y, + rect.Width, + rect.Height)); + end; + + function TGPGraphicsPath.AddRectangles(rects: PGPRectF; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathRectangles(nativePath, + rects, + count)); + end; + + function TGPGraphicsPath.AddRectangle(rect: TGPRect): TStatus; + begin + result := SetStatus(GdipAddPathRectangleI(nativePath, + rect.X, + rect.Y, + rect.Width, + rect.Height)); + end; + + function TGPGraphicsPath.AddRectangles(rects: PGPRect; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathRectanglesI(nativePath, + rects, + count)); + end; + + function TGPGraphicsPath.AddEllipse(rect: TGPRectF): TStatus; + begin + result := AddEllipse(rect.X, rect.Y, rect.Width, rect.Height); + end; + + function TGPGraphicsPath.AddEllipse(x, y, width, height: Single): TStatus; + begin + result := SetStatus(GdipAddPathEllipse(nativePath, + x, + y, + width, + height)); + end; + + function TGPGraphicsPath.AddEllipse(rect: TGPRect): TStatus; + begin + result := AddEllipse(rect.X, rect.Y, rect.Width, rect.Height); + end; + + function TGPGraphicsPath.AddEllipse(x, y, width, height: Integer): TStatus; + begin + result := SetStatus(GdipAddPathEllipseI(nativePath, + x, + y, + width, + height)); + end; + + function TGPGraphicsPath.AddPie(rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; + begin + result := AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle, + sweepAngle); + end; + + function TGPGraphicsPath.AddPie(x, y, width, height, startAngle, sweepAngle: Single): TStatus; + begin + result := SetStatus(GdipAddPathPie(nativePath, x, y, width, + height, startAngle, + sweepAngle)); + end; + + function TGPGraphicsPath.AddPie(rect: TGPRect; startAngle, sweepAngle: Single): TStatus; + begin + result := AddPie(rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + end; + + function TGPGraphicsPath.AddPie(x, y, width, height: Integer; startAngle, sweepAngle: Single): TStatus; + begin + result := SetStatus(GdipAddPathPieI(nativePath, + x, + y, + width, + height, + startAngle, + sweepAngle)); + end; + + function TGPGraphicsPath.AddPolygon(points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathPolygon(nativePath, points, count)); + end; + + function TGPGraphicsPath.AddPolygon(points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipAddPathPolygonI(nativePath, points, + count)); + end; + + function TGPGraphicsPath.AddPath(addingPath: TGPGraphicsPath; connect: Bool): TStatus; + var + nativePath2: GpPath; + begin + nativePath2 := nil; + if assigned(addingPath) then nativePath2 := addingPath.nativePath; + result := SetStatus(GdipAddPathPath(nativePath, nativePath2, connect)); + end; + + function TGPGraphicsPath.AddString( + string_: WideString; length: Integer; + family : TGPFontFamily; + style : Integer; + emSize : Single; // World units + origin : TGPPointF; + format : TGPStringFormat): TStatus; + var + rect : TGPRectF; + gpff : GPFONTFAMILY; + gpsf : GPSTRINGFORMAT; + begin + rect.X := origin.X; + rect.Y := origin.Y; + rect.Width := 0.0; + rect.Height := 0.0; + + gpff := nil; + gpsf := nil; + if assigned(family) then gpff := family.nativeFamily; + if assigned(format) then gpsf := format.nativeFormat; + result := SetStatus(GdipAddPathString(nativePath, PWideChar(string_), length, gpff, + style, emSize, @rect, gpsf)); + end; + + function TGPGraphicsPath.AddString( + string_: WideString; + length : Integer; + family : TGPFontFamily; + style : Integer; + emSize : Single; // World units + layoutRect: TGPRectF; + format : TGPStringFormat): TStatus; + var + gpff : GPFONTFAMILY; + gpsf : GPSTRINGFORMAT; + begin + gpff := nil; + gpsf := nil; + if assigned(family) then gpff := family.nativeFamily; + if assigned(format) then gpsf := format.nativeFormat; + result := SetStatus(GdipAddPathString( nativePath, PWideChar(string_), length, gpff, + style, emSize, @layoutRect, gpsf)); + end; + + function TGPGraphicsPath.AddString( + string_: WideString; + length : Integer; + family : TGPFontFamily; + style : Integer; + emSize : Single; // World units + origin : TGPPoint; + format : TGPStringFormat): TStatus; + var + rect : TGPRect; + gpff : GPFONTFAMILY; + gpsf : GPSTRINGFORMAT; + begin + rect.X := origin.X; + rect.Y := origin.Y; + rect.Width := 0; + rect.Height := 0; + gpff := nil; + gpsf := nil; + if assigned(family) then gpff := family.nativeFamily; + if assigned(format) then gpsf := format.nativeFormat; + result := SetStatus(GdipAddPathStringI(nativePath, PWideChar(string_), length, gpff, + style, emSize, @rect, gpsf)); + end; + + function TGPGraphicsPath.AddString( + string_: WideString; + length : Integer; + family : TGPFontFamily; + style : Integer; + emSize : Single; // World units + layoutRect: TGPRect; + format : TGPStringFormat): TStatus; + var + gpff : GPFONTFAMILY; + gpsf : GPSTRINGFORMAT; + begin + gpff := nil; + gpsf := nil; + if assigned(family) then gpff := family.nativeFamily; + if assigned(format) then gpsf := format.nativeFormat; + result := SetStatus(GdipAddPathStringI( nativePath, PWideChar(string_), length, gpff, + style, emSize, @layoutRect, gpsf)); + end; + + function TGPGraphicsPath.Transform(matrix: TGPMatrix): TStatus; + begin + if assigned(matrix) then + result := SetStatus(GdipTransformPath(nativePath, matrix.nativeMatrix)) + else + result := Ok; + end; + + // This is not always the tightest bounds. + + function TGPGraphicsPath.GetBounds(out bounds: TGPRectF; matrix: TGPMatrix = nil; pen: TGPPen = nil): TStatus; + var + nativeMatrix: GpMatrix; + nativePen: GpPen; + begin + nativeMatrix := nil; + nativePen := nil; + if assigned(matrix) then nativeMatrix := matrix.nativeMatrix; + if assigned(pen) then nativePen := pen.nativePen; + + result := SetStatus(GdipGetPathWorldBounds(nativePath, @bounds, nativeMatrix, nativePen)); + end; + + function TGPGraphicsPath.GetBounds(out bounds: TGPRect; matrix: TGPMatrix = nil; pen: TGPPen = nil): TStatus; + var + nativeMatrix: GpMatrix; + nativePen: GpPen; + begin + nativeMatrix := nil; + nativePen := nil; + if assigned(matrix) then nativeMatrix := matrix.nativeMatrix; + if assigned(pen) then nativePen := pen.nativePen; + + result := SetStatus(GdipGetPathWorldBoundsI(nativePath, @bounds, nativeMatrix, nativePen)); + end; + + // Once flattened, the resultant path is made of line segments and + // the original path information is lost. When matrix is nil the + // identity matrix is assumed. + + function TGPGraphicsPath.Flatten(matrix: TGPMatrix = nil; flatness: Single = FlatnessDefault): TStatus; + var nativeMatrix: GpMatrix; + begin + nativeMatrix := nil; + if assigned(matrix) then nativeMatrix := matrix.nativeMatrix; + result := SetStatus(GdipFlattenPath(nativePath, nativeMatrix, flatness)); + end; + + function TGPGraphicsPath.Widen(pen: TGPPen; matrix: TGPMatrix = nil; flatness: Single = FlatnessDefault): TStatus; + var nativeMatrix: GpMatrix; + begin + nativeMatrix := nil; + if assigned(matrix) then nativeMatrix := matrix.nativeMatrix; + result := SetStatus(GdipWidenPath(nativePath, pen.nativePen, nativeMatrix, flatness)); + end; + + function TGPGraphicsPath.Outline(matrix: TGPMatrix = nil; flatness: Single = FlatnessDefault): TStatus; + var nativeMatrix: GpMatrix; + begin + nativeMatrix := nil; + if assigned(matrix) then nativeMatrix := matrix.nativeMatrix; + result := SetStatus(GdipWindingModeOutline(nativePath, nativeMatrix, flatness)); + end; + + // Once this is called, the resultant path is made of line segments and + // the original path information is lost. When matrix is nil, the + // identity matrix is assumed. + + function TGPGraphicsPath.Warp(destPoints: PGPPointF; count: Integer; srcRect: TGPRectF; + matrix: TGPMatrix = nil; warpMode: TWarpMode = WarpModePerspective; + flatness: Single = FlatnessDefault): TStatus; + var nativeMatrix: GpMatrix; + begin + nativeMatrix := nil; + if assigned(matrix) then nativeMatrix := matrix.nativeMatrix; + result := SetStatus(GdipWarpPath(nativePath, nativeMatrix, destPoints, + count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, + warpMode, flatness)); + end; + + function TGPGraphicsPath.GetPointCount: Integer; + var count: Integer; + begin + count := 0; + SetStatus(GdipGetPointCount(nativePath, count)); + result := count; + end; + + function TGPGraphicsPath.GetPathTypes(types: PBYTE; count: Integer): TStatus; + begin + result := SetStatus(GdipGetPathTypes(nativePath, types, count)); + end; + + function TGPGraphicsPath.GetPathPoints(points: PGPPointF; count: Integer): TStatus; + begin + result := SetStatus(GdipGetPathPoints(nativePath, points, count)); + end; + + function TGPGraphicsPath.GetPathPoints(points: PGPPoint; count: Integer): TStatus; + begin + result := SetStatus(GdipGetPathPointsI(nativePath, points, count)); + end; + + function TGPGraphicsPath.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + + function TGPGraphicsPath.IsVisible(point: TGPPointF; g: TGPGraphics = nil): BOOL; + begin + result := IsVisible(point.X, point.Y, g); + end; + + function TGPGraphicsPath.IsVisible(x, y: Single; g: TGPGraphics = nil): BOOL; + var + booln: BOOL; + nativeGraphics: GpGraphics; + begin + booln := FALSE; + nativeGraphics := nil; + if assigned(g) then nativeGraphics := g.nativeGraphics; + SetStatus(GdipIsVisiblePathPoint(nativePath, x, y, nativeGraphics, booln)); + result := booln; + end; + + function TGPGraphicsPath.IsVisible(point: TGPPoint; g : TGPGraphics = nil): BOOL; + begin + result := IsVisible(point.X, point.Y, g); + end; + + function TGPGraphicsPath.IsVisible(x, y: Integer; g: TGPGraphics = nil): BOOL; + var + booln: BOOL; + nativeGraphics: GpGraphics; + begin + booln := FALSE; + nativeGraphics := nil; + if assigned(g) then nativeGraphics := g.nativeGraphics; + SetStatus(GdipIsVisiblePathPointI(nativePath, x, y, nativeGraphics, booln)); + result := booln; + end; + + function TGPGraphicsPath.IsOutlineVisible(point: TGPPointF; pen: TGPPen; g: TGPGraphics = nil): BOOL; + begin + result := IsOutlineVisible(point.X, point.Y, pen, g); + end; + + function TGPGraphicsPath.IsOutlineVisible(x, y: Single; pen: TGPPen; g: TGPGraphics = nil): BOOL; + var + booln: BOOL; + nativeGraphics: GpGraphics; + nativePen: GpPen; + begin + booln := FALSE; + nativeGraphics := nil; + nativePen := nil; + if assigned(g) then nativeGraphics := g.nativeGraphics; + if assigned(pen) then nativePen := pen.nativePen; + SetStatus(GdipIsOutlineVisiblePathPoint(nativePath, x, y, nativePen, + nativeGraphics, booln)); + result := booln; + end; + + function TGPGraphicsPath.IsOutlineVisible(point: TGPPoint; pen: TGPPen; g: TGPGraphics = nil): BOOL; + begin + result := IsOutlineVisible(point.X, point.Y, pen, g); + end; + + function TGPGraphicsPath.IsOutlineVisible(x, y: Integer; pen: TGPPen; g: TGPGraphics = nil): BOOL; + var + booln: BOOL; + nativeGraphics: GpGraphics; + nativePen: GpPen; + begin + booln := FALSE; + nativeGraphics := nil; + nativePen := nil; + if assigned(g) then nativeGraphics := g.nativeGraphics; + if assigned(pen) then nativePen := pen.nativePen; + SetStatus(GdipIsOutlineVisiblePathPointI(nativePath, x, y, nativePen, + nativeGraphics, booln)); + result := booln; + end; + + constructor TGPGraphicsPath.Create(path: TGPGraphicsPath); + var clonepath: GpPath; + begin + clonepath := nil; + SetStatus(GdipClonePath(path.nativePath, clonepath)); + SetNativePath(clonepath); + end; + + constructor TGPGraphicsPath.Create(nativePath: GpPath); + begin + lastResult := Ok; + SetNativePath(nativePath); + end; + + procedure TGPGraphicsPath.SetNativePath(nativePath: GpPath); + begin + self.nativePath := nativePath; + end; + + function TGPGraphicsPath.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then LastResult := status; + result := status; + end; + +//-------------------------------------------------------------------------- +// GraphisPathIterator class +//-------------------------------------------------------------------------- + + constructor TGPGraphicsPathIterator.Create(path: TGPGraphicsPath); + var + nativePath: GpPath; + iter: GpPathIterator; + begin + nativePath := nil; + if assigned(path) then nativePath := path.nativePath; + iter := nil; + lastResult := GdipCreatePathIter(iter, nativePath); + SetNativeIterator(iter); + end; + + destructor TGPGraphicsPathIterator.Destroy; + begin + GdipDeletePathIter(nativeIterator); + end; + + + function TGPGraphicsPathIterator.NextSubpath(out startIndex, endIndex: Integer; out isClosed: bool): Integer; + begin + SetStatus(GdipPathIterNextSubpath(nativeIterator, result, startIndex, endIndex, isClosed)); + end; + + function TGPGraphicsPathIterator.NextSubpath(path: TGPGraphicsPath; out isClosed: BOOL): Integer; + var + nativePath: GpPath; + resultCount: Integer; + begin + nativePath := nil; + if assigned(path) then nativePath := path.nativePath; + SetStatus(GdipPathIterNextSubpathPath(nativeIterator, resultCount, + nativePath, isClosed)); + result := resultCount; + end; + + function TGPGraphicsPathIterator.NextPathType(out pathType: TPathPointType; out startIndex, endIndex: Integer): Integer; + var + resultCount: Integer; + begin + SetStatus(GdipPathIterNextPathType(nativeIterator, resultCount, @pathType, + startIndex, endIndex)); + result := resultCount; + end; + + function TGPGraphicsPathIterator.NextMarker(out startIndex, endIndex: Integer): Integer; + begin + SetStatus(GdipPathIterNextMarker(nativeIterator, result, startIndex, endIndex)); + end; + + function TGPGraphicsPathIterator.NextMarker(path: TGPGraphicsPath): Integer; + var nativePath: GpPath; + begin + nativePath := nil; + if assigned(path) then nativePath := path.nativePath; + SetStatus(GdipPathIterNextMarkerPath(nativeIterator, result, nativePath)); + end; + + function TGPGraphicsPathIterator.GetCount: Integer; + begin + SetStatus(GdipPathIterGetCount(nativeIterator, result)); + end; + + function TGPGraphicsPathIterator.GetSubpathCount: Integer; + begin + SetStatus(GdipPathIterGetSubpathCount(nativeIterator, result)); + end; + + function TGPGraphicsPathIterator.HasCurve: BOOL; + begin + SetStatus(GdipPathIterHasCurve(nativeIterator, result)); + end; + + procedure TGPGraphicsPathIterator.Rewind; + begin + SetStatus(GdipPathIterRewind(nativeIterator)); + end; + + function TGPGraphicsPathIterator.Enumerate(points: PGPPointF; types: PBYTE; + count: Integer): Integer; + begin + SetStatus(GdipPathIterEnumerate(nativeIterator, result, points, types, count)); + end; + + function TGPGraphicsPathIterator.CopyData(points: PGPPointF; types: PBYTE; + startIndex, endIndex: Integer): Integer; + begin + SetStatus(GdipPathIterCopyData(nativeIterator, result, points, types, + startIndex, endIndex)); + end; + + function TGPGraphicsPathIterator.GetLastStatus: TStatus; + begin + result := lastResult; + lastResult := Ok; + end; + + procedure TGPGraphicsPathIterator.SetNativeIterator(nativeIterator: GpPathIterator); + begin + self.nativeIterator := nativeIterator; + end; + + function TGPGraphicsPathIterator.SetStatus(status: TStatus): TStatus; + begin + if (status <> Ok) then lastResult := status; + result := status; + end; + +//-------------------------------------------------------------------------- +// Path Gradient Brush +//-------------------------------------------------------------------------- + + constructor TGPPathGradientBrush.Create(points: PGPPointF; count: Integer; wrapMode: TWrapMode = WrapModeClamp); + var brush: GpPathGradient; + begin + brush := nil; + lastResult := GdipCreatePathGradient(points, count, wrapMode, brush); + SetNativeBrush(brush); + end; + + constructor TGPPathGradientBrush.Create(points: PGPPoint; count: Integer; wrapMode: TWrapMode = WrapModeClamp); + var brush: GpPathGradient; + begin + brush := nil; + lastResult := GdipCreatePathGradientI(points, count, wrapMode, brush); + SetNativeBrush(brush); + end; + + constructor TGPPathGradientBrush.Create(path: TGPGraphicsPath); + var brush: GpPathGradient; + begin + brush := nil; + lastResult := GdipCreatePathGradientFromPath(path.nativePath, brush); + SetNativeBrush(brush); + end; + + function TGPPathGradientBrush.GetCenterColor(out Color: TGPColor): TStatus; + begin + SetStatus(GdipGetPathGradientCenterColor(GpPathGradient(nativeBrush), Color)); + result := lastResult; + end; + + function TGPPathGradientBrush.SetCenterColor(color: TGPColor): TStatus; + begin + SetStatus(GdipSetPathGradientCenterColor(GpPathGradient(nativeBrush),color)); + result := lastResult; + end; + + function TGPPathGradientBrush.GetPointCount: Integer; + begin + SetStatus(GdipGetPathGradientPointCount(GpPathGradient(nativeBrush), result)); + end; + + function TGPPathGradientBrush.GetSurroundColorCount: Integer; + begin + SetStatus(GdipGetPathGradientSurroundColorCount(GpPathGradient(nativeBrush), result)); + end; + + function TGPPathGradientBrush.GetSurroundColors(colors: PARGB; var count: Integer): TStatus; + var + count1: Integer; + begin + if not assigned(colors) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + + SetStatus(GdipGetPathGradientSurroundColorCount(GpPathGradient(nativeBrush), count1)); + + if(lastResult <> Ok) then + begin + result := lastResult; + exit; + end; + + if((count < count1) or (count1 <= 0)) then + begin + result := SetStatus(InsufficientBuffer); + exit; + end; + + SetStatus(GdipGetPathGradientSurroundColorsWithCount(GpPathGradient(nativeBrush), colors, count1)); + if(lastResult = Ok) then + count := count1; + + result := lastResult; + end; + + function TGPPathGradientBrush.SetSurroundColors(colors: PARGB; var count: Integer): TStatus; + var + count1: Integer; + type + TDynArrDWORD = array of DWORD; + begin + if (colors = nil) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + + count1 := GetPointCount; + + if((count > count1) or (count1 <= 0)) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + + count1 := count; + + SetStatus(GdipSetPathGradientSurroundColorsWithCount( + GpPathGradient(nativeBrush), colors, count1)); + + if(lastResult = Ok) then count := count1; + result := lastResult; + end; + + function TGPPathGradientBrush.GetGraphicsPath(path: TGPGraphicsPath): TStatus; + begin + if(path = nil) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + result := SetStatus(GdipGetPathGradientPath(GpPathGradient(nativeBrush), path.nativePath)); + end; + + function TGPPathGradientBrush.SetGraphicsPath(path: TGPGraphicsPath): TStatus; + begin + if(path = nil) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + result := SetStatus(GdipSetPathGradientPath(GpPathGradient(nativeBrush), path.nativePath)); + end; + + function TGPPathGradientBrush.GetCenterPoint(out point: TGPPointF): TStatus; + begin + result := SetStatus(GdipGetPathGradientCenterPoint(GpPathGradient(nativeBrush), @point)); + end; + + function TGPPathGradientBrush.GetCenterPoint(out point: TGPPoint): TStatus; + begin + result := SetStatus(GdipGetPathGradientCenterPointI(GpPathGradient(nativeBrush), @point)); + end; + + function TGPPathGradientBrush.SetCenterPoint(point: TGPPointF): TStatus; + begin + result := SetStatus(GdipSetPathGradientCenterPoint(GpPathGradient(nativeBrush), @point)); + end; + + function TGPPathGradientBrush.SetCenterPoint(point: TGPPoint): TStatus; + begin + result := SetStatus(GdipSetPathGradientCenterPointI(GpPathGradient(nativeBrush), @point)); + end; + + function TGPPathGradientBrush.GetRectangle(out rect: TGPRectF): TStatus; + begin + result := SetStatus(GdipGetPathGradientRect(GpPathGradient(nativeBrush), @rect)); + end; + + function TGPPathGradientBrush.GetRectangle(out rect: TGPRect): TStatus; + begin + result := SetStatus(GdipGetPathGradientRectI(GpPathGradient(nativeBrush), @rect)); + end; + + function TGPPathGradientBrush.SetGammaCorrection(useGammaCorrection: BOOL): TStatus; + begin + result := SetStatus(GdipSetPathGradientGammaCorrection(GpPathGradient(nativeBrush), + useGammaCorrection)); + end; + + function TGPPathGradientBrush.GetGammaCorrection: BOOL; + begin + SetStatus(GdipGetPathGradientGammaCorrection(GpPathGradient(nativeBrush), result)); + end; + + function TGPPathGradientBrush.GetBlendCount: Integer; + var count: Integer; + begin + count := 0; + SetStatus(GdipGetPathGradientBlendCount(GpPathGradient(nativeBrush), count)); + result := count; + end; + + function TGPPathGradientBrush.GetBlend(blendFactors, blendPositions:PSingle; count: Integer): TStatus; + begin + result := SetStatus(GdipGetPathGradientBlend( + GpPathGradient(nativeBrush), + blendFactors, blendPositions, count)); + end; + + function TGPPathGradientBrush.SetBlend(blendFactors, blendPositions: PSingle; count: Integer): TStatus; + begin + result := SetStatus(GdipSetPathGradientBlend( + GpPathGradient(nativeBrush), + blendFactors, blendPositions, count)); + end; + + function TGPPathGradientBrush.GetInterpolationColorCount: Integer; + var count: Integer; + begin + count := 0; + SetStatus(GdipGetPathGradientPresetBlendCount(GpPathGradient(nativeBrush), count)); + result := count; + end; + + function TGPPathGradientBrush.SetInterpolationColors(presetColors: PARGB; + blendPositions: PSingle; count: Integer): TStatus; + var + status: TStatus; + begin + if ((count <= 0) or (presetColors = nil)) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + + status := SetStatus(GdipSetPathGradientPresetBlend(GpPathGradient(nativeBrush), + presetColors, blendPositions, count)); + result := status; + end; + + function TGPPathGradientBrush.GetInterpolationColors(presetColors: PARGB; + blendPositions: PSingle; count: Integer): TStatus; + var + status: GpStatus; + i: Integer; + argbs: PARGB; + begin + if ((count <= 0) or (presetColors = nil)) then + begin + result := SetStatus(InvalidParameter); + exit; + end; + getmem(argbs, count*SizeOf(ARGB)); + if (argbs = nil) then + begin + result := SetStatus(OutOfMemory); + exit; + end; + + status := SetStatus(GdipGetPathGradientPresetBlend(nativeBrush, argbs, + blendPositions, count)); + + for i := 0 to count - 1 do + TColorDynArray(presetColors)[i] := TColorDynArray(argbs)[i]; + + freemem(argbs); + + result := status; + end; + + function TGPPathGradientBrush.SetBlendBellShape(focus: Single; scale: Single = 1.0): TStatus; + begin + result := SetStatus(GdipSetPathGradientSigmaBlend(GpPathGradient(nativeBrush), focus, scale)); + end; + + function TGPPathGradientBrush.SetBlendTriangularShape(focus: Single; scale: Single = 1.0): TStatus; + begin + result := SetStatus(GdipSetPathGradientLinearBlend(GpPathGradient(nativeBrush), focus, scale)); + end; + + function TGPPathGradientBrush.GetTransform(matrix: TGPMatrix): TStatus; + begin + result := SetStatus(GdipGetPathGradientTransform(GpPathGradient(nativeBrush), + matrix.nativeMatrix)); + end; + + function TGPPathGradientBrush.SetTransform(matrix: TGPMatrix): TStatus; + begin + result := SetStatus(GdipSetPathGradientTransform( + GpPathGradient(nativeBrush), + matrix.nativeMatrix)); + end; + + function TGPPathGradientBrush.ResetTransform: TStatus; + begin + result := SetStatus(GdipResetPathGradientTransform( + GpPathGradient(nativeBrush))); + end; + + function TGPPathGradientBrush.MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipMultiplyPathGradientTransform( + GpPathGradient(nativeBrush), + matrix.nativeMatrix, + order)); + end; + + function TGPPathGradientBrush.TranslateTransform(dx, dy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipTranslatePathGradientTransform( + GpPathGradient(nativeBrush), + dx, dy, order)); + end; + + function TGPPathGradientBrush.ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipScalePathGradientTransform( + GpPathGradient(nativeBrush), + sx, sy, order)); + end; + + function TGPPathGradientBrush.RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; + begin + result := SetStatus(GdipRotatePathGradientTransform( + GpPathGradient(nativeBrush), + angle, order)); + end; + + function TGPPathGradientBrush.GetFocusScales(out xScale, yScale: Single): TStatus; + begin + result := SetStatus(GdipGetPathGradientFocusScales( + GpPathGradient(nativeBrush), xScale, yScale)); + end; + + function TGPPathGradientBrush.SetFocusScales(xScale, yScale: Single): TStatus; + begin + result := SetStatus(GdipSetPathGradientFocusScales( + GpPathGradient(nativeBrush), xScale, yScale)); + end; + + function TGPPathGradientBrush.GetWrapMode: TWrapMode; + begin + SetStatus(GdipGetPathGradientWrapMode(GpPathGradient(nativeBrush), result)); + end; + + function TGPPathGradientBrush.SetWrapMode(wrapMode: TWrapMode): TStatus; + begin + result := SetStatus(GdipSetPathGradientWrapMode( + GpPathGradient(nativeBrush), wrapMode)); + end; + + constructor TGPPathGradientBrush.Create; + begin + // écrase la fonction parent + end; + +initialization +begin + // Initialize StartupInput structure + StartupInput.DebugEventCallback := nil; + StartupInput.SuppressBackgroundThread := False; + StartupInput.SuppressExternalCodecs := False; + StartupInput.GdiplusVersion := 1; + // Initialize GDI+ + GdiplusStartup(gdiplusToken, @StartupInput, nil); + +end; + +finalization +begin + + if assigned(GenericSansSerifFontFamily) then GenericSansSerifFontFamily.Free; + if assigned(GenericSerifFontFamily) then GenericSerifFontFamily.Free; + if assigned(GenericMonospaceFontFamily) then GenericMonospaceFontFamily.Free; + + if assigned(GenericTypographicStringFormatBuffer) then GenericTypographicStringFormatBuffer.free; + if assigned(GenericDefaultStringFormatBuffer) then GenericDefaultStringFormatBuffer.Free; + + // Close GDI + + GdiplusShutdown(gdiplusToken); +end; + +end. diff --git a/Pramougolnik/GDIPUTIL.pas b/Pramougolnik/GDIPUTIL.pas new file mode 100644 index 0000000..22cbe89 --- /dev/null +++ b/Pramougolnik/GDIPUTIL.pas @@ -0,0 +1,378 @@ + {******************************************************************} + { GDI+ Util } + { } + { home page : http://www.progdigy.com } + { email : hgourvest@progdigy.com } + { } + { date : 15-02-2002 } + { } + { The contents of this file are used with permission, subject to } + { the Mozilla Public License Version 1.1 (the "License"); you may } + { not use this file except in compliance with the License. You may } + { obtain a copy of the License at } + { http://www.mozilla.org/MPL/MPL-1.1.html } + { } + { Software distributed under the License is distributed on an } + { "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } + { implied. See the License for the specific language governing } + { rights and limitations under the License. } + { } + { *****************************************************************} + +unit GDIPUTIL; + +interface +uses + Windows, + GDIPAPI, + GDIPOBJ; + +function ValueTypeFromULONG(Type_: ULONG): String; +function GetMetaDataIDString(id: ULONG): string; +function GetEncoderClsid(format: String; out pClsid: TGUID): integer; +function GetStatus(Stat: TStatus): string; +function PixelFormatString(PixelFormat: TPixelFormat): string; + +{from WinNT.h} +// creates a language identifier from a primary language identifier and a +// sublanguage identifier for the TStringFormat & TFontFamily class. +function MakeLangID(PrimaryLanguage, SubLanguage: LANGID): WORD; + +implementation + +function ValueTypeFromULONG(Type_: ULONG): String; +begin + case Type_ of + 0 : result := 'Nothing'; + 1 : result := 'PropertyTagTypeByte'; + 2 : result := 'PropertyTagTypeASCII'; + 3 : result := 'PropertyTagTypeShort'; + 4 : result := 'PropertyTagTypeLong'; + 5 : result := 'PropertyTagTypeRational'; + 6 : result := 'Nothing'; + 7 : result := 'PropertyTagTypeUndefined'; + 8 : result := 'Nothing'; + 9 : result := 'PropertyTagTypeSLONG'; + 10: result := 'PropertyTagTypeSRational'; + else + result := ''; + end; +end; + +function GetMetaDataIDString(id: ULONG): string; +begin + case id of + PropertyTagExifIFD : result := 'PropertyTagExifIFD'; + PropertyTagGpsIFD : result := 'PropertyTagGpsIFD'; + PropertyTagNewSubfileType : result := 'PropertyTagNewSubfileType'; + PropertyTagSubfileType : result := 'PropertyTagSubfileType'; + PropertyTagImageWidth : result := 'PropertyTagImageWidth'; + PropertyTagImageHeight : result := 'PropertyTagImageHeight'; + PropertyTagBitsPerSample : result := 'PropertyTagBitsPerSample'; + PropertyTagCompression : result := 'PropertyTagCompression'; + PropertyTagPhotometricInterp : result := 'PropertyTagPhotometricInterp'; + PropertyTagThreshHolding : result := 'PropertyTagThreshHolding'; + PropertyTagCellWidth : result := 'PropertyTagCellWidth'; + PropertyTagCellHeight : result := 'PropertyTagCellHeight'; + PropertyTagFillOrder : result := 'PropertyTagFillOrder'; + PropertyTagDocumentName : result := 'PropertyTagDocumentName'; + PropertyTagImageDescription : result := 'PropertyTagImageDescription'; + PropertyTagEquipMake : result := 'PropertyTagEquipMake'; + PropertyTagEquipModel : result := 'PropertyTagEquipModel'; + PropertyTagStripOffsets : result := 'PropertyTagStripOffsets'; + PropertyTagOrientation : result := 'PropertyTagOrientation'; + PropertyTagSamplesPerPixel : result := 'PropertyTagSamplesPerPixel'; + PropertyTagRowsPerStrip : result := 'PropertyTagRowsPerStrip'; + PropertyTagStripBytesCount : result := 'PropertyTagStripBytesCount'; + PropertyTagMinSampleValue : result := 'PropertyTagMinSampleValue'; + PropertyTagMaxSampleValue : result := 'PropertyTagMaxSampleValue'; + PropertyTagXResolution : result := 'PropertyTagXResolution'; + PropertyTagYResolution : result := 'PropertyTagYResolution'; + PropertyTagPlanarConfig : result := 'PropertyTagPlanarConfig'; + PropertyTagPageName : result := 'PropertyTagPageName'; + PropertyTagXPosition : result := 'PropertyTagXPosition'; + PropertyTagYPosition : result := 'PropertyTagYPosition'; + PropertyTagFreeOffset : result := 'PropertyTagFreeOffset'; + PropertyTagFreeByteCounts : result := 'PropertyTagFreeByteCounts'; + PropertyTagGrayResponseUnit : result := 'PropertyTagGrayResponseUnit'; + PropertyTagGrayResponseCurve : result := 'PropertyTagGrayResponseCurve'; + PropertyTagT4Option : result := 'PropertyTagT4Option'; + PropertyTagT6Option : result := 'PropertyTagT6Option'; + PropertyTagResolutionUnit : result := 'PropertyTagResolutionUnit'; + PropertyTagPageNumber : result := 'PropertyTagPageNumber'; + PropertyTagTransferFuncition : result := 'PropertyTagTransferFuncition'; + PropertyTagSoftwareUsed : result := 'PropertyTagSoftwareUsed'; + PropertyTagDateTime : result := 'PropertyTagDateTime'; + PropertyTagArtist : result := 'PropertyTagArtist'; + PropertyTagHostComputer : result := 'PropertyTagHostComputer'; + PropertyTagPredictor : result := 'PropertyTagPredictor'; + PropertyTagWhitePoint : result := 'PropertyTagWhitePoint'; + PropertyTagPrimaryChromaticities : result := 'PropertyTagPrimaryChromaticities'; + PropertyTagColorMap : result := 'PropertyTagColorMap'; + PropertyTagHalftoneHints : result := 'PropertyTagHalftoneHints'; + PropertyTagTileWidth : result := 'PropertyTagTileWidth'; + PropertyTagTileLength : result := 'PropertyTagTileLength'; + PropertyTagTileOffset : result := 'PropertyTagTileOffset'; + PropertyTagTileByteCounts : result := 'PropertyTagTileByteCounts'; + PropertyTagInkSet : result := 'PropertyTagInkSet'; + PropertyTagInkNames : result := 'PropertyTagInkNames'; + PropertyTagNumberOfInks : result := 'PropertyTagNumberOfInks'; + PropertyTagDotRange : result := 'PropertyTagDotRange'; + PropertyTagTargetPrinter : result := 'PropertyTagTargetPrinter'; + PropertyTagExtraSamples : result := 'PropertyTagExtraSamples'; + PropertyTagSampleFormat : result := 'PropertyTagSampleFormat'; + PropertyTagSMinSampleValue : result := 'PropertyTagSMinSampleValue'; + PropertyTagSMaxSampleValue : result := 'PropertyTagSMaxSampleValue'; + PropertyTagTransferRange : result := 'PropertyTagTransferRange'; + PropertyTagJPEGProc : result := 'PropertyTagJPEGProc'; + PropertyTagJPEGInterFormat : result := 'PropertyTagJPEGInterFormat'; + PropertyTagJPEGInterLength : result := 'PropertyTagJPEGInterLength'; + PropertyTagJPEGRestartInterval : result := 'PropertyTagJPEGRestartInterval'; + PropertyTagJPEGLosslessPredictors : result := 'PropertyTagJPEGLosslessPredictors'; + PropertyTagJPEGPointTransforms : result := 'PropertyTagJPEGPointTransforms'; + PropertyTagJPEGQTables : result := 'PropertyTagJPEGQTables'; + PropertyTagJPEGDCTables : result := 'PropertyTagJPEGDCTables'; + PropertyTagJPEGACTables : result := 'PropertyTagJPEGACTables'; + PropertyTagYCbCrCoefficients : result := 'PropertyTagYCbCrCoefficients'; + PropertyTagYCbCrSubsampling : result := 'PropertyTagYCbCrSubsampling'; + PropertyTagYCbCrPositioning : result := 'PropertyTagYCbCrPositioning'; + PropertyTagREFBlackWhite : result := 'PropertyTagREFBlackWhite'; + PropertyTagICCProfile : result := 'PropertyTagICCProfile'; + PropertyTagGamma : result := 'PropertyTagGamma'; + PropertyTagICCProfileDescriptor : result := 'PropertyTagICCProfileDescriptor'; + PropertyTagSRGBRenderingIntent : result := 'PropertyTagSRGBRenderingIntent'; + PropertyTagImageTitle : result := 'PropertyTagImageTitle'; + PropertyTagCopyright : result := 'PropertyTagCopyright'; + PropertyTagResolutionXUnit : result := 'PropertyTagResolutionXUnit'; + PropertyTagResolutionYUnit : result := 'PropertyTagResolutionYUnit'; + PropertyTagResolutionXLengthUnit : result := 'PropertyTagResolutionXLengthUnit'; + PropertyTagResolutionYLengthUnit : result := 'PropertyTagResolutionYLengthUnit'; + PropertyTagPrintFlags : result := 'PropertyTagPrintFlags'; + PropertyTagPrintFlagsVersion : result := 'PropertyTagPrintFlagsVersion'; + PropertyTagPrintFlagsCrop : result := 'PropertyTagPrintFlagsCrop'; + PropertyTagPrintFlagsBleedWidth : result := 'PropertyTagPrintFlagsBleedWidth'; + PropertyTagPrintFlagsBleedWidthScale : result := 'PropertyTagPrintFlagsBleedWidthScale'; + PropertyTagHalftoneLPI : result := 'PropertyTagHalftoneLPI'; + PropertyTagHalftoneLPIUnit : result := 'PropertyTagHalftoneLPIUnit'; + PropertyTagHalftoneDegree : result := 'PropertyTagHalftoneDegree'; + PropertyTagHalftoneShape : result := 'PropertyTagHalftoneShape'; + PropertyTagHalftoneMisc : result := 'PropertyTagHalftoneMisc'; + PropertyTagHalftoneScreen : result := 'PropertyTagHalftoneScreen'; + PropertyTagJPEGQuality : result := 'PropertyTagJPEGQuality'; + PropertyTagGridSize : result := 'PropertyTagGridSize'; + PropertyTagThumbnailFormat : result := 'PropertyTagThumbnailFormat'; + PropertyTagThumbnailWidth : result := 'PropertyTagThumbnailWidth'; + PropertyTagThumbnailHeight : result := 'PropertyTagThumbnailHeight'; + PropertyTagThumbnailColorDepth : result := 'PropertyTagThumbnailColorDepth'; + PropertyTagThumbnailPlanes : result := 'PropertyTagThumbnailPlanes'; + PropertyTagThumbnailRawBytes : result := 'PropertyTagThumbnailRawBytes'; + PropertyTagThumbnailSize : result := 'PropertyTagThumbnailSize'; + PropertyTagThumbnailCompressedSize : result := 'PropertyTagThumbnailCompressedSize'; + PropertyTagColorTransferFunction : result := 'PropertyTagColorTransferFunction'; + PropertyTagThumbnailData : result := 'PropertyTagThumbnailData'; + PropertyTagThumbnailImageWidth : result := 'PropertyTagThumbnailImageWidth'; + PropertyTagThumbnailImageHeight : result := 'PropertyTagThumbnailImageHeight'; + PropertyTagThumbnailBitsPerSample : result := 'PropertyTagThumbnailBitsPerSample'; + PropertyTagThumbnailCompression : result := 'PropertyTagThumbnailCompression'; + PropertyTagThumbnailPhotometricInterp : result := 'PropertyTagThumbnailPhotometricInterp'; + PropertyTagThumbnailImageDescription : result := 'PropertyTagThumbnailImageDescription'; + PropertyTagThumbnailEquipMake : result := 'PropertyTagThumbnailEquipMake'; + PropertyTagThumbnailEquipModel : result := 'PropertyTagThumbnailEquipModel'; + PropertyTagThumbnailStripOffsets : result := 'PropertyTagThumbnailStripOffsets'; + PropertyTagThumbnailOrientation : result := 'PropertyTagThumbnailOrientation'; + PropertyTagThumbnailSamplesPerPixel : result := 'PropertyTagThumbnailSamplesPerPixel'; + PropertyTagThumbnailRowsPerStrip : result := 'PropertyTagThumbnailRowsPerStrip'; + PropertyTagThumbnailStripBytesCount : result := 'PropertyTagThumbnailStripBytesCount'; + PropertyTagThumbnailResolutionX : result := 'PropertyTagThumbnailResolutionX'; + PropertyTagThumbnailResolutionY : result := 'PropertyTagThumbnailResolutionY'; + PropertyTagThumbnailPlanarConfig : result := 'PropertyTagThumbnailPlanarConfig'; + PropertyTagThumbnailResolutionUnit : result := 'PropertyTagThumbnailResolutionUnit'; + PropertyTagThumbnailTransferFunction : result := 'PropertyTagThumbnailTransferFunction'; + PropertyTagThumbnailSoftwareUsed : result := 'PropertyTagThumbnailSoftwareUsed'; + PropertyTagThumbnailDateTime : result := 'PropertyTagThumbnailDateTime'; + PropertyTagThumbnailArtist : result := 'PropertyTagThumbnailArtist'; + PropertyTagThumbnailWhitePoint : result := 'PropertyTagThumbnailWhitePoint'; + PropertyTagThumbnailPrimaryChromaticities : result := 'PropertyTagThumbnailPrimaryChromaticities'; + PropertyTagThumbnailYCbCrCoefficients : result := 'PropertyTagThumbnailYCbCrCoefficients'; + PropertyTagThumbnailYCbCrSubsampling : result := 'PropertyTagThumbnailYCbCrSubsampling'; + PropertyTagThumbnailYCbCrPositioning : result := 'PropertyTagThumbnailYCbCrPositioning'; + PropertyTagThumbnailRefBlackWhite : result := 'PropertyTagThumbnailRefBlackWhite'; + PropertyTagThumbnailCopyRight : result := 'PropertyTagThumbnailCopyRight'; + PropertyTagLuminanceTable : result := 'PropertyTagLuminanceTable'; + PropertyTagChrominanceTable : result := 'PropertyTagChrominanceTable'; + PropertyTagFrameDelay : result := 'PropertyTagFrameDelay'; + PropertyTagLoopCount : result := 'PropertyTagLoopCount'; + PropertyTagPixelUnit : result := 'PropertyTagPixelUnit'; + PropertyTagPixelPerUnitX : result := 'PropertyTagPixelPerUnitX'; + PropertyTagPixelPerUnitY : result := 'PropertyTagPixelPerUnitY'; + PropertyTagPaletteHistogram : result := 'PropertyTagPaletteHistogram'; + PropertyTagExifExposureTime : result := 'PropertyTagExifExposureTime'; + PropertyTagExifFNumber : result := 'PropertyTagExifFNumber'; + PropertyTagExifExposureProg : result := 'PropertyTagExifExposureProg'; + PropertyTagExifSpectralSense : result := 'PropertyTagExifSpectralSense'; + PropertyTagExifISOSpeed : result := 'PropertyTagExifISOSpeed'; + PropertyTagExifOECF : result := 'PropertyTagExifOECF'; + PropertyTagExifVer : result := 'PropertyTagExifVer'; + PropertyTagExifDTOrig : result := 'PropertyTagExifDTOrig'; + PropertyTagExifDTDigitized : result := 'PropertyTagExifDTDigitized'; + PropertyTagExifCompConfig : result := 'PropertyTagExifCompConfig'; + PropertyTagExifCompBPP : result := 'PropertyTagExifCompBPP'; + PropertyTagExifShutterSpeed : result := 'PropertyTagExifShutterSpeed'; + PropertyTagExifAperture : result := 'PropertyTagExifAperture'; + PropertyTagExifBrightness : result := 'PropertyTagExifBrightness'; + PropertyTagExifExposureBias : result := 'PropertyTagExifExposureBias'; + PropertyTagExifMaxAperture : result := 'PropertyTagExifMaxAperture'; + PropertyTagExifSubjectDist : result := 'PropertyTagExifSubjectDist'; + PropertyTagExifMeteringMode : result := 'PropertyTagExifMeteringMode'; + PropertyTagExifLightSource : result := 'PropertyTagExifLightSource'; + PropertyTagExifFlash : result := 'PropertyTagExifFlash'; + PropertyTagExifFocalLength : result := 'PropertyTagExifFocalLength'; + PropertyTagExifMakerNote : result := 'PropertyTagExifMakerNote'; + PropertyTagExifUserComment : result := 'PropertyTagExifUserComment'; + PropertyTagExifDTSubsec : result := 'PropertyTagExifDTSubsec'; + PropertyTagExifDTOrigSS : result := 'PropertyTagExifDTOrigSS'; + PropertyTagExifDTDigSS : result := 'PropertyTagExifDTDigSS'; + PropertyTagExifFPXVer : result := 'PropertyTagExifFPXVer'; + PropertyTagExifColorSpace : result := 'PropertyTagExifColorSpace'; + PropertyTagExifPixXDim : result := 'PropertyTagExifPixXDim'; + PropertyTagExifPixYDim : result := 'PropertyTagExifPixYDim'; + PropertyTagExifRelatedWav : result := 'PropertyTagExifRelatedWav'; + PropertyTagExifInterop : result := 'PropertyTagExifInterop'; + PropertyTagExifFlashEnergy : result := 'PropertyTagExifFlashEnergy'; + PropertyTagExifSpatialFR : result := 'PropertyTagExifSpatialFR'; + PropertyTagExifFocalXRes : result := 'PropertyTagExifFocalXRes'; + PropertyTagExifFocalYRes : result := 'PropertyTagExifFocalYRes'; + PropertyTagExifFocalResUnit : result := 'PropertyTagExifFocalResUnit'; + PropertyTagExifSubjectLoc : result := 'PropertyTagExifSubjectLoc'; + PropertyTagExifExposureIndex : result := 'PropertyTagExifExposureIndex'; + PropertyTagExifSensingMethod : result := 'PropertyTagExifSensingMethod'; + PropertyTagExifFileSource : result := 'PropertyTagExifFileSource'; + PropertyTagExifSceneType : result := 'PropertyTagExifSceneType'; + PropertyTagExifCfaPattern : result := 'PropertyTagExifCfaPattern'; + PropertyTagGpsVer : result := 'PropertyTagGpsVer'; + PropertyTagGpsLatitudeRef : result := 'PropertyTagGpsLatitudeRef'; + PropertyTagGpsLatitude : result := 'PropertyTagGpsLatitude'; + PropertyTagGpsLongitudeRef : result := 'PropertyTagGpsLongitudeRef'; + PropertyTagGpsLongitude : result := 'PropertyTagGpsLongitude'; + PropertyTagGpsAltitudeRef : result := 'PropertyTagGpsAltitudeRef'; + PropertyTagGpsAltitude : result := 'PropertyTagGpsAltitude'; + PropertyTagGpsGpsTime : result := 'PropertyTagGpsGpsTime'; + PropertyTagGpsGpsSatellites : result := 'PropertyTagGpsGpsSatellites'; + PropertyTagGpsGpsStatus : result := 'PropertyTagGpsGpsStatus'; + PropertyTagGpsGpsMeasureMode : result := 'PropertyTagGpsGpsMeasureMode'; + PropertyTagGpsGpsDop : result := 'PropertyTagGpsGpsDop'; + PropertyTagGpsSpeedRef : result := 'PropertyTagGpsSpeedRef'; + PropertyTagGpsSpeed : result := 'PropertyTagGpsSpeed'; + PropertyTagGpsTrackRef : result := 'PropertyTagGpsTrackRef'; + PropertyTagGpsTrack : result := 'PropertyTagGpsTrack'; + PropertyTagGpsImgDirRef : result := 'PropertyTagGpsImgDirRef'; + PropertyTagGpsImgDir : result := 'PropertyTagGpsImgDir'; + PropertyTagGpsMapDatum : result := 'PropertyTagGpsMapDatum'; + PropertyTagGpsDestLatRef : result := 'PropertyTagGpsDestLatRef'; + PropertyTagGpsDestLat : result := 'PropertyTagGpsDestLat'; + PropertyTagGpsDestLongRef : result := 'PropertyTagGpsDestLongRef'; + PropertyTagGpsDestLong : result := 'PropertyTagGpsDestLong'; + PropertyTagGpsDestBearRef : result := 'PropertyTagGpsDestBearRef'; + PropertyTagGpsDestBear : result := 'PropertyTagGpsDestBear'; + PropertyTagGpsDestDistRef : result := 'PropertyTagGpsDestDistRef'; + PropertyTagGpsDestDist : result := 'PropertyTagGpsDestDist'; + else + result := ''; + end; +end; + +function GetEncoderClsid(format: String; out pClsid: TGUID): integer; +var + num, size, j: UINT; + ImageCodecInfo: PImageCodecInfo; +Type + ArrIMgInf = array of TImageCodecInfo; +begin + num := 0; // number of image encoders + size := 0; // size of the image encoder array in bytes + result := -1; + + GetImageEncodersSize(num, size); + if (size = 0) then exit; + + GetMem(ImageCodecInfo, size); + if(ImageCodecInfo = nil) then exit; + + GetImageEncoders(num, size, ImageCodecInfo); + + for j := 0 to num - 1 do + begin + if( ArrIMgInf(ImageCodecInfo)[j].MimeType = format) then + begin + pClsid := ArrIMgInf(ImageCodecInfo)[j].Clsid; + result := j; // Success + end; + end; + FreeMem(ImageCodecInfo, size); +end; + +function GetStatus(Stat: TStatus): string; +begin + case Stat of + Ok : result := 'Ok'; + GenericError : result := 'GenericError'; + InvalidParameter : result := 'InvalidParameter'; + OutOfMemory : result := 'OutOfMemory'; + ObjectBusy : result := 'ObjectBusy'; + InsufficientBuffer : result := 'InsufficientBuffer'; + NotImplemented : result := 'NotImplemented'; + Win32Error : result := 'Win32Error'; + WrongState : result := 'WrongState'; + Aborted : result := 'Aborted'; + FileNotFound : result := 'FileNotFound'; + ValueOverflow : result := 'ValueOverflow'; + AccessDenied : result := 'AccessDenied'; + UnknownImageFormat : result := 'UnknownImageFormat'; + FontFamilyNotFound : result := 'FontFamilyNotFound'; + FontStyleNotFound : result := 'FontStyleNotFound'; + NotTrueTypeFont : result := 'NotTrueTypeFont'; + UnsupportedGdiplusVersion : result := 'UnsupportedGdiplusVersion'; + GdiplusNotInitialized : result := 'GdiplusNotInitialized'; + PropertyNotFound : result := 'PropertyNotFound'; + PropertyNotSupported : result := 'PropertyNotSupported'; + else + result := ''; + end; +end; + +function PixelFormatString(PixelFormat: TPixelFormat): string; +begin + case PixelFormat of + PixelFormatIndexed : result := 'PixelFormatIndexed'; + PixelFormatGDI : result := 'PixelFormatGDI'; + PixelFormatAlpha : result := 'PixelFormatAlpha'; + PixelFormatPAlpha : result := 'PixelFormatPAlpha'; + PixelFormatExtended : result := 'PixelFormatExtended'; + PixelFormatCanonical : result := 'PixelFormatCanonical'; + PixelFormatUndefined : result := 'PixelFormatUndefined'; + PixelFormat1bppIndexed : result := 'PixelFormat1bppIndexed'; + PixelFormat4bppIndexed : result := 'PixelFormat4bppIndexed'; + PixelFormat8bppIndexed : result := 'PixelFormat8bppIndexed'; + PixelFormat16bppGrayScale : result := 'PixelFormat16bppGrayScale'; + PixelFormat16bppRGB555 : result := 'PixelFormat16bppRGB555'; + PixelFormat16bppRGB565 : result := 'PixelFormat16bppRGB565'; + PixelFormat16bppARGB1555 : result := 'PixelFormat16bppARGB1555'; + PixelFormat24bppRGB : result := 'PixelFormat24bppRGB'; + PixelFormat32bppRGB : result := 'PixelFormat32bppRGB'; + PixelFormat32bppARGB : result := 'PixelFormat32bppARGB'; + PixelFormat32bppPARGB : result := 'PixelFormat32bppPARGB'; + PixelFormat48bppRGB : result := 'PixelFormat48bppRGB'; + PixelFormat64bppARGB : result := 'PixelFormat64bppARGB'; + PixelFormat64bppPARGB : result := 'PixelFormat64bppPARGB'; + PixelFormatMax : result := 'PixelFormatMax'; + else + result := ''; + end; +end; + +function MakeLangID(PrimaryLanguage, SubLanguage: LANGID): Word; +begin + result := (SubLanguage shl 10) or PrimaryLanguage; +end; + +end. diff --git a/Pramougolnik/Jedix.inc b/Pramougolnik/Jedix.inc new file mode 100644 index 0000000..26af2e0 --- /dev/null +++ b/Pramougolnik/Jedix.inc @@ -0,0 +1,628 @@ +{******************************************************************************} +{ } +{ The contents of this file are subject to the Mozilla Public License Version } +{ 1.1 (the "License"); you may not use this file except in compliance with the } +{ License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ } +{ } +{ Software distributed under the License is distributed on an "AS IS" basis, } +{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for } +{ the specific language governing rights and limitations under the License. } +{ } +{ The Original Code is JEDI.INC. } +{ } +{ The Initial Developer of the Original Code is Project JEDI } +{ http://www.delphi-jedi.org } +{ } +{******************************************************************************} +{ } +{ This file defines various generic compiler directives used in the JEDI Code } +{ Library (JCL) and JEDI Visual Component Library Library (J-VCL). The } +{ directives in this file are of generic nature and consist mostly of mappings } +{ from the VERXXX directives defined by Delphi and C++ Builder to friendly } +{ names such as DELPHI5 and SUPPORTS_WIDESTRING. These friendly names are } +{ subsequently used in both libraries to test for compiler versions and/or } +{ whether the compiler supports certain features (such as widestring's or 64 } +{ bit integers. Both libraries provide an additional, library specific, } +{ include file. For the JCL this is JCL.INC. These files should be included in } +{ source files instead of this file (which is pulled in automatically). } +{ } +{ Maintainer: Marcel van Brakel } +{ Last modified: July 18, 2006 } +{ } +{******************************************************************************} + +(* + +- Development environment directives + + This file defines two driectives to indicate which development environment the + library is being compiled with. Currently this can either be Delphi or + C++ Builder (in the near future "Kylix" will be added). + + Directive Description + ------------------------------------------------------------------------------ + DELPHI Defined if compiled with Delphi + BCB Defined if compiled with C++ Builder + +- Platform Directives + + Platform directives are not explicitly defined in this file but are defined + by the compiler itself. They are listed here only for completeness. + + Directive Description + ------------------------------------------------------------------------------ + WIN32 Defined when target platform is 32 bit Windows + LINUX Defined when target platform is Linux + +- Delphi Versions + + The following directives are direct mappings from the VERXXX directives to a + friendly name of the associated compiler. These directives are only defined if + the compiler is Delphi (ie DELPHI is defined). + + Directive Description + ------------------------------------------------------------------------------ + DELPHI1 Defined when compiling with Delphi 1 + DELPHI2 Defined when compiling with Delphi 2 + DELPHI3 Defined when compiling with Delphi 3 + DELPHI4 Defined when compiling with Delphi 4 + DELPHI5 Defined when compiling with Delphi 5 + DELPHI6 Defined when compiling with Delphi 6 + DELPHI1_UP Defined when compiling with Delphi 1 or higher + DELPHI2_UP Defined when compiling with Delphi 2 or higher + DELPHI3_UP Defined when compiling with Delphi 3 or higher + DELPHI4_UP Defined when compiling with Delphi 4 or higher + DELPHI5_UP Defined when compiling with Delphi 5 or higher + DELPHI6_UP Defined when compiling with Delphi 6 or higher + DELPHI7_UP Defined when compiling with Delphi 7 or higher + DELPHI8_UP Defined when compiling with Delphi 8 or higher + DELPHI9_UP Defined when compiling with Delphi 9 or higher + DELPHI10_UP Defined when compiling with Delphi 10 or higher + +- C++ Builder Versions + + The following directives are direct mappings from the VERXXX directives to a + friendly name of the associated compiler. These directives are only defined if + the compiler is C++ Builder (ie BCB is defined). + + Directive Description + ------------------------------------------------------------------------------ + BCB1 Defined when compiling with C++ Builder 1 + BCB3 Defined when compiling with C++ Builder 3 + BCB4 Defined when compiling with C++ Builder 4 + BCB5 Defined when compiling with C++ Builder 5 + BCB6 Defined when compiling with C++ Builder 6 + BCB7 Defined when compiling with C++ Builder 7 + BCB1_UP Defined when compiling with C++ Builder 1 or higher + BCB3_UP Defined when compiling with C++ Builder 3 or higher + BCB4_UP Defined when compiling with C++ Builder 4 or higher + BCB5_UP Defined when compiling with C++ Builder 5 or higher + BCB6_UP Defined when compiling with C++ Builder 6 or higher + BCB7_UP Defined when compiling with C++ Builder 7 or higher + BCB8_UP Defined when compiling with C++ Builder 8 or higher + BCB9_UP Defined when compiling with C++ Builder 9 or higher + BCB10_UP Defined when compiling with C++ Builder 10 or higher + +- Compiler Versions + + The following directives are direct mappings from the VERXXX directives to a + friendly name of the associated compiler. Unlike the DELPHI_X and BCB_X + directives, these directives are indepedent of the development environment. + That is, they are defined regardless of whether compilation takes place using + Delphi or C++ Builder. + + Directive Description + ------------------------------------------------------------------------------ + COMPILER1 Defined when compiling with Delphi 1 + COMPILER2 Defined when compiling with Delphi 2 or C++ Builder 1 + COMPILER3 Defined when compiling with Delphi 3 + COMPILER35 Defined when compiling with C++ Builder 3 + COMPILER4 Defined when compiling with Delphi 4 or C++ Builder 4 + COMPILER5 Defined when compiling with Delphi 5 or C++ Builder 5 + COMPILER6 Defined when compiling with Delphi 6 or C++ Builder 6 + COMPILER1_UP Defined when compiling with Delphi 1 or higher + COMPILER2_UP Defined when compiling with Delphi 2 or C++ Builder 1 or higher + COMPILER3_UP Defined when compiling with Delphi 3 or higher + COMPILER35_UP Defined when compiling with C++ Builder 3 or higher + COMPILER4_UP Defined when compiling with Delphi 4 or C++ Builder 4 or higher + COMPILER5_UP Defined when compiling with Delphi 5 or C++ Builder 5 or higher + COMPILER6_UP Defined when compiling with Delphi 6 or C++ Builder 6 or higher + COMPILER7_UP Defined when compiling with Delphi 7 or C++ Builder 7 or higher + COMPILER8_UP Defined when compiling with Delphi 8 or C++ Builder 8 or higher + COMPILER9_UP Defined when compiling with Delphi 9 or C++ Builder 9 or higher + COMPILER10_UP Defined when compiling with Delphi 10 or C++ Builder 10 or higher + +- Feature Directives + + The features directives are used to test if the compiler supports specific + features, such as method overloading, and adjust the sources accordingly. Use + of these directives is preferred over the use of the DELPHI and COMPILER + directives. + + Directive Description + ------------------------------------------------------------------------------ + SUPPORTS_WIDESTRING Compiler supports the WideString type (D3/BCB3 up) + SUPPORTS_INTERFACE Compiler supports interfaces (D3/BCB3) + SUPPORTS_EXTSYM Compiler supports the $EXTERNALSYM directive (D4/BCB3) + SUPPORTS_NODEFINE Compiler supports the $NODEFINE directive (D4/BCB3) + SUPPORTS_INT64 Compiler supports the Int64 type (D4/BCB4) + SUPPORTS_DYNAMICARRAYS Compiler supports dynamic arrays (D4/BCB4) + SUPPORTS_DEFAULTPARAMS Compiler supports default parameters (D4/BCB4) + SUPPORTS_OVERLOAD Compiler supports overloading (D4/BCB4) + +- Compiler Settings + + The compiler settings directives indicate whether a specific compiler setting + is in effect. This facilitates changing compiler settings locally in a more + compact and readible manner. + + Directive Description + ------------------------------------------------------------------------------ + ALIGN_ON Compiling in the A+ state (no alignment) + BOOLEVAL_ON Compiling in the B+ state (complete boolean evaluation) + ASSERTIONS_ON Compiling in the C+ state (assertions on) + DEBUGINFO_ON Compiling in the D+ state (debug info generation on) + IMPORTEDDATA_ON Compiling in the G+ state (creation of imported data references) + LONGSTRINGS_ON Compiling in the H+ state (string defined as AnsiString) + IOCHECKS_ON Compiling in the I+ state (I/O checking enabled) + WRITEABLECONST_ON Compiling in the J+ state (typed constants can be modified) + LOCALSYMBOLS Compiling in the L+ state (local symbol generation) + TYPEINFO_ON Compiling in the M+ state (RTTI generation on) + OPTIMIZATION_ON Compiling in the O+ state (code optimization on) + OPENSTRINGS_ON Compiling in the P+ state (variable string parameters are openstrings) + OVERFLOWCHECKS_ON Compiling in the Q+ state (overflow checing on) + RANGECHECKS_ON Compiling in the R+ state (range checking on) + TYPEDADDRESS_ON Compiling in the T+ state (pointers obtained using the @ operator are typed) + SAFEDIVIDE_ON Compiling in the U+ state (save FDIV instruction through RTL emulation) + VARSTRINGCHECKS_ON Compiling in the V+ state (type checking of shortstrings) + STACKFRAMES_ON Compiling in the W+ state (generation of stack frames) + EXTENDEDSYNTAX_ON Compiling in the X+ state (Delphi extended syntax enabled) + +*) + +//------------------------------------------------------------------------------ +// Compiler settings +//------------------------------------------------------------------------------ + +{$IFOPT A+} {$DEFINE ALIGN_ON} {$ENDIF} +{$IFOPT B+} {$DEFINE BOOLEVAL_ON} {$ENDIF} +{$IFOPT C+} {$DEFINE ASSERTIONS_ON} {$ENDIF} +{$IFOPT D+} {$DEFINE DEBUGINFO_ON} {$ENDIF} +{$IFOPT G+} {$DEFINE IMPORTEDDATA_ON} {$ENDIF} +{$IFOPT H+} {$DEFINE LONGSTRINGS_ON} {$ENDIF} +//HINTS +{$IFOPT I+} {$DEFINE IOCHECKS_ON} {$ENDIF} +{$IFOPT J+} {$DEFINE WRITEABLECONST_ON} {$ENDIF} +{$IFOPT L+} {$DEFINE LOCALSYMBOLS} {$ENDIF} +{$IFOPT M+} {$DEFINE TYPEINFO_ON} {$ENDIF} +{$IFOPT O+} {$DEFINE OPTIMIZATION_ON} {$ENDIF} +{$IFOPT P+} {$DEFINE OPENSTRINGS_ON} {$ENDIF} +{$IFOPT Q+} {$DEFINE OVERFLOWCHECKS_ON} {$ENDIF} +{$IFOPT R+} {$DEFINE RANGECHECKS_ON} {$ENDIF} +//REALCOMPATIBILITY +{$IFOPT T+} {$DEFINE TYPEDADDRESS_ON} {$ENDIF} +{$IFOPT U+} {$DEFINE SAFEDIVIDE_ON} {$ENDIF} +{$IFOPT V+} {$DEFINE VARSTRINGCHECKS_ON} {$ENDIF} +{$IFOPT W+} {$DEFINE STACKFRAMES_ON} {$ENDIF} +//WARNINGS +{$IFOPT X+} {$DEFINE EXTENDEDSYNTAX_ON} {$ENDIF} + +//------------------------------------------------------------------------------ +// VERXXX to COMPILERX, DELPHIX and BCBX mappings +//------------------------------------------------------------------------------ + + + +{$IFDEF VER180} + {$DEFINE COMPILER10} + {$IFDEF BCB} + {$DEFINE BCB10} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI10} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER170} + {$DEFINE COMPILER9} + {$IFDEF BCB} + {$DEFINE BCB9} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI9} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER160} + {$DEFINE COMPILER8} + {$IFDEF BCB} + {$DEFINE BCB8} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI8} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER150} + {$DEFINE COMPILER7} + {$IFDEF BCB} + {$DEFINE BCB7} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI7} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER140} + {$DEFINE COMPILER6} + {$IFDEF BCB} + {$DEFINE BCB6} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI6} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER130} + {$DEFINE COMPILER5} + {$IFDEF BCB} + {$DEFINE BCB5} + {$DEFINE BCB} + {$ELSE} + {$DEFINE DELPHI5} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER125} + {$DEFINE COMPILER4} + {$DEFINE BCB4} + {$DEFINE BCB} +{$ENDIF} + +{$IFDEF VER120} + {$DEFINE COMPILER4} + {$DEFINE DELPHI4} + {$DEFINE DELPHI} +{$ENDIF} + +{$IFDEF VER110} + {$DEFINE COMPILER35} + {$DEFINE BCB3} +{$ENDIF} + +{$IFDEF VER100} + {$DEFINE COMPILER3} + {$DEFINE DELPHI3} + {$DEFINE DELPHI} +{$ENDIF} + +{$IFDEF VER93} + {$DEFINE COMPILER2} + {$DEFINE BCB1} + {$DEFINE BCB} +{$ENDIF} + +{$IFDEF VER90} + {$DEFINE COMPILER2} + {$DEFINE DELPHI2} + {$DEFINE DELPHI} +{$ENDIF} + +{$IFDEF VER80} + {$DEFINE COMPILER1} + {$DEFINE DELPHI1} + {$DEFINE DELPHI} +{$ENDIF} + +//------------------------------------------------------------------------------ +// DELPHIX_UP from DELPHIX mappings +//------------------------------------------------------------------------------ + +{$IFDEF DELPHI10} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI9} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI8} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI7} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI6} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI5} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI4} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI3} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI2} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI1} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +//------------------------------------------------------------------------------ +// BCBX_UP from BCBX mappings +//------------------------------------------------------------------------------ + +{$IFDEF BCB10} + {$DEFINE BCB10_UP} + {$DEFINE BCB9_UP} + {$DEFINE BCB8_UP} + {$DEFINE BCB7_UP} + {$DEFINE BCB6_UP} + {$DEFINE BCB5_UP} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB9} + {$DEFINE BCB9_UP} + {$DEFINE BCB8_UP} + {$DEFINE BCB7_UP} + {$DEFINE BCB6_UP} + {$DEFINE BCB5_UP} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB8} + {$DEFINE BCB8_UP} + {$DEFINE BCB7_UP} + {$DEFINE BCB6_UP} + {$DEFINE BCB5_UP} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB7} + {$DEFINE BCB7_UP} + {$DEFINE BCB6_UP} + {$DEFINE BCB5_UP} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB6} + {$DEFINE BCB6_UP} + {$DEFINE BCB5_UP} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB5} + {$DEFINE BCB5_UP} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB4} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB3} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB1} + {$DEFINE BCB1_UP} +{$ENDIF} + +//------------------------------------------------------------------------------ +// COMPILERX_UP from COMPILERX mappings +//------------------------------------------------------------------------------ + +{$IFDEF COMPILER10} + {$DEFINE COMPILER10_UP} + {$DEFINE COMPILER9_UP} + {$DEFINE COMPILER8_UP} + {$DEFINE COMPILER7_UP} + {$DEFINE COMPILER6_UP} + {$DEFINE COMPILER5_UP} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER9} + {$DEFINE COMPILER9_UP} + {$DEFINE COMPILER8_UP} + {$DEFINE COMPILER7_UP} + {$DEFINE COMPILER6_UP} + {$DEFINE COMPILER5_UP} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER8} + {$DEFINE COMPILER8_UP} + {$DEFINE COMPILER7_UP} + {$DEFINE COMPILER6_UP} + {$DEFINE COMPILER5_UP} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER7} + {$DEFINE COMPILER7_UP} + {$DEFINE COMPILER6_UP} + {$DEFINE COMPILER5_UP} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER6} + {$DEFINE COMPILER6_UP} + {$DEFINE COMPILER5_UP} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER5} + {$DEFINE COMPILER5_UP} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER4} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER35} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER3} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER2} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER1} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +//------------------------------------------------------------------------------ +// Map COMPILERX_UP to friendly feature names +//------------------------------------------------------------------------------ + +{$IFDEF COMPILER3_UP} + {$DEFINE SUPPORTS_WIDESTRING} + {$DEFINE SUPPORTS_INTERFACE} +{$ENDIF} + +{$IFDEF COMPILER35_UP} + {$DEFINE SUPPORTS_EXTSYM} + {$DEFINE SUPPORTS_NODEFINE} +{$ENDIF} + +{$IFDEF COMPILER4_UP} + {$DEFINE SUPPORTS_INT64} + {$DEFINE SUPPORTS_DYNAMICARRAYS} + {$DEFINE SUPPORTS_DEFAULTPARAMS} + {$DEFINE SUPPORTS_OVERLOAD} +{$ENDIF} + +//------------------------------------------------------------------------------ +// Cross-platform related defines +//------------------------------------------------------------------------------ + +{$IFDEF WIN32} + {$DEFINE MSWINDOWS} +{$ENDIF} + +{$IFDEF LINUX} + {$DEFINE UNIX} + {$DEFINE COMPLIB_CLX} +{$ENDIF} + +{$IFNDEF COMPLIB_CLX} + {$DEFINE COMPLIB_VCL} +{$ENDIF} + diff --git a/Pramougolnik/Rectangle.dpr b/Pramougolnik/Rectangle.dpr new file mode 100644 index 0000000..7055173 --- /dev/null +++ b/Pramougolnik/Rectangle.dpr @@ -0,0 +1,13 @@ +program Rectangle; + +uses + Forms, + Unit1 in 'Unit1.pas' {Form1}; + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/Pramougolnik/Rectangle.dproj b/Pramougolnik/Rectangle.dproj new file mode 100644 index 0000000..ff08c5f --- /dev/null +++ b/Pramougolnik/Rectangle.dproj @@ -0,0 +1,872 @@ + + + {3D07A99C-1E74-4E6B-8C7B-AF9D58B143B8} + Rectangle.dpr + True + Debug + 1097 + Application + VCL + 18.7 + Win32 + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + false + false + false + true + false + 00400000 + 1 + 1 + vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP;$(DCC_UsePackage) + Rectangle + Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace) + 1049 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + + + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png + + + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png + + + System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName) + 1033 + $(BDS)\bin\default_app.manifest + Arrow_Icon.ico + true + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + + + RELEASE;$(DCC_Define) + 0 + false + 0 + + + true + PerMonitorV2 + + + DEBUG;$(DCC_Define) + false + true + + + true + PerMonitorV2 + + + + MainSource + + +
Form1
+
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + + + + + Rectangle.dpr + + + + True + True + True + True + + + + + Rectangle.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 1 + + + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + + + res\values + 1 + + + + + res\values-v21 + 1 + + + + + res\values + 1 + + + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + 1 + + + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + + + + + + + + + + 12 + + + + +
diff --git a/Pramougolnik/Rectangle.dproj.local b/Pramougolnik/Rectangle.dproj.local new file mode 100644 index 0000000..8c3ad8f --- /dev/null +++ b/Pramougolnik/Rectangle.dproj.local @@ -0,0 +1,6 @@ + + + + 2019.10.16 13:55:39.544,D:\Vanessa_repo\UITooolsFor1C\Pramougolnik\Rectangle.dproj=D:\Vanessa_repo\UITooolsFor1C\Pramougolnik\Arrow.dproj + + diff --git a/Pramougolnik/Rectangle.identcache b/Pramougolnik/Rectangle.identcache new file mode 100644 index 0000000..5ca2067 Binary files /dev/null and b/Pramougolnik/Rectangle.identcache differ diff --git a/Pramougolnik/Rectangle.res b/Pramougolnik/Rectangle.res new file mode 100644 index 0000000..b50edb7 Binary files /dev/null and b/Pramougolnik/Rectangle.res differ diff --git a/Pramougolnik/Unit1.dcu b/Pramougolnik/Unit1.dcu new file mode 100644 index 0000000..8f56773 Binary files /dev/null and b/Pramougolnik/Unit1.dcu differ diff --git a/Pramougolnik/Unit1.ddp b/Pramougolnik/Unit1.ddp new file mode 100644 index 0000000..4370276 Binary files /dev/null and b/Pramougolnik/Unit1.ddp differ diff --git a/Pramougolnik/Unit1.dfm b/Pramougolnik/Unit1.dfm new file mode 100644 index 0000000..f22aa31 --- /dev/null +++ b/Pramougolnik/Unit1.dfm @@ -0,0 +1,40 @@ +object Form1: TForm1 + Left = 191 + Top = 124 + Caption = 'Form1' + ClientHeight = 636 + ClientWidth = 1290 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object Image1: TImage + Left = 128 + Top = 128 + Width = 441 + Height = 249 + end + object Button1: TButton + Left = 72 + Top = 24 + Width = 75 + Height = 25 + Caption = 'Button1' + TabOrder = 0 + Visible = False + OnClick = Button1Click + end + object RectangleTimer: TTimer + Interval = 10 + OnTimer = RectangleTimerTimer + Left = 176 + Top = 24 + end +end diff --git a/Pramougolnik/Unit1.pas b/Pramougolnik/Unit1.pas new file mode 100644 index 0000000..1f684e8 --- /dev/null +++ b/Pramougolnik/Unit1.pas @@ -0,0 +1,292 @@ +unit Unit1; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, Math, ExtCtrls, GDIPAPI, GDIPOBJ; + +type + TForm1 = class(TForm) + Button1: TButton; + RectangleTimer: TTimer; + Image1: TImage; + procedure Button1Click(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure RectangleTimerTimer(Sender: TObject); + procedure FormShow(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + glX1,glX2,glY1,glY2,glColor, glHowLong:Integer; + glColorR,glColorG,glColorB:Integer; + glFileName:String; + CountTimer,MaxCountTimer:Integer; + glFirstShow:Boolean; + glgraphics : TGPGraphics; + glPN: TGPPen; + glOldX1,glOldX2,glOldY1,glOldY2:integer; + +implementation + +{$R *.dfm} + +function LeftStr(S:String; Kol:Integer):String; + var + Res:String; +begin + + Res:=S; + Delete(Res,Kol+1,Length(Res)); + + LeftStr:=Res; +end; + +function RightStr(S:String; Kol:Integer):String; + var + Res:String; +begin + + Res:=S; + Delete(Res,1,Length(Res)-Kol); + + RightStr:=Res; +end; + + +procedure DrawArrowHead(Canvas: TCanvas; X,Y: Integer; Angle,LW: Extended); +var + A1,A2: Extended; + Arrow: array[0..3] of TPoint; + OldWidth: Integer; +const + Beta=0.322; + LineLen=4.74; + CentLen=3; +begin + Angle:=Pi+Angle; + Arrow[0]:=Point(X,Y); + A1:=Angle-Beta; + A2:=Angle+Beta; + Arrow[1]:=Point(X+Round(LineLen*LW*Cos(A1)),Y-Round(LineLen*LW*Sin(A1))); + Arrow[2]:=Point(X+Round(CentLen*LW*Cos(Angle)),Y-Round(CentLen*LW*Sin(Angle))); + Arrow[3]:=Point(X+Round(LineLen*LW*Cos(A2)),Y-Round(LineLen*LW*Sin(A2))); + OldWidth:=Canvas.Pen.Width; + Canvas.Pen.Width:=1; + Canvas.Polygon(Arrow); + Canvas.Pen.Width:=OldWidth +end; + +procedure DrawRectangle(Canvas: TCanvas; X1,Y1,X2,Y2: Integer; LW: Extended); +begin + glgraphics.DrawRectangle(glPN, X1,Y1, X2-X1,Y2-Y1); +end; + +procedure DrawArrowTimer(); +begin + CountTimer:=0; + MaxCountTimer:=300; + Form1.RectangleTimer.Enabled:=True; +end; + + +procedure TForm1.Button1Click(Sender: TObject); +begin + Form1.Canvas.Pen.Color:=clGreen; + Form1.Canvas.Brush.Color:=clGreen; + Form1.Canvas.Pen.Width:=10; + + DrawRectangle(Form1.Canvas,10,200,800,400,10); +end; + +procedure TForm1.FormCreate(Sender: TObject); + var + i: integer; +begin + Application.ShowMainForm:=false; + glgraphics := TGPGraphics.Create(Form1.Canvas.Handle); + glPN := TGPPen.Create(MakeColor(255, 0, 0, 0)); + + glgraphics.SetSmoothingMode(SmoothingModeAntiAlias); + glgraphics.SetCompositingQuality(CompositingQualityAssumeLinear); + glgraphics.SetInterpolationMode(InterpolationModeHighQualityBilinear); + + Form1.Visible:=false; + { + if ParamCount = 0 then + begin + Form1.Close; + ExitProcess(0); + end; + } + + //X1, Y1, X2, Y2, Öâåò, Äëèòåëüíîñòü,{Èìÿ ñòîï ôàéëà(íåîáÿçàòåëüíûé)} + //åñëè íà äèñêå åñòü ñòîï ôàéë, çíà÷èò íàäî ñäåëàòü exit + + glFirstShow:=True; + + glX1 := 100; + glY1 := 300; + glX2 := 1800; + glY2 := 350; + glHowLong:=30000; + glColor := 255; + glFileName:=''; + + for i := 1 to ParamCount do + begin + if i=1 then + glX1:=StrToInt(ParamStr(i)); + if i=2 then + glY1:=StrToInt(ParamStr(i)); + if i=3 then + glX2:=StrToInt(ParamStr(i)); + if i=4 then + glY2:=StrToInt(ParamStr(i)); + if i=5 then + glColorR:=StrToInt(ParamStr(i)); + if i=6 then + glColorG:=StrToInt(ParamStr(i)); + if i=7 then + glColorB:=StrToInt(ParamStr(i)); + if i=8 then + glHowLong:=StrToInt(ParamStr(i)); + + + if LeftStr(ParamStr(i),13) = 'stopfilename=' then + begin + glFileName:=RightStr(ParamStr(i),Length(ParamStr(i))-13); + end; + + end; + + DrawArrowTimer(); + +end; + +procedure CopyScreenToImage(); +var + bm: TBitMap; + ms: TMemoryStream; +begin + bm := TBitMap.Create; + bm.Width := Form1.Width; // øèðèíà õîëñòà + bm.Height := Form1.Height; // äëèíà õîëñòà + BitBlt(bm.Canvas.Handle, 0, 0, bm.Width, bm.Height, + GetDC(0), Form1.Left, Form1.Top, SRCCOPY); // 0, 0, bm.Width, bm.Height çäåñü ýòî òà ÷àñòü ýêðàíà + // êîòîðóþ íóæíî êîïèðîâàòü + + ms := TMemoryStream.Create; + bm.SaveToStream(ms); + ms.Position := 0; + Form1.Image1.Picture.Bitmap.LoadFromStream(ms); + bm.Destroy; + ms.Free; + +end; + + +procedure TForm1.RectangleTimerTimer(Sender: TObject); + var + OffsetX,OffsetY : integer; + ResX,ResY : integer; + Border:integer; + Angle: Extended; +begin + CountTimer:=CountTimer + Round(RectangleTimer.Interval); + + if glFileName <> '' then + begin + if FileExists(glFileName) then + begin + RectangleTimer.Enabled:=False; + ExitProcess(0); + end; + + end; + + + if CountTimer >= glHowLong then + begin + //RectangleTimerTimer.Enabled:=False; + ExitProcess(0); + end; + + if CountTimer > MaxCountTimer then + begin + //ExitProcess(0); + Exit; + end; + + Border:=10; + + + if glFirstShow then + begin + + glFirstShow:=False; + + Form1.TransparentColorValue := TColor(1); + Form1.Color := TColor(1); + Form1.transparentcolor := true; + + Form1.BorderStyle := bsNone; + Form1.Left:=1; + Form1.Top:=1; + Form1.Width:= Max(glX1,glX2)+Border*2; + Form1.Height:=Max(glY1,glY2)+Border*2; + + + Image1.Left:=0; + Image1.Top:=0; + Image1.Width:=Form1.Width; + Image1.Height:=Form1.Height; + + + Form1.Show; + + SetWindowPos(Form1.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE); + SetWindowLong(Form1.Handle, GWL_EXSTYLE, GetWindowLong(Form1.Handle, GWL_EXSTYLE) or WS_EX_TRANSPARENT ); + end; + + + +if (CountTimer + Round(RectangleTimer.Interval)) > MaxCountTimer then + begin + Form1.Refresh; +end; + + + + glgraphics := TGPGraphics.Create(Form1.Canvas.Handle); + glPN := TGPPen.Create(MakeColor(255, glColorR, glColorG, glColorB)); + + glgraphics.SetSmoothingMode(SmoothingModeAntiAlias); + glgraphics.SetCompositingQuality(CompositingQualityAssumeLinear); + glgraphics.SetInterpolationMode(InterpolationModeHighQualityBilinear); + + glPN.SetWidth(3); + + + ResX:=glX1+OffsetX; + ResY:=glY1+OffsetY; + + DrawRectangle(Form1.Canvas,glX1,glY1,glX2,glY2,10); + + glOldX1:=glX1; + glOldY1:=glY1; + glOldX2:=ResX; + glOldY2:=ResY; +end; + +procedure TForm1.FormShow(Sender: TObject); +begin + ShowWindow(Application.Handle, SW_HIDE); +end; + +end. diff --git a/Pramougolnik/__history/Rectangle.dpr.~1~ b/Pramougolnik/__history/Rectangle.dpr.~1~ new file mode 100644 index 0000000..501be14 --- /dev/null +++ b/Pramougolnik/__history/Rectangle.dpr.~1~ @@ -0,0 +1,13 @@ +program Arrow; + +uses + Forms, + Unit1 in 'Unit1.pas' {Form1}; + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/Pramougolnik/__history/Unit1.dfm.~1~ b/Pramougolnik/__history/Unit1.dfm.~1~ new file mode 100644 index 0000000..600e4e6 --- /dev/null +++ b/Pramougolnik/__history/Unit1.dfm.~1~ @@ -0,0 +1,40 @@ +object Form1: TForm1 + Left = 191 + Top = 124 + Width = 1306 + Height = 675 + Caption = 'Form1' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object Image1: TImage + Left = 128 + Top = 128 + Width = 441 + Height = 249 + end + object Button1: TButton + Left = 72 + Top = 24 + Width = 75 + Height = 25 + Caption = 'Button1' + TabOrder = 0 + Visible = False + OnClick = Button1Click + end + object ArrowTimer: TTimer + Interval = 10 + OnTimer = ArrowTimerTimer + Left = 176 + Top = 24 + end +end diff --git a/Pramougolnik/__history/Unit1.dfm.~2~ b/Pramougolnik/__history/Unit1.dfm.~2~ new file mode 100644 index 0000000..f22aa31 --- /dev/null +++ b/Pramougolnik/__history/Unit1.dfm.~2~ @@ -0,0 +1,40 @@ +object Form1: TForm1 + Left = 191 + Top = 124 + Caption = 'Form1' + ClientHeight = 636 + ClientWidth = 1290 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + OnCreate = FormCreate + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object Image1: TImage + Left = 128 + Top = 128 + Width = 441 + Height = 249 + end + object Button1: TButton + Left = 72 + Top = 24 + Width = 75 + Height = 25 + Caption = 'Button1' + TabOrder = 0 + Visible = False + OnClick = Button1Click + end + object RectangleTimer: TTimer + Interval = 10 + OnTimer = RectangleTimerTimer + Left = 176 + Top = 24 + end +end diff --git a/Pramougolnik/__history/Unit1.pas.~1~ b/Pramougolnik/__history/Unit1.pas.~1~ new file mode 100644 index 0000000..b19b489 --- /dev/null +++ b/Pramougolnik/__history/Unit1.pas.~1~ @@ -0,0 +1,320 @@ +unit Unit1; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, Math, ExtCtrls, GDIPAPI, GDIPOBJ; + +type + TForm1 = class(TForm) + Button1: TButton; + ArrowTimer: TTimer; + Image1: TImage; + procedure Button1Click(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure ArrowTimerTimer(Sender: TObject); + procedure FormShow(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + glX1,glX2,glY1,glY2,glColor, glHowLong:Integer; + glColorR,glColorG,glColorB:Integer; + glFileName:String; + CountTimer,MaxCountTimer:Integer; + glFirstShow:Boolean; + glgraphics : TGPGraphics; + glPN: TGPPen; + glOldX1,glOldX2,glOldY1,glOldY2:integer; + +implementation + +{$R *.dfm} + +function LeftStr(S:String; Kol:Integer):String; + var + Res:String; +begin + + Res:=S; + Delete(Res,Kol+1,Length(Res)); + + LeftStr:=Res; +end; + +function RightStr(S:String; Kol:Integer):String; + var + Res:String; +begin + + Res:=S; + Delete(Res,1,Length(Res)-Kol); + + RightStr:=Res; +end; + + +procedure DrawArrowHead(Canvas: TCanvas; X,Y: Integer; Angle,LW: Extended); +var + A1,A2: Extended; + Arrow: array[0..3] of TPoint; + OldWidth: Integer; +const + Beta=0.322; + LineLen=4.74; + CentLen=3; +begin + Angle:=Pi+Angle; + Arrow[0]:=Point(X,Y); + A1:=Angle-Beta; + A2:=Angle+Beta; + Arrow[1]:=Point(X+Round(LineLen*LW*Cos(A1)),Y-Round(LineLen*LW*Sin(A1))); + Arrow[2]:=Point(X+Round(CentLen*LW*Cos(Angle)),Y-Round(CentLen*LW*Sin(Angle))); + Arrow[3]:=Point(X+Round(LineLen*LW*Cos(A2)),Y-Round(LineLen*LW*Sin(A2))); + OldWidth:=Canvas.Pen.Width; + Canvas.Pen.Width:=1; + Canvas.Polygon(Arrow); + Canvas.Pen.Width:=OldWidth +end; + +procedure DrawArrow(Canvas: TCanvas; X1,Y1,X2,Y2: Integer; LW: Extended); +var + Angle: Extended; +begin + Angle:=ArcTan2(Y1-Y2,X2-X1); + //Canvas.MoveTo(X1,Y1); + //Canvas.LineTo(X2-Round(2*LW*Cos(Angle)),Y2+Round(2*LW*Sin(Angle))); + glgraphics.DrawLine(glPN, X1,Y1, X2-Round(2*LW*Cos(Angle)),Y2+Round(2*LW*Sin(Angle))); + //glgraphics.DrawLine(glPN, 100, 330, 1800, 430); + + DrawArrowHead(Canvas,X2,Y2,Angle,LW); +end; + +procedure DrawArrowTimer(); +begin + CountTimer:=0; + MaxCountTimer:=300; + Form1.ArrowTimer.Enabled:=True; +end; + + +procedure TForm1.Button1Click(Sender: TObject); +begin + Form1.Canvas.Pen.Color:=clGreen; + Form1.Canvas.Brush.Color:=clGreen; + Form1.Canvas.Pen.Width:=10; + + DrawArrow(Form1.Canvas,10,200,800,400,10); +end; + +procedure TForm1.FormCreate(Sender: TObject); + var + i: integer; +begin + Application.ShowMainForm:=false; + glgraphics := TGPGraphics.Create(Form1.Canvas.Handle); + glPN := TGPPen.Create(MakeColor(255, 0, 0, 0)); + + glgraphics.SetSmoothingMode(SmoothingModeAntiAlias); + glgraphics.SetCompositingQuality(CompositingQualityAssumeLinear); + glgraphics.SetInterpolationMode(InterpolationModeHighQualityBilinear); + + Form1.Visible:=false; + { + if ParamCount = 0 then + begin + Form1.Close; + ExitProcess(0); + end; + } + + //X1, Y1, X2, Y2, Öâåò, Äëèòåëüíîñòü,{Èìÿ ñòîï ôàéëà(íåîáÿçàòåëüíûé)} + //åñëè íà äèñêå åñòü ñòîï ôàéë, çíà÷èò íàäî ñäåëàòü exit + + glFirstShow:=True; + + glX1 := 100; + glY1 := 300; + glX2 := 1800; + glY2 := 350; + glHowLong:=30000; + glColor := 255; + glFileName:=''; + + for i := 1 to ParamCount do + begin + if i=1 then + glX1:=StrToInt(ParamStr(i)); + if i=2 then + glY1:=StrToInt(ParamStr(i)); + if i=3 then + glX2:=StrToInt(ParamStr(i)); + if i=4 then + glY2:=StrToInt(ParamStr(i)); + if i=5 then + glColorR:=StrToInt(ParamStr(i)); + if i=6 then + glColorG:=StrToInt(ParamStr(i)); + if i=7 then + glColorB:=StrToInt(ParamStr(i)); + if i=8 then + glHowLong:=StrToInt(ParamStr(i)); + + + if LeftStr(ParamStr(i),13) = 'stopfilename=' then + begin + glFileName:=RightStr(ParamStr(i),Length(ParamStr(i))-13); + end; + + end; + + DrawArrowTimer(); + +end; + +procedure CopyScreenToImage(); +var + bm: TBitMap; + ms: TMemoryStream; +begin + bm := TBitMap.Create; + bm.Width := Form1.Width; // øèðèíà õîëñòà + bm.Height := Form1.Height; // äëèíà õîëñòà + BitBlt(bm.Canvas.Handle, 0, 0, bm.Width, bm.Height, + GetDC(0), Form1.Left, Form1.Top, SRCCOPY); // 0, 0, bm.Width, bm.Height çäåñü ýòî òà ÷àñòü ýêðàíà + // êîòîðóþ íóæíî êîïèðîâàòü + + ms := TMemoryStream.Create; + bm.SaveToStream(ms); + ms.Position := 0; + Form1.Image1.Picture.Bitmap.LoadFromStream(ms); + bm.Destroy; + ms.Free; + +end; + + +procedure TForm1.ArrowTimerTimer(Sender: TObject); + var + OffsetX,OffsetY : integer; + ResX,ResY : integer; + Border:integer; + Angle: Extended; +begin + CountTimer:=CountTimer + Round(ArrowTimer.Interval); + + if glFileName <> '' then + begin + if FileExists(glFileName) then + begin + ArrowTimer.Enabled:=False; + ExitProcess(0); + end; + + end; + + + if CountTimer >= glHowLong then + begin + ArrowTimer.Enabled:=False; + ExitProcess(0); + end; + + if CountTimer > MaxCountTimer then + begin + //ExitProcess(0); + Exit; + end; + + Border:=10; + + + if glFirstShow then + begin + + glFirstShow:=False; + + Form1.TransparentColorValue := TColor(1); + Form1.Color := TColor(1); + Form1.transparentcolor := true; + + Form1.BorderStyle := bsNone; + Form1.Left:=1; + Form1.Top:=1; + Form1.Width:= Max(glX1,glX2)+Border*2; + Form1.Height:=Max(glY1,glY2)+Border*2; + + + Image1.Left:=0; + Image1.Top:=0; + Image1.Width:=Form1.Width; + Image1.Height:=Form1.Height; + + CopyScreenToImage(); + + Form1.Show; + + SetWindowPos(Form1.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE); + SetWindowLong(Form1.Handle, GWL_EXSTYLE, GetWindowLong(Form1.Handle, GWL_EXSTYLE) or WS_EX_TRANSPARENT ); + end + else + begin + Form1.Canvas.Pen.Color:=TColor(1); + Form1.Canvas.Brush.Color:=TColor(1); + Form1.Canvas.Pen.Width:=10; + + Angle:=ArcTan2(glOldY1-glOldY2,glOldX2-glOldX1); + DrawArrowHead(Form1.Canvas,glOldX2,glOldY2,Angle,10); + end; + + + + Form1.Canvas.Pen.Color:=RGB(glColorR,glColorG,glColorB); + Form1.Canvas.Brush.Color:=RGB(glColorR,glColorG,glColorB); + Form1.Canvas.Pen.Width:=10; + + + OffsetX:= Round((CountTimer/MaxCountTimer)*(glX2-glX1)); + OffsetY:= Round((CountTimer/MaxCountTimer)*(glY2-glY1)); + + if (CountTimer + Round(ArrowTimer.Interval)) > MaxCountTimer then + begin + Form1.Refresh; + end; + + + + glgraphics := TGPGraphics.Create(Form1.Canvas.Handle); + glPN := TGPPen.Create(MakeColor(255, glColorR, glColorG, glColorB)); + + glgraphics.SetSmoothingMode(SmoothingModeAntiAlias); + glgraphics.SetCompositingQuality(CompositingQualityAssumeLinear); + glgraphics.SetInterpolationMode(InterpolationModeHighQualityBilinear); + + glPN.SetWidth(10); + + + ResX:=glX1+OffsetX; + ResY:=glY1+OffsetY; + + + + DrawArrow(Form1.Canvas,glX1,glY1,ResX,ResY,10); + + glOldX1:=glX1; + glOldY1:=glY1; + glOldX2:=ResX; + glOldY2:=ResY; +end; + +procedure TForm1.FormShow(Sender: TObject); +begin + ShowWindow(Application.Handle, SW_HIDE); +end; + +end.