Advertisement
Guest User

Untitled

a guest
Jan 11th, 2017
2,973
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 636.04 KB | None | 0 0
  1. unit GdiPlus;
  2.  
  3. { Delphi GDI+ Library for use with Delphi 2009 or later.
  4. Copyright (C) 2009 by Erik van Bilsen.
  5. Website: www.bilsen.com/gdiplus
  6.  
  7. License in plain English:
  8.  
  9. 1. I don't promise that this software works. (But if you find any bugs,
  10. please let me know!)
  11. 2. You can use this software for whatever you want. You don't have to pay me.
  12. 3. You may not pretend that you wrote this software. If you use it in a program,
  13. you must acknowledge somewhere in your documentation that you've used this
  14. code.
  15.  
  16. In legalese:
  17.  
  18. The author makes NO WARRANTY or representation, either express or implied,
  19. with respect to this software, its quality, accuracy, merchantability, or
  20. fitness for a particular purpose. This software is provided "AS IS", and you,
  21. its user, assume the entire risk as to its quality and accuracy.
  22.  
  23. Permission is hereby granted to use, copy, modify, and distribute this
  24. software (or portions thereof) for any purpose, without fee, subject to these
  25. conditions:
  26. (1) If any part of the source code for this software is distributed, then the
  27. License.txt file must be included, with this copyright and no-warranty notice
  28. unaltered; and any additions, deletions, or changes to the original files
  29. must be clearly indicated in accompanying documentation.
  30. (2) If only executable code is distributed, then the accompanying
  31. documentation must state that "this software is based in part on the Delphi
  32. GDI+ library by Erik van Bilsen".
  33. (3) Permission for use of this software is granted only if the user accepts
  34. full responsibility for any undesirable consequences; the author accepts
  35. NO LIABILITY for damages of any kind.
  36.  
  37. Version history
  38. ===============
  39.  
  40. Version 1.2:
  41. -Minor bug fixes
  42. -The biggest complaint with version 1.0 was about name conflicts (for example
  43. between Graphics.TBitmap and GdiPlus.TBitmap). In this version, all GDI+ types
  44. start with a "TGP" or "IGP" prefix now to avoid these collisions (for example
  45. IGPBitmap and TGPBitmap). The previous type names are still available if you
  46. define the GDIP_ALIAS conditional define in your project, although usage of
  47. these names is discouraged now.
  48.  
  49. Version 1.1:
  50. Never existed (to avoid confusion with Microsofts GDI+ version 1.1)
  51.  
  52. Version 1.0:
  53. Initial version }
  54.  
  55. {$ALIGN 8}
  56. {$MINENUMSIZE 4}
  57.  
  58. interface
  59.  
  60. uses
  61. Windows,
  62. Math,
  63. ActiveX,
  64. SysUtils,
  65. Generics.Collections;
  66.  
  67. {$IFDEF GDIP_0110}
  68. const
  69. GDIPVER = $0110;
  70.  
  71. { $R GdiPlus11.res}
  72. {$ELSE}
  73. const
  74. GDIPVER = $0100;
  75. {$ENDIF}
  76.  
  77. const
  78. GdiPlusDll = 'gdiplus.dll';
  79.  
  80. type
  81. PUInt16 = ^UInt16;
  82. PLangID = ^LangID;
  83. TColorRef = Integer;
  84.  
  85. {$REGION 'Support classes'}
  86. type
  87. IGPArray<T> = interface
  88. ['{E80D8F50-F3E5-4E5F-8E07-FC4535EA90EA}']
  89. { Property access methods }
  90. function GetCount: Integer;
  91. procedure SetCount(const Value: Integer);
  92. function GetItem(const Index: Integer): T;
  93. procedure SetItem(const Index: Integer; const Value: T);
  94. function GetItemPtr: Pointer;
  95.  
  96. { Methods }
  97. function GetEnumerator: TEnumerator<T>;
  98.  
  99. { Properties }
  100. property Count: Integer read GetCount write SetCount;
  101. property Items[const Index: Integer]: T read GetItem write SetItem; default;
  102. property ItemPtr: Pointer read GetItemPtr;
  103. end;
  104.  
  105. type
  106. TGPArray<T> = class(TInterfacedObject, IGPArray<T>)
  107. public
  108. type
  109. TEnumerator = class(TEnumerator<T>)
  110. private
  111. FArray: TGPArray<T>;
  112. FIndex: Integer;
  113. function GetCurrent: T;
  114. protected
  115. function DoGetCurrent: T; override;
  116. function DoMoveNext: Boolean; override;
  117. public
  118. constructor Create(const AArray: TGPArray<T>);
  119. property Current: T read GetCurrent;
  120. function MoveNext: Boolean;
  121. end;
  122. private
  123. FItems: array of T;
  124. private
  125. { IGPArray<T> }
  126. function GetCount: Integer;
  127. procedure SetCount(const Value: Integer);
  128. function GetItem(const Index: Integer): T;
  129. procedure SetItem(const Index: Integer; const Value: T);
  130. function GetItemPtr: Pointer;
  131. function GetEnumerator: TEnumerator<T>;
  132. public
  133. constructor Create(const Count: Integer);
  134. end;
  135.  
  136. type
  137. IGPBuffer = interface
  138. ['{F252CE33-4F54-4B76-9261-2344D1BCD19C}']
  139. { Property access methods }
  140. function GetData: Pointer;
  141. function GetSize: Cardinal;
  142.  
  143. { Properties }
  144. property Data: Pointer read GetData;
  145. property Size: Cardinal read GetSize;
  146. end;
  147.  
  148. type
  149. TGPBuffer = class(TInterfacedObject, IGPBuffer)
  150. private
  151. FData: Pointer;
  152. FSize: Cardinal;
  153. private
  154. { IRegionData }
  155. function GetData: Pointer;
  156. function GetSize: Cardinal;
  157. public
  158. constructor Create(const Data: Pointer; const Size: Cardinal);
  159. destructor Destroy; override;
  160. end;
  161. {$ENDREGION 'Support classes'}
  162.  
  163. {$REGION 'GdiplusMem.h'}
  164. (*****************************************************************************
  165. * GdiplusMem.h
  166. * GDI+ Private Memory Management APIs
  167. *****************************************************************************)
  168.  
  169. //----------------------------------------------------------------------------
  170. // Memory Allocation APIs
  171. //----------------------------------------------------------------------------
  172.  
  173. function GdipAlloc(Size: Integer): Pointer; stdcall; external GdiPlusDll;
  174. procedure GdipFree(Ptr: Pointer); stdcall; external GdiPlusDll;
  175. {$ENDREGION 'GdiplusMem.h'}
  176.  
  177. {$REGION 'GdiplusBase.h'}
  178. (*****************************************************************************
  179. * GdiplusBase.h
  180. * GDI+ base memory allocation class
  181. *****************************************************************************)
  182.  
  183. type
  184. GpNativeHandle = Pointer;
  185.  
  186. type
  187. IGdiplusBase = interface
  188. ['{24A5D3F5-4A9B-42A2-9F60-20825E2740F5}']
  189. { Property access methods }
  190. function GetNativeHandle: GpNativeHandle;
  191. procedure SetNativeHandle(const Value: GpNativeHandle);
  192.  
  193. { Properties }
  194. property NativeHandle: GpNativeHandle read GetNativeHandle write SetNativeHandle;
  195. end;
  196.  
  197. TGdiplusBase = class(TInterfacedObject, IGdiPlusBase)
  198. protected
  199. FNativeHandle: GpNativeHandle;
  200. private
  201. { IGdiPlusBase }
  202. function GetNativeHandle: GpNativeHandle;
  203. procedure SetNativeHandle(const Value: GpNativeHandle);
  204. private
  205. constructor Create;
  206. public
  207. class function NewInstance: TObject; override;
  208. procedure FreeInstance; override;
  209. end;
  210. {$ENDREGION 'GdiplusBase.h'}
  211.  
  212. {$REGION 'GdiplusEnums.h'}
  213. (*****************************************************************************
  214. * GdiplusEnums.h
  215. * GDI+ Enumeration Types
  216. *****************************************************************************)
  217.  
  218. //--------------------------------------------------------------------------
  219. // Default bezier flattening tolerance in device pixels.
  220. //--------------------------------------------------------------------------
  221.  
  222. const
  223. FlatnessDefault = 1.0 / 4.0;
  224.  
  225. //--------------------------------------------------------------------------
  226. // Graphics and Container State cookies
  227. //--------------------------------------------------------------------------
  228.  
  229. type
  230. TGPGraphicsState = UINT;
  231. PGPGraphicsState = ^TGPGraphicsState;
  232. TGPGraphicsContainer = UINT;
  233. PGPGraphicsContainer = ^TGPGraphicsContainer;
  234.  
  235. //--------------------------------------------------------------------------
  236. // Fill mode constants
  237. //--------------------------------------------------------------------------
  238.  
  239. type
  240. TGPFillMode = (
  241. FillModeAlternate, // 0
  242. FillModeWinding); // 1
  243.  
  244. //--------------------------------------------------------------------------
  245. // Quality mode constants
  246. //--------------------------------------------------------------------------
  247.  
  248. type
  249. TGPQualityMode = (
  250. QualityModeInvalid = -1,
  251. QualityModeDefault = 0,
  252. QualityModeLow = 1, // Best performance
  253. QualityModeHigh = 2); // Best rendering quality
  254.  
  255. //--------------------------------------------------------------------------
  256. // Alpha Compositing mode constants
  257. //--------------------------------------------------------------------------
  258.  
  259. type
  260. TGPCompositingMode = (
  261. CompositingModeSourceOver, // 0
  262. CompositingModeSourceCopy); // 1
  263.  
  264. //--------------------------------------------------------------------------
  265. // Alpha Compositing quality constants
  266. //--------------------------------------------------------------------------
  267.  
  268. type
  269. TGPCompositingQuality = (
  270. CompositingQualityInvalid = Ord(QualityModeInvalid),
  271. CompositingQualityDefault = Ord(QualityModeDefault),
  272. CompositingQualityHighSpeed = Ord(QualityModeLow),
  273. CompositingQualityHighQuality = Ord(QualityModeHigh),
  274. CompositingQualityGammaCorrected,
  275. CompositingQualityAssumeLinear);
  276.  
  277. //--------------------------------------------------------------------------
  278. // Unit constants
  279. //--------------------------------------------------------------------------
  280.  
  281. type
  282. TGPUnit = (
  283. UnitWorld, // 0 -- World coordinate (non-physical unit)
  284. UnitDisplay, // 1 -- Variable -- for PageTransform only
  285. UnitPixel, // 2 -- Each unit is one device pixel.
  286. UnitPoint, // 3 -- Each unit is a printer's point, or 1/72 inch.
  287. UnitInch, // 4 -- Each unit is 1 inch.
  288. UnitDocument, // 5 -- Each unit is 1/300 inch.
  289. UnitMillimeter); // 6 -- Each unit is 1 millimeter.
  290.  
  291. //--------------------------------------------------------------------------
  292. // MetafileFrameUnit
  293. //
  294. // The frameRect for creating a metafile can be specified in any of these
  295. // units. There is an extra frame unit value (MetafileFrameUnitGdi) so
  296. // that units can be supplied in the same units that GDI expects for
  297. // frame rects -- these units are in .01 (1/100ths) millimeter units
  298. // as defined by GDI.
  299. //--------------------------------------------------------------------------
  300.  
  301. type
  302. TGPMetafileFrameUnit = (
  303. MetafileFrameUnitPixel = Ord(UnitPixel),
  304. MetafileFrameUnitPoint = Ord(UnitPoint),
  305. MetafileFrameUnitInch = Ord(UnitInch),
  306. MetafileFrameUnitDocument = Ord(UnitDocument),
  307. MetafileFrameUnitMillimeter = Ord(UnitMillimeter),
  308. MetafileFrameUnitGdi); // GDI compatible .01 MM units
  309.  
  310. //--------------------------------------------------------------------------
  311. // Coordinate space identifiers
  312. //--------------------------------------------------------------------------
  313.  
  314. type
  315. TGPCoordinateSpace = (
  316. CoordinateSpaceWorld, // 0
  317. CoordinateSpacePage, // 1
  318. CoordinateSpaceDevice); // 2
  319.  
  320. //--------------------------------------------------------------------------
  321. // Various wrap modes for brushes
  322. //--------------------------------------------------------------------------
  323.  
  324. type
  325. TGPWrapMode = (
  326. WrapModeTile, // 0
  327. WrapModeTileFlipX, // 1
  328. WrapModeTileFlipY, // 2
  329. WrapModeTileFlipXY, // 3
  330. WrapModeClamp); // 4
  331.  
  332. //--------------------------------------------------------------------------
  333. // Various hatch styles
  334. //--------------------------------------------------------------------------
  335.  
  336. type
  337. TGPHatchStyle = (
  338. HatchStyleHorizontal, // 0
  339. HatchStyleVertical, // 1
  340. HatchStyleForwardDiagonal, // 2
  341. HatchStyleBackwardDiagonal, // 3
  342. HatchStyleCross, // 4
  343. HatchStyleDiagonalCross, // 5
  344. HatchStyle05Percent, // 6
  345. HatchStyle10Percent, // 7
  346. HatchStyle20Percent, // 8
  347. HatchStyle25Percent, // 9
  348. HatchStyle30Percent, // 10
  349. HatchStyle40Percent, // 11
  350. HatchStyle50Percent, // 12
  351. HatchStyle60Percent, // 13
  352. HatchStyle70Percent, // 14
  353. HatchStyle75Percent, // 15
  354. HatchStyle80Percent, // 16
  355. HatchStyle90Percent, // 17
  356. HatchStyleLightDownwardDiagonal, // 18
  357. HatchStyleLightUpwardDiagonal, // 19
  358. HatchStyleDarkDownwardDiagonal, // 20
  359. HatchStyleDarkUpwardDiagonal, // 21
  360. HatchStyleWideDownwardDiagonal, // 22
  361. HatchStyleWideUpwardDiagonal, // 23
  362. HatchStyleLightVertical, // 24
  363. HatchStyleLightHorizontal, // 25
  364. HatchStyleNarrowVertical, // 26
  365. HatchStyleNarrowHorizontal, // 27
  366. HatchStyleDarkVertical, // 28
  367. HatchStyleDarkHorizontal, // 29
  368. HatchStyleDashedDownwardDiagonal, // 30
  369. HatchStyleDashedUpwardDiagonal, // 31
  370. HatchStyleDashedHorizontal, // 32
  371. HatchStyleDashedVertical, // 33
  372. HatchStyleSmallConfetti, // 34
  373. HatchStyleLargeConfetti, // 35
  374. HatchStyleZigZag, // 36
  375. HatchStyleWave, // 37
  376. HatchStyleDiagonalBrick, // 38
  377. HatchStyleHorizontalBrick, // 39
  378. HatchStyleWeave, // 40
  379. HatchStylePlaid, // 41
  380. HatchStyleDivot, // 42
  381. HatchStyleDottedGrid, // 43
  382. HatchStyleDottedDiamond, // 44
  383. HatchStyleShingle, // 45
  384. HatchStyleTrellis, // 46
  385. HatchStyleSphere, // 47
  386. HatchStyleSmallGrid, // 48
  387. HatchStyleSmallCheckerBoard, // 49
  388. HatchStyleLargeCheckerBoard, // 50
  389. HatchStyleOutlinedDiamond, // 51
  390. HatchStyleSolidDiamond, // 52
  391.  
  392. HatchStyleTotal,
  393. HatchStyleLargeGrid = HatchStyleCross, // 4
  394.  
  395. HatchStyleMin = HatchStyleHorizontal,
  396. HatchStyleMax = HatchStyleTotal - 1);
  397.  
  398. //--------------------------------------------------------------------------
  399. // Dash style constants
  400. //--------------------------------------------------------------------------
  401.  
  402. type
  403. TGPDashStyle = (
  404. DashStyleSolid, // 0
  405. DashStyleDash, // 1
  406. DashStyleDot, // 2
  407. DashStyleDashDot, // 3
  408. DashStyleDashDotDot, // 4
  409. DashStyleCustom); // 5
  410.  
  411. //--------------------------------------------------------------------------
  412. // Dash cap constants
  413. //--------------------------------------------------------------------------
  414.  
  415. type
  416. TGPDashCap = (
  417. DashCapFlat = 0,
  418. DashCapRound = 2,
  419. DashCapTriangle = 3);
  420.  
  421. //--------------------------------------------------------------------------
  422. // Line cap constants (only the lowest 8 bits are used).
  423. //--------------------------------------------------------------------------
  424.  
  425. type
  426. TGPLineCap = (
  427. LineCapFlat = 0,
  428. LineCapSquare = 1,
  429. LineCapRound = 2,
  430. LineCapTriangle = 3,
  431.  
  432. LineCapNoAnchor = $10, // corresponds to flat cap
  433. LineCapSquareAnchor = $11, // corresponds to square cap
  434. LineCapRoundAnchor = $12, // corresponds to round cap
  435. LineCapDiamondAnchor = $13, // corresponds to triangle cap
  436. LineCapArrowAnchor = $14, // no correspondence
  437.  
  438. LineCapCustom = $ff, // custom cap
  439.  
  440. LineCapAnchorMask = $f0); // mask to check for anchor or not.
  441.  
  442. //--------------------------------------------------------------------------
  443. // Custom Line cap type constants
  444. //--------------------------------------------------------------------------
  445.  
  446. type
  447. TGPCustomLineCapType = (
  448. CustomLineCapTypeDefault = 0,
  449. CustomLineCapTypeAdjustableArrow = 1);
  450.  
  451. //--------------------------------------------------------------------------
  452. // Line join constants
  453. //--------------------------------------------------------------------------
  454.  
  455. type
  456. TGPLineJoin = (
  457. LineJoinMiter = 0,
  458. LineJoinBevel = 1,
  459. LineJoinRound = 2,
  460. LineJoinMiterClipped = 3);
  461.  
  462. //--------------------------------------------------------------------------
  463. // Path point types (only the lowest 8 bits are used.)
  464. // The lowest 3 bits are interpreted as point type
  465. // The higher 5 bits are reserved for flags.
  466. //--------------------------------------------------------------------------
  467.  
  468. type
  469. TGPPathPointType = (
  470. PathPointTypeStart = 0, // move
  471. PathPointTypeLine = 1, // line
  472. PathPointTypeBezier = 3, // default Bezier (= cubic Bezier)
  473. PathPointTypePathTypeMask = $07, // type mask (lowest 3 bits).
  474. PathPointTypeDashMode = $10, // currently in dash mode.
  475. PathPointTypePathMarker = $20, // a marker for the path.
  476. PathPointTypeCloseSubpath = $80, // closed flag
  477.  
  478. // Path types used for advanced path.
  479.  
  480. PathPointTypeBezier3 = 3); // cubic Bezier
  481.  
  482. //--------------------------------------------------------------------------
  483. // WarpMode constants
  484. //--------------------------------------------------------------------------
  485.  
  486. type
  487. TGPWarpMode = (
  488. WarpModePerspective, // 0
  489. WarpModeBilinear); // 1
  490.  
  491. //--------------------------------------------------------------------------
  492. // LineGradient Mode
  493. //--------------------------------------------------------------------------
  494.  
  495. type
  496. TGPLinearGradientMode = (
  497. LinearGradientModeHorizontal, // 0
  498. LinearGradientModeVertical, // 1
  499. LinearGradientModeForwardDiagonal, // 2
  500. LinearGradientModeBackwardDiagonal); // 3
  501.  
  502. //--------------------------------------------------------------------------
  503. // Region Comine Modes
  504. //--------------------------------------------------------------------------
  505.  
  506. type
  507. TGPCombineMode = (
  508. CombineModeReplace, // 0
  509. CombineModeIntersect, // 1
  510. CombineModeUnion, // 2
  511. CombineModeXor, // 3
  512. CombineModeExclude, // 4
  513. CombineModeComplement); // 5 (Exclude From)
  514.  
  515. //--------------------------------------------------------------------------
  516. // Image types
  517. //--------------------------------------------------------------------------
  518.  
  519. type
  520. TGPImageType = (
  521. ImageTypeUnknown, // 0
  522. ImageTypeBitmap, // 1
  523. ImageTypeMetafile); // 2
  524.  
  525. //--------------------------------------------------------------------------
  526. // Interpolation modes
  527. //--------------------------------------------------------------------------
  528.  
  529. type
  530. TGPInterpolationMode = (
  531. InterpolationModeInvalid = Ord(QualityModeInvalid),
  532. InterpolationModeDefault = Ord(QualityModeDefault),
  533. InterpolationModeLowQuality = Ord(QualityModeLow),
  534. InterpolationModeHighQuality = Ord(QualityModeHigh),
  535. InterpolationModeBilinear,
  536. InterpolationModeBicubic,
  537. InterpolationModeNearestNeighbor,
  538. InterpolationModeHighQualityBilinear,
  539. InterpolationModeHighQualityBicubic);
  540.  
  541. //--------------------------------------------------------------------------
  542. // Pen types
  543. //--------------------------------------------------------------------------
  544.  
  545. type
  546. TGPPenAlignment = (
  547. PenAlignmentCenter = 0,
  548. PenAlignmentInset = 1);
  549.  
  550. //--------------------------------------------------------------------------
  551. // Brush types
  552. //--------------------------------------------------------------------------
  553.  
  554. type
  555. TGPBrushType = (
  556. BrushTypeSolidColor = 0,
  557. BrushTypeHatchFill = 1,
  558. BrushTypeTextureFill = 2,
  559. BrushTypePathGradient = 3,
  560. BrushTypeLinearGradient = 4);
  561.  
  562. //--------------------------------------------------------------------------
  563. // Pen's Fill types
  564. //--------------------------------------------------------------------------
  565.  
  566. type
  567. TGPPenType = (
  568. PenTypeSolidColor = Ord(BrushTypeSolidColor),
  569. PenTypeHatchFill = Ord(BrushTypeHatchFill),
  570. PenTypeTextureFill = Ord(BrushTypeTextureFill),
  571. PenTypePathGradient = Ord(BrushTypePathGradient),
  572. PenTypeLinearGradient = Ord(BrushTypeLinearGradient),
  573. PenTypeUnknown = -1);
  574.  
  575. //--------------------------------------------------------------------------
  576. // Matrix Order
  577. //--------------------------------------------------------------------------
  578.  
  579. type
  580. TGPMatrixOrder = (
  581. MatrixOrderPrepend = 0,
  582. MatrixOrderAppend = 1);
  583.  
  584. //--------------------------------------------------------------------------
  585. // Generic font families
  586. //--------------------------------------------------------------------------
  587.  
  588. type
  589. TGPGenericFontFamily = (
  590. GenericFontFamilySerif,
  591. GenericFontFamilySansSerif,
  592. GenericFontFamilyMonospace);
  593.  
  594. //--------------------------------------------------------------------------
  595. // FontStyle: face types and common styles
  596. //--------------------------------------------------------------------------
  597.  
  598. type
  599. TGPFontStyleEntry = (
  600. FontStyleBold = 0,
  601. FontStyleItalic = 1,
  602. FontStyleUnderline = 2,
  603. FontStyleStrikeout = 3,
  604. FontStyleReserved = 31);
  605.  
  606. TGPFontStyle = set of TGPFontStyleEntry;
  607.  
  608. const
  609. FontStyleRegular = [];
  610. FontStyleBoldItalic = [FontStyleBold, FontStyleItalic];
  611.  
  612. //---------------------------------------------------------------------------
  613. // Smoothing Mode
  614. //---------------------------------------------------------------------------
  615.  
  616. type
  617. TGPSmoothingMode = (
  618. SmoothingModeInvalid = Ord(QualityModeInvalid),
  619. SmoothingModeDefault = Ord(QualityModeDefault),
  620. SmoothingModeHighSpeed = Ord(QualityModeLow),
  621. SmoothingModeHighQuality = Ord(QualityModeHigh),
  622. SmoothingModeNone,
  623. SmoothingModeAntiAlias
  624. {$IF (GDIPVER >= $0110)}
  625. ,
  626. SmoothingModeAntiAlias8x4 = Ord(SmoothingModeAntiAlias),
  627. SmoothingModeAntiAlias8x8
  628. {$IFEND}
  629. );
  630.  
  631. //---------------------------------------------------------------------------
  632. // Pixel Format Mode
  633. //---------------------------------------------------------------------------
  634.  
  635. type
  636. TGPPixelOffsetMode = (
  637. PixelOffsetModeInvalid = Ord(QualityModeInvalid),
  638. PixelOffsetModeDefault = Ord(QualityModeDefault),
  639. PixelOffsetModeHighSpeed = Ord(QualityModeLow),
  640. PixelOffsetModeHighQuality = Ord(QualityModeHigh),
  641. PixelOffsetModeNone, // No pixel offset
  642. PixelOffsetModeHalf); // Offset by -0.5, -0.5 for fast anti-alias perf
  643.  
  644. //---------------------------------------------------------------------------
  645. // Text Rendering Hint
  646. //---------------------------------------------------------------------------
  647.  
  648. type
  649. TGPTextRenderingHint = (
  650. TextRenderingHintSystemDefault = 0, // Glyph with system default rendering hint
  651. TextRenderingHintSingleBitPerPixelGridFit, // Glyph bitmap with hinting
  652. TextRenderingHintSingleBitPerPixel, // Glyph bitmap without hinting
  653. TextRenderingHintAntiAliasGridFit, // Glyph anti-alias bitmap with hinting
  654. TextRenderingHintAntiAlias, // Glyph anti-alias bitmap without hinting
  655. TextRenderingHintClearTypeGridFit); // Glyph CT bitmap with hinting
  656.  
  657. //---------------------------------------------------------------------------
  658. // Metafile Types
  659. //---------------------------------------------------------------------------
  660.  
  661. type
  662. TGPMetafileType = (
  663. MetafileTypeInvalid, // Invalid metafile
  664. MetafileTypeWmf, // Standard WMF
  665. MetafileTypeWmfPlaceable, // Placeable WMF
  666. MetafileTypeEmf, // EMF (not EMF+)
  667. MetafileTypeEmfPlusOnly, // EMF+ without dual, down-level records
  668. MetafileTypeEmfPlusDual); // EMF+ with dual, down-level records
  669.  
  670. //---------------------------------------------------------------------------
  671. // Specifies the type of EMF to record
  672. //---------------------------------------------------------------------------
  673.  
  674. type
  675. TGPEmfType = (
  676. EmfTypeEmfOnly = Ord(MetafileTypeEmf), // no EMF+, only EMF
  677. EmfTypeEmfPlusOnly = Ord(MetafileTypeEmfPlusOnly), // no EMF, only EMF+
  678. EmfTypeEmfPlusDual = Ord(MetafileTypeEmfPlusDual)); // both EMF+ and EMF
  679.  
  680. //---------------------------------------------------------------------------
  681. // EMF+ Persistent object types
  682. //---------------------------------------------------------------------------
  683.  
  684. type
  685. TGPObjectType = (
  686. ObjectTypeInvalid,
  687. ObjectTypeBrush,
  688. ObjectTypePen,
  689. ObjectTypePath,
  690. ObjectTypeRegion,
  691. ObjectTypeImage,
  692. ObjectTypeFont,
  693. ObjectTypeStringFormat,
  694. ObjectTypeImageAttributes,
  695. ObjectTypeCustomLineCap,
  696. {$IF (GDIPVER >= $0110)}
  697. ObjectTypeGraphics,
  698.  
  699. ObjectTypeMax = ObjectTypeGraphics,
  700. {$ELSE}
  701. ObjectTypeMax = ObjectTypeCustomLineCap,
  702. {$IFEND}
  703. ObjectTypeMin = ObjectTypeBrush);
  704.  
  705. function ObjectTypeIsValid(const ObjectType: TGPObjectType): Boolean; inline;
  706.  
  707. //---------------------------------------------------------------------------
  708. // EMF+ Records
  709. //---------------------------------------------------------------------------
  710.  
  711. // We have to change the WMF record numbers so that they don't conflict with
  712. // the EMF and EMF+ record numbers.
  713.  
  714. const
  715. GDIP_EMFPLUS_RECORD_BASE = $00004000;
  716. GDIP_WMF_RECORD_BASE = $00010000;
  717. // GDIP_WMF_RECORD_TO_EMFPLUS(n) ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
  718. // GDIP_EMFPLUS_RECORD_TO_WMF(n) ((n) & (~GDIP_WMF_RECORD_BASE))
  719. // GDIP_IS_WMF_RECORDTYPE(n) (((n) & GDIP_WMF_RECORD_BASE) != 0)
  720.  
  721. type
  722. TEmfPlusRecordType = (
  723. // Since we have to enumerate GDI records right along with GDI+ records,
  724. // We list all the GDI records here so that they can be part of the
  725. // same enumeration type which is used in the enumeration callback.
  726.  
  727. WmfRecordTypeSetBkColor = GDIP_WMF_RECORD_BASE or META_SETBKCOLOR,
  728. WmfRecordTypeSetBkMode = GDIP_WMF_RECORD_BASE or META_SETBKMODE,
  729. WmfRecordTypeSetMapMode = GDIP_WMF_RECORD_BASE or META_SETMAPMODE,
  730. WmfRecordTypeSetROP2 = GDIP_WMF_RECORD_BASE or META_SETROP2,
  731. WmfRecordTypeSetRelAbs = GDIP_WMF_RECORD_BASE or META_SETRELABS,
  732. WmfRecordTypeSetPolyFillMode = GDIP_WMF_RECORD_BASE or META_SETPOLYFILLMODE,
  733. WmfRecordTypeSetStretchBltMode = GDIP_WMF_RECORD_BASE or META_SETSTRETCHBLTMODE,
  734. WmfRecordTypeSetTextCharExtra = GDIP_WMF_RECORD_BASE or META_SETTEXTCHAREXTRA,
  735. WmfRecordTypeSetTextColor = GDIP_WMF_RECORD_BASE or META_SETTEXTCOLOR,
  736. WmfRecordTypeSetTextJustification = GDIP_WMF_RECORD_BASE or META_SETTEXTJUSTIFICATION,
  737. WmfRecordTypeSetWindowOrg = GDIP_WMF_RECORD_BASE or META_SETWINDOWORG,
  738. WmfRecordTypeSetWindowExt = GDIP_WMF_RECORD_BASE or META_SETWINDOWEXT,
  739. WmfRecordTypeSetViewportOrg = GDIP_WMF_RECORD_BASE or META_SETVIEWPORTORG,
  740. WmfRecordTypeSetViewportExt = GDIP_WMF_RECORD_BASE or META_SETVIEWPORTEXT,
  741. WmfRecordTypeOffsetWindowOrg = GDIP_WMF_RECORD_BASE or META_OFFSETWINDOWORG,
  742. WmfRecordTypeScaleWindowExt = GDIP_WMF_RECORD_BASE or META_SCALEWINDOWEXT,
  743. WmfRecordTypeOffsetViewportOrg = GDIP_WMF_RECORD_BASE or META_OFFSETVIEWPORTORG,
  744. WmfRecordTypeScaleViewportExt = GDIP_WMF_RECORD_BASE or META_SCALEVIEWPORTEXT,
  745. WmfRecordTypeLineTo = GDIP_WMF_RECORD_BASE or META_LINETO,
  746. WmfRecordTypeMoveTo = GDIP_WMF_RECORD_BASE or META_MOVETO,
  747. WmfRecordTypeExcludeClipRect = GDIP_WMF_RECORD_BASE or META_EXCLUDECLIPRECT,
  748. WmfRecordTypeIntersectClipRect = GDIP_WMF_RECORD_BASE or META_INTERSECTCLIPRECT,
  749. WmfRecordTypeArc = GDIP_WMF_RECORD_BASE or META_ARC,
  750. WmfRecordTypeEllipse = GDIP_WMF_RECORD_BASE or META_ELLIPSE,
  751. WmfRecordTypeFloodFill = GDIP_WMF_RECORD_BASE or META_FLOODFILL,
  752. WmfRecordTypePie = GDIP_WMF_RECORD_BASE or META_PIE,
  753. WmfRecordTypeRectangle = GDIP_WMF_RECORD_BASE or META_RECTANGLE,
  754. WmfRecordTypeRoundRect = GDIP_WMF_RECORD_BASE or META_ROUNDRECT,
  755. WmfRecordTypePatBlt = GDIP_WMF_RECORD_BASE or META_PATBLT,
  756. WmfRecordTypeSaveDC = GDIP_WMF_RECORD_BASE or META_SAVEDC,
  757. WmfRecordTypeSetPixel = GDIP_WMF_RECORD_BASE or META_SETPIXEL,
  758. WmfRecordTypeOffsetClipRgn = GDIP_WMF_RECORD_BASE or META_OFFSETCLIPRGN,
  759. WmfRecordTypeTextOut = GDIP_WMF_RECORD_BASE or META_TEXTOUT,
  760. WmfRecordTypeBitBlt = GDIP_WMF_RECORD_BASE or META_BITBLT,
  761. WmfRecordTypeStretchBlt = GDIP_WMF_RECORD_BASE or META_STRETCHBLT,
  762. WmfRecordTypePolygon = GDIP_WMF_RECORD_BASE or META_POLYGON,
  763. WmfRecordTypePolyline = GDIP_WMF_RECORD_BASE or META_POLYLINE,
  764. WmfRecordTypeEscape = GDIP_WMF_RECORD_BASE or META_ESCAPE,
  765. WmfRecordTypeRestoreDC = GDIP_WMF_RECORD_BASE or META_RESTOREDC,
  766. WmfRecordTypeFillRegion = GDIP_WMF_RECORD_BASE or META_FILLREGION,
  767. WmfRecordTypeFrameRegion = GDIP_WMF_RECORD_BASE or META_FRAMEREGION,
  768. WmfRecordTypeInvertRegion = GDIP_WMF_RECORD_BASE or META_INVERTREGION,
  769. WmfRecordTypePaintRegion = GDIP_WMF_RECORD_BASE or META_PAINTREGION,
  770. WmfRecordTypeSelectClipRegion = GDIP_WMF_RECORD_BASE or META_SELECTCLIPREGION,
  771. WmfRecordTypeSelectObject = GDIP_WMF_RECORD_BASE or META_SELECTOBJECT,
  772. WmfRecordTypeSetTextAlign = GDIP_WMF_RECORD_BASE or META_SETTEXTALIGN,
  773. WmfRecordTypeDrawText = GDIP_WMF_RECORD_BASE or $062F, // META_DRAWTEXT
  774. WmfRecordTypeChord = GDIP_WMF_RECORD_BASE or META_CHORD,
  775. WmfRecordTypeSetMapperFlags = GDIP_WMF_RECORD_BASE or META_SETMAPPERFLAGS,
  776. WmfRecordTypeExtTextOut = GDIP_WMF_RECORD_BASE or META_EXTTEXTOUT,
  777. WmfRecordTypeSetDIBToDev = GDIP_WMF_RECORD_BASE or META_SETDIBTODEV,
  778. WmfRecordTypeSelectPalette = GDIP_WMF_RECORD_BASE or META_SELECTPALETTE,
  779. WmfRecordTypeRealizePalette = GDIP_WMF_RECORD_BASE or META_REALIZEPALETTE,
  780. WmfRecordTypeAnimatePalette = GDIP_WMF_RECORD_BASE or META_ANIMATEPALETTE,
  781. WmfRecordTypeSetPalEntries = GDIP_WMF_RECORD_BASE or META_SETPALENTRIES,
  782. WmfRecordTypePolyPolygon = GDIP_WMF_RECORD_BASE or META_POLYPOLYGON,
  783. WmfRecordTypeResizePalette = GDIP_WMF_RECORD_BASE or META_RESIZEPALETTE,
  784. WmfRecordTypeDIBBitBlt = GDIP_WMF_RECORD_BASE or META_DIBBITBLT,
  785. WmfRecordTypeDIBStretchBlt = GDIP_WMF_RECORD_BASE or META_DIBSTRETCHBLT,
  786. WmfRecordTypeDIBCreatePatternBrush = GDIP_WMF_RECORD_BASE or META_DIBCREATEPATTERNBRUSH,
  787. WmfRecordTypeStretchDIB = GDIP_WMF_RECORD_BASE or META_STRETCHDIB,
  788. WmfRecordTypeExtFloodFill = GDIP_WMF_RECORD_BASE or META_EXTFLOODFILL,
  789. WmfRecordTypeSetLayout = GDIP_WMF_RECORD_BASE or $0149, // META_SETLAYOUT
  790. WmfRecordTypeResetDC = GDIP_WMF_RECORD_BASE or $014C, // META_RESETDC
  791. WmfRecordTypeStartDoc = GDIP_WMF_RECORD_BASE or $014D, // META_STARTDOC
  792. WmfRecordTypeStartPage = GDIP_WMF_RECORD_BASE or $004F, // META_STARTPAGE
  793. WmfRecordTypeEndPage = GDIP_WMF_RECORD_BASE or $0050, // META_ENDPAGE
  794. WmfRecordTypeAbortDoc = GDIP_WMF_RECORD_BASE or $0052, // META_ABORTDOC
  795. WmfRecordTypeEndDoc = GDIP_WMF_RECORD_BASE or $005E, // META_ENDDOC
  796. WmfRecordTypeDeleteObject = GDIP_WMF_RECORD_BASE or META_DELETEOBJECT,
  797. WmfRecordTypeCreatePalette = GDIP_WMF_RECORD_BASE or META_CREATEPALETTE,
  798. WmfRecordTypeCreateBrush = GDIP_WMF_RECORD_BASE or $00F8, // META_CREATEBRUSH
  799. WmfRecordTypeCreatePatternBrush = GDIP_WMF_RECORD_BASE or META_CREATEPATTERNBRUSH,
  800. WmfRecordTypeCreatePenIndirect = GDIP_WMF_RECORD_BASE or META_CREATEPENINDIRECT,
  801. WmfRecordTypeCreateFontIndirect = GDIP_WMF_RECORD_BASE or META_CREATEFONTINDIRECT,
  802. WmfRecordTypeCreateBrushIndirect = GDIP_WMF_RECORD_BASE or META_CREATEBRUSHINDIRECT,
  803. WmfRecordTypeCreateBitmapIndirect = GDIP_WMF_RECORD_BASE or $02FD, // META_CREATEBITMAPINDIRECT
  804. WmfRecordTypeCreateBitmap = GDIP_WMF_RECORD_BASE or $06FE, // META_CREATEBITMAP
  805. WmfRecordTypeCreateRegion = GDIP_WMF_RECORD_BASE or META_CREATEREGION,
  806.  
  807. EmfRecordTypeHeader = EMR_HEADER,
  808. EmfRecordTypePolyBezier = EMR_POLYBEZIER,
  809. EmfRecordTypePolygon = EMR_POLYGON,
  810. EmfRecordTypePolyline = EMR_POLYLINE,
  811. EmfRecordTypePolyBezierTo = EMR_POLYBEZIERTO,
  812. EmfRecordTypePolyLineTo = EMR_POLYLINETO,
  813. EmfRecordTypePolyPolyline = EMR_POLYPOLYLINE,
  814. EmfRecordTypePolyPolygon = EMR_POLYPOLYGON,
  815. EmfRecordTypeSetWindowExtEx = EMR_SETWINDOWEXTEX,
  816. EmfRecordTypeSetWindowOrgEx = EMR_SETWINDOWORGEX,
  817. EmfRecordTypeSetViewportExtEx = EMR_SETVIEWPORTEXTEX,
  818. EmfRecordTypeSetViewportOrgEx = EMR_SETVIEWPORTORGEX,
  819. EmfRecordTypeSetBrushOrgEx = EMR_SETBRUSHORGEX,
  820. EmfRecordTypeEOF = EMR_EOF,
  821. EmfRecordTypeSetPixelV = EMR_SETPIXELV,
  822. EmfRecordTypeSetMapperFlags = EMR_SETMAPPERFLAGS,
  823. EmfRecordTypeSetMapMode = EMR_SETMAPMODE,
  824. EmfRecordTypeSetBkMode = EMR_SETBKMODE,
  825. EmfRecordTypeSetPolyFillMode = EMR_SETPOLYFILLMODE,
  826. EmfRecordTypeSetROP2 = EMR_SETROP2,
  827. EmfRecordTypeSetStretchBltMode = EMR_SETSTRETCHBLTMODE,
  828. EmfRecordTypeSetTextAlign = EMR_SETTEXTALIGN,
  829. EmfRecordTypeSetColorAdjustment = EMR_SETCOLORADJUSTMENT,
  830. EmfRecordTypeSetTextColor = EMR_SETTEXTCOLOR,
  831. EmfRecordTypeSetBkColor = EMR_SETBKCOLOR,
  832. EmfRecordTypeOffsetClipRgn = EMR_OFFSETCLIPRGN,
  833. EmfRecordTypeMoveToEx = EMR_MOVETOEX,
  834. EmfRecordTypeSetMetaRgn = EMR_SETMETARGN,
  835. EmfRecordTypeExcludeClipRect = EMR_EXCLUDECLIPRECT,
  836. EmfRecordTypeIntersectClipRect = EMR_INTERSECTCLIPRECT,
  837. EmfRecordTypeScaleViewportExtEx = EMR_SCALEVIEWPORTEXTEX,
  838. EmfRecordTypeScaleWindowExtEx = EMR_SCALEWINDOWEXTEX,
  839. EmfRecordTypeSaveDC = EMR_SAVEDC,
  840. EmfRecordTypeRestoreDC = EMR_RESTOREDC,
  841. EmfRecordTypeSetWorldTransform = EMR_SETWORLDTRANSFORM,
  842. EmfRecordTypeModifyWorldTransform = EMR_MODIFYWORLDTRANSFORM,
  843. EmfRecordTypeSelectObject = EMR_SELECTOBJECT,
  844. EmfRecordTypeCreatePen = EMR_CREATEPEN,
  845. EmfRecordTypeCreateBrushIndirect = EMR_CREATEBRUSHINDIRECT,
  846. EmfRecordTypeDeleteObject = EMR_DELETEOBJECT,
  847. EmfRecordTypeAngleArc = EMR_ANGLEARC,
  848. EmfRecordTypeEllipse = EMR_ELLIPSE,
  849. EmfRecordTypeRectangle = EMR_RECTANGLE,
  850. EmfRecordTypeRoundRect = EMR_ROUNDRECT,
  851. EmfRecordTypeArc = EMR_ARC,
  852. EmfRecordTypeChord = EMR_CHORD,
  853. EmfRecordTypePie = EMR_PIE,
  854. EmfRecordTypeSelectPalette = EMR_SELECTPALETTE,
  855. EmfRecordTypeCreatePalette = EMR_CREATEPALETTE,
  856. EmfRecordTypeSetPaletteEntries = EMR_SETPALETTEENTRIES,
  857. EmfRecordTypeResizePalette = EMR_RESIZEPALETTE,
  858. EmfRecordTypeRealizePalette = EMR_REALIZEPALETTE,
  859. EmfRecordTypeExtFloodFill = EMR_EXTFLOODFILL,
  860. EmfRecordTypeLineTo = EMR_LINETO,
  861. EmfRecordTypeArcTo = EMR_ARCTO,
  862. EmfRecordTypePolyDraw = EMR_POLYDRAW,
  863. EmfRecordTypeSetArcDirection = EMR_SETARCDIRECTION,
  864. EmfRecordTypeSetMiterLimit = EMR_SETMITERLIMIT,
  865. EmfRecordTypeBeginPath = EMR_BEGINPATH,
  866. EmfRecordTypeEndPath = EMR_ENDPATH,
  867. EmfRecordTypeCloseFigure = EMR_CLOSEFIGURE,
  868. EmfRecordTypeFillPath = EMR_FILLPATH,
  869. EmfRecordTypeStrokeAndFillPath = EMR_STROKEANDFILLPATH,
  870. EmfRecordTypeStrokePath = EMR_STROKEPATH,
  871. EmfRecordTypeFlattenPath = EMR_FLATTENPATH,
  872. EmfRecordTypeWidenPath = EMR_WIDENPATH,
  873. EmfRecordTypeSelectClipPath = EMR_SELECTCLIPPATH,
  874. EmfRecordTypeAbortPath = EMR_ABORTPATH,
  875. EmfRecordTypeReserved_069 = 69, // Not Used
  876. EmfRecordTypeGdiComment = EMR_GDICOMMENT,
  877. EmfRecordTypeFillRgn = EMR_FILLRGN,
  878. EmfRecordTypeFrameRgn = EMR_FRAMERGN,
  879. EmfRecordTypeInvertRgn = EMR_INVERTRGN,
  880. EmfRecordTypePaintRgn = EMR_PAINTRGN,
  881. EmfRecordTypeExtSelectClipRgn = EMR_EXTSELECTCLIPRGN,
  882. EmfRecordTypeBitBlt = EMR_BITBLT,
  883. EmfRecordTypeStretchBlt = EMR_STRETCHBLT,
  884. EmfRecordTypeMaskBlt = EMR_MASKBLT,
  885. EmfRecordTypePlgBlt = EMR_PLGBLT,
  886. EmfRecordTypeSetDIBitsToDevice = EMR_SETDIBITSTODEVICE,
  887. EmfRecordTypeStretchDIBits = EMR_STRETCHDIBITS,
  888. EmfRecordTypeExtCreateFontIndirect = EMR_EXTCREATEFONTINDIRECTW,
  889. EmfRecordTypeExtTextOutA = EMR_EXTTEXTOUTA,
  890. EmfRecordTypeExtTextOutW = EMR_EXTTEXTOUTW,
  891. EmfRecordTypePolyBezier16 = EMR_POLYBEZIER16,
  892. EmfRecordTypePolygon16 = EMR_POLYGON16,
  893. EmfRecordTypePolyline16 = EMR_POLYLINE16,
  894. EmfRecordTypePolyBezierTo16 = EMR_POLYBEZIERTO16,
  895. EmfRecordTypePolylineTo16 = EMR_POLYLINETO16,
  896. EmfRecordTypePolyPolyline16 = EMR_POLYPOLYLINE16,
  897. EmfRecordTypePolyPolygon16 = EMR_POLYPOLYGON16,
  898. EmfRecordTypePolyDraw16 = EMR_POLYDRAW16,
  899. EmfRecordTypeCreateMonoBrush = EMR_CREATEMONOBRUSH,
  900. EmfRecordTypeCreateDIBPatternBrushPt = EMR_CREATEDIBPATTERNBRUSHPT,
  901. EmfRecordTypeExtCreatePen = EMR_EXTCREATEPEN,
  902. EmfRecordTypePolyTextOutA = EMR_POLYTEXTOUTA,
  903. EmfRecordTypePolyTextOutW = EMR_POLYTEXTOUTW,
  904. EmfRecordTypeSetICMMode = 98, // EMR_SETICMMODE,
  905. EmfRecordTypeCreateColorSpace = 99, // EMR_CREATECOLORSPACE,
  906. EmfRecordTypeSetColorSpace = 100, // EMR_SETCOLORSPACE,
  907. EmfRecordTypeDeleteColorSpace = 101, // EMR_DELETECOLORSPACE,
  908. EmfRecordTypeGLSRecord = 102, // EMR_GLSRECORD,
  909. EmfRecordTypeGLSBoundedRecord = 103, // EMR_GLSBOUNDEDRECORD,
  910. EmfRecordTypePixelFormat = 104, // EMR_PIXELFORMAT,
  911. EmfRecordTypeDrawEscape = 105, // EMR_RESERVED_105,
  912. EmfRecordTypeExtEscape = 106, // EMR_RESERVED_106,
  913. EmfRecordTypeStartDoc = 107, // EMR_RESERVED_107,
  914. EmfRecordTypeSmallTextOut = 108, // EMR_RESERVED_108,
  915. EmfRecordTypeForceUFIMapping = 109, // EMR_RESERVED_109,
  916. EmfRecordTypeNamedEscape = 110, // EMR_RESERVED_110,
  917. EmfRecordTypeColorCorrectPalette = 111, // EMR_COLORCORRECTPALETTE,
  918. EmfRecordTypeSetICMProfileA = 112, // EMR_SETICMPROFILEA,
  919. EmfRecordTypeSetICMProfileW = 113, // EMR_SETICMPROFILEW,
  920. EmfRecordTypeAlphaBlend = 114, // EMR_ALPHABLEND,
  921. EmfRecordTypeSetLayout = 115, // EMR_SETLAYOUT,
  922. EmfRecordTypeTransparentBlt = 116, // EMR_TRANSPARENTBLT,
  923. EmfRecordTypeReserved_117 = 117, // Not Used
  924. EmfRecordTypeGradientFill = 118, // EMR_GRADIENTFILL,
  925. EmfRecordTypeSetLinkedUFIs = 119, // EMR_RESERVED_119,
  926. EmfRecordTypeSetTextJustification = 120, // EMR_RESERVED_120,
  927. EmfRecordTypeColorMatchToTargetW = 121, // EMR_COLORMATCHTOTARGETW,
  928. EmfRecordTypeCreateColorSpaceW = 122, // EMR_CREATECOLORSPACEW,
  929. EmfRecordTypeMax = 122,
  930. EmfRecordTypeMin = 1,
  931.  
  932. // That is the END of the GDI EMF records.
  933.  
  934. // Now we start the list of EMF+ records. We leave quite
  935. // a bit of room here for the addition of any new GDI
  936. // records that may be added later.
  937.  
  938. EmfPlusRecordTypeInvalid = GDIP_EMFPLUS_RECORD_BASE,
  939. EmfPlusRecordTypeHeader,
  940. EmfPlusRecordTypeEndOfFile,
  941.  
  942. EmfPlusRecordTypeComment,
  943.  
  944. EmfPlusRecordTypeGetDC,
  945.  
  946. EmfPlusRecordTypeMultiFormatStart,
  947. EmfPlusRecordTypeMultiFormatSection,
  948. EmfPlusRecordTypeMultiFormatEnd,
  949.  
  950. // For all persistent objects
  951.  
  952. EmfPlusRecordTypeObject,
  953.  
  954. // Drawing Records
  955.  
  956. EmfPlusRecordTypeClear,
  957. EmfPlusRecordTypeFillRects,
  958. EmfPlusRecordTypeDrawRects,
  959. EmfPlusRecordTypeFillPolygon,
  960. EmfPlusRecordTypeDrawLines,
  961. EmfPlusRecordTypeFillEllipse,
  962. EmfPlusRecordTypeDrawEllipse,
  963. EmfPlusRecordTypeFillPie,
  964. EmfPlusRecordTypeDrawPie,
  965. EmfPlusRecordTypeDrawArc,
  966. EmfPlusRecordTypeFillRegion,
  967. EmfPlusRecordTypeFillPath,
  968. EmfPlusRecordTypeDrawPath,
  969. EmfPlusRecordTypeFillClosedCurve,
  970. EmfPlusRecordTypeDrawClosedCurve,
  971. EmfPlusRecordTypeDrawCurve,
  972. EmfPlusRecordTypeDrawBeziers,
  973. EmfPlusRecordTypeDrawImage,
  974. EmfPlusRecordTypeDrawImagePoints,
  975. EmfPlusRecordTypeDrawString,
  976.  
  977. // Graphics State Records
  978.  
  979. EmfPlusRecordTypeSetRenderingOrigin,
  980. EmfPlusRecordTypeSetAntiAliasMode,
  981. EmfPlusRecordTypeSetTextRenderingHint,
  982. EmfPlusRecordTypeSetTextContrast,
  983. EmfPlusRecordTypeSetInterpolationMode,
  984. EmfPlusRecordTypeSetPixelOffsetMode,
  985. EmfPlusRecordTypeSetCompositingMode,
  986. EmfPlusRecordTypeSetCompositingQuality,
  987. EmfPlusRecordTypeSave,
  988. EmfPlusRecordTypeRestore,
  989. EmfPlusRecordTypeBeginContainer,
  990. EmfPlusRecordTypeBeginContainerNoParams,
  991. EmfPlusRecordTypeEndContainer,
  992. EmfPlusRecordTypeSetWorldTransform,
  993. EmfPlusRecordTypeResetWorldTransform,
  994. EmfPlusRecordTypeMultiplyWorldTransform,
  995. EmfPlusRecordTypeTranslateWorldTransform,
  996. EmfPlusRecordTypeScaleWorldTransform,
  997. EmfPlusRecordTypeRotateWorldTransform,
  998. EmfPlusRecordTypeSetPageTransform,
  999. EmfPlusRecordTypeResetClip,
  1000. EmfPlusRecordTypeSetClipRect,
  1001. EmfPlusRecordTypeSetClipPath,
  1002. EmfPlusRecordTypeSetClipRegion,
  1003. EmfPlusRecordTypeOffsetClip,
  1004.  
  1005. EmfPlusRecordTypeDrawDriverString,
  1006. {$IF (GDIPVER >= $0110)}
  1007. EmfPlusRecordTypeStrokeFillPath,
  1008. EmfPlusRecordTypeSerializableObject,
  1009.  
  1010. EmfPlusRecordTypeSetTSGraphics,
  1011. EmfPlusRecordTypeSetTSClip,
  1012. {$IFEND}
  1013. // NOTE: New records *must* be added immediately before this line.
  1014.  
  1015. EmfPlusRecordTotal,
  1016.  
  1017. EmfPlusRecordTypeMax = EmfPlusRecordTotal-1,
  1018. EmfPlusRecordTypeMin = EmfPlusRecordTypeHeader);
  1019.  
  1020. //---------------------------------------------------------------------------
  1021. // StringFormatFlags
  1022. //---------------------------------------------------------------------------
  1023.  
  1024. //---------------------------------------------------------------------------
  1025. // String format flags
  1026. //
  1027. // DirectionRightToLeft - For horizontal text, the reading order is
  1028. // right to left. This value is called
  1029. // the base embedding level by the Unicode
  1030. // bidirectional engine.
  1031. // For vertical text, columns are read from
  1032. // right to left.
  1033. // By default, horizontal or vertical text is
  1034. // read from left to right.
  1035. //
  1036. // DirectionVertical - Individual lines of text are vertical. In
  1037. // each line, characters progress from top to
  1038. // bottom.
  1039. // By default, lines of text are horizontal,
  1040. // each new line below the previous line.
  1041. //
  1042. // NoFitBlackBox - Allows parts of glyphs to overhang the
  1043. // bounding rectangle.
  1044. // By default glyphs are first aligned
  1045. // inside the margines, then any glyphs which
  1046. // still overhang the bounding box are
  1047. // repositioned to avoid any overhang.
  1048. // For example when an italic
  1049. // lower case letter f in a font such as
  1050. // Garamond is aligned at the far left of a
  1051. // rectangle, the lower part of the f will
  1052. // reach slightly further left than the left
  1053. // edge of the rectangle. Setting this flag
  1054. // will ensure the character aligns visually
  1055. // with the lines above and below, but may
  1056. // cause some pixels outside the formatting
  1057. // rectangle to be clipped or painted.
  1058. //
  1059. // DisplayFormatControl - Causes control characters such as the
  1060. // left-to-right mark to be shown in the
  1061. // output with a representative glyph.
  1062. //
  1063. // NoFontFallback - Disables fallback to alternate fonts for
  1064. // characters not supported in the requested
  1065. // font. Any missing characters will be
  1066. // be displayed with the fonts missing glyph,
  1067. // usually an open square.
  1068. //
  1069. // NoWrap - Disables wrapping of text between lines
  1070. // when formatting within a rectangle.
  1071. // NoWrap is implied when a point is passed
  1072. // instead of a rectangle, or when the
  1073. // specified rectangle has a zero line length.
  1074. //
  1075. // NoClip - By default text is clipped to the
  1076. // formatting rectangle. Setting NoClip
  1077. // allows overhanging pixels to affect the
  1078. // device outside the formatting rectangle.
  1079. // Pixels at the end of the line may be
  1080. // affected if the glyphs overhang their
  1081. // cells, and either the NoFitBlackBox flag
  1082. // has been set, or the glyph extends to far
  1083. // to be fitted.
  1084. // Pixels above/before the first line or
  1085. // below/after the last line may be affected
  1086. // if the glyphs extend beyond their cell
  1087. // ascent / descent. This can occur rarely
  1088. // with unusual diacritic mark combinations.
  1089.  
  1090. //---------------------------------------------------------------------------
  1091.  
  1092. type
  1093. TGPStringFormatFlag = (
  1094. StringFormatFlagsDirectionRightToLeft = 0,
  1095. StringFormatFlagsDirectionVertical = 1,
  1096. StringFormatFlagsNoFitBlackBox = 2,
  1097. StringFormatFlagsDisplayFormatControl = 5,
  1098. StringFormatFlagsNoFontFallback = 10,
  1099. StringFormatFlagsMeasureTrailingSpaces = 11,
  1100. StringFormatFlagsNoWrap = 12,
  1101. StringFormatFlagsLineLimit = 13,
  1102.  
  1103. StringFormatFlagsNoClip = 14,
  1104. StringFormatFlagsBypassGDI = 31);
  1105. TGPStringFormatFlags = set of TGPStringFormatFlag;
  1106.  
  1107. //---------------------------------------------------------------------------
  1108. // StringTrimming
  1109. //---------------------------------------------------------------------------
  1110.  
  1111. type
  1112. TGPStringTrimming = (
  1113. StringTrimmingNone = 0,
  1114. StringTrimmingCharacter = 1,
  1115. StringTrimmingWord = 2,
  1116. StringTrimmingEllipsisCharacter = 3,
  1117. StringTrimmingEllipsisWord = 4,
  1118. StringTrimmingEllipsisPath = 5);
  1119.  
  1120. //---------------------------------------------------------------------------
  1121. // National language digit substitution
  1122. //---------------------------------------------------------------------------
  1123.  
  1124. type
  1125. TGPStringDigitSubstitute = (
  1126. StringDigitSubstituteUser = 0, // As NLS setting
  1127. StringDigitSubstituteNone = 1,
  1128. StringDigitSubstituteNational = 2,
  1129. StringDigitSubstituteTraditional = 3);
  1130. PGPStringDigitSubstitute = ^TGPStringDigitSubstitute;
  1131.  
  1132. //---------------------------------------------------------------------------
  1133. // Hotkey prefix interpretation
  1134. //---------------------------------------------------------------------------
  1135.  
  1136. type
  1137. TGPHotkeyPrefix = (
  1138. HotkeyPrefixNone = 0,
  1139. HotkeyPrefixShow = 1,
  1140. HotkeyPrefixHide = 2);
  1141.  
  1142. //---------------------------------------------------------------------------
  1143. // String alignment flags
  1144. //---------------------------------------------------------------------------
  1145.  
  1146. type
  1147. TGPStringAlignment = (
  1148. // Left edge for left-to-right text,
  1149. // right for right-to-left text,
  1150. // and top for vertical
  1151. StringAlignmentNear = 0,
  1152. StringAlignmentCenter = 1,
  1153. StringAlignmentFar = 2);
  1154.  
  1155. //---------------------------------------------------------------------------
  1156. // DriverStringOptions
  1157. //---------------------------------------------------------------------------
  1158.  
  1159. type
  1160. TGPDriverStringOption = (
  1161. DriverStringOptionsCmapLookup = 0,
  1162. DriverStringOptionsVertical = 1,
  1163. DriverStringOptionsRealizedAdvance = 2,
  1164. DriverStringOptionsLimitSubpixel = 3,
  1165. DriverStringOptionsReserved = 31);
  1166. TGPDriverStringOptions = set of TGPDriverStringOption;
  1167.  
  1168. //---------------------------------------------------------------------------
  1169. // Flush Intention flags
  1170. //---------------------------------------------------------------------------
  1171.  
  1172. type
  1173. TGPFlushIntention = (
  1174. FlushIntentionFlush = 0, // Flush all batched rendering operations
  1175. FlushIntentionSync = 1); // Flush all batched rendering operations
  1176. // and wait for them to complete
  1177.  
  1178. //---------------------------------------------------------------------------
  1179. // Image encoder parameter related types
  1180. //---------------------------------------------------------------------------
  1181.  
  1182. type
  1183. TGPEncoderParameterValueType = (
  1184. EncoderParameterValueTypeByte = 1, // 8-bit unsigned int
  1185. EncoderParameterValueTypeASCII = 2, // 8-bit byte containing one 7-bit ASCII
  1186. // code. NULL terminated.
  1187. EncoderParameterValueTypeShort = 3, // 16-bit unsigned int
  1188. EncoderParameterValueTypeLong = 4, // 32-bit unsigned int
  1189. EncoderParameterValueTypeRational = 5, // Two Longs. The first Long is the
  1190. // numerator, the second Long expresses the
  1191. // denomintor.
  1192. EncoderParameterValueTypeLongRange = 6, // Two longs which specify a range of
  1193. // integer values. The first Long specifies
  1194. // the lower end and the second one
  1195. // specifies the higher end. All values
  1196. // are inclusive at both ends
  1197. EncoderParameterValueTypeUndefined = 7, // 8-bit byte that can take any value
  1198. // depending on field definition
  1199. EncoderParameterValueTypeRationalRange = 8 // Two Rationals. The first Rational
  1200. // specifies the lower end and the second
  1201. // specifies the higher end. All values
  1202. // are inclusive at both ends
  1203. {$IF (GDIPVER >= $0110)}
  1204. ,
  1205. EncoderParameterValueTypePointer = 9 // a pointer to a parameter defined data.
  1206. {$IFEND}
  1207. );
  1208.  
  1209. //---------------------------------------------------------------------------
  1210. // Image encoder value types
  1211. //---------------------------------------------------------------------------
  1212.  
  1213. type
  1214. TGPEncoderValue = (
  1215. EncoderValueColorTypeCMYK,
  1216. EncoderValueColorTypeYCCK,
  1217. EncoderValueCompressionLZW,
  1218. EncoderValueCompressionCCITT3,
  1219. EncoderValueCompressionCCITT4,
  1220. EncoderValueCompressionRle,
  1221. EncoderValueCompressionNone,
  1222. EncoderValueScanMethodInterlaced,
  1223. EncoderValueScanMethodNonInterlaced,
  1224. EncoderValueVersionGif87,
  1225. EncoderValueVersionGif89,
  1226. EncoderValueRenderProgressive,
  1227. EncoderValueRenderNonProgressive,
  1228. EncoderValueTransformRotate90,
  1229. EncoderValueTransformRotate180,
  1230. EncoderValueTransformRotate270,
  1231. EncoderValueTransformFlipHorizontal,
  1232. EncoderValueTransformFlipVertical,
  1233. EncoderValueMultiFrame,
  1234. EncoderValueLastFrame,
  1235. EncoderValueFlush,
  1236. EncoderValueFrameDimensionTime,
  1237. EncoderValueFrameDimensionResolution,
  1238. EncoderValueFrameDimensionPage
  1239. {$IF (GDIPVER >= $0110)}
  1240. ,
  1241. EncoderValueColorTypeGray,
  1242. EncoderValueColorTypeRGB
  1243. {$IFEND}
  1244. );
  1245.  
  1246. //---------------------------------------------------------------------------
  1247. // Conversion of Emf To WMF Bits flags
  1248. //---------------------------------------------------------------------------
  1249.  
  1250. type
  1251. TGPEmfToWmfBitsFlag = (
  1252. EmfToWmfBitsFlagsEmbedEmf = 0,
  1253. EmfToWmfBitsFlagsIncludePlaceable = 1,
  1254. EmfToWmfBitsFlagsNoXORClip = 2,
  1255. EmfToWmfBitsFlagsReserved = 31);
  1256. TGPEmfToWmfBitsFlags = set of TGPEmfToWmfBitsFlag;
  1257.  
  1258. const
  1259. EmfToWmfBitsFlagsDefault = [];
  1260.  
  1261. {$IF (GDIPVER >= $0110)}
  1262. //---------------------------------------------------------------------------
  1263. // Conversion of Emf To Emf+ Bits flags
  1264. //---------------------------------------------------------------------------
  1265.  
  1266. type
  1267. TGPConvertToEmfPlusFlags = (
  1268. ConvertToEmfPlusFlagsRopUsed = 0,
  1269. ConvertToEmfPlusFlagsText = 1,
  1270. ConvertToEmfPlusFlagsInvalidRecord = 2);
  1271.  
  1272. const
  1273. ConvertToEmfPlusFlagsDefault = [];
  1274. {$IFEND}
  1275.  
  1276. //---------------------------------------------------------------------------
  1277. // Test Control flags
  1278. //---------------------------------------------------------------------------
  1279.  
  1280. type
  1281. TGPTestControlEnum = (
  1282. TestControlForceBilinear = 0,
  1283. TestControlNoICM = 1,
  1284. TestControlGetBuildNumber = 2);
  1285.  
  1286. {$ENDREGION 'GdiplusEnums.h' }
  1287.  
  1288. {$REGION 'GdiplusTypes.h'}
  1289. (*****************************************************************************
  1290. * GdiplusTypes.h
  1291. * GDI+ Types
  1292. *****************************************************************************)
  1293.  
  1294. //--------------------------------------------------------------------------
  1295. // Callback functions
  1296. //--------------------------------------------------------------------------
  1297.  
  1298. type
  1299. TGPImageAbort = function(CallbackData: Pointer): BOOL; stdcall;
  1300. TGPDrawImageAbort = TGPImageAbort;
  1301. TGPGetThumbnailImageAbort = TGPImageAbort;
  1302.  
  1303. // Callback for EnumerateMetafile methods. The parameters are:
  1304.  
  1305. // recordType WMF, EMF, or EMF+ record type
  1306. // flags (always 0 for WMF/EMF records)
  1307. // dataSize size of the record data (in bytes), or 0 if no data
  1308. // data pointer to the record data, or NULL if no data
  1309. // callbackData pointer to callbackData, if any
  1310.  
  1311. // This method can then call Metafile::PlayRecord to play the
  1312. // record that was just enumerated. If this method returns
  1313. // FALSE, the enumeration process is aborted. Otherwise, it continues.
  1314.  
  1315. type
  1316. TGPEnumerateMetafileProc= function (RecordType: TEmfPlusRecordType;
  1317. Flags, DataSize: UINT; Data: PByte; CallbackData: Pointer): BOOL; stdcall;
  1318.  
  1319. {$IF (GDIPVER >= $0110)}
  1320. // This is the main GDI+ Abort interface
  1321.  
  1322. type
  1323. TGdiplusAbort = record
  1324. Abort: function: HRESULT of object;
  1325. end;
  1326. PGdiplusAbort = ^TGdiplusAbort;
  1327. {$IFEND}
  1328.  
  1329. //--------------------------------------------------------------------------
  1330. // Primitive data types
  1331. //
  1332. // NOTE:
  1333. // Types already defined in standard header files:
  1334. // INT8
  1335. // UINT8
  1336. // INT16
  1337. // UINT16
  1338. // INT32
  1339. // UINT32
  1340. // INT64
  1341. // UINT64
  1342. //
  1343. // Avoid using the following types:
  1344. // LONG - use INT
  1345. // ULONG - use UINT
  1346. // DWORD - use UINT32
  1347. //--------------------------------------------------------------------------
  1348.  
  1349. const
  1350. REAL_MAX = MaxSingle;
  1351. REAL_MIN = MinSingle;
  1352. REAL_TOLERANCE = (MinSingle * 100);
  1353. REAL_EPSILON = 1.192092896e-07; // FLT_EPSILON
  1354.  
  1355. //--------------------------------------------------------------------------
  1356. // Status return values from GDI+ methods
  1357. //--------------------------------------------------------------------------
  1358.  
  1359. type
  1360. TGPStatus = (
  1361. Ok = 0,
  1362. GenericError = 1,
  1363. InvalidParameter = 2,
  1364. OutOfMemory = 3,
  1365. ObjectBusy = 4,
  1366. InsufficientBuffer = 5,
  1367. NotImplemented = 6,
  1368. Win32Error = 7,
  1369. WrongState = 8,
  1370. Aborted = 9,
  1371. FileNotFound = 10,
  1372. ValueOverflow = 11,
  1373. AccessDenied = 12,
  1374. UnknownImageFormat = 13,
  1375. FontFamilyNotFound = 14,
  1376. FontStyleNotFound = 15,
  1377. NotTrueTypeFont = 16,
  1378. UnsupportedGdiplusVersion = 17,
  1379. GdiplusNotInitialized = 18,
  1380. PropertyNotFound = 19,
  1381. PropertyNotSupported = 20
  1382. {$IF (GDIPVER >= $0110)}
  1383. ,
  1384. ProfileNotFound = 21
  1385. {$IFEND}
  1386. );
  1387.  
  1388. //--------------------------------------------------------------------------
  1389. // Represents a dimension in a 2D coordinate system (floating-point coordinates)
  1390. //--------------------------------------------------------------------------
  1391.  
  1392. type
  1393. TGPSizeF = record
  1394. public
  1395. Width: Single;
  1396. Height: Single;
  1397. public
  1398. procedure Initialize; overload;
  1399. procedure Initialize(const Size: TGPSizeF); overload;
  1400. procedure Initialize(const AWidth, AHeight: Single); overload;
  1401. class function Create(const Size: TGPSizeF): TGPSizeF; overload; static;
  1402. class function Create(const AWidth, AHeight: Single): TGPSizeF; overload; static;
  1403. class operator Add(const A, B: TGPSizeF): TGPSizeF;
  1404. class operator Subtract(const A, B: TGPSizeF): TGPSizeF;
  1405. function Empty: Boolean;
  1406. function Equals(const Size: TGPSizeF): Boolean;
  1407. end;
  1408. PGPSizeF = ^TGPSizeF;
  1409.  
  1410. //--------------------------------------------------------------------------
  1411. // Represents a dimension in a 2D coordinate system (integer coordinates)
  1412. //--------------------------------------------------------------------------
  1413.  
  1414. type
  1415. TGPSize = record
  1416. public
  1417. Width: Integer;
  1418. Height: Integer;
  1419. public
  1420. procedure Initialize; overload;
  1421. procedure Initialize(const Size: TGPSize); overload;
  1422. procedure Initialize(const AWidth, AHeight: Integer); overload;
  1423. class function Create(const Size: TGPSize): TGPSize; overload; static;
  1424. class function Create(const AWidth, AHeight: Integer): TGPSize; overload; static;
  1425. class operator Add(const A, B: TGPSize): TGPSize;
  1426. class operator Subtract(const A, B: TGPSize): TGPSize;
  1427. function Empty: Boolean;
  1428. function Equals(const Size: TGPSize): Boolean;
  1429. end;
  1430. PGPSize = ^TGPSize;
  1431.  
  1432. //--------------------------------------------------------------------------
  1433. // Represents a location in a 2D coordinate system (floating-point coordinates)
  1434. //--------------------------------------------------------------------------
  1435.  
  1436. type
  1437. TGPPointF = record
  1438. public
  1439. X: Single;
  1440. Y: Single;
  1441. public
  1442. procedure Initialize; overload;
  1443. procedure Initialize(const Point: TGPPointF); overload;
  1444. procedure Initialize(const Size: TGPSizeF); overload;
  1445. procedure Initialize(const AX, AY: Single); overload;
  1446. class function Create(const Point: TGPPointF): TGPPointF; overload; static;
  1447. class function Create(const Size: TGPSizeF): TGPPointF; overload; static;
  1448. class function Create(const AX, AY: Single): TGPPointF; overload; static;
  1449. class operator Add(const A, B: TGPPointF): TGPPointF;
  1450. class operator Subtract(const A, B: TGPPointF): TGPPointF;
  1451. function Equals(const Point: TGPPointF): Boolean;
  1452. end;
  1453. PGPPointF = ^TGPPointF;
  1454.  
  1455. //--------------------------------------------------------------------------
  1456. // Represents a location in a 2D coordinate system (integer coordinates)
  1457. //--------------------------------------------------------------------------
  1458.  
  1459. type
  1460. TGPPoint = record
  1461. public
  1462. X: Integer;
  1463. Y: Integer;
  1464. public
  1465. procedure Initialize; overload;
  1466. procedure Initialize(const Point: TGPPoint); overload;
  1467. procedure Initialize(const Size: TGPSize); overload;
  1468. procedure Initialize(const AX, AY: Integer); overload;
  1469. class function Create(const Point: TGPPoint): TGPPoint; overload; static;
  1470. class function Create(const Size: TGPSize): TGPPoint; overload; static;
  1471. class function Create(const AX, AY: Integer): TGPPoint; overload; static;
  1472. class operator Add(const A, B: TGPPoint): TGPPoint;
  1473. class operator Subtract(const A, B: TGPPoint): TGPPoint;
  1474. function Equals(const Point: TGPPoint): Boolean;
  1475. end;
  1476. PGPPoint = ^TGPPoint;
  1477.  
  1478. //--------------------------------------------------------------------------
  1479. // Represents a rectangle in a 2D coordinate system (floating-point coordinates)
  1480. //--------------------------------------------------------------------------
  1481.  
  1482. type
  1483. PGPRectF = ^TGPRectF;
  1484. TGPRectF = record
  1485. public
  1486. X: Single;
  1487. Y: Single;
  1488. Width: Single;
  1489. Height: Single;
  1490. private
  1491. function GetLocation: TGPPointF;
  1492. function GetSize: TGPSizeF;
  1493. function GetBounds: TGPRectF;
  1494. function GetRight: Single;
  1495. function GetBottom: Single;
  1496. public
  1497. procedure Initialize; overload;
  1498. procedure Initialize(const AX, AY, AWidth, AHeight: Single); overload;
  1499. procedure Initialize(const Location: TGPPointF; const Size: TGPSizeF); overload;
  1500. procedure InitializeFromLTRB(const Left, Top, Right, Bottom: Single);
  1501. class function Create(const AX, AY, AWidth, AHeight: Single): TGPRectF; overload; static;
  1502. class function Create(const Location: TGPPointF; const Size: TGPSizeF): TGPRectF; overload; static;
  1503. function Clone: TGPRectF;
  1504. function IsEmptyArea: Boolean;
  1505. function Equals(const Rect: TGPRectF): Boolean;
  1506. function Contains(const AX, AY: Single): Boolean; overload;
  1507. function Contains(const Point: TGPPointF): Boolean; overload;
  1508. function Contains(const Rect: TGPRectF): Boolean; overload;
  1509. procedure Inflate(const DX, DY: Single); overload;
  1510. procedure Inflate(const DXY: Single); overload;
  1511. procedure Inflate(const Point: TGPPointF); overload;
  1512. function Intersect(const Rect: TGPRectF): Boolean; overload;
  1513. class function Intersect(out C: TGPRectF; const A, B: TGPRectF): Boolean; overload; static;
  1514. function IntersectsWith(const Rect: TGPRectF): Boolean;
  1515. function Union(const Rect: TGPRectF): Boolean; overload;
  1516. class function Union(out C: TGPRectF; const A, B: TGPRectF): Boolean; overload; static;
  1517. procedure Offset(const Point: TGPPointF); overload;
  1518. procedure Offset(const DX, DY: Single); overload;
  1519.  
  1520. property Location: TGPPointF read GetLocation;
  1521. property Size: TGPSizeF read GetSize;
  1522. property Bounds: TGPRectF read GetBounds;
  1523. property Left: Single read X;
  1524. property Top: Single read Y;
  1525. property Right: Single read GetRight;
  1526. property Bottom: Single read GetBottom;
  1527. end;
  1528.  
  1529. //--------------------------------------------------------------------------
  1530. // Represents a rectangle in a 2D coordinate system (integer coordinates)
  1531. //--------------------------------------------------------------------------
  1532.  
  1533. type
  1534. PGPRect = ^TGPRect;
  1535. TGPRect = record
  1536. public
  1537. X: Integer;
  1538. Y: Integer;
  1539. Width: Integer;
  1540. Height: Integer;
  1541. private
  1542. function GetLocation: TGPPoint;
  1543. function GetSize: TGPSize;
  1544. function GetBounds: TGPRect;
  1545. function GetRight: Integer;
  1546. function GetBottom: Integer;
  1547. public
  1548. procedure Initialize; overload;
  1549. procedure Initialize(const AX, AY, AWidth, AHeight: Integer); overload;
  1550. procedure Initialize(const Location: TGPPoint; const Size: TGPSize); overload;
  1551. procedure Initialize(const Rect: Windows.TRect); overload;
  1552. procedure InitializeFromLTRB(const Left, Top, Right, Bottom: Integer);
  1553. class function Create(const AX, AY, AWidth, AHeight: Integer): TGPRect; overload; static;
  1554. class function Create(const Location: TGPPoint; const Size: TGPSize): TGPRect; overload; static;
  1555. class function Create(const Rect: Windows.TRect): TGPRect; overload; static;
  1556. function Clone: TGPRect;
  1557. function IsEmptyArea: Boolean;
  1558. function Equals(const Rect: TGPRect): Boolean;
  1559. function Contains(const AX, AY: Integer): Boolean; overload;
  1560. function Contains(const Point: TGPPoint): Boolean; overload;
  1561. function Contains(const Rect: TGPRect): Boolean; overload;
  1562. procedure Inflate(const DX, DY: Integer); overload;
  1563. procedure Inflate(const Point: TGPPoint); overload;
  1564. function Intersect(const Rect: TGPRect): Boolean; overload;
  1565. class function Intersect(out C: TGPRect; const A, B: TGPRect): Boolean; overload; static;
  1566. function IntersectsWith(const Rect: TGPRect): Boolean;
  1567. function Union(const Rect: TGPRect): Boolean; overload;
  1568. class function Union(out C: TGPRect; const A, B: TGPRect): Boolean; overload; static;
  1569. procedure Offset(const Point: TGPPoint); overload;
  1570. procedure Offset(const DX, DY: Integer); overload;
  1571.  
  1572. property Location: TGPPoint read GetLocation;
  1573. property Size: TGPSize read GetSize;
  1574. property Bounds: TGPRect read GetBounds;
  1575. property Left: Integer read X;
  1576. property Top: Integer read Y;
  1577. property Right: Integer read GetRight;
  1578. property Bottom: Integer read GetBottom;
  1579. end;
  1580.  
  1581. type
  1582. TGPNativePathData = record
  1583. Count: Integer;
  1584. Points: PGPPointF;
  1585. Types: PByte;
  1586. end;
  1587. PGPNativePathData = ^TGPNativePathData;
  1588.  
  1589. type
  1590. TGPCharacterRange = record
  1591. public
  1592. First: Integer;
  1593. Length: Integer;
  1594. public
  1595. procedure Initialize; overload;
  1596. procedure Initialize(const AFirst, ALength: Integer); overload;
  1597. end;
  1598. PGPCharacterRange = ^TGPCharacterRange;
  1599.  
  1600. {$ENDREGION 'GdiplusTypes.h'}
  1601.  
  1602. {$REGION 'GdiplusInit.h'}
  1603. (*****************************************************************************
  1604. * GdiplusInit.h
  1605. * GDI+ Startup and Shutdown APIs
  1606. *****************************************************************************)
  1607.  
  1608. type
  1609. TGPDebugEventLevel = (
  1610. DebugEventLevelFatal,
  1611. DebugEventLevelWarning);
  1612.  
  1613. // Callback function that GDI+ can call, on debug builds, for assertions
  1614. // and warnings.
  1615.  
  1616. type
  1617. TGPDebugEventProc = procedure(Level: TGPDebugEventLevel; Message: PAnsiChar); stdcall;
  1618.  
  1619. // Notification functions which the user must call appropriately if
  1620. // "SuppressBackgroundThread" (below) is set.
  1621.  
  1622. type
  1623. TGPNofificationHookProc = function(out Token: ULONG): TGPStatus; stdcall;
  1624. TGPNofificationUnhookProc = procedure(Token: ULONG); stdcall;
  1625.  
  1626. // Input structure for GdiplusStartup()
  1627.  
  1628. type
  1629. TGdiplusStartupInput = record
  1630. public
  1631. GdiplusVersion: UInt32; // Must be 1 (or 2 for the Ex version)
  1632. DebugEventCallback: TGPDebugEventProc; // Ignored on free builds
  1633. SuppressBackgroundThread: BOOL; // FALSE unless you're prepared to call the hook/unhook functions properly
  1634. SuppressExternalCodecs: BOOL; // FALSE unless you want GDI+ only to use its internal image codecs.
  1635. public
  1636. procedure Intialize(const ADebugEventCallback: TGPDebugEventProc = nil;
  1637. const ASuppressBackgroundThread: Boolean = False;
  1638. const ASuppressExternalCodecs: Boolean = False);
  1639. end;
  1640. PGdiplusStartupInput = ^TGdiplusStartupInput;
  1641.  
  1642. {$IF (GDIPVER >= $0110)}
  1643. type
  1644. TGdiplusStartupInputEx = record
  1645. public
  1646. { From TGdiplusStartupInput }
  1647. GdiplusVersion: UInt32;
  1648. DebugEventCallback: TGPDebugEventProc;
  1649. SuppressBackgroundThread: BOOL;
  1650. SuppressExternalCodecs: BOOL;
  1651. { New }
  1652. StartupParameters: Integer; // Do we not set the FPU rounding mode
  1653. public
  1654. procedure Intialize(const AStartupParameters: Integer = 0;
  1655. const ADebugEventCallback: TGPDebugEventProc = nil;
  1656. const ASuppressBackgroundThread: Boolean = False;
  1657. const ASuppressExternalCodecs: Boolean = False);
  1658. end;
  1659. PGdiplusStartupInputEx = ^TGdiplusStartupInputEx;
  1660.  
  1661. const
  1662. GdiplusStartupDefault = 0;
  1663. GdiplusStartupNoSetRound = 1;
  1664. GdiplusStartupSetPSValue = 2;
  1665. GdiplusStartupTransparencyMask = $FF000000;
  1666. {$IFEND}
  1667.  
  1668. // Output structure for GdiplusStartup()
  1669.  
  1670. type
  1671. TGdiplusStartupOutput = record
  1672. // The following 2 fields are NULL if SuppressBackgroundThread is FALSE.
  1673. // Otherwise, they are functions which must be called appropriately to
  1674. // replace the background thread.
  1675. //
  1676. // These should be called on the application's main message loop - i.e.
  1677. // a message loop which is active for the lifetime of GDI+.
  1678. // "NotificationHook" should be called before starting the loop,
  1679. // and "NotificationUnhook" should be called after the loop ends.
  1680. NotificationHook: TGPNofificationHookProc;
  1681. NotificationUnhook: TGPNofificationUnhookProc;
  1682. end;
  1683. PGdiplusStartupOutput = ^TGdiplusStartupOutput;
  1684.  
  1685. // GDI+ initialization. Must not be called from DllMain - can cause deadlock.
  1686. //
  1687. // Must be called before GDI+ API's or constructors are used.
  1688. //
  1689. // token - may not be NULL - accepts a token to be passed in the corresponding
  1690. // GdiplusShutdown call.
  1691. // input - may not be NULL
  1692. // output - may be NULL only if input->SuppressBackgroundThread is FALSE.
  1693.  
  1694. function GdiplusStartup(out Token: ULONG; const Input: PGdiplusStartupInput;
  1695. Output: PGdiplusStartupOutput): TGPStatus; stdcall; external GdiPlusDll;
  1696.  
  1697. // GDI+ termination. Must be called before GDI+ is unloaded.
  1698. // Must not be called from DllMain - can cause deadlock.
  1699. //
  1700. // GDI+ API's may not be called after GdiplusShutdown. Pay careful attention
  1701. // to GDI+ object destructors.
  1702.  
  1703. procedure GdiplusShutdown(Token: ULONG); stdcall; external GdiPlusDll;
  1704. {$ENDREGION 'GdiplusInit.h'}
  1705.  
  1706. {$REGION 'GdiplusPixelFormats.h'}
  1707. (*****************************************************************************
  1708. * GdiplusPixelFormats.h
  1709. * GDI+ Pixel Formats
  1710. *****************************************************************************)
  1711.  
  1712. type
  1713. ARGB = UInt32;
  1714. ARGB64 = UInt64;
  1715. PARGB = ^ARGB;
  1716. PARGB64 = ^ARGB64;
  1717.  
  1718. const
  1719. ALPHA_SHIFT = 24;
  1720. RED_SHIFT = 16;
  1721. GREEN_SHIFT = 8;
  1722. BLUE_SHIFT = 0;
  1723. ALPHA_MASK = ARGB($FF) shl ALPHA_SHIFT;
  1724.  
  1725. // In-memory pixel data formats:
  1726. // bits 0-7 = format index
  1727. // bits 8-15 = pixel size (in bits)
  1728. // bits 16-23 = flags
  1729. // bits 24-31 = reserved
  1730.  
  1731. type
  1732. TGPPixelFormat = Integer;
  1733.  
  1734. const
  1735. PixelFormatIndexed = $00010000; // Indexes into a palette
  1736. PixelFormatGDI = $00020000; // Is a GDI-supported format
  1737. PixelFormatAlpha = $00040000; // Has an alpha component
  1738. PixelFormatPAlpha = $00080000; // Pre-multiplied alpha
  1739. PixelFormatExtended = $00100000; // Extended color 16 bits/channel
  1740. PixelFormatCanonical = $00200000;
  1741.  
  1742. PixelFormatUndefined = 0;
  1743. PixelFormatDontCare = 0;
  1744.  
  1745. PixelFormat1bppIndexed = ( 1 or ( 1 shl 8) or PixelFormatIndexed or PixelFormatGDI);
  1746. PixelFormat4bppIndexed = ( 2 or ( 4 shl 8) or PixelFormatIndexed or PixelFormatGDI);
  1747. PixelFormat8bppIndexed = ( 3 or ( 8 shl 8) or PixelFormatIndexed or PixelFormatGDI);
  1748. PixelFormat16bppGrayScale = ( 4 or (16 shl 8) or PixelFormatExtended);
  1749. PixelFormat16bppRGB555 = ( 5 or (16 shl 8) or PixelFormatGDI);
  1750. PixelFormat16bppRGB565 = ( 6 or (16 shl 8) or PixelFormatGDI);
  1751. PixelFormat16bppARGB1555 = ( 7 or (16 shl 8) or PixelFormatAlpha or PixelFormatGDI);
  1752. PixelFormat24bppRGB = ( 8 or (24 shl 8) or PixelFormatGDI);
  1753. PixelFormat32bppRGB = ( 9 or (32 shl 8) or PixelFormatGDI);
  1754. PixelFormat32bppARGB = (10 or (32 shl 8) or PixelFormatAlpha or PixelFormatGDI or PixelFormatCanonical);
  1755. PixelFormat32bppPARGB = (11 or (32 shl 8) or PixelFormatAlpha or PixelFormatPAlpha or PixelFormatGDI);
  1756. PixelFormat48bppRGB = (12 or (48 shl 8) or PixelFormatExtended);
  1757. PixelFormat64bppARGB = (13 or (64 shl 8) or PixelFormatAlpha or PixelFormatCanonical or PixelFormatExtended);
  1758. PixelFormat64bppPARGB = (14 or (64 shl 8) or PixelFormatAlpha or PixelFormatPAlpha or PixelFormatExtended);
  1759. PixelFormat32bppCMYK = (15 or (32 shl 8));
  1760. PixelFormatMax = 16;
  1761.  
  1762. function GetPixelFormatSize(const PixFmt: TGPPixelFormat): Integer; inline;
  1763. function IsIndexedPixelFormat(const PixFmt: TGPPixelFormat): Boolean; inline;
  1764. function IsAlphaPixelFormat(const PixFmt: TGPPixelFormat): Boolean; inline;
  1765. function IsExtendedPixelFormat(const PixFmt: TGPPixelFormat): Boolean; inline;
  1766.  
  1767. //--------------------------------------------------------------------------
  1768. // Determine if the Pixel Format is Canonical format:
  1769. // PixelFormat32bppARGB
  1770. // PixelFormat32bppPARGB
  1771. // PixelFormat64bppARGB
  1772. // PixelFormat64bppPARGB
  1773. //--------------------------------------------------------------------------
  1774.  
  1775. function IsCanonicalPixelFormat(const PixFmt: TGPPixelFormat): Boolean; inline;
  1776.  
  1777. {$IF (GDIPVER >= $0110)}
  1778. //----------------------------------------------------------------------------
  1779. // Color format conversion parameters
  1780. //----------------------------------------------------------------------------
  1781.  
  1782. type
  1783. TGPPaletteType = (
  1784. // Arbitrary custom palette provided by caller.
  1785.  
  1786. PaletteTypeCustom = 0,
  1787.  
  1788. // Optimal palette generated using a median-cut algorithm.
  1789.  
  1790. PaletteTypeOptimal = 1,
  1791.  
  1792. // Black and white palette.
  1793.  
  1794. PaletteTypeFixedBW = 2,
  1795.  
  1796. // Symmetric halftone palettes.
  1797. // Each of these halftone palettes will be a superset of the system palette.
  1798. // E.g. Halftone8 will have it's 8-color on-off primaries and the 16 system
  1799. // colors added. With duplicates removed, that leaves 16 colors.
  1800.  
  1801. PaletteTypeFixedHalftone8 = 3, // 8-color, on-off primaries
  1802. PaletteTypeFixedHalftone27 = 4, // 3 intensity levels of each color
  1803. PaletteTypeFixedHalftone64 = 5, // 4 intensity levels of each color
  1804. PaletteTypeFixedHalftone125 = 6, // 5 intensity levels of each color
  1805. PaletteTypeFixedHalftone216 = 7, // 6 intensity levels of each color
  1806.  
  1807. // Assymetric halftone palettes.
  1808. // These are somewhat less useful than the symmetric ones, but are
  1809. // included for completeness. These do not include all of the system
  1810. // colors.
  1811.  
  1812. PaletteTypeFixedHalftone252 = 8, // 6-red, 7-green, 6-blue intensities
  1813. PaletteTypeFixedHalftone256 = 9); // 8-red, 8-green, 4-blue intensities
  1814.  
  1815. type
  1816. TGPDitherType = (
  1817. DitherTypeNone = 0,
  1818.  
  1819. // Solid color - picks the nearest matching color with no attempt to
  1820. // halftone or dither. May be used on an arbitrary palette.
  1821.  
  1822. DitherTypeSolid = 1,
  1823.  
  1824. // Ordered dithers and spiral dithers must be used with a fixed palette.
  1825.  
  1826. // NOTE: DitherOrdered4x4 is unique in that it may apply to 16bpp
  1827. // conversions also.
  1828.  
  1829. DitherTypeOrdered4x4 = 2,
  1830.  
  1831. DitherTypeOrdered8x8 = 3,
  1832. DitherTypeOrdered16x16 = 4,
  1833. DitherTypeSpiral4x4 = 5,
  1834. DitherTypeSpiral8x8 = 6,
  1835. DitherTypeDualSpiral4x4 = 7,
  1836. DitherTypeDualSpiral8x8 = 8,
  1837.  
  1838. // Error diffusion. May be used with any palette.
  1839.  
  1840. DitherTypeErrorDiffusion = 9,
  1841.  
  1842. DitherTypeMax = 10);
  1843. {$IFEND}
  1844.  
  1845. type
  1846. TGPPaletteFlag = (
  1847. PaletteFlagsHasAlpha = 0,
  1848. PaletteFlagsGrayScale = 1,
  1849. PaletteFlagsHalftone = 2,
  1850. PaletteFlagsReserved = 31);
  1851. TGPPaletteFlags = set of TGPPaletteFlag;
  1852.  
  1853. type
  1854. TGPNativeColorPalette = record
  1855. public
  1856. Flags: TGPPaletteFlags;
  1857. Count: Integer;
  1858. // Entries: array [0..0] of ARGB;
  1859. end;
  1860. PGPNativeColorPalette = ^TGPNativeColorPalette;
  1861. {$ENDREGION 'GdiplusPixelFormats.h'}
  1862.  
  1863. {$REGION 'GdiplusColor.h'}
  1864. (*****************************************************************************
  1865. * GdiplusColor.h
  1866. * GDI+ Color Object
  1867. *****************************************************************************)
  1868.  
  1869. //----------------------------------------------------------------------------
  1870. // Color mode
  1871. //----------------------------------------------------------------------------
  1872.  
  1873. type
  1874. TGPColorMode = (
  1875. ColorModeARGB32 = 0,
  1876. ColorModeARGB64 = 1);
  1877.  
  1878. //----------------------------------------------------------------------------
  1879. // Color Channel flags
  1880. //----------------------------------------------------------------------------
  1881.  
  1882. type
  1883. TGPColorChannelFlags = (
  1884. ColorChannelFlagsC = 0,
  1885. ColorChannelFlagsM,
  1886. ColorChannelFlagsY,
  1887. ColorChannelFlagsK,
  1888. ColorChannelFlagsLast);
  1889.  
  1890. //----------------------------------------------------------------------------
  1891. // Color
  1892. //----------------------------------------------------------------------------
  1893.  
  1894. type
  1895. TGPColor = record
  1896. private
  1897. FArgb: ARGB;
  1898. private
  1899. function GetAlpha: Byte;
  1900. procedure SetAlpha(const Value: Byte);
  1901. function GetRed: Byte;
  1902. procedure SetRed(const Value: Byte);
  1903. function GetGreen: Byte;
  1904. procedure SetGreen(const Value: Byte);
  1905. function GetBlue: Byte;
  1906. procedure SetBlue(const Value: Byte);
  1907. function GetColorRef: TColorRef;
  1908. procedure SetColorRef(const Value: TColorRef);
  1909. public
  1910. // Common color constants
  1911. const AliceBlue = $FFF0F8FF;
  1912. const AntiqueWhite = $FFFAEBD7;
  1913. const Aqua = $FF00FFFF;
  1914. const Aquamarine = $FF7FFFD4;
  1915. const Azure = $FFF0FFFF;
  1916. const Beige = $FFF5F5DC;
  1917. const Bisque = $FFFFE4C4;
  1918. const Black = $FF000000;
  1919. const BlanchedAlmond = $FFFFEBCD;
  1920. const Blue = $FF0000FF;
  1921. const BlueViolet = $FF8A2BE2;
  1922. const Brown = $FFA52A2A;
  1923. const BurlyWood = $FFDEB887;
  1924. const CadetBlue = $FF5F9EA0;
  1925. const Chartreuse = $FF7FFF00;
  1926. const Chocolate = $FFD2691E;
  1927. const Coral = $FFFF7F50;
  1928. const CornflowerBlue = $FF6495ED;
  1929. const Cornsilk = $FFFFF8DC;
  1930. const Crimson = $FFDC143C;
  1931. const Cyan = $FF00FFFF;
  1932. const DarkBlue = $FF00008B;
  1933. const DarkCyan = $FF008B8B;
  1934. const DarkGoldenrod = $FFB8860B;
  1935. const DarkGray = $FFA9A9A9;
  1936. const DarkGreen = $FF006400;
  1937. const DarkKhaki = $FFBDB76B;
  1938. const DarkMagenta = $FF8B008B;
  1939. const DarkOliveGreen = $FF556B2F;
  1940. const DarkOrange = $FFFF8C00;
  1941. const DarkOrchid = $FF9932CC;
  1942. const DarkRed = $FF8B0000;
  1943. const DarkSalmon = $FFE9967A;
  1944. const DarkSeaGreen = $FF8FBC8B;
  1945. const DarkSlateBlue = $FF483D8B;
  1946. const DarkSlateGray = $FF2F4F4F;
  1947. const DarkTurquoise = $FF00CED1;
  1948. const DarkViolet = $FF9400D3;
  1949. const DeepPink = $FFFF1493;
  1950. const DeepSkyBlue = $FF00BFFF;
  1951. const DimGray = $FF696969;
  1952. const DodgerBlue = $FF1E90FF;
  1953. const Firebrick = $FFB22222;
  1954. const FloralWhite = $FFFFFAF0;
  1955. const ForestGreen = $FF228B22;
  1956. const Fuchsia = $FFFF00FF;
  1957. const Gainsboro = $FFDCDCDC;
  1958. const GhostWhite = $FFF8F8FF;
  1959. const Gold = $FFFFD700;
  1960. const Goldenrod = $FFDAA520;
  1961. const Gray = $FF808080;
  1962. const Green = $FF008000;
  1963. const GreenYellow = $FFADFF2F;
  1964. const Honeydew = $FFF0FFF0;
  1965. const HotPink = $FFFF69B4;
  1966. const IndianRed = $FFCD5C5C;
  1967. const Indigo = $FF4B0082;
  1968. const Ivory = $FFFFFFF0;
  1969. const Khaki = $FFF0E68C;
  1970. const Lavender = $FFE6E6FA;
  1971. const LavenderBlush = $FFFFF0F5;
  1972. const LawnGreen = $FF7CFC00;
  1973. const LemonChiffon = $FFFFFACD;
  1974. const LightBlue = $FFADD8E6;
  1975. const LightCoral = $FFF08080;
  1976. const LightCyan = $FFE0FFFF;
  1977. const LightGoldenrodYellow = $FFFAFAD2;
  1978. const LightGray = $FFD3D3D3;
  1979. const LightGreen = $FF90EE90;
  1980. const LightPink = $FFFFB6C1;
  1981. const LightSalmon = $FFFFA07A;
  1982. const LightSeaGreen = $FF20B2AA;
  1983. const LightSkyBlue = $FF87CEFA;
  1984. const LightSlateGray = $FF778899;
  1985. const LightSteelBlue = $FFB0C4DE;
  1986. const LightYellow = $FFFFFFE0;
  1987. const Lime = $FF00FF00;
  1988. const LimeGreen = $FF32CD32;
  1989. const Linen = $FFFAF0E6;
  1990. const Magenta = $FFFF00FF;
  1991. const Maroon = $FF800000;
  1992. const MediumAquamarine = $FF66CDAA;
  1993. const MediumBlue = $FF0000CD;
  1994. const MediumOrchid = $FFBA55D3;
  1995. const MediumPurple = $FF9370DB;
  1996. const MediumSeaGreen = $FF3CB371;
  1997. const MediumSlateBlue = $FF7B68EE;
  1998. const MediumSpringGreen = $FF00FA9A;
  1999. const MediumTurquoise = $FF48D1CC;
  2000. const MediumVioletRed = $FFC71585;
  2001. const MidnightBlue = $FF191970;
  2002. const MintCream = $FFF5FFFA;
  2003. const MistyRose = $FFFFE4E1;
  2004. const Moccasin = $FFFFE4B5;
  2005. const NavajoWhite = $FFFFDEAD;
  2006. const Navy = $FF000080;
  2007. const OldLace = $FFFDF5E6;
  2008. const Olive = $FF808000;
  2009. const OliveDrab = $FF6B8E23;
  2010. const Orange = $FFFFA500;
  2011. const OrangeRed = $FFFF4500;
  2012. const Orchid = $FFDA70D6;
  2013. const PaleGoldenrod = $FFEEE8AA;
  2014. const PaleGreen = $FF98FB98;
  2015. const PaleTurquoise = $FFAFEEEE;
  2016. const PaleVioletRed = $FFDB7093;
  2017. const PapayaWhip = $FFFFEFD5;
  2018. const PeachPuff = $FFFFDAB9;
  2019. const Peru = $FFCD853F;
  2020. const Pink = $FFFFC0CB;
  2021. const Plum = $FFDDA0DD;
  2022. const PowderBlue = $FFB0E0E6;
  2023. const Purple = $FF800080;
  2024. const Red = $FFFF0000;
  2025. const RosyBrown = $FFBC8F8F;
  2026. const RoyalBlue = $FF4169E1;
  2027. const SaddleBrown = $FF8B4513;
  2028. const Salmon = $FFFA8072;
  2029. const SandyBrown = $FFF4A460;
  2030. const SeaGreen = $FF2E8B57;
  2031. const SeaShell = $FFFFF5EE;
  2032. const Sienna = $FFA0522D;
  2033. const Silver = $FFC0C0C0;
  2034. const SkyBlue = $FF87CEEB;
  2035. const SlateBlue = $FF6A5ACD;
  2036. const SlateGray = $FF708090;
  2037. const Snow = $FFFFFAFA;
  2038. const SpringGreen = $FF00FF7F;
  2039. const SteelBlue = $FF4682B4;
  2040. const Tan = $FFD2B48C;
  2041. const Teal = $FF008080;
  2042. const Thistle = $FFD8BFD8;
  2043. const Tomato = $FFFF6347;
  2044. const Transparent = $00FFFFFF;
  2045. const Turquoise = $FF40E0D0;
  2046. const Violet = $FFEE82EE;
  2047. const Wheat = $FFF5DEB3;
  2048. const White = $FFFFFFFF;
  2049. const WhiteSmoke = $FFF5F5F5;
  2050. const Yellow = $FFFFFF00;
  2051. const YellowGreen = $FF9ACD32;
  2052.  
  2053. // Shift count and bit mask for A, R, G, B components
  2054. const AlphaShift = 24;
  2055. const RedShift = 16;
  2056. const GreenShift = 8;
  2057. const BlueShift = 0;
  2058.  
  2059. const AlphaMask = $FF000000;
  2060. const RedMask = $00FF0000;
  2061. const GreenMask = $0000FF00;
  2062. const BlueMask = $000000FF;
  2063. public
  2064. procedure Initialize; overload;
  2065.  
  2066. // Construct an opaque Color object with
  2067. // the specified Red, Green, Blue values.
  2068. //
  2069. // Color values are not premultiplied.
  2070. procedure Initialize(const R, G, B: Byte); overload;
  2071. procedure Initialize(const A, R, G, B: Byte); overload;
  2072. procedure Initialize(const AArgb: ARGB); overload;
  2073. procedure InitializeFromColorRef(const ColorRef: TColorRef);
  2074.  
  2075. class operator Implicit(const AArgb: ARGB): TGPColor;
  2076. class operator Implicit(const Color: TGPColor): ARGB;
  2077. class function MakeARGB(const A, R, G, B: Byte): ARGB; static;
  2078. class function Create(const R, G, B: Byte): TGPColor; overload; static;
  2079. class function Create(const A, R, G, B: Byte): TGPColor; overload; static;
  2080. class function Create(const AArgb: ARGB): TGPColor; overload; static;
  2081. class function CreateFromColorRef(const ColorRef: TColorRef): TGPColor; overload; static;
  2082. class function CreateFromColorRef(const A: Byte; const ColorRef: TColorRef): TGPColor; overload; static;
  2083.  
  2084. property Alpha: Byte read GetAlpha write SetAlpha;
  2085. property A: Byte read GetAlpha write SetAlpha;
  2086. property R: Byte read GetRed write SetRed;
  2087. property G: Byte read GetGreen write SetGreen;
  2088. property B: Byte read GetBlue write SetBlue;
  2089. property Value: ARGB read FArgb write FArgb;
  2090. property ColorRef: TColorRef read GetColorRef write SetColorRef;
  2091. end;
  2092. PGPColor = ^TGPColor;
  2093. {$ENDREGION 'GdiplusColor.h'}
  2094.  
  2095. {$REGION 'GdiplusMetaHeader.h'}
  2096. (*****************************************************************************
  2097. * GdiplusMetaHeader.h
  2098. * GDI+ Metafile Related Structures
  2099. *****************************************************************************)
  2100.  
  2101. type
  2102. TEnhMetaHeader3 = record
  2103. iType: DWORD; // Record type EMR_HEADER
  2104. nSize: DWORD; // Record size in bytes. This may be greater
  2105. // than the sizeof(ENHMETAHEADER).
  2106. rclBounds: Windows.TRect; // Inclusive-inclusive bounds in device units
  2107. rclFrame: Windows.TRect; // Inclusive-inclusive Picture Frame .01mm unit
  2108. dSignature: DWORD; // Signature. Must be ENHMETA_SIGNATURE.
  2109. nVersion: DWORD; // Version number
  2110. nBytes: DWORD; // Size of the metafile in bytes
  2111. nRecords: DWORD; // Number of records in the metafile
  2112. nHandles: WORD; // Number of handles in the handle table
  2113. // Handle index zero is reserved.
  2114. sReserved: WORD; // Reserved. Must be zero.
  2115. nDescription: DWORD; // Number of chars in the unicode desc string
  2116. // This is 0 if there is no description string
  2117. offDescription: DWORD; // Offset to the metafile description record.
  2118. // This is 0 if there is no description string
  2119. nPalEntries: DWORD; // Number of entries in the metafile palette.
  2120. szlDevice: Windows.TSize; // Size of the reference device in pels
  2121. szlMillimeters: Windows.TSize; // Size of the reference device in millimeters
  2122. end;
  2123. PEnhMetaHeader3 = ^TEnhMetaHeader3;
  2124.  
  2125. // Placeable WMFs
  2126.  
  2127. // Placeable Metafiles were created as a non-standard way of specifying how
  2128. // a metafile is mapped and scaled on an output device.
  2129. // Placeable metafiles are quite wide-spread, but not directly supported by
  2130. // the Windows API. To playback a placeable metafile using the Windows API,
  2131. // you will first need to strip the placeable metafile header from the file.
  2132. // This is typically performed by copying the metafile to a temporary file
  2133. // starting at file offset 22 (0x16). The contents of the temporary file may
  2134. // then be used as input to the Windows GetMetaFile(), PlayMetaFile(),
  2135. // CopyMetaFile(), etc. GDI functions.
  2136.  
  2137. // Each placeable metafile begins with a 22-byte header,
  2138. // followed by a standard metafile:
  2139.  
  2140. type
  2141. TPWMFRect16 = packed record
  2142. Left: Int16;
  2143. Top: Int16;
  2144. Right: Int16;
  2145. Bottom: Int16;
  2146. end;
  2147. PPWMFRect16 = ^TPWMFRect16;
  2148.  
  2149. type
  2150. TWmfPlaceableFileHeader = packed record
  2151. Key: UInt32; // GDIP_WMF_PLACEABLEKEY
  2152. Hmf: Int16; // Metafile HANDLE number (always 0)
  2153. BoundingBox: TPWMFRect16; // Coordinates in metafile units
  2154. Inch: Int16; // Number of metafile units per inch
  2155. Reserved: UInt32; // Reserved (always 0)
  2156. Checksum: Int16; // Checksum value for previous 10 WORDs
  2157. end;
  2158. PWmfPlaceableFileHeader = ^TWmfPlaceableFileHeader;
  2159.  
  2160. // Key contains a special identification value that indicates the presence
  2161. // of a placeable metafile header and is always 0x9AC6CDD7.
  2162.  
  2163. // Handle is used to stored the handle of the metafile in memory. When written
  2164. // to disk, this field is not used and will always contains the value 0.
  2165.  
  2166. // Left, Top, Right, and Bottom contain the coordinates of the upper-left
  2167. // and lower-right corners of the image on the output device. These are
  2168. // measured in twips.
  2169.  
  2170. // A twip (meaning "twentieth of a point") is the logical unit of measurement
  2171. // used in Windows Metafiles. A twip is equal to 1/1440 of an inch. Thus 720
  2172. // twips equal 1/2 inch, while 32,768 twips is 22.75 inches.
  2173.  
  2174. // Inch contains the number of twips per inch used to represent the image.
  2175. // Normally, there are 1440 twips per inch; however, this number may be
  2176. // changed to scale the image. A value of 720 indicates that the image is
  2177. // double its normal size, or scaled to a factor of 2:1. A value of 360
  2178. // indicates a scale of 4:1, while a value of 2880 indicates that the image
  2179. // is scaled down in size by a factor of two. A value of 1440 indicates
  2180. // a 1:1 scale ratio.
  2181.  
  2182. // Reserved is not used and is always set to 0.
  2183.  
  2184. // Checksum contains a checksum value for the previous 10 WORDs in the header.
  2185. // This value can be used in an attempt to detect if the metafile has become
  2186. // corrupted. The checksum is calculated by XORing each WORD value to an
  2187. // initial value of 0.
  2188.  
  2189. // If the metafile was recorded with a reference Hdc that was a display.
  2190.  
  2191. const
  2192. GDIP_EMFPLUSFLAGS_DISPLAY = $00000001;
  2193.  
  2194. type
  2195. TGPMetafileHeader = record
  2196. private
  2197. type
  2198. THeader = record
  2199. case Integer of
  2200. 0: (WmfHeader: TMetaHeader);
  2201. 1: (EmfHeader: TEnhMetaHeader3);
  2202. end;
  2203. private
  2204. FMetafileType: TGPMetafileType;
  2205. FSize: Cardinal; // Size of the metafile (in bytes)
  2206. FVersion: Cardinal; // EMF+, EMF, or WMF version
  2207. FEmfPlusFlags: Cardinal;
  2208. FDpiX: Single;
  2209. FDpiY: Single;
  2210. FX: Integer; // Bounds in device units
  2211. FY: Integer;
  2212. FWidth: Integer;
  2213. FHeight: Integer;
  2214. FHeader: THeader;
  2215. FEmfPlusHeaderSize: Integer; // size of the EMF+ header in file
  2216. FLogicalDpiX: Integer; // Logical Dpi of reference Hdc
  2217. FLogicalDpiY: Integer; // usually valid only for EMF+
  2218. private
  2219. function GetBounds: TGPRect;
  2220. function GetWmfHeader: PMetaHeader;
  2221. function GetEmfHeader: PEnhMetaHeader3;
  2222. public
  2223. // Is it any type of WMF (standard or Placeable Metafile)?
  2224. function IsWmf: Boolean;
  2225.  
  2226. // Is this an Placeable Metafile?
  2227. function IsWmfPlaceable: Boolean;
  2228.  
  2229. // Is this an EMF (not an EMF+)?
  2230. function IsEmf: Boolean;
  2231.  
  2232. // Is this an EMF or EMF+ file?
  2233. function IsEmfOrEmfPlus: Boolean;
  2234.  
  2235. // Is this an EMF+ file?
  2236. function IsEmfPlus: Boolean;
  2237.  
  2238. // Is this an EMF+ dual (has dual, down-level records) file?
  2239. function IsEmfPlusDual: Boolean;
  2240.  
  2241. // Is this an EMF+ only (no dual records) file?
  2242. function IsEmfPlusOnly: Boolean;
  2243.  
  2244. // If it's an EMF+ file, was it recorded against a display Hdc?
  2245. function IsDisplay: Boolean;
  2246.  
  2247. property MetafileType: TGPMetafileType read FMetafileType;
  2248. property MetafileSize: Cardinal read FSize;
  2249.  
  2250. // If IsEmfPlus, this is the EMF+ version; else it is the WMF or EMF ver
  2251. property Version: Cardinal read FVersion;
  2252.  
  2253. // Get the EMF+ flags associated with the metafile
  2254. property EmfPlusFlags: Cardinal read FEmfPlusFlags;
  2255.  
  2256. property DpiX: Single read FDpiX;
  2257. property DpiY: Single read FDpiY;
  2258. property Bounds: TGPRect read GetBounds;
  2259.  
  2260. // Get the WMF header of the metafile (if it is a WMF)
  2261. property WmfHeader: PMetaHeader read GetWmfHeader;
  2262.  
  2263. // Get the EMF header of the metafile (if it is an EMF)
  2264. property EmfHeader: PEnhMetaHeader3 read GetEmfHeader;
  2265.  
  2266. property EmfPlusHeaderSize: Integer read FEmfPlusHeaderSize;
  2267. property LogicalDpiX: Integer read FLogicalDpiX;
  2268. property LogicalDpiY: Integer read FLogicalDpiY;
  2269. end;
  2270. PGPMetafileHeader = ^TGPMetafileHeader;
  2271. {$ENDREGION 'GdiplusMetaHeader.h'}
  2272.  
  2273. {$REGION 'GdiplusImaging.h'}
  2274. (*****************************************************************************
  2275. * GdiplusImaging.h
  2276. * GDI+ Imaging GUIDs
  2277. *****************************************************************************)
  2278.  
  2279. //---------------------------------------------------------------------------
  2280. // Image file format identifiers
  2281. //---------------------------------------------------------------------------
  2282. const
  2283. ImageFormatUndefined : TGUID = '{b96b3ca9-0728-11d3-9d7b-0000f81ef32e}';
  2284. ImageFormatMemoryBMP : TGUID = '{b96b3caa-0728-11d3-9d7b-0000f81ef32e}';
  2285. ImageFormatBMP : TGUID = '{b96b3cab-0728-11d3-9d7b-0000f81ef32e}';
  2286. ImageFormatEMF : TGUID = '{b96b3cac-0728-11d3-9d7b-0000f81ef32e}';
  2287. ImageFormatWMF : TGUID = '{b96b3cad-0728-11d3-9d7b-0000f81ef32e}';
  2288. ImageFormatJPEG : TGUID = '{b96b3cae-0728-11d3-9d7b-0000f81ef32e}';
  2289. ImageFormatPNG : TGUID = '{b96b3caf-0728-11d3-9d7b-0000f81ef32e}';
  2290. ImageFormatGIF : TGUID = '{b96b3cb0-0728-11d3-9d7b-0000f81ef32e}';
  2291. ImageFormatTIFF : TGUID = '{b96b3cb1-0728-11d3-9d7b-0000f81ef32e}';
  2292. ImageFormatEXIF : TGUID = '{b96b3cb2-0728-11d3-9d7b-0000f81ef32e}';
  2293. ImageFormatIcon : TGUID = '{b96b3cb5-0728-11d3-9d7b-0000f81ef32e}';
  2294.  
  2295. //---------------------------------------------------------------------------
  2296. // Predefined multi-frame dimension IDs
  2297. //---------------------------------------------------------------------------
  2298.  
  2299. const
  2300. FrameDimensionTime : TGUID = '{6aedbd6d-3fb5-418a-83a6-7f45229dc872}';
  2301. FrameDimensionResolution : TGUID = '{84236f7b-3bd3-428f-8dab-4ea1439ca315}';
  2302. FrameDimensionPage : TGUID = '{7462dc86-6180-4c7e-8e3f-ee7333a7a483}';
  2303.  
  2304. //---------------------------------------------------------------------------
  2305. // Property sets
  2306. //---------------------------------------------------------------------------
  2307.  
  2308. const
  2309. FormatIDImageInformation : TGUID = '{e5836cbe-5eef-4f1d-acde-ae4c43b608ce}';
  2310. FormatIDJpegAppHeaders : TGUID = '{1c4afdcd-6177-43cf-abc7-5f51af39ee85}';
  2311.  
  2312. //---------------------------------------------------------------------------
  2313. // Encoder parameter sets
  2314. //---------------------------------------------------------------------------
  2315.  
  2316. const
  2317. EncoderCompression : TGUID = '{e09d739d-ccd4-44ee-8eba-3fbf8be4fc58}';
  2318. EncoderColorDepth : TGUID = '{66087055-ad66-4c7c-9a18-38a2310b8337}';
  2319. EncoderScanMethod : TGUID = '{3a4e2661-3109-4e56-8536-42c156e7dcfa}';
  2320. EncoderVersion : TGUID = '{24d18c76-814a-41a4-bf53-1c219cccf797}';
  2321. EncoderRenderMethod : TGUID = '{6d42c53a-229a-4825-8bb7-5c99e2b9a8b8}';
  2322. EncoderQuality : TGUID = '{1d5be4b5-fa4a-452d-9cdd-5db35105e7eb}';
  2323. EncoderTransformation : TGUID = '{8d0eb2d1-a58e-4ea8-aa14-108074b7b6f9}';
  2324. EncoderLuminanceTable : TGUID = '{edb33bce-0266-4a77-b904-27216099e717}';
  2325. EncoderChrominanceTable : TGUID = '{f2e455dc-09b3-4316-8260-676ada32481c}';
  2326. EncoderSaveFlag : TGUID = '{292266fc-ac40-47bf-8cfc-a85b89a655de}';
  2327.  
  2328. {$IF (GDIPVER >= $0110)}
  2329. EncoderColorSpace : TGUID = '{ae7a62a0-ee2c-49d8-9d07-1ba8a927596e}';
  2330. EncoderImageItems : TGUID = '{63875e13-1f1d-45ab-9195-a29b6066a650}';
  2331. EncoderSaveAsCMYK : TGUID = '{a219bbc9-0a9d-4005-a3ee-3a421b8bb06c}';
  2332. {$IFEND}
  2333.  
  2334. CodecIImageBytes : TGUID = '{025d1823-6c7d-447b-bbdb-a3cbc3dfa2fc}';
  2335.  
  2336. type
  2337. IGPImageBytes = interface(IUnknown)
  2338. ['{025D1823-6C7D-447B-BBDB-A3CBC3DFA2FC}']
  2339. // Return total number of bytes in the IStream
  2340. function CountBytes(out Count: UINT): HRESULT; stdcall;
  2341.  
  2342. // Locks "cb" bytes, starting from "ulOffset" in the stream, and returns the
  2343. // pointer to the beginning of the locked memory chunk in "ppvBytes"
  2344. function LockBytes(Count: UINT; Offset: ULONG; out Bytes: Pointer): HResult; stdcall;
  2345.  
  2346. // Unlocks "cb" bytes, pointed by "pvBytes", starting from "ulOffset" in the
  2347. // stream
  2348. function UnlockBytes(const Bytes: Pointer; Count: UINT; Offset: ULONG): HResult; stdcall;
  2349. end;
  2350.  
  2351. //--------------------------------------------------------------------------
  2352. // Information flags about image codecs
  2353. //--------------------------------------------------------------------------
  2354.  
  2355. type
  2356. TGPImageCodecFlag = (
  2357. ImageCodecFlagsEncoder = 0,
  2358. ImageCodecFlagsDecoder = 1,
  2359. ImageCodecFlagsSupportBitmap = 2,
  2360. ImageCodecFlagsSupportVector = 3,
  2361. ImageCodecFlagsSeekableEncode = 4,
  2362. ImageCodecFlagsBlockingDecode = 5,
  2363.  
  2364. ImageCodecFlagsBuiltin = 16,
  2365. ImageCodecFlagsSystem = 17,
  2366. ImageCodecFlagsUser = 18);
  2367. TGPImageCodecFlags = set of TGPImageCodecFlag;
  2368.  
  2369. //--------------------------------------------------------------------------
  2370. // ImageCodecInfo structure
  2371. //--------------------------------------------------------------------------
  2372.  
  2373. type
  2374. TGPNativeImageCodecInfo = record
  2375. public
  2376. ClsId: TGUID;
  2377. FormatId: TGUID;
  2378. CodecName: PWideChar;
  2379. DllName: PWideChar;
  2380. FormatDescription: PWideChar;
  2381. FilenameExtension: PWideChar;
  2382. MimeType: PWideChar;
  2383. Flags: TGPImageCodecFlags;
  2384. Version: DWORD;
  2385. SigCount: DWORD;
  2386. SigSize: DWORD;
  2387. SigPattern: PByte;
  2388. SigMask: PByte;
  2389. end;
  2390. PGPNativeImageCodecInfo = ^TGPNativeImageCodecInfo;
  2391.  
  2392. //---------------------------------------------------------------------------
  2393. // Access modes used when calling Image::LockBits
  2394. //---------------------------------------------------------------------------
  2395.  
  2396. type
  2397. TGPImageLockModeOption = (
  2398. ImageLockModeRead = 0,
  2399. ImageLockModeWrite = 1,
  2400. ImageLockModeUserInputBuf = 2,
  2401. ImageLockModeReserved = 31);
  2402.  
  2403. TGPImageLockMode = set of TGPImageLockModeOption;
  2404.  
  2405. //---------------------------------------------------------------------------
  2406. // Information about image pixel data
  2407. //---------------------------------------------------------------------------
  2408.  
  2409. type
  2410. TGPBitmapData = record
  2411. public
  2412. Width: Cardinal;
  2413. Height: Cardinal;
  2414. Stride: Integer;
  2415. PixelFormat: TGPPixelFormat;
  2416. Scan0: Pointer;
  2417. Reserved: Cardinal;
  2418. end;
  2419. PGPBitmapData = ^TGPBitmapData;
  2420.  
  2421. //---------------------------------------------------------------------------
  2422. // Image flags
  2423. //---------------------------------------------------------------------------
  2424.  
  2425. type
  2426. TGPImageFlag = (
  2427. // Low-word: shared with SINKFLAG_x
  2428.  
  2429. ImageFlagsScalable = 0,
  2430. ImageFlagsHasAlpha = 1,
  2431. ImageFlagsHasTranslucent = 2,
  2432. ImageFlagsPartiallyScalable = 3,
  2433.  
  2434. // Low-word: color space definition
  2435.  
  2436. ImageFlagsColorSpaceRGB = 4,
  2437. ImageFlagsColorSpaceCMYK = 5,
  2438. ImageFlagsColorSpaceGRAY = 6,
  2439. ImageFlagsColorSpaceYCBCR = 7,
  2440. ImageFlagsColorSpaceYCCK = 8,
  2441.  
  2442. // Low-word: image size info
  2443.  
  2444. ImageFlagsHasRealDPI = 12,
  2445. ImageFlagsHasRealPixelSize = 13,
  2446.  
  2447. // High-word
  2448.  
  2449. ImageFlagsReadOnly = 16,
  2450. ImageFlagsCaching = 17);
  2451.  
  2452. TGPImageFlags = set of TGPImageFlag;
  2453.  
  2454. const
  2455. ImageFlagsNone = [];
  2456.  
  2457. type
  2458. TGPRotateFlipType = (
  2459. RotateNoneFlipNone = 0,
  2460. Rotate90FlipNone = 1,
  2461. Rotate180FlipNone = 2,
  2462. Rotate270FlipNone = 3,
  2463.  
  2464. RotateNoneFlipX = 4,
  2465. Rotate90FlipX = 5,
  2466. Rotate180FlipX = 6,
  2467. Rotate270FlipX = 7,
  2468.  
  2469. RotateNoneFlipY = Rotate180FlipX,
  2470. Rotate90FlipY = Rotate270FlipX,
  2471. Rotate180FlipY = RotateNoneFlipX,
  2472. Rotate270FlipY = Rotate90FlipX,
  2473.  
  2474. RotateNoneFlipXY = Rotate180FlipNone,
  2475. Rotate90FlipXY = Rotate270FlipNone,
  2476. Rotate180FlipXY = RotateNoneFlipNone,
  2477. Rotate270FlipXY = Rotate90FlipNone);
  2478.  
  2479. //---------------------------------------------------------------------------
  2480. // Encoder Parameter structure
  2481. //---------------------------------------------------------------------------
  2482.  
  2483. type
  2484. TGPNativeEncoderParameter = record
  2485. public
  2486. Guid: TGUID; // GUID of the parameter
  2487. NumberOfValues: ULONG; // Number of the parameter values
  2488. ValueType: TGPEncoderParameterValueType; // Value type, like ValueTypeLONG etc.
  2489. Value: Pointer; // A pointer to the parameter values
  2490. end;
  2491. PGPNativeEncoderParameter = ^TGPNativeEncoderParameter;
  2492.  
  2493. //---------------------------------------------------------------------------
  2494. // Encoder Parameters structure
  2495. //---------------------------------------------------------------------------
  2496.  
  2497. type
  2498. TGPNativeEncoderParameters = record
  2499. public
  2500. Count: Cardinal; // Number of parameters in this structure
  2501. Parameter: array [0..0] of TGPNativeEncoderParameter; // Parameter values
  2502. end;
  2503. PGPNativeEncoderParameters = ^TGPNativeEncoderParameters;
  2504.  
  2505. {$IF (GDIPVER >= $0110)}
  2506. type
  2507. TGPItemDataPosition = (
  2508. ItemDataPositionAfterHeader = 0,
  2509. ItemDataPositionAfterPalette = 1,
  2510. ItemDataPositionAfterBits = 2);
  2511.  
  2512. //---------------------------------------------------------------------------
  2513. // External Data Item
  2514. //---------------------------------------------------------------------------
  2515.  
  2516. type
  2517. TGPImageItemData = record
  2518. public
  2519. Size: Cardinal; // size of the structure
  2520. Position: Cardinal; // flags describing how the data is to be used.
  2521. Desc: Pointer; // description on how the data is to be saved.
  2522. // it is different for every codec type.
  2523. DescSize: Cardinal; // size memory pointed by Desc
  2524. Data: Pointer; // pointer to the data that is to be saved in the
  2525. // file, could be anything saved directly.
  2526. DataSize: Cardinal; // size memory pointed by Data
  2527. Cookie: Cardinal; // opaque for the apps data member used during
  2528. // enumeration of image data items.
  2529. end;
  2530. PGPImageItemData = ^TGPImageItemData;
  2531. {$IFEND}
  2532.  
  2533. //---------------------------------------------------------------------------
  2534. // Property Item
  2535. //---------------------------------------------------------------------------
  2536.  
  2537. type
  2538. TGPNativePropertyItem = record
  2539. public
  2540. Id: TPropID; // ID of this property
  2541. Length: ULONG; // Length of the property value, in bytes
  2542. ValueType: Word; // Type of the value, as one of TAG_TYPE_XXX
  2543. // defined above
  2544. Value: Pointer; // property value
  2545. end;
  2546. PGPNativePropertyItem = ^TGPNativePropertyItem;
  2547.  
  2548. //---------------------------------------------------------------------------
  2549. // Image property types
  2550. //---------------------------------------------------------------------------
  2551.  
  2552. const
  2553. PropertyTagTypeByte = 1;
  2554. PropertyTagTypeASCII = 2;
  2555. PropertyTagTypeShort = 3;
  2556. PropertyTagTypeLong = 4;
  2557. PropertyTagTypeRational = 5;
  2558. PropertyTagTypeUndefined = 7;
  2559. PropertyTagTypeSLONG = 9;
  2560. PropertyTagTypeSRational = 10;
  2561.  
  2562. //---------------------------------------------------------------------------
  2563. // Image property ID tags
  2564. //---------------------------------------------------------------------------
  2565.  
  2566. PropertyTagExifIFD = $8769;
  2567. PropertyTagGpsIFD = $8825;
  2568.  
  2569. PropertyTagNewSubfileType = $00FE;
  2570. PropertyTagSubfileType = $00FF;
  2571. PropertyTagImageWidth = $0100;
  2572. PropertyTagImageHeight = $0101;
  2573. PropertyTagBitsPerSample = $0102;
  2574. PropertyTagCompression = $0103;
  2575. PropertyTagPhotometricInterp = $0106;
  2576. PropertyTagThreshHolding = $0107;
  2577. PropertyTagCellWidth = $0108;
  2578. PropertyTagCellHeight = $0109;
  2579. PropertyTagFillOrder = $010A;
  2580. PropertyTagDocumentName = $010D;
  2581. PropertyTagImageDescription = $010E;
  2582. PropertyTagEquipMake = $010F;
  2583. PropertyTagEquipModel = $0110;
  2584. PropertyTagStripOffsets = $0111;
  2585. PropertyTagOrientation = $0112;
  2586. PropertyTagSamplesPerPixel = $0115;
  2587. PropertyTagRowsPerStrip = $0116;
  2588. PropertyTagStripBytesCount = $0117;
  2589. PropertyTagMinSampleValue = $0118;
  2590. PropertyTagMaxSampleValue = $0119;
  2591. PropertyTagXResolution = $011A; // Image resolution in width direction
  2592. PropertyTagYResolution = $011B; // Image resolution in height direction
  2593. PropertyTagPlanarConfig = $011C; // Image data arrangement
  2594. PropertyTagPageName = $011D;
  2595. PropertyTagXPosition = $011E;
  2596. PropertyTagYPosition = $011F;
  2597. PropertyTagFreeOffset = $0120;
  2598. PropertyTagFreeByteCounts = $0121;
  2599. PropertyTagGrayResponseUnit = $0122;
  2600. PropertyTagGrayResponseCurve = $0123;
  2601. PropertyTagT4Option = $0124;
  2602. PropertyTagT6Option = $0125;
  2603. PropertyTagResolutionUnit = $0128; // Unit of X and Y resolution
  2604. PropertyTagPageNumber = $0129;
  2605. PropertyTagTransferFuncition = $012D;
  2606. PropertyTagSoftwareUsed = $0131;
  2607. PropertyTagDateTime = $0132;
  2608. PropertyTagArtist = $013B;
  2609. PropertyTagHostComputer = $013C;
  2610. PropertyTagPredictor = $013D;
  2611. PropertyTagWhitePoint = $013E;
  2612. PropertyTagPrimaryChromaticities = $013F;
  2613. PropertyTagColorMap = $0140;
  2614. PropertyTagHalftoneHints = $0141;
  2615. PropertyTagTileWidth = $0142;
  2616. PropertyTagTileLength = $0143;
  2617. PropertyTagTileOffset = $0144;
  2618. PropertyTagTileByteCounts = $0145;
  2619. PropertyTagInkSet = $014C;
  2620. PropertyTagInkNames = $014D;
  2621. PropertyTagNumberOfInks = $014E;
  2622. PropertyTagDotRange = $0150;
  2623. PropertyTagTargetPrinter = $0151;
  2624. PropertyTagExtraSamples = $0152;
  2625. PropertyTagSampleFormat = $0153;
  2626. PropertyTagSMinSampleValue = $0154;
  2627. PropertyTagSMaxSampleValue = $0155;
  2628. PropertyTagTransferRange = $0156;
  2629.  
  2630. PropertyTagJPEGProc = $0200;
  2631. PropertyTagJPEGInterFormat = $0201;
  2632. PropertyTagJPEGInterLength = $0202;
  2633. PropertyTagJPEGRestartInterval = $0203;
  2634. PropertyTagJPEGLosslessPredictors = $0205;
  2635. PropertyTagJPEGPointTransforms = $0206;
  2636. PropertyTagJPEGQTables = $0207;
  2637. PropertyTagJPEGDCTables = $0208;
  2638. PropertyTagJPEGACTables = $0209;
  2639.  
  2640. PropertyTagYCbCrCoefficients = $0211;
  2641. PropertyTagYCbCrSubsampling = $0212;
  2642. PropertyTagYCbCrPositioning = $0213;
  2643. PropertyTagREFBlackWhite = $0214;
  2644.  
  2645. PropertyTagICCProfile = $8773; // This TAG is defined by ICC
  2646. // for embedded ICC in TIFF
  2647. PropertyTagGamma = $0301;
  2648. PropertyTagICCProfileDescriptor = $0302;
  2649. PropertyTagSRGBRenderingIntent = $0303;
  2650.  
  2651. PropertyTagImageTitle = $0320;
  2652. PropertyTagCopyright = $8298;
  2653.  
  2654. // Extra TAGs (Like Adobe Image Information tags etc.)
  2655.  
  2656. PropertyTagResolutionXUnit = $5001;
  2657. PropertyTagResolutionYUnit = $5002;
  2658. PropertyTagResolutionXLengthUnit = $5003;
  2659. PropertyTagResolutionYLengthUnit = $5004;
  2660. PropertyTagPrintFlags = $5005;
  2661. PropertyTagPrintFlagsVersion = $5006;
  2662. PropertyTagPrintFlagsCrop = $5007;
  2663. PropertyTagPrintFlagsBleedWidth = $5008;
  2664. PropertyTagPrintFlagsBleedWidthScale = $5009;
  2665. PropertyTagHalftoneLPI = $500A;
  2666. PropertyTagHalftoneLPIUnit = $500B;
  2667. PropertyTagHalftoneDegree = $500C;
  2668. PropertyTagHalftoneShape = $500D;
  2669. PropertyTagHalftoneMisc = $500E;
  2670. PropertyTagHalftoneScreen = $500F;
  2671. PropertyTagJPEGQuality = $5010;
  2672. PropertyTagGridSize = $5011;
  2673. PropertyTagThumbnailFormat = $5012; // 1 = JPEG, 0 = RAW RGB
  2674. PropertyTagThumbnailWidth = $5013;
  2675. PropertyTagThumbnailHeight = $5014;
  2676. PropertyTagThumbnailColorDepth = $5015;
  2677. PropertyTagThumbnailPlanes = $5016;
  2678. PropertyTagThumbnailRawBytes = $5017;
  2679. PropertyTagThumbnailSize = $5018;
  2680. PropertyTagThumbnailCompressedSize = $5019;
  2681. PropertyTagColorTransferFunction = $501A;
  2682. PropertyTagThumbnailData = $501B; // RAW thumbnail bits in
  2683. // JPEG format or RGB format
  2684. // depends on
  2685. // PropertyTagThumbnailFormat
  2686.  
  2687. // Thumbnail related TAGs
  2688.  
  2689. PropertyTagThumbnailImageWidth = $5020; // Thumbnail width
  2690. PropertyTagThumbnailImageHeight = $5021; // Thumbnail height
  2691. PropertyTagThumbnailBitsPerSample = $5022; // Number of bits per
  2692. // component
  2693. PropertyTagThumbnailCompression = $5023; // Compression Scheme
  2694. PropertyTagThumbnailPhotometricInterp = $5024; // Pixel composition
  2695. PropertyTagThumbnailImageDescription = $5025; // Image Tile
  2696. PropertyTagThumbnailEquipMake = $5026; // Manufacturer of Image
  2697. // Input equipment
  2698. PropertyTagThumbnailEquipModel = $5027; // Model of Image input
  2699. // equipment
  2700. PropertyTagThumbnailStripOffsets = $5028; // Image data location
  2701. PropertyTagThumbnailOrientation = $5029; // Orientation of image
  2702. PropertyTagThumbnailSamplesPerPixel = $502A; // Number of components
  2703. PropertyTagThumbnailRowsPerStrip = $502B; // Number of rows per strip
  2704. PropertyTagThumbnailStripBytesCount = $502C; // Bytes per compressed
  2705. // strip
  2706. PropertyTagThumbnailResolutionX = $502D; // Resolution in width
  2707. // direction
  2708. PropertyTagThumbnailResolutionY = $502E; // Resolution in height
  2709. // direction
  2710. PropertyTagThumbnailPlanarConfig = $502F; // Image data arrangement
  2711. PropertyTagThumbnailResolutionUnit = $5030; // Unit of X and Y
  2712. // Resolution
  2713. PropertyTagThumbnailTransferFunction = $5031; // Transfer function
  2714. PropertyTagThumbnailSoftwareUsed = $5032; // Software used
  2715. PropertyTagThumbnailDateTime = $5033; // File change date and
  2716. // time
  2717. PropertyTagThumbnailArtist = $5034; // Person who created the
  2718. // image
  2719. PropertyTagThumbnailWhitePoint = $5035; // White point chromaticity
  2720. PropertyTagThumbnailPrimaryChromaticities = $5036; // Chromaticities of
  2721. // primaries
  2722. PropertyTagThumbnailYCbCrCoefficients = $5037; // Color space transforma-
  2723. // tion coefficients
  2724. PropertyTagThumbnailYCbCrSubsampling = $5038; // Subsampling ratio of Y
  2725. // to C
  2726. PropertyTagThumbnailYCbCrPositioning = $5039; // Y and C position
  2727. PropertyTagThumbnailRefBlackWhite = $503A; // Pair of black and white
  2728. // reference values
  2729. PropertyTagThumbnailCopyRight = $503B; // CopyRight holder
  2730.  
  2731. PropertyTagLuminanceTable = $5090;
  2732. PropertyTagChrominanceTable = $5091;
  2733.  
  2734. PropertyTagFrameDelay = $5100;
  2735. PropertyTagLoopCount = $5101;
  2736.  
  2737. {$IF (GDIPVER >= $0110)}
  2738. PropertyTagGlobalPalette = $5102;
  2739. PropertyTagIndexBackground = $5103;
  2740. PropertyTagIndexTransparent = $5104;
  2741. {$IFEND}
  2742.  
  2743. PropertyTagPixelUnit = $5110; // Unit specifier for pixel/unit
  2744. PropertyTagPixelPerUnitX = $5111; // Pixels per unit in X
  2745. PropertyTagPixelPerUnitY = $5112; // Pixels per unit in Y
  2746. PropertyTagPaletteHistogram = $5113; // Palette histogram
  2747.  
  2748. // EXIF specific tag
  2749.  
  2750. PropertyTagExifExposureTime = $829A;
  2751. PropertyTagExifFNumber = $829D;
  2752.  
  2753. PropertyTagExifExposureProg = $8822;
  2754. PropertyTagExifSpectralSense = $8824;
  2755. PropertyTagExifISOSpeed = $8827;
  2756. PropertyTagExifOECF = $8828;
  2757.  
  2758. PropertyTagExifVer = $9000;
  2759. PropertyTagExifDTOrig = $9003; // Date & time of original
  2760. PropertyTagExifDTDigitized = $9004; // Date & time of digital data generation
  2761.  
  2762. PropertyTagExifCompConfig = $9101;
  2763. PropertyTagExifCompBPP = $9102;
  2764.  
  2765. PropertyTagExifShutterSpeed = $9201;
  2766. PropertyTagExifAperture = $9202;
  2767. PropertyTagExifBrightness = $9203;
  2768. PropertyTagExifExposureBias = $9204;
  2769. PropertyTagExifMaxAperture = $9205;
  2770. PropertyTagExifSubjectDist = $9206;
  2771. PropertyTagExifMeteringMode = $9207;
  2772. PropertyTagExifLightSource = $9208;
  2773. PropertyTagExifFlash = $9209;
  2774. PropertyTagExifFocalLength = $920A;
  2775. PropertyTagExifSubjectArea = $9214; // exif 2.2 Subject Area
  2776. PropertyTagExifMakerNote = $927C;
  2777. PropertyTagExifUserComment = $9286;
  2778. PropertyTagExifDTSubsec = $9290; // Date & Time subseconds
  2779. PropertyTagExifDTOrigSS = $9291; // Date & Time original subseconds
  2780. PropertyTagExifDTDigSS = $9292; // Date & TIme digitized subseconds
  2781.  
  2782. PropertyTagExifFPXVer = $A000;
  2783. PropertyTagExifColorSpace = $A001;
  2784. PropertyTagExifPixXDim = $A002;
  2785. PropertyTagExifPixYDim = $A003;
  2786. PropertyTagExifRelatedWav = $A004; // related sound file
  2787. PropertyTagExifInterop = $A005;
  2788. PropertyTagExifFlashEnergy = $A20B;
  2789. PropertyTagExifSpatialFR = $A20C; // Spatial Frequency Response
  2790. PropertyTagExifFocalXRes = $A20E; // Focal Plane X Resolution
  2791. PropertyTagExifFocalYRes = $A20F; // Focal Plane Y Resolution
  2792. PropertyTagExifFocalResUnit = $A210; // Focal Plane Resolution Unit
  2793. PropertyTagExifSubjectLoc = $A214;
  2794. PropertyTagExifExposureIndex = $A215;
  2795. PropertyTagExifSensingMethod = $A217;
  2796. PropertyTagExifFileSource = $A300;
  2797. PropertyTagExifSceneType = $A301;
  2798. PropertyTagExifCfaPattern = $A302;
  2799.  
  2800. // New EXIF 2.2 properties
  2801.  
  2802. PropertyTagExifCustomRendered = $A401;
  2803. PropertyTagExifExposureMode = $A402;
  2804. PropertyTagExifWhiteBalance = $A403;
  2805. PropertyTagExifDigitalZoomRatio = $A404;
  2806. PropertyTagExifFocalLengthIn35mmFilm = $A405;
  2807. PropertyTagExifSceneCaptureType = $A406;
  2808. PropertyTagExifGainControl = $A407;
  2809. PropertyTagExifContrast = $A408;
  2810. PropertyTagExifSaturation = $A409;
  2811. PropertyTagExifSharpness = $A40A;
  2812. PropertyTagExifDeviceSettingDesc = $A40B;
  2813. PropertyTagExifSubjectDistanceRange = $A40C;
  2814. PropertyTagExifUniqueImageID = $A420;
  2815.  
  2816.  
  2817. PropertyTagGpsVer = $0000;
  2818. PropertyTagGpsLatitudeRef = $0001;
  2819. PropertyTagGpsLatitude = $0002;
  2820. PropertyTagGpsLongitudeRef = $0003;
  2821. PropertyTagGpsLongitude = $0004;
  2822. PropertyTagGpsAltitudeRef = $0005;
  2823. PropertyTagGpsAltitude = $0006;
  2824. PropertyTagGpsGpsTime = $0007;
  2825. PropertyTagGpsGpsSatellites = $0008;
  2826. PropertyTagGpsGpsStatus = $0009;
  2827. PropertyTagGpsGpsMeasureMode = $000A ;
  2828. PropertyTagGpsGpsDop = $000B; // Measurement precision
  2829. PropertyTagGpsSpeedRef = $000C;
  2830. PropertyTagGpsSpeed = $000D;
  2831. PropertyTagGpsTrackRef = $000E;
  2832. PropertyTagGpsTrack = $000F;
  2833. PropertyTagGpsImgDirRef = $0010;
  2834. PropertyTagGpsImgDir = $0011;
  2835. PropertyTagGpsMapDatum = $0012;
  2836. PropertyTagGpsDestLatRef = $0013;
  2837. PropertyTagGpsDestLat = $0014;
  2838. PropertyTagGpsDestLongRef = $0015;
  2839. PropertyTagGpsDestLong = $0016;
  2840. PropertyTagGpsDestBearRef = $0017;
  2841. PropertyTagGpsDestBear = $0018;
  2842. PropertyTagGpsDestDistRef = $0019;
  2843. PropertyTagGpsDestDist = $001A;
  2844. PropertyTagGpsProcessingMethod = $001B;
  2845. PropertyTagGpsAreaInformation = $001C;
  2846. PropertyTagGpsDate = $001D;
  2847. PropertyTagGpsDifferential = $001E;
  2848. {$ENDREGION 'GdiplusImaging.h'}
  2849.  
  2850. {$REGION 'GdiplusColorMatrix.h'}
  2851. (*****************************************************************************
  2852. * GdiplusColorMatrix.h
  2853. * GDI+ Color Matrix object, used with Graphics.DrawImage
  2854. *****************************************************************************)
  2855.  
  2856. {$IF (GDIPVER >= $0110)}
  2857. //----------------------------------------------------------------------------
  2858. // Color channel look up table (LUT)
  2859. //----------------------------------------------------------------------------
  2860.  
  2861. type
  2862. TGPColorChannelLUT = array [0..255] of Byte;
  2863.  
  2864. //----------------------------------------------------------------------------
  2865. // Per-channel Histogram for 8bpp images.
  2866. //----------------------------------------------------------------------------
  2867.  
  2868. type
  2869. TGPHistogramFormat = (
  2870. HistogramFormatARGB,
  2871. HistogramFormatPARGB,
  2872. HistogramFormatRGB,
  2873. HistogramFormatGray,
  2874. HistogramFormatB,
  2875. HistogramFormatG,
  2876. HistogramFormatR,
  2877. HistogramFormatA);
  2878. {$IFEND}
  2879.  
  2880. //----------------------------------------------------------------------------
  2881. // Color matrix
  2882. //----------------------------------------------------------------------------
  2883.  
  2884. type
  2885. TGPColorMatrix = record
  2886. public
  2887. M: array [0..4, 0..4] of Single;
  2888. public
  2889. procedure SetToIdentity;
  2890. end;
  2891. PGPColorMatrix = ^TGPColorMatrix;
  2892.  
  2893. //----------------------------------------------------------------------------
  2894. // Color Matrix flags
  2895. //----------------------------------------------------------------------------
  2896.  
  2897. type
  2898. TGPColorMatrixFlags = (
  2899. ColorMatrixFlagsDefault = 0,
  2900. ColorMatrixFlagsSkipGrays = 1,
  2901. ColorMatrixFlagsAltGray = 2);
  2902.  
  2903. //----------------------------------------------------------------------------
  2904. // Color Adjust Type
  2905. //----------------------------------------------------------------------------
  2906.  
  2907. type
  2908. TGPColorAdjustType = (
  2909. ColorAdjustTypeDefault,
  2910. ColorAdjustTypeBitmap,
  2911. ColorAdjustTypeBrush,
  2912. ColorAdjustTypePen,
  2913. ColorAdjustTypeText,
  2914. ColorAdjustTypeCount,
  2915. ColorAdjustTypeAny); // Reserved
  2916.  
  2917. //----------------------------------------------------------------------------
  2918. // Color Map
  2919. //----------------------------------------------------------------------------
  2920.  
  2921. type
  2922. TGPColorMap = record
  2923. OldColor: TGPColor;
  2924. NewColor: TGPColor;
  2925. end;
  2926. PGPColorMap = ^TGPColorMap;
  2927.  
  2928. {$ENDREGION 'GdiplusColorMatrix.h'}
  2929.  
  2930. {$REGION 'GdiplusEffects.h'}
  2931. {$IF (GDIPVER >= $0110)}
  2932. (*****************************************************************************
  2933. * GdiplusEffects.h
  2934. * Gdiplus effect objects
  2935. *****************************************************************************)
  2936. //-----------------------------------------------------------------------------
  2937. // GDI+ effect GUIDs
  2938. //-----------------------------------------------------------------------------
  2939.  
  2940. const
  2941. BlurEffectGuid : TGUID = '{633C80A4-1843-482b-9EF2-BE2834C5FDD4}';
  2942. SharpenEffectGuid : TGUID = '{63CBF3EE-C526-402c-8F71-62C540BF5142}';
  2943. ColorMatrixEffectGuid : TGUID = '{718F2615-7933-40e3-A511-5F68FE14DD74}';
  2944. ColorLUTEffectGuid : TGUID = '{A7CE72A9-0F7F-40d7-B3CC-D0C02D5C3212}';
  2945. BrightnessContrastEffectGuid : TGUID = '{D3A1DBE1-8EC4-4c17-9F4C-EA97AD1C343D}';
  2946. HueSaturationLightnessEffectGuid: TGUID = '{8B2DD6C3-EB07-4d87-A5F0-7108E26A9C5F}';
  2947. LevelsEffectGuid : TGUID = '{99C354EC-2A31-4f3a-8C34-17A803B33A25}';
  2948. TintEffectGuid : TGUID = '{1077AF00-2848-4441-9489-44AD4C2D7A2C}';
  2949. ColorBalanceEffectGuid : TGUID = '{537E597D-251E-48da-9664-29CA496B70F8}';
  2950. RedEyeCorrectionEffectGuid : TGUID = '{74D29D05-69A4-4266-9549-3CC52836B632}';
  2951. ColorCurveEffectGuid : TGUID = '{DD6A0022-58E4-4a67-9D9B-D48EB881A53D}';
  2952.  
  2953. //-----------------------------------------------------------------------------
  2954.  
  2955. type
  2956. TGPSharpenParams = record
  2957. public
  2958. Radius: Single;
  2959. Amount: Single;
  2960. end;
  2961. PGPSharpenParams = ^TGPSharpenParams;
  2962.  
  2963. type
  2964. TGPBlurParams = record
  2965. public
  2966. Radius: Single;
  2967. ExpandEdge: BOOL;
  2968. end;
  2969. PGPBlurParams = ^TGPBlurParams;
  2970.  
  2971. type
  2972. TGPBrightnessContrastParams = record
  2973. public
  2974. BrightnessLevel: Integer;
  2975. ContrastLevel: Integer;
  2976. end;
  2977. PGPBrightnessContrastParams = ^TGPBrightnessContrastParams;
  2978.  
  2979. type
  2980. TGPRedEyeCorrectionParams = record
  2981. public
  2982. NumberOfAreas: Cardinal;
  2983. Areas: Windows.PRect;
  2984. end;
  2985. PGPRedEyeCorrectionParams = ^TGPRedEyeCorrectionParams;
  2986.  
  2987. type
  2988. TGPHueSaturationLightnessParams = record
  2989. public
  2990. HueLevel: Integer;
  2991. SaturationLevel: Integer;
  2992. LightnessLevel: Integer;
  2993. end;
  2994. PGPHueSaturationLightnessParams = ^TGPHueSaturationLightnessParams;
  2995.  
  2996. type
  2997. TGPTintParams = record
  2998. public
  2999. Hue: Integer;
  3000. Amount: Integer;
  3001. end;
  3002. PGPTintParams = ^TGPTintParams;
  3003.  
  3004. type
  3005. TGPLevelsParams = record
  3006. public
  3007. Highlight: Integer;
  3008. Midtone: Integer;
  3009. Shadow: Integer;
  3010. end;
  3011. PGPLevelsParams = ^TGPLevelsParams;
  3012.  
  3013. type
  3014. TGPColorBalanceParams = record
  3015. public
  3016. CyanRed: Integer;
  3017. MagentaGreen: Integer;
  3018. YellowBlue: Integer;
  3019. end;
  3020. PGPColorBalanceParams = ^TGPColorBalanceParams;
  3021.  
  3022. type
  3023. TGPColorLUTParams = record
  3024. // look up tables for each color channel.
  3025.  
  3026. LutB: TGPColorChannelLUT;
  3027. LutG: TGPColorChannelLUT;
  3028. LutR: TGPColorChannelLUT;
  3029. LutA: TGPColorChannelLUT;
  3030. end;
  3031. PGPColorLUTParams = ^TGPColorLUTParams;
  3032.  
  3033. type
  3034. TGPCurveAdjustments = (
  3035. AdjustExposure,
  3036. AdjustDensity,
  3037. AdjustContrast,
  3038. AdjustHighlight,
  3039. AdjustShadow,
  3040. AdjustMidtone,
  3041. AdjustWhiteSaturation,
  3042. AdjustBlackSaturation);
  3043.  
  3044. type
  3045. TGPCurveChannel = (
  3046. CurveChannelAll,
  3047. CurveChannelRed,
  3048. CurveChannelGreen,
  3049. CurveChannelBlue);
  3050.  
  3051. type
  3052. TGPColorCurveParams = record
  3053. public
  3054. Adjustment: TGPCurveAdjustments;
  3055. Channel: TGPCurveChannel;
  3056. AdjustValue: Integer;
  3057. end;
  3058. PGPColorCurveParams = ^TGPColorCurveParams;
  3059.  
  3060. type
  3061. CGpEffect = Pointer;
  3062.  
  3063. function GdipCreateEffect(Guid: TGUID;
  3064. out Effect: CGpEffect): TGPStatus; stdcall; external GdiPlusDll;
  3065.  
  3066. function GdipDeleteEffect(Effect: CGpEffect): TGPStatus; stdcall; external GdiPlusDll;
  3067.  
  3068. function GdipGetEffectParameterSize(Effect: CGpEffect;
  3069. out Size: UINT): TGPStatus; stdcall; external GdiPlusDll;
  3070.  
  3071. function GdipSetEffectParameters(Effect: CGpEffect; const Params: Pointer;
  3072. const Size: UINT): TGPStatus; stdcall; external GdiPlusDll;
  3073.  
  3074. function GdipGetEffectParameters(Effect: CGpEffect; var Size: UINT;
  3075. Params: Pointer): TGPStatus; stdcall; external GdiPlusDll;
  3076.  
  3077. type
  3078. IGPEffect = interface(IGdiPlusBase)
  3079. ['{446CEE9F-25A0-400F-8599-3905CBE4828A}']
  3080. { Property access methods }
  3081. function GetAuxDataSize: Integer;
  3082. function GetAuxData: Pointer;
  3083. function GetUseAuxData: Boolean;
  3084. procedure SetUseAuxData(const Value: Boolean);
  3085. function GetParameterSize: Cardinal;
  3086.  
  3087. { Methods }
  3088. procedure ReleaseAuxData;
  3089. procedure SetAuxData(const Data: Pointer; const Size: Integer);
  3090.  
  3091. { Properties }
  3092. property AuxDataSize: Integer read GetAuxDataSize;
  3093. property AuxData: Pointer read GetAuxData;
  3094. property UseAuxData: Boolean read GetUseAuxData write SetUseAuxData;
  3095. property ParameterSize: Cardinal read GetParameterSize;
  3096. end;
  3097.  
  3098. TGPEffect = class(TGdiplusBase, IGPEffect)
  3099. private
  3100. FAuxDataSize: Integer;
  3101. FAuxData: Pointer;
  3102. FUseAuxData: Boolean;
  3103. private
  3104. { IGPEffect }
  3105. function GetAuxDataSize: Integer;
  3106. function GetAuxData: Pointer;
  3107. function GetUseAuxData: Boolean;
  3108. procedure SetUseAuxData(const Value: Boolean);
  3109. function GetParameterSize: Cardinal;
  3110. procedure ReleaseAuxData;
  3111. procedure SetAuxData(const Data: Pointer; const Size: Integer);
  3112. protected
  3113. procedure SetParameters(const Params: Pointer; const Size: Cardinal);
  3114. procedure GetParameters(var Size: Cardinal; Params: Pointer);
  3115. public
  3116. destructor Destroy; override;
  3117. end;
  3118.  
  3119. type
  3120. // Blur
  3121. IGPBlur = interface(IGPEffect)
  3122. ['{8F6EFDE6-E905-4886-8386-8BE9E92545E5}']
  3123. { Property access methods }
  3124. function GetParameters: TGPBlurParams;
  3125. procedure SetParameters(const Value: TGPBlurParams);
  3126.  
  3127. { Properties }
  3128. property Parameters: TGPBlurParams read GetParameters write SetParameters;
  3129. end;
  3130.  
  3131. TGPBlur = class(TGPEffect, IGPBlur)
  3132. private
  3133. { IGPBlur }
  3134. function GetParameters: TGPBlurParams;
  3135. procedure SetParameters(const Value: TGPBlurParams);
  3136. public
  3137. constructor Create;
  3138. end;
  3139.  
  3140. type
  3141. // Sharpen
  3142. IGPSharpen = interface(IGPEffect)
  3143. ['{D5276FFC-FB19-4DCC-9FBB-DC5142DDE65E}']
  3144. { Property access methods }
  3145. function GetParameters: TGPSharpenParams;
  3146. procedure SetParameters(const Value: TGPSharpenParams);
  3147.  
  3148. { Properties }
  3149. property Parameters: TGPSharpenParams read GetParameters write SetParameters;
  3150. end;
  3151.  
  3152. TGPSharpen = class(TGPEffect, IGPSharpen)
  3153. private
  3154. { IGPSharpen }
  3155. function GetParameters: TGPSharpenParams;
  3156. procedure SetParameters(const Value: TGPSharpenParams);
  3157. public
  3158. constructor Create;
  3159. end;
  3160.  
  3161. type
  3162. // RedEye Correction
  3163. IGPRedEyeCorrection = interface(IGPEffect)
  3164. ['{055F978A-DB24-48C9-B87E-BA5616809566}']
  3165. { Property access methods }
  3166. function GetParameters: TGPRedEyeCorrectionParams;
  3167. procedure SetParameters(const Value: TGPRedEyeCorrectionParams);
  3168.  
  3169. { Properties }
  3170. property Parameters: TGPRedEyeCorrectionParams read GetParameters write SetParameters;
  3171. end;
  3172.  
  3173. TGPRedEyeCorrection = class(TGPEffect, IGPRedEyeCorrection)
  3174. private
  3175. { IGPRedEyeCorrection }
  3176. function GetParameters: TGPRedEyeCorrectionParams;
  3177. procedure SetParameters(const Value: TGPRedEyeCorrectionParams);
  3178. public
  3179. constructor Create;
  3180. end;
  3181.  
  3182. type
  3183. // Brightness/Contrast
  3184. IGPBrightnessContrast = interface(IGPEffect)
  3185. ['{3216DA55-5C78-4376-B693-E538E757118E}']
  3186. { Property access methods }
  3187. function GetParameters: TGPBrightnessContrastParams;
  3188. procedure SetParameters(const Value: TGPBrightnessContrastParams);
  3189.  
  3190. { Properties }
  3191. property Parameters: TGPBrightnessContrastParams read GetParameters write SetParameters;
  3192. end;
  3193.  
  3194. TGPBrightnessContrast = class(TGPEffect, IGPBrightnessContrast)
  3195. private
  3196. { IGPBrightnessContrast }
  3197. function GetParameters: TGPBrightnessContrastParams;
  3198. procedure SetParameters(const Value: TGPBrightnessContrastParams);
  3199. public
  3200. constructor Create;
  3201. end;
  3202.  
  3203. type
  3204. // Hue/Saturation/Lightness
  3205. IGPHueSaturationLightness = interface(IGPEffect)
  3206. ['{7DFF5E66-E1FB-4441-B78A-03423A1AB3CC}']
  3207. { Property access methods }
  3208. function GetParameters: TGPHueSaturationLightnessParams;
  3209. procedure SetParameters(const Value: TGPHueSaturationLightnessParams);
  3210.  
  3211. { Properties }
  3212. property Parameters: TGPHueSaturationLightnessParams read GetParameters write SetParameters;
  3213. end;
  3214.  
  3215. TGPHueSaturationLightness = class(TGPEffect, IGPHueSaturationLightness)
  3216. private
  3217. { IGPHueSaturationLightness }
  3218. function GetParameters: TGPHueSaturationLightnessParams;
  3219. procedure SetParameters(const Value: TGPHueSaturationLightnessParams);
  3220. public
  3221. constructor Create;
  3222. end;
  3223.  
  3224. type
  3225. // Highlight/Midtone/Shadow curves
  3226. IGPLevels = interface(IGPEffect)
  3227. ['{A4770860-C2CA-47EB-AF07-91F85B2FD0FC}']
  3228. { Property access methods }
  3229. function GetParameters: TGPLevelsParams;
  3230. procedure SetParameters(const Value: TGPLevelsParams);
  3231.  
  3232. { Properties }
  3233. property Parameters: TGPLevelsParams read GetParameters write SetParameters;
  3234. end;
  3235.  
  3236. TGPLevels = class(TGPEffect, IGPLevels)
  3237. private
  3238. { IGPLevels }
  3239. function GetParameters: TGPLevelsParams;
  3240. procedure SetParameters(const Value: TGPLevelsParams);
  3241. public
  3242. constructor Create;
  3243. end;
  3244.  
  3245. type
  3246. // Tint
  3247. IGPTint = interface(IGPEffect)
  3248. ['{EEBFC517-2FC5-4164-860A-C133C1D15541}']
  3249. { Property access methods }
  3250. function GetParameters: TGPTintParams;
  3251. procedure SetParameters(const Value: TGPTintParams);
  3252.  
  3253. { Properties }
  3254. property Parameters: TGPTintParams read GetParameters write SetParameters;
  3255. end;
  3256.  
  3257. TGPTint = class(TGPEffect, IGPTint)
  3258. private
  3259. { IGPTint }
  3260. function GetParameters: TGPTintParams;
  3261. procedure SetParameters(const Value: TGPTintParams);
  3262. public
  3263. constructor Create;
  3264. end;
  3265.  
  3266. type
  3267. // ColorBalance
  3268. IGPColorBalance = interface(IGPEffect)
  3269. ['{951B7FA7-239E-402E-B20F-DC1058A93B38}']
  3270. { Property access methods }
  3271. function GetParameters: TGPColorBalanceParams;
  3272. procedure SetParameters(const Value: TGPColorBalanceParams);
  3273.  
  3274. { Properties }
  3275. property Parameters: TGPColorBalanceParams read GetParameters write SetParameters;
  3276. end;
  3277.  
  3278. TGPColorBalance = class(TGPEffect, IGPColorBalance)
  3279. private
  3280. { IGPColorBalance }
  3281. function GetParameters: TGPColorBalanceParams;
  3282. procedure SetParameters(const Value: TGPColorBalanceParams);
  3283. public
  3284. constructor Create;
  3285. end;
  3286.  
  3287. type
  3288. // ColorMatrix
  3289. IGPColorMatrixEffect = interface(IGPEffect)
  3290. ['{492E9124-97C2-45AD-BC4E-699F75C62AF4}']
  3291. { Property access methods }
  3292. function GetParameters: TGPColorMatrix;
  3293. procedure SetParameters(const Value: TGPColorMatrix);
  3294.  
  3295. { Properties }
  3296. property Parameters: TGPColorMatrix read GetParameters write SetParameters;
  3297. end;
  3298.  
  3299. TGPColorMatrixEffect = class(TGPEffect, IGPColorMatrixEffect)
  3300. private
  3301. { IGPColorMatrixEffect }
  3302. function GetParameters: TGPColorMatrix;
  3303. procedure SetParameters(const Value: TGPColorMatrix);
  3304. public
  3305. constructor Create;
  3306. end;
  3307.  
  3308. type
  3309. // ColorLUT
  3310. IGPColorLUT = interface(IGPEffect)
  3311. ['{4846B6A9-7A08-4A09-B599-963588A77C14}']
  3312. { Property access methods }
  3313. function GetParameters: TGPColorLUTParams;
  3314. procedure SetParameters(const Value: TGPColorLUTParams);
  3315.  
  3316. { Properties }
  3317. property Parameters: TGPColorLUTParams read GetParameters write SetParameters;
  3318. end;
  3319.  
  3320. TGPColorLUT = class(TGPEffect, IGPColorLUT)
  3321. private
  3322. { IGPColorLUT }
  3323. function GetParameters: TGPColorLUTParams;
  3324. procedure SetParameters(const Value: TGPColorLUTParams);
  3325. public
  3326. constructor Create;
  3327. end;
  3328.  
  3329. type
  3330. // Color Curve
  3331. IGPColorCurve = interface(IGPEffect)
  3332. ['{710EE23F-A7A0-43E4-9551-51EA66E12773}']
  3333. { Property access methods }
  3334. function GetParameters: TGPColorCurveParams;
  3335. procedure SetParameters(const Value: TGPColorCurveParams);
  3336.  
  3337. { Properties }
  3338. property Parameters: TGPColorCurveParams read GetParameters write SetParameters;
  3339. end;
  3340.  
  3341. TGPColorCurve = class(TGPEffect, IGPColorCurve)
  3342. private
  3343. { IGPColorCurve }
  3344. function GetParameters: TGPColorCurveParams;
  3345. procedure SetParameters(const Value: TGPColorCurveParams);
  3346. public
  3347. constructor Create;
  3348. end;
  3349. {$IFEND}
  3350. {$ENDREGION 'GdiplusEffects.h'}
  3351.  
  3352. {$REGION 'GdiplusGpStubs.h (1)'}
  3353. (*****************************************************************************
  3354. * GdiplusGpStubs.h
  3355. * Private GDI+ header file.
  3356. *****************************************************************************)
  3357.  
  3358. //---------------------------------------------------------------------------
  3359. // Private GDI+ classes for internal type checking
  3360. //---------------------------------------------------------------------------
  3361.  
  3362. GpGraphics = Pointer;
  3363.  
  3364. GpBrush = Pointer;
  3365. GpTexture = Pointer;
  3366. GpSolidFill = Pointer;
  3367. GpLineGradient = Pointer;
  3368. GpPathGradient = Pointer;
  3369. GpHatch = Pointer;
  3370.  
  3371. GpPen = Pointer;
  3372. GpCustomLineCap = Pointer;
  3373. GpAdjustableArrowCap = Pointer;
  3374.  
  3375. GpImage = Pointer;
  3376. GpBitmap = Pointer;
  3377. PGpBitmap = ^GpBitmap;
  3378. GpMetafile = Pointer;
  3379. GpImageAttributes = Pointer;
  3380.  
  3381. GpPath = Pointer;
  3382. GpRegion = Pointer;
  3383. PGpRegion = ^GpRegion;
  3384. GpPathIterator = Pointer;
  3385.  
  3386. GpFontFamily = Pointer;
  3387. PGpFontFamily = ^GpFontFamily;
  3388. GpFont = Pointer;
  3389. GpStringFormat = Pointer;
  3390. GpFontCollection = Pointer;
  3391. GpInstalledFontCollection = Pointer;
  3392. GpPrivateFontCollection = Pointer;
  3393.  
  3394. GpCachedBitmap = Pointer;
  3395.  
  3396. GpMatrix = Pointer;
  3397.  
  3398. {$ENDREGION 'GdiplusGpStubs.h (1)'}
  3399.  
  3400. {$REGION 'GdiplusFlat.h'}
  3401. (*****************************************************************************
  3402. * GdiplusFlat.h
  3403. * Private GDI+ header file.
  3404. *****************************************************************************)
  3405.  
  3406. //----------------------------------------------------------------------------
  3407. // GraphicsPath APIs
  3408. //----------------------------------------------------------------------------
  3409.  
  3410. { GdipCreatePath(GpFillMode brushMode, GpPath **path); }
  3411. function GdipCreatePath(BrushMode: TGPFillMode; out Path: GpPath): TGPStatus; stdcall;
  3412. external GdiPlusDll;
  3413.  
  3414. { GdipCreatePath2(GDIPCONST GpPointF*, GDIPCONST BYTE*, INT, GpFillMode, GpPath **path); }
  3415. function GdipCreatePath2(const Param1: PGPPointF; const Param2: PByte;
  3416. Param3: Integer; Param4: TGPFillMode; out Path: GpPath): TGPStatus; stdcall;
  3417. external GdiPlusDll;
  3418.  
  3419. { GdipCreatePath2I(GDIPCONST GpPoint*, GDIPCONST BYTE*, INT, GpFillMode, GpPath **path); }
  3420. function GdipCreatePath2I(const Param1: PGPPoint; const Param2: PByte;
  3421. Param3: Integer; Param4: TGPFillMode; out Path: GpPath): TGPStatus; stdcall;
  3422. external GdiPlusDll;
  3423.  
  3424. { GdipClonePath(GpPath* path, GpPath **clonePath); }
  3425. function GdipClonePath(Path: GpPath; out ClonePath: GpPath): TGPStatus; stdcall;
  3426. external GdiPlusDll;
  3427.  
  3428. { GdipDeletePath(GpPath* path); }
  3429. function GdipDeletePath(Path: GpPath): TGPStatus; stdcall; external GdiPlusDll;
  3430.  
  3431. { GdipResetPath(GpPath* path); }
  3432. function GdipResetPath(Path: GpPath): TGPStatus; stdcall; external GdiPlusDll;
  3433.  
  3434. { GdipGetPointCount(GpPath* path, INT* count); }
  3435. function GdipGetPointCount(Path: GpPath; out Count: Integer): TGPStatus; stdcall;
  3436. external GdiPlusDll;
  3437.  
  3438. { GdipGetPathTypes(GpPath* path, BYTE* types, INT count); }
  3439. function GdipGetPathTypes(Path: GpPath; Types: PByte; Count: Integer): TGPStatus; stdcall;
  3440. external GdiPlusDll;
  3441.  
  3442. { GdipGetPathPoints(GpPath*, GpPointF* points, INT count); }
  3443. function GdipGetPathPoints(Path: GpPath; Points: PGPPointF; Count: Integer): TGPStatus; stdcall;
  3444. external GdiPlusDll;
  3445.  
  3446. { GdipGetPathPointsI(GpPath*, GpPoint* points, INT count); }
  3447. function GdipGetPathPointsI(Path: GpPath; Points: PGPPoint; Count: Integer): TGPStatus; stdcall;
  3448. external GdiPlusDll;
  3449.  
  3450. { GdipGetPathFillMode(GpPath *path, GpFillMode *fillmode); }
  3451. function GdipGetPathFillMode(Path: GpPath; out Fillmode: TGPFillMode): TGPStatus; stdcall;
  3452. external GdiPlusDll;
  3453.  
  3454. { GdipSetPathFillMode(GpPath *path, GpFillMode fillmode); }
  3455. function GdipSetPathFillMode(Path: GpPath; Fillmode: TGPFillMode): TGPStatus; stdcall;
  3456. external GdiPlusDll;
  3457.  
  3458. { GdipGetPathData(GpPath *path, GpPathData* pathData); }
  3459. function GdipGetPathData(Path: GpPath; PathData: PGPNativePathData): TGPStatus; stdcall;
  3460. external GdiPlusDll;
  3461.  
  3462. { GdipStartPathFigure(GpPath *path); }
  3463. function GdipStartPathFigure(Path: GpPath): TGPStatus; stdcall; external GdiPlusDll;
  3464.  
  3465. { GdipClosePathFigure(GpPath *path); }
  3466. function GdipClosePathFigure(Path: GpPath): TGPStatus; stdcall; external GdiPlusDll;
  3467.  
  3468. { GdipClosePathFigures(GpPath *path); }
  3469. function GdipClosePathFigures(Path: GpPath): TGPStatus; stdcall; external GdiPlusDll;
  3470.  
  3471. { GdipSetPathMarker(GpPath* path); }
  3472. function GdipSetPathMarker(Path: GpPath): TGPStatus; stdcall; external GdiPlusDll;
  3473.  
  3474. { GdipClearPathMarkers(GpPath* path); }
  3475. function GdipClearPathMarkers(Path: GpPath): TGPStatus; stdcall; external GdiPlusDll;
  3476.  
  3477. { GdipReversePath(GpPath* path); }
  3478. function GdipReversePath(Path: GpPath): TGPStatus; stdcall; external GdiPlusDll;
  3479.  
  3480. { GdipGetPathLastPoint(GpPath* path, GpPointF* lastPoint); }
  3481. function GdipGetPathLastPoint(Path: GpPath; out LastPoint: TGPPointF): TGPStatus; stdcall;
  3482. external GdiPlusDll;
  3483.  
  3484. { GdipAddPathLine(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2); }
  3485. function GdipAddPathLine(Path: GpPath; X1: Single; Y1: Single; X2: Single;
  3486. Y2: Single): TGPStatus; stdcall; external GdiPlusDll;
  3487.  
  3488. { GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, INT count); }
  3489. function GdipAddPathLine2(Path: GpPath; const Points: PGPPointF; Count: Integer): TGPStatus; stdcall;
  3490. external GdiPlusDll;
  3491.  
  3492. { GdipAddPathArc(GpPath *path, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle); }
  3493. function GdipAddPathArc(Path: GpPath; X: Single; Y: Single; Width: Single;
  3494. Height: Single; StartAngle: Single; SweepAngle: Single): TGPStatus; stdcall;
  3495. external GdiPlusDll;
  3496.  
  3497. { GdipAddPathBezier(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4); }
  3498. function GdipAddPathBezier(Path: GpPath; X1: Single; Y1: Single; X2: Single;
  3499. Y2: Single; X3: Single; Y3: Single; X4: Single; Y4: Single): TGPStatus; stdcall;
  3500. external GdiPlusDll;
  3501.  
  3502. { GdipAddPathBeziers(GpPath *path, GDIPCONST GpPointF *points, INT count); }
  3503. function GdipAddPathBeziers(Path: GpPath; const Points: PGPPointF; Count: Integer): TGPStatus; stdcall;
  3504. external GdiPlusDll;
  3505.  
  3506. { GdipAddPathCurve(GpPath *path, GDIPCONST GpPointF *points, INT count); }
  3507. function GdipAddPathCurve(Path: GpPath; const Points: PGPPointF; Count: Integer): TGPStatus; stdcall;
  3508. external GdiPlusDll;
  3509.  
  3510. { GdipAddPathCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, REAL tension); }
  3511. function GdipAddPathCurve2(Path: GpPath; const Points: PGPPointF; Count: Integer;
  3512. Tension: Single): TGPStatus; stdcall; external GdiPlusDll;
  3513.  
  3514. { GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points, INT count, INT offset, INT numberOfSegments, REAL tension); }
  3515. function GdipAddPathCurve3(Path: GpPath; const Points: PGPPointF; Count: Integer;
  3516. Offset: Integer; NumberOfSegments: Integer; Tension: Single): TGPStatus; stdcall;
  3517. external GdiPlusDll;
  3518.  
  3519. { GdipAddPathClosedCurve(GpPath *path, GDIPCONST GpPointF *points, INT count); }
  3520. function GdipAddPathClosedCurve(Path: GpPath; const Points: PGPPointF;
  3521. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3522.  
  3523. { GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, REAL tension); }
  3524. function GdipAddPathClosedCurve2(Path: GpPath; const Points: PGPPointF;
  3525. Count: Integer; Tension: Single): TGPStatus; stdcall; external GdiPlusDll;
  3526.  
  3527. { GdipAddPathRectangle(GpPath *path, REAL x, REAL y, REAL width, REAL height); }
  3528. function GdipAddPathRectangle(Path: GpPath; X: Single; Y: Single; Width: Single;
  3529. Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  3530.  
  3531. { GdipAddPathRectangles(GpPath *path, GDIPCONST GpRectF *rects, INT count); }
  3532. function GdipAddPathRectangles(Path: GpPath; const Rects: PGPRectF;
  3533. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3534.  
  3535. { GdipAddPathEllipse(GpPath *path, REAL x, REAL y, REAL width, REAL height); }
  3536. function GdipAddPathEllipse(Path: GpPath; X: Single; Y: Single; Width: Single;
  3537. Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  3538.  
  3539. { GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle); }
  3540. function GdipAddPathPie(Path: GpPath; X: Single; Y: Single; Width: Single;
  3541. Height: Single; StartAngle: Single; SweepAngle: Single): TGPStatus; stdcall;
  3542. external GdiPlusDll;
  3543.  
  3544. { GdipAddPathPolygon(GpPath *path, GDIPCONST GpPointF *points, INT count); }
  3545. function GdipAddPathPolygon(Path: GpPath; const Points: PGPPointF; Count: Integer): TGPStatus; stdcall;
  3546. external GdiPlusDll;
  3547.  
  3548. { GdipAddPathPath(GpPath *path, GDIPCONST GpPath* addingPath, BOOL connect); }
  3549. function GdipAddPathPath(Path: GpPath; const AddingPath: GpPath; Connect: Bool): TGPStatus; stdcall;
  3550. external GdiPlusDll;
  3551.  
  3552. { GdipAddPathString(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *format); }
  3553. function GdipAddPathString(Path: GpPath; const Str: PWideChar; Length: Integer;
  3554. const Family: GpFontFamily; Style: TGPFontStyle; EmSize: Single;
  3555. const LayoutRect: PGPRectF; const Format: GpStringFormat): TGPStatus; stdcall;
  3556. external GdiPlusDll;
  3557.  
  3558. { GdipAddPathStringI(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST Rect *layoutRect, GDIPCONST GpStringFormat *format); }
  3559. function GdipAddPathStringI(Path: GpPath; const Str: PWideChar; Length: Integer;
  3560. const Family: GpFontFamily; Style: TGPFontStyle; EmSize: Single;
  3561. const LayoutRect: PGPRect; const Format: GpStringFormat): TGPStatus; stdcall;
  3562. external GdiPlusDll;
  3563.  
  3564. { GdipAddPathLineI(GpPath *path, INT x1, INT y1, INT x2, INT y2); }
  3565. function GdipAddPathLineI(Path: GpPath; X1: Integer; Y1: Integer; X2: Integer;
  3566. Y2: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3567.  
  3568. { GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, INT count); }
  3569. function GdipAddPathLine2I(Path: GpPath; const Points: PGPPoint; Count: Integer): TGPStatus; stdcall;
  3570. external GdiPlusDll;
  3571.  
  3572. { GdipAddPathArcI(GpPath *path, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle); }
  3573. function GdipAddPathArcI(Path: GpPath; X: Integer; Y: Integer; Width: Integer;
  3574. Height: Integer; StartAngle: Single; SweepAngle: Single): TGPStatus; stdcall;
  3575. external GdiPlusDll;
  3576.  
  3577. { GdipAddPathBezierI(GpPath *path, INT x1, INT y1, INT x2, INT y2, INT x3, INT y3, INT x4, INT y4); }
  3578. function GdipAddPathBezierI(Path: GpPath; X1: Integer; Y1: Integer; X2: Integer;
  3579. Y2: Integer; X3: Integer; Y3: Integer; X4: Integer; Y4: Integer): TGPStatus; stdcall;
  3580. external GdiPlusDll;
  3581.  
  3582. { GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points, INT count); }
  3583. function GdipAddPathBeziersI(Path: GpPath; const Points: PGPPoint; Count: Integer): TGPStatus; stdcall;
  3584. external GdiPlusDll;
  3585.  
  3586. { GdipAddPathCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count); }
  3587. function GdipAddPathCurveI(Path: GpPath; const Points: PGPPoint; Count: Integer): TGPStatus; stdcall;
  3588. external GdiPlusDll;
  3589.  
  3590. { GdipAddPathCurve2I(GpPath *path, GDIPCONST GpPoint *points, INT count, REAL tension); }
  3591. function GdipAddPathCurve2I(Path: GpPath; const Points: PGPPoint; Count: Integer;
  3592. Tension: Single): TGPStatus; stdcall; external GdiPlusDll;
  3593.  
  3594. { GdipAddPathCurve3I(GpPath *path, GDIPCONST GpPoint *points, INT count, INT offset, INT numberOfSegments, REAL tension); }
  3595. function GdipAddPathCurve3I(Path: GpPath; const Points: PGPPoint; Count: Integer;
  3596. Offset: Integer; NumberOfSegments: Integer; Tension: Single): TGPStatus; stdcall;
  3597. external GdiPlusDll;
  3598.  
  3599. { GdipAddPathClosedCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count); }
  3600. function GdipAddPathClosedCurveI(Path: GpPath; const Points: PGPPoint;
  3601. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3602.  
  3603. { GdipAddPathClosedCurve2I(GpPath *path, GDIPCONST GpPoint *points, INT count, REAL tension); }
  3604. function GdipAddPathClosedCurve2I(Path: GpPath; const Points: PGPPoint;
  3605. Count: Integer; Tension: Single): TGPStatus; stdcall; external GdiPlusDll;
  3606.  
  3607. { GdipAddPathRectangleI(GpPath *path, INT x, INT y, INT width, INT height); }
  3608. function GdipAddPathRectangleI(Path: GpPath; X: Integer; Y: Integer;
  3609. Width: Integer; Height: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3610.  
  3611. { GdipAddPathRectanglesI(GpPath *path, GDIPCONST GpRect *rects, INT count); }
  3612. function GdipAddPathRectanglesI(Path: GpPath; const Rects: PGPRect;
  3613. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3614.  
  3615. { GdipAddPathEllipseI(GpPath *path, INT x, INT y, INT width, INT height); }
  3616. function GdipAddPathEllipseI(Path: GpPath; X: Integer; Y: Integer;
  3617. Width: Integer; Height: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3618.  
  3619. { GdipAddPathPieI(GpPath *path, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle); }
  3620. function GdipAddPathPieI(Path: GpPath; X: Integer; Y: Integer; Width: Integer;
  3621. Height: Integer; StartAngle: Single; SweepAngle: Single): TGPStatus; stdcall;
  3622. external GdiPlusDll;
  3623.  
  3624. { GdipAddPathPolygonI(GpPath *path, GDIPCONST GpPoint *points, INT count); }
  3625. function GdipAddPathPolygonI(Path: GpPath; const Points: PGPPoint; Count: Integer): TGPStatus; stdcall;
  3626. external GdiPlusDll;
  3627.  
  3628. { GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatness); }
  3629. function GdipFlattenPath(Path: GpPath; Matrix: GpMatrix; Flatness: Single): TGPStatus; stdcall;
  3630. external GdiPlusDll;
  3631.  
  3632. { GdipWindingModeOutline( GpPath *path, GpMatrix *matrix, REAL flatness ); }
  3633. function GdipWindingModeOutline(Path: GpPath; Matrix: GpMatrix;
  3634. Flatness: Single): TGPStatus; stdcall; external GdiPlusDll;
  3635.  
  3636. { GdipWidenPath( GpPath *nativePath, GpPen *pen, GpMatrix *matrix, REAL flatness ); }
  3637. function GdipWidenPath(NativePath: GpPath; Pen: GpPen; Matrix: GpMatrix;
  3638. Flatness: Single): TGPStatus; stdcall; external GdiPlusDll;
  3639.  
  3640. { GdipWarpPath(GpPath *path, GpMatrix* matrix, GDIPCONST GpPointF *points, INT count, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, WarpMode warpMode, REAL flatness); }
  3641. function GdipWarpPath(Path: GpPath; Matrix: GpMatrix; const Points: PGPPointF;
  3642. Count: Integer; Srcx: Single; Srcy: Single; Srcwidth: Single;
  3643. Srcheight: Single; WarpMode: TGPWarpMode; Flatness: Single): TGPStatus; stdcall;
  3644. external GdiPlusDll;
  3645.  
  3646. { GdipTransformPath(GpPath* path, GpMatrix* matrix); }
  3647. function GdipTransformPath(Path: GpPath; Matrix: GpMatrix): TGPStatus; stdcall;
  3648. external GdiPlusDll;
  3649.  
  3650. { GdipGetPathWorldBounds(GpPath* path, GpRectF* bounds, GDIPCONST GpMatrix *matrix, GDIPCONST GpPen *pen); }
  3651. function GdipGetPathWorldBounds(Path: GpPath; Bounds: PGPRectF;
  3652. const Matrix: GpMatrix; const Pen: GpPen): TGPStatus; stdcall; external GdiPlusDll;
  3653.  
  3654. { GdipGetPathWorldBoundsI(GpPath* path, GpRect* bounds, GDIPCONST GpMatrix *matrix, GDIPCONST GpPen *pen); }
  3655. function GdipGetPathWorldBoundsI(Path: GpPath; Bounds: PGPRect;
  3656. const Matrix: GpMatrix; const Pen: GpPen): TGPStatus; stdcall; external GdiPlusDll;
  3657.  
  3658. { GdipIsVisiblePathPoint(GpPath* path, REAL x, REAL y, GpGraphics *graphics, BOOL *result); }
  3659. function GdipIsVisiblePathPoint(Path: GpPath; X: Single; Y: Single;
  3660. Graphics: GpGraphics; out Result: Bool): TGPStatus; stdcall; external GdiPlusDll;
  3661.  
  3662. { GdipIsVisiblePathPointI(GpPath* path, INT x, INT y, GpGraphics *graphics, BOOL *result); }
  3663. function GdipIsVisiblePathPointI(Path: GpPath; X: Integer; Y: Integer;
  3664. Graphics: GpGraphics; out Result: Bool): TGPStatus; stdcall; external GdiPlusDll;
  3665.  
  3666. { GdipIsOutlineVisiblePathPoint(GpPath* path, REAL x, REAL y, GpPen *pen, GpGraphics *graphics, BOOL *result); }
  3667. function GdipIsOutlineVisiblePathPoint(Path: GpPath; X: Single; Y: Single;
  3668. Pen: GpPen; Graphics: GpGraphics; out Result: Bool): TGPStatus; stdcall;
  3669. external GdiPlusDll;
  3670.  
  3671. { GdipIsOutlineVisiblePathPointI(GpPath* path, INT x, INT y, GpPen *pen, GpGraphics *graphics, BOOL *result); }
  3672. function GdipIsOutlineVisiblePathPointI(Path: GpPath; X: Integer; Y: Integer;
  3673. Pen: GpPen; Graphics: GpGraphics; out Result: Bool): TGPStatus; stdcall;
  3674. external GdiPlusDll;
  3675.  
  3676.  
  3677. //----------------------------------------------------------------------------
  3678. // PathIterator APIs
  3679. //----------------------------------------------------------------------------
  3680.  
  3681. { GdipCreatePathIter(GpPathIterator **iterator, GpPath* path); }
  3682. function GdipCreatePathIter(out Iterator: GpPathIterator; Path: GpPath): TGPStatus; stdcall;
  3683. external GdiPlusDll;
  3684.  
  3685. { GdipDeletePathIter(GpPathIterator *iterator); }
  3686. function GdipDeletePathIter(Iterator: GpPathIterator): TGPStatus; stdcall;
  3687. external GdiPlusDll;
  3688.  
  3689. { GdipPathIterNextSubpath(GpPathIterator* iterator, INT *resultCount, INT* startIndex, INT* endIndex, BOOL* isClosed); }
  3690. function GdipPathIterNextSubpath(Iterator: GpPathIterator;
  3691. out ResultCount: Integer; out StartIndex: Integer; out EndIndex: Integer;
  3692. out IsClosed: Bool): TGPStatus; stdcall; external GdiPlusDll;
  3693.  
  3694. { GdipPathIterNextSubpathPath(GpPathIterator* iterator, INT* resultCount, GpPath* path, BOOL* isClosed); }
  3695. function GdipPathIterNextSubpathPath(Iterator: GpPathIterator;
  3696. out ResultCount: Integer; Path: GpPath; out IsClosed: Bool): TGPStatus; stdcall;
  3697. external GdiPlusDll;
  3698.  
  3699. { GdipPathIterNextPathType(GpPathIterator* iterator, INT* resultCount, BYTE* pathType, INT* startIndex, INT* endIndex); }
  3700. function GdipPathIterNextPathType(Iterator: GpPathIterator;
  3701. out ResultCount: Integer; out PathType: Byte; out StartIndex: Integer;
  3702. out EndIndex: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3703.  
  3704. { GdipPathIterNextMarker(GpPathIterator* iterator, INT *resultCount, INT* startIndex, INT* endIndex); }
  3705. function GdipPathIterNextMarker(Iterator: GpPathIterator; out ResultCount: Integer;
  3706. out StartIndex: Integer; out EndIndex: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3707.  
  3708. { GdipPathIterNextMarkerPath(GpPathIterator* iterator, INT* resultCount, GpPath* path); }
  3709. function GdipPathIterNextMarkerPath(Iterator: GpPathIterator;
  3710. out ResultCount: Integer; Path: GpPath): TGPStatus; stdcall; external GdiPlusDll;
  3711.  
  3712. { GdipPathIterGetCount(GpPathIterator* iterator, INT* count); }
  3713. function GdipPathIterGetCount(Iterator: GpPathIterator; out Count: Integer): TGPStatus; stdcall;
  3714. external GdiPlusDll;
  3715.  
  3716. { GdipPathIterGetSubpathCount(GpPathIterator* iterator, INT* count); }
  3717. function GdipPathIterGetSubpathCount(Iterator: GpPathIterator; out Count: Integer): TGPStatus; stdcall;
  3718. external GdiPlusDll;
  3719.  
  3720. { GdipPathIterIsValid(GpPathIterator* iterator, BOOL* valid); }
  3721. function GdipPathIterIsValid(Iterator: GpPathIterator; Valid: PBool): TGPStatus; stdcall;
  3722. external GdiPlusDll;
  3723.  
  3724. { GdipPathIterHasCurve(GpPathIterator* iterator, BOOL* hasCurve); }
  3725. function GdipPathIterHasCurve(Iterator: GpPathIterator; out HasCurve: Bool): TGPStatus; stdcall;
  3726. external GdiPlusDll;
  3727.  
  3728. { GdipPathIterRewind(GpPathIterator* iterator); }
  3729. function GdipPathIterRewind(Iterator: GpPathIterator): TGPStatus; stdcall;
  3730. external GdiPlusDll;
  3731.  
  3732. { GdipPathIterEnumerate(GpPathIterator* iterator, INT* resultCount, GpPointF *points, BYTE *types, INT count); }
  3733. function GdipPathIterEnumerate(Iterator: GpPathIterator; out ResultCount: Integer;
  3734. Points: PGPPointF; Types: PByte; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3735.  
  3736. { GdipPathIterCopyData(GpPathIterator* iterator, INT* resultCount, GpPointF* points, BYTE* types, INT startIndex, INT endIndex); }
  3737. function GdipPathIterCopyData(Iterator: GpPathIterator; out ResultCount: Integer;
  3738. Points: PGPPointF; Types: PByte; StartIndex: Integer; EndIndex: Integer): TGPStatus; stdcall;
  3739. external GdiPlusDll;
  3740.  
  3741. //----------------------------------------------------------------------------
  3742. // Matrix APIs
  3743. //----------------------------------------------------------------------------
  3744.  
  3745. { GdipCreateMatrix(GpMatrix **matrix); }
  3746. function GdipCreateMatrix(out Matrix: GpMatrix): TGPStatus; stdcall; external GdiPlusDll;
  3747.  
  3748. { GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy, GpMatrix **matrix); }
  3749. function GdipCreateMatrix2(M11: Single; M12: Single; M21: Single; M22: Single;
  3750. Dx: Single; Dy: Single; out Matrix: GpMatrix): TGPStatus; stdcall; external GdiPlusDll;
  3751.  
  3752. { GdipCreateMatrix3(GDIPCONST GpRectF *rect, GDIPCONST GpPointF *dstplg, GpMatrix **matrix); }
  3753. function GdipCreateMatrix3(const Rect: PGPRectF; const Dstplg: PGPPointF;
  3754. out Matrix: GpMatrix): TGPStatus; stdcall; external GdiPlusDll;
  3755.  
  3756. { GdipCreateMatrix3I(GDIPCONST GpRect *rect, GDIPCONST GpPoint *dstplg, GpMatrix **matrix); }
  3757. function GdipCreateMatrix3I(const Rect: PGPRect; const Dstplg: PGPPoint;
  3758. out Matrix: GpMatrix): TGPStatus; stdcall; external GdiPlusDll;
  3759.  
  3760. { GdipCloneMatrix(GpMatrix *matrix, GpMatrix **cloneMatrix); }
  3761. function GdipCloneMatrix(Matrix: GpMatrix; out CloneMatrix: GpMatrix): TGPStatus; stdcall;
  3762. external GdiPlusDll;
  3763.  
  3764. { GdipDeleteMatrix(GpMatrix *matrix); }
  3765. function GdipDeleteMatrix(Matrix: GpMatrix): TGPStatus; stdcall; external GdiPlusDll;
  3766.  
  3767. { GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy); }
  3768. function GdipSetMatrixElements(Matrix: GpMatrix; M11: Single; M12: Single;
  3769. M21: Single; M22: Single; Dx: Single; Dy: Single): TGPStatus; stdcall;
  3770. external GdiPlusDll;
  3771.  
  3772. { GdipMultiplyMatrix(GpMatrix *matrix, GpMatrix* matrix2, GpMatrixOrder order); }
  3773. function GdipMultiplyMatrix(Matrix: GpMatrix; Matrix2: GpMatrix;
  3774. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  3775.  
  3776. { GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order); }
  3777. function GdipTranslateMatrix(Matrix: GpMatrix; OffsetX: Single; OffsetY: Single;
  3778. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  3779.  
  3780. { GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order); }
  3781. function GdipScaleMatrix(Matrix: GpMatrix; ScaleX: Single; ScaleY: Single;
  3782. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  3783.  
  3784. { GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order); }
  3785. function GdipRotateMatrix(Matrix: GpMatrix; Angle: Single; Order: TGPMatrixOrder): TGPStatus; stdcall;
  3786. external GdiPlusDll;
  3787.  
  3788. { GdipShearMatrix(GpMatrix *matrix, REAL shearX, REAL shearY, GpMatrixOrder order); }
  3789. function GdipShearMatrix(Matrix: GpMatrix; ShearX: Single; ShearY: Single;
  3790. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  3791.  
  3792. { GdipInvertMatrix(GpMatrix *matrix); }
  3793. function GdipInvertMatrix(Matrix: GpMatrix): TGPStatus; stdcall; external GdiPlusDll;
  3794.  
  3795. { GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count); }
  3796. function GdipTransformMatrixPoints(Matrix: GpMatrix; Pts: PGPPointF;
  3797. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3798.  
  3799. { GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, INT count); }
  3800. function GdipTransformMatrixPointsI(Matrix: GpMatrix; Pts: PGPPoint;
  3801. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3802.  
  3803. { GdipVectorTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count); }
  3804. function GdipVectorTransformMatrixPoints(Matrix: GpMatrix; Pts: PGPPointF;
  3805. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3806.  
  3807. { GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, INT count); }
  3808. function GdipVectorTransformMatrixPointsI(Matrix: GpMatrix; Pts: PGPPoint;
  3809. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  3810.  
  3811. { GdipGetMatrixElements(GDIPCONST GpMatrix *matrix, REAL *matrixOut); }
  3812. function GdipGetMatrixElements(const Matrix: GpMatrix; MatrixOut: PSingle): TGPStatus; stdcall;
  3813. external GdiPlusDll;
  3814.  
  3815. { GdipIsMatrixInvertible(GDIPCONST GpMatrix *matrix, BOOL *result); }
  3816. function GdipIsMatrixInvertible(const Matrix: GpMatrix; out Result: Bool): TGPStatus; stdcall;
  3817. external GdiPlusDll;
  3818.  
  3819. { GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *result); }
  3820. function GdipIsMatrixIdentity(const Matrix: GpMatrix; out Result: Bool): TGPStatus; stdcall;
  3821. external GdiPlusDll;
  3822.  
  3823. { GdipIsMatrixEqual(GDIPCONST GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, BOOL *result); }
  3824. function GdipIsMatrixEqual(const Matrix: GpMatrix; const Matrix2: GpMatrix;
  3825. out Result: Bool): TGPStatus; stdcall; external GdiPlusDll;
  3826.  
  3827. //----------------------------------------------------------------------------
  3828. // Region APIs
  3829. //----------------------------------------------------------------------------
  3830.  
  3831. { GdipCreateRegion(GpRegion **region); }
  3832. function GdipCreateRegion(out Region: GpRegion): TGPStatus; stdcall; external GdiPlusDll;
  3833.  
  3834. { GdipCreateRegionRect(GDIPCONST GpRectF *rect, GpRegion **region); }
  3835. function GdipCreateRegionRect(const Rect: PGPRectF; out Region: GpRegion): TGPStatus; stdcall;
  3836. external GdiPlusDll;
  3837.  
  3838. { GdipCreateRegionRectI(GDIPCONST GpRect *rect, GpRegion **region); }
  3839. function GdipCreateRegionRectI(const Rect: PGPRect; out Region: GpRegion): TGPStatus; stdcall;
  3840. external GdiPlusDll;
  3841.  
  3842. { GdipCreateRegionPath(GpPath *path, GpRegion **region); }
  3843. function GdipCreateRegionPath(Path: GpPath; out Region: GpRegion): TGPStatus; stdcall;
  3844. external GdiPlusDll;
  3845.  
  3846. { GdipCreateRegionRgnData(GDIPCONST BYTE *regionData, INT size, GpRegion **region); }
  3847. function GdipCreateRegionRgnData(const RegionData: PByte; Size: Integer;
  3848. out Region: GpRegion): TGPStatus; stdcall; external GdiPlusDll;
  3849.  
  3850. { GdipCreateRegionHrgn(HRGN hRgn, GpRegion **region); }
  3851. function GdipCreateRegionHrgn(HRgn: HRGN; out Region: GpRegion): TGPStatus; stdcall;
  3852. external GdiPlusDll;
  3853.  
  3854. { GdipCloneRegion(GpRegion *region, GpRegion **cloneRegion); }
  3855. function GdipCloneRegion(Region: GpRegion; out CloneRegion: GpRegion): TGPStatus; stdcall;
  3856. external GdiPlusDll;
  3857.  
  3858. { GdipDeleteRegion(GpRegion *region); }
  3859. function GdipDeleteRegion(Region: GpRegion): TGPStatus; stdcall; external GdiPlusDll;
  3860.  
  3861. { GdipSetInfinite(GpRegion *region); }
  3862. function GdipSetInfinite(Region: GpRegion): TGPStatus; stdcall; external GdiPlusDll;
  3863.  
  3864. { GdipSetEmpty(GpRegion *region); }
  3865. function GdipSetEmpty(Region: GpRegion): TGPStatus; stdcall; external GdiPlusDll;
  3866.  
  3867. { GdipCombineRegionRect(GpRegion *region, GDIPCONST GpRectF *rect, CombineMode combineMode); }
  3868. function GdipCombineRegionRect(Region: GpRegion; const Rect: PGPRectF;
  3869. CombineMode: TGPCombineMode): TGPStatus; stdcall; external GdiPlusDll;
  3870.  
  3871. { GdipCombineRegionRectI(GpRegion *region, GDIPCONST GpRect *rect, CombineMode combineMode); }
  3872. function GdipCombineRegionRectI(Region: GpRegion; const Rect: PGPRect;
  3873. CombineMode: TGPCombineMode): TGPStatus; stdcall; external GdiPlusDll;
  3874.  
  3875. { GdipCombineRegionPath(GpRegion *region, GpPath *path, CombineMode combineMode); }
  3876. function GdipCombineRegionPath(Region: GpRegion; Path: GpPath;
  3877. CombineMode: TGPCombineMode): TGPStatus; stdcall; external GdiPlusDll;
  3878.  
  3879. { GdipCombineRegionRegion(GpRegion *region, GpRegion *region2, CombineMode combineMode); }
  3880. function GdipCombineRegionRegion(Region: GpRegion; Region2: GpRegion;
  3881. CombineMode: TGPCombineMode): TGPStatus; stdcall; external GdiPlusDll;
  3882.  
  3883. { GdipTranslateRegion(GpRegion *region, REAL dx, REAL dy); }
  3884. function GdipTranslateRegion(Region: GpRegion; Dx: Single; Dy: Single): TGPStatus; stdcall;
  3885. external GdiPlusDll;
  3886.  
  3887. { GdipTranslateRegionI(GpRegion *region, INT dx, INT dy); }
  3888. function GdipTranslateRegionI(Region: GpRegion; Dx: Integer; Dy: Integer): TGPStatus; stdcall;
  3889. external GdiPlusDll;
  3890.  
  3891. { GdipTransformRegion(GpRegion *region, GpMatrix *matrix); }
  3892. function GdipTransformRegion(Region: GpRegion; Matrix: GpMatrix): TGPStatus; stdcall;
  3893. external GdiPlusDll;
  3894.  
  3895. { GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, GpRectF *rect); }
  3896. function GdipGetRegionBounds(Region: GpRegion; Graphics: GpGraphics;
  3897. out Rect: TGPRectF): TGPStatus; stdcall; external GdiPlusDll;
  3898.  
  3899. { GdipGetRegionBoundsI(GpRegion *region, GpGraphics *graphics, GpRect *rect); }
  3900. function GdipGetRegionBoundsI(Region: GpRegion; Graphics: GpGraphics;
  3901. out Rect: TGPRect): TGPStatus; stdcall; external GdiPlusDll;
  3902.  
  3903. { GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HRGN *hRgn); }
  3904. function GdipGetRegionHRgn(Region: GpRegion; Graphics: GpGraphics;
  3905. out HRgn: HRgn): TGPStatus; stdcall; external GdiPlusDll;
  3906.  
  3907. { GdipIsEmptyRegion(GpRegion *region, GpGraphics *graphics, BOOL *result); }
  3908. function GdipIsEmptyRegion(Region: GpRegion; Graphics: GpGraphics;
  3909. out Result: Bool): TGPStatus; stdcall; external GdiPlusDll;
  3910.  
  3911. { GdipIsInfiniteRegion(GpRegion *region, GpGraphics *graphics, BOOL *result); }
  3912. function GdipIsInfiniteRegion(Region: GpRegion; Graphics: GpGraphics;
  3913. out Result: Bool): TGPStatus; stdcall; external GdiPlusDll;
  3914.  
  3915. { GdipIsEqualRegion(GpRegion *region, GpRegion *region2, GpGraphics *graphics, BOOL *result); }
  3916. function GdipIsEqualRegion(Region: GpRegion; Region2: GpRegion;
  3917. Graphics: GpGraphics; out Result: Bool): TGPStatus; stdcall; external GdiPlusDll;
  3918.  
  3919. { GdipGetRegionDataSize(GpRegion *region, UINT * bufferSize); }
  3920. function GdipGetRegionDataSize(Region: GpRegion; out BufferSize: Cardinal): TGPStatus; stdcall;
  3921. external GdiPlusDll;
  3922.  
  3923. { GdipGetRegionData(GpRegion *region, BYTE * buffer, UINT bufferSize, UINT * sizeFilled); }
  3924. function GdipGetRegionData(Region: GpRegion; Buffer: Pointer;
  3925. BufferSize: Cardinal; SizeFilled: PCardinal): TGPStatus; stdcall; external GdiPlusDll;
  3926.  
  3927. { GdipIsVisibleRegionPoint(GpRegion *region, REAL x, REAL y, GpGraphics *graphics, BOOL *result); }
  3928. function GdipIsVisibleRegionPoint(Region: GpRegion; X: Single; Y: Single;
  3929. Graphics: GpGraphics; out Result: Bool): TGPStatus; stdcall; external GdiPlusDll;
  3930.  
  3931. { GdipIsVisibleRegionPointI(GpRegion *region, INT x, INT y, GpGraphics *graphics, BOOL *result); }
  3932. function GdipIsVisibleRegionPointI(Region: GpRegion; X: Integer; Y: Integer;
  3933. Graphics: GpGraphics; out Result: Bool): TGPStatus; stdcall; external GdiPlusDll;
  3934.  
  3935. { GdipIsVisibleRegionRect(GpRegion *region, REAL x, REAL y, REAL width, REAL height, GpGraphics *graphics, BOOL *result); }
  3936. function GdipIsVisibleRegionRect(Region: GpRegion; X: Single; Y: Single;
  3937. Width: Single; Height: Single; Graphics: GpGraphics; out Result: Bool): TGPStatus; stdcall;
  3938. external GdiPlusDll;
  3939.  
  3940. { GdipIsVisibleRegionRectI(GpRegion *region, INT x, INT y, INT width, INT height, GpGraphics *graphics, BOOL *result); }
  3941. function GdipIsVisibleRegionRectI(Region: GpRegion; X: Integer; Y: Integer;
  3942. Width: Integer; Height: Integer; Graphics: GpGraphics; out Result: Bool): TGPStatus; stdcall;
  3943. external GdiPlusDll;
  3944.  
  3945. { GdipGetRegionScansCount(GpRegion *region, UINT* count, GpMatrix* matrix); }
  3946. function GdipGetRegionScansCount(Region: GpRegion; out Count: Integer;
  3947. Matrix: GpMatrix): TGPStatus; stdcall; external GdiPlusDll;
  3948.  
  3949. { GdipGetRegionScans(GpRegion *region, GpRectF* rects, INT* count, GpMatrix* matrix); }
  3950. function GdipGetRegionScans(Region: GpRegion; Rects: PGPRectF; var Count: Integer;
  3951. Matrix: GpMatrix): TGPStatus; stdcall; external GdiPlusDll;
  3952.  
  3953. { GdipGetRegionScansI(GpRegion *region, GpRect* rects, INT* count, GpMatrix* matrix); }
  3954. function GdipGetRegionScansI(Region: GpRegion; Rects: PGPRect; var Count: Integer;
  3955. Matrix: GpMatrix): TGPStatus; stdcall; external GdiPlusDll;
  3956.  
  3957. //----------------------------------------------------------------------------
  3958. // Brush APIs
  3959. //----------------------------------------------------------------------------
  3960.  
  3961. { GdipCloneBrush(GpBrush *brush, GpBrush **cloneBrush); }
  3962. function GdipCloneBrush(Brush: GpBrush; out CloneBrush: GpBrush): TGPStatus; stdcall;
  3963. external GdiPlusDll;
  3964.  
  3965. { GdipDeleteBrush(GpBrush *brush); }
  3966. function GdipDeleteBrush(Brush: GpBrush): TGPStatus; stdcall; external GdiPlusDll;
  3967.  
  3968. { GdipGetBrushType(GpBrush *brush, GpBrushType *type); }
  3969. function GdipGetBrushType(Brush: GpBrush; out AType: TGPBrushType): TGPStatus; stdcall;
  3970. external GdiPlusDll;
  3971.  
  3972. //----------------------------------------------------------------------------
  3973. // HatchBrush APIs
  3974. //----------------------------------------------------------------------------
  3975.  
  3976. { GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush); }
  3977. function GdipCreateHatchBrush(Hatchstyle: TGPHatchStyle; Forecol: ARGB;
  3978. Backcol: ARGB; out Brush: GpHatch): TGPStatus; stdcall; external GdiPlusDll;
  3979.  
  3980. { GdipGetHatchStyle(GpHatch *brush, GpHatchStyle *hatchstyle); }
  3981. function GdipGetHatchStyle(Brush: GpHatch; out Hatchstyle: TGPHatchStyle): TGPStatus; stdcall;
  3982. external GdiPlusDll;
  3983.  
  3984. { GdipGetHatchForegroundColor(GpHatch *brush, ARGB* forecol); }
  3985. function GdipGetHatchForegroundColor(Brush: GpHatch; out Forecol: ARGB): TGPStatus; stdcall;
  3986. external GdiPlusDll;
  3987.  
  3988. { GdipGetHatchBackgroundColor(GpHatch *brush, ARGB* backcol); }
  3989. function GdipGetHatchBackgroundColor(Brush: GpHatch; out Backcol: ARGB): TGPStatus; stdcall;
  3990. external GdiPlusDll;
  3991.  
  3992. //----------------------------------------------------------------------------
  3993. // TextureBrush APIs
  3994. //----------------------------------------------------------------------------
  3995.  
  3996. { GdipCreateTexture(GpImage *image, GpWrapMode wrapmode, GpTexture **texture); }
  3997. function GdipCreateTexture(Image: GpImage; Wrapmode: TGPWrapMode;
  3998. out Texture: GpTexture): TGPStatus; stdcall; external GdiPlusDll;
  3999.  
  4000. { GdipCreateTexture2(GpImage *image, GpWrapMode wrapmode, REAL x, REAL y, REAL width, REAL height, GpTexture **texture); }
  4001. function GdipCreateTexture2(Image: GpImage; Wrapmode: TGPWrapMode; X: Single;
  4002. Y: Single; Width: Single; Height: Single; out Texture: GpTexture): TGPStatus; stdcall;
  4003. external GdiPlusDll;
  4004.  
  4005. { GdipCreateTextureIA(GpImage *image, GDIPCONST GpImageAttributes *imageAttributes, REAL x, REAL y, REAL width, REAL height, GpTexture **texture); }
  4006. function GdipCreateTextureIA(Image: GpImage;
  4007. const ImageAttributes: GpImageAttributes; X: Single; Y: Single; Width: Single;
  4008. Height: Single; out Texture: GpTexture): TGPStatus; stdcall; external GdiPlusDll;
  4009.  
  4010. { GdipCreateTexture2I(GpImage *image, GpWrapMode wrapmode, INT x, INT y, INT width, INT height, GpTexture **texture); }
  4011. function GdipCreateTexture2I(Image: GpImage; Wrapmode: TGPWrapMode; X: Integer;
  4012. Y: Integer; Width: Integer; Height: Integer; out Texture: GpTexture): TGPStatus; stdcall;
  4013. external GdiPlusDll;
  4014.  
  4015. { GdipCreateTextureIAI(GpImage *image, GDIPCONST GpImageAttributes *imageAttributes, INT x, INT y, INT width, INT height, GpTexture **texture); }
  4016. function GdipCreateTextureIAI(Image: GpImage;
  4017. const ImageAttributes: GpImageAttributes; X: Integer; Y: Integer;
  4018. Width: Integer; Height: Integer; out Texture: GpTexture): TGPStatus; stdcall;
  4019. external GdiPlusDll;
  4020.  
  4021.  
  4022. { GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix); }
  4023. function GdipGetTextureTransform(Brush: GpTexture; Matrix: GpMatrix): TGPStatus; stdcall;
  4024. external GdiPlusDll;
  4025.  
  4026. { GdipSetTextureTransform(GpTexture *brush, GDIPCONST GpMatrix *matrix); }
  4027. function GdipSetTextureTransform(Brush: GpTexture; const Matrix: GpMatrix): TGPStatus; stdcall;
  4028. external GdiPlusDll;
  4029.  
  4030. { GdipResetTextureTransform(GpTexture* brush); }
  4031. function GdipResetTextureTransform(Brush: GpTexture): TGPStatus; stdcall;
  4032. external GdiPlusDll;
  4033.  
  4034. { GdipMultiplyTextureTransform(GpTexture* brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order); }
  4035. function GdipMultiplyTextureTransform(Brush: GpTexture; const Matrix: GpMatrix;
  4036. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4037.  
  4038. { GdipTranslateTextureTransform(GpTexture* brush, REAL dx, REAL dy, GpMatrixOrder order); }
  4039. function GdipTranslateTextureTransform(Brush: GpTexture; Dx: Single; Dy: Single;
  4040. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4041.  
  4042. { GdipScaleTextureTransform(GpTexture* brush, REAL sx, REAL sy, GpMatrixOrder order); }
  4043. function GdipScaleTextureTransform(Brush: GpTexture; Sx: Single; Sy: Single;
  4044. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4045.  
  4046. { GdipRotateTextureTransform(GpTexture* brush, REAL angle, GpMatrixOrder order); }
  4047. function GdipRotateTextureTransform(Brush: GpTexture; Angle: Single;
  4048. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4049.  
  4050. { GdipSetTextureWrapMode(GpTexture *brush, GpWrapMode wrapmode); }
  4051. function GdipSetTextureWrapMode(Brush: GpTexture; Wrapmode: TGPWrapMode): TGPStatus; stdcall;
  4052. external GdiPlusDll;
  4053.  
  4054. { GdipGetTextureWrapMode(GpTexture *brush, GpWrapMode *wrapmode); }
  4055. function GdipGetTextureWrapMode(Brush: GpTexture; out Wrapmode: TGPWrapMode): TGPStatus; stdcall;
  4056. external GdiPlusDll;
  4057.  
  4058. { GdipGetTextureImage(GpTexture *brush, GpImage **image); }
  4059. function GdipGetTextureImage(Brush: GpTexture; out Image: GpImage): TGPStatus; stdcall;
  4060. external GdiPlusDll;
  4061.  
  4062. //----------------------------------------------------------------------------
  4063. // SolidBrush APIs
  4064. //----------------------------------------------------------------------------
  4065.  
  4066. { GdipCreateSolidFill(ARGB color, GpSolidFill **brush); }
  4067. function GdipCreateSolidFill(Color: ARGB; out Brush: GpSolidFill): TGPStatus; stdcall;
  4068. external GdiPlusDll;
  4069.  
  4070. { GdipSetSolidFillColor(GpSolidFill *brush, ARGB color); }
  4071. function GdipSetSolidFillColor(Brush: GpSolidFill; Color: ARGB): TGPStatus; stdcall;
  4072. external GdiPlusDll;
  4073.  
  4074. { GdipGetSolidFillColor(GpSolidFill *brush, ARGB *color); }
  4075. function GdipGetSolidFillColor(Brush: GpSolidFill; out Color: ARGB): TGPStatus; stdcall;
  4076. external GdiPlusDll;
  4077.  
  4078. //----------------------------------------------------------------------------
  4079. // LineBrush APIs
  4080. //----------------------------------------------------------------------------
  4081.  
  4082. { GdipCreateLineBrush(GDIPCONST GpPointF* point1, GDIPCONST GpPointF* point2, ARGB color1, ARGB color2, GpWrapMode wrapMode, GpLineGradient **lineGradient); }
  4083. function GdipCreateLineBrush(const Point1: PGPPointF; const Point2: PGPPointF;
  4084. Color1: ARGB; Color2: ARGB; WrapMode: TGPWrapMode;
  4085. out LineGradient: GpLineGradient): TGPStatus; stdcall; external GdiPlusDll;
  4086.  
  4087. { GdipCreateLineBrushI(GDIPCONST GpPoint* point1, GDIPCONST GpPoint* point2, ARGB color1, ARGB color2, GpWrapMode wrapMode, GpLineGradient **lineGradient); }
  4088. function GdipCreateLineBrushI(const Point1: PGPPoint; const Point2: PGPPoint;
  4089. Color1: ARGB; Color2: ARGB; WrapMode: TGPWrapMode;
  4090. out LineGradient: GpLineGradient): TGPStatus; stdcall; external GdiPlusDll;
  4091.  
  4092. { GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect, ARGB color1, ARGB color2, LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient); }
  4093. function GdipCreateLineBrushFromRect(const Rect: PGPRectF; Color1: ARGB;
  4094. Color2: ARGB; Mode: TGPLinearGradientMode; WrapMode: TGPWrapMode;
  4095. out LineGradient: GpLineGradient): TGPStatus; stdcall; external GdiPlusDll;
  4096.  
  4097. { GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect, ARGB color1, ARGB color2, LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient); }
  4098. function GdipCreateLineBrushFromRectI(const Rect: PGPRect; Color1: ARGB;
  4099. Color2: ARGB; Mode: TGPLinearGradientMode; WrapMode: TGPWrapMode;
  4100. out LineGradient: GpLineGradient): TGPStatus; stdcall; external GdiPlusDll;
  4101.  
  4102. { GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect, ARGB color1, ARGB color2, REAL angle, BOOL isAngleScalable, GpWrapMode wrapMode, GpLineGradient **lineGradient); }
  4103. function GdipCreateLineBrushFromRectWithAngle(const Rect: PGPRectF; Color1: ARGB;
  4104. Color2: ARGB; Angle: Single; IsAngleScalable: Bool; WrapMode: TGPWrapMode;
  4105. out LineGradient: GpLineGradient): TGPStatus; stdcall; external GdiPlusDll;
  4106.  
  4107. { GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect* rect, ARGB color1, ARGB color2, REAL angle, BOOL isAngleScalable, GpWrapMode wrapMode, GpLineGradient **lineGradient); }
  4108. function GdipCreateLineBrushFromRectWithAngleI(const Rect: PGPRect; Color1: ARGB;
  4109. Color2: ARGB; Angle: Single; IsAngleScalable: Bool; WrapMode: TGPWrapMode;
  4110. out LineGradient: GpLineGradient): TGPStatus; stdcall; external GdiPlusDll;
  4111.  
  4112. { GdipSetLineColors(GpLineGradient *brush, ARGB color1, ARGB color2); }
  4113. function GdipSetLineColors(Brush: GpLineGradient; Color1: ARGB; Color2: ARGB): TGPStatus; stdcall;
  4114. external GdiPlusDll;
  4115.  
  4116. { GdipGetLineColors(GpLineGradient *brush, ARGB* colors); }
  4117. function GdipGetLineColors(Brush: GpLineGradient; Colors: PARGB): TGPStatus; stdcall;
  4118. external GdiPlusDll;
  4119.  
  4120. { GdipGetLineRect(GpLineGradient *brush, GpRectF *rect); }
  4121. function GdipGetLineRect(Brush: GpLineGradient; out Rect: TGPRectF): TGPStatus; stdcall;
  4122. external GdiPlusDll;
  4123.  
  4124. { GdipGetLineRectI(GpLineGradient *brush, GpRect *rect); }
  4125. function GdipGetLineRectI(Brush: GpLineGradient; out Rect: TGPRect): TGPStatus; stdcall;
  4126. external GdiPlusDll;
  4127.  
  4128. { GdipSetLineGammaCorrection(GpLineGradient *brush, BOOL useGammaCorrection); }
  4129. function GdipSetLineGammaCorrection(Brush: GpLineGradient;
  4130. UseGammaCorrection: Bool): TGPStatus; stdcall; external GdiPlusDll;
  4131.  
  4132. { GdipGetLineGammaCorrection(GpLineGradient *brush, BOOL *useGammaCorrection); }
  4133. function GdipGetLineGammaCorrection(Brush: GpLineGradient;
  4134. out UseGammaCorrection: Bool): TGPStatus; stdcall; external GdiPlusDll;
  4135.  
  4136. { GdipGetLineBlendCount(GpLineGradient *brush, INT *count); }
  4137. function GdipGetLineBlendCount(Brush: GpLineGradient; out Count: Integer): TGPStatus; stdcall;
  4138. external GdiPlusDll;
  4139.  
  4140. { GdipGetLineBlend(GpLineGradient *brush, REAL *blend, REAL* positions, INT count); }
  4141. function GdipGetLineBlend(Brush: GpLineGradient; Blend: PSingle;
  4142. Positions: PSingle; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4143.  
  4144. { GdipSetLineBlend(GpLineGradient *brush, GDIPCONST REAL *blend, GDIPCONST REAL* positions, INT count); }
  4145. function GdipSetLineBlend(Brush: GpLineGradient; const Blend: PSingle;
  4146. const Positions: PSingle; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4147.  
  4148. { GdipGetLinePresetBlendCount(GpLineGradient *brush, INT *count); }
  4149. function GdipGetLinePresetBlendCount(Brush: GpLineGradient; out Count: Integer): TGPStatus; stdcall;
  4150. external GdiPlusDll;
  4151.  
  4152. { GdipGetLinePresetBlend(GpLineGradient *brush, ARGB *blend, REAL* positions, INT count); }
  4153. function GdipGetLinePresetBlend(Brush: GpLineGradient; Blend: PARGB;
  4154. Positions: PSingle; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4155.  
  4156. { GdipSetLinePresetBlend(GpLineGradient *brush, GDIPCONST ARGB *blend, GDIPCONST REAL* positions, INT count); }
  4157. function GdipSetLinePresetBlend(Brush: GpLineGradient; const Blend: PARGB;
  4158. const Positions: PSingle; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4159.  
  4160. { GdipSetLineSigmaBlend(GpLineGradient *brush, REAL focus, REAL scale); }
  4161. function GdipSetLineSigmaBlend(Brush: GpLineGradient; Focus: Single;
  4162. Scale: Single): TGPStatus; stdcall; external GdiPlusDll;
  4163.  
  4164. { GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus, REAL scale); }
  4165. function GdipSetLineLinearBlend(Brush: GpLineGradient; Focus: Single;
  4166. Scale: Single): TGPStatus; stdcall; external GdiPlusDll;
  4167.  
  4168. { GdipSetLineWrapMode(GpLineGradient *brush, GpWrapMode wrapmode); }
  4169. function GdipSetLineWrapMode(Brush: GpLineGradient; Wrapmode: TGPWrapMode): TGPStatus; stdcall;
  4170. external GdiPlusDll;
  4171.  
  4172. { GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapmode); }
  4173. function GdipGetLineWrapMode(Brush: GpLineGradient; out Wrapmode: TGPWrapMode): TGPStatus; stdcall;
  4174. external GdiPlusDll;
  4175.  
  4176. { GdipGetLineTransform(GpLineGradient *brush, GpMatrix *matrix); }
  4177. function GdipGetLineTransform(Brush: GpLineGradient; Matrix: GpMatrix): TGPStatus; stdcall;
  4178. external GdiPlusDll;
  4179.  
  4180. { GdipSetLineTransform(GpLineGradient *brush, GDIPCONST GpMatrix *matrix); }
  4181. function GdipSetLineTransform(Brush: GpLineGradient; const Matrix: GpMatrix): TGPStatus; stdcall;
  4182. external GdiPlusDll;
  4183.  
  4184. { GdipResetLineTransform(GpLineGradient* brush); }
  4185. function GdipResetLineTransform(Brush: GpLineGradient): TGPStatus; stdcall;
  4186. external GdiPlusDll;
  4187.  
  4188. { GdipMultiplyLineTransform(GpLineGradient* brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order); }
  4189. function GdipMultiplyLineTransform(Brush: GpLineGradient;
  4190. const Matrix: GpMatrix; Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4191.  
  4192. { GdipTranslateLineTransform(GpLineGradient* brush, REAL dx, REAL dy, GpMatrixOrder order); }
  4193. function GdipTranslateLineTransform(Brush: GpLineGradient; Dx: Single;
  4194. Dy: Single; Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4195.  
  4196. { GdipScaleLineTransform(GpLineGradient* brush, REAL sx, REAL sy, GpMatrixOrder order); }
  4197. function GdipScaleLineTransform(Brush: GpLineGradient; Sx: Single; Sy: Single;
  4198. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4199.  
  4200. { GdipRotateLineTransform(GpLineGradient* brush, REAL angle, GpMatrixOrder order); }
  4201. function GdipRotateLineTransform(Brush: GpLineGradient; Angle: Single;
  4202. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4203.  
  4204. //----------------------------------------------------------------------------
  4205. // PathGradientBrush APIs
  4206. //----------------------------------------------------------------------------
  4207.  
  4208. { GdipCreatePathGradient(GDIPCONST GpPointF* points, INT count, GpWrapMode wrapMode, GpPathGradient **polyGradient); }
  4209. function GdipCreatePathGradient(const Points: PGPPointF; Count: Integer;
  4210. WrapMode: TGPWrapMode; out PolyGradient: GpPathGradient): TGPStatus; stdcall;
  4211. external GdiPlusDll;
  4212.  
  4213. { GdipCreatePathGradientI(GDIPCONST GpPoint* points, INT count, GpWrapMode wrapMode, GpPathGradient **polyGradient); }
  4214. function GdipCreatePathGradientI(const Points: PGPPoint; Count: Integer;
  4215. WrapMode: TGPWrapMode; out PolyGradient: GpPathGradient): TGPStatus; stdcall;
  4216. external GdiPlusDll;
  4217.  
  4218. { GdipCreatePathGradientFromPath(GDIPCONST GpPath* path, GpPathGradient **polyGradient); }
  4219. function GdipCreatePathGradientFromPath(const Path: GpPath;
  4220. out PolyGradient: GpPathGradient): TGPStatus; stdcall; external GdiPlusDll;
  4221.  
  4222. { GdipGetPathGradientCenterColor( GpPathGradient *brush, ARGB* colors); }
  4223. function GdipGetPathGradientCenterColor(Brush: GpPathGradient; out Color: ARGB): TGPStatus; stdcall;
  4224. external GdiPlusDll;
  4225.  
  4226. { GdipSetPathGradientCenterColor( GpPathGradient *brush, ARGB colors); }
  4227. function GdipSetPathGradientCenterColor(Brush: GpPathGradient; Color: ARGB): TGPStatus; stdcall;
  4228. external GdiPlusDll;
  4229.  
  4230. { GdipGetPathGradientSurroundColorsWithCount( GpPathGradient *brush, ARGB* color, INT* count); }
  4231. function GdipGetPathGradientSurroundColorsWithCount(Brush: GpPathGradient;
  4232. Color: PARGB; out Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4233.  
  4234. { GdipSetPathGradientSurroundColorsWithCount( GpPathGradient *brush, GDIPCONST ARGB* color, INT* count); }
  4235. function GdipSetPathGradientSurroundColorsWithCount(Brush: GpPathGradient;
  4236. const Color: PARGB; out Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4237.  
  4238. { GdipGetPathGradientPath(GpPathGradient *brush, GpPath *path); }
  4239. function GdipGetPathGradientPath(Brush: GpPathGradient; Path: GpPath): TGPStatus; stdcall;
  4240. external GdiPlusDll;
  4241.  
  4242. { GdipSetPathGradientPath(GpPathGradient *brush, GDIPCONST GpPath *path); }
  4243. function GdipSetPathGradientPath(Brush: GpPathGradient; const Path: GpPath): TGPStatus; stdcall;
  4244. external GdiPlusDll;
  4245.  
  4246. { GdipGetPathGradientCenterPoint( GpPathGradient *brush, GpPointF* points); }
  4247. function GdipGetPathGradientCenterPoint(Brush: GpPathGradient; out Point: TGPPointF): TGPStatus; stdcall;
  4248. external GdiPlusDll;
  4249.  
  4250. { GdipGetPathGradientCenterPointI( GpPathGradient *brush, GpPoint* points); }
  4251. function GdipGetPathGradientCenterPointI(Brush: GpPathGradient; out Point: TGPPoint): TGPStatus; stdcall;
  4252. external GdiPlusDll;
  4253.  
  4254. { GdipSetPathGradientCenterPoint( GpPathGradient *brush, GDIPCONST GpPointF* points); }
  4255. function GdipSetPathGradientCenterPoint(Brush: GpPathGradient;
  4256. const Point: PGPPointF): TGPStatus; stdcall; external GdiPlusDll;
  4257.  
  4258. { GdipSetPathGradientCenterPointI( GpPathGradient *brush, GDIPCONST GpPoint* points); }
  4259. function GdipSetPathGradientCenterPointI(Brush: GpPathGradient;
  4260. const Point: PGPPoint): TGPStatus; stdcall; external GdiPlusDll;
  4261.  
  4262. { GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect); }
  4263. function GdipGetPathGradientRect(Brush: GpPathGradient; out Rect: TGPRectF): TGPStatus; stdcall;
  4264. external GdiPlusDll;
  4265.  
  4266. { GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect); }
  4267. function GdipGetPathGradientRectI(Brush: GpPathGradient; out Rect: TGPRect): TGPStatus; stdcall;
  4268. external GdiPlusDll;
  4269.  
  4270. { GdipGetPathGradientPointCount(GpPathGradient *brush, INT* count); }
  4271. function GdipGetPathGradientPointCount(Brush: GpPathGradient; out Count: Integer): TGPStatus; stdcall;
  4272. external GdiPlusDll;
  4273.  
  4274. { GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, INT* count); }
  4275. function GdipGetPathGradientSurroundColorCount(Brush: GpPathGradient;
  4276. out Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4277.  
  4278. { GdipSetPathGradientGammaCorrection(GpPathGradient *brush, BOOL useGammaCorrection); }
  4279. function GdipSetPathGradientGammaCorrection(Brush: GpPathGradient;
  4280. UseGammaCorrection: Bool): TGPStatus; stdcall; external GdiPlusDll;
  4281.  
  4282. { GdipGetPathGradientGammaCorrection(GpPathGradient *brush, BOOL *useGammaCorrection); }
  4283. function GdipGetPathGradientGammaCorrection(Brush: GpPathGradient;
  4284. out UseGammaCorrection: Bool): TGPStatus; stdcall; external GdiPlusDll;
  4285.  
  4286. { GdipGetPathGradientBlendCount(GpPathGradient *brush, INT *count); }
  4287. function GdipGetPathGradientBlendCount(Brush: GpPathGradient; out Count: Integer): TGPStatus; stdcall;
  4288. external GdiPlusDll;
  4289.  
  4290. { GdipGetPathGradientBlend(GpPathGradient *brush, REAL *blend, REAL *positions, INT count); }
  4291. function GdipGetPathGradientBlend(Brush: GpPathGradient; Blend: PSingle;
  4292. Positions: PSingle; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4293.  
  4294. { GdipSetPathGradientBlend(GpPathGradient *brush, GDIPCONST REAL *blend, GDIPCONST REAL *positions, INT count); }
  4295. function GdipSetPathGradientBlend(Brush: GpPathGradient; const Blend: PSingle;
  4296. const Positions: PSingle; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4297.  
  4298. { GdipGetPathGradientPresetBlendCount(GpPathGradient *brush, INT *count); }
  4299. function GdipGetPathGradientPresetBlendCount(Brush: GpPathGradient;
  4300. out Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4301.  
  4302. { GdipGetPathGradientPresetBlend(GpPathGradient *brush, ARGB *blend, REAL* positions, INT count); }
  4303. function GdipGetPathGradientPresetBlend(Brush: GpPathGradient; Blend: PARGB;
  4304. Positions: PSingle; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4305.  
  4306. { GdipSetPathGradientPresetBlend(GpPathGradient *brush, GDIPCONST ARGB *blend, GDIPCONST REAL* positions, INT count); }
  4307. function GdipSetPathGradientPresetBlend(Brush: GpPathGradient;
  4308. const Blend: PARGB; const Positions: PSingle; Count: Integer): TGPStatus; stdcall;
  4309. external GdiPlusDll;
  4310.  
  4311. { GdipSetPathGradientSigmaBlend(GpPathGradient *brush, REAL focus, REAL scale); }
  4312. function GdipSetPathGradientSigmaBlend(Brush: GpPathGradient; Focus: Single;
  4313. Scale: Single): TGPStatus; stdcall; external GdiPlusDll;
  4314.  
  4315. { GdipSetPathGradientLinearBlend(GpPathGradient *brush, REAL focus, REAL scale); }
  4316. function GdipSetPathGradientLinearBlend(Brush: GpPathGradient; Focus: Single;
  4317. Scale: Single): TGPStatus; stdcall; external GdiPlusDll;
  4318.  
  4319. { GdipGetPathGradientWrapMode(GpPathGradient *brush, GpWrapMode *wrapmode); }
  4320. function GdipGetPathGradientWrapMode(Brush: GpPathGradient;
  4321. out Wrapmode: TGPWrapMode): TGPStatus; stdcall; external GdiPlusDll;
  4322.  
  4323. { GdipSetPathGradientWrapMode(GpPathGradient *brush, GpWrapMode wrapmode); }
  4324. function GdipSetPathGradientWrapMode(Brush: GpPathGradient; Wrapmode: TGPWrapMode): TGPStatus; stdcall;
  4325. external GdiPlusDll;
  4326.  
  4327. { GdipGetPathGradientTransform(GpPathGradient *brush, GpMatrix *matrix); }
  4328. function GdipGetPathGradientTransform(Brush: GpPathGradient; Matrix: GpMatrix): TGPStatus; stdcall;
  4329. external GdiPlusDll;
  4330.  
  4331. { GdipSetPathGradientTransform(GpPathGradient *brush, GpMatrix *matrix); }
  4332. function GdipSetPathGradientTransform(Brush: GpPathGradient; Matrix: GpMatrix): TGPStatus; stdcall;
  4333. external GdiPlusDll;
  4334.  
  4335. { GdipResetPathGradientTransform(GpPathGradient* brush); }
  4336. function GdipResetPathGradientTransform(Brush: GpPathGradient): TGPStatus; stdcall;
  4337. external GdiPlusDll;
  4338.  
  4339. { GdipMultiplyPathGradientTransform(GpPathGradient* brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order); }
  4340. function GdipMultiplyPathGradientTransform(Brush: GpPathGradient;
  4341. const Matrix: GpMatrix; Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4342.  
  4343. { GdipTranslatePathGradientTransform(GpPathGradient* brush, REAL dx, REAL dy, GpMatrixOrder order); }
  4344. function GdipTranslatePathGradientTransform(Brush: GpPathGradient; Dx: Single;
  4345. Dy: Single; Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4346.  
  4347. { GdipScalePathGradientTransform(GpPathGradient* brush, REAL sx, REAL sy, GpMatrixOrder order); }
  4348. function GdipScalePathGradientTransform(Brush: GpPathGradient; Sx: Single;
  4349. Sy: Single; Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4350.  
  4351. { GdipRotatePathGradientTransform(GpPathGradient* brush, REAL angle, GpMatrixOrder order); }
  4352. function GdipRotatePathGradientTransform(Brush: GpPathGradient; Angle: Single;
  4353. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4354.  
  4355. { GdipGetPathGradientFocusScales(GpPathGradient *brush, REAL* xScale, REAL* yScale); }
  4356. function GdipGetPathGradientFocusScales(Brush: GpPathGradient; out XScale: Single;
  4357. out YScale: Single): TGPStatus; stdcall; external GdiPlusDll;
  4358.  
  4359. { GdipSetPathGradientFocusScales(GpPathGradient *brush, REAL xScale, REAL yScale); }
  4360. function GdipSetPathGradientFocusScales(Brush: GpPathGradient; XScale: Single;
  4361. YScale: Single): TGPStatus; stdcall; external GdiPlusDll;
  4362.  
  4363. //----------------------------------------------------------------------------
  4364. // Pen APIs
  4365. //----------------------------------------------------------------------------
  4366.  
  4367. { GdipCreatePen1(ARGB color, REAL width, GpUnit unit, GpPen **pen); }
  4368. function GdipCreatePen1(Color: ARGB; Width: Single; AUnit: TGPUnit;
  4369. out Pen: GpPen): TGPStatus; stdcall; external GdiPlusDll;
  4370.  
  4371. { GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit, GpPen **pen); }
  4372. function GdipCreatePen2(Brush: GpBrush; Width: Single; AUnit: TGPUnit;
  4373. out Pen: GpPen): TGPStatus; stdcall; external GdiPlusDll;
  4374.  
  4375. { GdipClonePen(GpPen *pen, GpPen **clonepen); }
  4376. function GdipClonePen(Pen: GpPen; out Clonepen: GpPen): TGPStatus; stdcall;
  4377. external GdiPlusDll;
  4378.  
  4379. { GdipDeletePen(GpPen *pen); }
  4380. function GdipDeletePen(Pen: GpPen): TGPStatus; stdcall; external GdiPlusDll;
  4381.  
  4382. { GdipSetPenWidth(GpPen *pen, REAL width); }
  4383. function GdipSetPenWidth(Pen: GpPen; Width: Single): TGPStatus; stdcall;
  4384. external GdiPlusDll;
  4385.  
  4386. { GdipGetPenWidth(GpPen *pen, REAL *width); }
  4387. function GdipGetPenWidth(Pen: GpPen; out Width: Single): TGPStatus; stdcall;
  4388. external GdiPlusDll;
  4389.  
  4390. { GdipSetPenUnit(GpPen *pen, GpUnit unit); }
  4391. function GdipSetPenUnit(Pen: GpPen; AUnit: TGPUnit): TGPStatus; stdcall;
  4392. external GdiPlusDll;
  4393.  
  4394. { GdipGetPenUnit(GpPen *pen, GpUnit *unit); }
  4395. function GdipGetPenUnit(Pen: GpPen; out AUnit: TGPUnit): TGPStatus; stdcall;
  4396. external GdiPlusDll;
  4397.  
  4398. { GdipSetPenLineCap197819(GpPen *pen, GpLineCap startCap, GpLineCap endCap, GpDashCap dashCap); }
  4399. function GdipSetPenLineCap197819(Pen: GpPen; StartCap: TGPLineCap;
  4400. EndCap: TGPLineCap; DashCap: TGPDashCap): TGPStatus; stdcall; external GdiPlusDll;
  4401.  
  4402. { GdipSetPenStartCap(GpPen *pen, GpLineCap startCap); }
  4403. function GdipSetPenStartCap(Pen: GpPen; StartCap: TGPLineCap): TGPStatus; stdcall;
  4404. external GdiPlusDll;
  4405.  
  4406. { GdipSetPenEndCap(GpPen *pen, GpLineCap endCap); }
  4407. function GdipSetPenEndCap(Pen: GpPen; EndCap: TGPLineCap): TGPStatus; stdcall;
  4408. external GdiPlusDll;
  4409.  
  4410. { GdipSetPenDashCap197819(GpPen *pen, GpDashCap dashCap); }
  4411. function GdipSetPenDashCap197819(Pen: GpPen; DashCap: TGPDashCap): TGPStatus; stdcall;
  4412. external GdiPlusDll;
  4413.  
  4414. { GdipGetPenStartCap(GpPen *pen, GpLineCap *startCap); }
  4415. function GdipGetPenStartCap(Pen: GpPen; out StartCap: TGPLineCap): TGPStatus; stdcall;
  4416. external GdiPlusDll;
  4417.  
  4418. { GdipGetPenEndCap(GpPen *pen, GpLineCap *endCap); }
  4419. function GdipGetPenEndCap(Pen: GpPen; out EndCap: TGPLineCap): TGPStatus; stdcall;
  4420. external GdiPlusDll;
  4421.  
  4422. { GdipGetPenDashCap197819(GpPen *pen, GpDashCap *dashCap); }
  4423. function GdipGetPenDashCap197819(Pen: GpPen; out DashCap: TGPDashCap): TGPStatus; stdcall;
  4424. external GdiPlusDll;
  4425.  
  4426. { GdipSetPenLineJoin(GpPen *pen, GpLineJoin lineJoin); }
  4427. function GdipSetPenLineJoin(Pen: GpPen; LineJoin: TGPLineJoin): TGPStatus; stdcall;
  4428. external GdiPlusDll;
  4429.  
  4430. { GdipGetPenLineJoin(GpPen *pen, GpLineJoin *lineJoin); }
  4431. function GdipGetPenLineJoin(Pen: GpPen; out LineJoin: TGPLineJoin): TGPStatus; stdcall;
  4432. external GdiPlusDll;
  4433.  
  4434. { GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* customCap); }
  4435. function GdipSetPenCustomStartCap(Pen: GpPen; CustomCap: GpCustomLineCap): TGPStatus; stdcall;
  4436. external GdiPlusDll;
  4437.  
  4438. { GdipGetPenCustomStartCap(GpPen *pen, GpCustomLineCap** customCap); }
  4439. function GdipGetPenCustomStartCap(Pen: GpPen; out CustomCap: GpCustomLineCap): TGPStatus; stdcall;
  4440. external GdiPlusDll;
  4441.  
  4442. { GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap); }
  4443. function GdipSetPenCustomEndCap(Pen: GpPen; CustomCap: GpCustomLineCap): TGPStatus; stdcall;
  4444. external GdiPlusDll;
  4445.  
  4446. { GdipGetPenCustomEndCap(GpPen *pen, GpCustomLineCap** customCap); }
  4447. function GdipGetPenCustomEndCap(Pen: GpPen; out CustomCap: GpCustomLineCap): TGPStatus; stdcall;
  4448. external GdiPlusDll;
  4449.  
  4450. { GdipSetPenMiterLimit(GpPen *pen, REAL miterLimit); }
  4451. function GdipSetPenMiterLimit(Pen: GpPen; MiterLimit: Single): TGPStatus; stdcall;
  4452. external GdiPlusDll;
  4453.  
  4454. { GdipGetPenMiterLimit(GpPen *pen, REAL *miterLimit); }
  4455. function GdipGetPenMiterLimit(Pen: GpPen; out MiterLimit: Single): TGPStatus; stdcall;
  4456. external GdiPlusDll;
  4457.  
  4458. { GdipSetPenMode(GpPen *pen, GpPenAlignment penMode); }
  4459. function GdipSetPenMode(Pen: GpPen; PenMode: TGPPenAlignment): TGPStatus; stdcall;
  4460. external GdiPlusDll;
  4461.  
  4462. { GdipGetPenMode(GpPen *pen, GpPenAlignment *penMode); }
  4463. function GdipGetPenMode(Pen: GpPen; out PenMode: TGPPenAlignment): TGPStatus; stdcall;
  4464. external GdiPlusDll;
  4465.  
  4466. { GdipSetPenTransform(GpPen *pen, GpMatrix *matrix); }
  4467. function GdipSetPenTransform(Pen: GpPen; Matrix: GpMatrix): TGPStatus; stdcall;
  4468. external GdiPlusDll;
  4469.  
  4470. { GdipGetPenTransform(GpPen *pen, GpMatrix *matrix); }
  4471. function GdipGetPenTransform(Pen: GpPen; Matrix: GpMatrix): TGPStatus; stdcall;
  4472. external GdiPlusDll;
  4473.  
  4474. { GdipResetPenTransform(GpPen *pen); }
  4475. function GdipResetPenTransform(Pen: GpPen): TGPStatus; stdcall; external GdiPlusDll;
  4476.  
  4477. { GdipMultiplyPenTransform(GpPen *pen, GDIPCONST GpMatrix *matrix, GpMatrixOrder order); }
  4478. function GdipMultiplyPenTransform(Pen: GpPen; const Matrix: GpMatrix;
  4479. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4480.  
  4481. { GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, GpMatrixOrder order); }
  4482. function GdipTranslatePenTransform(Pen: GpPen; Dx: Single; Dy: Single;
  4483. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4484.  
  4485. { GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrixOrder order); }
  4486. function GdipScalePenTransform(Pen: GpPen; Sx: Single; Sy: Single;
  4487. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  4488.  
  4489. { GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order); }
  4490. function GdipRotatePenTransform(Pen: GpPen; Angle: Single; Order: TGPMatrixOrder): TGPStatus; stdcall;
  4491. external GdiPlusDll;
  4492.  
  4493. { GdipSetPenColor(GpPen *pen, ARGB argb); }
  4494. function GdipSetPenColor(Pen: GpPen; Argb: ARGB): TGPStatus; stdcall; external GdiPlusDll;
  4495.  
  4496. { GdipGetPenColor(GpPen *pen, ARGB *argb); }
  4497. function GdipGetPenColor(Pen: GpPen; out Argb: ARGB): TGPStatus; stdcall;
  4498. external GdiPlusDll;
  4499.  
  4500. { GdipSetPenBrushFill(GpPen *pen, GpBrush *brush); }
  4501. function GdipSetPenBrushFill(Pen: GpPen; Brush: GpBrush): TGPStatus; stdcall;
  4502. external GdiPlusDll;
  4503.  
  4504. { GdipGetPenBrushFill(GpPen *pen, GpBrush **brush); }
  4505. function GdipGetPenBrushFill(Pen: GpPen; out Brush: GpBrush): TGPStatus; stdcall;
  4506. external GdiPlusDll;
  4507.  
  4508. { GdipGetPenFillType(GpPen *pen, GpPenType* type); }
  4509. function GdipGetPenFillType(Pen: GpPen; out AType: TGPPenType): TGPStatus; stdcall;
  4510. external GdiPlusDll;
  4511.  
  4512. { GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dashstyle); }
  4513. function GdipGetPenDashStyle(Pen: GpPen; out Dashstyle: TGPDashStyle): TGPStatus; stdcall;
  4514. external GdiPlusDll;
  4515.  
  4516. { GdipSetPenDashStyle(GpPen *pen, GpDashStyle dashstyle); }
  4517. function GdipSetPenDashStyle(Pen: GpPen; Dashstyle: TGPDashStyle): TGPStatus; stdcall;
  4518. external GdiPlusDll;
  4519.  
  4520. { GdipGetPenDashOffset(GpPen *pen, REAL *offset); }
  4521. function GdipGetPenDashOffset(Pen: GpPen; out Offset: Single): TGPStatus; stdcall;
  4522. external GdiPlusDll;
  4523.  
  4524. { GdipSetPenDashOffset(GpPen *pen, REAL offset); }
  4525. function GdipSetPenDashOffset(Pen: GpPen; Offset: Single): TGPStatus; stdcall;
  4526. external GdiPlusDll;
  4527.  
  4528. { GdipGetPenDashCount(GpPen *pen, INT *count); }
  4529. function GdipGetPenDashCount(Pen: GpPen; out Count: Integer): TGPStatus; stdcall;
  4530. external GdiPlusDll;
  4531.  
  4532. { GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash, INT count); }
  4533. function GdipSetPenDashArray(Pen: GpPen; const Dash: PSingle; Count: Integer): TGPStatus; stdcall;
  4534. external GdiPlusDll;
  4535.  
  4536. { GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count); }
  4537. function GdipGetPenDashArray(Pen: GpPen; Dash: PSingle; Count: Integer): TGPStatus; stdcall;
  4538. external GdiPlusDll;
  4539.  
  4540. { GdipGetPenCompoundCount(GpPen *pen, INT *count); }
  4541. function GdipGetPenCompoundCount(Pen: GpPen; out Count: Integer): TGPStatus; stdcall;
  4542. external GdiPlusDll;
  4543.  
  4544. { GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *dash, INT count); }
  4545. function GdipSetPenCompoundArray(Pen: GpPen; const Dash: PSingle;
  4546. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4547.  
  4548. { GdipGetPenCompoundArray(GpPen *pen, REAL *dash, INT count); }
  4549. function GdipGetPenCompoundArray(Pen: GpPen; Dash: PSingle; Count: Integer): TGPStatus; stdcall;
  4550. external GdiPlusDll;
  4551.  
  4552. //----------------------------------------------------------------------------
  4553. // CustomLineCap APIs
  4554. //----------------------------------------------------------------------------
  4555.  
  4556. { GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath, GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap); }
  4557. function GdipCreateCustomLineCap(FillPath: GpPath; StrokePath: GpPath;
  4558. BaseCap: TGPLineCap; BaseInset: Single; out CustomCap: GpCustomLineCap): TGPStatus; stdcall;
  4559. external GdiPlusDll;
  4560.  
  4561. { GdipDeleteCustomLineCap(GpCustomLineCap* customCap); }
  4562. function GdipDeleteCustomLineCap(CustomCap: GpCustomLineCap): TGPStatus; stdcall;
  4563. external GdiPlusDll;
  4564.  
  4565. { GdipCloneCustomLineCap(GpCustomLineCap* customCap, GpCustomLineCap** clonedCap); }
  4566. function GdipCloneCustomLineCap(CustomCap: GpCustomLineCap;
  4567. out ClonedCap: GpCustomLineCap): TGPStatus; stdcall; external GdiPlusDll;
  4568.  
  4569. { GdipGetCustomLineCapType(GpCustomLineCap* customCap, CustomLineCapType* capType); }
  4570. function GdipGetCustomLineCapType(CustomCap: GpCustomLineCap;
  4571. out CapType: TGPCustomLineCapType): TGPStatus; stdcall; external GdiPlusDll;
  4572.  
  4573. { GdipSetCustomLineCapStrokeCaps(GpCustomLineCap* customCap, GpLineCap startCap, GpLineCap endCap); }
  4574. function GdipSetCustomLineCapStrokeCaps(CustomCap: GpCustomLineCap;
  4575. StartCap: TGPLineCap; EndCap: TGPLineCap): TGPStatus; stdcall; external GdiPlusDll;
  4576.  
  4577. { GdipGetCustomLineCapStrokeCaps(GpCustomLineCap* customCap, GpLineCap* startCap, GpLineCap* endCap); }
  4578. function GdipGetCustomLineCapStrokeCaps(CustomCap: GpCustomLineCap;
  4579. out StartCap: TGPLineCap; out EndCap: TGPLineCap): TGPStatus; stdcall; external GdiPlusDll;
  4580.  
  4581. { GdipSetCustomLineCapStrokeJoin(GpCustomLineCap* customCap, GpLineJoin lineJoin); }
  4582. function GdipSetCustomLineCapStrokeJoin(CustomCap: GpCustomLineCap;
  4583. LineJoin: TGPLineJoin): TGPStatus; stdcall; external GdiPlusDll;
  4584.  
  4585. { GdipGetCustomLineCapStrokeJoin(GpCustomLineCap* customCap, GpLineJoin* lineJoin); }
  4586. function GdipGetCustomLineCapStrokeJoin(CustomCap: GpCustomLineCap;
  4587. out LineJoin: TGPLineJoin): TGPStatus; stdcall; external GdiPlusDll;
  4588.  
  4589. { GdipSetCustomLineCapBaseCap(GpCustomLineCap* customCap, GpLineCap baseCap); }
  4590. function GdipSetCustomLineCapBaseCap(CustomCap: GpCustomLineCap;
  4591. BaseCap: TGPLineCap): TGPStatus; stdcall; external GdiPlusDll;
  4592.  
  4593. { GdipGetCustomLineCapBaseCap(GpCustomLineCap* customCap, GpLineCap* baseCap); }
  4594. function GdipGetCustomLineCapBaseCap(CustomCap: GpCustomLineCap;
  4595. out BaseCap: TGPLineCap): TGPStatus; stdcall; external GdiPlusDll;
  4596.  
  4597. { GdipSetCustomLineCapBaseInset(GpCustomLineCap* customCap, REAL inset); }
  4598. function GdipSetCustomLineCapBaseInset(CustomCap: GpCustomLineCap;
  4599. Inset: Single): TGPStatus; stdcall; external GdiPlusDll;
  4600.  
  4601. { GdipGetCustomLineCapBaseInset(GpCustomLineCap* customCap, REAL* inset); }
  4602. function GdipGetCustomLineCapBaseInset(CustomCap: GpCustomLineCap;
  4603. out Inset: Single): TGPStatus; stdcall; external GdiPlusDll;
  4604.  
  4605. { GdipSetCustomLineCapWidthScale(GpCustomLineCap* customCap, REAL widthScale); }
  4606. function GdipSetCustomLineCapWidthScale(CustomCap: GpCustomLineCap;
  4607. WidthScale: Single): TGPStatus; stdcall; external GdiPlusDll;
  4608.  
  4609. { GdipGetCustomLineCapWidthScale(GpCustomLineCap* customCap, REAL* widthScale); }
  4610. function GdipGetCustomLineCapWidthScale(CustomCap: GpCustomLineCap;
  4611. out WidthScale: Single): TGPStatus; stdcall; external GdiPlusDll;
  4612.  
  4613. //----------------------------------------------------------------------------
  4614. // AdjustableArrowCap APIs
  4615. //----------------------------------------------------------------------------
  4616.  
  4617. { GdipCreateAdjustableArrowCap(REAL height, REAL width, BOOL isFilled, GpAdjustableArrowCap **cap); }
  4618. function GdipCreateAdjustableArrowCap(Height: Single; Width: Single;
  4619. IsFilled: Bool; out Cap: GpAdjustableArrowCap): TGPStatus; stdcall; external GdiPlusDll;
  4620.  
  4621. { GdipSetAdjustableArrowCapHeight(GpAdjustableArrowCap* cap, REAL height); }
  4622. function GdipSetAdjustableArrowCapHeight(Cap: GpAdjustableArrowCap;
  4623. Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  4624.  
  4625. { GdipGetAdjustableArrowCapHeight(GpAdjustableArrowCap* cap, REAL* height); }
  4626. function GdipGetAdjustableArrowCapHeight(Cap: GpAdjustableArrowCap;
  4627. out Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  4628.  
  4629. { GdipSetAdjustableArrowCapWidth(GpAdjustableArrowCap* cap, REAL width); }
  4630. function GdipSetAdjustableArrowCapWidth(Cap: GpAdjustableArrowCap;
  4631. Width: Single): TGPStatus; stdcall; external GdiPlusDll;
  4632.  
  4633. { GdipGetAdjustableArrowCapWidth(GpAdjustableArrowCap* cap, REAL* width); }
  4634. function GdipGetAdjustableArrowCapWidth(Cap: GpAdjustableArrowCap;
  4635. out Width: Single): TGPStatus; stdcall; external GdiPlusDll;
  4636.  
  4637. { GdipSetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap* cap, REAL middleInset); }
  4638. function GdipSetAdjustableArrowCapMiddleInset(Cap: GpAdjustableArrowCap;
  4639. MiddleInset: Single): TGPStatus; stdcall; external GdiPlusDll;
  4640.  
  4641. { GdipGetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap* cap, REAL* middleInset); }
  4642. function GdipGetAdjustableArrowCapMiddleInset(Cap: GpAdjustableArrowCap;
  4643. out MiddleInset: Single): TGPStatus; stdcall; external GdiPlusDll;
  4644.  
  4645. { GdipSetAdjustableArrowCapFillState(GpAdjustableArrowCap* cap, BOOL fillState); }
  4646. function GdipSetAdjustableArrowCapFillState(Cap: GpAdjustableArrowCap;
  4647. FillState: Bool): TGPStatus; stdcall; external GdiPlusDll;
  4648.  
  4649. { GdipGetAdjustableArrowCapFillState(GpAdjustableArrowCap* cap, BOOL* fillState); }
  4650. function GdipGetAdjustableArrowCapFillState(Cap: GpAdjustableArrowCap;
  4651. out FillState: Bool): TGPStatus; stdcall; external GdiPlusDll;
  4652.  
  4653. //----------------------------------------------------------------------------
  4654. // Image APIs
  4655. //----------------------------------------------------------------------------
  4656.  
  4657. { GdipLoadImageFromStream(IStream* stream, GpImage **image); }
  4658. function GdipLoadImageFromStream(const Stream: IStream; out Image: GpImage): TGPStatus; stdcall;
  4659. external GdiPlusDll;
  4660.  
  4661. { GdipLoadImageFromFile(GDIPCONST WCHAR* filename, GpImage **image); }
  4662. function GdipLoadImageFromFile(const Filename: PWideChar; out Image: GpImage): TGPStatus; stdcall;
  4663. external GdiPlusDll;
  4664.  
  4665. { GdipLoadImageFromStreamICM(IStream* stream, GpImage **image); }
  4666. function GdipLoadImageFromStreamICM(const Stream: IStream; out Image: GpImage): TGPStatus; stdcall;
  4667. external GdiPlusDll;
  4668.  
  4669. { GdipLoadImageFromFileICM(GDIPCONST WCHAR* filename, GpImage **image); }
  4670. function GdipLoadImageFromFileICM(const Filename: PWideChar; out Image: GpImage): TGPStatus; stdcall;
  4671. external GdiPlusDll;
  4672.  
  4673. { GdipCloneImage(GpImage *image, GpImage **cloneImage); }
  4674. function GdipCloneImage(Image: GpImage; out CloneImage: GpImage): TGPStatus; stdcall;
  4675. external GdiPlusDll;
  4676.  
  4677. { GdipDisposeImage(GpImage *image); }
  4678. function GdipDisposeImage(Image: GpImage): TGPStatus; stdcall; external GdiPlusDll;
  4679.  
  4680. { GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR* filename, GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams); }
  4681. function GdipSaveImageToFile(Image: GpImage; const Filename: PWideChar;
  4682. const ClsidEncoder: TGUID; const EncoderParams: PGPNativeEncoderParameters): TGPStatus; stdcall;
  4683. external GdiPlusDll;
  4684.  
  4685. { GdipSaveImageToStream(GpImage *image, IStream* stream, GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams); }
  4686. function GdipSaveImageToStream(Image: GpImage; const Stream: IStream;
  4687. const ClsidEncoder: TGUID; const EncoderParams: PGPNativeEncoderParameters): TGPStatus; stdcall;
  4688. external GdiPlusDll;
  4689.  
  4690. { GdipSaveAdd(GpImage *image, GDIPCONST EncoderParameters* encoderParams); }
  4691. function GdipSaveAdd(Image: GpImage; const EncoderParams: PGPNativeEncoderParameters): TGPStatus; stdcall;
  4692. external GdiPlusDll;
  4693.  
  4694. { GdipSaveAddImage(GpImage *image, GpImage* newImage, GDIPCONST EncoderParameters* encoderParams); }
  4695. function GdipSaveAddImage(Image: GpImage; NewImage: GpImage;
  4696. const EncoderParams: PGPNativeEncoderParameters): TGPStatus; stdcall; external GdiPlusDll;
  4697.  
  4698. { GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics); }
  4699. function GdipGetImageGraphicsContext(Image: GpImage; out Graphics: GpGraphics): TGPStatus; stdcall;
  4700. external GdiPlusDll;
  4701.  
  4702. { GdipGetImageBounds(GpImage *image, GpRectF *srcRect, GpUnit *srcUnit); }
  4703. function GdipGetImageBounds(Image: GpImage; out SrcRect: TGPRectF;
  4704. out SrcUnit: TGPUnit): TGPStatus; stdcall; external GdiPlusDll;
  4705.  
  4706. { GdipGetImageDimension(GpImage *image, REAL *width, REAL *height); }
  4707. function GdipGetImageDimension(Image: GpImage; out Width: Single;
  4708. out Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  4709.  
  4710. { GdipGetImageType(GpImage *image, ImageType *type); }
  4711. function GdipGetImageType(Image: GpImage; out AType: TGPImageType): TGPStatus; stdcall;
  4712. external GdiPlusDll;
  4713.  
  4714. { GdipGetImageWidth(GpImage *image, UINT *width); }
  4715. function GdipGetImageWidth(Image: GpImage; out Width: Cardinal): TGPStatus; stdcall;
  4716. external GdiPlusDll;
  4717.  
  4718. { GdipGetImageHeight(GpImage *image, UINT *height); }
  4719. function GdipGetImageHeight(Image: GpImage; out Height: Cardinal): TGPStatus; stdcall;
  4720. external GdiPlusDll;
  4721.  
  4722. { GdipGetImageHorizontalResolution(GpImage *image, REAL *resolution); }
  4723. function GdipGetImageHorizontalResolution(Image: GpImage; out Resolution: Single): TGPStatus; stdcall;
  4724. external GdiPlusDll;
  4725.  
  4726. { GdipGetImageVerticalResolution(GpImage *image, REAL *resolution); }
  4727. function GdipGetImageVerticalResolution(Image: GpImage; out Resolution: Single): TGPStatus; stdcall;
  4728. external GdiPlusDll;
  4729.  
  4730. { GdipGetImageFlags(GpImage *image, UINT *flags); }
  4731. function GdipGetImageFlags(Image: GpImage; out Flags: TGPImageFlags): TGPStatus; stdcall;
  4732. external GdiPlusDll;
  4733.  
  4734. { GdipGetImageRawFormat(GpImage *image, GUID *format); }
  4735. function GdipGetImageRawFormat(Image: GpImage; out Format: TGUID): TGPStatus; stdcall;
  4736. external GdiPlusDll;
  4737.  
  4738. { GdipGetImagePixelFormat(GpImage *image, PixelFormat *format); }
  4739. function GdipGetImagePixelFormat(Image: GpImage; out Format: TGPPixelFormat): TGPStatus; stdcall;
  4740. external GdiPlusDll;
  4741.  
  4742. { GdipGetImageThumbnail(GpImage *image, UINT thumbWidth, UINT thumbHeight, GpImage **thumbImage, GetThumbnailImageAbort callback, VOID * callbackData); }
  4743. function GdipGetImageThumbnail(Image: GpImage; ThumbWidth: Cardinal;
  4744. ThumbHeight: Cardinal; out ThumbImage: GpImage;
  4745. Callback: TGPGetThumbnailImageAbort; CallbackData: Pointer): TGPStatus; stdcall;
  4746. external GdiPlusDll;
  4747.  
  4748. { GdipGetEncoderParameterListSize(GpImage *image, GDIPCONST CLSID* clsidEncoder, UINT* size); }
  4749. function GdipGetEncoderParameterListSize(Image: GpImage;
  4750. const ClsidEncoder: PGUID; out Size: Cardinal): TGPStatus; stdcall; external GdiPlusDll;
  4751.  
  4752. { GdipGetEncoderParameterList(GpImage *image, GDIPCONST CLSID* clsidEncoder, UINT size, EncoderParameters* buffer); }
  4753. function GdipGetEncoderParameterList(Image: GpImage; const ClsidEncoder: PGUID;
  4754. Size: Cardinal; Buffer: PGPNativeEncoderParameters): TGPStatus; stdcall; external GdiPlusDll;
  4755.  
  4756. { GdipImageGetFrameDimensionsCount(GpImage* image, UINT* count); }
  4757. function GdipImageGetFrameDimensionsCount(Image: GpImage; out Count: Cardinal): TGPStatus; stdcall;
  4758. external GdiPlusDll;
  4759.  
  4760. { GdipImageGetFrameDimensionsList(GpImage* image, GUID* dimensionIDs, UINT count); }
  4761. function GdipImageGetFrameDimensionsList(Image: GpImage; DimensionIDs: PGUID;
  4762. Count: Cardinal): TGPStatus; stdcall; external GdiPlusDll;
  4763.  
  4764. { GdipImageGetFrameCount(GpImage *image, GDIPCONST GUID* dimensionID, UINT* count); }
  4765. function GdipImageGetFrameCount(Image: GpImage; const DimensionID: TGUID;
  4766. out Count: Cardinal): TGPStatus; stdcall; external GdiPlusDll;
  4767.  
  4768. { GdipImageSelectActiveFrame(GpImage *image, GDIPCONST GUID* dimensionID, UINT frameIndex); }
  4769. function GdipImageSelectActiveFrame(Image: GpImage; const DimensionID: TGUID;
  4770. FrameIndex: Cardinal): TGPStatus; stdcall; external GdiPlusDll;
  4771.  
  4772. { GdipImageRotateFlip(GpImage *image, RotateFlipType rfType); }
  4773. function GdipImageRotateFlip(Image: GpImage; RfType: TGPRotateFlipType): TGPStatus; stdcall;
  4774. external GdiPlusDll;
  4775.  
  4776. { GdipGetImagePalette(GpImage *image, ColorPalette *palette, INT size); }
  4777. function GdipGetImagePalette(Image: GpImage; Palette: PGPNativeColorPalette;
  4778. Size: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4779.  
  4780. { GdipSetImagePalette(GpImage *image, GDIPCONST ColorPalette *palette); }
  4781. function GdipSetImagePalette(Image: GpImage; const Palette: PGPNativeColorPalette): TGPStatus; stdcall;
  4782. external GdiPlusDll;
  4783.  
  4784. { GdipGetImagePaletteSize(GpImage *image, INT *size); }
  4785. function GdipGetImagePaletteSize(Image: GpImage; out Size: Integer): TGPStatus; stdcall;
  4786. external GdiPlusDll;
  4787.  
  4788. { GdipGetPropertyCount(GpImage *image, UINT* numOfProperty); }
  4789. function GdipGetPropertyCount(Image: GpImage; out NumOfProperty: Cardinal): TGPStatus; stdcall;
  4790. external GdiPlusDll;
  4791.  
  4792. { GdipGetPropertyIdList(GpImage *image, UINT numOfProperty, PROPID* list); }
  4793. function GdipGetPropertyIdList(Image: GpImage; NumOfProperty: Cardinal;
  4794. List: PPropID): TGPStatus; stdcall; external GdiPlusDll;
  4795.  
  4796. { GdipGetPropertyItemSize(GpImage *image, PROPID propId, UINT* size); }
  4797. function GdipGetPropertyItemSize(Image: GpImage; PropId: TPropID;
  4798. out Size: Cardinal): TGPStatus; stdcall; external GdiPlusDll;
  4799.  
  4800. { GdipGetPropertyItem(GpImage *image, PROPID propId,UINT propSize, PropertyItem* buffer); }
  4801. function GdipGetPropertyItem(Image: GpImage; PropId: TPropID;
  4802. PropSize: Cardinal; Buffer: PGPNativePropertyItem): TGPStatus; stdcall; external GdiPlusDll;
  4803.  
  4804. { GdipGetPropertySize(GpImage *image, UINT* totalBufferSize, UINT* numProperties); }
  4805. function GdipGetPropertySize(Image: GpImage; out TotalBufferSize: Cardinal;
  4806. out NumProperties: Cardinal): TGPStatus; stdcall; external GdiPlusDll;
  4807.  
  4808. { GdipGetAllPropertyItems(GpImage *image, UINT totalBufferSize, UINT numProperties, PropertyItem* allItems); }
  4809. function GdipGetAllPropertyItems(Image: GpImage; TotalBufferSize: Cardinal;
  4810. NumProperties: Cardinal; AllItems: PGPNativePropertyItem): TGPStatus; stdcall;
  4811. external GdiPlusDll;
  4812.  
  4813. { GdipRemovePropertyItem(GpImage *image, PROPID propId); }
  4814. function GdipRemovePropertyItem(Image: GpImage; PropId: TPropID): TGPStatus; stdcall;
  4815. external GdiPlusDll;
  4816.  
  4817. { GdipSetPropertyItem(GpImage *image, GDIPCONST PropertyItem* item); }
  4818. function GdipSetPropertyItem(Image: GpImage; const Item: PGPNativePropertyItem): TGPStatus; stdcall;
  4819. external GdiPlusDll;
  4820.  
  4821. {$IF (GDIPVER >= $0110)}
  4822. { GdipFindFirstImageItem(GpImage *image, ImageItemData* item); }
  4823. function GdipFindFirstImageItem(Image: GpImage; Item: PGPImageItemData): TGPStatus; stdcall;
  4824. external GdiPlusDll;
  4825.  
  4826. { GdipFindNextImageItem(GpImage *image, ImageItemData* item); }
  4827. function GdipFindNextImageItem(Image: GpImage; Item: PGPImageItemData): TGPStatus; stdcall;
  4828. external GdiPlusDll;
  4829.  
  4830. { GdipGetImageItemData(GpImage *image, ImageItemData* item); }
  4831. function GdipGetImageItemData(Image: GpImage; Item: PGPImageItemData): TGPStatus; stdcall;
  4832. external GdiPlusDll;
  4833. {$IFEND}
  4834.  
  4835. { GdipImageForceValidation(GpImage *image); }
  4836. function GdipImageForceValidation(Image: GpImage): TGPStatus; stdcall;
  4837. external GdiPlusDll;
  4838.  
  4839. //----------------------------------------------------------------------------
  4840. // Bitmap APIs
  4841. //----------------------------------------------------------------------------
  4842.  
  4843. { GdipCreateBitmapFromStream(IStream* stream, GpBitmap **bitmap); }
  4844. function GdipCreateBitmapFromStream(const Stream: IStream; out Bitmap: GpBitmap): TGPStatus; stdcall;
  4845. external GdiPlusDll;
  4846.  
  4847. { GdipCreateBitmapFromFile(GDIPCONST WCHAR* filename, GpBitmap **bitmap); }
  4848. function GdipCreateBitmapFromFile(const Filename: PWideChar;
  4849. out Bitmap: GpBitmap): TGPStatus; stdcall; external GdiPlusDll;
  4850.  
  4851. { GdipCreateBitmapFromStreamICM(IStream* stream, GpBitmap **bitmap); }
  4852. function GdipCreateBitmapFromStreamICM(const Stream: IStream;
  4853. out Bitmap: GpBitmap): TGPStatus; stdcall; external GdiPlusDll;
  4854.  
  4855. { GdipCreateBitmapFromFileICM(GDIPCONST WCHAR* filename, GpBitmap **bitmap); }
  4856. function GdipCreateBitmapFromFileICM(const Filename: PWideChar;
  4857. out Bitmap: GpBitmap): TGPStatus; stdcall; external GdiPlusDll;
  4858.  
  4859. { GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE* scan0, GpBitmap** bitmap); }
  4860. function GdipCreateBitmapFromScan0(Width: Integer; Height: Integer;
  4861. Stride: Integer; Format: TGPPixelFormat; Scan0: PByte; out Bitmap: GpBitmap): TGPStatus; stdcall;
  4862. external GdiPlusDll;
  4863.  
  4864. { GdipCreateBitmapFromGraphics(INT width, INT height, GpGraphics* target, GpBitmap** bitmap); }
  4865. function GdipCreateBitmapFromGraphics(Width: Integer; Height: Integer;
  4866. Target: GpGraphics; out Bitmap: GpBitmap): TGPStatus; stdcall; external GdiPlusDll;
  4867.  
  4868. { GdipCreateBitmapFromDirectDrawSurface(IDirectDrawSurface7* surface, GpBitmap** bitmap); }
  4869. function GdipCreateBitmapFromDirectDrawSurface(const Surface: IUnknown;
  4870. out Bitmap: GpBitmap): TGPStatus; stdcall; external GdiPlusDll;
  4871.  
  4872. { GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO* gdiBitmapInfo, VOID* gdiBitmapData, GpBitmap** bitmap); }
  4873. function GdipCreateBitmapFromGdiDib(const GdiBitmapInfo: PBitmapInfo;
  4874. GdiBitmapData: Pointer; out Bitmap: GpBitmap): TGPStatus; stdcall; external GdiPlusDll;
  4875.  
  4876. { GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBitmap** bitmap); }
  4877. function GdipCreateBitmapFromHBITMAP(Hbm: HBitmap; Hpal: HPalette;
  4878. out Bitmap: GpBitmap): TGPStatus; stdcall; external GdiPlusDll;
  4879.  
  4880. { GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap, HBITMAP* hbmReturn, ARGB background); }
  4881. function GdipCreateHBITMAPFromBitmap(Bitmap: GpBitmap; out HbmReturn: HBitmap;
  4882. Background: ARGB): TGPStatus; stdcall; external GdiPlusDll;
  4883.  
  4884. { GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap); }
  4885. function GdipCreateBitmapFromHICON(Hicon: HIcon; out Bitmap: GpBitmap): TGPStatus; stdcall;
  4886. external GdiPlusDll;
  4887.  
  4888. { GdipCreateHICONFromBitmap(GpBitmap* bitmap, HICON* hbmReturn); }
  4889. function GdipCreateHICONFromBitmap(Bitmap: GpBitmap; out HbmReturn: HIcon): TGPStatus; stdcall;
  4890. external GdiPlusDll;
  4891.  
  4892. { GdipCreateBitmapFromResource(HINSTANCE hInstance, GDIPCONST WCHAR* lpBitmapName, GpBitmap** bitmap); }
  4893. function GdipCreateBitmapFromResource(HInstance: HInst;
  4894. const LpBitmapName: PWideChar; out Bitmap: GpBitmap): TGPStatus; stdcall;
  4895. external GdiPlusDll;
  4896.  
  4897. { GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height, PixelFormat format, GpBitmap *srcBitmap, GpBitmap **dstBitmap); }
  4898. function GdipCloneBitmapArea(X: Single; Y: Single; Width: Single;
  4899. Height: Single; Format: TGPPixelFormat; SrcBitmap: GpBitmap;
  4900. out DstBitmap: GpBitmap): TGPStatus; stdcall; external GdiPlusDll;
  4901.  
  4902. { GdipCloneBitmapAreaI(INT x, INT y, INT width, INT height, PixelFormat format, GpBitmap *srcBitmap, GpBitmap **dstBitmap); }
  4903. function GdipCloneBitmapAreaI(X: Integer; Y: Integer; Width: Integer;
  4904. Height: Integer; Format: TGPPixelFormat; SrcBitmap: GpBitmap;
  4905. out DstBitmap: GpBitmap): TGPStatus; stdcall; external GdiPlusDll;
  4906.  
  4907. { GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect, UINT flags, PixelFormat format, BitmapData* lockedBitmapData); }
  4908. function GdipBitmapLockBits(Bitmap: GpBitmap; const Rect: PGPRect;
  4909. Flags: TGPImageLockMode; Format: TGPPixelFormat; out LockedBitmapData: TGPBitmapData): TGPStatus; stdcall;
  4910. external GdiPlusDll;
  4911.  
  4912. { GdipBitmapUnlockBits(GpBitmap* bitmap, BitmapData* lockedBitmapData); }
  4913. function GdipBitmapUnlockBits(Bitmap: GpBitmap; const LockedBitmapData: TGPBitmapData): TGPStatus; stdcall;
  4914. external GdiPlusDll;
  4915.  
  4916. { GdipBitmapGetPixel(GpBitmap* bitmap, INT x, INT y, ARGB *color); }
  4917. function GdipBitmapGetPixel(Bitmap: GpBitmap; X: Integer; Y: Integer;
  4918. out Color: ARGB): TGPStatus; stdcall; external GdiPlusDll;
  4919.  
  4920. { GdipBitmapSetPixel(GpBitmap* bitmap, INT x, INT y, ARGB color); }
  4921. function GdipBitmapSetPixel(Bitmap: GpBitmap; X: Integer; Y: Integer;
  4922. Color: ARGB): TGPStatus; stdcall; external GdiPlusDll;
  4923.  
  4924. {$IF (GDIPVER >= $0110)}
  4925. { GdipImageSetAbort( GpImage *pImage, GdiplusAbort *pIAbort ); }
  4926. function GdipImageSetAbort(PImage: GpImage; PIAbort: PGdiplusAbort): TGPStatus; stdcall;
  4927. external GdiPlusDll;
  4928.  
  4929. { GdipGraphicsSetAbort( GpGraphics *pGraphics, GdiplusAbort *pIAbort ); }
  4930. function GdipGraphicsSetAbort(PGraphics: GpGraphics; PIAbort: PGdiplusAbort): TGPStatus; stdcall;
  4931. external GdiPlusDll;
  4932.  
  4933. { GdipBitmapConvertFormat( IN GpBitmap *pInputBitmap, PixelFormat format, DitherType dithertype, PaletteType palettetype, ColorPalette *palette, REAL alphaThresholdPercent ); }
  4934. function GdipBitmapConvertFormat(const InputBitmap: GpBitmap;
  4935. Format: TGPPixelFormat; Dithertype: TGPDitherType; Palettetype: TGPPaletteType;
  4936. Palette: PGPNativeColorPalette; AlphaThresholdPercent: Single): TGPStatus; stdcall;
  4937. external GdiPlusDll;
  4938.  
  4939. { GdipInitializePalette( OUT ColorPalette *palette, PaletteType palettetype, INT optimalColors, BOOL useTransparentColor, GpBitmap *bitmap ); }
  4940. function GdipInitializePalette(const Palette: PGPNativeColorPalette;
  4941. Palettetype: TGPPaletteType; OptimalColors: Integer; UseTransparentColor: Bool;
  4942. Bitmap: GpBitmap): TGPStatus; stdcall; external GdiPlusDll;
  4943.  
  4944. { GdipBitmapApplyEffect( GpBitmap* bitmap, CGpEffect *effect, RECT *roi, BOOL useAuxData, VOID **auxData, INT *auxDataSize ); }
  4945. function GdipBitmapApplyEffect(Bitmap: GpBitmap; Effect: CGpEffect; Roi: Windows.PRect;
  4946. UseAuxData: Bool; out AuxData: Pointer; out AuxDataSize: Integer): TGPStatus; stdcall;
  4947. external GdiPlusDll;
  4948.  
  4949. { GdipBitmapCreateApplyEffect( GpBitmap **inputBitmaps, INT numInputs, CGpEffect *effect, RECT *roi, RECT *outputRect, GpBitmap **outputBitmap, BOOL useAuxData, VOID **auxData, INT *auxDataSize ); }
  4950. function GdipBitmapCreateApplyEffect(const InputBitmaps: PGpBitmap;
  4951. NumInputs: Integer; Effect: CGpEffect; Roi: Windows.PRect; OutputRect: Windows.PRect;
  4952. out OutputBitmap: GpBitmap; UseAuxData: Bool; out AuxData: Pointer;
  4953. out AuxDataSize: Integer): TGPStatus; stdcall; external GdiPlusDll;
  4954.  
  4955. { GdipBitmapGetHistogram( GpBitmap* bitmap, IN HistogramFormat format, IN UINT NumberOfEntries, __out_bcount(sizeof(UINT)*256) UINT *channel0, __out_bcount(sizeof(UINT)*256) UINT *channel1, __out_bcount(sizeof(UINT)*256) UINT *channel2, __out_bcount(sizeof(UINT)*256) UINT *channel3 ); }
  4956. function GdipBitmapGetHistogram(Bitmap: GpBitmap;
  4957. const Format: TGPHistogramFormat; const NumberOfEntries: Cardinal;
  4958. Channel0: PCardinal; Channel1: PCardinal; Channel2: PCardinal;
  4959. Channel3: PCardinal): TGPStatus; stdcall; external GdiPlusDll;
  4960.  
  4961. { GdipBitmapGetHistogramSize( IN HistogramFormat format, OUT UINT *NumberOfEntries ); }
  4962. function GdipBitmapGetHistogramSize(const Format: TGPHistogramFormat;
  4963. out NumberOfEntries: Cardinal): TGPStatus; stdcall; external GdiPlusDll;
  4964. {$IFEND}
  4965.  
  4966. { GdipBitmapSetResolution(GpBitmap* bitmap, REAL xdpi, REAL ydpi); }
  4967. function GdipBitmapSetResolution(Bitmap: GpBitmap; Xdpi: Single; Ydpi: Single): TGPStatus; stdcall;
  4968. external GdiPlusDll;
  4969.  
  4970. //----------------------------------------------------------------------------
  4971. // ImageAttributes APIs
  4972. //----------------------------------------------------------------------------
  4973.  
  4974. { GdipCreateImageAttributes(GpImageAttributes **imageattr); }
  4975. function GdipCreateImageAttributes(out Imageattr: GpImageAttributes): TGPStatus; stdcall;
  4976. external GdiPlusDll;
  4977.  
  4978. { GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imageattr, GpImageAttributes **cloneImageattr); }
  4979. function GdipCloneImageAttributes(const Imageattr: GpImageAttributes;
  4980. out CloneImageattr: GpImageAttributes): TGPStatus; stdcall; external GdiPlusDll;
  4981.  
  4982. { GdipDisposeImageAttributes(GpImageAttributes *imageattr); }
  4983. function GdipDisposeImageAttributes(Imageattr: GpImageAttributes): TGPStatus; stdcall;
  4984. external GdiPlusDll;
  4985.  
  4986. { GdipSetImageAttributesToIdentity(GpImageAttributes *imageattr, ColorAdjustType type); }
  4987. function GdipSetImageAttributesToIdentity(Imageattr: GpImageAttributes;
  4988. AType: TGPColorAdjustType): TGPStatus; stdcall; external GdiPlusDll;
  4989.  
  4990. { GdipResetImageAttributes(GpImageAttributes *imageattr, ColorAdjustType type); }
  4991. function GdipResetImageAttributes(Imageattr: GpImageAttributes;
  4992. AType: TGPColorAdjustType): TGPStatus; stdcall; external GdiPlusDll;
  4993.  
  4994. { GdipSetImageAttributesColorMatrix(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, GDIPCONST ColorMatrix* colorMatrix, GDIPCONST ColorMatrix* grayMatrix, ColorMatrixFlags flags); }
  4995. function GdipSetImageAttributesColorMatrix(Imageattr: GpImageAttributes;
  4996. AType: TGPColorAdjustType; EnableFlag: Bool; const ColorMatrix: PGPColorMatrix;
  4997. const GrayMatrix: PGPColorMatrix; Flags: TGPColorMatrixFlags): TGPStatus; stdcall;
  4998. external GdiPlusDll;
  4999.  
  5000. { GdipSetImageAttributesThreshold(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, REAL threshold); }
  5001. function GdipSetImageAttributesThreshold(Imageattr: GpImageAttributes;
  5002. AType: TGPColorAdjustType; EnableFlag: Bool; Threshold: Single): TGPStatus; stdcall;
  5003. external GdiPlusDll;
  5004.  
  5005. { GdipSetImageAttributesGamma(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, REAL gamma); }
  5006. function GdipSetImageAttributesGamma(Imageattr: GpImageAttributes;
  5007. AType: TGPColorAdjustType; EnableFlag: Bool; Gamma: Single): TGPStatus; stdcall;
  5008. external GdiPlusDll;
  5009.  
  5010. { GdipSetImageAttributesNoOp(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag); }
  5011. function GdipSetImageAttributesNoOp(Imageattr: GpImageAttributes;
  5012. AType: TGPColorAdjustType; EnableFlag: Bool): TGPStatus; stdcall; external GdiPlusDll;
  5013.  
  5014. { GdipSetImageAttributesColorKeys(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, ARGB colorLow, ARGB colorHigh); }
  5015. function GdipSetImageAttributesColorKeys(Imageattr: GpImageAttributes;
  5016. AType: TGPColorAdjustType; EnableFlag: Bool; ColorLow: ARGB; ColorHigh: ARGB): TGPStatus; stdcall;
  5017. external GdiPlusDll;
  5018.  
  5019. { GdipSetImageAttributesOutputChannel(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, ColorChannelFlags channelFlags); }
  5020. function GdipSetImageAttributesOutputChannel(Imageattr: GpImageAttributes;
  5021. AType: TGPColorAdjustType; EnableFlag: Bool; ChannelFlags: TGPColorChannelFlags): TGPStatus; stdcall;
  5022. external GdiPlusDll;
  5023.  
  5024. { GdipSetImageAttributesOutputChannelColorProfile(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, GDIPCONST WCHAR *colorProfileFilename); }
  5025. function GdipSetImageAttributesOutputChannelColorProfile(
  5026. Imageattr: GpImageAttributes; AType: TGPColorAdjustType; EnableFlag: Bool;
  5027. const ColorProfileFilename: PWideChar): TGPStatus; stdcall; external GdiPlusDll;
  5028.  
  5029. { GdipSetImageAttributesRemapTable(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, UINT mapSize, GDIPCONST ColorMap *map); }
  5030. function GdipSetImageAttributesRemapTable(Imageattr: GpImageAttributes;
  5031. AType: TGPColorAdjustType; EnableFlag: Bool; MapSize: Cardinal;
  5032. const Map: PGPColorMap): TGPStatus; stdcall; external GdiPlusDll;
  5033. { GdipSetImageAttributesWrapMode( GpImageAttributes *imageAttr, WrapMode wrap, ARGB argb, BOOL clamp ); }
  5034. function GdipSetImageAttributesWrapMode(ImageAttr: GpImageAttributes;
  5035. Wrap: TGPWrapMode; Argb: ARGB; Clamp: Bool): TGPStatus; stdcall; external GdiPlusDll;
  5036.  
  5037. { GdipSetImageAttributesICMMode( GpImageAttributes *imageAttr, BOOL on ); }
  5038. function GdipSetImageAttributesICMMode(ImageAttr: GpImageAttributes; Enable: Bool): TGPStatus; stdcall;
  5039. external GdiPlusDll;
  5040.  
  5041. { GdipGetImageAttributesAdjustedPalette( GpImageAttributes *imageAttr, ColorPalette * colorPalette, ColorAdjustType colorAdjustType ); }
  5042. function GdipGetImageAttributesAdjustedPalette(ImageAttr: GpImageAttributes;
  5043. ColorPalette: PGPNativeColorPalette; ColorAdjustType: TGPColorAdjustType): TGPStatus; stdcall;
  5044. external GdiPlusDll;
  5045.  
  5046. //----------------------------------------------------------------------------
  5047. // Graphics APIs
  5048. //----------------------------------------------------------------------------
  5049.  
  5050. { GdipFlush(GpGraphics *graphics, GpFlushIntention intention); }
  5051. function GdipFlush(Graphics: GpGraphics; Intention: TGPFlushIntention): TGPStatus; stdcall;
  5052. external GdiPlusDll;
  5053.  
  5054. { GdipCreateFromHDC(HDC hdc, GpGraphics **graphics); }
  5055. function GdipCreateFromHDC(Hdc: HDC; out Graphics: GpGraphics): TGPStatus; stdcall;
  5056. external GdiPlusDll;
  5057.  
  5058. { GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **graphics); }
  5059. function GdipCreateFromHDC2(Hdc: HDC; HDevice: THandle;
  5060. out Graphics: GpGraphics): TGPStatus; stdcall; external GdiPlusDll;
  5061.  
  5062. { GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics); }
  5063. function GdipCreateFromHWND(Hwnd: HWnd; out Graphics: GpGraphics): TGPStatus; stdcall;
  5064. external GdiPlusDll;
  5065.  
  5066. { GdipCreateFromHWNDICM(HWND hwnd, GpGraphics **graphics); }
  5067. function GdipCreateFromHWNDICM(Hwnd: HWnd; out Graphics: GpGraphics): TGPStatus; stdcall;
  5068. external GdiPlusDll;
  5069.  
  5070. { GdipDeleteGraphics(GpGraphics *graphics); }
  5071. function GdipDeleteGraphics(Graphics: GpGraphics): TGPStatus; stdcall;
  5072. external GdiPlusDll;
  5073.  
  5074. { GdipGetDC(GpGraphics* graphics, HDC * hdc); }
  5075. function GdipGetDC(Graphics: GpGraphics; out Hdc: HDC): TGPStatus; stdcall;
  5076. external GdiPlusDll;
  5077.  
  5078. { GdipReleaseDC(GpGraphics* graphics, HDC hdc); }
  5079. function GdipReleaseDC(Graphics: GpGraphics; Hdc: HDC): TGPStatus; stdcall;
  5080. external GdiPlusDll;
  5081.  
  5082. { GdipSetCompositingMode(GpGraphics *graphics, CompositingMode compositingMode); }
  5083. function GdipSetCompositingMode(Graphics: GpGraphics;
  5084. CompositingMode: TGPCompositingMode): TGPStatus; stdcall; external GdiPlusDll;
  5085.  
  5086. { GdipGetCompositingMode(GpGraphics *graphics, CompositingMode *compositingMode); }
  5087. function GdipGetCompositingMode(Graphics: GpGraphics;
  5088. out CompositingMode: TGPCompositingMode): TGPStatus; stdcall; external GdiPlusDll;
  5089.  
  5090. { GdipSetRenderingOrigin(GpGraphics *graphics, INT x, INT y); }
  5091. function GdipSetRenderingOrigin(Graphics: GpGraphics; X: Integer; Y: Integer): TGPStatus; stdcall;
  5092. external GdiPlusDll;
  5093.  
  5094. { GdipGetRenderingOrigin(GpGraphics *graphics, INT *x, INT *y); }
  5095. function GdipGetRenderingOrigin(Graphics: GpGraphics; out X: Integer; out Y: Integer): TGPStatus; stdcall;
  5096. external GdiPlusDll;
  5097.  
  5098. { GdipSetCompositingQuality(GpGraphics *graphics, CompositingQuality compositingQuality); }
  5099. function GdipSetCompositingQuality(Graphics: GpGraphics;
  5100. CompositingQuality: TGPCompositingQuality): TGPStatus; stdcall; external GdiPlusDll;
  5101.  
  5102. { GdipGetCompositingQuality(GpGraphics *graphics, CompositingQuality *compositingQuality); }
  5103. function GdipGetCompositingQuality(Graphics: GpGraphics;
  5104. out CompositingQuality: TGPCompositingQuality): TGPStatus; stdcall; external GdiPlusDll;
  5105.  
  5106. { GdipSetSmoothingMode(GpGraphics *graphics, SmoothingMode smoothingMode); }
  5107. function GdipSetSmoothingMode(Graphics: GpGraphics;
  5108. SmoothingMode: TGPSmoothingMode): TGPStatus; stdcall; external GdiPlusDll;
  5109.  
  5110. { GdipGetSmoothingMode(GpGraphics *graphics, SmoothingMode *smoothingMode); }
  5111. function GdipGetSmoothingMode(Graphics: GpGraphics;
  5112. out SmoothingMode: TGPSmoothingMode): TGPStatus; stdcall; external GdiPlusDll;
  5113.  
  5114. { GdipSetPixelOffsetMode(GpGraphics* graphics, PixelOffsetMode pixelOffsetMode); }
  5115. function GdipSetPixelOffsetMode(Graphics: GpGraphics;
  5116. PixelOffsetMode: TGPPixelOffsetMode): TGPStatus; stdcall; external GdiPlusDll;
  5117.  
  5118. { GdipGetPixelOffsetMode(GpGraphics *graphics, PixelOffsetMode *pixelOffsetMode); }
  5119. function GdipGetPixelOffsetMode(Graphics: GpGraphics;
  5120. out PixelOffsetMode: TGPPixelOffsetMode): TGPStatus; stdcall; external GdiPlusDll;
  5121.  
  5122. { GdipSetTextRenderingHint(GpGraphics *graphics, TextRenderingHint mode); }
  5123. function GdipSetTextRenderingHint(Graphics: GpGraphics;
  5124. Mode: TGPTextRenderingHint): TGPStatus; stdcall; external GdiPlusDll;
  5125.  
  5126. { GdipGetTextRenderingHint(GpGraphics *graphics, TextRenderingHint *mode); }
  5127. function GdipGetTextRenderingHint(Graphics: GpGraphics;
  5128. out Mode: TGPTextRenderingHint): TGPStatus; stdcall; external GdiPlusDll;
  5129.  
  5130. { GdipSetTextContrast(GpGraphics *graphics, UINT contrast); }
  5131. function GdipSetTextContrast(Graphics: GpGraphics; Contrast: Integer): TGPStatus; stdcall;
  5132. external GdiPlusDll;
  5133.  
  5134. { GdipGetTextContrast(GpGraphics *graphics, UINT * contrast); }
  5135. function GdipGetTextContrast(Graphics: GpGraphics; out Contrast: Integer): TGPStatus; stdcall;
  5136. external GdiPlusDll;
  5137.  
  5138. { GdipSetInterpolationMode(GpGraphics *graphics, InterpolationMode interpolationMode); }
  5139. function GdipSetInterpolationMode(Graphics: GpGraphics;
  5140. InterpolationMode: TGPInterpolationMode): TGPStatus; stdcall; external GdiPlusDll;
  5141.  
  5142. { GdipGetInterpolationMode(GpGraphics *graphics, InterpolationMode *interpolationMode); }
  5143. function GdipGetInterpolationMode(Graphics: GpGraphics;
  5144. out InterpolationMode: TGPInterpolationMode): TGPStatus; stdcall; external GdiPlusDll;
  5145.  
  5146. { GdipSetWorldTransform(GpGraphics *graphics, GpMatrix *matrix); }
  5147. function GdipSetWorldTransform(Graphics: GpGraphics; Matrix: GpMatrix): TGPStatus; stdcall;
  5148. external GdiPlusDll;
  5149.  
  5150. { GdipResetWorldTransform(GpGraphics *graphics); }
  5151. function GdipResetWorldTransform(Graphics: GpGraphics): TGPStatus; stdcall;
  5152. external GdiPlusDll;
  5153.  
  5154. { GdipMultiplyWorldTransform(GpGraphics *graphics, GDIPCONST GpMatrix *matrix, GpMatrixOrder order); }
  5155. function GdipMultiplyWorldTransform(Graphics: GpGraphics;
  5156. const Matrix: GpMatrix; Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  5157.  
  5158. { GdipTranslateWorldTransform(GpGraphics *graphics, REAL dx, REAL dy, GpMatrixOrder order); }
  5159. function GdipTranslateWorldTransform(Graphics: GpGraphics; Dx: Single;
  5160. Dy: Single; Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  5161.  
  5162. { GdipScaleWorldTransform(GpGraphics *graphics, REAL sx, REAL sy, GpMatrixOrder order); }
  5163. function GdipScaleWorldTransform(Graphics: GpGraphics; Sx: Single; Sy: Single;
  5164. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  5165.  
  5166. { GdipRotateWorldTransform(GpGraphics *graphics, REAL angle, GpMatrixOrder order); }
  5167. function GdipRotateWorldTransform(Graphics: GpGraphics; Angle: Single;
  5168. Order: TGPMatrixOrder): TGPStatus; stdcall; external GdiPlusDll;
  5169.  
  5170. { GdipGetWorldTransform(GpGraphics *graphics, GpMatrix *matrix); }
  5171. function GdipGetWorldTransform(Graphics: GpGraphics; Matrix: GpMatrix): TGPStatus; stdcall;
  5172. external GdiPlusDll;
  5173.  
  5174. { GdipResetPageTransform(GpGraphics *graphics); }
  5175. function GdipResetPageTransform(Graphics: GpGraphics): TGPStatus; stdcall;
  5176. external GdiPlusDll;
  5177.  
  5178. { GdipGetPageUnit(GpGraphics *graphics, GpUnit *unit); }
  5179. function GdipGetPageUnit(Graphics: GpGraphics; out AUnit: TGPUnit): TGPStatus; stdcall;
  5180. external GdiPlusDll;
  5181.  
  5182. { GdipGetPageScale(GpGraphics *graphics, REAL *scale); }
  5183. function GdipGetPageScale(Graphics: GpGraphics; out Scale: Single): TGPStatus; stdcall;
  5184. external GdiPlusDll;
  5185.  
  5186. { GdipSetPageUnit(GpGraphics *graphics, GpUnit unit); }
  5187. function GdipSetPageUnit(Graphics: GpGraphics; AUnit: TGPUnit): TGPStatus; stdcall;
  5188. external GdiPlusDll;
  5189.  
  5190. { GdipSetPageScale(GpGraphics *graphics, REAL scale); }
  5191. function GdipSetPageScale(Graphics: GpGraphics; Scale: Single): TGPStatus; stdcall;
  5192. external GdiPlusDll;
  5193.  
  5194. { GdipGetDpiX(GpGraphics *graphics, REAL* dpi); }
  5195. function GdipGetDpiX(Graphics: GpGraphics; out Dpi: Single): TGPStatus; stdcall;
  5196. external GdiPlusDll;
  5197.  
  5198. { GdipGetDpiY(GpGraphics *graphics, REAL* dpi); }
  5199. function GdipGetDpiY(Graphics: GpGraphics; out Dpi: Single): TGPStatus; stdcall;
  5200. external GdiPlusDll;
  5201.  
  5202. { GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace destSpace, GpCoordinateSpace srcSpace, GpPointF *points, INT count); }
  5203. function GdipTransformPoints(Graphics: GpGraphics; DestSpace: TGPCoordinateSpace;
  5204. SrcSpace: TGPCoordinateSpace; Points: PGPPointF; Count: Integer): TGPStatus; stdcall;
  5205. external GdiPlusDll;
  5206.  
  5207. { GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace destSpace, GpCoordinateSpace srcSpace, GpPoint *points, INT count); }
  5208. function GdipTransformPointsI(Graphics: GpGraphics; DestSpace: TGPCoordinateSpace;
  5209. SrcSpace: TGPCoordinateSpace; Points: PGPPoint; Count: Integer): TGPStatus; stdcall;
  5210. external GdiPlusDll;
  5211.  
  5212. { GdipGetNearestColor(GpGraphics *graphics, ARGB* argb); }
  5213. function GdipGetNearestColor(Graphics: GpGraphics; Argb: PARGB): TGPStatus; stdcall;
  5214. external GdiPlusDll;
  5215.  
  5216. // Creates the Win9x Halftone Palette (even on NT) with correct Desktop colors
  5217. function GdipCreateHalftonePalette: HPalette; external GdiPlusDll;
  5218.  
  5219. { GdipDrawLine(GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, REAL x2, REAL y2); }
  5220. function GdipDrawLine(Graphics: GpGraphics; Pen: GpPen; X1: Single; Y1: Single;
  5221. X2: Single; Y2: Single): TGPStatus; stdcall; external GdiPlusDll;
  5222.  
  5223. { GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1, INT y1, INT x2, INT y2); }
  5224. function GdipDrawLineI(Graphics: GpGraphics; Pen: GpPen; X1: Integer;
  5225. Y1: Integer; X2: Integer; Y2: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5226.  
  5227. { GdipDrawLines(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count); }
  5228. function GdipDrawLines(Graphics: GpGraphics; Pen: GpPen; const Points: PGPPointF;
  5229. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5230.  
  5231. { GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count); }
  5232. function GdipDrawLinesI(Graphics: GpGraphics; Pen: GpPen; const Points: PGPPoint;
  5233. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5234.  
  5235. { GdipDrawArc(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle); }
  5236. function GdipDrawArc(Graphics: GpGraphics; Pen: GpPen; X: Single; Y: Single;
  5237. Width: Single; Height: Single; StartAngle: Single; SweepAngle: Single): TGPStatus; stdcall;
  5238. external GdiPlusDll;
  5239.  
  5240. { GdipDrawArcI(GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle); }
  5241. function GdipDrawArcI(Graphics: GpGraphics; Pen: GpPen; X: Integer; Y: Integer;
  5242. Width: Integer; Height: Integer; StartAngle: Single; SweepAngle: Single): TGPStatus; stdcall;
  5243. external GdiPlusDll;
  5244.  
  5245. { GdipDrawBezier(GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4); }
  5246. function GdipDrawBezier(Graphics: GpGraphics; Pen: GpPen; X1: Single;
  5247. Y1: Single; X2: Single; Y2: Single; X3: Single; Y3: Single; X4: Single;
  5248. Y4: Single): TGPStatus; stdcall; external GdiPlusDll;
  5249.  
  5250. { GdipDrawBezierI(GpGraphics *graphics, GpPen *pen, INT x1, INT y1, INT x2, INT y2, INT x3, INT y3, INT x4, INT y4); }
  5251. function GdipDrawBezierI(Graphics: GpGraphics; Pen: GpPen; X1: Integer;
  5252. Y1: Integer; X2: Integer; Y2: Integer; X3: Integer; Y3: Integer; X4: Integer;
  5253. Y4: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5254.  
  5255. { GdipDrawBeziers(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count); }
  5256. function GdipDrawBeziers(Graphics: GpGraphics; Pen: GpPen;
  5257. const Points: PGPPointF; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5258.  
  5259. { GdipDrawBeziersI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count); }
  5260. function GdipDrawBeziersI(Graphics: GpGraphics; Pen: GpPen;
  5261. const Points: PGPPoint; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5262.  
  5263. { GdipDrawRectangle(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height); }
  5264. function GdipDrawRectangle(Graphics: GpGraphics; Pen: GpPen; X: Single;
  5265. Y: Single; Width: Single; Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  5266.  
  5267. { GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height); }
  5268. function GdipDrawRectangleI(Graphics: GpGraphics; Pen: GpPen; X: Integer;
  5269. Y: Integer; Width: Integer; Height: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5270.  
  5271. { GdipDrawRectangles(GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, INT count); }
  5272. function GdipDrawRectangles(Graphics: GpGraphics; Pen: GpPen;
  5273. const Rects: PGPRectF; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5274.  
  5275. { GdipDrawRectanglesI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, INT count); }
  5276. function GdipDrawRectanglesI(Graphics: GpGraphics; Pen: GpPen;
  5277. const Rects: PGPRect; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5278.  
  5279. { GdipDrawEllipse(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height); }
  5280. function GdipDrawEllipse(Graphics: GpGraphics; Pen: GpPen; X: Single; Y: Single;
  5281. Width: Single; Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  5282.  
  5283. { GdipDrawEllipseI(GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height); }
  5284. function GdipDrawEllipseI(Graphics: GpGraphics; Pen: GpPen; X: Integer;
  5285. Y: Integer; Width: Integer; Height: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5286.  
  5287. { GdipDrawPie(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle); }
  5288. function GdipDrawPie(Graphics: GpGraphics; Pen: GpPen; X: Single; Y: Single;
  5289. Width: Single; Height: Single; StartAngle: Single; SweepAngle: Single): TGPStatus; stdcall;
  5290. external GdiPlusDll;
  5291.  
  5292. { GdipDrawPieI(GpGraphics *graphics, GpPen *pen, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle); }
  5293. function GdipDrawPieI(Graphics: GpGraphics; Pen: GpPen; X: Integer; Y: Integer;
  5294. Width: Integer; Height: Integer; StartAngle: Single; SweepAngle: Single): TGPStatus; stdcall;
  5295. external GdiPlusDll;
  5296.  
  5297. { GdipDrawPolygon(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count); }
  5298. function GdipDrawPolygon(Graphics: GpGraphics; Pen: GpPen;
  5299. const Points: PGPPointF; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5300.  
  5301. { GdipDrawPolygonI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count); }
  5302. function GdipDrawPolygonI(Graphics: GpGraphics; Pen: GpPen;
  5303. const Points: PGPPoint; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5304.  
  5305. { GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path); }
  5306. function GdipDrawPath(Graphics: GpGraphics; Pen: GpPen; Path: GpPath): TGPStatus; stdcall;
  5307. external GdiPlusDll;
  5308.  
  5309. { GdipDrawCurve(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count); }
  5310. function GdipDrawCurve(Graphics: GpGraphics; Pen: GpPen; const Points: PGPPointF;
  5311. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5312.  
  5313. { GdipDrawCurveI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count); }
  5314. function GdipDrawCurveI(Graphics: GpGraphics; Pen: GpPen; const Points: PGPPoint;
  5315. Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5316.  
  5317. { GdipDrawCurve2(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, REAL tension); }
  5318. function GdipDrawCurve2(Graphics: GpGraphics; Pen: GpPen; const Points: PGPPointF;
  5319. Count: Integer; Tension: Single): TGPStatus; stdcall; external GdiPlusDll;
  5320.  
  5321. { GdipDrawCurve2I(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, REAL tension); }
  5322. function GdipDrawCurve2I(Graphics: GpGraphics; Pen: GpPen; const Points: PGPPoint;
  5323. Count: Integer; Tension: Single): TGPStatus; stdcall; external GdiPlusDll;
  5324.  
  5325. { GdipDrawCurve3(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, INT offset, INT numberOfSegments, REAL tension); }
  5326. function GdipDrawCurve3(Graphics: GpGraphics; Pen: GpPen; const Points: PGPPointF;
  5327. Count: Integer; Offset: Integer; NumberOfSegments: Integer; Tension: Single): TGPStatus; stdcall;
  5328. external GdiPlusDll;
  5329.  
  5330. { GdipDrawCurve3I(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, INT offset, INT numberOfSegments, REAL tension); }
  5331. function GdipDrawCurve3I(Graphics: GpGraphics; Pen: GpPen; const Points: PGPPoint;
  5332. Count: Integer; Offset: Integer; NumberOfSegments: Integer; Tension: Single): TGPStatus; stdcall;
  5333. external GdiPlusDll;
  5334.  
  5335. { GdipDrawClosedCurve(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count); }
  5336. function GdipDrawClosedCurve(Graphics: GpGraphics; Pen: GpPen;
  5337. const Points: PGPPointF; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5338.  
  5339. { GdipDrawClosedCurveI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count); }
  5340. function GdipDrawClosedCurveI(Graphics: GpGraphics; Pen: GpPen;
  5341. const Points: PGPPoint; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5342.  
  5343. { GdipDrawClosedCurve2(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, INT count, REAL tension); }
  5344. function GdipDrawClosedCurve2(Graphics: GpGraphics; Pen: GpPen;
  5345. const Points: PGPPointF; Count: Integer; Tension: Single): TGPStatus; stdcall;
  5346. external GdiPlusDll;
  5347.  
  5348. { GdipDrawClosedCurve2I(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, INT count, REAL tension); }
  5349. function GdipDrawClosedCurve2I(Graphics: GpGraphics; Pen: GpPen;
  5350. const Points: PGPPoint; Count: Integer; Tension: Single): TGPStatus; stdcall;
  5351. external GdiPlusDll;
  5352.  
  5353. { GdipGraphicsClear(GpGraphics *graphics, ARGB color); }
  5354. function GdipGraphicsClear(Graphics: GpGraphics; Color: ARGB): TGPStatus; stdcall;
  5355. external GdiPlusDll;
  5356.  
  5357. { GdipFillRectangle(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height); }
  5358. function GdipFillRectangle(Graphics: GpGraphics; Brush: GpBrush; X: Single;
  5359. Y: Single; Width: Single; Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  5360.  
  5361. { GdipFillRectangleI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height); }
  5362. function GdipFillRectangleI(Graphics: GpGraphics; Brush: GpBrush; X: Integer;
  5363. Y: Integer; Width: Integer; Height: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5364.  
  5365. { GdipFillRectangles(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, INT count); }
  5366. function GdipFillRectangles(Graphics: GpGraphics; Brush: GpBrush;
  5367. const Rects: PGPRectF; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5368.  
  5369. { GdipFillRectanglesI(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRect *rects, INT count); }
  5370. function GdipFillRectanglesI(Graphics: GpGraphics; Brush: GpBrush;
  5371. const Rects: PGPRect; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5372.  
  5373. { GdipFillPolygon(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count, GpFillMode fillMode); }
  5374. function GdipFillPolygon(Graphics: GpGraphics; Brush: GpBrush;
  5375. const Points: PGPPointF; Count: Integer; FillMode: TGPFillMode): TGPStatus; stdcall;
  5376. external GdiPlusDll;
  5377.  
  5378. { GdipFillPolygonI(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count, GpFillMode fillMode); }
  5379. function GdipFillPolygonI(Graphics: GpGraphics; Brush: GpBrush;
  5380. const Points: PGPPoint; Count: Integer; FillMode: TGPFillMode): TGPStatus; stdcall;
  5381. external GdiPlusDll;
  5382.  
  5383. { GdipFillPolygon2(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count); }
  5384. function GdipFillPolygon2(Graphics: GpGraphics; Brush: GpBrush;
  5385. const Points: PGPPointF; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5386.  
  5387. { GdipFillPolygon2I(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count); }
  5388. function GdipFillPolygon2I(Graphics: GpGraphics; Brush: GpBrush;
  5389. const Points: PGPPoint; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5390.  
  5391. { GdipFillEllipse(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height); }
  5392. function GdipFillEllipse(Graphics: GpGraphics; Brush: GpBrush; X: Single;
  5393. Y: Single; Width: Single; Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  5394.  
  5395. { GdipFillEllipseI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height); }
  5396. function GdipFillEllipseI(Graphics: GpGraphics; Brush: GpBrush; X: Integer;
  5397. Y: Integer; Width: Integer; Height: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5398.  
  5399. { GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle); }
  5400. function GdipFillPie(Graphics: GpGraphics; Brush: GpBrush; X: Single; Y: Single;
  5401. Width: Single; Height: Single; StartAngle: Single; SweepAngle: Single): TGPStatus; stdcall;
  5402. external GdiPlusDll;
  5403.  
  5404. { GdipFillPieI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle); }
  5405. function GdipFillPieI(Graphics: GpGraphics; Brush: GpBrush; X: Integer;
  5406. Y: Integer; Width: Integer; Height: Integer; StartAngle: Single;
  5407. SweepAngle: Single): TGPStatus; stdcall; external GdiPlusDll;
  5408.  
  5409. { GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath *path); }
  5410. function GdipFillPath(Graphics: GpGraphics; Brush: GpBrush; Path: GpPath): TGPStatus; stdcall;
  5411. external GdiPlusDll;
  5412.  
  5413. { GdipFillClosedCurve(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count); }
  5414. function GdipFillClosedCurve(Graphics: GpGraphics; Brush: GpBrush;
  5415. const Points: PGPPointF; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5416.  
  5417. { GdipFillClosedCurveI(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count); }
  5418. function GdipFillClosedCurveI(Graphics: GpGraphics; Brush: GpBrush;
  5419. const Points: PGPPoint; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5420.  
  5421. { GdipFillClosedCurve2(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, INT count, REAL tension, GpFillMode fillMode); }
  5422. function GdipFillClosedCurve2(Graphics: GpGraphics; Brush: GpBrush;
  5423. const Points: PGPPointF; Count: Integer; Tension: Single; FillMode: TGPFillMode): TGPStatus; stdcall;
  5424. external GdiPlusDll;
  5425.  
  5426. { GdipFillClosedCurve2I(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, INT count, REAL tension, GpFillMode fillMode); }
  5427. function GdipFillClosedCurve2I(Graphics: GpGraphics; Brush: GpBrush;
  5428. const Points: PGPPoint; Count: Integer; Tension: Single; FillMode: TGPFillMode): TGPStatus; stdcall;
  5429. external GdiPlusDll;
  5430.  
  5431. { GdipFillRegion(GpGraphics *graphics, GpBrush *brush, GpRegion *region); }
  5432. function GdipFillRegion(Graphics: GpGraphics; Brush: GpBrush; Region: GpRegion): TGPStatus; stdcall;
  5433. external GdiPlusDll;
  5434.  
  5435. {$IF (GDIPVER >= $0110)}
  5436. { GdipDrawImageFX( GpGraphics *graphics, GpImage *image, GpRectF *source, GpMatrix *xForm, CGpEffect *effect, GpImageAttributes *imageAttributes, GpUnit srcUnit ); }
  5437. function GdipDrawImageFX(Graphics: GpGraphics; Image: GpImage; Source: PGPRectF;
  5438. XForm: GpMatrix; Effect: CGpEffect; ImageAttributes: GpImageAttributes;
  5439. SrcUnit: TGPUnit): TGPStatus; stdcall; external GdiPlusDll;
  5440. {$IFEND}
  5441.  
  5442. { GdipDrawImage(GpGraphics *graphics, GpImage *image, REAL x, REAL y); }
  5443. function GdipDrawImage(Graphics: GpGraphics; Image: GpImage; X: Single;
  5444. Y: Single): TGPStatus; stdcall; external GdiPlusDll;
  5445.  
  5446. { GdipDrawImageI(GpGraphics *graphics, GpImage *image, INT x, INT y); }
  5447. function GdipDrawImageI(Graphics: GpGraphics; Image: GpImage; X: Integer;
  5448. Y: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5449.  
  5450. { GdipDrawImageRect(GpGraphics *graphics, GpImage *image, REAL x, REAL y, REAL width, REAL height); }
  5451. function GdipDrawImageRect(Graphics: GpGraphics; Image: GpImage; X: Single;
  5452. Y: Single; Width: Single; Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  5453.  
  5454. { GdipDrawImageRectI(GpGraphics *graphics, GpImage *image, INT x, INT y, INT width, INT height); }
  5455. function GdipDrawImageRectI(Graphics: GpGraphics; Image: GpImage; X: Integer;
  5456. Y: Integer; Width: Integer; Height: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5457.  
  5458. { GdipDrawImagePoints(GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *dstpoints, INT count); }
  5459. function GdipDrawImagePoints(Graphics: GpGraphics; Image: GpImage;
  5460. const Dstpoints: PGPPointF; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5461.  
  5462. { GdipDrawImagePointsI(GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *dstpoints, INT count); }
  5463. function GdipDrawImagePointsI(Graphics: GpGraphics; Image: GpImage;
  5464. const Dstpoints: PGPPoint; Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5465.  
  5466. { GdipDrawImagePointRect(GpGraphics *graphics, GpImage *image, REAL x, REAL y, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit); }
  5467. function GdipDrawImagePointRect(Graphics: GpGraphics; Image: GpImage; X: Single;
  5468. Y: Single; Srcx: Single; Srcy: Single; Srcwidth: Single; Srcheight: Single;
  5469. SrcUnit: TGPUnit): TGPStatus; stdcall; external GdiPlusDll;
  5470.  
  5471. { GdipDrawImagePointRectI(GpGraphics *graphics, GpImage *image, INT x, INT y, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit); }
  5472. function GdipDrawImagePointRectI(Graphics: GpGraphics; Image: GpImage;
  5473. X: Integer; Y: Integer; Srcx: Integer; Srcy: Integer; Srcwidth: Integer;
  5474. Srcheight: Integer; SrcUnit: TGPUnit): TGPStatus; stdcall; external GdiPlusDll;
  5475.  
  5476. { GdipDrawImageRectRect(GpGraphics *graphics, GpImage *image, REAL dstx, REAL dsty, REAL dstwidth, REAL dstheight, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes* imageAttributes, DrawImageAbort callback, VOID * callbackData); }
  5477. function GdipDrawImageRectRect(Graphics: GpGraphics; Image: GpImage;
  5478. Dstx: Single; Dsty: Single; Dstwidth: Single; Dstheight: Single; Srcx: Single;
  5479. Srcy: Single; Srcwidth: Single; Srcheight: Single; SrcUnit: TGPUnit;
  5480. const ImageAttributes: GpImageAttributes; Callback: TGPDrawImageAbort;
  5481. CallbackData: Pointer): TGPStatus; stdcall; external GdiPlusDll;
  5482.  
  5483. { GdipDrawImageRectRectI(GpGraphics *graphics, GpImage *image, INT dstx, INT dsty, INT dstwidth, INT dstheight, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes* imageAttributes, DrawImageAbort callback, VOID * callbackData); }
  5484. function GdipDrawImageRectRectI(Graphics: GpGraphics; Image: GpImage;
  5485. Dstx: Integer; Dsty: Integer; Dstwidth: Integer; Dstheight: Integer;
  5486. Srcx: Integer; Srcy: Integer; Srcwidth: Integer; Srcheight: Integer;
  5487. SrcUnit: TGPUnit; const ImageAttributes: GpImageAttributes;
  5488. Callback: TGPDrawImageAbort; CallbackData: Pointer): TGPStatus; stdcall;
  5489. external GdiPlusDll;
  5490.  
  5491. { GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *points, INT count, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes* imageAttributes, DrawImageAbort callback, VOID * callbackData); }
  5492. function GdipDrawImagePointsRect(Graphics: GpGraphics; Image: GpImage;
  5493. const Points: PGPPointF; Count: Integer; Srcx: Single; Srcy: Single;
  5494. Srcwidth: Single; Srcheight: Single; SrcUnit: TGPUnit;
  5495. const ImageAttributes: GpImageAttributes; Callback: TGPDrawImageAbort;
  5496. CallbackData: Pointer): TGPStatus; stdcall; external GdiPlusDll;
  5497.  
  5498. { GdipDrawImagePointsRectI(GpGraphics *graphics, GpImage *image, GDIPCONST GpPoint *points, INT count, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes* imageAttributes, DrawImageAbort callback, VOID * callbackData); }
  5499. function GdipDrawImagePointsRectI(Graphics: GpGraphics; Image: GpImage;
  5500. const Points: PGPPoint; Count: Integer; Srcx: Integer; Srcy: Integer;
  5501. Srcwidth: Integer; Srcheight: Integer; SrcUnit: TGPUnit;
  5502. const ImageAttributes: GpImageAttributes; Callback: TGPDrawImageAbort;
  5503. CallbackData: Pointer): TGPStatus; stdcall; external GdiPlusDll;
  5504.  
  5505. { GdipEnumerateMetafileDestPoint( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST PointF & destPoint, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5506. function GdipEnumerateMetafileDestPoint(Graphics: GpGraphics;
  5507. const Metafile: GpMetafile; const DestPoint: PGPPointF;
  5508. Callback: TGPEnumerateMetafileProc; CallbackData: Pointer;
  5509. const ImageAttributes: GpImageAttributes): TGPStatus; stdcall; external GdiPlusDll;
  5510.  
  5511. { GdipEnumerateMetafileDestPointI( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST Point & destPoint, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5512. function GdipEnumerateMetafileDestPointI(Graphics: GpGraphics;
  5513. const Metafile: GpMetafile; const DestPoint: PGPPoint;
  5514. Callback: TGPEnumerateMetafileProc; CallbackData: Pointer;
  5515. const ImageAttributes: GpImageAttributes): TGPStatus; stdcall; external GdiPlusDll;
  5516.  
  5517. { GdipEnumerateMetafileDestRect( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST RectF & destRect, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5518. function GdipEnumerateMetafileDestRect(Graphics: GpGraphics;
  5519. const Metafile: GpMetafile; const DestRect: PGPRectF;
  5520. Callback: TGPEnumerateMetafileProc; CallbackData: Pointer;
  5521. const ImageAttributes: GpImageAttributes): TGPStatus; stdcall; external GdiPlusDll;
  5522.  
  5523. { GdipEnumerateMetafileDestRectI( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST Rect & destRect, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5524. function GdipEnumerateMetafileDestRectI(Graphics: GpGraphics;
  5525. const Metafile: GpMetafile; const DestRect: PGPRect;
  5526. Callback: TGPEnumerateMetafileProc; CallbackData: Pointer;
  5527. const ImageAttributes: GpImageAttributes): TGPStatus; stdcall; external GdiPlusDll;
  5528.  
  5529. { GdipEnumerateMetafileDestPoints( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST PointF * destPoints, INT count, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5530. function GdipEnumerateMetafileDestPoints(Graphics: GpGraphics;
  5531. const Metafile: GpMetafile; const DestPoints: PGPPointF; Count: Integer;
  5532. Callback: TGPEnumerateMetafileProc; CallbackData: Pointer;
  5533. const ImageAttributes: GpImageAttributes): TGPStatus; stdcall; external GdiPlusDll;
  5534.  
  5535. { GdipEnumerateMetafileDestPointsI( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST Point * destPoints, INT count, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5536. function GdipEnumerateMetafileDestPointsI(Graphics: GpGraphics;
  5537. const Metafile: GpMetafile; const DestPoints: PGPPoint; Count: Integer;
  5538. Callback: TGPEnumerateMetafileProc; CallbackData: Pointer;
  5539. const ImageAttributes: GpImageAttributes): TGPStatus; stdcall; external GdiPlusDll;
  5540.  
  5541. { GdipEnumerateMetafileSrcRectDestPoint( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST PointF & destPoint, GDIPCONST RectF & srcRect, Unit srcUnit, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5542. function GdipEnumerateMetafileSrcRectDestPoint(Graphics: GpGraphics;
  5543. const Metafile: GpMetafile; const DestPoint: PGPPointF; const SrcRect: PGPRectF;
  5544. SrcUnit: TGPUnit; Callback: TGPEnumerateMetafileProc; CallbackData: Pointer;
  5545. const ImageAttributes: GpImageAttributes): TGPStatus; stdcall; external GdiPlusDll;
  5546.  
  5547. { GdipEnumerateMetafileSrcRectDestPointI( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST Point & destPoint, GDIPCONST Rect & srcRect, Unit srcUnit, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5548. function GdipEnumerateMetafileSrcRectDestPointI(Graphics: GpGraphics;
  5549. const Metafile: GpMetafile; const DestPoint: PGPPoint; const SrcRect: PGPRect;
  5550. SrcUnit: TGPUnit; Callback: TGPEnumerateMetafileProc; CallbackData: Pointer;
  5551. const ImageAttributes: GpImageAttributes): TGPStatus; stdcall; external GdiPlusDll;
  5552.  
  5553. { GdipEnumerateMetafileSrcRectDestRect( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST RectF & destRect, GDIPCONST RectF & srcRect, Unit srcUnit, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5554. function GdipEnumerateMetafileSrcRectDestRect(Graphics: GpGraphics;
  5555. const Metafile: GpMetafile; const DestRect: PGPRectF; const SrcRect: PGPRectF;
  5556. SrcUnit: TGPUnit; Callback: TGPEnumerateMetafileProc; CallbackData: Pointer;
  5557. const ImageAttributes: GpImageAttributes): TGPStatus; stdcall; external GdiPlusDll;
  5558.  
  5559. { GdipEnumerateMetafileSrcRectDestRectI( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST Rect & destRect, GDIPCONST Rect & srcRect, Unit srcUnit, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5560. function GdipEnumerateMetafileSrcRectDestRectI(Graphics: GpGraphics;
  5561. const Metafile: GpMetafile; const DestRect: PGPRect; const SrcRect: PGPRect;
  5562. SrcUnit: TGPUnit; Callback: TGPEnumerateMetafileProc; CallbackData: Pointer;
  5563. const ImageAttributes: GpImageAttributes): TGPStatus; stdcall; external GdiPlusDll;
  5564.  
  5565. { GdipEnumerateMetafileSrcRectDestPoints( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST PointF * destPoints, INT count, GDIPCONST RectF & srcRect, Unit srcUnit, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5566. function GdipEnumerateMetafileSrcRectDestPoints(Graphics: GpGraphics;
  5567. const Metafile: GpMetafile; const DestPoints: PGPPointF; Count: Integer;
  5568. const SrcRect: PGPRectF; SrcUnit: TGPUnit; Callback: TGPEnumerateMetafileProc;
  5569. CallbackData: Pointer; const ImageAttributes: GpImageAttributes): TGPStatus; stdcall;
  5570. external GdiPlusDll;
  5571.  
  5572. { GdipEnumerateMetafileSrcRectDestPointsI( GpGraphics * graphics, GDIPCONST GpMetafile * metafile, GDIPCONST Point * destPoints, INT count, GDIPCONST Rect & srcRect, Unit srcUnit, EnumerateMetafileProc callback, VOID * callbackData, GDIPCONST GpImageAttributes * imageAttributes ); }
  5573. function GdipEnumerateMetafileSrcRectDestPointsI(Graphics: GpGraphics;
  5574. const Metafile: GpMetafile; const DestPoints: PGPPoint; Count: Integer;
  5575. const SrcRect: PGPRect; SrcUnit: TGPUnit; Callback: TGPEnumerateMetafileProc;
  5576. CallbackData: Pointer; const ImageAttributes: GpImageAttributes): TGPStatus; stdcall;
  5577. external GdiPlusDll;
  5578.  
  5579. { GdipPlayMetafileRecord( GDIPCONST GpMetafile * metafile, EmfPlusRecordType recordType, UINT flags, UINT dataSize, GDIPCONST BYTE * data ); }
  5580. function GdipPlayMetafileRecord(const Metafile: GpMetafile;
  5581. RecordType: TEmfPlusRecordType; Flags: Cardinal; DataSize: Cardinal;
  5582. const Data: PByte): TGPStatus; stdcall; external GdiPlusDll;
  5583.  
  5584. { GdipSetClipGraphics(GpGraphics *graphics, GpGraphics *srcgraphics, CombineMode combineMode); }
  5585. function GdipSetClipGraphics(Graphics: GpGraphics; Srcgraphics: GpGraphics;
  5586. CombineMode: TGPCombineMode): TGPStatus; stdcall; external GdiPlusDll;
  5587.  
  5588. { GdipSetClipRect(GpGraphics *graphics, REAL x, REAL y, REAL width, REAL height, CombineMode combineMode); }
  5589. function GdipSetClipRect(Graphics: GpGraphics; X: Single; Y: Single;
  5590. Width: Single; Height: Single; CombineMode: TGPCombineMode): TGPStatus; stdcall;
  5591. external GdiPlusDll;
  5592.  
  5593. { GdipSetClipRectI(GpGraphics *graphics, INT x, INT y, INT width, INT height, CombineMode combineMode); }
  5594. function GdipSetClipRectI(Graphics: GpGraphics; X: Integer; Y: Integer;
  5595. Width: Integer; Height: Integer; CombineMode: TGPCombineMode): TGPStatus; stdcall;
  5596. external GdiPlusDll;
  5597.  
  5598. { GdipSetClipPath(GpGraphics *graphics, GpPath *path, CombineMode combineMode); }
  5599. function GdipSetClipPath(Graphics: GpGraphics; Path: GpPath;
  5600. CombineMode: TGPCombineMode): TGPStatus; stdcall; external GdiPlusDll;
  5601.  
  5602. { GdipSetClipRegion(GpGraphics *graphics, GpRegion *region, CombineMode combineMode); }
  5603. function GdipSetClipRegion(Graphics: GpGraphics; Region: GpRegion;
  5604. CombineMode: TGPCombineMode): TGPStatus; stdcall; external GdiPlusDll;
  5605.  
  5606. { GdipSetClipHrgn(GpGraphics *graphics, HRGN hRgn, CombineMode combineMode); }
  5607. function GdipSetClipHrgn(Graphics: GpGraphics; HRgn: HRGN;
  5608. CombineMode: TGPCombineMode): TGPStatus; stdcall; external GdiPlusDll;
  5609.  
  5610. { GdipResetClip(GpGraphics *graphics); }
  5611. function GdipResetClip(Graphics: GpGraphics): TGPStatus; stdcall; external GdiPlusDll;
  5612.  
  5613. { GdipTranslateClip(GpGraphics *graphics, REAL dx, REAL dy); }
  5614. function GdipTranslateClip(Graphics: GpGraphics; Dx: Single; Dy: Single): TGPStatus; stdcall;
  5615. external GdiPlusDll;
  5616.  
  5617. { GdipTranslateClipI(GpGraphics *graphics, INT dx, INT dy); }
  5618. function GdipTranslateClipI(Graphics: GpGraphics; Dx: Integer; Dy: Integer): TGPStatus; stdcall;
  5619. external GdiPlusDll;
  5620.  
  5621. { GdipGetClip(GpGraphics *graphics, GpRegion *region); }
  5622. function GdipGetClip(Graphics: GpGraphics; Region: GpRegion): TGPStatus; stdcall;
  5623. external GdiPlusDll;
  5624.  
  5625. { GdipGetClipBounds(GpGraphics *graphics, GpRectF *rect); }
  5626. function GdipGetClipBounds(Graphics: GpGraphics; out Rect: TGPRectF): TGPStatus; stdcall;
  5627. external GdiPlusDll;
  5628.  
  5629. { GdipGetClipBoundsI(GpGraphics *graphics, GpRect *rect); }
  5630. function GdipGetClipBoundsI(Graphics: GpGraphics; out Rect: TGPRect): TGPStatus; stdcall;
  5631. external GdiPlusDll;
  5632.  
  5633. { GdipIsClipEmpty(GpGraphics *graphics, BOOL *result); }
  5634. function GdipIsClipEmpty(Graphics: GpGraphics; out Result: Bool): TGPStatus; stdcall;
  5635. external GdiPlusDll;
  5636.  
  5637. { GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect); }
  5638. function GdipGetVisibleClipBounds(Graphics: GpGraphics; out Rect: TGPRectF): TGPStatus; stdcall;
  5639. external GdiPlusDll;
  5640.  
  5641. { GdipGetVisibleClipBoundsI(GpGraphics *graphics, GpRect *rect); }
  5642. function GdipGetVisibleClipBoundsI(Graphics: GpGraphics; out Rect: TGPRect): TGPStatus; stdcall;
  5643. external GdiPlusDll;
  5644.  
  5645. { GdipIsVisibleClipEmpty(GpGraphics *graphics, BOOL *result); }
  5646. function GdipIsVisibleClipEmpty(Graphics: GpGraphics; out Result: Bool): TGPStatus; stdcall;
  5647. external GdiPlusDll;
  5648.  
  5649. { GdipIsVisiblePoint(GpGraphics *graphics, REAL x, REAL y, BOOL *result); }
  5650. function GdipIsVisiblePoint(Graphics: GpGraphics; X: Single; Y: Single;
  5651. out Result: Bool): TGPStatus; stdcall; external GdiPlusDll;
  5652.  
  5653. { GdipIsVisiblePointI(GpGraphics *graphics, INT x, INT y, BOOL *result); }
  5654. function GdipIsVisiblePointI(Graphics: GpGraphics; X: Integer; Y: Integer;
  5655. out Result: Bool): TGPStatus; stdcall; external GdiPlusDll;
  5656.  
  5657. { GdipIsVisibleRect(GpGraphics *graphics, REAL x, REAL y, REAL width, REAL height, BOOL *result); }
  5658. function GdipIsVisibleRect(Graphics: GpGraphics; X: Single; Y: Single;
  5659. Width: Single; Height: Single; out Result: Bool): TGPStatus; stdcall; external GdiPlusDll;
  5660.  
  5661. { GdipIsVisibleRectI(GpGraphics *graphics, INT x, INT y, INT width, INT height, BOOL *result); }
  5662. function GdipIsVisibleRectI(Graphics: GpGraphics; X: Integer; Y: Integer;
  5663. Width: Integer; Height: Integer; out Result: Bool): TGPStatus; stdcall;
  5664. external GdiPlusDll;
  5665.  
  5666. { GdipSaveGraphics(GpGraphics *graphics, GraphicsState *state); }
  5667. function GdipSaveGraphics(Graphics: GpGraphics; out State: TGPGraphicsState): TGPStatus; stdcall;
  5668. external GdiPlusDll;
  5669.  
  5670. { GdipRestoreGraphics(GpGraphics *graphics, GraphicsState state); }
  5671. function GdipRestoreGraphics(Graphics: GpGraphics; State: TGPGraphicsState): TGPStatus; stdcall;
  5672. external GdiPlusDll;
  5673.  
  5674. { GdipBeginContainer(GpGraphics *graphics, GDIPCONST GpRectF* dstrect, GDIPCONST GpRectF *srcrect, GpUnit unit, GraphicsContainer *state); }
  5675. function GdipBeginContainer(Graphics: GpGraphics; const Dstrect: PGPRectF;
  5676. const Srcrect: PGPRectF; AUnit: TGPUnit; out State: TGPGraphicsContainer): TGPStatus; stdcall;
  5677. external GdiPlusDll;
  5678.  
  5679. { GdipBeginContainerI(GpGraphics *graphics, GDIPCONST GpRect* dstrect, GDIPCONST GpRect *srcrect, GpUnit unit, GraphicsContainer *state); }
  5680. function GdipBeginContainerI(Graphics: GpGraphics; const Dstrect: PGPRect;
  5681. const Srcrect: PGPRect; AUnit: TGPUnit; out State: TGPGraphicsContainer): TGPStatus; stdcall;
  5682. external GdiPlusDll;
  5683.  
  5684. { GdipBeginContainer2(GpGraphics *graphics, GraphicsContainer* state); }
  5685. function GdipBeginContainer2(Graphics: GpGraphics; out State: TGPGraphicsContainer): TGPStatus; stdcall;
  5686. external GdiPlusDll;
  5687.  
  5688. { GdipEndContainer(GpGraphics *graphics, GraphicsContainer state); }
  5689. function GdipEndContainer(Graphics: GpGraphics; State: TGPGraphicsContainer): TGPStatus; stdcall;
  5690. external GdiPlusDll;
  5691.  
  5692. { GdipGetMetafileHeaderFromWmf( HMETAFILE hWmf, GDIPCONST WmfPlaceableFileHeader * wmfPlaceableFileHeader, MetafileHeader * header ); }
  5693. function GdipGetMetafileHeaderFromWmf(HWmf: HMetaFile;
  5694. const WmfPlaceableFileHeader: TWmfPlaceableFileHeader;
  5695. out Header: TGPMetafileHeader): TGPStatus; stdcall; external GdiPlusDll;
  5696.  
  5697. { GdipGetMetafileHeaderFromEmf( HENHMETAFILE hEmf, MetafileHeader * header ); }
  5698. function GdipGetMetafileHeaderFromEmf(HEmf: HEnhMetaFile;
  5699. out Header: TGPMetafileHeader): TGPStatus; stdcall; external GdiPlusDll;
  5700.  
  5701. { GdipGetMetafileHeaderFromFile( GDIPCONST WCHAR* filename, MetafileHeader * header ); }
  5702. function GdipGetMetafileHeaderFromFile(const Filename: PWideChar;
  5703. out Header: TGPMetafileHeader): TGPStatus; stdcall; external GdiPlusDll;
  5704.  
  5705. { GdipGetMetafileHeaderFromStream( IStream * stream, MetafileHeader * header ); }
  5706. function GdipGetMetafileHeaderFromStream(const Stream: IStream;
  5707. out Header: TGPMetafileHeader): TGPStatus; stdcall; external GdiPlusDll;
  5708.  
  5709. { GdipGetMetafileHeaderFromMetafile( GpMetafile * metafile, MetafileHeader * header ); }
  5710. function GdipGetMetafileHeaderFromMetafile(Metafile: GpMetafile;
  5711. out Header: TGPMetafileHeader): TGPStatus; stdcall; external GdiPlusDll;
  5712.  
  5713. { GdipGetHemfFromMetafile( GpMetafile * metafile, HENHMETAFILE * hEmf ); }
  5714. function GdipGetHemfFromMetafile(Metafile: GpMetafile;
  5715. out HEmf: HEnhMetaFile): TGPStatus; stdcall; external GdiPlusDll;
  5716.  
  5717. { GdipCreateStreamOnFile(GDIPCONST WCHAR * filename, UINT access, IStream **stream); }
  5718. function GdipCreateStreamOnFile(const Filename: PWideChar; Access: Cardinal;
  5719. const Stream: IStream): TGPStatus; stdcall; external GdiPlusDll;
  5720.  
  5721. { GdipCreateMetafileFromWmf(HMETAFILE hWmf, BOOL deleteWmf, GDIPCONST WmfPlaceableFileHeader * wmfPlaceableFileHeader, GpMetafile **metafile); }
  5722. function GdipCreateMetafileFromWmf(HWmf: HMetaFile; DeleteWmf: Bool;
  5723. const WmfPlaceableFileHeader: TWmfPlaceableFileHeader;
  5724. out Metafile: GpMetafile): TGPStatus; stdcall; external GdiPlusDll;
  5725.  
  5726. { GdipCreateMetafileFromEmf(HENHMETAFILE hEmf, BOOL deleteEmf, GpMetafile **metafile); }
  5727. function GdipCreateMetafileFromEmf(HEmf: HEnhMetaFile; DeleteEmf: Bool;
  5728. out Metafile: GpMetafile): TGPStatus; stdcall; external GdiPlusDll;
  5729.  
  5730. { GdipCreateMetafileFromFile(GDIPCONST WCHAR* file, GpMetafile **metafile); }
  5731. function GdipCreateMetafileFromFile(const Filename: PWideChar;
  5732. out Metafile: GpMetafile): TGPStatus; stdcall; external GdiPlusDll;
  5733.  
  5734. { GdipCreateMetafileFromWmfFile(GDIPCONST WCHAR* file, GDIPCONST WmfPlaceableFileHeader * wmfPlaceableFileHeader, GpMetafile **metafile); }
  5735. function GdipCreateMetafileFromWmfFile(const Filename: PWideChar;
  5736. const WmfPlaceableFileHeader: TWmfPlaceableFileHeader;
  5737. out Metafile: GpMetafile): TGPStatus; stdcall; external GdiPlusDll;
  5738.  
  5739. { GdipCreateMetafileFromStream(IStream * stream, GpMetafile **metafile); }
  5740. function GdipCreateMetafileFromStream(const Stream: IStream;
  5741. out Metafile: GpMetafile): TGPStatus; stdcall; external GdiPlusDll;
  5742.  
  5743.  
  5744. { GdipRecordMetafile( HDC referenceHdc, EmfType type, GDIPCONST GpRectF * frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR * description, GpMetafile ** metafile ); }
  5745. function GdipRecordMetafile(ReferenceHdc: HDC; AType: TGPEmfType;
  5746. const FrameRect: PGPRectF; FrameUnit: TGPMetafileFrameUnit;
  5747. const Description: PWideChar; out Metafile: GpMetafile): TGPStatus; stdcall;
  5748. external GdiPlusDll;
  5749.  
  5750. { GdipRecordMetafileI( HDC referenceHdc, EmfType type, GDIPCONST GpRect * frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR * description, GpMetafile ** metafile ); }
  5751. function GdipRecordMetafileI(ReferenceHdc: HDC; AType: TGPEmfType;
  5752. const FrameRect: PGPRect; FrameUnit: TGPMetafileFrameUnit;
  5753. const Description: PWideChar; out Metafile: GpMetafile): TGPStatus; stdcall;
  5754. external GdiPlusDll;
  5755.  
  5756. { GdipRecordMetafileFileName( GDIPCONST WCHAR* fileName, HDC referenceHdc, EmfType type, GDIPCONST GpRectF * frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR * description, GpMetafile ** metafile ); }
  5757. function GdipRecordMetafileFileName(const FileName: PWideChar;
  5758. ReferenceHdc: HDC; AType: TGPEmfType; const FrameRect: PGPRectF;
  5759. FrameUnit: TGPMetafileFrameUnit; const Description: PWideChar;
  5760. out Metafile: GpMetafile): TGPStatus; stdcall; external GdiPlusDll;
  5761.  
  5762. { GdipRecordMetafileFileNameI( GDIPCONST WCHAR* fileName, HDC referenceHdc, EmfType type, GDIPCONST GpRect * frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR * description, GpMetafile ** metafile ); }
  5763. function GdipRecordMetafileFileNameI(const FileName: PWideChar;
  5764. ReferenceHdc: HDC; AType: TGPEmfType; const FrameRect: PGPRect;
  5765. FrameUnit: TGPMetafileFrameUnit; const Description: PWideChar;
  5766. out Metafile: GpMetafile): TGPStatus; stdcall; external GdiPlusDll;
  5767.  
  5768. { GdipRecordMetafileStream( IStream * stream, HDC referenceHdc, EmfType type, GDIPCONST GpRectF * frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR * description, GpMetafile ** metafile ); }
  5769. function GdipRecordMetafileStream(const Stream: IStream; ReferenceHdc: HDC;
  5770. AType: TGPEmfType; const FrameRect: PGPRectF; FrameUnit: TGPMetafileFrameUnit;
  5771. const Description: PWideChar; out Metafile: GpMetafile): TGPStatus; stdcall;
  5772. external GdiPlusDll;
  5773.  
  5774. { GdipRecordMetafileStreamI( IStream * stream, HDC referenceHdc, EmfType type, GDIPCONST GpRect * frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR * description, GpMetafile ** metafile ); }
  5775. function GdipRecordMetafileStreamI(const Stream: IStream; ReferenceHdc: HDC;
  5776. AType: TGPEmfType; const FrameRect: PGPRect; FrameUnit: TGPMetafileFrameUnit;
  5777. const Description: PWideChar; out Metafile: GpMetafile): TGPStatus; stdcall;
  5778. external GdiPlusDll;
  5779.  
  5780. { GdipSetMetafileDownLevelRasterizationLimit( GpMetafile * metafile, UINT metafileRasterizationLimitDpi ); }
  5781. function GdipSetMetafileDownLevelRasterizationLimit(Metafile: GpMetafile;
  5782. MetafileRasterizationLimitDpi: Cardinal): TGPStatus; stdcall; external GdiPlusDll;
  5783.  
  5784. { GdipGetMetafileDownLevelRasterizationLimit( GDIPCONST GpMetafile * metafile, UINT * metafileRasterizationLimitDpi ); }
  5785. function GdipGetMetafileDownLevelRasterizationLimit(const Metafile: GpMetafile;
  5786. out MetafileRasterizationLimitDpi: Cardinal): TGPStatus; stdcall; external GdiPlusDll;
  5787.  
  5788. { GdipGetImageDecodersSize(UINT *numDecoders, UINT *size); }
  5789. function GdipGetImageDecodersSize(out NumDecoders: Cardinal; out Size: Cardinal): TGPStatus; stdcall;
  5790. external GdiPlusDll;
  5791.  
  5792. { GdipGetImageDecoders(UINT numDecoders, UINT size, __out_bcount(size) ImageCodecInfo *decoders); }
  5793. function GdipGetImageDecoders(NumDecoders: Cardinal; Size: Cardinal;
  5794. Decoders: PGPNativeImageCodecInfo): TGPStatus; stdcall; external GdiPlusDll;
  5795.  
  5796. { GdipGetImageEncodersSize(UINT *numEncoders, UINT *size); }
  5797. function GdipGetImageEncodersSize(out NumEncoders: Cardinal; out Size: Cardinal): TGPStatus; stdcall;
  5798. external GdiPlusDll;
  5799.  
  5800. { GdipGetImageEncoders(UINT numEncoders, UINT size, __out_bcount(size) ImageCodecInfo *encoders); }
  5801. function GdipGetImageEncoders(NumEncoders: Cardinal; Size: Cardinal;
  5802. Encoders: PGPNativeImageCodecInfo): TGPStatus; stdcall; external GdiPlusDll;
  5803.  
  5804. { GdipComment(GpGraphics* graphics, UINT sizeData, GDIPCONST BYTE * data); }
  5805. function GdipComment(Graphics: GpGraphics; SizeData: Cardinal;
  5806. const Data: PByte): TGPStatus; stdcall; external GdiPlusDll;
  5807.  
  5808. //----------------------------------------------------------------------------
  5809. // FontFamily APIs
  5810. //----------------------------------------------------------------------------
  5811.  
  5812. { GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, GpFontCollection *fontCollection, GpFontFamily **fontFamily); }
  5813. function GdipCreateFontFamilyFromName(const Name: PWideChar;
  5814. FontCollection: GpFontCollection; out FontFamily: GpFontFamily): TGPStatus; stdcall;
  5815. external GdiPlusDll;
  5816.  
  5817. { GdipDeleteFontFamily(GpFontFamily *fontFamily); }
  5818. function GdipDeleteFontFamily(FontFamily: GpFontFamily): TGPStatus; stdcall;
  5819. external GdiPlusDll;
  5820.  
  5821. { GdipCloneFontFamily(GpFontFamily *fontFamily, GpFontFamily **clonedFontFamily); }
  5822. function GdipCloneFontFamily(FontFamily: GpFontFamily;
  5823. out ClonedFontFamily: GpFontFamily): TGPStatus; stdcall; external GdiPlusDll;
  5824.  
  5825. { GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamily); }
  5826. function GdipGetGenericFontFamilySansSerif(out NativeFamily: GpFontFamily): TGPStatus; stdcall;
  5827. external GdiPlusDll;
  5828.  
  5829. { GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily); }
  5830. function GdipGetGenericFontFamilySerif(out NativeFamily: GpFontFamily): TGPStatus; stdcall;
  5831. external GdiPlusDll;
  5832.  
  5833. { GdipGetGenericFontFamilyMonospace(GpFontFamily **nativeFamily); }
  5834. function GdipGetGenericFontFamilyMonospace(out NativeFamily: GpFontFamily): TGPStatus; stdcall;
  5835. external GdiPlusDll;
  5836.  
  5837.  
  5838. { GdipGetFamilyName( GDIPCONST GpFontFamily *family, __out_ecount(LF_FACESIZE) LPWSTR name, LANGID language ); }
  5839. function GdipGetFamilyName(const Family: GpFontFamily; Name: PWideChar;
  5840. Language: LangID): TGPStatus; stdcall; external GdiPlusDll;
  5841.  
  5842. { GdipIsStyleAvailable(GDIPCONST GpFontFamily *family, INT style, BOOL * IsStyleAvailable); }
  5843. function GdipIsStyleAvailable(const Family: GpFontFamily; Style: TGPFontStyle;
  5844. out IsStyleAvailable: Bool): TGPStatus; stdcall; external GdiPlusDll;
  5845.  
  5846. { GdipFontCollectionEnumerable( GpFontCollection* fontCollection, GpGraphics* graphics, INT * numFound ); }
  5847. function GdipFontCollectionEnumerable(FontCollection: GpFontCollection;
  5848. Graphics: GpGraphics; NumFound: PInteger): TGPStatus; stdcall; external GdiPlusDll;
  5849.  
  5850. { GdipFontCollectionEnumerate( GpFontCollection* fontCollection, INT numSought, GpFontFamily* gpfamilies[], INT* numFound, GpGraphics* graphics ); }
  5851. function GdipFontCollectionEnumerate(FontCollection: GpFontCollection;
  5852. NumSought: Integer; Gpfamilies: PGpFontFamily; NumFound: PInteger;
  5853. Graphics: GpGraphics): TGPStatus; stdcall; external GdiPlusDll;
  5854.  
  5855. { GdipGetEmHeight(GDIPCONST GpFontFamily *family, INT style, UINT16 * EmHeight); }
  5856. function GdipGetEmHeight(const Family: GpFontFamily; Style: TGPFontStyle;
  5857. out EmHeight: UInt16): TGPStatus; stdcall; external GdiPlusDll;
  5858.  
  5859. { GdipGetCellAscent(GDIPCONST GpFontFamily *family, INT style, UINT16 * CellAscent); }
  5860. function GdipGetCellAscent(const Family: GpFontFamily; Style: TGPFontStyle;
  5861. out CellAscent: UInt16): TGPStatus; stdcall; external GdiPlusDll;
  5862.  
  5863. { GdipGetCellDescent(GDIPCONST GpFontFamily *family, INT style, UINT16 * CellDescent); }
  5864. function GdipGetCellDescent(const Family: GpFontFamily; Style: TGPFontStyle;
  5865. out CellDescent: UInt16): TGPStatus; stdcall; external GdiPlusDll;
  5866.  
  5867. { GdipGetLineSpacing(GDIPCONST GpFontFamily *family, INT style, UINT16 * LineSpacing); }
  5868. function GdipGetLineSpacing(const Family: GpFontFamily; Style: TGPFontStyle;
  5869. out LineSpacing: UInt16): TGPStatus; stdcall; external GdiPlusDll;
  5870.  
  5871. //----------------------------------------------------------------------------
  5872. // Font APIs
  5873. //----------------------------------------------------------------------------
  5874.  
  5875. { GdipCreateFontFromDC( HDC hdc, GpFont **font ); }
  5876. function GdipCreateFontFromDC(Hdc: HDC; out Font: GpFont): TGPStatus; stdcall;
  5877. external GdiPlusDll;
  5878.  
  5879. { GdipCreateFontFromLogfontA( HDC hdc, GDIPCONST LOGFONTA *logfont, GpFont **font ); }
  5880. function GdipCreateFontFromLogfontA(Hdc: HDC; const Logfont: PLogFontA;
  5881. out Font: GpFont): TGPStatus; stdcall; external GdiPlusDll;
  5882.  
  5883. { GdipCreateFontFromLogfontW( HDC hdc, GDIPCONST LOGFONTW *logfont, GpFont **font ); }
  5884. function GdipCreateFontFromLogfontW(Hdc: HDC; const Logfont: PLogFontW;
  5885. out Font: GpFont): TGPStatus; stdcall; external GdiPlusDll;
  5886.  
  5887. { GdipCreateFont( GDIPCONST GpFontFamily *fontFamily, REAL emSize, INT style, Unit unit, GpFont **font ); }
  5888. function GdipCreateFont(const FontFamily: GpFontFamily; EmSize: Single;
  5889. Style: TGPFontStyle; MeasureUnit: TGPUnit; out Font: GpFont): TGPStatus; stdcall;
  5890. external GdiPlusDll;
  5891.  
  5892. { GdipCloneFont(GpFont* font, GpFont** cloneFont); }
  5893. function GdipCloneFont(Font: GpFont; out CloneFont: GpFont): TGPStatus; stdcall;
  5894. external GdiPlusDll;
  5895.  
  5896. { GdipDeleteFont(GpFont* font); }
  5897. function GdipDeleteFont(Font: GpFont): TGPStatus; stdcall; external GdiPlusDll;
  5898.  
  5899. { GdipGetFamily(GpFont *font, GpFontFamily **family); }
  5900. function GdipGetFamily(Font: GpFont; out Family: GpFontFamily): TGPStatus; stdcall;
  5901. external GdiPlusDll;
  5902.  
  5903. { GdipGetFontStyle(GpFont *font, INT *style); }
  5904. function GdipGetFontStyle(Font: GpFont; out Style: TGPFontStyle): TGPStatus; stdcall;
  5905. external GdiPlusDll;
  5906.  
  5907. { GdipGetFontSize(GpFont *font, REAL *size); }
  5908. function GdipGetFontSize(Font: GpFont; out Size: Single): TGPStatus; stdcall;
  5909. external GdiPlusDll;
  5910.  
  5911. { GdipGetFontUnit(GpFont *font, Unit *unit); }
  5912. function GdipGetFontUnit(Font: GpFont; out MeasureUnit: TGPUnit): TGPStatus; stdcall;
  5913. external GdiPlusDll;
  5914.  
  5915. { GdipGetFontHeight(GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height); }
  5916. function GdipGetFontHeight(const Font: GpFont; const Graphics: GpGraphics;
  5917. out Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  5918.  
  5919. { GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi, REAL *height); }
  5920. function GdipGetFontHeightGivenDPI(const Font: GpFont; Dpi: Single;
  5921. out Height: Single): TGPStatus; stdcall; external GdiPlusDll;
  5922.  
  5923. { GdipGetLogFontA(GpFont * font, GpGraphics *graphics, LOGFONTA * logfontA); }
  5924. function GdipGetLogFontA(Font: GpFont; Graphics: GpGraphics;
  5925. out LogfontA: TLogFontA): TGPStatus; stdcall; external GdiPlusDll;
  5926.  
  5927. { GdipGetLogFontW(GpFont * font, GpGraphics *graphics, LOGFONTW * logfontW); }
  5928. function GdipGetLogFontW(Font: GpFont; Graphics: GpGraphics;
  5929. out LogfontW: TLogFontW): TGPStatus; stdcall; external GdiPlusDll;
  5930.  
  5931. { GdipNewInstalledFontCollection(GpFontCollection** fontCollection); }
  5932. function GdipNewInstalledFontCollection(out FontCollection: GpFontCollection): TGPStatus; stdcall;
  5933. external GdiPlusDll;
  5934.  
  5935. { GdipNewPrivateFontCollection(GpFontCollection** fontCollection); }
  5936. function GdipNewPrivateFontCollection(out FontCollection: GpFontCollection): TGPStatus; stdcall;
  5937. external GdiPlusDll;
  5938.  
  5939. { GdipDeletePrivateFontCollection(GpFontCollection** fontCollection); }
  5940. function GdipDeletePrivateFontCollection(out FontCollection: GpFontCollection): TGPStatus; stdcall;
  5941. external GdiPlusDll;
  5942.  
  5943. { GdipGetFontCollectionFamilyCount( GpFontCollection* fontCollection, INT * numFound ); }
  5944. function GdipGetFontCollectionFamilyCount(FontCollection: GpFontCollection;
  5945. out NumFound: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5946.  
  5947. { GdipGetFontCollectionFamilyList( GpFontCollection* fontCollection, INT numSought, GpFontFamily* gpfamilies[], INT* numFound ); }
  5948. function GdipGetFontCollectionFamilyList(FontCollection: GpFontCollection;
  5949. NumSought: Integer; Gpfamilies: PGpFontFamily; out NumFound: Integer): TGPStatus; stdcall;
  5950. external GdiPlusDll;
  5951.  
  5952. { GdipPrivateAddFontFile( GpFontCollection* fontCollection, GDIPCONST WCHAR* filename ); }
  5953. function GdipPrivateAddFontFile(FontCollection: GpFontCollection;
  5954. const Filename: PWideChar): TGPStatus; stdcall; external GdiPlusDll;
  5955.  
  5956. { GdipPrivateAddMemoryFont( GpFontCollection* fontCollection, GDIPCONST void* memory, INT length ); }
  5957. function GdipPrivateAddMemoryFont(FontCollection: GpFontCollection;
  5958. const Memory: Pointer; Length: Integer): TGPStatus; stdcall; external GdiPlusDll;
  5959.  
  5960. //----------------------------------------------------------------------------
  5961. // Text APIs
  5962. //----------------------------------------------------------------------------
  5963.  
  5964. { GdipDrawString( GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, GDIPCONST GpBrush *brush ); }
  5965. function GdipDrawString(Graphics: GpGraphics; const Str: PWideChar;
  5966. Length: Integer; const Font: GpFont; const LayoutRect: PGPRectF;
  5967. const StringFormat: GpStringFormat; const Brush: GpBrush): TGPStatus; stdcall;
  5968. external GdiPlusDll;
  5969.  
  5970. { GdipMeasureString( GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox, INT *codepointsFitted, INT *linesFilled ); }
  5971. function GdipMeasureString(Graphics: GpGraphics; const Str: PWideChar;
  5972. Length: Integer; const Font: GpFont; const LayoutRect: PGPRectF;
  5973. const StringFormat: GpStringFormat; out BoundingBox: TGPRectF;
  5974. CodepointsFitted: PInteger; LinesFilled: PInteger): TGPStatus; stdcall;
  5975. external GdiPlusDll;
  5976.  
  5977. { GdipMeasureCharacterRanges( GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF &layoutRect, GDIPCONST GpStringFormat *stringFormat, INT regionCount, GpRegion **regions ); }
  5978. function GdipMeasureCharacterRanges(Graphics: GpGraphics; const Str: PWideChar;
  5979. Length: Integer; const Font: GpFont; const LayoutRect: PGPRectF;
  5980. const StringFormat: GpStringFormat; RegionCount: Integer;
  5981. Regions: PGpRegion): TGPStatus; stdcall; external GdiPlusDll;
  5982.  
  5983. { GdipDrawDriverString( GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix ); }
  5984. function GdipDrawDriverString(Graphics: GpGraphics; const Text: PUInt16;
  5985. Length: Integer; const Font: GpFont; const Brush: GpBrush;
  5986. const Positions: PGPPointF; Flags: TGPDriverStringOptions; const Matrix: GpMatrix): TGPStatus; stdcall;
  5987. external GdiPlusDll;
  5988.  
  5989. { GdipMeasureDriverString( GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix, RectF *boundingBox ); }
  5990. function GdipMeasureDriverString(Graphics: GpGraphics; const Text: PUInt16;
  5991. Length: Integer; const Font: GpFont; const Positions: PGPPointF; Flags: TGPDriverStringOptions;
  5992. const Matrix: GpMatrix; out BoundingBox: TGPRectF): TGPStatus; stdcall; external GdiPlusDll;
  5993.  
  5994. //----------------------------------------------------------------------------
  5995. // String format APIs
  5996. //----------------------------------------------------------------------------
  5997.  
  5998. { GdipCreateStringFormat( INT formatAttributes, LANGID language, GpStringFormat **format ); }
  5999. function GdipCreateStringFormat(FormatAttributes: TGPStringFormatFlags; Language: LANGID;
  6000. out Format: GpStringFormat): TGPStatus; stdcall; external GdiPlusDll;
  6001.  
  6002. { GdipStringFormatGetGenericDefault(GpStringFormat **format); }
  6003. function GdipStringFormatGetGenericDefault(out Format: GpStringFormat): TGPStatus; stdcall;
  6004. external GdiPlusDll;
  6005.  
  6006. { GdipStringFormatGetGenericTypographic(GpStringFormat **format); }
  6007. function GdipStringFormatGetGenericTypographic(out Format: GpStringFormat): TGPStatus; stdcall;
  6008. external GdiPlusDll;
  6009.  
  6010. { GdipDeleteStringFormat(GpStringFormat *format); }
  6011. function GdipDeleteStringFormat(Format: GpStringFormat): TGPStatus; stdcall;
  6012. external GdiPlusDll;
  6013.  
  6014. { GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpStringFormat **newFormat); }
  6015. function GdipCloneStringFormat(const Format: GpStringFormat;
  6016. out NewFormat: GpStringFormat): TGPStatus; stdcall; external GdiPlusDll;
  6017.  
  6018. { GdipSetStringFormatFlags(GpStringFormat *format, INT flags); }
  6019. function GdipSetStringFormatFlags(Format: GpStringFormat; Flags: TGPStringFormatFlags): TGPStatus; stdcall;
  6020. external GdiPlusDll;
  6021.  
  6022. { GdipGetStringFormatFlags(GDIPCONST GpStringFormat *format, INT *flags); }
  6023. function GdipGetStringFormatFlags(const Format: GpStringFormat;
  6024. out Flags: TGPStringFormatFlags): TGPStatus; stdcall; external GdiPlusDll;
  6025.  
  6026. { GdipSetStringFormatAlign(GpStringFormat *format, StringAlignment align); }
  6027. function GdipSetStringFormatAlign(Format: GpStringFormat;
  6028. Align: TGPStringAlignment): TGPStatus; stdcall; external GdiPlusDll;
  6029.  
  6030. { GdipGetStringFormatAlign(GDIPCONST GpStringFormat *format, StringAlignment *align); }
  6031. function GdipGetStringFormatAlign(const Format: GpStringFormat;
  6032. out Align: TGPStringAlignment): TGPStatus; stdcall; external GdiPlusDll;
  6033.  
  6034. { GdipSetStringFormatLineAlign(GpStringFormat *format, StringAlignment align); }
  6035. function GdipSetStringFormatLineAlign(Format: GpStringFormat;
  6036. Align: TGPStringAlignment): TGPStatus; stdcall; external GdiPlusDll;
  6037.  
  6038. { GdipGetStringFormatLineAlign(GDIPCONST GpStringFormat *format, StringAlignment *align); }
  6039. function GdipGetStringFormatLineAlign(const Format: GpStringFormat;
  6040. out Align: TGPStringAlignment): TGPStatus; stdcall; external GdiPlusDll;
  6041.  
  6042. { GdipSetStringFormatTrimming( GpStringFormat *format, StringTrimming trimming ); }
  6043. function GdipSetStringFormatTrimming(Format: GpStringFormat;
  6044. Trimming: TGPStringTrimming): TGPStatus; stdcall; external GdiPlusDll;
  6045.  
  6046. { GdipGetStringFormatTrimming( GDIPCONST GpStringFormat *format, StringTrimming *trimming ); }
  6047. function GdipGetStringFormatTrimming(const Format: GpStringFormat;
  6048. out Trimming: TGPStringTrimming): TGPStatus; stdcall; external GdiPlusDll;
  6049.  
  6050. { GdipSetStringFormatHotkeyPrefix(GpStringFormat *format, INT hotkeyPrefix); }
  6051. function GdipSetStringFormatHotkeyPrefix(Format: GpStringFormat;
  6052. HotkeyPrefix: TGPHotkeyPrefix): TGPStatus; stdcall; external GdiPlusDll;
  6053.  
  6054. { GdipGetStringFormatHotkeyPrefix(GDIPCONST GpStringFormat *format, INT *hotkeyPrefix); }
  6055. function GdipGetStringFormatHotkeyPrefix(const Format: GpStringFormat;
  6056. out HotkeyPrefix: TGPHotkeyPrefix): TGPStatus; stdcall; external GdiPlusDll;
  6057.  
  6058. { GdipSetStringFormatTabStops(GpStringFormat *format, REAL firstTabOffset, INT count, GDIPCONST REAL *tabStops); }
  6059. function GdipSetStringFormatTabStops(Format: GpStringFormat;
  6060. FirstTabOffset: Single; Count: Integer; const TabStops: PSingle): TGPStatus; stdcall;
  6061. external GdiPlusDll;
  6062.  
  6063. { GdipGetStringFormatTabStops(GDIPCONST GpStringFormat *format, INT count, REAL *firstTabOffset, REAL *tabStops); }
  6064. function GdipGetStringFormatTabStops(const Format: GpStringFormat;
  6065. Count: Integer; out FirstTabOffset: Single; TabStops: PSingle): TGPStatus; stdcall;
  6066. external GdiPlusDll;
  6067.  
  6068. { GdipGetStringFormatTabStopCount(GDIPCONST GpStringFormat *format, INT * count); }
  6069. function GdipGetStringFormatTabStopCount(const Format: GpStringFormat;
  6070. out Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  6071.  
  6072. { GdipSetStringFormatDigitSubstitution(GpStringFormat *format, LANGID language, StringDigitSubstitute substitute); }
  6073. function GdipSetStringFormatDigitSubstitution(Format: GpStringFormat;
  6074. Language: LangID; Substitute: TGPStringDigitSubstitute): TGPStatus; stdcall;
  6075. external GdiPlusDll;
  6076.  
  6077. { GdipGetStringFormatDigitSubstitution(GDIPCONST GpStringFormat *format, LANGID *language, StringDigitSubstitute *substitute); }
  6078. function GdipGetStringFormatDigitSubstitution(const Format: GpStringFormat;
  6079. Language: PLangID; Substitute: PGPStringDigitSubstitute): TGPStatus; stdcall;
  6080. external GdiPlusDll;
  6081.  
  6082. { GdipGetStringFormatMeasurableCharacterRangeCount( GDIPCONST GpStringFormat *format, INT *count ); }
  6083. function GdipGetStringFormatMeasurableCharacterRangeCount(
  6084. const Format: GpStringFormat; out Count: Integer): TGPStatus; stdcall; external GdiPlusDll;
  6085.  
  6086. { GdipSetStringFormatMeasurableCharacterRanges( GpStringFormat *format, INT rangeCount, GDIPCONST CharacterRange *ranges ); }
  6087. function GdipSetStringFormatMeasurableCharacterRanges(Format: GpStringFormat;
  6088. RangeCount: Integer; const Ranges: PGPCharacterRange): TGPStatus; stdcall;
  6089. external GdiPlusDll;
  6090.  
  6091. //----------------------------------------------------------------------------
  6092. // Cached Bitmap APIs
  6093. //----------------------------------------------------------------------------
  6094.  
  6095. { GdipCreateCachedBitmap( GpBitmap *bitmap, GpGraphics *graphics, GpCachedBitmap **cachedBitmap ); }
  6096. function GdipCreateCachedBitmap(Bitmap: GpBitmap; Graphics: GpGraphics;
  6097. out CachedBitmap: GpCachedBitmap): TGPStatus; stdcall; external GdiPlusDll;
  6098.  
  6099. { GdipDeleteCachedBitmap(GpCachedBitmap *cachedBitmap); }
  6100. function GdipDeleteCachedBitmap(CachedBitmap: GpCachedBitmap): TGPStatus; stdcall;
  6101. external GdiPlusDll;
  6102.  
  6103. { GdipDrawCachedBitmap( GpGraphics *graphics, GpCachedBitmap *cachedBitmap, INT x, INT y ); }
  6104. function GdipDrawCachedBitmap(Graphics: GpGraphics;
  6105. CachedBitmap: GpCachedBitmap; X: Integer; Y: Integer): TGPStatus; stdcall;
  6106. external GdiPlusDll;
  6107.  
  6108. function GdipEmfToWmfBits(HEmf: HEnhMetaFile; cbData16: UINT; pData16: PByte;
  6109. MapMode: Integer; Flags: TGPEmfToWmfBitsFlags): UINT; stdcall; external GdiPlusDll;
  6110.  
  6111. { GdipSetImageAttributesCachedBackground( GpImageAttributes *imageattr, BOOL enableFlag ); }
  6112. function GdipSetImageAttributesCachedBackground(Imageattr: GpImageAttributes;
  6113. EnableFlag: Bool): TGPStatus; stdcall; external GdiPlusDll;
  6114.  
  6115. { GdipTestControl( GpTestControlEnum control, void * param ); }
  6116. function GdipTestControl(Control: TGPTestControlEnum; Param: Pointer): TGPStatus; stdcall;
  6117. external GdiPlusDll;
  6118.  
  6119. function GdiplusNotificationHook(out Token: ULONG): TGPStatus; stdcall; external GdiPlusDll;
  6120.  
  6121. procedure GdiplusNotificationUnhook(Token: ULONG); stdcall; external GdiPlusDll;
  6122.  
  6123. {$IF (GDIPVER >= $0110)}
  6124. { GdipConvertToEmfPlus( const GpGraphics* refGraphics, GpMetafile* metafile, INT* conversionFailureFlag, EmfType emfType, const WCHAR* description, GpMetafile** out_metafile ); }
  6125. function GdipConvertToEmfPlus(const RefGraphics: GpGraphics;
  6126. Metafile: GpMetafile; ConversionFailureFlag: PInteger; EmfType: TGPEmfType;
  6127. const Description: PWideChar; out Out_metafile: GpMetafile): TGPStatus; stdcall;
  6128. external GdiPlusDll;
  6129.  
  6130. { GdipConvertToEmfPlusToFile( const GpGraphics* refGraphics, GpMetafile* metafile, INT* conversionFailureFlag, const WCHAR* filename, EmfType emfType, const WCHAR* description, GpMetafile** out_metafile ); }
  6131. function GdipConvertToEmfPlusToFile(const RefGraphics: GpGraphics;
  6132. Metafile: GpMetafile; ConversionFailureFlag: PInteger;
  6133. const Filename: PWideChar; EmfType: TGPEmfType; const Description: PWideChar;
  6134. out Out_metafile: GpMetafile): TGPStatus; stdcall; external GdiPlusDll;
  6135.  
  6136. { GdipConvertToEmfPlusToStream( const GpGraphics* refGraphics, GpMetafile* metafile, INT* conversionFailureFlag, IStream* stream, EmfType emfType, const WCHAR* description, GpMetafile** out_metafile ); }
  6137. function GdipConvertToEmfPlusToStream(const RefGraphics: GpGraphics;
  6138. Metafile: GpMetafile; ConversionFailureFlag: PInteger; const Stream: IStream;
  6139. EmfType: TGPEmfType; const Description: PWideChar; out Out_metafile: GpMetafile): TGPStatus; stdcall;
  6140. external GdiPlusDll;
  6141. {$IFEND}
  6142. {$ENDREGION 'GdiplusFlat.h'}
  6143.  
  6144. {$REGION 'GdiplusGpStubs.h (2)'}
  6145. (*****************************************************************************
  6146. * GdiplusGpStubs.h
  6147. * Private GDI+ header file.
  6148. *****************************************************************************)
  6149.  
  6150.  
  6151. //---------------------------------------------------------------------------
  6152. // GDI+ classes for forward reference
  6153. //---------------------------------------------------------------------------
  6154.  
  6155. type
  6156. IGPGraphics = interface;
  6157. IGPPen = interface;
  6158. IGPBrush = interface;
  6159. IGPMatrix = interface;
  6160. IGPBitmap = interface;
  6161. IGPMetafile = interface;
  6162. IGPGraphicsPath = interface;
  6163. IGPGraphicsPathIterator = interface;
  6164. IGPRegion = interface;
  6165. IGPImage = interface;
  6166. IGPTextureBrush = interface;
  6167. IGPHatchBrush = interface;
  6168. IGPSolidBrush = interface;
  6169. IGPLinearGradientBrush = interface;
  6170. IGPPathGradientBrush = interface;
  6171. IGPFont = interface;
  6172. IGPFontFamily = interface;
  6173. IGPFontCollection = interface;
  6174. IGPInstalledFontCollection = interface;
  6175. IGPPrivateFontCollection = interface;
  6176. IGPImageAttributes = interface;
  6177. IGPCachedBitmap = interface;
  6178. {$ENDREGION 'GdiplusGpStubs.h (2)'}
  6179.  
  6180. {$REGION 'GdiplusRegion.h'}
  6181. (*****************************************************************************
  6182. * GdiplusRegion.h
  6183. * GDI+ Region class implementation
  6184. *****************************************************************************)
  6185.  
  6186. IGPRegionData = IGPBuffer;
  6187. IGPRegionScansF = IGPArray<TGPRectF>;
  6188. IGPRegionScans = IGPArray<TGPRect>;
  6189.  
  6190. IGPRegion = interface(IGdiPlusBase)
  6191. ['{BA76B8F7-FEF0-41AA-9E96-59946D279F4D}']
  6192. { Methods }
  6193. function Clone: IGPRegion;
  6194. procedure MakeInfinite;
  6195. procedure MakeEmpty;
  6196. function GetData: IGPRegionData;
  6197. procedure Intersect(const Rect: TGPRect); overload;
  6198. procedure Intersect(const Rect: TGPRectF); overload;
  6199. procedure Intersect(const Path: IGPGraphicsPath); overload;
  6200. procedure Intersect(const Region: IGPRegion); overload;
  6201. procedure Union(const Rect: TGPRect); overload;
  6202. procedure Union(const Rect: TGPRectF); overload;
  6203. procedure Union(const Path: IGPGraphicsPath); overload;
  6204. procedure Union(const Region: IGPRegion); overload;
  6205. procedure ExclusiveOr(const Rect: TGPRect); overload;
  6206. procedure ExclusiveOr(const Rect: TGPRectF); overload;
  6207. procedure ExclusiveOr(const Path: IGPGraphicsPath); overload;
  6208. procedure ExclusiveOr(const Region: IGPRegion); overload;
  6209. procedure Exclude(const Rect: TGPRect); overload;
  6210. procedure Exclude(const Rect: TGPRectF); overload;
  6211. procedure Exclude(const Path: IGPGraphicsPath); overload;
  6212. procedure Exclude(const Region: IGPRegion); overload;
  6213. procedure Complement(const Rect: TGPRect); overload;
  6214. procedure Complement(const Rect: TGPRectF); overload;
  6215. procedure Complement(const Path: IGPGraphicsPath); overload;
  6216. procedure Complement(const Region: IGPRegion); overload;
  6217. procedure Translate(const DX, DY: Single); overload;
  6218. procedure Translate(const DX, DY: Integer); overload;
  6219. procedure Transform(const Matrix: IGPMatrix);
  6220. procedure GetBounds(out Rect: TGPRect; const G: IGPGraphics); overload;
  6221. procedure GetBounds(out Rect: TGPRectF; const G: IGPGraphics); overload;
  6222. function GetHRGN(const G: IGPGraphics): HRGN;
  6223. function IsEmpty(const G: IGPGraphics): Boolean;
  6224. function IsInfinite(const G: IGPGraphics): Boolean;
  6225. function IsVisible(const X, Y: Integer; const G: IGPGraphics = nil): Boolean; overload;
  6226. function IsVisible(const Point: TGPPoint; const G: IGPGraphics = nil): Boolean; overload;
  6227. function IsVisible(const X, Y: Single; const G: IGPGraphics = nil): Boolean; overload;
  6228. function IsVisible(const Point: TGPPointF; const G: IGPGraphics = nil): Boolean; overload;
  6229. function IsVisible(const X, Y, Width, Height: Integer; const G: IGPGraphics = nil): Boolean; overload;
  6230. function IsVisible(const Rect: TGPRect; const G: IGPGraphics = nil): Boolean; overload;
  6231. function IsVisible(const X, Y, Width, Height: Single; const G: IGPGraphics = nil): Boolean; overload;
  6232. function IsVisible(const Rect: TGPRectF; const G: IGPGraphics = nil): Boolean; overload;
  6233. function Equals(const Region: IGPRegion; const G: IGPGraphics): Boolean;
  6234. function GetRegionScans(const Matrix: IGPMatrix): IGPRegionScansF;
  6235. function GetRegionScansI(const Matrix: IGPMatrix): IGPRegionScans;
  6236. end;
  6237.  
  6238. TGPRegion = class(TGdiplusBase, IGPRegion)
  6239. private
  6240. { IGPRegion }
  6241. function Clone: IGPRegion;
  6242. procedure MakeInfinite;
  6243. procedure MakeEmpty;
  6244. function GetData: IGPRegionData;
  6245. procedure Intersect(const Rect: TGPRect); overload;
  6246. procedure Intersect(const Rect: TGPRectF); overload;
  6247. procedure Intersect(const Path: IGPGraphicsPath); overload;
  6248. procedure Intersect(const Region: IGPRegion); overload;
  6249. procedure Union(const Rect: TGPRect); overload;
  6250. procedure Union(const Rect: TGPRectF); overload;
  6251. procedure Union(const Path: IGPGraphicsPath); overload;
  6252. procedure Union(const Region: IGPRegion); overload;
  6253. procedure ExclusiveOr(const Rect: TGPRect); overload;
  6254. procedure ExclusiveOr(const Rect: TGPRectF); overload;
  6255. procedure ExclusiveOr(const Path: IGPGraphicsPath); overload;
  6256. procedure ExclusiveOr(const Region: IGPRegion); overload;
  6257. procedure Exclude(const Rect: TGPRect); overload;
  6258. procedure Exclude(const Rect: TGPRectF); overload;
  6259. procedure Exclude(const Path: IGPGraphicsPath); overload;
  6260. procedure Exclude(const Region: IGPRegion); overload;
  6261. procedure Complement(const Rect: TGPRect); overload;
  6262. procedure Complement(const Rect: TGPRectF); overload;
  6263. procedure Complement(const Path: IGPGraphicsPath); overload;
  6264. procedure Complement(const Region: IGPRegion); overload;
  6265. procedure Translate(const DX, DY: Single); overload;
  6266. procedure Translate(const DX, DY: Integer); overload;
  6267. procedure Transform(const Matrix: IGPMatrix);
  6268. procedure GetBounds(out Rect: TGPRect; const G: IGPGraphics); overload;
  6269. procedure GetBounds(out Rect: TGPRectF; const G: IGPGraphics); overload;
  6270. function GetHRGN(const G: IGPGraphics): HRGN;
  6271. function IsEmpty(const G: IGPGraphics): Boolean;
  6272. function IsInfinite(const G: IGPGraphics): Boolean;
  6273. function IsVisible(const X, Y: Integer; const G: IGPGraphics = nil): Boolean; overload;
  6274. function IsVisible(const Point: TGPPoint; const G: IGPGraphics = nil): Boolean; overload;
  6275. function IsVisible(const X, Y: Single; const G: IGPGraphics = nil): Boolean; overload;
  6276. function IsVisible(const Point: TGPPointF; const G: IGPGraphics = nil): Boolean; overload;
  6277. function IsVisible(const X, Y, Width, Height: Integer; const G: IGPGraphics = nil): Boolean; overload;
  6278. function IsVisible(const Rect: TGPRect; const G: IGPGraphics = nil): Boolean; overload;
  6279. function IsVisible(const X, Y, Width, Height: Single; const G: IGPGraphics = nil): Boolean; overload;
  6280. function IsVisible(const Rect: TGPRectF; const G: IGPGraphics = nil): Boolean; overload;
  6281. function Equals(const Region: IGPRegion; const G: IGPGraphics): Boolean; reintroduce;
  6282. function GetRegionScans(const Matrix: IGPMatrix): IGPRegionScansF;
  6283. function GetRegionScansI(const Matrix: IGPMatrix): IGPRegionScans;
  6284. private
  6285. constructor Create(const NativeRegion: GpRegion); overload;
  6286. public
  6287. constructor Create; overload;
  6288. constructor Create(const Rect: TGPRectF); overload;
  6289. constructor Create(const Rect: TGPRect); overload;
  6290. constructor Create(const Path: IGPGraphicsPath); overload;
  6291. constructor Create(const RegionData: PByte; const Size: Integer); overload;
  6292. constructor Create(const HRgn: HRGN); overload;
  6293. destructor Destroy; override;
  6294.  
  6295. class function FromHRGN(const HRgn: HRGN): IGPRegion; static;
  6296. end;
  6297. {$ENDREGION 'GdiplusRegion.h'}
  6298.  
  6299. {$REGION 'GdiplusFontFamily.h'}
  6300. (*****************************************************************************
  6301. * GdiplusFontFamily.h
  6302. * GDI+ Font Family class
  6303. *****************************************************************************)
  6304.  
  6305. IGPFontFamily = interface(IGdiPlusBase)
  6306. ['{FC545EB0-E826-476E-9435-8ADAE2D191B4}']
  6307. { Property access method }
  6308. function GetFamilyNameInternal: String;
  6309.  
  6310. { Methods }
  6311. function GetFamilyName(const Language: LangID = 0): String;
  6312. function Clone: IGPFontFamily;
  6313. function IsAvailable: Boolean;
  6314. function IsStyleAvailable(const Style: TGPFontStyle): Boolean;
  6315. function GetEmHeight(const Style: TGPFontStyle): Word;
  6316. function GetCellAscent(const Style: TGPFontStyle): Word;
  6317. function GetCellDescent(const Style: TGPFontStyle): Word;
  6318. function GetLineSpacing(const Style: TGPFontStyle): Word;
  6319.  
  6320. { Properties }
  6321. property FamilyName: String read GetFamilyNameInternal;
  6322. end;
  6323.  
  6324. TGPFontFamily = class(TGdiplusBase, IGPFontFamily)
  6325. private
  6326. class var FGenericSansSerifFontFamily: IGPFontFamily;
  6327. class var FGenericSerifFontFamily: IGPFontFamily;
  6328. class var FGenericMonoSpaceFontFamily: IGPFontFamily;
  6329. private
  6330. { IGPFontFamily }
  6331. function GetFamilyNameInternal: String;
  6332. function GetFamilyName(const Language: LangID = 0): String;
  6333. function Clone: IGPFontFamily;
  6334. function IsAvailable: Boolean;
  6335. function IsStyleAvailable(const Style: TGPFontStyle): Boolean;
  6336. function GetEmHeight(const Style: TGPFontStyle): Word;
  6337. function GetCellAscent(const Style: TGPFontStyle): Word;
  6338. function GetCellDescent(const Style: TGPFontStyle): Word;
  6339. function GetLineSpacing(const Style: TGPFontStyle): Word;
  6340. private
  6341. constructor Create(const NativeFamily: GpFontFamily); overload;
  6342. public
  6343. constructor Create; overload;
  6344. constructor Create(const Name: String;
  6345. const FontCollection: IGPFontCollection = nil); overload;
  6346. destructor Destroy; override;
  6347.  
  6348. class function GenericSansSerif: IGPFontFamily; static;
  6349. class function GenericSerif: IGPFontFamily; static;
  6350. class function GenericMonospace: IGPFontFamily; static;
  6351. end;
  6352.  
  6353. {$ENDREGION 'GdiplusFontFamily.h'}
  6354.  
  6355. {$REGION 'GdiplusFont.h'}
  6356. (*****************************************************************************
  6357. * GdiplusFont.h
  6358. * GDI+ Font class
  6359. *****************************************************************************)
  6360.  
  6361. IGPFont = interface(IGdiPlusBase)
  6362. ['{63A81FE2-D0BC-4031-9DD8-0254A1CC732D}']
  6363. { Property access methods }
  6364. function GetStyle: TGPFontStyle;
  6365. function GetSize: Single;
  6366. function GetUnit: TGPUnit;
  6367. function GetFamily: IGPFontFamily;
  6368.  
  6369. { Methods }
  6370. function Clone: IGPFont;
  6371. function GetLogFontA(const G: IGPGraphics): TLogFontA;
  6372. function GetLogFontW(const G: IGPGraphics): TLogFontW;
  6373. function IsAvailable: Boolean;
  6374. function GetHeight(const Graphics: IGPGraphics): Single; overload;
  6375. function GetHeight(const Dpi: Single): Single; overload;
  6376.  
  6377. { Properties }
  6378. property Style: TGPFontStyle read GetStyle;
  6379. property Size: Single read GetSize;
  6380. property MeasureUnit: TGPUnit read GetUnit;
  6381. property Family: IGPFontFamily read GetFamily;
  6382. end;
  6383.  
  6384. TGPFont = class(TGdiPlusBase, IGPFont)
  6385. private
  6386. { IGPFont }
  6387. function GetStyle: TGPFontStyle;
  6388. function GetSize: Single;
  6389. function GetUnit: TGPUnit;
  6390. function Clone: IGPFont;
  6391. function GetLogFontA(const G: IGPGraphics): TLogFontA;
  6392. function GetLogFontW(const G: IGPGraphics): TLogFontW;
  6393. function IsAvailable: Boolean;
  6394. function GetHeight(const Graphics: IGPGraphics): Single; overload;
  6395. function GetHeight(const Dpi: Single): Single; overload;
  6396. function GetFamily: IGPFontFamily;
  6397. private
  6398. constructor Create(const NativeFont: GpFont); overload;
  6399. public
  6400. constructor Create(const DC: HDC); overload;
  6401. constructor Create(const DC: HDC; const LogFont: TLogFontA); overload;
  6402. constructor Create(const DC: HDC; const LogFont: TLogFontW); overload;
  6403. constructor Create(const DC: HDC; const FontHandle: HFont); overload;
  6404. constructor Create(const Family: IGPFontFamily; const EmSize: Single;
  6405. const Style: TGPFontStyle = FontStyleRegular;
  6406. const MeasureUnit: TGPUnit = UnitPoint); overload;
  6407. constructor Create(const FamilyName: String; const EmSize: Single;
  6408. const Style: TGPFontStyle = FontStyleRegular;
  6409. const MeasureUnit: TGPUnit = UnitPoint;
  6410. const FontCollection: IGPFontCollection = nil); overload;
  6411. destructor Destroy; override;
  6412. end;
  6413.  
  6414. {$ENDREGION 'GdiplusFont.h'}
  6415.  
  6416. {$REGION 'GdiplusFontCollection.h'}
  6417. (*****************************************************************************
  6418. * GdiplusFontCollection.h
  6419. * Font collections (Installed and Private)
  6420. *****************************************************************************)
  6421.  
  6422. IGPFontFamilies = IGPArray<IGPFontFamily>;
  6423.  
  6424. IGPFontCollection = interface(IGdiPlusBase)
  6425. ['{5040653F-C5E1-4CA1-9623-6CD258F6DD6C}']
  6426. { Property access methods }
  6427. function GetFamilies: IGPFontFamilies;
  6428.  
  6429. { Properties }
  6430. property Families: IGPFontFamilies read GetFamilies;
  6431. end;
  6432.  
  6433. TGPFontCollection = class(TGdiPlusBase, IGPFontCollection)
  6434. private
  6435. { IGPFontCollection }
  6436. function GetFamilies: IGPFontFamilies;
  6437. public
  6438. constructor Create;
  6439. end;
  6440.  
  6441. IGPInstalledFontCollection = interface(IGPFontCollection)
  6442. ['{168514BC-DC7E-40BC-808D-B2E949AE9F4F}']
  6443. end;
  6444.  
  6445. TGPInstalledFontCollection = class(TGPFontCollection, IGPInstalledFontCollection)
  6446. public
  6447. constructor Create;
  6448. end;
  6449.  
  6450. IGPPrivateFontCollection = interface(IGPFontCollection)
  6451. ['{75E3CC1B-16E4-4203-9796-05B47EB5F076}']
  6452. { Methods }
  6453. procedure AddFontFile(const Filename: String);
  6454. procedure AddMemoryFont(const Memory: Pointer; const Length: Integer);
  6455. end;
  6456.  
  6457. TGPPrivateFontCollection = class(TGPFontCollection, IGPPrivateFontCollection)
  6458. private
  6459. { IGPPrivateFontCollection }
  6460. procedure AddFontFile(const Filename: String);
  6461. procedure AddMemoryFont(const Memory: Pointer; const Length: Integer);
  6462. public
  6463. constructor Create;
  6464. destructor Destroy; override;
  6465. end;
  6466.  
  6467. {$ENDREGION 'GdiplusFontCollection.h'}
  6468.  
  6469. {$REGION 'GdiplusBitmap.h'}
  6470. (*****************************************************************************
  6471. * GdiplusBitmap.h
  6472. * GDI+ Bitmap class
  6473. *****************************************************************************)
  6474.  
  6475. IGPImageFormat = interface
  6476. ['{EDAB4D5F-527C-47D6-B53E-38DB9496725D}']
  6477. { Property access method }
  6478. function GetGuid: TGUID;
  6479. function GetCodecId: TGUID;
  6480.  
  6481. { Properties }
  6482. property Guid: TGUID read GetGUID;
  6483. property CodecId: TGUID read GetCodecId;
  6484. end;
  6485.  
  6486. TGPImageFormat = class(TInterfacedObject, IGPImageFormat)
  6487. private
  6488. FGuid: TGUID;
  6489. FCodecId: TGUID;
  6490. class var FInitialized: Boolean;
  6491. class var FBmp: IGPImageFormat;
  6492. class var FJpeg: IGPImageFormat;
  6493. class var FGif: IGPImageFormat;
  6494. class var FTiff: IGPImageFormat;
  6495. class var FPng: IGPImageFormat;
  6496. class function GetBmp: IGPImageFormat; static;
  6497. class function GetJpeg: IGPImageFormat; static;
  6498. class function GetGif: IGPImageFormat; static;
  6499. class function GetTiff: IGPImageFormat; static;
  6500. class function GetPng: IGPImageFormat; static;
  6501. class procedure InitializeCodecs; static;
  6502. private
  6503. { IGPImageFormat }
  6504. function GetGuid: TGuid;
  6505. function GetCodecId: TGUID;
  6506. public
  6507. constructor Create(const Guid: TGUID); overload;
  6508. constructor Create(const Guid, CodecId: TGUID); overload;
  6509. class function FindByFormatId(const lFormatId: TGUID): IGPImageFormat; static;
  6510.  
  6511. class property Bmp: IGPImageFormat read GetBmp;
  6512. class property Jpeg: IGPImageFormat read GetJpeg;
  6513. class property Gif: IGPImageFormat read GetGif;
  6514. class property Tiff: IGPImageFormat read GetTiff;
  6515. class property Png: IGPImageFormat read GetPng;
  6516. end;
  6517.  
  6518. IGPImageCodecInfo = interface
  6519. ['{4AAE3ECA-3AEA-4C20-8D17-865F07393536}']
  6520. { Property access methods }
  6521. function GetClsId: TGUID;
  6522. function GetCodecName: String;
  6523. function GetDllName: String;
  6524. function GetFilenameExtension: String;
  6525. function GetFlags: TGPImageCodecFlags;
  6526. function GetFormatDescription: String;
  6527. function GetFormatId: TGUID;
  6528. function GetMimeType: String;
  6529. function GetVersion: Integer;
  6530.  
  6531. { Properties }
  6532. property ClsId: TGUID read GetClsId;
  6533. property CodecName: String read GetCodecName;
  6534. property DllName: String read GetDllName;
  6535. property FilenameExtension: String read GetFilenameExtension;
  6536. property Flags: TGPImageCodecFlags read GetFlags;
  6537. property FormatDescription: String read GetFormatDescription;
  6538. property FormatId: TGUID read GetFormatId;
  6539. property MimeType: String read GetMimeType;
  6540. property Version: Integer read GetVersion;
  6541. end;
  6542.  
  6543. IGPImageCodecInfoArray = IGPArray<IGPImageCodecInfo>;
  6544.  
  6545. TGPImageCodecInfo = class(TInterfacedObject, IGPImageCodecInfo)
  6546. private
  6547. FInfo: TGPNativeImageCodecInfo;
  6548. private
  6549. { IGPImageCodecInfo }
  6550. function GetClsId: TGUID;
  6551. function GetCodecName: String;
  6552. function GetDllName: String;
  6553. function GetFilenameExtension: String;
  6554. function GetFlags: TGPImageCodecFlags;
  6555. function GetFormatDescription: String;
  6556. function GetFormatId: TGUID;
  6557. function GetMimeType: String;
  6558. function GetVersion: Integer;
  6559. public
  6560. constructor Create(const Info: TGPNativeImageCodecInfo);
  6561. class function GetImageDecoders: IGPImageCodecInfoArray; static;
  6562. class function GetImageEncoders: IGPImageCodecInfoArray; static;
  6563. end;
  6564.  
  6565. IGPEncoderParameters = interface;
  6566.  
  6567. TGPEncoderParameterEnumerator = class
  6568. private
  6569. FIndex: Integer;
  6570. FParams: IGPEncoderParameters;
  6571. public
  6572. constructor Create(const AParams: IGPEncoderParameters);
  6573. function GetCurrent: PGPNativeEncoderParameter;
  6574. function MoveNext: Boolean;
  6575. property Current: PGPNativeEncoderParameter read GetCurrent;
  6576. end;
  6577.  
  6578. IGPEncoderParameters = interface
  6579. ['{284A0A77-1831-483A-AF75-903FCFB50A56}']
  6580. { Property access methods }
  6581. function GetCount: Integer;
  6582. function GetParam(const Index: Integer): PGPNativeEncoderParameter;
  6583. function GetNativeParams: PGPNativeEncoderParameters;
  6584.  
  6585. { Methods }
  6586. function GetEnumerator: TGPEncoderParameterEnumerator;
  6587. procedure Clear;
  6588. procedure Add(const ParamType: TGUID; const Value: TGPEncoderValue); overload;
  6589. procedure Add(const ParamType: TGUID; const Value: array of TGPEncoderValue); overload;
  6590. procedure Add(const ParamType: TGUID; var Value: Byte); overload;
  6591. procedure Add(const ParamType: TGUID; const Value: array of Byte); overload;
  6592. procedure Add(const ParamType: TGUID; var Value: Int16); overload;
  6593. procedure Add(const ParamType: TGUID; const Value: array of Int16); overload;
  6594. procedure Add(const ParamType: TGUID; var Value: Int32); overload;
  6595. procedure Add(const ParamType: TGUID; const Value: array of Int32); overload;
  6596. procedure Add(const ParamType: TGUID; var Value: Int64); overload;
  6597. procedure Add(const ParamType: TGUID; const Value: array of Int64); overload;
  6598. procedure Add(const ParamType: TGUID; const Value: String); overload;
  6599. procedure Add(const ParamType: TGUID; const Value: Byte;
  6600. const Undefined: Boolean); overload;
  6601. procedure Add(const ParamType: TGUID; const Value: array of Byte;
  6602. const Undefined: Boolean); overload;
  6603. procedure Add(const ParamType: TGUID; var Numerator, Denominator: Int32); overload;
  6604. procedure Add(const ParamType: TGUID; const Numerators,
  6605. Denominators: array of Int32); overload;
  6606. procedure Add(const ParamType: TGUID; var RangeBegin, RangeEnd: Int64); overload;
  6607. procedure Add(const ParamType: TGUID; const RangesBegin,
  6608. RangesEnd: array of Int64); overload;
  6609. procedure Add(const ParamType: TGUID; const NumberOfValues: Integer;
  6610. const ValueType: TGPEncoderParameterValueType; const Value: Pointer); overload;
  6611. procedure Add(const ParamType: TGUID; const Numerator1, Denominator1,
  6612. Numerator2, Denominator2: Int32); overload;
  6613. procedure Add(const ParamType: TGUID; const Numerator1, Denominator1,
  6614. Numerator2, Denominator2: array of Int32); overload;
  6615.  
  6616. { Properties }
  6617. property Count: Integer read GetCount;
  6618. property Param[const Index: Integer]: PGPNativeEncoderParameter read GetParam; default;
  6619. property NativeParams: PGPNativeEncoderParameters read GetNativeParams;
  6620. end;
  6621.  
  6622. TGPEncoderParameters = class(TInterfacedObject, IGPEncoderParameters)
  6623. private
  6624. FParams: array of TGPNativeEncoderParameter;
  6625. FParamCount: Integer;
  6626. FValues: Pointer;
  6627. FValueSize: Integer;
  6628. FValueAllocated: Integer;
  6629. FNativeParams: PGPNativeEncoderParameters;
  6630. FModified: Boolean;
  6631. private
  6632. { IGPEncoderParameters }
  6633. function GetNativeParams: PGPNativeEncoderParameters;
  6634. function GetEnumerator: TGPEncoderParameterEnumerator;
  6635. function GetCount: Integer;
  6636. function GetParam(const Index: Integer): PGPNativeEncoderParameter;
  6637. procedure Clear;
  6638. procedure Add(const ParamType: TGUID; const Value: TGPEncoderValue); overload;
  6639. procedure Add(const ParamType: TGUID; const Value: array of TGPEncoderValue); overload;
  6640. procedure Add(const ParamType: TGUID; var Value: Byte); overload;
  6641. procedure Add(const ParamType: TGUID; const Value: array of Byte); overload;
  6642. procedure Add(const ParamType: TGUID; var Value: Int16); overload;
  6643. procedure Add(const ParamType: TGUID; const Value: array of Int16); overload;
  6644. procedure Add(const ParamType: TGUID; var Value: Int32); overload;
  6645. procedure Add(const ParamType: TGUID; const Value: array of Int32); overload;
  6646. procedure Add(const ParamType: TGUID; var Value: Int64); overload;
  6647. procedure Add(const ParamType: TGUID; const Value: array of Int64); overload;
  6648. procedure Add(const ParamType: TGUID; const Value: String); overload;
  6649. procedure Add(const ParamType: TGUID; const Value: Byte;
  6650. const Undefined: Boolean); overload;
  6651. procedure Add(const ParamType: TGUID; const Value: array of Byte;
  6652. const Undefined: Boolean); overload;
  6653. procedure Add(const ParamType: TGUID; var Numerator, Denominator: Int32); overload;
  6654. procedure Add(const ParamType: TGUID; const Numerators,
  6655. Denominators: array of Int32); overload;
  6656. procedure Add(const ParamType: TGUID; var RangeBegin, RangeEnd: Int64); overload;
  6657. procedure Add(const ParamType: TGUID; const RangesBegin,
  6658. RangesEnd: array of Int64); overload;
  6659. procedure Add(const ParamType: TGUID; const NumberOfValues: Integer;
  6660. const ValueType: TGPEncoderParameterValueType; const Value: Pointer); overload;
  6661. procedure Add(const ParamType: TGUID; const Numerator1, Denominator1,
  6662. Numerator2, Denominator2: Int32); overload;
  6663. procedure Add(const ParamType: TGUID; const Numerator1, Denominator1,
  6664. Numerator2, Denominator2: array of Int32); overload;
  6665. private
  6666. constructor Create(const Params: PGPNativeEncoderParameters); overload;
  6667. public
  6668. constructor Create; overload;
  6669. destructor Destroy; override;
  6670. end;
  6671.  
  6672. IGPColorPalette = interface
  6673. ['{17D63D7E-20F6-445F-AEFC-3D53FC8D01CE}']
  6674. { Property access methods }
  6675. function GetFlags: TGPPaletteFlags;
  6676. procedure SetFlags(const Value: TGPPaletteFlags);
  6677. function GetCount: Integer;
  6678. function GetEntry(const Index: Integer): ARGB;
  6679. procedure SetEntry(const Index: Integer; const Value: ARGB);
  6680. function GetEntryPtr: PARGB;
  6681. function GetNativePalette: PGPNativeColorPalette;
  6682.  
  6683. { Properties }
  6684. property Flags: TGPPaletteFlags read GetFlags write SetFlags;
  6685. property Count: Integer read GetCount;
  6686. property Entries[const Index: Integer]: ARGB read GetEntry write SetEntry; default;
  6687. property EntryPtr: PARGB read GetEntryPtr;
  6688. property NativePalette: PGPNativeColorPalette read GetNativePalette;
  6689. end;
  6690.  
  6691. TGPColorPalette = class(TInterfacedObject, IGPColorPalette)
  6692. private
  6693. FData: PGPNativeColorPalette;
  6694. FEntries: PARGB;
  6695. private
  6696. { IGPColorPalette }
  6697. function GetFlags: TGPPaletteFlags;
  6698. procedure SetFlags(const Value: TGPPaletteFlags);
  6699. function GetCount: Integer;
  6700. function GetEntry(const Index: Integer): ARGB;
  6701. procedure SetEntry(const Index: Integer; const Value: ARGB);
  6702. function GetEntryPtr: PARGB;
  6703. function GetNativePalette: PGPNativeColorPalette;
  6704. private
  6705. constructor Create(const NativePalette: PGPNativeColorPalette); overload;
  6706. public
  6707. constructor Create(const Count: Integer); overload;
  6708. destructor Destroy; override;
  6709. end;
  6710.  
  6711. IGPPropertyItem = interface
  6712. ['{8886FE82-91E0-4069-B7BA-EA4A99E28AB4}']
  6713. { Property access methods }
  6714. function GetId: TPropID;
  6715. procedure SetId(const Value: TPropID);
  6716. function GetLength: Cardinal;
  6717. procedure SetLength(const Value: Cardinal);
  6718. function GetValueType: Word;
  6719. procedure SetValueType(const Value: Word);
  6720. function GetValue: Pointer;
  6721. procedure SetValue(const Value: Pointer);
  6722. function GetNativeItem: PGPNativePropertyItem;
  6723.  
  6724. { Properties }
  6725. property Id: TPropID read GetId write SetId;
  6726. property Length: Cardinal read GetLength write SetLength;
  6727. property ValueType: Word read GetValueType write SetValueType;
  6728. property Value: Pointer read GetValue write SetValue;
  6729. property NativeItem: PGPNativePropertyItem read GetNativeItem;
  6730. end;
  6731.  
  6732. TGPPropertyItem = class(TInterfacedObject, IGPPropertyItem)
  6733. private
  6734. FData: PGPNativePropertyItem;
  6735. private
  6736. { IGPPropertyItem }
  6737. function GetId: TPropID;
  6738. procedure SetId(const Value: TPropID);
  6739. function GetLength: Cardinal;
  6740. procedure SetLength(const Value: Cardinal);
  6741. function GetValueType: Word;
  6742. procedure SetValueType(const Value: Word);
  6743. function GetValue: Pointer;
  6744. procedure SetValue(const Value: Pointer);
  6745. function GetNativeItem: PGPNativePropertyItem;
  6746. private
  6747. constructor Create(const Data: PGPNativePropertyItem); overload;
  6748. public
  6749. constructor Create; overload;
  6750. destructor Destroy; override;
  6751. end;
  6752.  
  6753. IGPFrameDimensions = IGPArray<TGUID>;
  6754. IGPPropertyIdList = IGPArray<TPropID>;
  6755. IGPPropertyItems = IGPArray<IGPPropertyItem>;
  6756.  
  6757. IGPImage = interface(IGdiPlusBase)
  6758. ['{9E494AC2-7002-41CD-9776-CA6B5A4E8426}']
  6759. { Property access methods }
  6760. function GetType: TGPImageType;
  6761. function GetWidth: Cardinal;
  6762. function GetHeight: Cardinal;
  6763. function GetHorizontalResolution: Single;
  6764. function GetVerticalResolution: Single;
  6765. function GetFlags: TGPImageFlags;
  6766. function GetRawFormat: TGUID;
  6767. function GetPixelFormat: TGPPixelFormat;
  6768. function GetPalette: IGPColorPalette;
  6769. procedure SetPalette(const Value: IGPColorPalette);
  6770. function GetPropertyIdList: IGPPropertyIdList;
  6771. function GetPropertyItems: IGPPropertyItems;
  6772.  
  6773. { Methods }
  6774. function Clone: IGPImage;
  6775. procedure Save(const Filename: String; const Format: IGPImageFormat;
  6776. const Params: IGPEncoderParameters = nil); overload;
  6777. procedure Save(const Filename: String; const Encoder: IGPImageCodecInfo;
  6778. const Params: IGPEncoderParameters = nil); overload;
  6779. procedure Save(const Stream: IStream; const Format: IGPImageFormat;
  6780. const Params: IGPEncoderParameters = nil); overload;
  6781. procedure Save(const Stream: IStream; const Encoder: IGPImageCodecInfo;
  6782. const Params: IGPEncoderParameters = nil); overload;
  6783. procedure SaveAdd(const Params: IGPEncoderParameters); overload;
  6784. procedure SaveAdd(const NewImage: IGPImage;
  6785. const Params: IGPEncoderParameters); overload;
  6786. procedure GetPhysicalDimension(out Size: TGPSizeF);
  6787. procedure GetBounds(out SrcRect: TGPRectF; out SrcUnit: TGPUnit);
  6788. function GetThumbnailImage(const ThumbWidth, ThumbHeight: Cardinal;
  6789. const Callback: TGPGetThumbnailImageAbort = nil;
  6790. const CallbackData: Pointer = nil): IGPImage;
  6791. function GetFrameDimensions: IGPFrameDimensions;
  6792. function GetFrameCount(const DimensionID: TGUID): Cardinal;
  6793. procedure SelectActiveFrame(const DimensionID: TGUID;
  6794. const FrameIndex: Cardinal);
  6795. procedure RotateFlip(const RotateFlipType: TGPRotateFlipType);
  6796. function GetPropertyItem(const PropId: TPropID): IGPPropertyItem;
  6797. procedure SetPropertyItem(const PropItem: IGPPropertyItem);
  6798. procedure RemovePropertyItem(const PropId: TPropID);
  6799. function GetEncoderParameterList(const lEncoder: TGUID): IGPEncoderParameters;
  6800. {$IF (GDIPVER >= $0110)}
  6801. procedure FindFirstItem(const Item: PGPImageItemData);
  6802. procedure FindNextItem(const Item: PGPImageItemData);
  6803. procedure GetItemData(const Item: PGPImageItemData);
  6804. procedure SetAbort(const Abort: TGdiplusAbort);
  6805. {$IFEND}
  6806.  
  6807. { Properties }
  6808. property ImageType: TGPImageType read GetType;
  6809. property Width: Cardinal read GetWidth;
  6810. property Height: Cardinal read GetHeight;
  6811. property HorizontalResolution: Single read GetHorizontalResolution;
  6812. property VerticalResolution: Single read GetVerticalResolution;
  6813. property Flags: TGPImageFlags read GetFlags;
  6814. property RawFormat: TGUID read GetRawFormat;
  6815. property PixelFormat: TGPPixelFormat read GetPixelFormat;
  6816. property Palette: IGPColorPalette read GetPalette write SetPalette;
  6817. property PropertyIdList: IGPPropertyIdList read GetPropertyIdList;
  6818. property PropertyItems: IGPPropertyItems read GetPropertyItems;
  6819. end;
  6820.  
  6821. TGPImage = class(TGdiplusBase, IGPImage)
  6822. private
  6823. { IGPImage }
  6824. function GetType: TGPImageType;
  6825. function GetWidth: Cardinal;
  6826. function GetHeight: Cardinal;
  6827. function GetHorizontalResolution: Single;
  6828. function GetVerticalResolution: Single;
  6829. function GetFlags: TGPImageFlags;
  6830. function GetRawFormat: TGUID;
  6831. function GetPixelFormat: TGPPixelFormat;
  6832. function GetPalette: IGPColorPalette;
  6833. procedure SetPalette(const Value: IGPColorPalette);
  6834. function GetPropertyIdList: IGPPropertyIdList;
  6835. function GetPropertyItems: IGPPropertyItems;
  6836.  
  6837. function Clone: IGPImage;
  6838. procedure Save(const Filename: String; const Format: IGPImageFormat;
  6839. const Params: IGPEncoderParameters = nil); overload;
  6840. procedure Save(const Filename: String; const Encoder: IGPImageCodecInfo;
  6841. const Params: IGPEncoderParameters = nil); overload;
  6842. procedure Save(const Stream: IStream; const Format: IGPImageFormat;
  6843. const Params: IGPEncoderParameters = nil); overload;
  6844. procedure Save(const Stream: IStream; const Encoder: IGPImageCodecInfo;
  6845. const Params: IGPEncoderParameters = nil); overload;
  6846. procedure SaveAdd(const Params: IGPEncoderParameters); overload;
  6847. procedure SaveAdd(const NewImage: IGPImage;
  6848. const Params: IGPEncoderParameters); overload;
  6849. procedure GetPhysicalDimension(out Size: TGPSizeF);
  6850. procedure GetBounds(out SrcRect: TGPRectF; out SrcUnit: TGPUnit);
  6851. function GetThumbnailImage(const ThumbWidth, ThumbHeight: Cardinal;
  6852. const Callback: TGPGetThumbnailImageAbort = nil;
  6853. const CallbackData: Pointer = nil): IGPImage;
  6854. function GetFrameDimensions: IGPFrameDimensions;
  6855. function GetFrameCount(const DimensionID: TGUID): Cardinal;
  6856. procedure SelectActiveFrame(const DimensionID: TGUID;
  6857. const FrameIndex: Cardinal);
  6858. procedure RotateFlip(const RotateFlipType: TGPRotateFlipType);
  6859. function GetPropertyItem(const PropId: TPropID): IGPPropertyItem;
  6860. procedure SetPropertyItem(const PropItem: IGPPropertyItem);
  6861. procedure RemovePropertyItem(const PropId: TPropID);
  6862. function GetEncoderParameterList(const lEncoder: TGUID): IGPEncoderParameters;
  6863. {$IF (GDIPVER >= $0110)}
  6864. procedure FindFirstItem(const Item: PGPImageItemData);
  6865. procedure FindNextItem(const Item: PGPImageItemData);
  6866. procedure GetItemData(const Item: PGPImageItemData);
  6867. procedure SetAbort(const Abort: TGdiplusAbort);
  6868. {$IFEND}
  6869. private
  6870. constructor Create(const NativeImage: GpImage); overload;
  6871. public
  6872. constructor Create(const Filename: String;
  6873. const UseEmbeddedColorManagement: Boolean = False); overload;
  6874. constructor Create(const Stream: IStream;
  6875. const UseEmbeddedColorManagement: Boolean = False); overload;
  6876. destructor Destroy; override;
  6877.  
  6878. class function FromFile(const Filename: String;
  6879. const UseEmbeddedColorManagement: Boolean = False): IGPImage; static;
  6880. class function FromStream(const Stream: IStream;
  6881. const UseEmbeddedColorManagement: Boolean = False): IGPImage; static;
  6882. // published
  6883. property ImageType: TGPImageType read GetType;
  6884. property Width: Cardinal read GetWidth;
  6885. property Height: Cardinal read GetHeight;
  6886. property HorizontalResolution: Single read GetHorizontalResolution;
  6887. property VerticalResolution: Single read GetVerticalResolution;
  6888. property Flags: TGPImageFlags read GetFlags;
  6889. property RawFormat: TGUID read GetRawFormat;
  6890. property PixelFormat: TGPPixelFormat read GetPixelFormat;
  6891. property Palette: IGPColorPalette read GetPalette write SetPalette;
  6892. property PropertyIdList: IGPPropertyIdList read GetPropertyIdList;
  6893. property PropertyItems: IGPPropertyItems read GetPropertyItems;
  6894.  
  6895. end;
  6896.  
  6897. {$IF (GDIPVER >= $0110)}
  6898. IGPHistogram = interface
  6899. ['{4449210B-46EF-46B0-9458-CE3277CBBA67}']
  6900. { Property access methods }
  6901. function GetChannelCount: Integer;
  6902. function GetEntryCount: Integer;
  6903. function GetValue(const ChannelIndex, EntryIndex: Integer): Cardinal;
  6904. function GetChannel0(const Index: Integer): Cardinal;
  6905. function GetChannel1(const Index: Integer): Cardinal;
  6906. function GetChannel2(const Index: Integer): Cardinal;
  6907. function GetChannel3(const Index: Integer): Cardinal;
  6908. function GetValuePtr(const ChannelIndex: Integer): PCardinal;
  6909. function GetChannel0Ptr: PCardinal;
  6910. function GetChannel1Ptr: PCardinal;
  6911. function GetChannel2Ptr: PCardinal;
  6912. function GetChannel3Ptr: PCardinal;
  6913.  
  6914. { Properties }
  6915. property ChannelCount: Integer read GetChannelCount;
  6916. property EntryCount: Integer read GetEntryCount;
  6917. property Values[const ChannelIndex, EntryIndex: Integer]: Cardinal read GetValue; default;
  6918. property Channel0[const Index: Integer]: Cardinal read GetChannel0;
  6919. property Channel1[const Index: Integer]: Cardinal read GetChannel1;
  6920. property Channel2[const Index: Integer]: Cardinal read GetChannel2;
  6921. property Channel3[const Index: Integer]: Cardinal read GetChannel3;
  6922. property ValuePtr[const ChannelIndex: Integer]: PCardinal read GetValuePtr;
  6923. property Channel0Ptr: PCardinal read GetChannel0Ptr;
  6924. property Channel1Ptr: PCardinal read GetChannel1Ptr;
  6925. property Channel2Ptr: PCardinal read GetChannel2Ptr;
  6926. property Channel3Ptr: PCardinal read GetChannel3Ptr;
  6927. end;
  6928.  
  6929. TGPHistogram = class(TInterfacedObject, IGPHistogram)
  6930. private
  6931. FChannelCount: Integer;
  6932. FEntryCount: Integer;
  6933. FChannels: array [0..3] of PCardinal;
  6934. private
  6935. { IGPHistogram }
  6936. function GetChannelCount: Integer;
  6937. function GetEntryCount: Integer;
  6938. function GetValue(const ChannelIndex, EntryIndex: Integer): Cardinal;
  6939. function GetChannel0(const Index: Integer): Cardinal;
  6940. function GetChannel1(const Index: Integer): Cardinal;
  6941. function GetChannel2(const Index: Integer): Cardinal;
  6942. function GetChannel3(const Index: Integer): Cardinal;
  6943. function GetValuePtr(const ChannelIndex: Integer): PCardinal;
  6944. function GetChannel0Ptr: PCardinal;
  6945. function GetChannel1Ptr: PCardinal;
  6946. function GetChannel2Ptr: PCardinal;
  6947. function GetChannel3Ptr: PCardinal;
  6948. private
  6949. constructor Create(const AChannelCount, AEntryCount: Integer;
  6950. const AChannel0, AChannel1, AChannel2, AChannel3: PCardinal);
  6951. public
  6952. destructor Destroy; override;
  6953. end;
  6954. {$IFEND}
  6955.  
  6956. IGPBitmap = interface(IGPImage)
  6957. ['{704FC1E3-DAFC-4775-9BCB-D7D70741BB54}']
  6958. { Property access methods }
  6959. function GetPixel(const X, Y: Integer): TGPColor;
  6960. procedure SetPixel(const X, Y: Integer; const Value: TGPColor);
  6961.  
  6962. { Methods }
  6963. function Clone: IGPBitmap; overload;
  6964. function Clone(const Rect: TGPRect; const Format: TGPPixelFormat): IGPBitmap; overload;
  6965. function Clone(const X, Y, Width, Height: Integer; const Format: TGPPixelFormat): IGPBitmap; overload;
  6966. function Clone(const Rect: TGPRectF; const Format: TGPPixelFormat): IGPBitmap; overload;
  6967. function Clone(const X, Y, Width, Height: Single; const Format: TGPPixelFormat): IGPBitmap; overload;
  6968. function LockBits(const Rect: TGPRect; const Mode: TGPImageLockMode;
  6969. const Format: TGPPixelFormat): TGPBitmapData;
  6970. procedure UnlockBits(const LockedBitmapData: TGPBitmapData);
  6971. {$IF (GDIPVER >= $0110)}
  6972. procedure ConvertFormat(const Format: TGPPixelFormat;
  6973. const DitherType: TGPDitherType; const PaletteType: TGPPaletteType;
  6974. const Palette: IGPColorPalette = nil; const AlphaThresholdPercent: Single = 0);
  6975. procedure ApplyEffect(const Effect: IGPEffect; const ROI: Windows.PRect = nil);
  6976. function GetHistogram(const Format: TGPHistogramFormat): IGPHistogram;
  6977. {$IFEND}
  6978. procedure SetResolution(const XDpi, YDpi: Single);
  6979. function GetHBitmap(const ColorBackground: TGPColor): HBitmap;
  6980. function GetHIcon: HIcon;
  6981.  
  6982. { Properties }
  6983. property Pixels[const X, Y: Integer]: TGPColor read GetPixel write SetPixel; default;
  6984. end;
  6985.  
  6986. TGPBitmap = class(TGPImage, IGPBitmap)
  6987. public
  6988. { IGPBitmap }
  6989. function GetPixel(const X, Y: Integer): TGPColor;
  6990. procedure SetPixel(const X, Y: Integer; const Value: TGPColor);
  6991.  
  6992. function Clone: IGPBitmap; overload;
  6993. function Clone(const Rect: TGPRect; const Format: TGPPixelFormat): IGPBitmap; overload;
  6994. function Clone(const X, Y, Width, Height: Integer; const Format: TGPPixelFormat): IGPBitmap; overload;
  6995. function Clone(const Rect: TGPRectF; const Format: TGPPixelFormat): IGPBitmap; overload;
  6996. function Clone(const X, Y, Width, Height: Single; const Format: TGPPixelFormat): IGPBitmap; overload;
  6997. function LockBits(const Rect: TGPRect; const Mode: TGPImageLockMode;
  6998. const Format: TGPPixelFormat): TGPBitmapData;
  6999. procedure UnlockBits(const LockedBitmapData: TGPBitmapData);
  7000. {$IF (GDIPVER >= $0110)}
  7001. procedure ConvertFormat(const Format: TGPPixelFormat;
  7002. const DitherType: TGPDitherType; const PaletteType: TGPPaletteType;
  7003. const Palette: IGPColorPalette; const AlphaThresholdPercent: Single);
  7004. procedure ApplyEffect(const Effect: IGPEffect; const ROI: Windows.PRect); overload;
  7005. function GetHistogram(const Format: TGPHistogramFormat): IGPHistogram;
  7006. {$IFEND}
  7007. procedure SetResolution(const XDpi, YDpi: Single);
  7008.  
  7009. function GetHBitmap(const ColorBackground: TGPColor): HBitmap;
  7010. function GetHIcon: HIcon;
  7011. private
  7012. constructor Create(const NativeBitmap: GpBitmap); overload;
  7013. public
  7014. constructor Create(const Filename: String;
  7015. const UseEmbeddedColorManagement: Boolean = False); overload;
  7016. constructor Create(const Stream: IStream;
  7017. const UseEmbeddedColorManagement: Boolean = False); overload;
  7018. constructor Create(const Width, Height, Stride: Integer;
  7019. const Format: TGPPixelFormat; const Scan0: Pointer); overload;
  7020. constructor Create(const Width, Height: Integer;
  7021. const Format: TGPPixelFormat = PixelFormat32bppARGB); overload;
  7022. constructor Create(const Width, Height: Integer;
  7023. const Target: IGPGraphics); overload;
  7024. constructor Create(const DirectDrawSurface7: IUnknown); overload;
  7025. constructor Create(const BitmapInfo: TBitmapInfo;
  7026. const BitmapData: Pointer); overload;
  7027. constructor Create(const BitmapHandle: HBitmap;
  7028. const Palette: HPalette); overload;
  7029. constructor Create(const IconHandle: HIcon); overload;
  7030. constructor Create(const Instance: HInst; const BitmapName: String); overload;
  7031.  
  7032. class function FromFile(const Filename: String;
  7033. const UseEmbeddedColorManagement: Boolean = False): IGPBitmap; static;
  7034. class function FromStream(const Stream: IStream;
  7035. const UseEmbeddedColorManagement: Boolean = False): IGPBitmap; static;
  7036. class function FromDirectDrawSurface7(const Surface: IUnknown): IGPBitmap;
  7037. class function FromBitmapInfo(const BitmapInfo: TBitmapInfo;
  7038. const BitmapData: Pointer): IGPBitmap;
  7039. class function FromHBitmap(const BitmapHandle: HBitmap;
  7040. const Palette: HPalette): IGPBitmap;
  7041. class function FromHIcon(const IconHandle: HIcon): IGPBitmap;
  7042. class function FromResource(const Instance: HInst;
  7043. const BitmapName: String): IGPBitmap;
  7044.  
  7045. {$IF (GDIPVER >= $0110)}
  7046. class function InitializePalette(const ColorCount: Integer;
  7047. const PaletteType: TGPPaletteType; const OptimalColors: Integer;
  7048. const UseTransparentColor: Boolean; const Bitmap: IGPBitmap): IGPColorPalette; static;
  7049. class function ApplyEffect(const Inputs: array of IGPBitmap;
  7050. const Effect: IGPEffect; const ROI, OutputRect: Windows.PRect): IGPBitmap; overload;
  7051. {$IFEND}
  7052. end;
  7053.  
  7054. {$ENDREGION 'GdiplusBitmap.h'}
  7055.  
  7056. {$REGION 'GdiplusLineCaps.h'}
  7057. (*****************************************************************************
  7058. * GdiplusLineCaps.h
  7059. * GDI+ CustomLineCap APIs
  7060. *****************************************************************************)
  7061.  
  7062. IGPCustomLineCap = interface(IGdiPlusBase)
  7063. ['{6BF10928-312C-42F6-83DE-76D98FFFCD7B}']
  7064. { Property access methods }
  7065. function GetStrokeJoin: TGPLineJoin;
  7066. procedure SetStrokeJoin(const Value: TGPLineJoin);
  7067. function GetBaseCap: TGPLineCap;
  7068. procedure SetBaseCap(const Value: TGPLineCap);
  7069. function GetBaseInset: Single;
  7070. procedure SetBaseInset(const Value: Single);
  7071. function GetWidthScale: Single;
  7072. procedure SetWidthScale(const Value: Single);
  7073.  
  7074. { Methods }
  7075. function Clone: IGPCustomLineCap;
  7076. procedure SetStrokeCap(const StrokeCap: TGPLineCap);
  7077. procedure SetStrokeCaps(const StartCap, EndCap: TGPLineCap);
  7078. procedure GetStrokeCaps(out StartCap, EndCap: TGPLineCap);
  7079.  
  7080. { Properties }
  7081. property StrokeJoin: TGPLineJoin read GetStrokeJoin write SetStrokeJoin;
  7082. property BaseCap: TGPLineCap read GetBaseCap write SetBaseCap;
  7083. property BaseInset: Single read GetBaseInset write SetBaseInset;
  7084. property WidthScale: Single read GetWidthScale write SetWidthScale;
  7085. end;
  7086.  
  7087. TGPCustomLineCap = class(TGdiplusBase, IGPCustomLineCap)
  7088. private
  7089. { IGPCustomLineCap }
  7090. function GetStrokeJoin: TGPLineJoin;
  7091. procedure SetStrokeJoin(const Value: TGPLineJoin);
  7092. function GetBaseCap: TGPLineCap;
  7093. procedure SetBaseCap(const Value: TGPLineCap);
  7094. function GetBaseInset: Single;
  7095. procedure SetBaseInset(const Value: Single);
  7096. function GetWidthScale: Single;
  7097. procedure SetWidthScale(const Value: Single);
  7098.  
  7099. function Clone: IGPCustomLineCap;
  7100. procedure SetStrokeCap(const StrokeCap: TGPLineCap);
  7101. procedure SetStrokeCaps(const StartCap, EndCap: TGPLineCap);
  7102. procedure GetStrokeCaps(out StartCap, EndCap: TGPLineCap);
  7103. private
  7104. constructor Create(const NativeLineCap: GpCustomLineCap); overload;
  7105. public
  7106. constructor Create(const FillPath, StrokePath: IGPGraphicsPath;
  7107. const BaseCap: TGPLineCap = LineCapFlat; const BaseInset: Single = 0); overload;
  7108. destructor Destroy; override;
  7109. end;
  7110.  
  7111. IGPAdjustableArrowCap = interface(IGPCustomLineCap)
  7112. ['{25BE82E3-DF7F-4143-B5EA-3E535BDD3A86}']
  7113. { Property access methods }
  7114. function GetHeight: Single;
  7115. procedure SetHeight(const Value: Single);
  7116. function GetWidth: Single;
  7117. procedure SetWidth(const Value: Single);
  7118. function GetMiddleInset: Single;
  7119. procedure SetMiddleInset(const Value: Single);
  7120. function GetFilled: Boolean;
  7121. procedure SetFilled(const Value: Boolean);
  7122.  
  7123. { Properties }
  7124. property Height: Single read GetHeight write SetHeight;
  7125. property Width: Single read GetWidth write SetWidth;
  7126. property MiddleInset: Single read GetMiddleInset write SetMiddleInset;
  7127. property Filled: Boolean read GetFilled write SetFilled;
  7128. end;
  7129.  
  7130. TGPAdjustableArrowCap = class(TGPCustomLineCap, IGPAdjustableArrowCap)
  7131. private
  7132. { IGPAdjustableArrowCap }
  7133. function GetHeight: Single;
  7134. procedure SetHeight(const Value: Single);
  7135. function GetWidth: Single;
  7136. procedure SetWidth(const Value: Single);
  7137. function GetMiddleInset: Single;
  7138. procedure SetMiddleInset(const Value: Single);
  7139. function GetFilled: Boolean;
  7140. procedure SetFilled(const Value: Boolean);
  7141. public
  7142. constructor Create(const Height, Width: Single;
  7143. const IsFilled: Boolean = True); overload;
  7144. end;
  7145. {$ENDREGION 'GdiplusLineCaps.h'}
  7146.  
  7147. {$REGION 'GdiplusCachedBitmap.h'}
  7148. (*****************************************************************************
  7149. * GdiplusCachedBitmap.h
  7150. * GDI+ CachedBitmap is a representation of an accelerated drawing
  7151. * that has restrictions on what operations are allowed in order
  7152. * to accelerate the drawing to the destination.
  7153. *****************************************************************************)
  7154.  
  7155. IGPCachedBitmap = interface(IGdiPlusBase)
  7156. ['{1F77CA35-C917-4167-87CF-BF9DBB23FCAB}']
  7157. end;
  7158.  
  7159. TGPCachedBitmap = class(TGdiplusBase, IGPCachedBitmap)
  7160. public
  7161. constructor Create(const Bitmap: IGPBitmap; const Graphics: IGPGraphics); overload;
  7162. destructor Destroy; override;
  7163. end;
  7164.  
  7165. {$ENDREGION 'GdiplusCachedBitmap.h'}
  7166.  
  7167. {$REGION 'GdiplusMetafile.h'}
  7168. (*****************************************************************************
  7169. * GdiplusMetafile.h
  7170. * GDI+ Metafile class
  7171. *****************************************************************************)
  7172.  
  7173. IGPMetafile = interface(IGPImage)
  7174. ['{BBA510DD-1D60-4067-839C-C77733BCC2AB}']
  7175. { Property access methods }
  7176. function GetDownLevelRasterizationLimit: Cardinal;
  7177. procedure SetDownLevelRasterizationLimit(const Value: Cardinal);
  7178.  
  7179. { Methods }
  7180. function GetMetafileHeader: TGPMetafileHeader;
  7181. function GetHEnhMetafile: HEnhMetafile;
  7182. procedure PlayRecord(const RecordType: TEmfPlusRecordType;
  7183. const Flags, DataSize: Integer; const Data: Pointer);
  7184. {$IF (GDIPVER >= $0110)}
  7185. procedure ConvertToEmfPlus(const RefGraphics: IGPGraphics;
  7186. const ConversionFailureFlag: PInteger = nil;
  7187. const EmfType: TGPEmfType = EmfTypeEmfPlusOnly;
  7188. const Description: String = ''); overload;
  7189. procedure ConvertToEmfPlus(const RefGraphics: IGPGraphics;
  7190. const Filename: String; const ConversionFailureFlag: PInteger = nil;
  7191. const EmfType: TGPEmfType = EmfTypeEmfPlusOnly;
  7192. const Description: String = ''); overload;
  7193. procedure ConvertToEmfPlus(const RefGraphics: IGPGraphics;
  7194. const Stream: IStream; const ConversionFailureFlag: PInteger = nil;
  7195. const EmfType: TGPEmfType = EmfTypeEmfPlusOnly;
  7196. const Description: String = ''); overload;
  7197. {$IFEND}
  7198.  
  7199. { Properties }
  7200. property DownLevelRasterizationLimit: Cardinal read GetDownLevelRasterizationLimit write SetDownLevelRasterizationLimit;
  7201. end;
  7202.  
  7203. TGPMetafile = class(TGPImage, IGPMetafile)
  7204. private
  7205. { IGPMetafile }
  7206. function GetDownLevelRasterizationLimit: Cardinal;
  7207. procedure SetDownLevelRasterizationLimit(const Value: Cardinal);
  7208.  
  7209. function GetMetafileHeader: TGPMetafileHeader; overload;
  7210. function GetHEnhMetafile: HEnhMetafile;
  7211. procedure PlayRecord(const RecordType: TEmfPlusRecordType;
  7212. const Flags, DataSize: Integer; const Data: Pointer);
  7213. {$IF (GDIPVER >= $0110)}
  7214. procedure ConvertToEmfPlus(const RefGraphics: IGPGraphics;
  7215. const ConversionFailureFlag: PInteger = nil;
  7216. const EmfType: TGPEmfType = EmfTypeEmfPlusOnly;
  7217. const Description: String = ''); overload;
  7218. procedure ConvertToEmfPlus(const RefGraphics: IGPGraphics;
  7219. const Filename: String; const ConversionFailureFlag: PInteger = nil;
  7220. const EmfType: TGPEmfType = EmfTypeEmfPlusOnly;
  7221. const Description: String = ''); overload;
  7222. procedure ConvertToEmfPlus(const RefGraphics: IGPGraphics;
  7223. const Stream: IStream; const ConversionFailureFlag: PInteger = nil;
  7224. const EmfType: TGPEmfType = EmfTypeEmfPlusOnly;
  7225. const Description: String = ''); overload;
  7226. {$IFEND}
  7227. public
  7228. constructor Create(const Wmf: HMetafile;
  7229. const WmfPlaceableFileHeader: TWmfPlaceableFileHeader;
  7230. const DeleteWmf: Boolean = False); overload;
  7231. constructor Create(const Emf: HEnhMetafile; const DeleteEmf: Boolean = False); overload;
  7232. constructor Create(const Filename: String); overload;
  7233. constructor Create(const Filename: String;
  7234. const WmfPlaceableFileHeader: TWmfPlaceableFileHeader); overload;
  7235. constructor Create(const Stream: IStream); overload;
  7236. constructor Create(const ReferenceDC: HDC;
  7237. const EmfType: TGPEmfType = EmfTypeEmfPlusDual;
  7238. const Description: String = ''); overload;
  7239. constructor Create(const ReferenceDC: HDC; const FrameRect: TGPRectF;
  7240. const FrameUnit: TGPMetafileFrameUnit = MetafileFrameUnitGdi;
  7241. const EmfType: TGPEmfType = EmfTypeEmfPlusDual;
  7242. const Description: String = ''); overload;
  7243. constructor Create(const ReferenceDC: HDC; const FrameRect: TGPRect;
  7244. const FrameUnit: TGPMetafileFrameUnit = MetafileFrameUnitGdi;
  7245. const EmfType: TGPEmfType = EmfTypeEmfPlusDual;
  7246. const Description: String = ''); overload;
  7247. constructor Create(const Filename: String; const ReferenceDC: HDC;
  7248. const EmfType: TGPEmfType = EmfTypeEmfPlusDual;
  7249. const Description: String = ''); overload;
  7250. constructor Create(const Filename: String; const ReferenceDC: HDC;
  7251. const FrameRect: TGPRectF;
  7252. const FrameUnit: TGPMetafileFrameUnit = MetafileFrameUnitGdi;
  7253. const EmfType: TGPEmfType = EmfTypeEmfPlusDual;
  7254. const Description: String = ''); overload;
  7255. constructor Create(const Filename: String; const ReferenceDC: HDC;
  7256. const FrameRect: TGPRect;
  7257. const FrameUnit: TGPMetafileFrameUnit = MetafileFrameUnitGdi;
  7258. const EmfType: TGPEmfType = EmfTypeEmfPlusDual;
  7259. const Description: String = ''); overload;
  7260. constructor Create(const Stream: IStream; const ReferenceDC: HDC;
  7261. const EmfType: TGPEmfType = EmfTypeEmfPlusDual;
  7262. const Description: String = ''); overload;
  7263. constructor Create(const Stream: IStream; const ReferenceDC: HDC;
  7264. const FrameRect: TGPRectF;
  7265. const FrameUnit: TGPMetafileFrameUnit = MetafileFrameUnitGdi;
  7266. const EmfType: TGPEmfType = EmfTypeEmfPlusDual;
  7267. const Description: String = ''); overload;
  7268. constructor Create(const Stream: IStream; const ReferenceDC: HDC;
  7269. const FrameRect: TGPRect;
  7270. const FrameUnit: TGPMetafileFrameUnit = MetafileFrameUnitGdi;
  7271. const EmfType: TGPEmfType = EmfTypeEmfPlusDual;
  7272. const Description: String = ''); overload;
  7273.  
  7274. class function GetMetafileHeader(const Wmf: HMetafile;
  7275. const WmfPlaceableFileHeader: TWmfPlaceableFileHeader): TGPMetafileHeader; overload; static;
  7276. class function GetMetafileHeader(const Emf: HEnhMetafile): TGPMetafileHeader; overload; static;
  7277. class function GetMetafileHeader(const Filename: String): TGPMetafileHeader; overload; static;
  7278. class function GetMetafileHeader(const Stream: IStream): TGPMetafileHeader; overload; static;
  7279.  
  7280. class function EmfToWmfBits(const Emf: HEnhMetafile;
  7281. const MapMode: Integer = MM_ANISOTROPIC;
  7282. const Flags: TGPEmfToWmfBitsFlags = EmfToWmfBitsFlagsDefault): IGPBuffer;
  7283. end;
  7284.  
  7285. {$ENDREGION 'GdiplusMetafile.h'}
  7286.  
  7287. {$REGION 'GdiplusImageAttributes.h'}
  7288.  
  7289. (*****************************************************************************
  7290. * GdiplusImageAttributes.h
  7291. * GDI+ Image Attributes used with Graphics.DrawImage
  7292. *****************************************************************************)
  7293.  
  7294. IGPImageAttributes = interface(IGdiPlusBase)
  7295. ['{840C6292-E52C-4A2D-8444-CCE2A91DB701}']
  7296. { Methods }
  7297. function Clone: IGPImageAttributes;
  7298. procedure SetToIdentity(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7299. procedure Reset(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7300. procedure SetColorMatrix(const ColorMatrix: TGPColorMatrix;
  7301. const Mode: TGPColorMatrixFlags = ColorMatrixFlagsDefault;
  7302. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7303. procedure ClearColorMatrix(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7304. procedure SetColorMatrices(const ColorMatrix, GrayMatrix: TGPColorMatrix;
  7305. const Mode: TGPColorMatrixFlags = ColorMatrixFlagsDefault;
  7306. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7307. procedure ClearColorMatrices(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7308. procedure SetThreshold(const Threshold: Single;
  7309. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7310. procedure ClearThreshold(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7311. procedure SetGamma(const Gamma: Single;
  7312. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7313. procedure ClearGamma(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7314. procedure SetNoOp(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7315. procedure ClearNoOp(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7316. procedure SetColorKey(const ColorLow, ColorHigh: TGPColor;
  7317. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7318. procedure ClearColorKey(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7319. procedure SetOutputChannel(const ChannelFlags: TGPColorChannelFlags;
  7320. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7321. procedure ClearOutputChannel(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7322. procedure SetOutputChannelColorProfile(const ColorProfileFilename: String;
  7323. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7324. procedure ClearOutputChannelColorProfile(
  7325. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7326. procedure SetRemapTable(const Map: array of TGPColorMap;
  7327. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7328. procedure ClearRemapTable(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7329. procedure SetBrushRemapTable(const Map: array of TGPColorMap);
  7330. procedure ClearBrushRemapTable;
  7331. procedure SetWrapMode(const Wrap: TGPWrapMode;
  7332. const Color: TGPColor; const Clamp: Boolean = False); overload;
  7333. procedure SetWrapMode(const Wrap: TGPWrapMode); overload;
  7334. procedure GetAdjustedPalette(const ColorPalette: IGPColorPalette;
  7335. const ColorAdjustType: TGPColorAdjustType);
  7336. end;
  7337.  
  7338. TGPImageAttributes = class(TGdiplusBase, IGPImageAttributes)
  7339. private
  7340. { IGPImageAttributes }
  7341. function Clone: IGPImageAttributes;
  7342. procedure SetToIdentity(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7343. procedure Reset(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7344. procedure SetColorMatrix(const ColorMatrix: TGPColorMatrix;
  7345. const Mode: TGPColorMatrixFlags = ColorMatrixFlagsDefault;
  7346. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7347. procedure ClearColorMatrix(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7348. procedure SetColorMatrices(const ColorMatrix, GrayMatrix: TGPColorMatrix;
  7349. const Mode: TGPColorMatrixFlags = ColorMatrixFlagsDefault;
  7350. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7351. procedure ClearColorMatrices(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7352. procedure SetThreshold(const Threshold: Single;
  7353. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7354. procedure ClearThreshold(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7355. procedure SetGamma(const Gamma: Single;
  7356. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7357. procedure ClearGamma(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7358. procedure SetNoOp(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7359. procedure ClearNoOp(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7360. procedure SetColorKey(const ColorLow, ColorHigh: TGPColor;
  7361. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7362. procedure ClearColorKey(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7363. procedure SetOutputChannel(const ChannelFlags: TGPColorChannelFlags;
  7364. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7365. procedure ClearOutputChannel(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7366. procedure SetOutputChannelColorProfile(const ColorProfileFilename: String;
  7367. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7368. procedure ClearOutputChannelColorProfile(
  7369. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7370. procedure SetRemapTable(const Map: array of TGPColorMap;
  7371. const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7372. procedure ClearRemapTable(const AdjustType: TGPColorAdjustType = ColorAdjustTypeDefault);
  7373. procedure SetBrushRemapTable(const Map: array of TGPColorMap);
  7374. procedure ClearBrushRemapTable;
  7375. procedure SetWrapMode(const Wrap: TGPWrapMode;
  7376. const Color: TGPColor; const Clamp: Boolean = False); overload;
  7377. procedure SetWrapMode(const Wrap: TGPWrapMode); overload;
  7378. procedure GetAdjustedPalette(const ColorPalette: IGPColorPalette;
  7379. const ColorAdjustType: TGPColorAdjustType);
  7380. private
  7381. constructor Create(const NativeAttributes: GpImageAttributes); overload;
  7382. public
  7383. constructor Create; overload;
  7384. destructor Destroy; override;
  7385. end;
  7386.  
  7387. {$ENDREGION 'GdiplusImageAttributes.h'}
  7388.  
  7389. {$REGION 'GdiplusMatrix.h'}
  7390.  
  7391. (*****************************************************************************
  7392. * GdiplusMatrix.h
  7393. * GDI+ Matrix class
  7394. *****************************************************************************)
  7395.  
  7396. TGPMatrixElements = record
  7397. case Integer of
  7398. 0: (M: array [0..5] of Single);
  7399. 1: (M11: Single;
  7400. M12: Single;
  7401. M21: Single;
  7402. M22: Single;
  7403. DX : Single;
  7404. DY : Single);
  7405. end;
  7406.  
  7407. TGPPlgPointsF = array [0..2] of TGPPointF;
  7408. TGPPlgPoints = array [0..2] of TGPPoint;
  7409.  
  7410. IGPMatrix = interface(IGdiPlusBase)
  7411. ['{2B5AA3D4-F4AA-436D-AB48-18321613FF99}']
  7412. { Property access methods }
  7413. function GetElements: TGPMatrixElements;
  7414. procedure SetElements(const Value: TGPMatrixElements); overload;
  7415. function GetOffsetX: Single;
  7416. function GetOffsetY: Single;
  7417. function GetIsInvertible: Boolean;
  7418. function GetIsIdentity: Boolean;
  7419.  
  7420. { Methods }
  7421. function Clone: IGPMatrix;
  7422. procedure Reset;
  7423. procedure SetElements(const M11, M12, M21, M22, DX, DY: Single); overload;
  7424. procedure Multiply(const Matrix: IGPMatrix;
  7425. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7426. procedure Translate(const OffsetX, OffsetY: Single;
  7427. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7428. procedure Scale(const ScaleX, ScaleY: Single;
  7429. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7430. procedure Rotate(const Angle: Single;
  7431. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7432. procedure RotateAt(const Angle: Single; const Center: TGPPointF;
  7433. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7434. procedure Shear(const ShearX, ShearY: Single;
  7435. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7436. procedure Invert;
  7437. procedure TransformPoint(var Point: TGPPointF); overload;
  7438. procedure TransformPoint(var Point: TGPPoint); overload;
  7439. procedure TransformPoints(const Points: array of TGPPointF); overload;
  7440. procedure TransformPoints(const Points: array of TGPPoint); overload;
  7441. procedure TransformVector(var Point: TGPPointF); overload;
  7442. procedure TransformVector(var Point: TGPPoint); overload;
  7443. procedure TransformVectors(const Points: array of TGPPointF); overload;
  7444. procedure TransformVectors(const Points: array of TGPPoint); overload;
  7445. function Equals(const Matrix: IGPMatrix): Boolean;
  7446.  
  7447. { Properties }
  7448. property Elements: TGPMatrixElements read GetElements write SetElements;
  7449. property OffsetX: Single read GetOffsetX;
  7450. property OffsetY: Single read GetOffsetY;
  7451. property IsInvertible: Boolean read GetIsInvertible;
  7452. property IsIdentity: Boolean read GetIsIdentity;
  7453. end;
  7454.  
  7455. TGPMatrix = class(TGdiplusBase, IGPMatrix)
  7456. private
  7457. { IGPMatrix }
  7458. function GetElements: TGPMatrixElements;
  7459. procedure SetElements(const Value: TGPMatrixElements); overload;
  7460. function GetOffsetX: Single;
  7461. function GetOffsetY: Single;
  7462. function GetIsInvertible: Boolean;
  7463. function GetIsIdentity: Boolean;
  7464.  
  7465. function Clone: IGPMatrix;
  7466. procedure Reset;
  7467. procedure SetElements(const M11, M12, M21, M22, DX, DY: Single); overload;
  7468. procedure Multiply(const Matrix: IGPMatrix;
  7469. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7470. procedure Translate(const OffsetX, OffsetY: Single;
  7471. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7472. procedure Scale(const ScaleX, ScaleY: Single;
  7473. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7474. procedure Rotate(const Angle: Single;
  7475. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7476. procedure RotateAt(const Angle: Single; const Center: TGPPointF;
  7477. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7478. procedure Shear(const ShearX, ShearY: Single;
  7479. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7480. procedure Invert;
  7481. procedure TransformPoint(var Point: TGPPointF); overload;
  7482. procedure TransformPoint(var Point: TGPPoint); overload;
  7483. procedure TransformPoints(const Points: array of TGPPointF); overload;
  7484. procedure TransformPoints(const Points: array of TGPPoint); overload;
  7485. procedure TransformVector(var Point: TGPPointF); overload;
  7486. procedure TransformVector(var Point: TGPPoint); overload;
  7487. procedure TransformVectors(const Points: array of TGPPointF); overload;
  7488. procedure TransformVectors(const Points: array of TGPPoint); overload;
  7489. function Equals(const Matrix: IGPMatrix): Boolean; reintroduce;
  7490. private
  7491. constructor Create(const NativeMatrix: GpMatrix); overload;
  7492. public
  7493. constructor Create; overload;
  7494. constructor Create(const M11, M12, M21, M22, DX, DY: Single); overload;
  7495. constructor Create(const Rect: TGPRectF; const DstPlg: TGPPlgPointsF); overload;
  7496. constructor Create(const Rect: TGPRect; const DstPlg: TGPPlgPoints); overload;
  7497. destructor Destroy; override;
  7498. end;
  7499. {$ENDREGION 'GdiplusMatrix.h'}
  7500.  
  7501. {$REGION 'GdiplusBrush.h'}
  7502.  
  7503. (*****************************************************************************
  7504. * GdiplusBrush.h
  7505. * GDI+ Brush class
  7506. *****************************************************************************)
  7507. IGPBrush = interface(IGdiPlusBase)
  7508. ['{E0A8536C-D389-43E9-984F-B6DB6B1AFBF2}']
  7509. { Property access methods }
  7510. function GetType: TGPBrushType;
  7511.  
  7512. { Methods }
  7513. function Clone: IGPBrush;
  7514.  
  7515. { Properties }
  7516. property BrushType: TGPBrushType read GetType;
  7517. end;
  7518.  
  7519. TGPBrush = class abstract(TGdiplusBase, IGPBrush)
  7520. private
  7521. { IGPBrush }
  7522. function GetType: TGPBrushType;
  7523. function Clone: IGPBrush;
  7524. private
  7525. constructor Create; overload;
  7526. constructor Create(const NativeBrush: GpBrush); overload;
  7527. public
  7528. destructor Destroy; override;
  7529. end;
  7530.  
  7531. IGPSolidBrush = interface(IGPBrush)
  7532. ['{5DC6D20E-74C1-48B8-83A1-00D213827298}']
  7533. { Property access methods }
  7534. function GetColor: TGPColor;
  7535. procedure SetColor(const Value: TGPColor);
  7536.  
  7537. { Properties }
  7538. property Color: TGPColor read GetColor write SetColor;
  7539. end;
  7540.  
  7541. TGPSolidBrush = class(TGPBrush, IGPSolidBrush)
  7542. private
  7543. { IGPSolidBrush }
  7544. function GetColor: TGPColor;
  7545. procedure SetColor(const Value: TGPColor);
  7546. private
  7547. constructor Create; overload;
  7548. public
  7549. constructor Create(const Color: TGPColor); overload;
  7550. end;
  7551.  
  7552. IGPTextureBrush = interface(IGPBrush)
  7553. ['{37076023-1AE9-4F95-BB6C-D09C4E647AC2}']
  7554. { Property access methods }
  7555. function GetTransform: IGPMatrix;
  7556. procedure SetTransform(const Value: IGPMatrix);
  7557. function GetWrapMode: TGPWrapMode;
  7558. procedure SetWrapMode(const Value: TGPWrapMode);
  7559. function GetImage: IGPImage;
  7560.  
  7561. { Methods }
  7562. procedure ResetTransform;
  7563. procedure MultiplyTransform(const Matrix: IGPMatrix;
  7564. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7565. procedure TranslateTransform(const DX, DY: Single;
  7566. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7567. procedure ScaleTransform(const SX, SY: Single;
  7568. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7569. procedure RotateTransform(const Angle: Single;
  7570. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7571.  
  7572. { Properties }
  7573. property Transform: IGPMatrix read GetTransform write SetTransform;
  7574. property WrapMode: TGPWrapMode read GetWrapMode write SetWrapMode;
  7575. property Image: IGPImage read GetImage;
  7576. end;
  7577.  
  7578. TGPTextureBrush = class(TGPBrush, IGPTextureBrush)
  7579. private
  7580. { IGPTextureBrush }
  7581. function GetTransform: IGPMatrix;
  7582. procedure SetTransform(const Value: IGPMatrix);
  7583. function GetWrapMode: TGPWrapMode;
  7584. procedure SetWrapMode(const Value: TGPWrapMode);
  7585. function GetImage: IGPImage;
  7586.  
  7587. procedure ResetTransform;
  7588. procedure MultiplyTransform(const Matrix: IGPMatrix;
  7589. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7590. procedure TranslateTransform(const DX, DY: Single;
  7591. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7592. procedure ScaleTransform(const SX, SY: Single;
  7593. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7594. procedure RotateTransform(const Angle: Single;
  7595. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7596. private
  7597. constructor Create; overload;
  7598. public
  7599. constructor Create(const Image: IGPImage;
  7600. const WrapMode: TGPWrapMode = WrapModeTile); overload;
  7601. constructor Create(const Image: IGPImage;
  7602. const WrapMode: TGPWrapMode; const DstRect: TGPRectF); overload;
  7603. constructor Create(const Image: IGPImage;
  7604. const WrapMode: TGPWrapMode; const DstRect: TGPRect); overload;
  7605. constructor Create(const Image: IGPImage; const DstRect: TGPRectF;
  7606. const ImageAttributes: IGPImageAttributes = nil); overload;
  7607. constructor Create(const Image: IGPImage; const DstRect: TGPRect;
  7608. const ImageAttributes: IGPImageAttributes = nil); overload;
  7609. constructor Create(const Image: IGPImage;
  7610. const WrapMode: TGPWrapMode; const DstX, DstY, DstWidth, DstHeight: Single); overload;
  7611. constructor Create(const Image: IGPImage;
  7612. const WrapMode: TGPWrapMode; const DstX, DstY, DstWidth, DstHeight: Integer); overload;
  7613. end;
  7614.  
  7615. TGPLinearColors = array [0..1] of TGPColor;
  7616.  
  7617. IGPBlend = interface
  7618. ['{497DDA96-3962-4037-B5D4-089D0C463378}']
  7619. { Property access methods }
  7620. function GetCount: Integer;
  7621. function GetFactor(const Index: Integer): Single;
  7622. procedure SetFactor(const Index: Integer; const Value: Single);
  7623. function GetPosition(const Index: Integer): Single;
  7624. procedure SetPosition(const Index: Integer; const Value: Single);
  7625. function GetFactorPtr: PSingle;
  7626. function GetPositionPtr: PSingle;
  7627.  
  7628. { Properties }
  7629. property Count: Integer read GetCount;
  7630. property Factors[const Index: Integer]: Single read GetFactor write SetFactor;
  7631. property Positions[const Index: Integer]: Single read GetPosition write SetPosition;
  7632. property FactorPtr: PSingle read GetFactorPtr;
  7633. property PositionPtr: PSingle read GetPositionPtr;
  7634. end;
  7635.  
  7636. TGPBlend = class(TInterfacedObject, IGPBlend)
  7637. private
  7638. FFactors: array of Single;
  7639. FPositions: array of Single;
  7640. private
  7641. { IGPBlend }
  7642. function GetCount: Integer;
  7643. function GetFactor(const Index: Integer): Single;
  7644. procedure SetFactor(const Index: Integer; const Value: Single);
  7645. function GetPosition(const Index: Integer): Single;
  7646. procedure SetPosition(const Index: Integer; const Value: Single);
  7647. function GetFactorPtr: PSingle;
  7648. function GetPositionPtr: PSingle;
  7649. private
  7650. constructor Create(const ACount: Integer); overload;
  7651. public
  7652. constructor Create(const AFactors, APositions: array of Single); overload;
  7653. end;
  7654.  
  7655. IGPColorBlend = interface
  7656. ['{5F3C0BE0-BFED-4275-A21B-7FF97687F271}']
  7657. { Property access methods }
  7658. function GetCount: Integer;
  7659. function GetColor(const Index: Integer): TGPColor;
  7660. procedure SetColor(const Index: Integer; const Value: TGPColor);
  7661. function GetPosition(const Index: Integer): Single;
  7662. procedure SetPosition(const Index: Integer; const Value: Single);
  7663. function GetColorPtr: PGPColor;
  7664. function GetPositionPtr: PSingle;
  7665.  
  7666. { Properties }
  7667. property Count: Integer read GetCount;
  7668. property Colors[const Index: Integer]: TGPColor read GetColor write SetColor;
  7669. property Positions[const Index: Integer]: Single read GetPosition write SetPosition;
  7670. property ColorPtr: PGPColor read GetColorPtr;
  7671. property PositionPtr: PSingle read GetPositionPtr;
  7672. end;
  7673.  
  7674. TGPColorBlend = class(TInterfacedObject, IGPColorBlend)
  7675. private
  7676. FColors: array of TGPColor;
  7677. FPositions: array of Single;
  7678. private
  7679. { IGPColorBlend }
  7680. function GetCount: Integer;
  7681. function GetColor(const Index: Integer): TGPColor;
  7682. procedure SetColor(const Index: Integer; const Value: TGPColor);
  7683. function GetPosition(const Index: Integer): Single;
  7684. procedure SetPosition(const Index: Integer; const Value: Single);
  7685. function GetColorPtr: PGPColor;
  7686. function GetPositionPtr: PSingle;
  7687. private
  7688. constructor Create(const ACount: Integer); overload;
  7689. public
  7690. constructor Create(const AColors: array of TGPColor;
  7691. const APositions: array of Single); overload;
  7692. end;
  7693.  
  7694. IGPLinearGradientBrush = interface(IGPBrush)
  7695. ['{85ECE5BB-FE0F-4CD9-9094-6608696C8475}']
  7696. { Property access methods }
  7697. function GetLinearColors: TGPLinearColors;
  7698. procedure SetLinearColors(const Value: TGPLinearColors);
  7699. function GetRectangle: TGPRectF; overload;
  7700. function GetGammaCorrection: Boolean;
  7701. procedure SetGammaCorrection(const Value: Boolean);
  7702. function GetBlend: IGPBlend;
  7703. procedure SetBlend(const Value: IGPBlend);
  7704. function GetInterpolationColors: IGPColorBlend;
  7705. procedure SetInterpolationColors(const Value: IGPColorBlend);
  7706. function GetTransform: IGPMatrix;
  7707. procedure SetTransform(const Value: IGPMatrix);
  7708. function GetWrapMode: TGPWrapMode;
  7709. procedure SetWrapMode(const Value: TGPWrapMode);
  7710.  
  7711. { Methods }
  7712. procedure GetRectangle(out Rect: TGPRectF); overload;
  7713. procedure GetRectangle(out Rect: TGPRect); overload;
  7714. procedure SetBlendBellShape(const Focus: Single; const Scale: Single = 1);
  7715. procedure SetBlendTriangularShape(const Focus: Single; const Scale: Single = 1);
  7716. procedure ResetTransform;
  7717. procedure MultiplyTransform(const Matrix: IGPMatrix;
  7718. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7719. procedure TranslateTransform(const DX, DY: Single;
  7720. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7721. procedure ScaleTransform(const SX, SY: Single;
  7722. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7723. procedure RotateTransform(const Angle: Single;
  7724. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7725.  
  7726. { Properties }
  7727. property LinearColors: TGPLinearColors read GetLinearColors write SetLinearColors;
  7728. property Rectangle: TGPRectF read GetRectangle;
  7729. property GammaCorrection: Boolean read GetGammaCorrection write SetGammaCorrection;
  7730. property Blend: IGPBlend read GetBlend write SetBlend;
  7731. property InterpolationColors: IGPColorBlend read GetInterpolationColors write SetInterpolationColors;
  7732. property Transform: IGPMatrix read GetTransform write SetTransform;
  7733. property WrapMode: TGPWrapMode read GetWrapMode write SetWrapMode;
  7734. end;
  7735.  
  7736. TGPLinearGradientBrush = class(TGPBrush, IGPLinearGradientBrush)
  7737. private
  7738. { IGPLinearGradientBrush }
  7739. function GetLinearColors: TGPLinearColors;
  7740. procedure SetLinearColors(const Value: TGPLinearColors);
  7741. function GetRectangle: TGPRectF; overload;
  7742. function GetGammaCorrection: Boolean;
  7743. procedure SetGammaCorrection(const Value: Boolean);
  7744. function GetBlend: IGPBlend;
  7745. procedure SetBlend(const Value: IGPBlend);
  7746. function GetInterpolationColors: IGPColorBlend;
  7747. procedure SetInterpolationColors(const Value: IGPColorBlend);
  7748. function GetTransform: IGPMatrix;
  7749. procedure SetTransform(const Value: IGPMatrix);
  7750. function GetWrapMode: TGPWrapMode;
  7751. procedure SetWrapMode(const Value: TGPWrapMode);
  7752.  
  7753. procedure GetRectangle(out Rect: TGPRectF); overload;
  7754. procedure GetRectangle(out Rect: TGPRect); overload;
  7755. procedure SetBlendBellShape(const Focus: Single; const Scale: Single = 1);
  7756. procedure SetBlendTriangularShape(const Focus: Single; const Scale: Single = 1);
  7757. procedure ResetTransform;
  7758. procedure MultiplyTransform(const Matrix: IGPMatrix;
  7759. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7760. procedure TranslateTransform(const DX, DY: Single;
  7761. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7762. procedure ScaleTransform(const SX, SY: Single;
  7763. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7764. procedure RotateTransform(const Angle: Single;
  7765. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7766. private
  7767. constructor Create; overload;
  7768. public
  7769. constructor Create(const Point1, Point2: TGPPointF;
  7770. const Color1, Color2: TGPColor); overload;
  7771. constructor Create(const Point1, Point2: TGPPoint;
  7772. const Color1, Color2: TGPColor); overload;
  7773. constructor Create(const Rect: TGPRectF; const Color1, Color2: TGPColor;
  7774. const Mode: TGPLinearGradientMode); overload;
  7775. constructor Create(const Rect: TGPRect; const Color1, Color2: TGPColor;
  7776. const Mode: TGPLinearGradientMode); overload;
  7777. constructor Create(const Rect: TGPRectF; const Color1, Color2: TGPColor;
  7778. const Angle: Single; const IsAngleScalable: Boolean = False); overload;
  7779. constructor Create(const Rect: TGPRect; const Color1, Color2: TGPColor;
  7780. const Angle: Single; const IsAngleScalable: Boolean = False); overload;
  7781. end;
  7782.  
  7783. IGPHatchBrush = interface(IGPBrush)
  7784. ['{5EED3025-99F4-435D-A854-FDF2B0A08FBD}']
  7785. { Property access methods }
  7786. function GetHatchStyle: TGPHatchStyle;
  7787. function GetForegroundColor: TGPColor;
  7788. function GetBackgroundColor: TGPColor;
  7789.  
  7790. { Properties }
  7791. property HatchStyle: TGPHatchStyle read GetHatchStyle;
  7792. property ForegroundColor: TGPColor read GetForegroundColor;
  7793. property BackgroundColor: TGPColor read GetBackgroundColor;
  7794. end;
  7795.  
  7796. TGPHatchBrush = class(TGPBrush, IGPHatchBrush)
  7797. private
  7798. { IGPHatchBrush }
  7799. function GetHatchStyle: TGPHatchStyle;
  7800. function GetForegroundColor: TGPColor;
  7801. function GetBackgroundColor: TGPColor;
  7802. private
  7803. constructor Create; overload;
  7804. public
  7805. constructor Create(const HatchStyle: TGPHatchStyle; const ForeColor,
  7806. BackColor: TGPColor); overload;
  7807. constructor Create(const HatchStyle: TGPHatchStyle; const ForeColor: TGPColor); overload;
  7808. end;
  7809.  
  7810. {$ENDREGION 'GdiplusBrush.h'}
  7811.  
  7812. {$REGION 'GdiplusPen.h'}
  7813.  
  7814. (*****************************************************************************
  7815. * GdiplusPen.h
  7816. * GDI+ Pen class
  7817. *****************************************************************************)
  7818.  
  7819. IGPDashPattern = IGPArray<Single>;
  7820. IGPCompoundArray = IGPArray<Single>;
  7821.  
  7822. IGPPen = interface(IGdiPlusBase)
  7823. ['{5F88EBBC-6104-44AC-BDCE-691DBEF21607}']
  7824. { Property access methods }
  7825. function GetWidth: Single;
  7826. procedure SetWidth(const Value: Single);
  7827. function GetStartCap: TGPLineCap;
  7828. procedure SetStartCap(const Value: TGPLineCap);
  7829. function GetEndCap: TGPLineCap;
  7830. procedure SetEndCap(const Value: TGPLineCap);
  7831. function GetDashCap: TGPDashCap;
  7832. procedure SetDashCap(const Value: TGPDashCap);
  7833. function GetLineJoin: TGPLineJoin;
  7834. procedure SetLineJoin(const Value: TGPLineJoin);
  7835. function GetCustomStartCap: IGPCustomLineCap;
  7836. procedure SetCustomStartCap(const Value: IGPCustomLineCap);
  7837. function GetCustomEndCap: IGPCustomLineCap;
  7838. procedure SetCustomEndCap(const Value: IGPCustomLineCap);
  7839. function GetMiterLimit: Single;
  7840. procedure SetMiterLimit(const Value: Single);
  7841. function GetAlignment: TGPPenAlignment;
  7842. procedure SetAlignment(const Value: TGPPenAlignment);
  7843. function GetTransform: IGPMatrix;
  7844. procedure SetTransform(const Value: IGPMatrix);
  7845. function GetPenType: TGPPenType;
  7846. function GetColor: TGPColor;
  7847. procedure SetColor(const Value: TGPColor);
  7848. function GetBrush: IGPBrush;
  7849. procedure SetBrush(const Value: IGPBrush);
  7850. function GetDashStyle: TGPDashStyle;
  7851. procedure SetDashStyle(const Value: TGPDashStyle);
  7852. function GetDashOffset: Single;
  7853. procedure SetDashOffset(const Value: Single);
  7854. function GetDashPattern: IGPDashPattern;
  7855. procedure SetDashPatternInternal(const Value: IGPDashPattern);
  7856. function GetCompoundArray: IGPCompoundArray;
  7857. procedure SetCompoundArray(const Value: IGPCompoundArray);
  7858.  
  7859. { Methods }
  7860. function Clone: IGPPen;
  7861. procedure SetLineCap(const StartCap, EndCap: TGPLineCap;
  7862. const DashCap: TGPDashCap);
  7863. procedure ResetTransform;
  7864. procedure MultiplyTransform(const Matrix: IGPMatrix;
  7865. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7866. procedure TranslateTransform(const DX, DY: Single;
  7867. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7868. procedure ScaleTransform(const SX, SY: Single;
  7869. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7870. procedure RotateTransform(const Angle: Single;
  7871. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7872. procedure SetDashPattern(const Pattern: array of Single);
  7873.  
  7874. { Properties }
  7875. property Width: Single read GetWidth write SetWidth;
  7876. property StartCap: TGPLineCap read GetStartCap write SetStartCap;
  7877. property EndCap: TGPLineCap read GetEndCap write SetEndCap;
  7878. property DashCap: TGPDashCap read GetDashCap write SetDashCap;
  7879. property LineJoin: TGPLineJoin read GetLineJoin write SetLineJoin;
  7880. property CustomStartCap: IGPCustomLineCap read GetCustomStartCap write SetCustomStartCap;
  7881. property CustomEndCap: IGPCustomLineCap read GetCustomEndCap write SetCustomEndCap;
  7882. property MiterLimit: Single read GetMiterLimit write SetMiterLimit;
  7883. property Alignment: TGPPenAlignment read GetAlignment write SetAlignment;
  7884. property Transform: IGPMatrix read GetTransform write SetTransform;
  7885. property PenType: TGPPenType read GetPenType;
  7886. property Color: TGPColor read GetColor write SetColor;
  7887. property Brush: IGPBrush read GetBrush write SetBrush;
  7888. property DashStyle: TGPDashStyle read GetDashStyle write SetDashStyle;
  7889. property DashOffset: Single read GetDashOffset write SetDashOffset;
  7890. property DashPattern: IGPDashPattern read GetDashPattern write SetDashPatternInternal;
  7891. property CompoundArray: IGPCompoundArray read GetCompoundArray write SetCompoundArray;
  7892. end;
  7893.  
  7894. TGPPen = class(TGdiplusBase, IGPPen)
  7895. private
  7896. { IGPPen }
  7897. function GetWidth: Single;
  7898. procedure SetWidth(const Value: Single);
  7899. function GetStartCap: TGPLineCap;
  7900. procedure SetStartCap(const Value: TGPLineCap);
  7901. function GetEndCap: TGPLineCap;
  7902. procedure SetEndCap(const Value: TGPLineCap);
  7903. function GetDashCap: TGPDashCap;
  7904. procedure SetDashCap(const Value: TGPDashCap);
  7905. function GetLineJoin: TGPLineJoin;
  7906. procedure SetLineJoin(const Value: TGPLineJoin);
  7907. function GetCustomStartCap: IGPCustomLineCap;
  7908. procedure SetCustomStartCap(const Value: IGPCustomLineCap);
  7909. function GetCustomEndCap: IGPCustomLineCap;
  7910. procedure SetCustomEndCap(const Value: IGPCustomLineCap);
  7911. function GetMiterLimit: Single;
  7912. procedure SetMiterLimit(const Value: Single);
  7913. function GetAlignment: TGPPenAlignment;
  7914. procedure SetAlignment(const Value: TGPPenAlignment);
  7915. function GetTransform: IGPMatrix;
  7916. procedure SetTransform(const Value: IGPMatrix);
  7917. function GetPenType: TGPPenType;
  7918. function GetColor: TGPColor;
  7919. procedure SetColor(const Value: TGPColor);
  7920. function GetBrush: IGPBrush;
  7921. procedure SetBrush(const Value: IGPBrush);
  7922. function GetDashStyle: TGPDashStyle;
  7923. procedure SetDashStyle(const Value: TGPDashStyle);
  7924. function GetDashOffset: Single;
  7925. procedure SetDashOffset(const Value: Single);
  7926. function GetDashPattern: IGPDashPattern;
  7927. procedure SetDashPatternInternal(const Value: IGPDashPattern);
  7928. function GetCompoundArray: IGPCompoundArray;
  7929. procedure SetCompoundArray(const Value: IGPCompoundArray);
  7930.  
  7931. function Clone: IGPPen;
  7932. procedure SetLineCap(const StartCap, EndCap: TGPLineCap;
  7933. const DashCap: TGPDashCap);
  7934. procedure ResetTransform;
  7935. procedure MultiplyTransform(const Matrix: IGPMatrix;
  7936. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7937. procedure TranslateTransform(const DX, DY: Single;
  7938. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7939. procedure ScaleTransform(const SX, SY: Single;
  7940. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7941. procedure RotateTransform(const Angle: Single;
  7942. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  7943. procedure SetDashPattern(const Pattern: array of Single);
  7944. private
  7945. constructor Create(const NativePen: GpPen); overload;
  7946. public
  7947. constructor Create(const Color: TGPColor; const Width: Single = 1); overload;
  7948. constructor Create(const Brush: IGPBrush; const Width: Single = 1); overload;
  7949. destructor Destroy; override;
  7950. end;
  7951.  
  7952. {$ENDREGION 'GdiplusPen.h'}
  7953.  
  7954. {$REGION 'GdiplusStringFormat.h'}
  7955.  
  7956. (*****************************************************************************
  7957. * GdiplusStringFormat.h
  7958. * GDI+ StringFormat class
  7959. *****************************************************************************)
  7960.  
  7961. IGPTabStops = IGPArray<Single>;
  7962. IGPCharacterRanges = IGPArray<TGPCharacterRange>;
  7963.  
  7964. IGPStringFormat = interface(IGdiPlusBase)
  7965. ['{15875A7E-A799-4460-AC3B-4C5A966319E8}']
  7966. { Property access methods }
  7967. function GetFormatFlags: TGPStringFormatFlags;
  7968. procedure SetFormatFlags(const Value: TGPStringFormatFlags);
  7969. function GetAlignment: TGPStringAlignment;
  7970. procedure SetAlignment(const Value: TGPStringAlignment);
  7971. function GetLineAlignment: TGPStringAlignment;
  7972. procedure SetLineAlignment(const Value: TGPStringAlignment);
  7973. function GetHotkeyPrefix: TGPHotkeyPrefix;
  7974. procedure SetHotkeyPrefix(const Value: TGPHotkeyPrefix);
  7975. function GetDigitSubstitutionLanguage: LangID;
  7976. function GetDigitSubstitutionMethod: TGPStringDigitSubstitute;
  7977. function GetTrimming: TGPStringTrimming;
  7978. procedure SetTrimming(const Value: TGPStringTrimming);
  7979. function GetMeasurableCharacterRangeCount: Integer;
  7980.  
  7981. { Methods }
  7982. function Clone: IGPStringFormat;
  7983. function GetTabStops(out FirstTabOffset: Single): IGPTabStops;
  7984. procedure SetTabStops(const FirstTabOffset: Single;
  7985. const TabStops: array of Single);
  7986. procedure SetDigitSubstitution(const Language: LangID;
  7987. const Substitute: TGPStringDigitSubstitute);
  7988. procedure SetMeasurableCharacterRanges(const Ranges: IGPCharacterRanges);
  7989.  
  7990. { Properties }
  7991. property FormatFlags: TGPStringFormatFlags read GetFormatFlags write SetFormatFlags;
  7992. property Alignment: TGPStringAlignment read GetAlignment write SetAlignment;
  7993. property LineAlignment: TGPStringAlignment read GetLineAlignment write SetLineAlignment;
  7994. property HotkeyPrefix: TGPHotkeyPrefix read GetHotkeyPrefix write SetHotkeyPrefix;
  7995. property DigitSubstitutionLanguage: LangID read GetDigitSubstitutionLanguage;
  7996. property DigitSubstitutionMethod: TGPStringDigitSubstitute read GetDigitSubstitutionMethod;
  7997. property Trimming: TGPStringTrimming read GetTrimming write SetTrimming;
  7998. property MeasurableCharacterRangeCount: Integer read GetMeasurableCharacterRangeCount;
  7999. end;
  8000.  
  8001. TGPStringFormat = class(TGdiplusBase, IGPStringFormat)
  8002. private
  8003. class var FGenericDefault: IGPStringFormat;
  8004. class var FGenericTypographic: IGPStringFormat;
  8005. private
  8006. { IGPStringFormat }
  8007. function GetFormatFlags: TGPStringFormatFlags;
  8008. procedure SetFormatFlags(const Value: TGPStringFormatFlags);
  8009. function GetAlignment: TGPStringAlignment;
  8010. procedure SetAlignment(const Value: TGPStringAlignment);
  8011. function GetLineAlignment: TGPStringAlignment;
  8012. procedure SetLineAlignment(const Value: TGPStringAlignment);
  8013. function GetHotkeyPrefix: TGPHotkeyPrefix;
  8014. procedure SetHotkeyPrefix(const Value: TGPHotkeyPrefix);
  8015. function GetDigitSubstitutionLanguage: LangID;
  8016. function GetDigitSubstitutionMethod: TGPStringDigitSubstitute;
  8017. function GetTrimming: TGPStringTrimming;
  8018. procedure SetTrimming(const Value: TGPStringTrimming);
  8019. function GetMeasurableCharacterRangeCount: Integer;
  8020.  
  8021. function Clone: IGPStringFormat;
  8022. function GetTabStops(out FirstTabOffset: Single): IGPTabStops;
  8023. procedure SetTabStops(const FirstTabOffset: Single;
  8024. const TabStops: array of Single);
  8025. procedure SetDigitSubstitution(const Language: LangID;
  8026. const Substitute: TGPStringDigitSubstitute);
  8027. procedure SetMeasurableCharacterRanges(const Ranges: IGPCharacterRanges);
  8028. private
  8029. constructor Create(const NativeFormat: GpStringFormat); overload;
  8030. public
  8031. constructor Create(const FormatFlags: TGPStringFormatFlags = [];
  8032. const Language: LangID = LANG_NEUTRAL); overload;
  8033. constructor Create(const Format: IGPStringFormat); overload;
  8034. destructor Destroy; override;
  8035.  
  8036. class function GenericDefault: IGPStringFormat; static;
  8037. class function GenericTypographic: IGPStringFormat; static;
  8038. end;
  8039. {$ENDREGION 'GdiplusStringFormat.h'}
  8040.  
  8041. {$REGION 'GdiplusPath.h'}
  8042.  
  8043. (*****************************************************************************
  8044. * GdiplusPath.h
  8045. * GDI+ Graphics Path class
  8046. *****************************************************************************)
  8047.  
  8048. IGPPathTypes = IGPArray<Byte>;
  8049. IGPPathPoints = IGPArray<TGPPointF>;
  8050. IGPPathPointsI = IGPArray<TGPPoint>;
  8051.  
  8052. IGPPathData = interface
  8053. ['{2FC67BFC-7013-4279-839A-1FCD71BD0909}']
  8054. { Property access methods }
  8055. function GetCount: Integer;
  8056. procedure SetCount(const Value: Integer);
  8057. function GetPoint(const Index: Integer): TGPPointF;
  8058. function GetType(const Index: Integer): Byte;
  8059. function GetPointPtr: PGPPointF;
  8060. function GetTypePtr: PByte;
  8061. function GetNativePathData: TGPNativePathData;
  8062.  
  8063. { Properties }
  8064. property Count: Integer read GetCount write SetCount;
  8065. property Points[const Index: Integer]: TGPPointF read GetPoint;
  8066. property Types[const Index: Integer]: Byte read GetType;
  8067. property PointPtr: PGPPointF read GetPointPtr;
  8068. property TypePtr: PByte read GetTypePtr;
  8069. property NativePathData: TGPNativePathData read GetNativePathData;
  8070. end;
  8071.  
  8072. TGPPathData = class(TInterfacedObject, IGPPathData)
  8073. private
  8074. FPoints: array of TGPPointF;
  8075. FTypes: array of Byte;
  8076. private
  8077. { IGPPathData }
  8078. function GetCount: Integer;
  8079. procedure SetCount(const Value: Integer);
  8080. function GetPoint(const Index: Integer): TGPPointF;
  8081. function GetType(const Index: Integer): Byte;
  8082. function GetPointPtr: PGPPointF;
  8083. function GetTypePtr: PByte;
  8084. function GetNativePathData: TGPNativePathData;
  8085. private
  8086. constructor Create(const ACount: Integer);
  8087. end;
  8088.  
  8089. IGPGraphicsPath = interface(IGdiPlusBase)
  8090. ['{9F117627-F765-41C0-96BD-44AA9165BF07}']
  8091. { Property access methods }
  8092. function GetFillMode: TGPFillMode;
  8093. procedure SetFillMode(const Value: TGPFillMode);
  8094. function GetPathData: IGPPathData;
  8095. function GetPointCount: Integer;
  8096. function GetPathTypes: IGPPathTypes;
  8097. function GetPathPoints: IGPPathPoints;
  8098. function GetPathPointsI: IGPPathPointsI;
  8099.  
  8100. { Methods }
  8101. function Clone: IGPGraphicsPath;
  8102. procedure Reset;
  8103. procedure StartFigure;
  8104. procedure CloseFigure;
  8105. procedure CloseAllFigures;
  8106. procedure SetMarker;
  8107. procedure ClearMarkers;
  8108. procedure Reverse;
  8109. function GetLastPoint: TGPPointF;
  8110.  
  8111. procedure AddLine(const Pt1, Pt2: TGPPointF); overload;
  8112. procedure AddLine(const X1, Y1, X2, Y2: Single); overload;
  8113. procedure AddLine(const Pt1, Pt2: TGPPoint); overload;
  8114. procedure AddLine(const X1, Y1, X2, Y2: Integer); overload;
  8115.  
  8116. procedure AddLines(const Points: array of TGPPointF); overload;
  8117. procedure AddLines(const Points: array of TGPPoint); overload;
  8118.  
  8119. procedure AddArc(const Rect: TGPRectF; const StartAngle, SweepAngle: Single); overload;
  8120. procedure AddArc(const X, Y, Width, Height, StartAngle, SweepAngle: Single); overload;
  8121. procedure AddArc(const Rect: TGPRect; const StartAngle, SweepAngle: Single); overload;
  8122. procedure AddArc(const X, Y, Width, Height: Integer;
  8123. const StartAngle, SweepAngle: Single); overload;
  8124.  
  8125. procedure AddBezier(const Pt1, Pt2, Pt3, Pt4: TGPPointF); overload;
  8126. procedure AddBezier(const X1, Y1, X2, Y2, X3, Y3, X4, Y4: Single); overload;
  8127. procedure AddBezier(const Pt1, Pt2, Pt3, Pt4: TGPPoint); overload;
  8128. procedure AddBezier(const X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer); overload;
  8129.  
  8130. procedure AddBeziers(const Points: array of TGPPointF); overload;
  8131. procedure AddBeziers(const Points: array of TGPPoint); overload;
  8132.  
  8133. procedure AddCurve(const Points: array of TGPPointF); overload;
  8134. procedure AddCurve(const Points: array of TGPPointF;
  8135. const Tension: Single); overload;
  8136. procedure AddCurve(const Points: array of TGPPointF;
  8137. const Offset, NumberOfSegments: Integer; const Tension: Single); overload;
  8138. procedure AddCurve(const Points: array of TGPPoint); overload;
  8139. procedure AddCurve(const Points: array of TGPPoint;
  8140. const Tension: Single); overload;
  8141. procedure AddCurve(const Points: array of TGPPoint;
  8142. const Offset, NumberOfSegments: Integer; const Tension: Single); overload;
  8143.  
  8144. procedure AddClosedCurve(const Points: array of TGPPointF); overload;
  8145. procedure AddClosedCurve(const Points: array of TGPPointF;
  8146. const Tension: Single); overload;
  8147. procedure AddClosedCurve(const Points: array of TGPPoint); overload;
  8148. procedure AddClosedCurve(const Points: array of TGPPoint;
  8149. const Tension: Single); overload;
  8150.  
  8151. procedure AddRectangle(const Rect: TGPRectF); overload;
  8152. procedure AddRectangle(const Rect: TGPRect); overload;
  8153.  
  8154. procedure AddRectangles(const Rects: array of TGPRectF); overload;
  8155. procedure AddRectangles(const Rects: array of TGPRect); overload;
  8156.  
  8157. procedure AddEllipse(const Rect: TGPRectF); overload;
  8158. procedure AddEllipse(const X, Y, Width, Height: Single); overload;
  8159. procedure AddEllipse(const Rect: TGPRect); overload;
  8160. procedure AddEllipse(const X, Y, Width, Height: Integer); overload;
  8161.  
  8162. procedure AddPie(const Rect: TGPRectF; const StartAngle, SweepAngle: Single); overload;
  8163. procedure AddPie(const X, Y, Width, Height, StartAngle, SweepAngle: Single); overload;
  8164. procedure AddPie(const Rect: TGPRect; const StartAngle, SweepAngle: Single); overload;
  8165. procedure AddPie(const X, Y, Width, Height: Integer;
  8166. const StartAngle, SweepAngle: Single); overload;
  8167.  
  8168. procedure AddPolygon(const Points: array of TGPPointF); overload;
  8169. procedure AddPolygon(const Points: array of TGPPoint); overload;
  8170.  
  8171. procedure AddPath(const AddingPath: IGPGraphicsPath; const Connect: Boolean);
  8172.  
  8173. procedure AddString(const Str: String; const Family: IGPFontFamily;
  8174. const Style: TGPFontStyle; const EmSize: Single; const Origin: TGPPointF;
  8175. const Format: IGPStringFormat); overload;
  8176. procedure AddString(const Str: String; const Family: IGPFontFamily;
  8177. const Style: TGPFontStyle; const EmSize: Single; const LayoutRect: TGPRectF;
  8178. const Format: IGPStringFormat); overload;
  8179. procedure AddString(const Str: String; const Family: IGPFontFamily;
  8180. const Style: TGPFontStyle; const EmSize: Single; const Origin: TGPPoint;
  8181. const Format: IGPStringFormat); overload;
  8182. procedure AddString(const Str: String; const Family: IGPFontFamily;
  8183. const Style: TGPFontStyle; const EmSize: Single; const LayoutRect: TGPRect;
  8184. const Format: IGPStringFormat); overload;
  8185.  
  8186. procedure Transform(const Matrix: IGPMatrix);
  8187. procedure GetBounds(out Bounds: TGPRectF; const Matrix: IGPMatrix = nil;
  8188. const Pen: IGPPen = nil); overload;
  8189. procedure GetBounds(out Bounds: TGPRect; const Matrix: IGPMatrix = nil;
  8190. const Pen: IGPPen = nil); overload;
  8191. procedure Flatten(const Matrix: IGPMatrix = nil;
  8192. const Flatness: Single = FlatnessDefault);
  8193. procedure Widen(const Pen: IGPPen; const Matrix: IGPMatrix = nil;
  8194. const Flatness: Single = FlatnessDefault);
  8195. procedure Outline(const Matrix: IGPMatrix = nil;
  8196. const Flatness: Single = FlatnessDefault);
  8197. procedure Warp(const DestPoints: array of TGPPointF; const SrcRect: TGPRectF;
  8198. const Matrix: IGPMatrix = nil; const WarpMode: TGPWarpMode = WarpModePerspective;
  8199. const Flatness: Single = FlatnessDefault);
  8200.  
  8201. function IsVisible(const Point: TGPPointF; const G: IGPGraphics = nil): Boolean; overload;
  8202. function IsVisible(const X, Y: Single; const G: IGPGraphics = nil): Boolean; overload;
  8203. function IsVisible(const Point: TGPPoint; const G: IGPGraphics = nil): Boolean; overload;
  8204. function IsVisible(const X, Y: Integer; const G: IGPGraphics = nil): Boolean; overload;
  8205.  
  8206. function IsOutlineVisible(const Point: TGPPointF; const Pen: IGPPen;
  8207. const G: IGPGraphics = nil): Boolean; overload;
  8208. function IsOutlineVisible(const X, Y: Single; const Pen: IGPPen;
  8209. const G: IGPGraphics = nil): Boolean; overload;
  8210. function IsOutlineVisible(const Point: TGPPoint; const Pen: IGPPen;
  8211. const G: IGPGraphics = nil): Boolean; overload;
  8212. function IsOutlineVisible(const X, Y: Integer; const Pen: IGPPen;
  8213. const G: IGPGraphics = nil): Boolean; overload;
  8214.  
  8215. { Properties }
  8216. property FillMode: TGPFillMode read GetFillMode write SetFillMode;
  8217. property PathData: IGPPathData read GetPathData;
  8218. property PointCount: Integer read GetPointCount;
  8219. property PathTypes: IGPPathTypes read GetPathTypes;
  8220. property PathPoints: IGPPathPoints read GetPathPoints;
  8221. property PathPointsI: IGPPathPointsI read GetPathPointsI;
  8222. end;
  8223.  
  8224. TGPGraphicsPath = class(TGdiplusBase, IGPGraphicsPath)
  8225. private
  8226. { IGPGraphicsPath }
  8227. function GetFillMode: TGPFillMode;
  8228. procedure SetFillMode(const Value: TGPFillMode);
  8229. function GetPathData: IGPPathData;
  8230. function GetPointCount: Integer;
  8231. function GetPathTypes: IGPPathTypes;
  8232. function GetPathPoints: IGPPathPoints;
  8233. function GetPathPointsI: IGPPathPointsI;
  8234.  
  8235. function Clone: IGPGraphicsPath;
  8236. procedure Reset;
  8237. procedure StartFigure;
  8238. procedure CloseFigure;
  8239. procedure CloseAllFigures;
  8240. procedure SetMarker;
  8241. procedure ClearMarkers;
  8242. procedure Reverse;
  8243. function GetLastPoint: TGPPointF;
  8244. procedure AddLine(const Pt1, Pt2: TGPPointF); overload;
  8245. procedure AddLine(const X1, Y1, X2, Y2: Single); overload;
  8246. procedure AddLine(const Pt1, Pt2: TGPPoint); overload;
  8247. procedure AddLine(const X1, Y1, X2, Y2: Integer); overload;
  8248. procedure AddLines(const Points: array of TGPPointF); overload;
  8249. procedure AddLines(const Points: array of TGPPoint); overload;
  8250. procedure AddArc(const Rect: TGPRectF; const StartAngle, SweepAngle: Single); overload;
  8251. procedure AddArc(const X, Y, Width, Height, StartAngle, SweepAngle: Single); overload;
  8252. procedure AddArc(const Rect: TGPRect; const StartAngle, SweepAngle: Single); overload;
  8253. procedure AddArc(const X, Y, Width, Height: Integer;
  8254. const StartAngle, SweepAngle: Single); overload;
  8255. procedure AddBezier(const Pt1, Pt2, Pt3, Pt4: TGPPointF); overload;
  8256. procedure AddBezier(const X1, Y1, X2, Y2, X3, Y3, X4, Y4: Single); overload;
  8257. procedure AddBezier(const Pt1, Pt2, Pt3, Pt4: TGPPoint); overload;
  8258. procedure AddBezier(const X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer); overload;
  8259. procedure AddBeziers(const Points: array of TGPPointF); overload;
  8260. procedure AddBeziers(const Points: array of TGPPoint); overload;
  8261. procedure AddCurve(const Points: array of TGPPointF); overload;
  8262. procedure AddCurve(const Points: array of TGPPointF;
  8263. const Tension: Single); overload;
  8264. procedure AddCurve(const Points: array of TGPPointF;
  8265. const Offset, NumberOfSegments: Integer; const Tension: Single); overload;
  8266. procedure AddCurve(const Points: array of TGPPoint); overload;
  8267. procedure AddCurve(const Points: array of TGPPoint;
  8268. const Tension: Single); overload;
  8269. procedure AddCurve(const Points: array of TGPPoint;
  8270. const Offset, NumberOfSegments: Integer; const Tension: Single); overload;
  8271. procedure AddClosedCurve(const Points: array of TGPPointF); overload;
  8272. procedure AddClosedCurve(const Points: array of TGPPointF;
  8273. const Tension: Single); overload;
  8274. procedure AddClosedCurve(const Points: array of TGPPoint); overload;
  8275. procedure AddClosedCurve(const Points: array of TGPPoint;
  8276. const Tension: Single); overload;
  8277. procedure AddRectangle(const Rect: TGPRectF); overload;
  8278. procedure AddRectangle(const Rect: TGPRect); overload;
  8279. procedure AddRectangles(const Rects: array of TGPRectF); overload;
  8280. procedure AddRectangles(const Rects: array of TGPRect); overload;
  8281. procedure AddEllipse(const Rect: TGPRectF); overload;
  8282. procedure AddEllipse(const X, Y, Width, Height: Single); overload;
  8283. procedure AddEllipse(const Rect: TGPRect); overload;
  8284. procedure AddEllipse(const X, Y, Width, Height: Integer); overload;
  8285. procedure AddPie(const Rect: TGPRectF; const StartAngle, SweepAngle: Single); overload;
  8286. procedure AddPie(const X, Y, Width, Height, StartAngle, SweepAngle: Single); overload;
  8287. procedure AddPie(const Rect: TGPRect; const StartAngle, SweepAngle: Single); overload;
  8288. procedure AddPie(const X, Y, Width, Height: Integer;
  8289. const StartAngle, SweepAngle: Single); overload;
  8290. procedure AddPolygon(const Points: array of TGPPointF); overload;
  8291. procedure AddPolygon(const Points: array of TGPPoint); overload;
  8292. procedure AddPath(const AddingPath: IGPGraphicsPath; const Connect: Boolean);
  8293. procedure AddString(const Str: String; const Family: IGPFontFamily;
  8294. const Style: TGPFontStyle; const EmSize: Single; const Origin: TGPPointF;
  8295. const Format: IGPStringFormat); overload;
  8296. procedure AddString(const Str: String; const Family: IGPFontFamily;
  8297. const Style: TGPFontStyle; const EmSize: Single; const LayoutRect: TGPRectF;
  8298. const Format: IGPStringFormat); overload;
  8299. procedure AddString(const Str: String; const Family: IGPFontFamily;
  8300. const Style: TGPFontStyle; const EmSize: Single; const Origin: TGPPoint;
  8301. const Format: IGPStringFormat); overload;
  8302. procedure AddString(const Str: String; const Family: IGPFontFamily;
  8303. const Style: TGPFontStyle; const EmSize: Single; const LayoutRect: TGPRect;
  8304. const Format: IGPStringFormat); overload;
  8305. procedure Transform(const Matrix: IGPMatrix);
  8306. procedure GetBounds(out Bounds: TGPRectF; const Matrix: IGPMatrix = nil;
  8307. const Pen: IGPPen = nil); overload;
  8308. procedure GetBounds(out Bounds: TGPRect; const Matrix: IGPMatrix = nil;
  8309. const Pen: IGPPen = nil); overload;
  8310. procedure Flatten(const Matrix: IGPMatrix = nil;
  8311. const Flatness: Single = FlatnessDefault);
  8312. procedure Widen(const Pen: IGPPen; const Matrix: IGPMatrix = nil;
  8313. const Flatness: Single = FlatnessDefault);
  8314. procedure Outline(const Matrix: IGPMatrix = nil;
  8315. const Flatness: Single = FlatnessDefault);
  8316. procedure Warp(const DestPoints: array of TGPPointF; const SrcRect: TGPRectF;
  8317. const Matrix: IGPMatrix = nil; const WarpMode: TGPWarpMode = WarpModePerspective;
  8318. const Flatness: Single = FlatnessDefault);
  8319. function IsVisible(const Point: TGPPointF; const G: IGPGraphics = nil): Boolean; overload;
  8320. function IsVisible(const X, Y: Single; const G: IGPGraphics = nil): Boolean; overload;
  8321. function IsVisible(const Point: TGPPoint; const G: IGPGraphics = nil): Boolean; overload;
  8322. function IsVisible(const X, Y: Integer; const G: IGPGraphics = nil): Boolean; overload;
  8323. function IsOutlineVisible(const Point: TGPPointF; const Pen: IGPPen;
  8324. const G: IGPGraphics = nil): Boolean; overload;
  8325. function IsOutlineVisible(const X, Y: Single; const Pen: IGPPen;
  8326. const G: IGPGraphics = nil): Boolean; overload;
  8327. function IsOutlineVisible(const Point: TGPPoint; const Pen: IGPPen;
  8328. const G: IGPGraphics = nil): Boolean; overload;
  8329. function IsOutlineVisible(const X, Y: Integer; const Pen: IGPPen;
  8330. const G: IGPGraphics = nil): Boolean; overload;
  8331. private
  8332. constructor Create(const NativePath: GpPath); overload;
  8333. public
  8334. constructor Create(const FillMode: TGPFillMode = FillModeAlternate); overload;
  8335. constructor Create(const Points: array of TGPPointF; const Types: array of Byte;
  8336. const FillMode: TGPFillMode = FillModeAlternate); overload;
  8337. constructor Create(const Points: array of TGPPoint; const Types: array of Byte;
  8338. const FillMode: TGPFillMode = FillModeAlternate); overload;
  8339. destructor Destroy; override;
  8340. end;
  8341.  
  8342. IGPGraphicsPathIterator = interface(IGdiPlusBase)
  8343. ['{4A37267A-F6EE-46C1-8D1D-08256ED3FCB8}']
  8344. { Property access methods }
  8345. function GetCount: Integer;
  8346. function GetSubpathCount: Integer;
  8347.  
  8348. { Methods }
  8349. function NextSubPath(out StartIndex, EndIndex: Integer;
  8350. out IsClosed: Boolean): Integer; overload;
  8351. function NextSubPath(const Path: IGPGraphicsPath;
  8352. out IsClosed: Boolean): Integer; overload;
  8353. function NextPathType(out PathType: Byte; out StartIndex,
  8354. EndIndex: Integer): Integer;
  8355. function NextMarker(out StartIndex, EndIndex: Integer): Integer; overload;
  8356. function NextMarker(const Path: IGPGraphicsPath): Integer; overload;
  8357. function HasCurve: Boolean;
  8358. procedure Rewind;
  8359. function Enumerate: IGPPathData;
  8360. function CopyData(const StartIndex, EndIndex: Integer): IGPPathData;
  8361.  
  8362. { Properties }
  8363. property Count: Integer read GetCount;
  8364. property SubpathCount: Integer read GetSubpathCount;
  8365. end;
  8366.  
  8367. TGPGraphicsPathIterator = class(TGdiplusBase, IGPGraphicsPathIterator)
  8368. private
  8369. { IGPGraphicsPathIterator }
  8370. function GetCount: Integer;
  8371. function GetSubpathCount: Integer;
  8372.  
  8373. function NextSubPath(out StartIndex, EndIndex: Integer;
  8374. out IsClosed: Boolean): Integer; overload;
  8375. function NextSubPath(const Path: IGPGraphicsPath;
  8376. out IsClosed: Boolean): Integer; overload;
  8377. function NextPathType(out PathType: Byte; out StartIndex,
  8378. EndIndex: Integer): Integer;
  8379. function NextMarker(out StartIndex, EndIndex: Integer): Integer; overload;
  8380. function NextMarker(const Path: IGPGraphicsPath): Integer; overload;
  8381. function HasCurve: Boolean;
  8382. procedure Rewind;
  8383. function Enumerate: IGPPathData;
  8384. function CopyData(const StartIndex, EndIndex: Integer): IGPPathData;
  8385. public
  8386. constructor Create(const Path: IGPGraphicsPath);
  8387. destructor Destroy; override;
  8388. end;
  8389.  
  8390. IGPColors = IGPArray<TGPColor>;
  8391.  
  8392. IGPPathGradientBrush = interface(IGPBrush)
  8393. ['{66013840-6B90-4179-B72A-031548138EBF}']
  8394. { Property access methods }
  8395. function GetCenterColor: TGPColor;
  8396. procedure SetCenterColor(const Value: TGPColor);
  8397. function GetPointCount: Integer;
  8398. function GetSurroundColors: IGPColors;
  8399. procedure SetSurroundColorsInternal(const Value: IGPColors);
  8400. function GetGraphicsPath: IGPGraphicsPath;
  8401. procedure SetGraphicsPath(const Value: IGPGraphicsPath);
  8402. function GetCenterPoint: TGPPointF;
  8403. procedure SetCenterPoint(const Value: TGPPointF);
  8404. function GetCenterPointI: TGPPoint;
  8405. procedure SetCenterPointI(const Value: TGPPoint);
  8406. function GetRectangle: TGPRectF;
  8407. function GetRectangleI: TGPRect;
  8408. function GetGammaCorrection: Boolean;
  8409. procedure SetGammaCorrection(const Value: Boolean);
  8410. function GetBlend: IGPBlend;
  8411. procedure SetBlend(const Value: IGPBlend);
  8412. function GetInterpolationColors: IGPColorBlend;
  8413. procedure SetInterpolationColors(const Value: IGPColorBlend);
  8414. function GetTransform: IGPMatrix;
  8415. procedure SetTransform(const Value: IGPMatrix);
  8416. function GetWrapMode: TGPWrapMode;
  8417. procedure SetWrapMode(const Value: TGPWrapMode);
  8418.  
  8419. { Methods }
  8420. procedure SetBlendBellShape(const Focus: Single; const Scale: Single = 1);
  8421. procedure SetBlendTriangularShape(const Focus: Single; const Scale: Single = 1);
  8422. procedure ResetTransform;
  8423. procedure MultiplyTransform(const Matrix: IGPMatrix;
  8424. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8425. procedure TranslateTransform(const DX, DY: Single;
  8426. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8427. procedure ScaleTransform(const SX, SY: Single;
  8428. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8429. procedure RotateTransform(const Angle: Single;
  8430. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8431. procedure GetFocusScales(out XScale, YScale: Single);
  8432. procedure SetFocusScales(const XScale, YScale: Single);
  8433. procedure SetSurroundColors(const Colors: array of TGPColor);
  8434.  
  8435. { Properties }
  8436. property CenterColor: TGPColor read GetCenterColor write SetCenterColor;
  8437. property PointCount: Integer read GetPointCount;
  8438. property SurroundColors: IGPColors read GetSurroundColors write SetSurroundColorsInternal;
  8439. property GraphicsPath: IGPGraphicsPath read GetGraphicsPath write SetGraphicsPath;
  8440. property CenterPoint: TGPPointF read GetCenterPoint write SetCenterPoint;
  8441. property CenterPointI: TGPPoint read GetCenterPointI write SetCenterPointI;
  8442. property Rectangle: TGPRectF read GetRectangle;
  8443. property RectangleI: TGPRect read GetRectangleI;
  8444. property GammaCorrection: Boolean read GetGammaCorrection write SetGammaCorrection;
  8445. property Blend: IGPBlend read GetBlend write SetBlend;
  8446. property InterpolationColors: IGPColorBlend read GetInterpolationColors write SetInterpolationColors;
  8447. property Transform: IGPMatrix read GetTransform write SetTransform;
  8448. property WrapMode: TGPWrapMode read GetWrapMode write SetWrapMode;
  8449. end;
  8450.  
  8451. TGPPathGradientBrush = class(TGPBrush, IGPPathGradientBrush)
  8452. private
  8453. { IGPPathGradientBrush }
  8454. function GetCenterColor: TGPColor;
  8455. procedure SetCenterColor(const Value: TGPColor);
  8456. function GetPointCount: Integer;
  8457. function GetSurroundColors: IGPColors;
  8458. procedure SetSurroundColorsInternal(const Value: IGPColors);
  8459. function GetGraphicsPath: IGPGraphicsPath;
  8460. procedure SetGraphicsPath(const Value: IGPGraphicsPath);
  8461. function GetCenterPoint: TGPPointF;
  8462. procedure SetCenterPoint(const Value: TGPPointF);
  8463. function GetCenterPointI: TGPPoint;
  8464. procedure SetCenterPointI(const Value: TGPPoint);
  8465. function GetRectangle: TGPRectF;
  8466. function GetRectangleI: TGPRect;
  8467. function GetGammaCorrection: Boolean;
  8468. procedure SetGammaCorrection(const Value: Boolean);
  8469. function GetBlend: IGPBlend;
  8470. procedure SetBlend(const Value: IGPBlend);
  8471. function GetInterpolationColors: IGPColorBlend;
  8472. procedure SetInterpolationColors(const Value: IGPColorBlend);
  8473. function GetTransform: IGPMatrix;
  8474. procedure SetTransform(const Value: IGPMatrix);
  8475. function GetWrapMode: TGPWrapMode;
  8476. procedure SetWrapMode(const Value: TGPWrapMode);
  8477.  
  8478. procedure SetBlendBellShape(const Focus: Single; const Scale: Single = 1);
  8479. procedure SetBlendTriangularShape(const Focus: Single; const Scale: Single = 1);
  8480. procedure ResetTransform;
  8481. procedure MultiplyTransform(const Matrix: IGPMatrix;
  8482. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8483. procedure TranslateTransform(const DX, DY: Single;
  8484. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8485. procedure ScaleTransform(const SX, SY: Single;
  8486. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8487. procedure RotateTransform(const Angle: Single;
  8488. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8489. procedure GetFocusScales(out XScale, YScale: Single);
  8490. procedure SetFocusScales(const XScale, YScale: Single);
  8491. procedure SetSurroundColors(const Colors: array of TGPColor);
  8492. public
  8493. constructor Create(const Points: array of TGPPointF;
  8494. const WrapMode: TGPWrapMode = WrapModeClamp); overload;
  8495. constructor Create(const Points: array of TGPPoint;
  8496. const WrapMode: TGPWrapMode = WrapModeClamp); overload;
  8497. constructor Create(const Path: IGPGraphicsPath); overload;
  8498. end;
  8499. {$ENDREGION 'GdiplusPath.h'}
  8500.  
  8501. {$REGION 'GdiplusGraphics.h'}
  8502.  
  8503. (*****************************************************************************
  8504. * GdiplusGraphics.h
  8505. * GDI+ Graphics class
  8506. *****************************************************************************)
  8507.  
  8508. IGPRegions = IGPArray<IGPRegion>;
  8509.  
  8510. IGPGraphics = interface(IGdiPlusBase)
  8511. ['{57F85BA4-CB01-4466-8441-948D03588F54}']
  8512. { Property access methods }
  8513. function GetRenderingOrigin: TGPPoint; overload;
  8514. procedure SetRenderingOrigin(const Value: TGPPoint); overload;
  8515. function GetCompositingMode: TGPCompositingMode;
  8516. procedure SetCompositingMode(const Value: TGPCompositingMode);
  8517. function GetCompositingQuality: TGPCompositingQuality;
  8518. procedure SetCompositingQuality(const Value: TGPCompositingQuality);
  8519. function GetTextRenderingHint: TGPTextRenderingHint;
  8520. procedure SetTextRenderingHint(const Value: TGPTextRenderingHint);
  8521. function GetTextContrast: Integer;
  8522. procedure SetTextContrast(const Value: Integer);
  8523. function GetInterpolationMode: TGPInterpolationMode;
  8524. procedure SetInterpolationMode(const Value: TGPInterpolationMode);
  8525. function GetSmoothingMode: TGPSmoothingMode;
  8526. procedure SetSmoothingMode(const Value: TGPSmoothingMode);
  8527. function GetPixelOffsetMode: TGPPixelOffsetMode;
  8528. procedure SetPixelOffsetMode(const Value: TGPPixelOffsetMode);
  8529. function GetTransform: IGPMatrix;
  8530. procedure SetTransform(const Value: IGPMatrix);
  8531. function GetPageUnit: TGPUnit;
  8532. procedure SetPageUnit(const Value: TGPUnit);
  8533. function GetPageScale: Single;
  8534. procedure SetPageScale(const Value: Single);
  8535. function GetDpiX: Single;
  8536. function GetDpiY: Single;
  8537. function GetClip: IGPRegion;
  8538. procedure SetClipReplace(const Value: IGPRegion);
  8539. function GetClipBounds: TGPRectF;
  8540. function GetClipBoundsI: TGPRect;
  8541. function GetIsClipEmpty: Boolean;
  8542. function GetVisibleClipBounds: TGPRectF;
  8543. function GetVisibleClipBoundsI: TGPRect;
  8544. function GetIsVisibleClipEmpty: Boolean;
  8545.  
  8546. { Methods }
  8547. procedure Flush(const Intention: TGPFlushIntention = FlushIntentionFlush);
  8548. function GetHDC: HDC;
  8549. procedure ReleaseHDC(const DC: HDC);
  8550. procedure GetRenderingOrigin(out X, Y: Integer); overload;
  8551. procedure SetRenderingOrigin(const X, Y: Integer); overload;
  8552. {$IF (GDIPVER >= $0110)}
  8553. procedure SetAbort(const IAbort: TGdiplusAbort);
  8554. {$IFEND}
  8555. procedure ResetTransform;
  8556. procedure MultiplyTransform(const Matrix: IGPMatrix;
  8557. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8558. procedure TranslateTransform(const DX, DY: Single;
  8559. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8560. procedure ScaleTransform(const SX, SY: Single;
  8561. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8562. procedure RotateTransform(const Angle: Single;
  8563. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8564. procedure TransformPoints(const DestSpace, SrcSpace: TGPCoordinateSpace;
  8565. const Points: array of TGPPointF); overload;
  8566. procedure TransformPoints(const DestSpace, SrcSpace: TGPCoordinateSpace;
  8567. const Points: array of TGPPoint); overload;
  8568. function GetNearestColor(const Color: TGPColor): TGPColor;
  8569.  
  8570. procedure DrawLine(const Pen: IGPPen; const Pt1, Pt2: TGPPointF); overload;
  8571. procedure DrawLine(const Pen: IGPPen; const X1, Y1, X2, Y2: Single); overload;
  8572. procedure DrawLine(const Pen: IGPPen; const Pt1, Pt2: TGPPoint); overload;
  8573. procedure DrawLine(const Pen: IGPPen; const X1, Y1, X2, Y2: Integer); overload;
  8574.  
  8575. procedure DrawLines(const Pen: IGPPen; const Points: array of TGPPointF); overload;
  8576. procedure DrawLines(const Pen: IGPPen; const Points: array of TGPPoint); overload;
  8577.  
  8578. procedure DrawArc(const Pen: IGPPen; const Rect: TGPRectF; const StartAngle,
  8579. SweepAngle: Single); overload;
  8580. procedure DrawArc(const Pen: IGPPen; const X, Y, Width, Height, StartAngle,
  8581. SweepAngle: Single); overload;
  8582. procedure DrawArc(const Pen: IGPPen; const Rect: TGPRect; const StartAngle,
  8583. SweepAngle: Single); overload;
  8584. procedure DrawArc(const Pen: IGPPen; const X, Y, Width, Height: Integer;
  8585. const StartAngle, SweepAngle: Single); overload;
  8586.  
  8587. procedure DrawBezier(const Pen: IGPPen; const Pt1, Pt2, Pt3, Pt4: TGPPointF); overload;
  8588. procedure DrawBezier(const Pen: IGPPen; const X1, Y1, X2, Y2, X3, Y3, X4, Y4: Single); overload;
  8589. procedure DrawBezier(const Pen: IGPPen; const Pt1, Pt2, Pt3, Pt4: TGPPoint); overload;
  8590. procedure DrawBezier(const Pen: IGPPen; const X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer); overload;
  8591.  
  8592. procedure DrawBeziers(const Pen: IGPPen; const Points: array of TGPPointF); overload;
  8593. procedure DrawBeziers(const Pen: IGPPen; const Points: array of TGPPoint); overload;
  8594.  
  8595. procedure DrawRectangle(const Pen: IGPPen; const Rect: TGPRectF); overload;
  8596. procedure DrawRectangle(const Pen: IGPPen; const Rect: TGPRect); overload;
  8597. procedure DrawRectangle(const Pen: IGPPen; const X, Y, Width, Height: Single); overload;
  8598. procedure DrawRectangle(const Pen: IGPPen; const X, Y, Width, Height: Integer); overload;
  8599.  
  8600. procedure DrawRectangles(const Pen: IGPPen; const Rects: array of TGPRectF); overload;
  8601. procedure DrawRectangles(const Pen: IGPPen; const Rects: array of TGPRect); overload;
  8602.  
  8603. procedure DrawEllipse(const Pen: IGPPen; const Rect: TGPRectF); overload;
  8604. procedure DrawEllipse(const Pen: IGPPen; const X, Y, Width, Height: Single); overload;
  8605. procedure DrawEllipse(const Pen: IGPPen; const Rect: TGPRect); overload;
  8606. procedure DrawEllipse(const Pen: IGPPen; const X, Y, Width, Height: Integer); overload;
  8607.  
  8608. procedure DrawPie(const Pen: IGPPen; const Rect: TGPRectF;
  8609. const StartAngle, SweepAngle: Single); overload;
  8610. procedure DrawPie(const Pen: IGPPen; const X, Y, Width, Height,
  8611. StartAngle, SweepAngle: Single); overload;
  8612. procedure DrawPie(const Pen: IGPPen; const Rect: TGPRect;
  8613. const StartAngle, SweepAngle: Single); overload;
  8614. procedure DrawPie(const Pen: IGPPen; const X, Y, Width, Height: Integer;
  8615. const StartAngle, SweepAngle: Single); overload;
  8616.  
  8617. procedure DrawPolygon(const Pen: IGPPen; const Points: array of TGPPointF); overload;
  8618. procedure DrawPolygon(const Pen: IGPPen; const Points: array of TGPPoint); overload;
  8619.  
  8620. procedure DrawPath(const Pen: IGPPen; const Path: IGPGraphicsPath);
  8621.  
  8622. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPointF); overload;
  8623. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPointF;
  8624. const Tension: Single); overload;
  8625. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPointF;
  8626. const Offset, NumberOfSegments: Integer; const Tension: Single); overload;
  8627. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPoint); overload;
  8628. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPoint;
  8629. const Tension: Single); overload;
  8630. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPoint;
  8631. const Offset, NumberOfSegments: Integer; const Tension: Single); overload;
  8632.  
  8633. procedure DrawClosedCurve(const Pen: IGPPen; const Points: array of TGPPointF); overload;
  8634. procedure DrawClosedCurve(const Pen: IGPPen; const Points: array of TGPPointF;
  8635. const Tension: Single); overload;
  8636. procedure DrawClosedCurve(const Pen: IGPPen; const Points: array of TGPPoint); overload;
  8637. procedure DrawClosedCurve(const Pen: IGPPen; const Points: array of TGPPoint;
  8638. const Tension: Single); overload;
  8639.  
  8640. procedure Clear(const Color: TGPColor);
  8641.  
  8642. procedure FillRectangle(const Brush: IGPBrush; const Rect: TGPRectF); overload;
  8643. procedure FillRectangle(const Brush: IGPBrush; const Rect: TGPRect); overload;
  8644. procedure FillRectangle(const Brush: IGPBrush; const X, Y, Width, Height: Single); overload;
  8645. procedure FillRectangle(const Brush: IGPBrush; const X, Y, Width, Height: Integer); overload;
  8646.  
  8647. procedure FillRectangles(const Brush: IGPBrush; const Rects: array of TGPRectF); overload;
  8648. procedure FillRectangles(const Brush: IGPBrush; const Rects: array of TGPRect); overload;
  8649.  
  8650. procedure FillPolygon(const Brush: IGPBrush; const Points: array of TGPPointF); overload;
  8651. procedure FillPolygon(const Brush: IGPBrush; const Points: array of TGPPoint); overload;
  8652. procedure FillPolygon(const Brush: IGPBrush; const Points: array of TGPPointF;
  8653. const FillMode: TGPFillMode); overload;
  8654. procedure FillPolygon(const Brush: IGPBrush; const Points: array of TGPPoint;
  8655. const FillMode: TGPFillMode); overload;
  8656.  
  8657. procedure FillEllipse(const Brush: IGPBrush; const Rect: TGPRectF); overload;
  8658. procedure FillEllipse(const Brush: IGPBrush; const X, Y, Width, Height: Single); overload;
  8659. procedure FillEllipse(const Brush: IGPBrush; const Rect: TGPRect); overload;
  8660. procedure FillEllipse(const Brush: IGPBrush; const X, Y, Width, Height: Integer); overload;
  8661.  
  8662. procedure FillPie(const Brush: IGPBrush; const Rect: TGPRectF;
  8663. const StartAngle, SweepAngle: Single); overload;
  8664. procedure FillPie(const Brush: IGPBrush; const X, Y, Width, Height,
  8665. StartAngle, SweepAngle: Single); overload;
  8666. procedure FillPie(const Brush: IGPBrush; const Rect: TGPRect;
  8667. const StartAngle, SweepAngle: Single); overload;
  8668. procedure FillPie(const Brush: IGPBrush; const X, Y, Width, Height: Integer;
  8669. const StartAngle, SweepAngle: Single); overload;
  8670.  
  8671. procedure FillPath(const Brush: IGPBrush; const Path: IGPGraphicsPath);
  8672.  
  8673. procedure FillClosedCurve(const Brush: IGPBrush; const Points: array of TGPPointF); overload;
  8674. procedure FillClosedCurve(const Brush: IGPBrush; const Points: array of TGPPointF;
  8675. const FillMode: TGPFillMode; const Tension: Single); overload;
  8676. procedure FillClosedCurve(const Brush: IGPBrush; const Points: array of TGPPoint); overload;
  8677. procedure FillClosedCurve(const Brush: IGPBrush; const Points: array of TGPPoint;
  8678. const FillMode: TGPFillMode; const Tension: Single); overload;
  8679.  
  8680. procedure FillRegion(const Brush: IGPBrush; const Region: IGPRegion);
  8681.  
  8682. procedure DrawString(const Str: String; const Font: IGPFont;
  8683. const Origin: TGPPointF; const Brush: IGPBrush); overload;
  8684. procedure DrawString(const Str: String; const Font: IGPFont;
  8685. const LayoutRect: TGPRectF; const Format: IGPStringFormat;
  8686. const Brush: IGPBrush); overload;
  8687. procedure DrawString(const Str: String; const Font: IGPFont;
  8688. const Origin: TGPPointF; const Format: IGPStringFormat;
  8689. const Brush: IGPBrush); overload;
  8690.  
  8691. function MeasureString(const Str: String; const Font: IGPFont;
  8692. const LayoutRect: TGPRectF; const Format: IGPStringFormat): TGPRectF; overload;
  8693. function MeasureString(const Str: String; const Font: IGPFont;
  8694. const LayoutRect: TGPRectF; const Format: IGPStringFormat;
  8695. out CodepointsFitted, LinesFilled: Integer): TGPRectF; overload;
  8696. function MeasureString(const Str: String; const Font: IGPFont;
  8697. const LayoutRectSize: TGPSizeF; const Format: IGPStringFormat): TGPSizeF; overload;
  8698. function MeasureString(const Str: String; const Font: IGPFont;
  8699. const LayoutRectSize: TGPSizeF; const Format: IGPStringFormat;
  8700. out CodepointsFitted, LinesFilled: Integer): TGPSizeF; overload;
  8701. function MeasureString(const Str: String; const Font: IGPFont;
  8702. const Origin: TGPPointF; const Format: IGPStringFormat): TGPRectF; overload;
  8703. function MeasureString(const Str: String; const Font: IGPFont;
  8704. const LayoutRect: TGPRectF): TGPRectF; overload;
  8705. function MeasureString(const Str: String; const Font: IGPFont;
  8706. const Origin: TGPPointF): TGPRectF; overload;
  8707.  
  8708. function MeasureCharacterRanges(const Str: String; const Font: IGPFont;
  8709. const LayoutRect: TGPRectF; const Format: IGPStringFormat): IGPRegions;
  8710. procedure DrawDriverString(const Text: PUInt16; const Length: Integer;
  8711. const Font: IGPFont; const Brush: IGPBrush; const Positions: PGPPointF;
  8712. const Flags: TGPDriverStringOptions; const Matrix: IGPMatrix);
  8713. function MeasureDriverString(const Text: PUInt16; const Length: Integer;
  8714. const Font: IGPFont; const Positions: PGPPointF;
  8715. const Flags: TGPDriverStringOptions; const Matrix: IGPMatrix): TGPRectF;
  8716.  
  8717. procedure DrawCachedBitmap(const CachedBitmap: IGPCachedBitmap;
  8718. const X, Y: Integer);
  8719.  
  8720. procedure DrawImage(const Image: IGPImage; const Point: TGPPointF); overload;
  8721. procedure DrawImage(const Image: IGPImage; const X, Y: Single); overload;
  8722. procedure DrawImage(const Image: IGPImage; const Rect: TGPRectF); overload;
  8723. procedure DrawImage(const Image: IGPImage; const X, Y, Width, Height: Single); overload;
  8724. procedure DrawImage(const Image: IGPImage; const Point: TGPPoint); overload;
  8725. procedure DrawImage(const Image: IGPImage; const X, Y: Integer); overload;
  8726. procedure DrawImage(const Image: IGPImage; const Rect: TGPRect); overload;
  8727. procedure DrawImage(const Image: IGPImage; const X, Y, Width, Height: Integer); overload;
  8728. procedure DrawImage(const Image: IGPImage; const DestPoints: TGPPlgPointsF); overload;
  8729. procedure DrawImage(const Image: IGPImage; const DestPoints: TGPPlgPoints); overload;
  8730. procedure DrawImage(const Image: IGPImage; const X, Y, SrcX, SrcY, SrcWidth,
  8731. SrcHeight: Single; const SrcUnit: TGPUnit); overload;
  8732. procedure DrawImage(const Image: IGPImage; const DestRect: TGPRectF;
  8733. const SrcX, SrcY, SrcWidth, SrcHeight: Single; const SrcUnit: TGPUnit;
  8734. const ImageAttributes: IGPImageAttributes = nil;
  8735. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  8736. procedure DrawImage(const Image: IGPImage; const DstX, DstY, DstWidth,
  8737. DstHeight, SrcX, SrcY, SrcWidth, SrcHeight: Single; const SrcUnit: TGPUnit;
  8738. const ImageAttributes: IGPImageAttributes = nil;
  8739. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  8740. procedure DrawImage(const Image: IGPImage; const DestPoints: TGPPlgPointsF;
  8741. const SrcX, SrcY, SrcWidth, SrcHeight: Single; const SrcUnit: TGPUnit;
  8742. const ImageAttributes: IGPImageAttributes = nil;
  8743. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  8744. procedure DrawImage(const Image: IGPImage; const X, Y, SrcX, SrcY, SrcWidth,
  8745. SrcHeight: Integer; const SrcUnit: TGPUnit); overload;
  8746. procedure DrawImage(const Image: IGPImage; const DestRect: TGPRect;
  8747. const SrcX, SrcY, SrcWidth, SrcHeight: Integer; const SrcUnit: TGPUnit;
  8748. const ImageAttributes: IGPImageAttributes = nil;
  8749. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  8750. procedure DrawImage(const Image: IGPImage; const DstX, DstY, DstWidth,
  8751. DstHeight, SrcX, SrcY, SrcWidth, SrcHeight: Integer; const SrcUnit: TGPUnit;
  8752. const ImageAttributes: IGPImageAttributes = nil;
  8753. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  8754. procedure DrawImage(const Image: IGPImage; const DestPoints: TGPPlgPoints;
  8755. const SrcX, SrcY, SrcWidth, SrcHeight: Integer; const SrcUnit: TGPUnit;
  8756. const ImageAttributes: IGPImageAttributes = nil;
  8757. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  8758. {$IF (GDIPVER >= $0110)}
  8759. procedure DrawImage(const Image: IGPImage; const DestRect, SourceRect: TGPRectF;
  8760. const SrcUnit: TGPUnit; const ImageAttributes: IGPImageAttributes = nil); overload;
  8761. procedure DrawImage(const Image: IGPImage; const SourceRect: TGPRectF;
  8762. const XForm: IGPMatrix; const Effect: IGPEffect;
  8763. const ImageAttributes: IGPImageAttributes; const SrcUnit: TGPUnit); overload;
  8764. {$IFEND}
  8765.  
  8766. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8767. const DestPoint: TGPPointF; const Callback: TGPEnumerateMetafileProc;
  8768. const CallbackData: Pointer = nil;
  8769. const ImageAttributes: IGPImageAttributes = nil); overload;
  8770. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8771. const DestPoint: TGPPoint; const Callback: TGPEnumerateMetafileProc;
  8772. const CallbackData: Pointer = nil;
  8773. const ImageAttributes: IGPImageAttributes = nil); overload;
  8774. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8775. const DestRect: TGPRectF; const Callback: TGPEnumerateMetafileProc;
  8776. const CallbackData: Pointer = nil;
  8777. const ImageAttributes: IGPImageAttributes = nil); overload;
  8778. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8779. const DestRect: TGPRect; const Callback: TGPEnumerateMetafileProc;
  8780. const CallbackData: Pointer = nil;
  8781. const ImageAttributes: IGPImageAttributes = nil); overload;
  8782. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8783. const DestPoints: TGPPlgPointsF; const Callback: TGPEnumerateMetafileProc;
  8784. const CallbackData: Pointer = nil;
  8785. const ImageAttributes: IGPImageAttributes = nil); overload;
  8786. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8787. const DestPoints: TGPPlgPoints; const Callback: TGPEnumerateMetafileProc;
  8788. const CallbackData: Pointer = nil;
  8789. const ImageAttributes: IGPImageAttributes = nil); overload;
  8790. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8791. const DestPoint: TGPPointF; const SrcRect: TGPRectF; const SrcUnit: TGPUnit;
  8792. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  8793. const ImageAttributes: IGPImageAttributes = nil); overload;
  8794. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8795. const DestPoint: TGPPoint; const SrcRect: TGPRect; const SrcUnit: TGPUnit;
  8796. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  8797. const ImageAttributes: IGPImageAttributes = nil); overload;
  8798. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8799. const DestRect, SrcRect: TGPRectF; const SrcUnit: TGPUnit;
  8800. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  8801. const ImageAttributes: IGPImageAttributes = nil); overload;
  8802. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8803. const DestRect, SrcRect: TGPRect; const SrcUnit: TGPUnit;
  8804. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  8805. const ImageAttributes: IGPImageAttributes = nil); overload;
  8806. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8807. const DestPoints: TGPPlgPointsF; const SrcRect: TGPRectF; const SrcUnit: TGPUnit;
  8808. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  8809. const ImageAttributes: IGPImageAttributes = nil); overload;
  8810. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  8811. const DestPoints: TGPPlgPoints; const SrcRect: TGPRect; const SrcUnit: TGPUnit;
  8812. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  8813. const ImageAttributes: IGPImageAttributes = nil); overload;
  8814.  
  8815. procedure SetClip(const G: IGPGraphics;
  8816. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  8817. procedure SetClip(const Rect: TGPRectF;
  8818. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  8819. procedure SetClip(const Rect: TGPRect;
  8820. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  8821. procedure SetClip(const Path: IGPGraphicsPath;
  8822. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  8823. procedure SetClip(const Region: IGPRegion;
  8824. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  8825. procedure SetClip(const Region: HRgn;
  8826. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  8827.  
  8828. procedure IntersectClip(const Rect: TGPRectF); overload;
  8829. procedure IntersectClip(const Rect: TGPRect); overload;
  8830. procedure IntersectClip(const Region: IGPRegion); overload;
  8831. procedure ExcludeClip(const Rect: TGPRectF); overload;
  8832. procedure ExcludeClip(const Rect: TGPRect); overload;
  8833. procedure ExcludeClip(const Region: IGPRegion); overload;
  8834. procedure ResetClip;
  8835. procedure TranslateClip(const DX, DY: Single); overload;
  8836. procedure TranslateClip(const DX, DY: Integer); overload;
  8837.  
  8838. function IsVisible(const X, Y: Integer): Boolean; overload;
  8839. function IsVisible(const Point: TGPPoint): Boolean; overload;
  8840. function IsVisible(const X, Y, Width, Height: Integer): Boolean; overload;
  8841. function IsVisible(const Rect: TGPRect): Boolean; overload;
  8842. function IsVisible(const X, Y: Single): Boolean; overload;
  8843. function IsVisible(const Point: TGPPointF): Boolean; overload;
  8844. function IsVisible(const X, Y, Width, Height: Single): Boolean; overload;
  8845. function IsVisible(const Rect: TGPRectF): Boolean; overload;
  8846.  
  8847. function Save: TGPGraphicsState;
  8848. procedure Restore(const State: TGPGraphicsState);
  8849. function BeginContainer(const DstRect, SrcRect: TGPRectF;
  8850. const MeasureUnit: TGPUnit): TGPGraphicsContainer; overload;
  8851. function BeginContainer(const DstRect, SrcRect: TGPRect;
  8852. const MeasureUnit: TGPUnit): TGPGraphicsContainer; overload;
  8853. function BeginContainer: TGPGraphicsContainer; overload;
  8854. procedure EndContainer(const State: TGPGraphicsContainer);
  8855.  
  8856. procedure AddMetafileComment(const Data: array of Byte);
  8857.  
  8858. { Properties }
  8859. property RenderingOrigin: TGPPoint read GetRenderingOrigin write SetRenderingOrigin;
  8860. property CompositingMode: TGPCompositingMode read GetCompositingMode write SetCompositingMode;
  8861. property CompositingQuality: TGPCompositingQuality read GetCompositingQuality write SetCompositingQuality;
  8862. property TextRenderingHint: TGPTextRenderingHint read GetTextRenderingHint write SetTextRenderingHint;
  8863. property TextContrast: Integer read GetTextContrast write SetTextContrast;
  8864. property InterpolationMode: TGPInterpolationMode read GetInterpolationMode write SetInterpolationMode;
  8865. property SmoothingMode: TGPSmoothingMode read GetSmoothingMode write SetSmoothingMode;
  8866. property PixelOffsetMode: TGPPixelOffsetMode read GetPixelOffsetMode write SetPixelOffsetMode;
  8867. property Transform: IGPMatrix read GetTransform write SetTransform;
  8868. property PageUnit: TGPUnit read GetPageUnit write SetPageUnit;
  8869. property PageScale: Single read GetPageScale write SetPageScale;
  8870. property DpiX: Single read GetDpiX;
  8871. property DpiY: Single read GetDpiY;
  8872. property Clip: IGPRegion read GetClip write SetClipReplace;
  8873. property ClipBounds: TGPRectF read GetClipBounds;
  8874. property ClipBoundsI: TGPRect read GetClipBoundsI;
  8875. property IsClipEmpty: Boolean read GetIsClipEmpty;
  8876. property VisibleClipBounds: TGPRectF read GetVisibleClipBounds;
  8877. property VisibleClipBoundsI: TGPRect read GetVisibleClipBoundsI;
  8878. property IsVisibleClipEmpty: Boolean read GetIsVisibleClipEmpty;
  8879. end;
  8880.  
  8881. TGPGraphics = class(TGdiplusBase, IGPGraphics)
  8882. private
  8883. { IGPGraphics }
  8884. function GetRenderingOrigin: TGPPoint; overload;
  8885. procedure SetRenderingOrigin(const Value: TGPPoint); overload;
  8886. function GetCompositingMode: TGPCompositingMode;
  8887. procedure SetCompositingMode(const Value: TGPCompositingMode);
  8888. function GetCompositingQuality: TGPCompositingQuality;
  8889. procedure SetCompositingQuality(const Value: TGPCompositingQuality);
  8890. function GetTextRenderingHint: TGPTextRenderingHint;
  8891. procedure SetTextRenderingHint(const Value: TGPTextRenderingHint);
  8892. function GetTextContrast: Integer;
  8893. procedure SetTextContrast(const Value: Integer);
  8894. function GetInterpolationMode: TGPInterpolationMode;
  8895. procedure SetInterpolationMode(const Value: TGPInterpolationMode);
  8896. function GetSmoothingMode: TGPSmoothingMode;
  8897. procedure SetSmoothingMode(const Value: TGPSmoothingMode);
  8898. function GetPixelOffsetMode: TGPPixelOffsetMode;
  8899. procedure SetPixelOffsetMode(const Value: TGPPixelOffsetMode);
  8900. function GetTransform: IGPMatrix;
  8901. procedure SetTransform(const Value: IGPMatrix);
  8902. function GetPageUnit: TGPUnit;
  8903. procedure SetPageUnit(const Value: TGPUnit);
  8904. function GetPageScale: Single;
  8905. procedure SetPageScale(const Value: Single);
  8906. function GetDpiX: Single;
  8907. function GetDpiY: Single;
  8908. function GetClip: IGPRegion;
  8909. procedure SetClipReplace(const Value: IGPRegion);
  8910. function GetClipBounds: TGPRectF;
  8911. function GetClipBoundsI: TGPRect;
  8912. function GetIsClipEmpty: Boolean;
  8913. function GetVisibleClipBounds: TGPRectF;
  8914. function GetVisibleClipBoundsI: TGPRect;
  8915. function GetIsVisibleClipEmpty: Boolean;
  8916.  
  8917. procedure Flush(const Intention: TGPFlushIntention = FlushIntentionFlush);
  8918. function GetHDC: HDC;
  8919. procedure ReleaseHDC(const DC: HDC);
  8920. procedure GetRenderingOrigin(out X, Y: Integer); overload;
  8921. procedure SetRenderingOrigin(const X, Y: Integer); overload;
  8922. {$IF (GDIPVER >= $0110)}
  8923. procedure SetAbort(const IAbort: TGdiplusAbort);
  8924. {$IFEND}
  8925. procedure ResetTransform;
  8926. procedure MultiplyTransform(const Matrix: IGPMatrix;
  8927. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8928. procedure TranslateTransform(const DX, DY: Single;
  8929. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8930. procedure ScaleTransform(const SX, SY: Single;
  8931. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8932. procedure RotateTransform(const Angle: Single;
  8933. const Order: TGPMatrixOrder = MatrixOrderPrepend);
  8934. procedure TransformPoints(const DestSpace, SrcSpace: TGPCoordinateSpace;
  8935. const Points: array of TGPPointF); overload;
  8936. procedure TransformPoints(const DestSpace, SrcSpace: TGPCoordinateSpace;
  8937. const Points: array of TGPPoint); overload;
  8938. function GetNearestColor(const Color: TGPColor): TGPColor;
  8939.  
  8940. procedure DrawLine(const Pen: IGPPen; const Pt1, Pt2: TGPPointF); overload;
  8941. procedure DrawLine(const Pen: IGPPen; const X1, Y1, X2, Y2: Single); overload;
  8942. procedure DrawLine(const Pen: IGPPen; const Pt1, Pt2: TGPPoint); overload;
  8943. procedure DrawLine(const Pen: IGPPen; const X1, Y1, X2, Y2: Integer); overload;
  8944.  
  8945. procedure DrawLines(const Pen: IGPPen; const Points: array of TGPPointF); overload;
  8946. procedure DrawLines(const Pen: IGPPen; const Points: array of TGPPoint); overload;
  8947.  
  8948. procedure DrawArc(const Pen: IGPPen; const Rect: TGPRectF; const StartAngle,
  8949. SweepAngle: Single); overload;
  8950. procedure DrawArc(const Pen: IGPPen; const X, Y, Width, Height, StartAngle,
  8951. SweepAngle: Single); overload;
  8952. procedure DrawArc(const Pen: IGPPen; const Rect: TGPRect; const StartAngle,
  8953. SweepAngle: Single); overload;
  8954. procedure DrawArc(const Pen: IGPPen; const X, Y, Width, Height: Integer;
  8955. const StartAngle, SweepAngle: Single); overload;
  8956.  
  8957. procedure DrawBezier(const Pen: IGPPen; const Pt1, Pt2, Pt3, Pt4: TGPPointF); overload;
  8958. procedure DrawBezier(const Pen: IGPPen; const X1, Y1, X2, Y2, X3, Y3, X4, Y4: Single); overload;
  8959. procedure DrawBezier(const Pen: IGPPen; const Pt1, Pt2, Pt3, Pt4: TGPPoint); overload;
  8960. procedure DrawBezier(const Pen: IGPPen; const X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer); overload;
  8961.  
  8962. procedure DrawBeziers(const Pen: IGPPen; const Points: array of TGPPointF); overload;
  8963. procedure DrawBeziers(const Pen: IGPPen; const Points: array of TGPPoint); overload;
  8964.  
  8965. procedure DrawRectangle(const Pen: IGPPen; const Rect: TGPRectF); overload;
  8966. procedure DrawRectangle(const Pen: IGPPen; const Rect: TGPRect); overload;
  8967. procedure DrawRectangle(const Pen: IGPPen; const X, Y, Width, Height: Single); overload;
  8968. procedure DrawRectangle(const Pen: IGPPen; const X, Y, Width, Height: Integer); overload;
  8969.  
  8970. procedure DrawRectangles(const Pen: IGPPen; const Rects: array of TGPRectF); overload;
  8971. procedure DrawRectangles(const Pen: IGPPen; const Rects: array of TGPRect); overload;
  8972.  
  8973. procedure DrawEllipse(const Pen: IGPPen; const Rect: TGPRectF); overload;
  8974. procedure DrawEllipse(const Pen: IGPPen; const X, Y, Width, Height: Single); overload;
  8975. procedure DrawEllipse(const Pen: IGPPen; const Rect: TGPRect); overload;
  8976. procedure DrawEllipse(const Pen: IGPPen; const X, Y, Width, Height: Integer); overload;
  8977.  
  8978. procedure DrawPie(const Pen: IGPPen; const Rect: TGPRectF;
  8979. const StartAngle, SweepAngle: Single); overload;
  8980. procedure DrawPie(const Pen: IGPPen; const X, Y, Width, Height,
  8981. StartAngle, SweepAngle: Single); overload;
  8982. procedure DrawPie(const Pen: IGPPen; const Rect: TGPRect;
  8983. const StartAngle, SweepAngle: Single); overload;
  8984. procedure DrawPie(const Pen: IGPPen; const X, Y, Width, Height: Integer;
  8985. const StartAngle, SweepAngle: Single); overload;
  8986.  
  8987. procedure DrawPolygon(const Pen: IGPPen; const Points: array of TGPPointF); overload;
  8988. procedure DrawPolygon(const Pen: IGPPen; const Points: array of TGPPoint); overload;
  8989.  
  8990. procedure DrawPath(const Pen: IGPPen; const Path: IGPGraphicsPath);
  8991.  
  8992. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPointF); overload;
  8993. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPointF;
  8994. const Tension: Single); overload;
  8995. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPointF;
  8996. const Offset, NumberOfSegments: Integer; const Tension: Single); overload;
  8997. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPoint); overload;
  8998. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPoint;
  8999. const Tension: Single); overload;
  9000. procedure DrawCurve(const Pen: IGPPen; const Points: array of TGPPoint;
  9001. const Offset, NumberOfSegments: Integer; const Tension: Single); overload;
  9002.  
  9003. procedure DrawClosedCurve(const Pen: IGPPen; const Points: array of TGPPointF); overload;
  9004. procedure DrawClosedCurve(const Pen: IGPPen; const Points: array of TGPPointF;
  9005. const Tension: Single); overload;
  9006. procedure DrawClosedCurve(const Pen: IGPPen; const Points: array of TGPPoint); overload;
  9007. procedure DrawClosedCurve(const Pen: IGPPen; const Points: array of TGPPoint;
  9008. const Tension: Single); overload;
  9009.  
  9010. procedure Clear(const Color: TGPColor);
  9011.  
  9012. procedure FillRectangle(const Brush: IGPBrush; const Rect: TGPRectF); overload;
  9013. procedure FillRectangle(const Brush: IGPBrush; const Rect: TGPRect); overload;
  9014. procedure FillRectangle(const Brush: IGPBrush; const X, Y, Width, Height: Single); overload;
  9015. procedure FillRectangle(const Brush: IGPBrush; const X, Y, Width, Height: Integer); overload;
  9016.  
  9017. procedure FillRectangles(const Brush: IGPBrush; const Rects: array of TGPRectF); overload;
  9018. procedure FillRectangles(const Brush: IGPBrush; const Rects: array of TGPRect); overload;
  9019.  
  9020. procedure FillPolygon(const Brush: IGPBrush; const Points: array of TGPPointF); overload;
  9021. procedure FillPolygon(const Brush: IGPBrush; const Points: array of TGPPoint); overload;
  9022. procedure FillPolygon(const Brush: IGPBrush; const Points: array of TGPPointF;
  9023. const FillMode: TGPFillMode); overload;
  9024. procedure FillPolygon(const Brush: IGPBrush; const Points: array of TGPPoint;
  9025. const FillMode: TGPFillMode); overload;
  9026.  
  9027. procedure FillEllipse(const Brush: IGPBrush; const Rect: TGPRectF); overload;
  9028. procedure FillEllipse(const Brush: IGPBrush; const X, Y, Width, Height: Single); overload;
  9029. procedure FillEllipse(const Brush: IGPBrush; const Rect: TGPRect); overload;
  9030. procedure FillEllipse(const Brush: IGPBrush; const X, Y, Width, Height: Integer); overload;
  9031.  
  9032. procedure FillPie(const Brush: IGPBrush; const Rect: TGPRectF;
  9033. const StartAngle, SweepAngle: Single); overload;
  9034. procedure FillPie(const Brush: IGPBrush; const X, Y, Width, Height,
  9035. StartAngle, SweepAngle: Single); overload;
  9036. procedure FillPie(const Brush: IGPBrush; const Rect: TGPRect;
  9037. const StartAngle, SweepAngle: Single); overload;
  9038. procedure FillPie(const Brush: IGPBrush; const X, Y, Width, Height: Integer;
  9039. const StartAngle, SweepAngle: Single); overload;
  9040.  
  9041. procedure FillPath(const Brush: IGPBrush; const Path: IGPGraphicsPath);
  9042.  
  9043. procedure FillClosedCurve(const Brush: IGPBrush; const Points: array of TGPPointF); overload;
  9044. procedure FillClosedCurve(const Brush: IGPBrush; const Points: array of TGPPointF;
  9045. const FillMode: TGPFillMode; const Tension: Single); overload;
  9046. procedure FillClosedCurve(const Brush: IGPBrush; const Points: array of TGPPoint); overload;
  9047. procedure FillClosedCurve(const Brush: IGPBrush; const Points: array of TGPPoint;
  9048. const FillMode: TGPFillMode; const Tension: Single); overload;
  9049.  
  9050. procedure FillRegion(const Brush: IGPBrush; const Region: IGPRegion);
  9051.  
  9052. procedure DrawString(const Str: String; const Font: IGPFont;
  9053. const LayoutRect: TGPRectF; const Format: IGPStringFormat;
  9054. const Brush: IGPBrush); overload;
  9055. procedure DrawString(const Str: String; const Font: IGPFont;
  9056. const Origin: TGPPointF; const Format: IGPStringFormat;
  9057. const Brush: IGPBrush); overload;
  9058. procedure DrawString(const Str: String; const Font: IGPFont;
  9059. const Origin: TGPPointF; const Brush: IGPBrush); overload;
  9060.  
  9061. function MeasureString(const Str: String; const Font: IGPFont;
  9062. const LayoutRect: TGPRectF; const Format: IGPStringFormat): TGPRectF; overload;
  9063. function MeasureString(const Str: String; const Font: IGPFont;
  9064. const LayoutRect: TGPRectF; const Format: IGPStringFormat;
  9065. out CodepointsFitted, LinesFilled: Integer): TGPRectF; overload;
  9066. function MeasureString(const Str: String; const Font: IGPFont;
  9067. const LayoutRectSize: TGPSizeF; const Format: IGPStringFormat): TGPSizeF; overload;
  9068. function MeasureString(const Str: String; const Font: IGPFont;
  9069. const LayoutRectSize: TGPSizeF; const Format: IGPStringFormat;
  9070. out CodepointsFitted, LinesFilled: Integer): TGPSizeF; overload;
  9071. function MeasureString(const Str: String; const Font: IGPFont;
  9072. const Origin: TGPPointF; const Format: IGPStringFormat): TGPRectF; overload;
  9073. function MeasureString(const Str: String; const Font: IGPFont;
  9074. const LayoutRect: TGPRectF): TGPRectF; overload;
  9075. function MeasureString(const Str: String; const Font: IGPFont;
  9076. const Origin: TGPPointF): TGPRectF; overload;
  9077.  
  9078. function MeasureCharacterRanges(const Str: String; const Font: IGPFont;
  9079. const LayoutRect: TGPRectF; const Format: IGPStringFormat): IGPRegions;
  9080. procedure DrawDriverString(const Text: PUInt16; const Length: Integer;
  9081. const Font: IGPFont; const Brush: IGPBrush; const Positions: PGPPointF;
  9082. const Flags: TGPDriverStringOptions; const Matrix: IGPMatrix);
  9083. function MeasureDriverString(const Text: PUInt16; const Length: Integer;
  9084. const Font: IGPFont; const Positions: PGPPointF;
  9085. const Flags: TGPDriverStringOptions; const Matrix: IGPMatrix): TGPRectF;
  9086.  
  9087. procedure DrawCachedBitmap(const CachedBitmap: IGPCachedBitmap;
  9088. const X, Y: Integer);
  9089.  
  9090. procedure DrawImage(const Image: IGPImage; const Point: TGPPointF); overload;
  9091. procedure DrawImage(const Image: IGPImage; const X, Y: Single); overload;
  9092. procedure DrawImage(const Image: IGPImage; const Rect: TGPRectF); overload;
  9093. procedure DrawImage(const Image: IGPImage; const X, Y, Width, Height: Single); overload;
  9094. procedure DrawImage(const Image: IGPImage; const Point: TGPPoint); overload;
  9095. procedure DrawImage(const Image: IGPImage; const X, Y: Integer); overload;
  9096. procedure DrawImage(const Image: IGPImage; const Rect: TGPRect); overload;
  9097. procedure DrawImage(const Image: IGPImage; const X, Y, Width, Height: Integer); overload;
  9098. procedure DrawImage(const Image: IGPImage; const DestPoints: TGPPlgPointsF); overload;
  9099. procedure DrawImage(const Image: IGPImage; const DestPoints: TGPPlgPoints); overload;
  9100. procedure DrawImage(const Image: IGPImage; const X, Y, SrcX, SrcY, SrcWidth,
  9101. SrcHeight: Single; const SrcUnit: TGPUnit); overload;
  9102. procedure DrawImage(const Image: IGPImage; const DestRect: TGPRectF;
  9103. const SrcX, SrcY, SrcWidth, SrcHeight: Single; const SrcUnit: TGPUnit;
  9104. const ImageAttributes: IGPImageAttributes = nil;
  9105. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  9106. procedure DrawImage(const Image: IGPImage; const DstX, DstY, DstWidth,
  9107. DstHeight, SrcX, SrcY, SrcWidth, SrcHeight: Single; const SrcUnit: TGPUnit;
  9108. const ImageAttributes: IGPImageAttributes = nil;
  9109. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  9110. procedure DrawImage(const Image: IGPImage; const DestPoints: TGPPlgPointsF;
  9111. const SrcX, SrcY, SrcWidth, SrcHeight: Single; const SrcUnit: TGPUnit;
  9112. const ImageAttributes: IGPImageAttributes = nil;
  9113. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  9114. procedure DrawImage(const Image: IGPImage; const X, Y, SrcX, SrcY, SrcWidth,
  9115. SrcHeight: Integer; const SrcUnit: TGPUnit); overload;
  9116. procedure DrawImage(const Image: IGPImage; const DestRect: TGPRect;
  9117. const SrcX, SrcY, SrcWidth, SrcHeight: Integer; const SrcUnit: TGPUnit;
  9118. const ImageAttributes: IGPImageAttributes = nil;
  9119. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  9120. procedure DrawImage(const Image: IGPImage; const DstX, DstY, DstWidth,
  9121. DstHeight, SrcX, SrcY, SrcWidth, SrcHeight: Integer; const SrcUnit: TGPUnit;
  9122. const ImageAttributes: IGPImageAttributes = nil;
  9123. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  9124. procedure DrawImage(const Image: IGPImage; const DestPoints: TGPPlgPoints;
  9125. const SrcX, SrcY, SrcWidth, SrcHeight: Integer; const SrcUnit: TGPUnit;
  9126. const ImageAttributes: IGPImageAttributes = nil;
  9127. const Callback: TGPDrawImageAbort = nil; const CallbackData: Pointer = nil); overload;
  9128. {$IF (GDIPVER >= $0110)}
  9129. procedure DrawImage(const Image: IGPImage; const DestRect, SourceRect: TGPRectF;
  9130. const SrcUnit: TGPUnit; const ImageAttributes: IGPImageAttributes = nil); overload;
  9131. procedure DrawImage(const Image: IGPImage; const SourceRect: TGPRectF;
  9132. const XForm: IGPMatrix; const Effect: IGPEffect;
  9133. const ImageAttributes: IGPImageAttributes; const SrcUnit: TGPUnit); overload;
  9134. {$IFEND}
  9135.  
  9136. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9137. const DestPoint: TGPPointF; const Callback: TGPEnumerateMetafileProc;
  9138. const CallbackData: Pointer = nil;
  9139. const ImageAttributes: IGPImageAttributes = nil); overload;
  9140. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9141. const DestPoint: TGPPoint; const Callback: TGPEnumerateMetafileProc;
  9142. const CallbackData: Pointer = nil;
  9143. const ImageAttributes: IGPImageAttributes = nil); overload;
  9144. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9145. const DestRect: TGPRectF; const Callback: TGPEnumerateMetafileProc;
  9146. const CallbackData: Pointer = nil;
  9147. const ImageAttributes: IGPImageAttributes = nil); overload;
  9148. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9149. const DestRect: TGPRect; const Callback: TGPEnumerateMetafileProc;
  9150. const CallbackData: Pointer = nil;
  9151. const ImageAttributes: IGPImageAttributes = nil); overload;
  9152. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9153. const DestPoints: TGPPlgPointsF; const Callback: TGPEnumerateMetafileProc;
  9154. const CallbackData: Pointer = nil;
  9155. const ImageAttributes: IGPImageAttributes = nil); overload;
  9156. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9157. const DestPoints: TGPPlgPoints; const Callback: TGPEnumerateMetafileProc;
  9158. const CallbackData: Pointer = nil;
  9159. const ImageAttributes: IGPImageAttributes = nil); overload;
  9160. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9161. const DestPoint: TGPPointF; const SrcRect: TGPRectF; const SrcUnit: TGPUnit;
  9162. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  9163. const ImageAttributes: IGPImageAttributes = nil); overload;
  9164. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9165. const DestPoint: TGPPoint; const SrcRect: TGPRect; const SrcUnit: TGPUnit;
  9166. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  9167. const ImageAttributes: IGPImageAttributes = nil); overload;
  9168. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9169. const DestRect, SrcRect: TGPRectF; const SrcUnit: TGPUnit;
  9170. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  9171. const ImageAttributes: IGPImageAttributes = nil); overload;
  9172. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9173. const DestRect, SrcRect: TGPRect; const SrcUnit: TGPUnit;
  9174. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  9175. const ImageAttributes: IGPImageAttributes = nil); overload;
  9176. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9177. const DestPoints: TGPPlgPointsF; const SrcRect: TGPRectF; const SrcUnit: TGPUnit;
  9178. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  9179. const ImageAttributes: IGPImageAttributes = nil); overload;
  9180. procedure EnumerateMetafile(const Metafile: IGPMetafile;
  9181. const DestPoints: TGPPlgPoints; const SrcRect: TGPRect; const SrcUnit: TGPUnit;
  9182. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer = nil;
  9183. const ImageAttributes: IGPImageAttributes = nil); overload;
  9184.  
  9185. procedure SetClip(const G: IGPGraphics;
  9186. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  9187. procedure SetClip(const Rect: TGPRectF;
  9188. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  9189. procedure SetClip(const Rect: TGPRect;
  9190. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  9191. procedure SetClip(const Path: IGPGraphicsPath;
  9192. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  9193. procedure SetClip(const Region: IGPRegion;
  9194. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  9195. procedure SetClip(const Region: HRgn;
  9196. const CombineMode: TGPCombineMode = CombineModeReplace); overload;
  9197.  
  9198. procedure IntersectClip(const Rect: TGPRectF); overload;
  9199. procedure IntersectClip(const Rect: TGPRect); overload;
  9200. procedure IntersectClip(const Region: IGPRegion); overload;
  9201. procedure ExcludeClip(const Rect: TGPRectF); overload;
  9202. procedure ExcludeClip(const Rect: TGPRect); overload;
  9203. procedure ExcludeClip(const Region: IGPRegion); overload;
  9204. procedure ResetClip;
  9205. procedure TranslateClip(const DX, DY: Single); overload;
  9206. procedure TranslateClip(const DX, DY: Integer); overload;
  9207.  
  9208. function IsVisible(const X, Y: Integer): Boolean; overload;
  9209. function IsVisible(const Point: TGPPoint): Boolean; overload;
  9210. function IsVisible(const X, Y, Width, Height: Integer): Boolean; overload;
  9211. function IsVisible(const Rect: TGPRect): Boolean; overload;
  9212. function IsVisible(const X, Y: Single): Boolean; overload;
  9213. function IsVisible(const Point: TGPPointF): Boolean; overload;
  9214. function IsVisible(const X, Y, Width, Height: Single): Boolean; overload;
  9215. function IsVisible(const Rect: TGPRectF): Boolean; overload;
  9216.  
  9217. function Save: TGPGraphicsState;
  9218. procedure Restore(const State: TGPGraphicsState);
  9219. function BeginContainer(const DstRect, SrcRect: TGPRectF;
  9220. const MeasureUnit: TGPUnit): TGPGraphicsContainer; overload;
  9221. function BeginContainer(const DstRect, SrcRect: TGPRect;
  9222. const MeasureUnit: TGPUnit): TGPGraphicsContainer; overload;
  9223. function BeginContainer: TGPGraphicsContainer; overload;
  9224. procedure EndContainer(const State: TGPGraphicsContainer);
  9225.  
  9226. procedure AddMetafileComment(const Data: array of Byte);
  9227. public
  9228. constructor Create(const DC: HDC); overload;
  9229. constructor Create(const DC: HDC; const Device: THandle); overload;
  9230. constructor Create(const Window: HWnd; const ICM: Boolean = False); overload;
  9231. constructor Create(const Image: IGPImage); overload;
  9232. destructor Destroy; override;
  9233.  
  9234. class function FromHDC(const DC: HDC): IGPGraphics; overload; static;
  9235. class function FromHDC(const DC: HDC; const Device: THandle): IGPGraphics; overload; static;
  9236. class function FromHWnd(const Window: HWnd;
  9237. const ICM: Boolean = False): IGPGraphics; static;
  9238. class function FromImage(const Image: IGPImage): IGPGraphics; static;
  9239. end;
  9240. {$ENDREGION 'GdiplusGraphics.h'}
  9241.  
  9242. {$REGION 'Utilities'}
  9243. type
  9244. EGdipError = class(Exception)
  9245. private
  9246. FStatus: TGPStatus;
  9247. public
  9248. constructor Create(const Status: TGPStatus);
  9249.  
  9250. property Status: TGPStatus read FStatus;
  9251. end;
  9252. {$ENDREGION 'Utilities'}
  9253.  
  9254. {$REGION 'Aliases'}
  9255. {$IFDEF GDIP_ALIAS}
  9256. type
  9257. TGraphicsState = TGPGraphicsState;
  9258. PGraphicsState = PGPGraphicsState;
  9259. TGraphicsContainer = TGPGraphicsContainer;
  9260. PGraphicsContainer = PGPGraphicsContainer;
  9261. TFillMode = TGPFillMode;
  9262. TQualityMode = TGPQualityMode;
  9263. TCompositingMode = TGPCompositingMode;
  9264. TCompositingQuality = TGPCompositingQuality;
  9265. TUnit = TGPUnit;
  9266. TMetafileFrameUnit = TGPMetafileFrameUnit;
  9267. TCoordinateSpace = TGPCoordinateSpace;
  9268. TWrapMode = TGPWrapMode;
  9269. THatchStyle = TGPHatchStyle;
  9270. TDashStyle = TGPDashStyle;
  9271. TDashCap = TGPDashCap;
  9272. TLineCap = TGPLineCap;
  9273. TCustomLineCapType = TGPCustomLineCapType;
  9274. TLineJoin = TGPLineJoin;
  9275. TPathPointType = TGPPathPointType;
  9276. TWarpMode = TGPWarpMode;
  9277. TLinearGradientMode = TGPLinearGradientMode;
  9278. TCombineMode = TGPCombineMode;
  9279. TImageType = TGPImageType;
  9280. TInterpolationMode = TGPInterpolationMode;
  9281. TPenAlignment = TGPPenAlignment;
  9282. TBrushType = TGPBrushType;
  9283. TPenType = TGPPenType;
  9284. TMatrixOrder = TGPMatrixOrder;
  9285. TGenericFontFamily = TGPGenericFontFamily;
  9286. TFontStyleEntry = TGPFontStyleEntry;
  9287. TFontStyle = TGPFontStyle;
  9288. TSmoothingMode = TGPSmoothingMode;
  9289. TPixelOffsetMode = TGPPixelOffsetMode;
  9290. TTextRenderingHint = TGPTextRenderingHint;
  9291. TMetafileType = TGPMetafileType;
  9292. TEmfType = TGPEmfType;
  9293. TObjectType = TGPObjectType;
  9294. TStringFormatFlag = TGPStringFormatFlag;
  9295. TStringFormatFlags = TGPStringFormatFlags;
  9296. TStringTrimming = TGPStringTrimming;
  9297. TStringDigitSubstitute = TGPStringDigitSubstitute;
  9298. PStringDigitSubstitute = PGPStringDigitSubstitute;
  9299. THotkeyPrefix = TGPHotkeyPrefix;
  9300. TStringAlignment = TGPStringAlignment;
  9301. TDriverStringOption = TGPDriverStringOption;
  9302. TDriverStringOptions = TGPDriverStringOptions;
  9303. TFlushIntention = TGPFlushIntention;
  9304. TEncoderParameterValueType = TGPEncoderParameterValueType;
  9305. TEncoderValue = TGPEncoderValue;
  9306. TEmfToWmfBitsFlag = TGPEmfToWmfBitsFlag;
  9307. TEmfToWmfBitsFlags = TGPEmfToWmfBitsFlags;
  9308. TTestControlEnum = TGPTestControlEnum;
  9309. TImageAbort = TGPImageAbort;
  9310. TDrawImageAbort = TGPDrawImageAbort;
  9311. TGetThumbnailImageAbort = TGPGetThumbnailImageAbort;
  9312. TEnumerateMetafileProc = TGPEnumerateMetafileProc;
  9313. TStatus = TGPStatus;
  9314. TSizeF = TGPSizeF;
  9315. PSizeF = PGPSizeF;
  9316. TSize = TGPSize;
  9317. PSize = PGPSize;
  9318. TPointF = TGPPointF;
  9319. PPointF = PGPPointF;
  9320. TPoint = TGPPoint;
  9321. PPoint = PGPPoint;
  9322. PRectF = PGPRectF;
  9323. TRectF = TGPRectF;
  9324. PRect = PGPRect;
  9325. TRect = TGPRect;
  9326. TNativePathData = TGPNativePathData;
  9327. PNativePathData = PGPNativePathData;
  9328. TCharacterRange = TGPCharacterRange;
  9329. PCharacterRange = PGPCharacterRange;
  9330. TDebugEventLevel = TGPDebugEventLevel;
  9331. TDebugEventProc = TGPDebugEventProc;
  9332. TNofificationHookProc = TGPNofificationHookProc;
  9333. TNofificationUnhookProc = TGPNofificationUnhookProc;
  9334. TPixelFormat = TGPPixelFormat;
  9335. TPaletteFlag = TGPPaletteFlag;
  9336. TPaletteFlags = TGPPaletteFlags;
  9337. TNativeColorPalette = TGPNativeColorPalette;
  9338. PNativeColorPalette = PGPNativeColorPalette;
  9339. TColorMode = TGPColorMode;
  9340. TColorChannelFlags = TGPColorChannelFlags;
  9341. TColor = TGPColor;
  9342. PColor = PGPColor;
  9343. TMetafileHeader = TGPMetafileHeader;
  9344. PMetafileHeader = PGPMetafileHeader;
  9345. IImageBytes = IGPImageBytes;
  9346. TImageCodecFlag = TGPImageCodecFlag;
  9347. TNativeImageCodecInfo = TGPNativeImageCodecInfo;
  9348. PNativeImageCodecInfo = PGPNativeImageCodecInfo;
  9349. TImageLockModeOption = TGPImageLockModeOption;
  9350. TImageLockMode = TGPImageLockMode;
  9351. TBitmapData = TGPBitmapData;
  9352. PBitmapData = PGPBitmapData;
  9353. TImageFlag = TGPImageFlag;
  9354. TImageFlags = TGPImageFlags;
  9355. TRotateFlipType = TGPRotateFlipType;
  9356. TNativeEncoderParameter = TGPNativeEncoderParameter;
  9357. PNativeEncoderParameter = PGPNativeEncoderParameter;
  9358. TNativeEncoderParameters = TGPNativeEncoderParameters;
  9359. PNativeEncoderParameters = PGPNativeEncoderParameters;
  9360. TNativePropertyItem = TGPNativePropertyItem;
  9361. PNativePropertyItem = PGPNativePropertyItem;
  9362. TColorMatrix = TGPColorMatrix;
  9363. PColorMatrix = PGPColorMatrix;
  9364. TColorMatrixFlags = TGPColorMatrixFlags;
  9365. TColorAdjustType = TGPColorAdjustType;
  9366. TColorMap = TGPColorMap;
  9367. PColorMap = PGPColorMap;
  9368. IRegionData = IGPRegionData;
  9369. IRegionScansF = IGPRegionScansF;
  9370. IRegionScans = IGPRegionScans;
  9371. IRegion = IGPRegion;
  9372. TRegion = TGPRegion;
  9373. IFontFamily = IGPFontFamily;
  9374. TFontFamily = TGPFontFamily;
  9375. IFont = IGPFont;
  9376. TFont = TGPFont;
  9377. IFontFamilies = IGPFontFamilies;
  9378. IFontCollection = IGPFontCollection;
  9379. TFontCollection = TGPFontCollection;
  9380. IInstalledFontCollection = IGPInstalledFontCollection;
  9381. TInstalledFontCollection = TGPInstalledFontCollection;
  9382. IPrivateFontCollection = IGPPrivateFontCollection;
  9383. TPrivateFontCollection = TGPPrivateFontCollection;
  9384. IImageFormat = IGPImageFormat;
  9385. TImageFormat = TGPImageFormat;
  9386. IImageCodecInfo = IGPImageCodecInfo;
  9387. IImageCodecInfoArray = IGPImageCodecInfoArray;
  9388. TImageCodecInfo = TGPImageCodecInfo;
  9389. IEncoderParameters = IGPEncoderParameters;
  9390. TEncoderParameterEnumerator = TGPEncoderParameterEnumerator;
  9391. TEncoderParameters = TGPEncoderParameters;
  9392. IColorPalette = IGPColorPalette;
  9393. TColorPalette = TGPColorPalette;
  9394. IPropertyItem = IGPPropertyItem;
  9395. TPropertyItem = TGPPropertyItem;
  9396. IFrameDimensions = IGPFrameDimensions;
  9397. IPropertyIdList = IGPPropertyIdList;
  9398. IPropertyItems = IGPPropertyItems;
  9399. IImage = IGPImage;
  9400. TImage = TGPImage;
  9401. IBitmap = IGPBitmap;
  9402. TBitmap = TGPBitmap;
  9403. ICustomLineCap = IGPCustomLineCap;
  9404. TCustomLineCap = TGPCustomLineCap;
  9405. IAdjustableArrowCap = IGPAdjustableArrowCap;
  9406. TAdjustableArrowCap = TGPAdjustableArrowCap;
  9407. ICachedBitmap = IGPCachedBitmap;
  9408. TCachedBitmap = TGPCachedBitmap;
  9409. IMetafile = IGPMetafile;
  9410. TMetafile = TGPMetafile;
  9411. IImageAttributes = IGPImageAttributes;
  9412. TImageAttributes = TGPImageAttributes;
  9413. TMatrixElements = TGPMatrixElements;
  9414. TPlgPointsF = TGPPlgPointsF;
  9415. TPlgPoints = TGPPlgPoints;
  9416. IMatrix = IGPMatrix;
  9417. TMatrix = TGPMatrix;
  9418. IBrush = IGPBrush;
  9419. TBrush = TGPBrush;
  9420. ISolidBrush = IGPSolidBrush;
  9421. TSolidBrush = TGPSolidBrush;
  9422. ITextureBrush = IGPTextureBrush;
  9423. TTextureBrush = TGPTextureBrush;
  9424. TLinearColors = TGPLinearColors;
  9425. IBlend = IGPBlend;
  9426. TBlend = TGPBlend;
  9427. IColorBlend = IGPColorBlend;
  9428. TColorBlend = TGPColorBlend;
  9429. ILinearGradientBrush = IGPLinearGradientBrush;
  9430. TLinearGradientBrush = TGPLinearGradientBrush;
  9431. IHatchBrush = IGPHatchBrush;
  9432. THatchBrush = TGPHatchBrush;
  9433. IDashPattern = IGPDashPattern;
  9434. ICompoundArray = IGPCompoundArray;
  9435. IPen = IGPPen;
  9436. TPen = TGPPen;
  9437. ITabStops = IGPTabStops;
  9438. ICharacterRanges = IGPCharacterRanges;
  9439. IStringFormat = IGPStringFormat;
  9440. TStringFormat = TGPStringFormat;
  9441. IPathTypes = IGPPathTypes;
  9442. IPathPoints = IGPPathPoints;
  9443. IPathPointsI = IGPPathPointsI;
  9444. IPathData = IGPPathData;
  9445. TPathData = TGPPathData;
  9446. IGraphicsPath = IGPGraphicsPath;
  9447. TGraphicsPath = TGPGraphicsPath;
  9448. IGraphicsPathIterator = IGPGraphicsPathIterator;
  9449. TGraphicsPathIterator = TGPGraphicsPathIterator;
  9450. IColors = IGPColors;
  9451. IPathGradientBrush = IGPPathGradientBrush;
  9452. TPathGradientBrush = TGPPathGradientBrush;
  9453. IRegions = IGPRegions;
  9454. IGraphics = IGPGraphics;
  9455. TGraphics = TGPGraphics;
  9456. {$IF (GDIPVER >= $0110)}
  9457. TConvertToEmfPlusFlags = TGPConvertToEmfPlusFlags;
  9458. TPaletteType = TGPPaletteType;
  9459. TDitherType = TGPDitherType;
  9460. TItemDataPosition = TGPItemDataPosition;
  9461. TImageItemData = TGPImageItemData;
  9462. PImageItemData = PGPImageItemData;
  9463. TColorChannelLUT = TGPColorChannelLUT;
  9464. THistogramFormat = TGPHistogramFormat;
  9465. IHistogram = IGPHistogram;
  9466. THistogram = TGPHistogram;
  9467. TSharpenParams = TGPSharpenParams;
  9468. PSharpenParams = PGPSharpenParams;
  9469. TBlurParams = TGPBlurParams;
  9470. PBlurParams = PGPBlurParams;
  9471. TBrightnessContrastParams = TGPBrightnessContrastParams;
  9472. PBrightnessContrastParams = PGPBrightnessContrastParams;
  9473. TRedEyeCorrectionParams = TGPRedEyeCorrectionParams;
  9474. PRedEyeCorrectionParams = PGPRedEyeCorrectionParams;
  9475. THueSaturationLightnessParams = TGPHueSaturationLightnessParams;
  9476. PHueSaturationLightnessParams = PGPHueSaturationLightnessParams;
  9477. TTintParams = TGPTintParams;
  9478. PTintParams = PGPTintParams;
  9479. TLevelsParams = TGPLevelsParams;
  9480. PLevelsParams = PGPLevelsParams;
  9481. TColorBalanceParams = TGPColorBalanceParams;
  9482. PColorBalanceParams = PGPColorBalanceParams;
  9483. TColorLUTParams = TGPColorLUTParams;
  9484. PColorLUTParams = PGPColorLUTParams;
  9485. TCurveAdjustments = TGPCurveAdjustments;
  9486. TCurveChannel = TGPCurveChannel;
  9487. TColorCurveParams = TGPColorCurveParams;
  9488. PColorCurveParams = PGPColorCurveParams;
  9489. IEffect = IGPEffect;
  9490. TEffect = TGPEffect;
  9491. IBlur = IGPBlur;
  9492. TBlur = TGPBlur;
  9493. ISharpen = IGPSharpen;
  9494. TSharpen = TGPSharpen;
  9495. IRedEyeCorrection = IGPRedEyeCorrection;
  9496. TRedEyeCorrection = TGPRedEyeCorrection;
  9497. IBrightnessContrast = IGPBrightnessContrast;
  9498. TBrightnessContrast = TGPBrightnessContrast;
  9499. IHueSaturationLightness = IGPHueSaturationLightness;
  9500. THueSaturationLightness = TGPHueSaturationLightness;
  9501. ILevels = IGPLevels;
  9502. TLevels = TGPLevels;
  9503. ITint = IGPTint;
  9504. TTint = TGPTint;
  9505. IColorBalance = IGPColorBalance;
  9506. TColorBalance = TGPColorBalance;
  9507. IColorMatrixEffect = IGPColorMatrixEffect;
  9508. TColorMatrixEffect = TGPColorMatrixEffect;
  9509. IColorLUT = IGPColorLUT;
  9510. TColorLUT = TGPColorLUT;
  9511. IColorCurve = IGPColorCurve;
  9512. TColorCurve = TGPColorCurve;
  9513. {$IFEND} // (GDIPVER >= $0110)
  9514. {$ENDIF} // GDIP_ALIAS
  9515. {$ENDREGION 'Aliases'}
  9516.  
  9517. implementation
  9518.  
  9519. {$POINTERMATH ON}
  9520.  
  9521. {$REGION 'Support classes'}
  9522.  
  9523. { TGPArray<T>.TEnumerator }
  9524.  
  9525. constructor TGPArray<T>.TEnumerator.Create(const AArray: TGPArray<T>);
  9526. begin
  9527. inherited Create;
  9528. FArray := AArray;
  9529. FIndex := -1;
  9530. end;
  9531.  
  9532. function TGPArray<T>.TEnumerator.DoGetCurrent: T;
  9533. begin
  9534. Result := GetCurrent;
  9535. end;
  9536.  
  9537. function TGPArray<T>.TEnumerator.DoMoveNext: Boolean;
  9538. begin
  9539. Result := MoveNext;
  9540. end;
  9541.  
  9542. function TGPArray<T>.TEnumerator.GetCurrent: T;
  9543. begin
  9544. Result := FArray.GetItem(FIndex);
  9545. end;
  9546.  
  9547. function TGPArray<T>.TEnumerator.MoveNext: Boolean;
  9548. begin
  9549. if (FIndex >= FArray.GetCount) then
  9550. Exit(False);
  9551. Inc(FIndex);
  9552. Result := (FIndex < FArray.GetCount);
  9553. end;
  9554.  
  9555. { TGPArray<T> }
  9556.  
  9557. constructor TGPArray<T>.Create(const Count: Integer);
  9558. begin
  9559. inherited Create;
  9560. SetLength(FItems, Count);
  9561. end;
  9562.  
  9563. function TGPArray<T>.GetCount: Integer;
  9564. begin
  9565. Result := Length(FItems);
  9566. end;
  9567.  
  9568. function TGPArray<T>.GetEnumerator: TEnumerator<T>;
  9569. begin
  9570. Result := TEnumerator.Create(Self);
  9571. end;
  9572.  
  9573. function TGPArray<T>.GetItem(const Index: Integer): T;
  9574. begin
  9575. Result := FItems[Index];
  9576. end;
  9577.  
  9578. function TGPArray<T>.GetItemPtr: Pointer;
  9579. begin
  9580. Result := @FItems[0];
  9581. end;
  9582.  
  9583. procedure TGPArray<T>.SetCount(const Value: Integer);
  9584. begin
  9585. if (Value <> Length(FItems)) then
  9586. SetLength(FItems, Value);
  9587. end;
  9588.  
  9589. procedure TGPArray<T>.SetItem(const Index: Integer; const Value: T);
  9590. begin
  9591. FItems[Index] := Value;
  9592. end;
  9593.  
  9594. { TGPBuffer }
  9595.  
  9596. constructor TGPBuffer.Create(const Data: Pointer; const Size: Cardinal);
  9597. begin
  9598. inherited Create;
  9599. FData := Data;
  9600. FSize := Size;
  9601. end;
  9602.  
  9603. destructor TGPBuffer.Destroy;
  9604. begin
  9605. FreeMem(FData);
  9606. inherited;
  9607. end;
  9608.  
  9609. function TGPBuffer.GetData: Pointer;
  9610. begin
  9611. Result := FData;
  9612. end;
  9613.  
  9614. function TGPBuffer.GetSize: Cardinal;
  9615. begin
  9616. Result := FSize;
  9617. end;
  9618.  
  9619. {$ENDREGION 'Support classes'}
  9620.  
  9621. {$REGION 'Utilities'}
  9622. procedure GdipCheck(const Status: TGPStatus); inline;
  9623. begin
  9624. if (Status <> Ok) then
  9625. raise EGdipError.Create(Status);
  9626. end;
  9627.  
  9628. function GdipHandle(const GpObject: IGdiplusBase): GpNativeHandle;
  9629. begin
  9630. if Assigned(GpObject) then
  9631. Result := GpObject.NativeHandle
  9632. else
  9633. Result := nil;
  9634. end;
  9635. { EGdipError }
  9636.  
  9637. constructor EGdipError.Create(const Status: TGPStatus);
  9638. var
  9639. S: String;
  9640. begin
  9641. case Status of
  9642. GenericError:
  9643. S := 'Generic Error';
  9644. InvalidParameter:
  9645. S := 'One of the arguments passed to the method was not valid';
  9646. OutOfMemory:
  9647. S := 'Out of Memory';
  9648. ObjectBusy:
  9649. S := 'One of the arguments is already in use in another thread';
  9650. InsufficientBuffer:
  9651. S := 'The specified buffer is not large enough to hold the data to be received';
  9652. NotImplemented:
  9653. S := 'Method is not implemented';
  9654. Win32Error:
  9655. S := 'Win32 Error: ' + SysErrorMessage(GetLastError);
  9656. WrongState:
  9657. S := 'The object is in an invalid state';
  9658. Aborted:
  9659. S := 'The method was aborted';
  9660. FileNotFound:
  9661. S := 'The specified image file or metafile cannot be found';
  9662. ValueOverflow:
  9663. S := 'The method performed an arithmetic operation that produces a numeric overflow';
  9664. AccessDenied:
  9665. S := 'A write operation is not allowed on the specified file';
  9666. UnknownImageFormat:
  9667. S := 'The specified image file format is not known';
  9668. FontFamilyNotFound:
  9669. S := 'The specified font family cannot be found';
  9670. FontStyleNotFound:
  9671. S := 'The specified style is not available for the specified font family';
  9672. NotTrueTypeFont:
  9673. S := 'The specified font is not a TrueType font';
  9674. UnsupportedGdiplusVersion:
  9675. S := 'The version of GDI+ installed on the system is incompatible with the requested version';
  9676. GdiplusNotInitialized:
  9677. S := 'GDI+ is not initialized';
  9678. PropertyNotFound:
  9679. S := 'The specified property does not exist in the image';
  9680. PropertyNotSupported:
  9681. S := 'The specified property is not supported by the format of the image';
  9682. {$IF (GDIPVER >= $0110)}
  9683. ProfileNotFound:
  9684. S := 'The color profile required to save an image in CMYK format was not found';
  9685. {$IFEND}
  9686. else
  9687. S := 'Unknown error: ' + IntToStr(Ord(Status));
  9688. end;
  9689. inherited Create('(GDI+ Error) ' + S);
  9690. end;
  9691. {$ENDREGION 'Utilities'}
  9692.  
  9693. {$REGION 'GdiplusBase.h'}
  9694. (*****************************************************************************
  9695. * GdiplusBase.h
  9696. * GDI+ base memory allocation class
  9697. *****************************************************************************)
  9698.  
  9699. { TGdiplusBase }
  9700.  
  9701. constructor TGdiplusBase.Create;
  9702. begin
  9703. inherited Create;
  9704. end;
  9705.  
  9706. procedure TGdiplusBase.FreeInstance;
  9707. begin
  9708. CleanupInstance;
  9709. GdipFree(Self);
  9710. end;
  9711.  
  9712. function TGdiplusBase.GetNativeHandle: GpNativeHandle;
  9713. begin
  9714. Result := FNativeHandle;
  9715. end;
  9716.  
  9717. class function TGdiplusBase.NewInstance: TObject;
  9718. begin
  9719. Result := InitInstance(GdipAlloc(InstanceSize));
  9720.  
  9721. { Set an implicit refcount so that refcounting during construction won't
  9722. destroy the object (see TInterfacedObject.NewInstance) }
  9723. TGdiplusBase(Result).FRefCount := 1;
  9724. end;
  9725.  
  9726. procedure TGdiplusBase.SetNativeHandle(const Value: GpNativeHandle);
  9727. begin
  9728. FNativeHandle := Value;
  9729. end;
  9730.  
  9731. {$ENDREGION 'GdiplusBase.h'}
  9732.  
  9733. {$REGION 'GdiplusEnums.h'}
  9734. (*****************************************************************************
  9735. * GdiplusEnums.h
  9736. * GDI+ Enumeration Types
  9737. *****************************************************************************)
  9738.  
  9739. function ObjectTypeIsValid(const ObjectType: TGPObjectType): Boolean; inline;
  9740. begin
  9741. Result := (ObjectType >= ObjectTypeMin) and (ObjectType <= ObjectTypeMax);
  9742. end;
  9743. {$ENDREGION 'GdiplusEnums.h' }
  9744.  
  9745. {$REGION 'GdiplusTypes.h'}
  9746.  
  9747. { TGPSizeF }
  9748.  
  9749. class operator TGPSizeF.Add(const A, B: TGPSizeF): TGPSizeF;
  9750. begin
  9751. Result.Initialize(A.Width + B.Width, A.Height + B.Height);
  9752. end;
  9753.  
  9754. class function TGPSizeF.Create(const Size: TGPSizeF): TGPSizeF;
  9755. begin
  9756. Result.Initialize(Size);
  9757. end;
  9758.  
  9759. class function TGPSizeF.Create(const AWidth, AHeight: Single): TGPSizeF;
  9760. begin
  9761. Result.Initialize(AWidth, AHeight);
  9762. end;
  9763.  
  9764. function TGPSizeF.Empty: Boolean;
  9765. begin
  9766. Result := (Width = 0) and (Height = 0);
  9767. end;
  9768.  
  9769. function TGPSizeF.Equals(const Size: TGPSizeF): Boolean;
  9770. begin
  9771. Result := (Width = Size.Width) and (Height = Size.Height);
  9772. end;
  9773.  
  9774. procedure TGPSizeF.Initialize;
  9775. begin
  9776. Width := 0;
  9777. Height := 0;
  9778. end;
  9779.  
  9780. procedure TGPSizeF.Initialize(const AWidth, AHeight: Single);
  9781. begin
  9782. Width := AWidth;
  9783. Height := AHeight;
  9784. end;
  9785.  
  9786. procedure TGPSizeF.Initialize(const Size: TGPSizeF);
  9787. begin
  9788. Width := Size.Width;
  9789. Height := Size.Height;
  9790. end;
  9791.  
  9792. class operator TGPSizeF.Subtract(const A, B: TGPSizeF): TGPSizeF;
  9793. begin
  9794. Result.Initialize(A.Width - B.Width, A.Height - B.Height);
  9795. end;
  9796.  
  9797. { TGPSize }
  9798.  
  9799. class operator TGPSize.Add(const A, B: TGPSize): TGPSize;
  9800. begin
  9801. Result.Initialize(A.Width + B.Width, A.Height + B.Height);
  9802. end;
  9803.  
  9804. class function TGPSize.Create(const Size: TGPSize): TGPSize;
  9805. begin
  9806. Result.Initialize(Size);
  9807. end;
  9808.  
  9809. class function TGPSize.Create(const AWidth, AHeight: Integer): TGPSize;
  9810. begin
  9811. Result.Initialize(AWidth, AHeight);
  9812. end;
  9813.  
  9814. function TGPSize.Empty: Boolean;
  9815. begin
  9816. Result := (Width = 0) and (Height = 0);
  9817. end;
  9818.  
  9819. function TGPSize.Equals(const Size: TGPSize): Boolean;
  9820. begin
  9821. Result := (Width = Size.Width) and (Height = Size.Height);
  9822. end;
  9823.  
  9824. procedure TGPSize.Initialize;
  9825. begin
  9826. Width := 0;
  9827. Height := 0;
  9828. end;
  9829.  
  9830. procedure TGPSize.Initialize(const AWidth, AHeight: Integer);
  9831. begin
  9832. Width := AWidth;
  9833. Height := AHeight;
  9834. end;
  9835.  
  9836. procedure TGPSize.Initialize(const Size: TGPSize);
  9837. begin
  9838. Width := Size.Width;
  9839. Height := Size.Height;
  9840. end;
  9841.  
  9842. class operator TGPSize.Subtract(const A, B: TGPSize): TGPSize;
  9843. begin
  9844. Result.Initialize(A.Width - B.Width, A.Height - B.Height);
  9845. end;
  9846.  
  9847. { TGPPointF }
  9848.  
  9849. class operator TGPPointF.Add(const A, B: TGPPointF): TGPPointF;
  9850. begin
  9851. Result.Initialize(A.X + B.X, A.Y + B.Y);
  9852. end;
  9853.  
  9854. class function TGPPointF.Create(const Point: TGPPointF): TGPPointF;
  9855. begin
  9856. Result.Initialize(Point);
  9857. end;
  9858.  
  9859. class function TGPPointF.Create(const Size: TGPSizeF): TGPPointF;
  9860. begin
  9861. Result.Initialize(Size);
  9862. end;
  9863.  
  9864. class function TGPPointF.Create(const AX, AY: Single): TGPPointF;
  9865. begin
  9866. Result.Initialize(AX, AY);
  9867. end;
  9868.  
  9869. function TGPPointF.Equals(const Point: TGPPointF): Boolean;
  9870. begin
  9871. Result := (X = Point.X) and (Y = Point.Y);
  9872. end;
  9873.  
  9874. procedure TGPPointF.Initialize;
  9875. begin
  9876. X := 0;
  9877. Y := 0;
  9878. end;
  9879.  
  9880. procedure TGPPointF.Initialize(const Point: TGPPointF);
  9881. begin
  9882. X := Point.X;
  9883. Y := Point.Y;
  9884. end;
  9885.  
  9886. procedure TGPPointF.Initialize(const AX, AY: Single);
  9887. begin
  9888. X := AX;
  9889. Y := AY;
  9890. end;
  9891.  
  9892. procedure TGPPointF.Initialize(const Size: TGPSizeF);
  9893. begin
  9894. X := Size.Width;
  9895. Y := Size.Height;
  9896. end;
  9897.  
  9898. class operator TGPPointF.Subtract(const A, B: TGPPointF): TGPPointF;
  9899. begin
  9900. Result.Initialize(A.X - B.X, A.Y - B.Y);
  9901. end;
  9902.  
  9903. { TGPPoint }
  9904.  
  9905. class operator TGPPoint.Add(const A, B: TGPPoint): TGPPoint;
  9906. begin
  9907. Result.Initialize(A.X + B.X, A.Y + B.Y);
  9908. end;
  9909.  
  9910. class function TGPPoint.Create(const Point: TGPPoint): TGPPoint;
  9911. begin
  9912. Result.Initialize(Point);
  9913. end;
  9914.  
  9915. class function TGPPoint.Create(const Size: TGPSize): TGPPoint;
  9916. begin
  9917. Result.Initialize(Size);
  9918. end;
  9919.  
  9920. class function TGPPoint.Create(const AX, AY: Integer): TGPPoint;
  9921. begin
  9922. Result.Initialize(AX, AY);
  9923. end;
  9924.  
  9925. function TGPPoint.Equals(const Point: TGPPoint): Boolean;
  9926. begin
  9927. Result := (X = Point.X) and (Y = Point.Y);
  9928. end;
  9929.  
  9930. procedure TGPPoint.Initialize;
  9931. begin
  9932. X := 0;
  9933. Y := 0;
  9934. end;
  9935.  
  9936. procedure TGPPoint.Initialize(const Point: TGPPoint);
  9937. begin
  9938. X := Point.X;
  9939. Y := Point.Y;
  9940. end;
  9941.  
  9942. procedure TGPPoint.Initialize(const AX, AY: Integer);
  9943. begin
  9944. X := AX;
  9945. Y := AY;
  9946. end;
  9947.  
  9948. procedure TGPPoint.Initialize(const Size: TGPSize);
  9949. begin
  9950. X := Size.Width;
  9951. Y := Size.Height;
  9952. end;
  9953.  
  9954. class operator TGPPoint.Subtract(const A, B: TGPPoint): TGPPoint;
  9955. begin
  9956. Result.Initialize(A.X - B.X, A.Y - B.Y);
  9957. end;
  9958.  
  9959. { TGPRectF }
  9960.  
  9961. function TGPRectF.Clone: TGPRectF;
  9962. begin
  9963. Result := Self;
  9964. end;
  9965.  
  9966. function TGPRectF.Contains(const Rect: TGPRectF): Boolean;
  9967. begin
  9968. Result := (X <= Rect.X) and (Rect.Right <= Right)
  9969. and (Y <= Rect.Y) and (Rect.Bottom <= Bottom);
  9970. end;
  9971.  
  9972. class function TGPRectF.Create(const AX, AY, AWidth, AHeight: Single): TGPRectF;
  9973. begin
  9974. Result.Initialize(AX, AY, AWidth, AHeight);
  9975. end;
  9976.  
  9977. class function TGPRectF.Create(const Location: TGPPointF;
  9978. const Size: TGPSizeF): TGPRectF;
  9979. begin
  9980. Result.Initialize(Location, Size);
  9981. end;
  9982.  
  9983. function TGPRectF.Contains(const Point: TGPPointF): Boolean;
  9984. begin
  9985. Result := Contains(Point.X, Point.Y);
  9986. end;
  9987.  
  9988. function TGPRectF.Contains(const AX, AY: Single): Boolean;
  9989. begin
  9990. Result := (AX >= X) and (AX < (X + Width)) and (AY >= Y) and (AY < (Y + Height));
  9991. end;
  9992.  
  9993. function TGPRectF.Equals(const Rect: TGPRectF): Boolean;
  9994. begin
  9995. Result := (X = Rect.X) and (Y = Rect.Y) and (Width = Rect.Width) and (Height = Rect.Height);
  9996. end;
  9997.  
  9998. function TGPRectF.GetBottom: Single;
  9999. begin
  10000. Result := Y + Height;
  10001. end;
  10002.  
  10003. function TGPRectF.GetBounds: TGPRectF;
  10004. begin
  10005. Result := Self;
  10006. end;
  10007.  
  10008. function TGPRectF.GetLocation: TGPPointF;
  10009. begin
  10010. Result.X := X;
  10011. Result.Y := Y;
  10012. end;
  10013.  
  10014. function TGPRectF.GetRight: Single;
  10015. begin
  10016. Result := X + Width;
  10017. end;
  10018.  
  10019. function TGPRectF.GetSize: TGPSizeF;
  10020. begin
  10021. Result.Width := Width;
  10022. Result.Height := Height;
  10023. end;
  10024.  
  10025. procedure TGPRectF.Inflate(const Point: TGPPointF);
  10026. begin
  10027. Inflate(Point.X, Point.Y);
  10028. end;
  10029.  
  10030. procedure TGPRectF.Inflate(const DX, DY: Single);
  10031. begin
  10032. X := X - DX;
  10033. Y := Y - DY;
  10034. Width := Width + (2 * DX);
  10035. Height := Height + (2 * DY);
  10036. end;
  10037.  
  10038. procedure TGPRectF.Initialize;
  10039. begin
  10040. X := 0;
  10041. Y := 0;
  10042. Width := 0;
  10043. Height := 0;
  10044. end;
  10045.  
  10046. procedure TGPRectF.Initialize(const AX, AY, AWidth, AHeight: Single);
  10047. begin
  10048. X := AX;
  10049. Y := AY;
  10050. Width := AWidth;
  10051. Height := AHeight;
  10052. end;
  10053.  
  10054. procedure TGPRectF.Inflate(const DXY: Single);
  10055. begin
  10056. Inflate(DXY, DXY);
  10057. end;
  10058.  
  10059. procedure TGPRectF.Initialize(const Location: TGPPointF; const Size: TGPSizeF);
  10060. begin
  10061. X := Location.X;
  10062. Y := Location.Y;
  10063. Width := Size.Width;
  10064. Height := Size.Height;
  10065. end;
  10066.  
  10067. procedure TGPRectF.InitializeFromLTRB(const Left, Top, Right, Bottom: Single);
  10068. begin
  10069. X := Left;
  10070. Y := Top;
  10071. Width := Right - Left;
  10072. Height := Bottom - Top;
  10073. end;
  10074.  
  10075. class function TGPRectF.Intersect(out C: TGPRectF; const A, B: TGPRectF): Boolean;
  10076. var
  10077. Right, Bottom, Left, Top: Single;
  10078. begin
  10079. Right := Min(A.Right, B.Right);
  10080. Bottom := Min(A.Bottom, B.Bottom);
  10081. Left := Max(A.Left, B.Left);
  10082. Top := Max(A.Top, B.Top);
  10083.  
  10084. C.X := Left;
  10085. C.Y := Top;
  10086. C.Width := Right - Left;
  10087. C.Height := Bottom - Top;
  10088. Result := (not C.IsEmptyArea);
  10089. end;
  10090.  
  10091. function TGPRectF.Intersect(const Rect: TGPRectF): Boolean;
  10092. begin
  10093. Result := Intersect(Self, Self, Rect);
  10094. end;
  10095.  
  10096. function TGPRectF.IntersectsWith(const Rect: TGPRectF): Boolean;
  10097. begin
  10098. Result := (Left < Rect.Right) and (Top < Rect.Bottom)
  10099. and (Right > Rect.Left) and (Bottom > Rect.Top);
  10100. end;
  10101.  
  10102. function TGPRectF.IsEmptyArea: Boolean;
  10103. begin
  10104. Result := (Width <= REAL_EPSILON) or (Height <= REAL_EPSILON);
  10105. end;
  10106.  
  10107. procedure TGPRectF.Offset(const DX, DY: Single);
  10108. begin
  10109. X := X + DX;
  10110. Y := Y + DY;
  10111. end;
  10112.  
  10113. function TGPRectF.Union(const Rect: TGPRectF): Boolean;
  10114. begin
  10115. Result := Union(Self, Self, Rect);
  10116. end;
  10117.  
  10118. procedure TGPRectF.Offset(const Point: TGPPointF);
  10119. begin
  10120. Offset(Point.X, Point.Y);
  10121. end;
  10122.  
  10123. class function TGPRectF.Union(out C: TGPRectF; const A, B: TGPRectF): Boolean;
  10124. var
  10125. Right, Bottom, Left, Top: Single;
  10126. begin
  10127. Right := Max(A.Right, B.Right);
  10128. Bottom := Max(A.Bottom, B.Bottom);
  10129. Left := Min(A.Left, B.Left);
  10130. Top := Min(A.Top, B.Top);
  10131.  
  10132. C.X := Left;
  10133. C.Y := Top;
  10134. C.Width := Right - Left;
  10135. C.Height := Bottom - Top;
  10136. Result := (not C.IsEmptyArea);
  10137. end;
  10138.  
  10139. { TGPRect }
  10140.  
  10141. function TGPRect.Clone: TGPRect;
  10142. begin
  10143. Result := Self;
  10144. end;
  10145.  
  10146. function TGPRect.Contains(const Rect: TGPRect): Boolean;
  10147. begin
  10148. Result := (X <= Rect.X) and (Rect.Right <= Right)
  10149. and (Y <= Rect.Y) and (Rect.Bottom <= Bottom);
  10150. end;
  10151.  
  10152. class function TGPRect.Create(const AX, AY, AWidth, AHeight: Integer): TGPRect;
  10153. begin
  10154. Result.Initialize(AX, AY, AWidth, AHeight);
  10155. end;
  10156.  
  10157. class function TGPRect.Create(const Location: TGPPoint; const Size: TGPSize): TGPRect;
  10158. begin
  10159. Result.Initialize(Location, Size);
  10160. end;
  10161.  
  10162. class function TGPRect.Create(const Rect: Windows.TRect): TGPRect;
  10163. begin
  10164. Result.Initialize(Rect);
  10165. end;
  10166.  
  10167. function TGPRect.Contains(const Point: TGPPoint): Boolean;
  10168. begin
  10169. Result := Contains(Point.X, Point.Y);
  10170. end;
  10171.  
  10172. function TGPRect.Contains(const AX, AY: Integer): Boolean;
  10173. begin
  10174. Result := (AX >= X) and (AX < (X + Width)) and (AY >= Y) and (AY < (Y + Height));
  10175. end;
  10176.  
  10177. function TGPRect.Equals(const Rect: TGPRect): Boolean;
  10178. begin
  10179. Result := (X = Rect.X) and (Y = Rect.Y) and (Width = Rect.Width) and (Height = Rect.Height);
  10180. end;
  10181.  
  10182. function TGPRect.GetBottom: Integer;
  10183. begin
  10184. Result := Y + Height;
  10185. end;
  10186.  
  10187. function TGPRect.GetBounds: TGPRect;
  10188. begin
  10189. Result := Self;
  10190. end;
  10191.  
  10192. function TGPRect.GetLocation: TGPPoint;
  10193. begin
  10194. Result.X := X;
  10195. Result.Y := Y;
  10196. end;
  10197.  
  10198. function TGPRect.GetRight: Integer;
  10199. begin
  10200. Result := X + Width;
  10201. end;
  10202.  
  10203. function TGPRect.GetSize: TGPSize;
  10204. begin
  10205. Result.Width := Width;
  10206. Result.Height := Height;
  10207. end;
  10208.  
  10209. procedure TGPRect.Inflate(const Point: TGPPoint);
  10210. begin
  10211. Inflate(Point.X, Point.Y);
  10212. end;
  10213.  
  10214. procedure TGPRect.Inflate(const DX, DY: Integer);
  10215. begin
  10216. X := X - DX;
  10217. Y := Y - DY;
  10218. Width := Width + (2 * DX);
  10219. Height := Height + (2 * DY);
  10220. end;
  10221.  
  10222. procedure TGPRect.Initialize;
  10223. begin
  10224. X := 0;
  10225. Y := 0;
  10226. Width := 0;
  10227. Height := 0;
  10228. end;
  10229.  
  10230. procedure TGPRect.Initialize(const AX, AY, AWidth, AHeight: Integer);
  10231. begin
  10232. X := AX;
  10233. Y := AY;
  10234. Width := AWidth;
  10235. Height := AHeight;
  10236. end;
  10237.  
  10238. procedure TGPRect.Initialize(const Location: TGPPoint; const Size: TGPSize);
  10239. begin
  10240. X := Location.X;
  10241. Y := Location.Y;
  10242. Width := Size.Width;
  10243. Height := Size.Height;
  10244. end;
  10245.  
  10246. procedure TGPRect.Initialize(const Rect: Windows.TRect);
  10247. begin
  10248. X := Rect.Left;
  10249. Y := Rect.Top;
  10250. Width := Rect.Right - Rect.Left;
  10251. Height := Rect.Bottom - Rect.Top;
  10252. end;
  10253.  
  10254. procedure TGPRect.InitializeFromLTRB(const Left, Top, Right, Bottom: Integer);
  10255. begin
  10256. X := Left;
  10257. Y := Top;
  10258. Width := Right - Left;
  10259. Height := Bottom - Top;
  10260. end;
  10261.  
  10262. class function TGPRect.Intersect(out C: TGPRect; const A, B: TGPRect): Boolean;
  10263. var
  10264. Right, Bottom, Left, Top: Integer;
  10265. begin
  10266. Right := Min(A.Right, B.Right);
  10267. Bottom := Min(A.Bottom, B.Bottom);
  10268. Left := Max(A.Left, B.Left);
  10269. Top := Max(A.Top, B.Top);
  10270.  
  10271. C.X := Left;
  10272. C.Y := Top;
  10273. C.Width := Right - Left;
  10274. C.Height := Bottom - Top;
  10275. Result := (not C.IsEmptyArea);
  10276. end;
  10277.  
  10278. function TGPRect.Intersect(const Rect: TGPRect): Boolean;
  10279. begin
  10280. Result := Intersect(Self, Self, Rect);
  10281. end;
  10282.  
  10283. function TGPRect.IntersectsWith(const Rect: TGPRect): Boolean;
  10284. begin
  10285. Result := (Left < Rect.Right) and (Top < Rect.Bottom)
  10286. and (Right > Rect.Left) and (Bottom > Rect.Top);
  10287. end;
  10288.  
  10289. function TGPRect.IsEmptyArea: Boolean;
  10290. begin
  10291. Result := (Width <= REAL_EPSILON) or (Height <= REAL_EPSILON);
  10292. end;
  10293.  
  10294. procedure TGPRect.Offset(const DX, DY: Integer);
  10295. begin
  10296. X := X + DX;
  10297. Y := Y + DY;
  10298. end;
  10299.  
  10300. function TGPRect.Union(const Rect: TGPRect): Boolean;
  10301. begin
  10302. Result := Union(Self, Self, Rect);
  10303. end;
  10304.  
  10305. procedure TGPRect.Offset(const Point: TGPPoint);
  10306. begin
  10307. Offset(Point.X, Point.Y);
  10308. end;
  10309.  
  10310. class function TGPRect.Union(out C: TGPRect; const A, B: TGPRect): Boolean;
  10311. var
  10312. Right, Bottom, Left, Top: Integer;
  10313. begin
  10314. Right := Max(A.Right, B.Right);
  10315. Bottom := Max(A.Bottom, B.Bottom);
  10316. Left := Min(A.Left, B.Left);
  10317. Top := Min(A.Top, B.Top);
  10318.  
  10319. C.X := Left;
  10320. C.Y := Top;
  10321. C.Width := Right - Left;
  10322. C.Height := Bottom - Top;
  10323. Result := (not C.IsEmptyArea);
  10324. end;
  10325.  
  10326. { TGPCharacterRange }
  10327.  
  10328. procedure TGPCharacterRange.Initialize;
  10329. begin
  10330. First := 0;
  10331. Length := 0;
  10332. end;
  10333.  
  10334. procedure TGPCharacterRange.Initialize(const AFirst, ALength: Integer);
  10335. begin
  10336. First := AFirst;
  10337. Length := ALength;
  10338. end;
  10339. {$ENDREGION 'GdiplusTypes.h'}
  10340.  
  10341. {$REGION 'GdiplusInit.h'}
  10342.  
  10343. { TGdiplusStartupInput }
  10344.  
  10345. procedure TGdiplusStartupInput.Intialize(
  10346. const ADebugEventCallback: TGPDebugEventProc; const ASuppressBackgroundThread,
  10347. ASuppressExternalCodecs: Boolean);
  10348. begin
  10349. GdiplusVersion := 1;
  10350. DebugEventCallback := ADebugEventCallback;
  10351. SuppressBackgroundThread := ASuppressBackgroundThread;
  10352. SuppressExternalCodecs := ASuppressExternalCodecs;
  10353. end;
  10354.  
  10355. {$IF (GDIPVER >= $0110)}
  10356.  
  10357. { TGdiplusStartupInputEx }
  10358.  
  10359. procedure TGdiplusStartupInputEx.Intialize(const AStartupParameters: Integer;
  10360. const ADebugEventCallback: TGPDebugEventProc; const ASuppressBackgroundThread,
  10361. ASuppressExternalCodecs: Boolean);
  10362. begin
  10363. GdiplusVersion := 2;
  10364. DebugEventCallback := ADebugEventCallback;
  10365. SuppressBackgroundThread := ASuppressBackgroundThread;
  10366. SuppressExternalCodecs := ASuppressExternalCodecs;
  10367. StartupParameters := AStartupParameters;
  10368. end;
  10369. {$IFEND}
  10370.  
  10371. {$ENDREGION 'GdiplusInit.h'}
  10372.  
  10373. {$REGION 'GdiplusPixelFormats.h'}
  10374. function GetPixelFormatSize(const PixFmt: TGPPixelFormat): Integer; inline;
  10375. begin
  10376. Result := (PixFmt shr 8) and $FF;
  10377. end;
  10378.  
  10379. function IsIndexedPixelFormat(const PixFmt: TGPPixelFormat): Boolean; inline;
  10380. begin
  10381. Result := ((PixFmt and PixelFormatIndexed) <> 0);
  10382. end;
  10383.  
  10384. function IsAlphaPixelFormat(const PixFmt: TGPPixelFormat): Boolean; inline;
  10385. begin
  10386. Result := ((PixFmt and PixelFormatAlpha) <> 0);
  10387. end;
  10388.  
  10389. function IsExtendedPixelFormat(const PixFmt: TGPPixelFormat): Boolean; inline;
  10390. begin
  10391. Result := ((PixFmt and PixelFormatExtended) <> 0);
  10392. end;
  10393.  
  10394. function IsCanonicalPixelFormat(const PixFmt: TGPPixelFormat): Boolean; inline;
  10395. begin
  10396. Result := ((PixFmt and PixelFormatCanonical) <> 0);
  10397. end;
  10398.  
  10399. {$ENDREGION 'GdiplusPixelFormats.h'}
  10400.  
  10401. {$REGION 'GdiplusColor.h'}
  10402.  
  10403. { TGPColor }
  10404.  
  10405. class function TGPColor.Create(const AArgb: ARGB): TGPColor;
  10406. begin
  10407. Result.FArgb := AArgb;
  10408. end;
  10409.  
  10410. class function TGPColor.CreateFromColorRef(const A: Byte; const ColorRef: TColorRef): TGPColor;
  10411. begin
  10412. if (ColorRef < 0) then
  10413. Result.FArgb := GetSysColor(ColorRef and $000000FF)
  10414. else
  10415. Result.FArgb := ColorRef;
  10416.  
  10417. Result.FArgb := MakeARGB(A, Byte(Result.FArgb), Byte(Result.FArgb shr 8), Byte(Result.FArgb shr 16));
  10418. end;
  10419.  
  10420. class function TGPColor.CreateFromColorRef(const ColorRef: TColorRef): TGPColor;
  10421. begin
  10422. Result.SetColorRef(ColorRef);
  10423. end;
  10424.  
  10425. class function TGPColor.Create(const R, G, B: Byte): TGPColor;
  10426. begin
  10427. Result.FArgb := MakeARGB(255, R, G, B);
  10428. end;
  10429.  
  10430. class function TGPColor.Create(const A, R, G, B: Byte): TGPColor;
  10431. begin
  10432. Result.FArgb := MakeARGB(A, R, G, B);
  10433. end;
  10434.  
  10435. function TGPColor.GetAlpha: Byte;
  10436. begin
  10437. Result := Byte(FArgb shr AlphaShift);
  10438. end;
  10439.  
  10440. function TGPColor.GetBlue: Byte;
  10441. begin
  10442. Result := Byte(FArgb shr BlueShift);
  10443. end;
  10444.  
  10445. function TGPColor.GetColorRef: TColorRef;
  10446. begin
  10447. Result := GetRed or (GetGreen shl 8) or (GetBlue shl 16);
  10448. end;
  10449.  
  10450. function TGPColor.GetGreen: Byte;
  10451. begin
  10452. Result := Byte(FArgb shr GreenShift);
  10453. end;
  10454.  
  10455. function TGPColor.GetRed: Byte;
  10456. begin
  10457. Result := Byte(FArgb shr RedShift);
  10458. end;
  10459.  
  10460. procedure TGPColor.Initialize(const R, G, B: Byte);
  10461. begin
  10462. FArgb := MakeARGB(255, R, G, B);
  10463. end;
  10464.  
  10465. procedure TGPColor.Initialize;
  10466. begin
  10467. FArgb := Black;
  10468. end;
  10469.  
  10470. class operator TGPColor.Implicit(const AArgb: ARGB): TGPColor;
  10471. begin
  10472. Result.FArgb := AArgb;
  10473. end;
  10474.  
  10475. class operator TGPColor.Implicit(const Color: TGPColor): ARGB;
  10476. begin
  10477. Result := Color.FArgb;
  10478. end;
  10479.  
  10480. procedure TGPColor.Initialize(const AArgb: ARGB);
  10481. begin
  10482. FArgb := AArgb;
  10483. end;
  10484.  
  10485. procedure TGPColor.InitializeFromColorRef(const ColorRef: TColorRef);
  10486. begin
  10487. SetColorRef(ColorRef);
  10488. end;
  10489.  
  10490. procedure TGPColor.Initialize(const A, R, G, B: Byte);
  10491. begin
  10492. FArgb := MakeARGB(A, R, G, B)
  10493. end;
  10494.  
  10495. class function TGPColor.MakeARGB(const A, R, G, B: Byte): ARGB;
  10496. begin
  10497. Result := (ARGB(B) shl BlueShift) or
  10498. (ARGB(G) shl GreenShift) or
  10499. (ARGB(R) shl RedShift) or
  10500. (ARGB(A) shl AlphaShift);
  10501. end;
  10502.  
  10503. procedure TGPColor.SetAlpha(const Value: Byte);
  10504. begin
  10505. FArgb := (FArgb and (not AlphaMask)) or (Value shl AlphaShift);
  10506. end;
  10507.  
  10508. procedure TGPColor.SetBlue(const Value: Byte);
  10509. begin
  10510. FArgb := (FArgb and (not BlueMask)) or (Value shl BlueShift);
  10511. end;
  10512.  
  10513. procedure TGPColor.SetColorRef(const Value: TColorRef);
  10514. begin
  10515. if (Value < 0) then
  10516. FArgb := GetSysColor(Value and $000000FF)
  10517. else
  10518. FArgb := Value;
  10519. FArgb := MakeARGB(255, Byte(FArgb), Byte(FArgb shr 8), Byte(FArgb shr 16));
  10520. end;
  10521.  
  10522. procedure TGPColor.SetGreen(const Value: Byte);
  10523. begin
  10524. FArgb := (FArgb and (not GreenMask)) or (Value shl GreenShift);
  10525. end;
  10526.  
  10527. procedure TGPColor.SetRed(const Value: Byte);
  10528. begin
  10529. FArgb := (FArgb and (not RedMask)) or (Value shl RedShift);
  10530. end;
  10531.  
  10532. {$ENDREGION 'GdiplusColor.h'}
  10533.  
  10534. {$REGION 'GdiplusMetaHeader.h'}
  10535.  
  10536. { TGPMetafileHeader }
  10537.  
  10538. function TGPMetafileHeader.GetBounds: TGPRect;
  10539. begin
  10540. Result.Initialize(FX, FY, FWidth, FHeight);
  10541. end;
  10542.  
  10543. function TGPMetafileHeader.GetEmfHeader: PEnhMetaHeader3;
  10544. begin
  10545. if (IsEmfOrEmfPlus) then
  10546. Result := @FHeader.EmfHeader
  10547. else
  10548. Result := nil;
  10549. end;
  10550.  
  10551. function TGPMetafileHeader.GetWmfHeader: PMetaHeader;
  10552. begin
  10553. if (IsWmf) then
  10554. Result := @FHeader.WmfHeader
  10555. else
  10556. Result := nil;
  10557. end;
  10558.  
  10559. function TGPMetafileHeader.IsDisplay: Boolean;
  10560. begin
  10561. Result := IsEmfPlus and ((FEmfPlusFlags and GDIP_EMFPLUSFLAGS_DISPLAY) <> 0);
  10562. end;
  10563.  
  10564. function TGPMetafileHeader.IsEmf: Boolean;
  10565. begin
  10566. Result := (FMetafileType = MetafileTypeEmf);
  10567. end;
  10568.  
  10569. function TGPMetafileHeader.IsEmfOrEmfPlus: Boolean;
  10570. begin
  10571. Result := (FMetafileType >= MetafileTypeEmf);
  10572. end;
  10573.  
  10574. function TGPMetafileHeader.IsEmfPlus: Boolean;
  10575. begin
  10576. Result := (FMetafileType >= MetafileTypeEmfPlusOnly);
  10577. end;
  10578.  
  10579. function TGPMetafileHeader.IsEmfPlusDual: Boolean;
  10580. begin
  10581. Result := (FMetafileType = MetafileTypeEmfPlusDual);
  10582. end;
  10583.  
  10584. function TGPMetafileHeader.IsEmfPlusOnly: Boolean;
  10585. begin
  10586. Result := (FMetafileType = MetafileTypeEmfPlusOnly);
  10587. end;
  10588.  
  10589. function TGPMetafileHeader.IsWmf: Boolean;
  10590. begin
  10591. Result := (FMetafileType in [MetafileTypeWmf, MetafileTypeWmfPlaceable]);
  10592. end;
  10593.  
  10594. function TGPMetafileHeader.IsWmfPlaceable: Boolean;
  10595. begin
  10596. Result := (FMetafileType = MetafileTypeWmfPlaceable);
  10597. end;
  10598. {$ENDREGION 'GdiplusMetaHeader.h'}
  10599.  
  10600. {$REGION 'GdiplusColorMatrix.h'}
  10601. procedure TGPColorMatrix.SetToIdentity;
  10602. begin
  10603. FillChar(M, SizeOf(M), 0);
  10604. M[0,0] := 1;
  10605. M[1,1] := 1;
  10606. M[2,2] := 1;
  10607. M[3,3] := 1;
  10608. M[4,4] := 1;
  10609. end;
  10610. {$ENDREGION 'GdiplusColorMatrix.h'}
  10611.  
  10612. {$REGION 'GdiplusEffects.h'}
  10613. {$IF (GDIPVER >= $0110)}
  10614.  
  10615. { TGPEffect }
  10616.  
  10617. destructor TGPEffect.Destroy;
  10618. begin
  10619. ReleaseAuxData;
  10620.  
  10621. // Release the native Effect.
  10622. GdipCheck(GdipDeleteEffect(FNativeHandle));
  10623. inherited;
  10624. end;
  10625.  
  10626. function TGPEffect.GetAuxData: Pointer;
  10627. begin
  10628. Result := FAuxData;
  10629. end;
  10630.  
  10631. function TGPEffect.GetAuxDataSize: Integer;
  10632. begin
  10633. Result := FAuxDataSize;
  10634. end;
  10635.  
  10636. procedure TGPEffect.GetParameters(var Size: Cardinal; Params: Pointer);
  10637. begin
  10638. GdipCheck(GdipGetEffectParameters(FNativeHandle, Size, Params));
  10639. end;
  10640.  
  10641. function TGPEffect.GetParameterSize: Cardinal;
  10642. begin
  10643. GdipCheck(GdipGetEffectParameterSize(FNativeHandle, Result));
  10644. end;
  10645.  
  10646. function TGPEffect.GetUseAuxData: Boolean;
  10647. begin
  10648. Result := FUseAuxData;
  10649. end;
  10650.  
  10651. procedure TGPEffect.ReleaseAuxData;
  10652. begin
  10653. // pvData is allocated by ApplyEffect. Return the pointer so that
  10654. // it can be freed by the appropriate memory manager.
  10655. GdipFree(FAuxData);
  10656. FAuxData := nil;
  10657. FAuxDataSize := 0;
  10658. end;
  10659.  
  10660. procedure TGPEffect.SetAuxData(const Data: Pointer; const Size: Integer);
  10661. begin
  10662. ReleaseAuxData;
  10663. FAuxData := Data;
  10664. FAuxDataSize := Size;
  10665. end;
  10666.  
  10667. procedure TGPEffect.SetParameters(const Params: Pointer; const Size: Cardinal);
  10668. begin
  10669. GdipCheck(GdipSetEffectParameters(FNativeHandle, Params, Size));
  10670. end;
  10671.  
  10672. procedure TGPEffect.SetUseAuxData(const Value: Boolean);
  10673. begin
  10674. FUseAuxData := Value;
  10675. end;
  10676.  
  10677. { TGPBlur }
  10678.  
  10679. constructor TGPBlur.Create;
  10680. begin
  10681. inherited Create;
  10682. GdipCheck(GdipCreateEffect(BlurEffectGuid, FNativeHandle));
  10683. end;
  10684.  
  10685. function TGPBlur.GetParameters: TGPBlurParams;
  10686. var
  10687. Size: Cardinal;
  10688. begin
  10689. Size := SizeOf(Result);
  10690. inherited GetParameters(Size, @Result);
  10691. end;
  10692.  
  10693. procedure TGPBlur.SetParameters(const Value: TGPBlurParams);
  10694. begin
  10695. inherited SetParameters(@Value, SizeOf(Value));
  10696. end;
  10697.  
  10698. { TGPSharpen }
  10699.  
  10700. constructor TGPSharpen.Create;
  10701. begin
  10702. inherited Create;
  10703. GdipCheck(GdipCreateEffect(SharpenEffectGuid, FNativeHandle));
  10704. end;
  10705.  
  10706. function TGPSharpen.GetParameters: TGPSharpenParams;
  10707. var
  10708. Size: Cardinal;
  10709. begin
  10710. Size := SizeOf(Result);
  10711. inherited GetParameters(Size, @Result);
  10712. end;
  10713.  
  10714. procedure TGPSharpen.SetParameters(const Value: TGPSharpenParams);
  10715. begin
  10716. inherited SetParameters(@Value, SizeOf(Value));
  10717. end;
  10718.  
  10719. { TGPRedEyeCorrection }
  10720.  
  10721. constructor TGPRedEyeCorrection.Create;
  10722. begin
  10723. inherited Create;
  10724. GdipCheck(GdipCreateEffect(RedEyeCorrectionEffectGuid, FNativeHandle));
  10725. end;
  10726.  
  10727. function TGPRedEyeCorrection.GetParameters: TGPRedEyeCorrectionParams;
  10728. var
  10729. Size: Cardinal;
  10730. begin
  10731. Size := SizeOf(Result);
  10732. inherited GetParameters(Size, @Result);
  10733. end;
  10734.  
  10735. procedure TGPRedEyeCorrection.SetParameters(const Value: TGPRedEyeCorrectionParams);
  10736. begin
  10737. inherited SetParameters(@Value, SizeOf(Value)
  10738. + (Value.NumberOfAreas * SizeOf(Windows.TRect)));
  10739. end;
  10740.  
  10741. { TGPBrightnessContrast }
  10742.  
  10743. constructor TGPBrightnessContrast.Create;
  10744. begin
  10745. inherited Create;
  10746. GdipCheck(GdipCreateEffect(BrightnessContrastEffectGuid, FNativeHandle));
  10747. end;
  10748.  
  10749. function TGPBrightnessContrast.GetParameters: TGPBrightnessContrastParams;
  10750. var
  10751. Size: Cardinal;
  10752. begin
  10753. Size := SizeOf(Result);
  10754. inherited GetParameters(Size, @Result);
  10755. end;
  10756.  
  10757. procedure TGPBrightnessContrast.SetParameters(
  10758. const Value: TGPBrightnessContrastParams);
  10759. begin
  10760. inherited SetParameters(@Value, SizeOf(Value));
  10761. end;
  10762.  
  10763. { TGPHueSaturationLightness }
  10764.  
  10765. constructor TGPHueSaturationLightness.Create;
  10766. begin
  10767. inherited Create;
  10768. GdipCheck(GdipCreateEffect(HueSaturationLightnessEffectGuid, FNativeHandle));
  10769. end;
  10770.  
  10771. function TGPHueSaturationLightness.GetParameters: TGPHueSaturationLightnessParams;
  10772. var
  10773. Size: Cardinal;
  10774. begin
  10775. Size := SizeOf(Result);
  10776. inherited GetParameters(Size, @Result);
  10777. end;
  10778.  
  10779. procedure TGPHueSaturationLightness.SetParameters(
  10780. const Value: TGPHueSaturationLightnessParams);
  10781. begin
  10782. inherited SetParameters(@Value, SizeOf(Value));
  10783. end;
  10784.  
  10785. { TGPLevels }
  10786.  
  10787. constructor TGPLevels.Create;
  10788. begin
  10789. inherited Create;
  10790. GdipCheck(GdipCreateEffect(LevelsEffectGuid, FNativeHandle));
  10791. end;
  10792.  
  10793. function TGPLevels.GetParameters: TGPLevelsParams;
  10794. var
  10795. Size: Cardinal;
  10796. begin
  10797. Size := SizeOf(Result);
  10798. inherited GetParameters(Size, @Result);
  10799. end;
  10800.  
  10801. procedure TGPLevels.SetParameters(const Value: TGPLevelsParams);
  10802. begin
  10803. inherited SetParameters(@Value, SizeOf(Value));
  10804. end;
  10805.  
  10806. { TGPTint }
  10807.  
  10808. constructor TGPTint.Create;
  10809. begin
  10810. inherited Create;
  10811. GdipCheck(GdipCreateEffect(TintEffectGuid, FNativeHandle));
  10812. end;
  10813.  
  10814. function TGPTint.GetParameters: TGPTintParams;
  10815. var
  10816. Size: Cardinal;
  10817. begin
  10818. Size := SizeOf(Result);
  10819. inherited GetParameters(Size, @Result);
  10820. end;
  10821.  
  10822. procedure TGPTint.SetParameters(const Value: TGPTintParams);
  10823. begin
  10824. inherited SetParameters(@Value, SizeOf(Value));
  10825. end;
  10826.  
  10827. { TGPColorBalance }
  10828.  
  10829. constructor TGPColorBalance.Create;
  10830. begin
  10831. inherited Create;
  10832. GdipCheck(GdipCreateEffect(ColorBalanceEffectGuid, FNativeHandle));
  10833. end;
  10834.  
  10835. function TGPColorBalance.GetParameters: TGPColorBalanceParams;
  10836. var
  10837. Size: Cardinal;
  10838. begin
  10839. Size := SizeOf(Result);
  10840. inherited GetParameters(Size, @Result);
  10841. end;
  10842.  
  10843. procedure TGPColorBalance.SetParameters(const Value: TGPColorBalanceParams);
  10844. begin
  10845. inherited SetParameters(@Value, SizeOf(Value));
  10846. end;
  10847.  
  10848. { TGPColorMatrixEffect }
  10849.  
  10850. constructor TGPColorMatrixEffect.Create;
  10851. begin
  10852. inherited Create;
  10853. GdipCheck(GdipCreateEffect(ColorMatrixEffectGuid, FNativeHandle));
  10854. end;
  10855.  
  10856. function TGPColorMatrixEffect.GetParameters: TGPColorMatrix;
  10857. var
  10858. Size: Cardinal;
  10859. begin
  10860. Size := SizeOf(Result);
  10861. inherited GetParameters(Size, @Result);
  10862. end;
  10863.  
  10864. procedure TGPColorMatrixEffect.SetParameters(const Value: TGPColorMatrix);
  10865. begin
  10866. inherited SetParameters(@Value, SizeOf(Value));
  10867. end;
  10868.  
  10869. { TGPColorLUT }
  10870.  
  10871. constructor TGPColorLUT.Create;
  10872. begin
  10873. inherited Create;
  10874. GdipCheck(GdipCreateEffect(ColorLUTEffectGuid, FNativeHandle));
  10875. end;
  10876.  
  10877. function TGPColorLUT.GetParameters: TGPColorLUTParams;
  10878. var
  10879. Size: Cardinal;
  10880. begin
  10881. Size := SizeOf(Result);
  10882. inherited GetParameters(Size, @Result);
  10883. end;
  10884.  
  10885. procedure TGPColorLUT.SetParameters(const Value: TGPColorLUTParams);
  10886. begin
  10887. inherited SetParameters(@Value, SizeOf(Value));
  10888. end;
  10889.  
  10890. { TGPColorCurve }
  10891.  
  10892. constructor TGPColorCurve.Create;
  10893. begin
  10894. inherited Create;
  10895. GdipCheck(GdipCreateEffect(ColorCurveEffectGuid, FNativeHandle));
  10896. end;
  10897.  
  10898. function TGPColorCurve.GetParameters: TGPColorCurveParams;
  10899. var
  10900. Size: Cardinal;
  10901. begin
  10902. Size := SizeOf(Result);
  10903. inherited GetParameters(Size, @Result);
  10904. end;
  10905.  
  10906. procedure TGPColorCurve.SetParameters(const Value: TGPColorCurveParams);
  10907. begin
  10908. inherited SetParameters(@Value, SizeOf(Value));
  10909. end;
  10910.  
  10911. {$IFEND}
  10912. {$ENDREGION 'GdiplusEffects.h'}
  10913.  
  10914. {$REGION 'GdiplusRegion.h'}
  10915.  
  10916. { TGPRegion }
  10917.  
  10918. function TGPRegion.Clone: IGPRegion;
  10919. var
  10920. NativeClone: GpRegion;
  10921. begin
  10922. NativeClone := nil;
  10923. GdipCheck(GdipCloneRegion(FNativeHandle, NativeClone));
  10924. Result := TGPRegion.Create(NativeClone);
  10925. end;
  10926.  
  10927. constructor TGPRegion.Create(const NativeRegion: GpRegion);
  10928. begin
  10929. inherited Create;
  10930. FNativeHandle := NativeRegion;
  10931. end;
  10932.  
  10933. constructor TGPRegion.Create(const Path: IGPGraphicsPath);
  10934. begin
  10935. inherited Create;
  10936. GdipCheck(GdipCreateRegionPath(Path.NativeHandle, FNativeHandle));
  10937. end;
  10938.  
  10939. constructor TGPRegion.Create(const Rect: TGPRect);
  10940. begin
  10941. inherited Create;
  10942. GdipCheck(GdipCreateRegionRectI(@Rect, FNativeHandle));
  10943. end;
  10944.  
  10945. constructor TGPRegion.Create(const HRgn: HRGN);
  10946. begin
  10947. inherited Create;
  10948. GdipCheck(GdipCreateRegionHrgn(HRgn, FNativeHandle));
  10949. end;
  10950.  
  10951. constructor TGPRegion.Create(const RegionData: PByte; const Size: Integer);
  10952. begin
  10953. inherited Create;
  10954. GdipCheck(GdipCreateRegionRgnData(RegionData, Size, FNativeHandle));
  10955. end;
  10956.  
  10957. constructor TGPRegion.Create;
  10958. begin
  10959. inherited Create;
  10960. GdipCheck(GdipCreateRegion(FNativeHandle));
  10961. end;
  10962.  
  10963. constructor TGPRegion.Create(const Rect: TGPRectF);
  10964. begin
  10965. inherited Create;
  10966. GdipCheck(GdipCreateRegionRect(@Rect, FNativeHandle));
  10967. end;
  10968.  
  10969. procedure TGPRegion.Complement(const Rect: TGPRectF);
  10970. begin
  10971. GdipCheck(GdipCombineRegionRect(FNativeHandle, @Rect, CombineModeComplement));
  10972. end;
  10973.  
  10974. procedure TGPRegion.Complement(const Rect: TGPRect);
  10975. begin
  10976. GdipCheck(GdipCombineRegionRectI(FNativeHandle, @Rect, CombineModeComplement));
  10977. end;
  10978.  
  10979. procedure TGPRegion.Complement(const Path: IGPGraphicsPath);
  10980. begin
  10981. GdipCheck(GdipCombineRegionRect(FNativeHandle, Path.NativeHandle, CombineModeComplement));
  10982. end;
  10983.  
  10984. procedure TGPRegion.Complement(const Region: IGPRegion);
  10985. begin
  10986. GdipCheck(GdipCombineRegionRect(FNativeHandle, Region.NativeHandle, CombineModeComplement));
  10987. end;
  10988.  
  10989. destructor TGPRegion.Destroy;
  10990. begin
  10991. GdipDeleteRegion(FNativeHandle);
  10992. inherited;
  10993. end;
  10994.  
  10995. function TGPRegion.Equals(const Region: IGPRegion; const G: IGPGraphics): Boolean;
  10996. var
  10997. B: Bool;
  10998. begin
  10999. B := False;
  11000. GdipCheck(GdipIsEqualRegion(FNativeHandle, Region.NativeHandle, G.NativeHandle, B));
  11001. Result := B;
  11002. end;
  11003.  
  11004. procedure TGPRegion.ExclusiveOr(const Rect: TGPRectF);
  11005. begin
  11006. GdipCheck(GdipCombineRegionRect(FNativeHandle, @Rect, CombineModeXor));
  11007. end;
  11008.  
  11009. procedure TGPRegion.ExclusiveOr(const Rect: TGPRect);
  11010. begin
  11011. GdipCheck(GdipCombineRegionRectI(FNativeHandle, @Rect, CombineModeXor));
  11012. end;
  11013.  
  11014. procedure TGPRegion.Exclude(const Rect: TGPRectF);
  11015. begin
  11016. GdipCheck(GdipCombineRegionRect(FNativeHandle, @Rect, CombineModeExclude));
  11017. end;
  11018.  
  11019. procedure TGPRegion.Exclude(const Rect: TGPRect);
  11020. begin
  11021. GdipCheck(GdipCombineRegionRectI(FNativeHandle, @Rect, CombineModeExclude));
  11022. end;
  11023.  
  11024. procedure TGPRegion.Exclude(const Region: IGPRegion);
  11025. begin
  11026. GdipCheck(GdipCombineRegionRegion(FNativeHandle, Region.NativeHandle, CombineModeExclude));
  11027. end;
  11028.  
  11029. procedure TGPRegion.Exclude(const Path: IGPGraphicsPath);
  11030. begin
  11031. GdipCheck(GdipCombineRegionPath(FNativeHandle, Path.NativeHandle, CombineModeExclude));
  11032. end;
  11033.  
  11034. procedure TGPRegion.ExclusiveOr(const Region: IGPRegion);
  11035. begin
  11036. GdipCheck(GdipCombineRegionRegion(FNativeHandle, Region.NativeHandle, CombineModeXor));
  11037. end;
  11038.  
  11039. procedure TGPRegion.ExclusiveOr(const Path: IGPGraphicsPath);
  11040. begin
  11041. GdipCheck(GdipCombineRegionPath(FNativeHandle, Path.NativeHandle, CombineModeXor));
  11042. end;
  11043.  
  11044. class function TGPRegion.FromHRGN(const HRgn: HRGN): IGPRegion;
  11045. var
  11046. NativeRegion: GpRegion;
  11047. begin
  11048. NativeRegion := nil;
  11049. if (GdipCreateRegionHrgn(HRgn, NativeRegion) = Ok) then
  11050. Result := TGPRegion.Create(NativeRegion)
  11051. else
  11052. Result := nil;
  11053. end;
  11054.  
  11055. procedure TGPRegion.GetBounds(out Rect: TGPRectF; const G: IGPGraphics);
  11056. begin
  11057. GdipCheck(GdipGetRegionBounds(FNativeHandle, G.NativeHandle, Rect));
  11058. end;
  11059.  
  11060. procedure TGPRegion.GetBounds(out Rect: TGPRect; const G: IGPGraphics);
  11061. begin
  11062. GdipCheck(GdipGetRegionBoundsI(FNativeHandle, G.NativeHandle, Rect));
  11063. end;
  11064.  
  11065. function TGPRegion.GetData: IGPRegionData;
  11066. var
  11067. Data: Pointer;
  11068. Size: Cardinal;
  11069. begin
  11070. Data := nil;
  11071. Size := 0;
  11072. GdipCheck(GdipGetRegionDataSize(FNativeHandle, Size));
  11073. if (Size > 0) then
  11074. begin
  11075. GetMem(Data, Size);
  11076. GdipCheck(GdipGetRegionData(FNativeHandle, Data, Size, nil));
  11077. end;
  11078. Result := TGPBuffer.Create(Data, Size);
  11079. end;
  11080.  
  11081. function TGPRegion.GetHRGN(const G: IGPGraphics): HRGN;
  11082. begin
  11083. GdipCheck(GdipGetRegionHRgn(FNativeHandle, G.NativeHandle, Result));
  11084. end;
  11085.  
  11086. function TGPRegion.GetRegionScans(const Matrix: IGPMatrix): IGPRegionScansF;
  11087. var
  11088. Count: Integer;
  11089. begin
  11090. Count := 0;
  11091. GdipCheck(GdipGetRegionScansCount(FNativeHandle, Count, Matrix.NativeHandle));
  11092. Result := TGPArray<TGPRectF>.Create(Count);
  11093. if (Count > 0) then
  11094. GdipCheck(GdipGetRegionScans(FNativeHandle, Result.ItemPtr, Count, Matrix.NativeHandle));
  11095. end;
  11096.  
  11097. function TGPRegion.GetRegionScansI(const Matrix: IGPMatrix): IGPRegionScans;
  11098. var
  11099. Count: Integer;
  11100. begin
  11101. Count := 0;
  11102. GdipCheck(GdipGetRegionScansCount(FNativeHandle, Count, Matrix.NativeHandle));
  11103. Result := TGPArray<TGPRect>.Create(Count);
  11104. if (Count > 0) then
  11105. GdipCheck(GdipGetRegionScansI(FNativeHandle, Result.ItemPtr, Count, Matrix.NativeHandle));
  11106. end;
  11107.  
  11108. procedure TGPRegion.Intersect(const Rect: TGPRectF);
  11109. begin
  11110. GdipCheck(GdipCombineRegionRect(FNativeHandle, @Rect, CombineModeIntersect));
  11111. end;
  11112.  
  11113. procedure TGPRegion.Intersect(const Path: IGPGraphicsPath);
  11114. begin
  11115. GdipCheck(GdipCombineRegionPath(FNativeHandle, Path.NativeHandle, CombineModeIntersect));
  11116. end;
  11117.  
  11118. procedure TGPRegion.Intersect(const Region: IGPRegion);
  11119. begin
  11120. GdipCheck(GdipCombineRegionRegion(FNativeHandle, Region.NativeHandle, CombineModeIntersect));
  11121. end;
  11122.  
  11123. procedure TGPRegion.Intersect(const Rect: TGPRect);
  11124. begin
  11125. GdipCheck(GdipCombineRegionRectI(FNativeHandle, @Rect, CombineModeIntersect));
  11126. end;
  11127.  
  11128. function TGPRegion.IsEmpty(const G: IGPGraphics): Boolean;
  11129. var
  11130. B: Bool;
  11131. begin
  11132. B := False;
  11133. GdipCheck(GdipIsEmptyRegion(FNativeHandle, G.NativeHandle, B));
  11134. Result := B;
  11135. end;
  11136.  
  11137. function TGPRegion.IsInfinite(const G: IGPGraphics): Boolean;
  11138. var
  11139. B: Bool;
  11140. begin
  11141. B := False;
  11142. GdipCheck(GdipIsInfiniteRegion(FNativeHandle, G.NativeHandle, B));
  11143. Result := B;
  11144. end;
  11145.  
  11146. function TGPRegion.IsVisible(const Rect: TGPRect; const G: IGPGraphics): Boolean;
  11147. var
  11148. B: Bool;
  11149. begin
  11150. B := False;
  11151. GdipCheck(GdipIsVisibleRegionRectI(FNativeHandle, Rect.X, Rect.Y,
  11152. Rect.Width, Rect.Height, GdipHandle(G), B));
  11153. Result := B;
  11154. end;
  11155.  
  11156. function TGPRegion.IsVisible(const X, Y, Width, Height: Integer;
  11157. const G: IGPGraphics): Boolean;
  11158. begin
  11159. Result := IsVisible(TGPRect.Create(X, Y, Width, Height), G);
  11160. end;
  11161.  
  11162. function TGPRegion.IsVisible(const Rect: TGPRectF; const G: IGPGraphics): Boolean;
  11163. var
  11164. B: Bool;
  11165. begin
  11166. B := False;
  11167. GdipCheck(GdipIsVisibleRegionRect(FNativeHandle, Rect.X, Rect.Y,
  11168. Rect.Width, Rect.Height, GdipHandle(G), B));
  11169. Result := B;
  11170. end;
  11171.  
  11172. function TGPRegion.IsVisible(const X, Y, Width, Height: Single;
  11173. const G: IGPGraphics): Boolean;
  11174. begin
  11175. Result := IsVisible(TGPRectF.Create(X, Y, Width, Height), G);
  11176. end;
  11177.  
  11178. function TGPRegion.IsVisible(const Point: TGPPoint; const G: IGPGraphics): Boolean;
  11179. var
  11180. B: Bool;
  11181. begin
  11182. B := False;
  11183. GdipCheck(GdipIsVisibleRegionPointI(FNativeHandle, Point.X, Point.Y, GdipHandle(G), B));
  11184. Result := B;
  11185. end;
  11186.  
  11187. function TGPRegion.IsVisible(const X, Y: Integer; const G: IGPGraphics): Boolean;
  11188. begin
  11189. Result := IsVisible(TGPPoint.Create(X, Y), G);
  11190. end;
  11191.  
  11192. function TGPRegion.IsVisible(const Point: TGPPointF; const G: IGPGraphics): Boolean;
  11193. var
  11194. B: Bool;
  11195. begin
  11196. B := False;
  11197. GdipCheck(GdipIsVisibleRegionPoint(FNativeHandle, Point.X, Point.Y, GdipHandle(G), B));
  11198. Result := B;
  11199. end;
  11200.  
  11201. function TGPRegion.IsVisible(const X, Y: Single; const G: IGPGraphics): Boolean;
  11202. begin
  11203. Result := IsVisible(TGPPointF.Create(X, Y), G);
  11204. end;
  11205.  
  11206. procedure TGPRegion.MakeEmpty;
  11207. begin
  11208. GdipCheck(GdipSetEmpty(FNativeHandle));
  11209. end;
  11210.  
  11211. procedure TGPRegion.MakeInfinite;
  11212. begin
  11213. GdipCheck(GdipSetInfinite(FNativeHandle));
  11214. end;
  11215.  
  11216. procedure TGPRegion.Transform(const Matrix: IGPMatrix);
  11217. begin
  11218. GdipCheck(GdipTransformRegion(FNativeHandle, Matrix.NativeHandle));
  11219. end;
  11220.  
  11221. procedure TGPRegion.Translate(const DX, DY: Single);
  11222. begin
  11223. GdipCheck(GdipTranslateRegion(FNativeHandle, DX, DY));
  11224. end;
  11225.  
  11226. procedure TGPRegion.Translate(const DX, DY: Integer);
  11227. begin
  11228. GdipCheck(GdipTranslateRegionI(FNativeHandle, DX, DY));
  11229. end;
  11230.  
  11231. procedure TGPRegion.Union(const Rect: TGPRect);
  11232. begin
  11233. GdipCheck(GdipCombineRegionRectI(FNativeHandle, @Rect, CombineModeUnion));
  11234. end;
  11235.  
  11236. procedure TGPRegion.Union(const Rect: TGPRectF);
  11237. begin
  11238. GdipCheck(GdipCombineRegionRect(FNativeHandle, @Rect, CombineModeUnion));
  11239. end;
  11240.  
  11241. procedure TGPRegion.Union(const Path: IGPGraphicsPath);
  11242. begin
  11243. GdipCheck(GdipCombineRegionPath(FNativeHandle, Path.NativeHandle, CombineModeUnion));
  11244. end;
  11245.  
  11246. procedure TGPRegion.Union(const Region: IGPRegion);
  11247. begin
  11248. GdipCheck(GdipCombineRegionRegion(FNativeHandle, Region.NativeHandle, CombineModeUnion));
  11249. end;
  11250. {$ENDREGION 'GdiplusRegion.h'}
  11251.  
  11252. {$REGION 'GdiplusFontFamily.h'}
  11253. { TGPFontFamily }
  11254.  
  11255. function TGPFontFamily.Clone: IGPFontFamily;
  11256. var
  11257. ClonedFamily: GpFontFamily;
  11258. begin
  11259. ClonedFamily := nil;
  11260. GdipCheck(GdipCloneFontFamily(FNativeHandle, ClonedFamily));
  11261. Result := TGPFontFamily.Create(ClonedFamily);
  11262. end;
  11263.  
  11264. constructor TGPFontFamily.Create(const NativeFamily: GpFontFamily);
  11265. begin
  11266. inherited Create;
  11267. FNativeHandle := NativeFamily;
  11268. end;
  11269.  
  11270. constructor TGPFontFamily.Create;
  11271. begin
  11272. inherited Create;
  11273. end;
  11274.  
  11275. constructor TGPFontFamily.Create(const Name: String;
  11276. const FontCollection: IGPFontCollection);
  11277. begin
  11278. inherited Create;
  11279. GdipCheck(GdipCreateFontFamilyFromName(PWideChar(Name), GdipHandle(FontCollection), FNativeHandle));
  11280. end;
  11281.  
  11282. destructor TGPFontFamily.Destroy;
  11283. begin
  11284. GdipDeleteFontFamily(FNativeHandle);
  11285. inherited;
  11286. end;
  11287.  
  11288. class function TGPFontFamily.GenericMonospace: IGPFontFamily;
  11289. var
  11290. NativeFamily: GpFontFamily;
  11291. begin
  11292. if (FGenericMonospaceFontFamily = nil) then
  11293. begin
  11294. GdipCheck(GdipGetGenericFontFamilyMonospace(NativeFamily));
  11295. FGenericMonospaceFontFamily := TGPFontFamily.Create(NativeFamily);
  11296. end;
  11297. Result := FGenericMonospaceFontFamily;
  11298. end;
  11299.  
  11300. class function TGPFontFamily.GenericSansSerif: IGPFontFamily;
  11301. var
  11302. NativeFamily: GpFontFamily;
  11303. begin
  11304. if (FGenericSansSerifFontFamily = nil) then
  11305. begin
  11306. GdipCheck(GdipGetGenericFontFamilySansSerif(NativeFamily));
  11307. FGenericSansSerifFontFamily := TGPFontFamily.Create(NativeFamily);
  11308. end;
  11309. Result := FGenericSansSerifFontFamily;
  11310. end;
  11311.  
  11312. class function TGPFontFamily.GenericSerif: IGPFontFamily;
  11313. var
  11314. NativeFamily: GpFontFamily;
  11315. begin
  11316. if (FGenericSerifFontFamily = nil) then
  11317. begin
  11318. GdipCheck(GdipGetGenericFontFamilySerif(NativeFamily));
  11319. FGenericSerifFontFamily := TGPFontFamily.Create(NativeFamily);
  11320. end;
  11321. Result := FGenericSerifFontFamily;
  11322. end;
  11323.  
  11324. function TGPFontFamily.GetCellAscent(const Style: TGPFontStyle): Word;
  11325. begin
  11326. GdipCheck(GdipGetCellAscent(FNativeHandle, Style, Result));
  11327. end;
  11328.  
  11329. function TGPFontFamily.GetCellDescent(const Style: TGPFontStyle): Word;
  11330. begin
  11331. GdipCheck(GdipGetCellDescent(FNativeHandle, Style, Result));
  11332. end;
  11333.  
  11334. function TGPFontFamily.GetEmHeight(const Style: TGPFontStyle): Word;
  11335. begin
  11336. GdipCheck(GdipGetEmHeight(FNativeHandle, Style, Result));
  11337. end;
  11338.  
  11339. function TGPFontFamily.GetFamilyName(const Language: LangID = 0): String;
  11340. var
  11341. Name: array [0..LF_FACESIZE - 1] of WideChar;
  11342. begin
  11343. GdipCheck(GdipGetFamilyName(FNativeHandle, Name, Language));
  11344. Result := Name;
  11345. end;
  11346.  
  11347. function TGPFontFamily.GetFamilyNameInternal: String;
  11348. begin
  11349. Result := GetFamilyName(0);
  11350. end;
  11351.  
  11352. function TGPFontFamily.GetLineSpacing(const Style: TGPFontStyle): Word;
  11353. begin
  11354. GdipCheck(GdipGetLineSpacing(FNativeHandle, Style, Result));
  11355. end;
  11356.  
  11357. function TGPFontFamily.IsAvailable: Boolean;
  11358. begin
  11359. Result := Assigned(FNativeHandle);
  11360. end;
  11361.  
  11362. function TGPFontFamily.IsStyleAvailable(const Style: TGPFontStyle): Boolean;
  11363. var
  11364. B: Bool;
  11365. begin
  11366. if (GdipIsStyleAvailable(FNativeHandle, Style, B) <> Ok) then
  11367. Result := False
  11368. else
  11369. Result := B;
  11370. end;
  11371. {$ENDREGION 'GdiplusFontFamily.h'}
  11372.  
  11373. {$REGION 'GdiplusFont.h'}
  11374.  
  11375. { TGPFont }
  11376.  
  11377. function TGPFont.Clone: IGPFont;
  11378. var
  11379. NativeClone: GpFont;
  11380. begin
  11381. NativeClone := nil;
  11382. GdipCheck(GdipCloneFont(FNativeHandle, NativeClone));
  11383. Result := TGPFont.Create(NativeClone);
  11384. end;
  11385.  
  11386. constructor TGPFont.Create(const DC: HDC; const LogFont: TLogFontA);
  11387. begin
  11388. GdipCheck(GdipCreateFontFromLogfontA(DC, @LogFont, FNativeHandle))
  11389. end;
  11390.  
  11391. constructor TGPFont.Create(const DC: HDC);
  11392. begin
  11393. inherited Create;
  11394. GdipCheck(GdipCreateFontFromDC(DC, FNativeHandle));
  11395. end;
  11396.  
  11397. constructor TGPFont.Create(const NativeFont: GpFont);
  11398. begin
  11399. inherited Create;
  11400. FNativeHandle := NativeFont;
  11401. end;
  11402.  
  11403. constructor TGPFont.Create(const Family: IGPFontFamily; const EmSize: Single;
  11404. const Style: TGPFontStyle; const MeasureUnit: TGPUnit);
  11405. begin
  11406. inherited Create;
  11407. GdipCheck(GdipCreateFont(GdipHandle(Family), EmSize, Style, MeasureUnit, FNativeHandle))
  11408. end;
  11409.  
  11410. constructor TGPFont.Create(const FamilyName: String; const EmSize: Single;
  11411. const Style: TGPFontStyle; const MeasureUnit: TGPUnit;
  11412. const FontCollection: IGPFontCollection);
  11413. var
  11414. Family: IGPFontFamily;
  11415. NativeFamily: GpFontFamily;
  11416. begin
  11417. inherited Create;
  11418. try
  11419. Family := TGPFontFamily.Create(FamilyName, FontCollection);
  11420. NativeFamily := Family.NativeHandle;
  11421. except
  11422. NativeFamily := TGPFontFamily.GenericSansSerif.NativeHandle;
  11423. end;
  11424. GdipCheck(GdipCreateFont(NativeFamily, EmSize, Style, MeasureUnit, FNativeHandle))
  11425. end;
  11426.  
  11427. constructor TGPFont.Create(const DC: HDC; const LogFont: TLogFontW);
  11428. begin
  11429. inherited Create;
  11430. GdipCheck(GdipCreateFontFromLogfontW(DC, @LogFont, FNativeHandle))
  11431. end;
  11432.  
  11433. constructor TGPFont.Create(const DC: HDC; const FontHandle: HFont);
  11434. var
  11435. LogFont: TLogFontA;
  11436. begin
  11437. inherited Create;
  11438. if (FontHandle <> 0) then
  11439. begin
  11440. if (GetObjectA(FontHandle, SizeOf(LogFont), @LogFont) <> 0) then
  11441. GdipCheck(GdipCreateFontFromLogfontA(DC, @LogFont, FNativeHandle))
  11442. else
  11443. GdipCheck(GdipCreateFontFromDC(DC, FNativeHandle));
  11444. end
  11445. else
  11446. GdipCheck(GdipCreateFontFromDC(DC, FNativeHandle));
  11447. end;
  11448.  
  11449. destructor TGPFont.Destroy;
  11450. begin
  11451. GdipDeleteFont(FNativeHandle);
  11452. inherited;
  11453. end;
  11454.  
  11455. function TGPFont.GetFamily: IGPFontFamily;
  11456. var
  11457. NativeFamily: GpFontFamily;
  11458. begin
  11459. GdipCheck(GdipGetFamily(FNativeHandle, NativeFamily));
  11460. Result := TGPFontFamily.Create(NativeFamily);
  11461. end;
  11462.  
  11463. function TGPFont.GetHeight(const Dpi: Single): Single;
  11464. begin
  11465. GdipCheck(GdipGetFontHeightGivenDPI(FNativeHandle, Dpi, Result));
  11466. end;
  11467.  
  11468. function TGPFont.GetHeight(const Graphics: IGPGraphics): Single;
  11469. begin
  11470. GdipCheck(GdipGetFontHeight(FNativeHandle, GdipHandle(Graphics), Result));
  11471. end;
  11472.  
  11473. function TGPFont.GetLogFontA(const G: IGPGraphics): TLogFontA;
  11474. begin
  11475. GdipCheck(GdipGetLogFontA(FNativeHandle, GdipHandle(G), Result));
  11476. end;
  11477.  
  11478. function TGPFont.GetLogFontW(const G: IGPGraphics): TLogFontW;
  11479. begin
  11480. GdipCheck(GdipGetLogFontW(FNativeHandle, GdipHandle(G), Result));
  11481. end;
  11482.  
  11483. function TGPFont.GetSize: Single;
  11484. begin
  11485. GdipCheck(GdipGetFontSize(FNativeHandle, Result));
  11486. end;
  11487.  
  11488. function TGPFont.GetStyle: TGPFontStyle;
  11489. begin
  11490. GdipCheck(GdipGetFontStyle(FNativeHandle, Result));
  11491. end;
  11492.  
  11493. function TGPFont.GetUnit: TGPUnit;
  11494. begin
  11495. GdipCheck(GdipGetFontUnit(FNativeHandle, Result));
  11496. end;
  11497.  
  11498. function TGPFont.IsAvailable: Boolean;
  11499. begin
  11500. Result := Assigned(FNativeHandle);
  11501. end;
  11502. {$ENDREGION 'GdiplusFont.h'}
  11503.  
  11504. {$REGION 'GdiplusFontCollection.h'}
  11505.  
  11506. { TGPFontCollection }
  11507.  
  11508. constructor TGPFontCollection.Create;
  11509. begin
  11510. inherited Create;
  11511. FNativeHandle := nil;
  11512. end;
  11513.  
  11514. function TGPFontCollection.GetFamilies: IGPFontFamilies;
  11515. var
  11516. NativeFamilyList: array of GpFontFamily;
  11517. NativeClone: GpFontFamily;
  11518. Count, ActualCount, I: Integer;
  11519. begin
  11520. Count := 0;
  11521. GdipCheck(GdipGetFontCollectionFamilyCount(FNativeHandle, Count));
  11522.  
  11523. SetLength(NativeFamilyList, Count);
  11524. GdipCheck(GdipGetFontCollectionFamilyList(FNativeHandle, Count,
  11525. @NativeFamilyList[0], ActualCount));
  11526.  
  11527. Result := TGPArray<IGPFontFamily>.Create(ActualCount);
  11528. for I := 0 to ActualCount - 1 do
  11529. begin
  11530. GdipCheck(GdipCloneFontFamily(NativeFamilyList[I], NativeClone));
  11531. Result[I] := TGPFontFamily.Create(NativeClone);
  11532. end;
  11533. end;
  11534.  
  11535. { TGPInstalledFontCollection }
  11536.  
  11537. constructor TGPInstalledFontCollection.Create;
  11538. begin
  11539. inherited Create;
  11540. GdipCheck(GdipNewInstalledFontCollection(FNativeHandle));
  11541. end;
  11542.  
  11543. { TGPPrivateFontCollection }
  11544.  
  11545. procedure TGPPrivateFontCollection.AddFontFile(const Filename: String);
  11546. begin
  11547. GdipCheck(GdipPrivateAddFontFile(FNativeHandle, PWideChar(Filename)));
  11548. end;
  11549.  
  11550. procedure TGPPrivateFontCollection.AddMemoryFont(const Memory: Pointer;
  11551. const Length: Integer);
  11552. begin
  11553. GdipCheck(GdipPrivateAddMemoryFont(FNativeHandle, Memory, Length));
  11554. end;
  11555.  
  11556. constructor TGPPrivateFontCollection.Create;
  11557. begin
  11558. inherited Create;
  11559. GdipCheck(GdipNewPrivateFontCollection(FNativeHandle));
  11560. end;
  11561.  
  11562. destructor TGPPrivateFontCollection.Destroy;
  11563. begin
  11564. GdipDeletePrivateFontCollection(FNativeHandle);
  11565. inherited;
  11566. end;
  11567. {$ENDREGION 'GdiplusFontCollection.h'}
  11568.  
  11569. {$REGION 'GdiplusBitmap.h'}
  11570. { TGPImageFormat }
  11571.  
  11572. constructor TGPImageFormat.Create(const Guid: TGUID);
  11573. begin
  11574. inherited Create;
  11575. FGuid := Guid;
  11576. end;
  11577.  
  11578. constructor TGPImageFormat.Create(const Guid, CodecId: TGUID);
  11579. begin
  11580. inherited Create;
  11581. FGuid := Guid;
  11582. FCodecId := CodecId;
  11583. end;
  11584.  
  11585. class function TGPImageFormat.FindByFormatId(
  11586. const lFormatId: TGUID): IGPImageFormat;
  11587. begin
  11588. InitializeCodecs;
  11589. if IsEqualGUID(lFormatId, FBmp.Guid) then
  11590. Result := FBmp
  11591. else if IsEqualGUID(lFormatId, FGif.Guid) then
  11592. Result := FGif
  11593. else if IsEqualGUID(lFormatId, FJpeg.Guid) then
  11594. Result := FJpeg
  11595. else if IsEqualGUID(lFormatId, FPng.Guid) then
  11596. Result := FPng
  11597. else if IsEqualGUID(lFormatId, FTiff.Guid) then
  11598. Result := FTiff
  11599. else
  11600. Result := nil;
  11601. end;
  11602.  
  11603. class function TGPImageFormat.GetBmp: IGPImageFormat;
  11604. begin
  11605. InitializeCodecs;
  11606. Result := FBmp;
  11607. end;
  11608.  
  11609. function TGPImageFormat.GetCodecId: TGUID;
  11610. begin
  11611. Result := FCodecId;
  11612. end;
  11613.  
  11614. class function TGPImageFormat.GetGif: IGPImageFormat;
  11615. begin
  11616. InitializeCodecs;
  11617. Result := FGif;
  11618. end;
  11619.  
  11620. function TGPImageFormat.GetGuid: TGuid;
  11621. begin
  11622. Result := FGuid;
  11623. end;
  11624.  
  11625. class function TGPImageFormat.GetJpeg: IGPImageFormat;
  11626. begin
  11627. InitializeCodecs;
  11628. Result := FJpeg;
  11629. end;
  11630.  
  11631. class function TGPImageFormat.GetPng: IGPImageFormat;
  11632. begin
  11633. InitializeCodecs;
  11634. Result := FPng;
  11635. end;
  11636.  
  11637. class function TGPImageFormat.GetTiff: IGPImageFormat;
  11638. begin
  11639. InitializeCodecs;
  11640. Result := FTiff;
  11641. end;
  11642.  
  11643. class procedure TGPImageFormat.InitializeCodecs;
  11644. var
  11645. I, Count, Size: Cardinal;
  11646. List, Info: PGPNativeImageCodecInfo;
  11647. begin
  11648. if (not FInitialized) then
  11649. begin
  11650. FInitialized := True;
  11651. GdipCheck(GdipGetImageEncodersSize(Count, Size));
  11652. if (Size > 0) then
  11653. begin
  11654. GetMem(List, Size);
  11655. try
  11656. GdipCheck(GdipGetImageEncoders(Count, Size, List));
  11657. Info := List;
  11658. for I := 0 to Count - 1 do
  11659. begin
  11660. if IsEqualGUID(Info.FormatId, ImageFormatBMP) then
  11661. FBmp := TGPImageFormat.Create(Info.FormatId, Info.ClsId)
  11662. else
  11663. if IsEqualGUID(Info.FormatId, ImageFormatJPEG) then
  11664. FJpeg := TGPImageFormat.Create(Info.FormatId, Info.ClsId)
  11665. else
  11666. if IsEqualGUID(Info.FormatId, ImageFormatGIF) then
  11667. FGif := TGPImageFormat.Create(Info.FormatId, Info.ClsId)
  11668. else
  11669. if IsEqualGUID(Info.FormatId, ImageFormatTIFF) then
  11670. FTiff := TGPImageFormat.Create(Info.FormatId, Info.ClsId)
  11671. else
  11672. if IsEqualGUID(Info.FormatId, ImageFormatPNG) then
  11673. FPng := TGPImageFormat.Create(Info.FormatId, Info.ClsId);
  11674. Inc(Info);
  11675. end;
  11676. finally
  11677. FreeMem(List);
  11678. end;
  11679. end;
  11680. Assert(Assigned(FBmp));
  11681. Assert(Assigned(FJpeg));
  11682. Assert(Assigned(FGif));
  11683. Assert(Assigned(FTiff));
  11684. Assert(Assigned(FPng));
  11685. end;
  11686. end;
  11687.  
  11688. { TGPImageCodecInfo }
  11689.  
  11690. constructor TGPImageCodecInfo.Create(const Info: TGPNativeImageCodecInfo);
  11691. begin
  11692. inherited Create;
  11693. FInfo := Info;
  11694. end;
  11695.  
  11696. function TGPImageCodecInfo.GetClsId: TGUID;
  11697. begin
  11698. Result := FInfo.ClsId;
  11699. end;
  11700.  
  11701. function TGPImageCodecInfo.GetCodecName: String;
  11702. begin
  11703. Result := FInfo.CodecName;
  11704. end;
  11705.  
  11706. function TGPImageCodecInfo.GetDllName: String;
  11707. begin
  11708. Result := FInfo.DllName;
  11709. end;
  11710.  
  11711. function TGPImageCodecInfo.GetFilenameExtension: String;
  11712. begin
  11713. Result := FInfo.FilenameExtension;
  11714. end;
  11715.  
  11716. function TGPImageCodecInfo.GetFlags: TGPImageCodecFlags;
  11717. begin
  11718. Result := FInfo.Flags;
  11719. end;
  11720.  
  11721. function TGPImageCodecInfo.GetFormatDescription: String;
  11722. begin
  11723. Result := FInfo.FormatDescription;
  11724. end;
  11725.  
  11726. function TGPImageCodecInfo.GetFormatId: TGUID;
  11727. begin
  11728. Result := FInfo.FormatId;
  11729. end;
  11730.  
  11731. class function TGPImageCodecInfo.GetImageDecoders: IGPImageCodecInfoArray;
  11732. var
  11733. I, Count, Size: Cardinal;
  11734. List, Info: PGPNativeImageCodecInfo;
  11735. begin
  11736. GdipCheck(GdipGetImageDecodersSize(Count, Size));
  11737. if (Count > 0) then
  11738. begin
  11739. Result := TGPArray<IGPImageCodecInfo>.Create(Count);
  11740. GetMem(List, Size);
  11741. try
  11742. GdipCheck(GdipGetImageDecoders(Count, Size, List));
  11743. Info := List;
  11744. for I := 0 to Count - 1 do
  11745. begin
  11746. Result[I] := TGPImageCodecInfo.Create(Info^);
  11747. Inc(Info);
  11748. end;
  11749. finally
  11750. FreeMem(List);
  11751. end;
  11752. end
  11753. else
  11754. Result := nil;
  11755. end;
  11756.  
  11757. class function TGPImageCodecInfo.GetImageEncoders: IGPImageCodecInfoArray;
  11758. var
  11759. I, Count, Size: Cardinal;
  11760. List, Info: PGPNativeImageCodecInfo;
  11761. begin
  11762. GdipCheck(GdipGetImageEncodersSize(Count, Size));
  11763. if (Count > 0) then
  11764. begin
  11765. Result := TGPArray<IGPImageCodecInfo>.Create(Count);
  11766. GetMem(List, Size);
  11767. try
  11768. GdipCheck(GdipGetImageEncoders(Count, Size, List));
  11769. Info := List;
  11770. for I := 0 to Count - 1 do
  11771. begin
  11772. Result[I] := TGPImageCodecInfo.Create(Info^);
  11773. Inc(Info);
  11774. end;
  11775. finally
  11776. FreeMem(List);
  11777. end;
  11778. end
  11779. else
  11780. Result := nil;
  11781. end;
  11782.  
  11783. function TGPImageCodecInfo.GetMimeType: String;
  11784. begin
  11785. Result := FInfo.MimeType;
  11786. end;
  11787.  
  11788. function TGPImageCodecInfo.GetVersion: Integer;
  11789. begin
  11790. Result := FInfo.Version;
  11791. end;
  11792.  
  11793. { TGPEncoderParameterEnumerator }
  11794.  
  11795. constructor TGPEncoderParameterEnumerator.Create(
  11796. const AParams: IGPEncoderParameters);
  11797. begin
  11798. inherited Create;
  11799. FParams := AParams;
  11800. FIndex := -1;
  11801. end;
  11802.  
  11803. function TGPEncoderParameterEnumerator.GetCurrent: PGPNativeEncoderParameter;
  11804. begin
  11805. Result := FParams.Param[FIndex];
  11806. end;
  11807.  
  11808. function TGPEncoderParameterEnumerator.MoveNext: Boolean;
  11809. begin
  11810. Result := (FIndex < FParams.Count - 1);
  11811. if Result then
  11812. Inc(FIndex);
  11813. end;
  11814.  
  11815. { TGPEncoderParameters }
  11816.  
  11817. procedure TGPEncoderParameters.Add(const ParamType: TGUID; var Value: Int64);
  11818. var
  11819. Value32: Int32;
  11820. begin
  11821. Value32 := Value;
  11822. Add(ParamType, 1, EncoderParameterValueTypeLong, @Value32);
  11823. end;
  11824.  
  11825. procedure TGPEncoderParameters.Add(const ParamType: TGUID;
  11826. const Value: array of Int32);
  11827. begin
  11828. Assert(Length(Value) > 0);
  11829. Add(ParamType, Length(Value), EncoderParameterValueTypeLong, @Value[0]);
  11830. end;
  11831.  
  11832. procedure TGPEncoderParameters.Add(const ParamType: TGUID; const Value: String);
  11833. var
  11834. AnsiValue: AnsiString;
  11835. begin
  11836. {$WARNINGS OFF}
  11837. AnsiValue := AnsiString(Value);
  11838. {$WARNINGS ON}
  11839. Assert(Length(AnsiValue) > 0);
  11840. Add(ParamType, Length(AnsiValue) + 1, EncoderParameterValueTypeASCII, @AnsiValue[1]);
  11841. end;
  11842.  
  11843. procedure TGPEncoderParameters.Add(const ParamType: TGUID;
  11844. const Value: array of Int64);
  11845. var
  11846. Value32: array of Int32;
  11847. I: Integer;
  11848. begin
  11849. Assert(Length(Value) > 0);
  11850. SetLength(Value32, Length(Value));
  11851. for I := 0 to Length(Value) - 1 do
  11852. Value32[I] := Value[I];
  11853. Add(ParamType, Length(Value), EncoderParameterValueTypeLong, @Value32[0]);
  11854. end;
  11855.  
  11856. procedure TGPEncoderParameters.Add(const ParamType: TGUID; var Value: Int32);
  11857. begin
  11858. Add(ParamType, 1, EncoderParameterValueTypeLong, @Value);
  11859. end;
  11860.  
  11861. procedure TGPEncoderParameters.Add(const ParamType: TGUID;
  11862. const Value: array of Byte);
  11863. begin
  11864. Assert(Length(Value) > 0);
  11865. Add(ParamType, Length(Value), EncoderParameterValueTypeByte, @Value[0]);
  11866. end;
  11867.  
  11868. procedure TGPEncoderParameters.Add(const ParamType: TGUID; var Value: Byte);
  11869. begin
  11870. Add(ParamType, 1, EncoderParameterValueTypeByte, @Value);
  11871. end;
  11872.  
  11873. procedure TGPEncoderParameters.Add(const ParamType: TGUID;
  11874. const Value: array of Int16);
  11875. begin
  11876. Assert(Length(Value) > 0);
  11877. Add(ParamType, Length(Value), EncoderParameterValueTypeShort, @Value[0]);
  11878. end;
  11879.  
  11880. procedure TGPEncoderParameters.Add(const ParamType: TGUID; var Value: Int16);
  11881. begin
  11882. Add(ParamType, 1, EncoderParameterValueTypeShort, @Value);
  11883. end;
  11884.  
  11885. procedure TGPEncoderParameters.Add(const ParamType: TGUID;
  11886. const NumberOfValues: Integer; const ValueType: TGPEncoderParameterValueType;
  11887. const Value: Pointer);
  11888. var
  11889. ValueSize: Integer;
  11890. ValuePtr: PByte;
  11891. begin
  11892. FModified := True;
  11893. if (FParamCount >= Length(FParams)) then
  11894. SetLength(FParams, FParamCount + 4);
  11895.  
  11896. case ValueType of
  11897. EncoderParameterValueTypeByte,
  11898. EncoderParameterValueTypeASCII,
  11899. EncoderParameterValueTypeUndefined:
  11900. ValueSize := 1;
  11901. EncoderParameterValueTypeShort:
  11902. ValueSize := 2;
  11903. EncoderParameterValueTypeLong:
  11904. ValueSize := 4;
  11905. EncoderParameterValueTypeRational,
  11906. EncoderParameterValueTypeLongRange:
  11907. ValueSize := 8;
  11908. EncoderParameterValueTypeRationalRange:
  11909. ValueSize := 16;
  11910.  
  11911. {$IF (GDIPVER >= $0110)}
  11912. EncoderParameterValueTypePointer:
  11913. ValueSize := 1;
  11914. {$IFEND}
  11915. else
  11916. begin
  11917. ValueSize := 1;
  11918. Assert(False);
  11919. end;
  11920. end;
  11921. ValueSize := ValueSize * NumberOfValues;
  11922. if ((FValueSize + ValueSize) > FValueAllocated) then
  11923. begin
  11924. FValueAllocated := FValueSize + ValueSize + 64;
  11925. ReallocMem(FValues, FValueAllocated);
  11926. end;
  11927. ValuePtr := FValues;
  11928. Inc(ValuePtr, FValueSize);
  11929. Inc(FValueSize, ValueSize);
  11930. Move(Value^, ValuePtr^, ValueSize);
  11931.  
  11932. FParams[FParamCount].Guid := ParamType;
  11933. FParams[FParamCount].NumberOfValues := NumberOfValues;
  11934. FParams[FParamCount].ValueType := ValueType;
  11935. FParams[FParamCount].Value := ValuePtr;
  11936.  
  11937. Inc(FParamCount);
  11938. end;
  11939.  
  11940. procedure TGPEncoderParameters.Add(const ParamType: TGUID; const RangesBegin,
  11941. RangesEnd: array of Int64);
  11942. var
  11943. Ranges: array of Int32;
  11944. I: Integer;
  11945. begin
  11946. Assert(Length(RangesBegin) > 0);
  11947. Assert(Length(RangesBegin) = Length(RangesEnd));
  11948. SetLength(Ranges, Length(RangesBegin) * 2);
  11949. for I := 0 to Length(RangesBegin) - 1 do
  11950. begin
  11951. Ranges[I * 2 + 0] := RangesBegin[I];
  11952. Ranges[I * 2 + 1] := RangesEnd[I];
  11953. end;
  11954. Add(ParamType, Length(RangesBegin), EncoderParameterValueTypeLongRange, @Ranges[0]);
  11955. end;
  11956.  
  11957. procedure TGPEncoderParameters.Add(const ParamType: TGUID; const Numerator1,
  11958. Denominator1, Numerator2, Denominator2: array of Int32);
  11959. var
  11960. Values: array of Int32;
  11961. I: Integer;
  11962. begin
  11963. Assert(Length(Numerator1) > 0);
  11964. Assert(Length(Numerator1) = Length(Numerator2));
  11965. Assert(Length(Numerator1) = Length(Denominator1));
  11966. Assert(Length(Numerator1) = Length(Denominator2));
  11967. SetLength(Values, Length(Numerator1) * 4);
  11968. for I := 0 to Length(Numerator1) - 1 do
  11969. begin
  11970. Values[I * 4 + 0] := Numerator1[I];
  11971. Values[I * 4 + 1] := Denominator1[I];
  11972. Values[I * 4 + 2] := Numerator2[I];
  11973. Values[I * 4 + 3] := Denominator2[I];
  11974. end;
  11975. Add(ParamType, Length(Numerator1), EncoderParameterValueTypeRationalRange, @Values[0]);
  11976. end;
  11977.  
  11978. procedure TGPEncoderParameters.Add(const ParamType: TGUID;
  11979. const Value: array of TGPEncoderValue);
  11980. begin
  11981. Assert(Length(Value) > 0);
  11982. Add(ParamType, Length(Value), EncoderParameterValueTypeLong, @Value[0]);
  11983. end;
  11984.  
  11985. procedure TGPEncoderParameters.Add(const ParamType: TGUID;
  11986. const Value: TGPEncoderValue);
  11987. begin
  11988. Add(ParamType, 1, EncoderParameterValueTypeLong, @Value);
  11989. end;
  11990.  
  11991. procedure TGPEncoderParameters.Clear;
  11992. begin
  11993. FParamCount := 0;
  11994. FValueSize := 0;
  11995. FModified := True;
  11996. end;
  11997.  
  11998. constructor TGPEncoderParameters.Create;
  11999. begin
  12000. inherited Create;
  12001. end;
  12002.  
  12003. constructor TGPEncoderParameters.Create(const Params: PGPNativeEncoderParameters);
  12004. var
  12005. Param: PGPNativeEncoderParameter;
  12006. I: Integer;
  12007. begin
  12008. inherited Create;
  12009. if Assigned(Params) then
  12010. begin
  12011. SetLength(FParams, Params.Count);
  12012. if (Params.Count > 0) then
  12013. begin
  12014. Param := @Params.Parameter[0];
  12015. for I := 0 to Params.Count - 1 do
  12016. begin
  12017. Add(Param.Guid, Param.NumberOfValues, Param.ValueType, Param.Value);
  12018. Inc(Param);
  12019. end;
  12020. end;
  12021. end;
  12022. end;
  12023.  
  12024. procedure TGPEncoderParameters.Add(const ParamType: TGUID; const Numerator1,
  12025. Denominator1, Numerator2, Denominator2: Int32);
  12026. var
  12027. Values: array [0..3] of Int32;
  12028. begin
  12029. Values[0] := Numerator1;
  12030. Values[1] := Denominator1;
  12031. Values[2] := Numerator2;
  12032. Values[3] := Denominator2;
  12033. Add(ParamType, 1, EncoderParameterValueTypeRationalRange, @Values[0]);
  12034. end;
  12035.  
  12036. procedure TGPEncoderParameters.Add(const ParamType: TGUID; var RangeBegin,
  12037. RangeEnd: Int64);
  12038. var
  12039. Values: array [0..1] of Int32;
  12040. begin
  12041. Values[0] := RangeBegin;
  12042. Values[1] := RangeEnd;
  12043. Add(ParamType, 1, EncoderParameterValueTypeLongRange, @Values[0]);
  12044. end;
  12045.  
  12046. procedure TGPEncoderParameters.Add(const ParamType: TGUID;
  12047. const Value: array of Byte; const Undefined: Boolean);
  12048. begin
  12049. Assert(Length(Value) > 0);
  12050. if (Undefined) then
  12051. Add(ParamType, Length(Value), EncoderParameterValueTypeUndefined, @Value[0])
  12052. else
  12053. Add(ParamType, Length(Value), EncoderParameterValueTypeByte, @Value[0]);
  12054. end;
  12055.  
  12056. procedure TGPEncoderParameters.Add(const ParamType: TGUID; const Value: Byte;
  12057. const Undefined: Boolean);
  12058. begin
  12059. if (Undefined) then
  12060. Add(ParamType, 1, EncoderParameterValueTypeUndefined, @Value)
  12061. else
  12062. Add(ParamType, 1, EncoderParameterValueTypeByte, @Value);
  12063. end;
  12064.  
  12065. procedure TGPEncoderParameters.Add(const ParamType: TGUID; const Numerators,
  12066. Denominators: array of Int32);
  12067. var
  12068. Values: array of Int32;
  12069. I: Integer;
  12070. begin
  12071. Assert(Length(Numerators) > 0);
  12072. Assert(Length(Numerators) = Length(Denominators));
  12073. SetLength(Values, Length(Numerators) * 2);
  12074. for I := 0 to Length(Numerators) - 1 do
  12075. begin
  12076. Values[I * 2 + 0] := Numerators[I];
  12077. Values[I * 2 + 1] := Denominators[I];
  12078. end;
  12079. Add(ParamType, Length(Numerators), EncoderParameterValueTypeRational, @Values[0]);
  12080. end;
  12081.  
  12082. procedure TGPEncoderParameters.Add(const ParamType: TGUID; var Numerator,
  12083. Denominator: Int32);
  12084. var
  12085. Values: array [0..1] of Int32;
  12086. begin
  12087. Values[0] := Numerator;
  12088. Values[1] := Denominator;
  12089. Add(ParamType, 1, EncoderParameterValueTypeRational, @Values[0]);
  12090. end;
  12091.  
  12092. destructor TGPEncoderParameters.Destroy;
  12093. begin
  12094. FreeMem(FNativeParams);
  12095. FreeMem(FValues);
  12096. inherited;
  12097. end;
  12098.  
  12099. function TGPEncoderParameters.GetCount: Integer;
  12100. begin
  12101. Result := FParamCount;
  12102. end;
  12103.  
  12104. function TGPEncoderParameters.GetEnumerator: TGPEncoderParameterEnumerator;
  12105. begin
  12106. Result := TGPEncoderParameterEnumerator.Create(Self);
  12107. end;
  12108.  
  12109. function TGPEncoderParameters.GetNativeParams: PGPNativeEncoderParameters;
  12110. begin
  12111. if (FNativeParams = nil) or (FModified) then
  12112. begin
  12113. ReallocMem(FNativeParams, 4 + FParamCount * SizeOf(TGPNativeEncoderParameter));
  12114. FNativeParams.Count := FParamCount;
  12115. if (FParamCount > 0) then
  12116. Move(FParams[0], FNativeParams.Parameter[0], FParamCount * SizeOf(TGPNativeEncoderParameter));
  12117. FModified := False;
  12118. end;
  12119. Result := FNativeParams;
  12120. end;
  12121.  
  12122. function TGPEncoderParameters.GetParam(const Index: Integer): PGPNativeEncoderParameter;
  12123. begin
  12124. Result := @FParams[Index];
  12125. end;
  12126.  
  12127. { TGPColorPalette }
  12128.  
  12129. constructor TGPColorPalette.Create(const Count: Integer);
  12130. begin
  12131. inherited Create;
  12132. GetMem(FData, SizeOf(TGPNativeColorPalette) + Count * SizeOf(ARGB));
  12133. FData.Count := Count;
  12134. FData.Flags := [];
  12135. FEntries := Pointer(FData);
  12136. Inc(PByte(FEntries), SizeOf(TGPNativeColorPalette));
  12137. end;
  12138.  
  12139. constructor TGPColorPalette.Create(const NativePalette: PGPNativeColorPalette);
  12140. begin
  12141. if (NativePalette = nil) then
  12142. begin
  12143. Create(1);
  12144. FData.Count := 0;
  12145. end
  12146. else
  12147. begin
  12148. inherited Create;
  12149. FData := NativePalette;
  12150. FEntries := Pointer(FData);
  12151. Inc(PByte(FEntries), SizeOf(TGPNativeColorPalette));
  12152. end;
  12153. end;
  12154.  
  12155. destructor TGPColorPalette.Destroy;
  12156. begin
  12157. FreeMem(FData);
  12158. inherited;
  12159. end;
  12160.  
  12161. function TGPColorPalette.GetCount: Integer;
  12162. begin
  12163. Result := FData.Count;
  12164. end;
  12165.  
  12166. function TGPColorPalette.GetEntry(const Index: Integer): ARGB;
  12167. begin
  12168. Result := FEntries[Index];
  12169. end;
  12170.  
  12171. function TGPColorPalette.GetEntryPtr: PARGB;
  12172. begin
  12173. Result := FEntries;
  12174. end;
  12175.  
  12176. function TGPColorPalette.GetFlags: TGPPaletteFlags;
  12177. begin
  12178. Result := FData.Flags;
  12179. end;
  12180.  
  12181. function TGPColorPalette.GetNativePalette: PGPNativeColorPalette;
  12182. begin
  12183. Result := FData;
  12184. end;
  12185.  
  12186. procedure TGPColorPalette.SetEntry(const Index: Integer; const Value: ARGB);
  12187. begin
  12188. FEntries[Index] := Value;
  12189. end;
  12190.  
  12191. procedure TGPColorPalette.SetFlags(const Value: TGPPaletteFlags);
  12192. begin
  12193. FData.Flags := Value;
  12194. end;
  12195.  
  12196. { TGPPropertyItem }
  12197.  
  12198. constructor TGPPropertyItem.Create(const Data: PGPNativePropertyItem);
  12199. begin
  12200. inherited Create;
  12201. FData := Data;
  12202. end;
  12203.  
  12204. constructor TGPPropertyItem.Create;
  12205. begin
  12206. inherited Create;
  12207. GetMem(FData, SizeOf(TGPNativePropertyItem));
  12208. end;
  12209.  
  12210. destructor TGPPropertyItem.Destroy;
  12211. begin
  12212. FreeMem(FData);
  12213. inherited;
  12214. end;
  12215.  
  12216. function TGPPropertyItem.GetId: TPropID;
  12217. begin
  12218. Result := FData.Id;
  12219. end;
  12220.  
  12221. function TGPPropertyItem.GetLength: Cardinal;
  12222. begin
  12223. Result := FData.Length;
  12224. end;
  12225.  
  12226. function TGPPropertyItem.GetNativeItem: PGPNativePropertyItem;
  12227. begin
  12228. Result := FData;
  12229. end;
  12230.  
  12231. function TGPPropertyItem.GetValue: Pointer;
  12232. begin
  12233. Result := FData.Value;
  12234. end;
  12235.  
  12236. function TGPPropertyItem.GetValueType: Word;
  12237. begin
  12238. Result := FData.ValueType;
  12239. end;
  12240.  
  12241. procedure TGPPropertyItem.SetId(const Value: TPropID);
  12242. begin
  12243. FData.Id := Value;
  12244. end;
  12245.  
  12246. procedure TGPPropertyItem.SetLength(const Value: Cardinal);
  12247. begin
  12248. FData.Length := Value;
  12249. end;
  12250.  
  12251. procedure TGPPropertyItem.SetValue(const Value: Pointer);
  12252. begin
  12253. FData.Value := Value;
  12254. end;
  12255.  
  12256. procedure TGPPropertyItem.SetValueType(const Value: Word);
  12257. begin
  12258. FData.ValueType := Value;
  12259. end;
  12260.  
  12261. { TGPImage }
  12262.  
  12263. function TGPImage.Clone: IGPImage;
  12264. var
  12265. NativeClone: GpImage;
  12266. begin
  12267. NativeClone := nil;
  12268. GdipCheck(GdipCloneImage(FNativeHandle, NativeClone));
  12269. Result := TGPImage.Create(NativeClone);
  12270. end;
  12271.  
  12272. constructor TGPImage.Create(const Stream: IStream;
  12273. const UseEmbeddedColorManagement: Boolean);
  12274. begin
  12275. inherited Create;
  12276. if (UseEmbeddedColorManagement) then
  12277. GdipCheck(GdipLoadImageFromStreamICM(Stream, FNativeHandle))
  12278. else
  12279. GdipCheck(GdipLoadImageFromStream(Stream, FNativeHandle))
  12280. end;
  12281.  
  12282. constructor TGPImage.Create(const Filename: String;
  12283. const UseEmbeddedColorManagement: Boolean);
  12284. begin
  12285. inherited Create;
  12286. if (UseEmbeddedColorManagement) then
  12287. GdipCheck(GdipLoadImageFromFileICM(PWideChar(Filename), FNativeHandle))
  12288. else
  12289. GdipCheck(GdipLoadImageFromFile(PWideChar(Filename), FNativeHandle))
  12290. end;
  12291.  
  12292. constructor TGPImage.Create(const NativeImage: GpImage);
  12293. begin
  12294. inherited Create;
  12295. FNativeHandle := NativeImage;
  12296. end;
  12297.  
  12298. destructor TGPImage.Destroy;
  12299. begin
  12300. GdipDisposeImage(FNativeHandle);
  12301. inherited;
  12302. end;
  12303.  
  12304. {$IF (GDIPVER >= $0110)}
  12305. procedure TGPImage.FindFirstItem(const Item: PGPImageItemData);
  12306. begin
  12307. GdipCheck(GdipFindFirstImageItem(FNativeHandle, Item));
  12308. end;
  12309.  
  12310. procedure TGPImage.FindNextItem(const Item: PGPImageItemData);
  12311. begin
  12312. GdipCheck(GdipFindNextImageItem(FNativeHandle, Item));
  12313. end;
  12314.  
  12315. procedure TGPImage.GetItemData(const Item: PGPImageItemData);
  12316. begin
  12317. GdipCheck(GdipGetImageItemData(FNativeHandle, Item));
  12318. end;
  12319.  
  12320. procedure TGPImage.SetAbort(const Abort: TGdiplusAbort);
  12321. begin
  12322. GdipCheck(GdipImageSetAbort(FNativeHandle, @Abort));
  12323. end;
  12324. {$IFEND}
  12325.  
  12326. class function TGPImage.FromFile(const Filename: String;
  12327. const UseEmbeddedColorManagement: Boolean): IGPImage;
  12328. begin
  12329. Result := TGPImage.Create(Filename, UseEmbeddedColorManagement);
  12330. end;
  12331.  
  12332. class function TGPImage.FromStream(const Stream: IStream;
  12333. const UseEmbeddedColorManagement: Boolean): IGPImage;
  12334. begin
  12335. Result := TGPImage.Create(Stream, UseEmbeddedColorManagement);
  12336. end;
  12337.  
  12338. procedure TGPImage.GetBounds(out SrcRect: TGPRectF; out SrcUnit: TGPUnit);
  12339. begin
  12340. GdipCheck(GdipGetImageBounds(FNativeHandle, SrcRect, SrcUnit));
  12341. end;
  12342.  
  12343. function TGPImage.GetEncoderParameterList(const lEncoder: TGUID): IGPEncoderParameters;
  12344. var
  12345. Size: Cardinal;
  12346. Params: PGPNativeEncoderParameters;
  12347. begin
  12348. Size := 0;
  12349. Params := nil;
  12350. try
  12351. if (GdipGetEncoderParameterListSize(FNativeHandle, @lEncoder, Size) = Ok) and (Size > 0) then
  12352. begin
  12353. GetMem(Params, Size);
  12354. GdipCheck(GdipGetEncoderParameterList(FNativeHandle, @lEncoder, Size, Params));
  12355. end;
  12356. Result := TGPEncoderParameters.Create(Params);
  12357. finally
  12358. FreeMem(Params);
  12359. end;
  12360. end;
  12361.  
  12362. function TGPImage.GetFlags: TGPImageFlags;
  12363. begin
  12364. Result := [];
  12365. GdipCheck(GdipGetImageFlags(FNativeHandle, Result));
  12366. end;
  12367.  
  12368. function TGPImage.GetFrameCount(const DimensionID: TGUID): Cardinal;
  12369. begin
  12370. Result := 0;
  12371. GdipCheck(GdipImageGetFrameCount(FNativeHandle, DimensionID, Result));
  12372. end;
  12373.  
  12374. function TGPImage.GetFrameDimensions: IGPFrameDimensions;
  12375. var
  12376. Count: Cardinal;
  12377. begin
  12378. Count := 0;
  12379. GdipCheck(GdipImageGetFrameDimensionsCount(FNativeHandle, Count));
  12380. Result := TGPArray<TGUID>.Create(Count);
  12381. if (Count > 0) then
  12382. GdipCheck(GdipImageGetFrameDimensionsList(FNativeHandle, Result.ItemPtr, Count));
  12383. end;
  12384.  
  12385. function TGPImage.GetHeight: Cardinal;
  12386. begin
  12387. Result := 0;
  12388. GdipCheck(GdipGetImageHeight(FNativeHandle, Result));
  12389. end;
  12390.  
  12391. function TGPImage.GetHorizontalResolution: Single;
  12392. begin
  12393. Result := 0;
  12394. GdipCheck(GdipGetImageHorizontalResolution(FNativeHandle, Result));
  12395. end;
  12396.  
  12397. function TGPImage.GetPalette: IGPColorPalette;
  12398. var
  12399. Size: Integer;
  12400. Palette: PGPNativeColorPalette;
  12401. begin
  12402. Palette := nil;
  12403. Size := 0;
  12404. GdipCheck(GdipGetImagePaletteSize(FNativeHandle, Size));
  12405. if (Size > 0) then
  12406. begin
  12407. GetMem(Palette, Size);
  12408. GdipCheck(GdipGetImagePalette(FNativeHandle, Palette, Size));
  12409. end;
  12410. Result := TGPColorPalette.Create(Palette);
  12411. end;
  12412.  
  12413. procedure TGPImage.GetPhysicalDimension(out Size: TGPSizeF);
  12414. begin
  12415. GdipCheck(GdipGetImageDimension(FNativeHandle, Size.Width, Size.Height));
  12416. end;
  12417.  
  12418. function TGPImage.GetPixelFormat: TGPPixelFormat;
  12419. begin
  12420. GdipCheck(GdipGetImagePixelFormat(FNativeHandle, Result));
  12421. end;
  12422.  
  12423. function TGPImage.GetPropertyIdList: IGPPropertyIdList;
  12424. var
  12425. Count: Cardinal;
  12426. begin
  12427. Count := 0;
  12428. GdipCheck(GdipGetPropertyCount(FNativeHandle, Count));
  12429. Result := TGPArray<TPropID>.Create(Count);
  12430. if (Count > 0) then
  12431. GdipCheck(GdipGetPropertyIdList(FNativeHandle, Count, Result.ItemPtr));
  12432. end;
  12433.  
  12434. function TGPImage.GetPropertyItem(const PropId: TPropID): IGPPropertyItem;
  12435. var
  12436. Size: Cardinal;
  12437. Data: PGPNativePropertyItem;
  12438. begin
  12439. Size := 0;
  12440. Data := nil;
  12441. GdipCheck(GdipGetPropertyItemSize(FNativeHandle, PropId, Size));
  12442. if (Size > 0) then
  12443. begin
  12444. GetMem(Data, Size);
  12445. GdipCheck(GdipGetPropertyItem(FNativeHandle, PropId, Size, Data));
  12446. end;
  12447. Result := TGPPropertyItem.Create(Data);
  12448. end;
  12449.  
  12450. function TGPImage.GetPropertyItems: IGPPropertyItems;
  12451. var
  12452. I, TotalBufferSize, NumProperties, PropSize: Cardinal;
  12453. AllProperties, CurProp, Data: PGPNativePropertyItem;
  12454. begin
  12455. GdipCheck(GdipGetPropertySize(FNativeHandle, TotalBufferSize, NumProperties));
  12456. Result := TGPArray<IGPPropertyItem>.Create(NumProperties);
  12457. if (TotalBufferSize > 0) then
  12458. begin
  12459. GetMem(AllProperties, TotalBufferSize);
  12460. try
  12461. GdipCheck(GdipGetAllPropertyItems(FNativeHandle, TotalBufferSize,
  12462. NumProperties, AllProperties));
  12463. CurProp := AllProperties;
  12464. PropSize := TotalBufferSize div SizeOf(TGPNativePropertyItem);
  12465. for I := 0 to NumProperties - 1 do
  12466. begin
  12467. GetMem(Data, PropSize);
  12468. Move(CurProp^, Data^, PropSize);
  12469. Result[I] := TGPPropertyItem.Create(Data);
  12470. Inc(CurProp);
  12471. end;
  12472. finally
  12473. FreeMem(AllProperties);
  12474. end;
  12475. end;
  12476. end;
  12477.  
  12478. function TGPImage.GetRawFormat: TGUID;
  12479. begin
  12480. GdipCheck(GdipGetImageRawFormat(FNativeHandle, Result));
  12481. end;
  12482.  
  12483. function TGPImage.GetThumbnailImage(const ThumbWidth, ThumbHeight: Cardinal;
  12484. const Callback: TGPGetThumbnailImageAbort; const CallbackData: Pointer): IGPImage;
  12485. var
  12486. NativeThumbnail: GpImage;
  12487. begin
  12488. NativeThumbnail := nil;
  12489. GdipCheck(GdipGetImageThumbnail(FNativeHandle, ThumbWidth, ThumbHeight,
  12490. NativeThumbnail, Callback, CallbackData));
  12491. Result := TGPImage.Create(NativeThumbnail);
  12492. end;
  12493.  
  12494. function TGPImage.GetType: TGPImageType;
  12495. begin
  12496. Result := ImageTypeUnknown;
  12497. GdipCheck(GdipGetImageType(FNativeHandle, Result));
  12498. end;
  12499.  
  12500. function TGPImage.GetVerticalResolution: Single;
  12501. begin
  12502. Result := 0;
  12503. GdipCheck(GdipGetImageVerticalResolution(FNativeHandle, Result));
  12504. end;
  12505.  
  12506. function TGPImage.GetWidth: Cardinal;
  12507. begin
  12508. Result := 0;
  12509. GdipCheck(GdipGetImageWidth(FNativeHandle, Result));
  12510. end;
  12511.  
  12512. procedure TGPImage.RemovePropertyItem(const PropId: TPropID);
  12513. begin
  12514. GdipCheck(GdipRemovePropertyItem(FNativeHandle, PropId));
  12515. end;
  12516.  
  12517. procedure TGPImage.RotateFlip(const RotateFlipType: TGPRotateFlipType);
  12518. begin
  12519. GdipCheck(GdipImageRotateFlip(FNativeHandle, RotateFlipType));
  12520. end;
  12521.  
  12522. procedure TGPImage.Save(const Filename: String; const Encoder: IGPImageCodecInfo;
  12523. const Params: IGPEncoderParameters);
  12524. var
  12525. NativeParams: PGPNativeEncoderParameters;
  12526. begin
  12527. Assert(Assigned(Encoder));
  12528. if Assigned(Params) then
  12529. NativeParams := Params.NativeParams
  12530. else
  12531. NativeParams := nil;
  12532. GdipCheck(GdipSaveImageToFile(FNativeHandle, PWideChar(Filename),
  12533. Encoder.ClsId, NativeParams));
  12534. end;
  12535.  
  12536. procedure TGPImage.Save(const Stream: IStream; const Format: IGPImageFormat;
  12537. const Params: IGPEncoderParameters);
  12538. var
  12539. NativeParams: PGPNativeEncoderParameters;
  12540. begin
  12541. Assert(Assigned(Format));
  12542. if Assigned(Params) then
  12543. NativeParams := Params.NativeParams
  12544. else
  12545. NativeParams := nil;
  12546. GdipCheck(GdipSaveImageToStream(FNativeHandle, Stream, Format.CodecId, NativeParams));
  12547. end;
  12548.  
  12549. procedure TGPImage.Save(const Stream: IStream; const Encoder: IGPImageCodecInfo;
  12550. const Params: IGPEncoderParameters);
  12551. var
  12552. NativeParams: PGPNativeEncoderParameters;
  12553. begin
  12554. Assert(Assigned(Encoder));
  12555. if Assigned(Params) then
  12556. NativeParams := Params.NativeParams
  12557. else
  12558. NativeParams := nil;
  12559. GdipCheck(GdipSaveImageToStream(FNativeHandle, Stream, Encoder.ClsId, NativeParams));
  12560. end;
  12561.  
  12562. procedure TGPImage.Save(const Filename: String; const Format: IGPImageFormat;
  12563. const Params: IGPEncoderParameters);
  12564. var
  12565. NativeParams: PGPNativeEncoderParameters;
  12566. begin
  12567. Assert(Assigned(Format));
  12568. if Assigned(Params) then
  12569. NativeParams := Params.NativeParams
  12570. else
  12571. NativeParams := nil;
  12572. GdipCheck(GdipSaveImageToFile(FNativeHandle, PWideChar(Filename),
  12573. Format.CodecId, NativeParams));
  12574. end;
  12575.  
  12576. procedure TGPImage.SaveAdd(const NewImage: IGPImage;
  12577. const Params: IGPEncoderParameters);
  12578. begin
  12579. Assert(Assigned(Params));
  12580. if (NewImage = nil) then
  12581. GdipCheck(InvalidParameter);
  12582. GdipCheck(GdipSaveAddImage(FNativeHandle, NewImage.NativeHandle, Params.NativeParams));
  12583. end;
  12584.  
  12585. procedure TGPImage.SaveAdd(const Params: IGPEncoderParameters);
  12586. begin
  12587. Assert(Assigned(Params));
  12588. GdipCheck(GdipSaveAdd(FNativeHandle, Params.NativeParams));
  12589. end;
  12590.  
  12591. procedure TGPImage.SelectActiveFrame(const DimensionID: TGUID;
  12592. const FrameIndex: Cardinal);
  12593. begin
  12594. GdipCheck(GdipImageSelectActiveFrame(FNativeHandle, DimensionID, FrameIndex));
  12595. end;
  12596.  
  12597. procedure TGPImage.SetPalette(const Value: IGPColorPalette);
  12598. begin
  12599. Assert(Assigned(Value));
  12600. GdipCheck(GdipSetImagePalette(FNativeHandle, Value.NativePalette));
  12601. end;
  12602.  
  12603. procedure TGPImage.SetPropertyItem(const PropItem: IGPPropertyItem);
  12604. begin
  12605. Assert(Assigned(PropItem));
  12606. GdipCheck(GdipSetPropertyItem(FNativeHandle, PropItem.NativeItem));
  12607. end;
  12608.  
  12609. {$IF (GDIPVER >= $0110)}
  12610.  
  12611. { TGPHistogram }
  12612.  
  12613. constructor TGPHistogram.Create(const AChannelCount, AEntryCount: Integer; const AChannel0, AChannel1,
  12614. AChannel2, AChannel3: PCardinal);
  12615. begin
  12616. inherited Create;
  12617. FChannelCount := AChannelCount;
  12618. FEntryCount := AEntryCount;
  12619. FChannels[0] := AChannel0;
  12620. FChannels[1] := AChannel1;
  12621. FChannels[2] := AChannel2;
  12622. FChannels[3] := AChannel3;
  12623. end;
  12624.  
  12625. destructor TGPHistogram.Destroy;
  12626. begin
  12627. FreeMem(FChannels[3]);
  12628. FreeMem(FChannels[2]);
  12629. FreeMem(FChannels[1]);
  12630. FreeMem(FChannels[0]);
  12631. inherited;
  12632. end;
  12633.  
  12634. function TGPHistogram.GetChannel0(const Index: Integer): Cardinal;
  12635. begin
  12636. Result := FChannels[0, Index];
  12637. end;
  12638.  
  12639. function TGPHistogram.GetChannel0Ptr: PCardinal;
  12640. begin
  12641. Result := FChannels[0];
  12642. end;
  12643.  
  12644. function TGPHistogram.GetChannel1(const Index: Integer): Cardinal;
  12645. begin
  12646. Result := FChannels[1,Index];
  12647. end;
  12648.  
  12649. function TGPHistogram.GetChannel1Ptr: PCardinal;
  12650. begin
  12651. Result := FChannels[1];
  12652. end;
  12653.  
  12654. function TGPHistogram.GetChannel2(const Index: Integer): Cardinal;
  12655. begin
  12656. Result := FChannels[2,Index];
  12657. end;
  12658.  
  12659. function TGPHistogram.GetChannel2Ptr: PCardinal;
  12660. begin
  12661. Result := FChannels[2];
  12662. end;
  12663.  
  12664. function TGPHistogram.GetChannel3(const Index: Integer): Cardinal;
  12665. begin
  12666. Result := FChannels[3,Index];
  12667. end;
  12668.  
  12669. function TGPHistogram.GetChannel3Ptr: PCardinal;
  12670. begin
  12671. Result := FChannels[3];
  12672. end;
  12673.  
  12674. function TGPHistogram.GetChannelCount: Integer;
  12675. begin
  12676. Result := FChannelCount;
  12677. end;
  12678.  
  12679. function TGPHistogram.GetEntryCount: Integer;
  12680. begin
  12681. Result := FEntryCount;
  12682. end;
  12683.  
  12684. function TGPHistogram.GetValue(const ChannelIndex, EntryIndex: Integer): Cardinal;
  12685. begin
  12686. Result := FChannels[ChannelIndex, EntryIndex];
  12687. end;
  12688.  
  12689. function TGPHistogram.GetValuePtr(const ChannelIndex: Integer): PCardinal;
  12690. begin
  12691. Result := FChannels[ChannelIndex];
  12692. end;
  12693. {$IFEND}
  12694.  
  12695. { TGPBitmap }
  12696.  
  12697. {$IF (GDIPVER >= $0110)}
  12698. procedure TGPBitmap.ApplyEffect(const Effect: IGPEffect; const ROI: Windows.PRect);
  12699. var
  12700. AuxData: Pointer;
  12701. AuxDataSize: Integer;
  12702. begin
  12703. Effect.ReleaseAuxData;
  12704. AuxData := nil;
  12705. AuxDataSize := 0;
  12706. GdipCheck(GdipBitmapApplyEffect(FNativeHandle, Effect.NativeHandle, ROI,
  12707. Effect.UseAuxData, AuxData, AuxDataSize));
  12708. Effect.SetAuxData(AuxData, AuxDataSize);
  12709. end;
  12710.  
  12711. class function TGPBitmap.ApplyEffect(const Inputs: array of IGPBitmap;
  12712. const Effect: IGPEffect; const ROI, OutputRect: Windows.PRect): IGPBitmap;
  12713. var
  12714. NativeInputs: array of GpBitmap;
  12715. NativeOutput: GpBitmap;
  12716. I, AuxDataSize: Integer;
  12717. AuxData: Pointer;
  12718. begin
  12719. SetLength(NativeInputs, Length(Inputs));
  12720. for I := 0 to Length(Inputs) - 1 do
  12721. NativeInputs[I] := Inputs[I].NativeHandle;
  12722.  
  12723. Effect.ReleaseAuxData;
  12724. AuxData := nil;
  12725. AuxDataSize := 0;
  12726.  
  12727. GdipCheck(GdipBitmapCreateApplyEffect(@NativeInputs[0], Length(Inputs),
  12728. Effect.NativeHandle, ROI, OutputRect, NativeOutput, Effect.UseAuxData,
  12729. AuxData, AuxDataSize));
  12730.  
  12731. Effect.SetAuxData(AuxData, AuxDataSize);
  12732. Result := TGPBitmap.Create(NativeOutput);
  12733. end;
  12734. {$IFEND}
  12735.  
  12736. function TGPBitmap.Clone(const Rect: TGPRectF; const Format: TGPPixelFormat): IGPBitmap;
  12737. begin
  12738. Result := Clone(Rect.X, Rect.Y, Rect.Width, Rect.Height, Format);
  12739. end;
  12740.  
  12741. function TGPBitmap.Clone(const X, Y, Width, Height: Single;
  12742. const Format: TGPPixelFormat): IGPBitmap;
  12743. var
  12744. NativeClone: GpBitmap;
  12745. begin
  12746. GdipCheck(GdipCloneBitmapArea(X, Y, Width, Height, Format, FNativeHandle, NativeClone));
  12747. Result := TGPBitmap.Create(NativeClone);
  12748. end;
  12749.  
  12750. function TGPBitmap.Clone: IGPBitmap;
  12751. begin
  12752. Result := Clone(0, 0, GetWidth, GetHeight, GetPixelFormat);
  12753. end;
  12754.  
  12755. function TGPBitmap.Clone(const X, Y, Width, Height: Integer;
  12756. const Format: TGPPixelFormat): IGPBitmap;
  12757. var
  12758. NativeClone: GpBitmap;
  12759. begin
  12760. GdipCheck(GdipCloneBitmapAreaI(X, Y, Width, Height, Format, FNativeHandle, NativeClone));
  12761. Result := TGPBitmap.Create(NativeClone);
  12762. end;
  12763.  
  12764. function TGPBitmap.Clone(const Rect: TGPRect; const Format: TGPPixelFormat): IGPBitmap;
  12765. begin
  12766. Result := Clone(Rect.X, Rect.Y, Rect.Width, Rect.Height, Format);
  12767. end;
  12768.  
  12769. {$IF (GDIPVER >= $0110)}
  12770. procedure TGPBitmap.ConvertFormat(const Format: TGPPixelFormat;
  12771. const DitherType: TGPDitherType; const PaletteType: TGPPaletteType;
  12772. const Palette: IGPColorPalette; const AlphaThresholdPercent: Single);
  12773. var
  12774. NativePalette: PGPNativeColorPalette;
  12775. begin
  12776. if Assigned(Palette) then
  12777. NativePalette := Palette.NativePalette
  12778. else
  12779. NativePalette := nil;
  12780. GdipCheck(GdipBitmapConvertFormat(FNativeHandle, Format, DitherType,
  12781. PaletteType, NativePalette, AlphaThresholdPercent));
  12782. end;
  12783. {$IFEND}
  12784.  
  12785. constructor TGPBitmap.Create(const Filename: String;
  12786. const UseEmbeddedColorManagement: Boolean);
  12787. begin
  12788. inherited Create;
  12789. if (UseEmbeddedColorManagement) then
  12790. GdipCheck(GdipCreateBitmapFromFileICM(PWideChar(Filename), FNativeHandle))
  12791. else
  12792. GdipCheck(GdipCreateBitmapFromFile(PWideChar(Filename), FNativeHandle))
  12793. end;
  12794.  
  12795. constructor TGPBitmap.Create(const NativeBitmap: GpBitmap);
  12796. begin
  12797. inherited Create(NativeBitmap);
  12798. end;
  12799.  
  12800. constructor TGPBitmap.Create(const BitmapHandle: HBitmap;
  12801. const Palette: HPalette);
  12802. begin
  12803. inherited Create;
  12804. GdipCheck(GdipCreateBitmapFromHBITMAP(BitmapHandle, Palette, FNativeHandle))
  12805. end;
  12806.  
  12807. constructor TGPBitmap.Create(const BitmapInfo: TBitmapInfo;
  12808. const BitmapData: Pointer);
  12809. begin
  12810. inherited Create;
  12811. GdipCheck(GdipCreateBitmapFromGdiDib(@BitmapInfo, BitmapData, FNativeHandle))
  12812. end;
  12813.  
  12814. constructor TGPBitmap.Create(const Instance: HInst; const BitmapName: String);
  12815. begin
  12816. inherited Create;
  12817. GdipCheck(GdipCreateBitmapFromResource(Instance, PWideChar(BitmapName), FNativeHandle))
  12818. end;
  12819.  
  12820. constructor TGPBitmap.Create(const IconHandle: HIcon);
  12821. begin
  12822. inherited Create;
  12823. GdipCheck(GdipCreateBitmapFromHICON(IconHandle, FNativeHandle))
  12824. end;
  12825.  
  12826. constructor TGPBitmap.Create(const DirectDrawSurface7: IInterface);
  12827. {$IFOPT C+}
  12828. const
  12829. IID_IDirectDrawSurface7: TGUID = '{15e65ec0-3b9c-11d2-b92f-00609797ea5b}';
  12830. {$ENDIF}
  12831. begin
  12832. {$IFOPT C+}
  12833. Assert(Supports(DirectDrawSurface7, IID_IDirectDrawSurface7));
  12834. {$ENDIF}
  12835. inherited Create;
  12836. GdipCheck(GdipCreateBitmapFromDirectDrawSurface(DirectDrawSurface7, FNativeHandle))
  12837. end;
  12838.  
  12839. constructor TGPBitmap.Create(const Stream: IStream;
  12840. const UseEmbeddedColorManagement: Boolean);
  12841. begin
  12842. inherited Create;
  12843. if (UseEmbeddedColorManagement) then
  12844. GdipCheck(GdipCreateBitmapFromStreamICM(Stream, FNativeHandle))
  12845. else
  12846. GdipCheck(GdipCreateBitmapFromStream(Stream, FNativeHandle))
  12847. end;
  12848.  
  12849. constructor TGPBitmap.Create(const Width, Height, Stride: Integer;
  12850. const Format: TGPPixelFormat; const Scan0: Pointer);
  12851. begin
  12852. inherited Create;
  12853. GdipCheck(GdipCreateBitmapFromScan0(Width, Height, Stride, Format, Scan0, FNativeHandle));
  12854. end;
  12855.  
  12856. constructor TGPBitmap.Create(const Width, Height: Integer;
  12857. const Target: IGPGraphics);
  12858. begin
  12859. inherited Create;
  12860. GdipCheck(GdipCreateBitmapFromGraphics(Width, Height, Target.NativeHandle, FNativeHandle));
  12861. end;
  12862.  
  12863. constructor TGPBitmap.Create(const Width, Height: Integer;
  12864. const Format: TGPPixelFormat);
  12865. begin
  12866. inherited Create;
  12867. GdipCheck(GdipCreateBitmapFromScan0(Width, Height, 0, Format, nil, FNativeHandle));
  12868. end;
  12869.  
  12870. class function TGPBitmap.FromBitmapInfo(const BitmapInfo: TBitmapInfo;
  12871. const BitmapData: Pointer): IGPBitmap;
  12872. begin
  12873. Result := TGPBitmap.Create(BitmapInfo, BitmapData);
  12874. end;
  12875.  
  12876. class function TGPBitmap.FromDirectDrawSurface7(
  12877. const Surface: IInterface): IGPBitmap;
  12878. begin
  12879. Result := TGPBitmap.Create(Surface);
  12880. end;
  12881.  
  12882. class function TGPBitmap.FromFile(const Filename: String;
  12883. const UseEmbeddedColorManagement: Boolean): IGPBitmap;
  12884. begin
  12885. Result := TGPBitmap.Create(Filename, UseEmbeddedColorManagement);
  12886. end;
  12887.  
  12888. class function TGPBitmap.FromHBitmap(const BitmapHandle: HBitmap;
  12889. const Palette: HPalette): IGPBitmap;
  12890. begin
  12891. Result := TGPBitmap.Create(BitmapHandle, Palette);
  12892. end;
  12893.  
  12894. class function TGPBitmap.FromHIcon(const IconHandle: HIcon): IGPBitmap;
  12895. begin
  12896. Result := TGPBitmap.Create(IconHandle);
  12897. end;
  12898.  
  12899. class function TGPBitmap.FromResource(const Instance: HInst;
  12900. const BitmapName: String): IGPBitmap;
  12901. begin
  12902. Result := TGPBitmap.Create(Instance, BitmapName);
  12903. end;
  12904.  
  12905. class function TGPBitmap.FromStream(const Stream: IStream;
  12906. const UseEmbeddedColorManagement: Boolean): IGPBitmap;
  12907. begin
  12908. Result := TGPBitmap.Create(Stream, UseEmbeddedColorManagement);
  12909. end;
  12910.  
  12911. function TGPBitmap.GetHBitmap(const ColorBackground: TGPColor): HBitmap;
  12912. begin
  12913. GdipCheck(GdipCreateHBITMAPFromBitmap(FNativeHandle, Result, ColorBackground.Value));
  12914. end;
  12915.  
  12916. function TGPBitmap.GetHIcon: HIcon;
  12917. begin
  12918. GdipCheck(GdipCreateHICONFromBitmap(FNativeHandle, Result));
  12919. end;
  12920.  
  12921. {$IF (GDIPVER >= $0110)}
  12922. function TGPBitmap.GetHistogram(const Format: TGPHistogramFormat): IGPHistogram;
  12923. var
  12924. ChannelCount, EntryCount: Cardinal;
  12925. Channel0, Channel1, Channel2, Channel3: PCardinal;
  12926. begin
  12927. case Format of
  12928. HistogramFormatARGB,
  12929. HistogramFormatPARGB:
  12930. ChannelCount := 4;
  12931. HistogramFormatRGB:
  12932. ChannelCount := 3;
  12933. else
  12934. ChannelCount := 1;
  12935. end;
  12936. EntryCount := 0;
  12937. Channel0 := nil;
  12938. Channel1 := nil;
  12939. Channel2 := nil;
  12940. Channel3 := nil;
  12941. GdipCheck(GdipBitmapGetHistogramSize(Format, EntryCount));
  12942. if (EntryCount > 0) then
  12943. begin
  12944. GetMem(Channel0, EntryCount * SizeOf(Cardinal));
  12945. if (ChannelCount > 1) then
  12946. begin
  12947. GetMem(Channel1, EntryCount * SizeOf(Cardinal));
  12948. GetMem(Channel2, EntryCount * SizeOf(Cardinal));
  12949. if (ChannelCount > 3) then
  12950. GetMem(Channel3, EntryCount * SizeOf(Cardinal));
  12951. end;
  12952.  
  12953. try
  12954. GdipCheck(GdipBitmapGetHistogram(FNativeHandle, Format, EntryCount,
  12955. Channel0, Channel1, Channel2, Channel3));
  12956. except
  12957. FreeMem(Channel3);
  12958. FreeMem(Channel2);
  12959. FreeMem(Channel2);
  12960. FreeMem(Channel0);
  12961. Channel0 := nil;
  12962. Channel1 := nil;
  12963. Channel2 := nil;
  12964. Channel3 := nil;
  12965. end;
  12966. end;
  12967. Result := TGPHistogram.Create(ChannelCount, EntryCount, Channel0, Channel1, Channel2, Channel3);
  12968. end;
  12969. {$IFEND}
  12970.  
  12971. function TGPBitmap.GetPixel(const X, Y: Integer): TGPColor;
  12972. begin
  12973. GdipCheck(GdipBitmapGetPixel(FNativeHandle, X, Y, Result.FArgb));
  12974. end;
  12975.  
  12976. {$IF (GDIPVER >= $0110)}
  12977. class function TGPBitmap.InitializePalette(const ColorCount: Integer;
  12978. const PaletteType: TGPPaletteType; const OptimalColors: Integer;
  12979. const UseTransparentColor: Boolean; const Bitmap: IGPBitmap): IGPColorPalette;
  12980. var
  12981. NativePalette: PGPNativeColorPalette;
  12982. begin
  12983. GetMem(NativePalette, SizeOf(TGPNativeColorPalette) + ColorCount * SizeOf(ARGB));
  12984. NativePalette.Flags := [];
  12985. NativePalette.Count := ColorCount;
  12986. try
  12987. GdipCheck(GdipInitializePalette(NativePalette, PaletteType, OptimalColors,
  12988. UseTransparentColor, GdipHandle(Bitmap)));
  12989. except
  12990. FreeMem(NativePalette);
  12991. raise;
  12992. end;
  12993. Result := TGPColorPalette.Create(NativePalette);
  12994. end;
  12995. {$IFEND}
  12996.  
  12997. function TGPBitmap.LockBits(const Rect: TGPRect; const Mode: TGPImageLockMode;
  12998. const Format: TGPPixelFormat): TGPBitmapData;
  12999. begin
  13000. GdipCheck(GdipBitmapLockBits(FNativeHandle, @Rect, Mode, Format, Result));
  13001. end;
  13002.  
  13003. procedure TGPBitmap.SetPixel(const X, Y: Integer; const Value: TGPColor);
  13004. begin
  13005. GdipCheck(GdipBitmapSetPixel(FNativeHandle, X, Y, Value.Value));
  13006. end;
  13007.  
  13008. procedure TGPBitmap.SetResolution(const XDpi, YDpi: Single);
  13009. begin
  13010. GdipCheck(GdipBitmapSetResolution(FNativeHandle, XDpi, YDpi));
  13011. end;
  13012.  
  13013. procedure TGPBitmap.UnlockBits(const LockedBitmapData: TGPBitmapData);
  13014. begin
  13015. GdipCheck(GdipBitmapUnlockBits(FNativeHandle, LockedBitmapData));
  13016. end;
  13017. {$ENDREGION 'GdiplusBitmap.h'}
  13018.  
  13019. {$REGION 'GdiplusLineCaps.h'}
  13020.  
  13021. { TGPCustomLineCap }
  13022.  
  13023. function TGPCustomLineCap.Clone: IGPCustomLineCap;
  13024. var
  13025. NativeClone: GpCustomLineCap;
  13026. begin
  13027. NativeClone := nil;
  13028. GdipCheck(GdipCloneCustomLineCap(FNativeHandle, NativeClone));
  13029. Result := TGPCustomLineCap.Create(NativeClone);
  13030. end;
  13031.  
  13032. constructor TGPCustomLineCap.Create(const NativeLineCap: GpCustomLineCap);
  13033. begin
  13034. inherited Create;
  13035. FNativeHandle := NativeLineCap;
  13036. end;
  13037.  
  13038. constructor TGPCustomLineCap.Create(const FillPath, StrokePath: IGPGraphicsPath;
  13039. const BaseCap: TGPLineCap; const BaseInset: Single);
  13040. begin
  13041. inherited Create;
  13042. GdipCheck(GdipCreateCustomLineCap(GdipHandle(FillPath), GdipHandle(StrokePath),
  13043. BaseCap, BaseInset, FNativeHandle));
  13044. end;
  13045.  
  13046. destructor TGPCustomLineCap.Destroy;
  13047. begin
  13048. GdipDeleteCustomLineCap(FNativeHandle);
  13049. inherited;
  13050. end;
  13051.  
  13052. function TGPCustomLineCap.GetBaseCap: TGPLineCap;
  13053. begin
  13054. GdipCheck(GdipGetCustomLineCapBaseCap(FNativeHandle, Result));
  13055. end;
  13056.  
  13057. function TGPCustomLineCap.GetBaseInset: Single;
  13058. begin
  13059. GdipCheck(GdipGetCustomLineCapBaseInset(FNativeHandle, Result));
  13060. end;
  13061.  
  13062. procedure TGPCustomLineCap.GetStrokeCaps(out StartCap, EndCap: TGPLineCap);
  13063. begin
  13064. GdipCheck(GdipGetCustomLineCapStrokeCaps(FNativeHandle, StartCap, EndCap));
  13065. end;
  13066.  
  13067. function TGPCustomLineCap.GetStrokeJoin: TGPLineJoin;
  13068. begin
  13069. GdipCheck(GdipGetCustomLineCapStrokeJoin(FNativeHandle, Result));
  13070. end;
  13071.  
  13072. function TGPCustomLineCap.GetWidthScale: Single;
  13073. begin
  13074. GdipCheck(GdipGetCustomLineCapWidthScale(FNativeHandle, Result));
  13075. end;
  13076.  
  13077. procedure TGPCustomLineCap.SetBaseCap(const Value: TGPLineCap);
  13078. begin
  13079. GdipCheck(GdipSetCustomLineCapBaseCap(FNativeHandle, Value));
  13080. end;
  13081.  
  13082. procedure TGPCustomLineCap.SetBaseInset(const Value: Single);
  13083. begin
  13084. GdipCheck(GdipSetCustomLineCapBaseInset(FNativeHandle, Value));
  13085. end;
  13086.  
  13087. procedure TGPCustomLineCap.SetStrokeCap(const StrokeCap: TGPLineCap);
  13088. begin
  13089. SetStrokeCaps(StrokeCap, StrokeCap);
  13090. end;
  13091.  
  13092. procedure TGPCustomLineCap.SetStrokeCaps(const StartCap, EndCap: TGPLineCap);
  13093. begin
  13094. GdipCheck(GdipSetCustomLineCapStrokeCaps(FNativeHandle, StartCap, EndCap));
  13095. end;
  13096.  
  13097. procedure TGPCustomLineCap.SetStrokeJoin(const Value: TGPLineJoin);
  13098. begin
  13099. GdipCheck(GdipSetCustomLineCapStrokeJoin(FNativeHandle, Value));
  13100. end;
  13101.  
  13102. procedure TGPCustomLineCap.SetWidthScale(const Value: Single);
  13103. begin
  13104. GdipCheck(GdipSetCustomLineCapWidthScale(FNativeHandle, Value));
  13105. end;
  13106.  
  13107. { TGPAdjustableArrowCap }
  13108.  
  13109. constructor TGPAdjustableArrowCap.Create(const Height, Width: Single;
  13110. const IsFilled: Boolean);
  13111. begin
  13112. GdipCheck(GdipCreateAdjustableArrowCap(Height, Width, IsFilled, FNativeHandle));
  13113. end;
  13114.  
  13115. function TGPAdjustableArrowCap.GetFilled: Boolean;
  13116. var
  13117. B: Bool;
  13118. begin
  13119. GdipCheck(GdipGetAdjustableArrowCapFillState(FNativeHandle, B));
  13120. Result := B;
  13121. end;
  13122.  
  13123. function TGPAdjustableArrowCap.GetHeight: Single;
  13124. begin
  13125. GdipCheck(GdipGetAdjustableArrowCapHeight(FNativeHandle, Result));
  13126. end;
  13127.  
  13128. function TGPAdjustableArrowCap.GetMiddleInset: Single;
  13129. begin
  13130. GdipCheck(GdipGetAdjustableArrowCapMiddleInset(FNativeHandle, Result));
  13131. end;
  13132.  
  13133. function TGPAdjustableArrowCap.GetWidth: Single;
  13134. begin
  13135. GdipCheck(GdipGetAdjustableArrowCapWidth(FNativeHandle, Result));
  13136. end;
  13137.  
  13138. procedure TGPAdjustableArrowCap.SetFilled(const Value: Boolean);
  13139. begin
  13140. GdipCheck(GdipSetAdjustableArrowCapFillState(FNativeHandle, Value));
  13141. end;
  13142.  
  13143. procedure TGPAdjustableArrowCap.SetHeight(const Value: Single);
  13144. begin
  13145. GdipCheck(GdipSetAdjustableArrowCapHeight(FNativeHandle, Value));
  13146. end;
  13147.  
  13148. procedure TGPAdjustableArrowCap.SetMiddleInset(const Value: Single);
  13149. begin
  13150. GdipCheck(GdipSetAdjustableArrowCapMiddleInset(FNativeHandle, Value));
  13151. end;
  13152.  
  13153. procedure TGPAdjustableArrowCap.SetWidth(const Value: Single);
  13154. begin
  13155. GdipCheck(GdipSetAdjustableArrowCapWidth(FNativeHandle, Value));
  13156. end;
  13157. {$ENDREGION 'GdiplusLineCaps.h'}
  13158.  
  13159. {$REGION 'GdiplusCachedBitmap.h'}
  13160.  
  13161. { TGPCachedBitmap }
  13162.  
  13163. constructor TGPCachedBitmap.Create(const Bitmap: IGPBitmap;
  13164. const Graphics: IGPGraphics);
  13165. begin
  13166. inherited Create;
  13167. GdipCheck(GdipCreateCachedBitmap(Bitmap.NativeHandle, Graphics.NativeHandle, FNativeHandle));
  13168. end;
  13169.  
  13170. destructor TGPCachedBitmap.Destroy;
  13171. begin
  13172. GdipDeleteCachedBitmap(FNativeHandle);
  13173. inherited;
  13174. end;
  13175. {$ENDREGION 'GdiplusCachedBitmap.h'}
  13176.  
  13177. {$REGION 'GdiplusMetafile.h'}
  13178.  
  13179. { TGPMetafile }
  13180.  
  13181. {$IF (GDIPVER >= $0110)}
  13182. procedure TGPMetafile.ConvertToEmfPlus(const RefGraphics: IGPGraphics;
  13183. const ConversionFailureFlag: PInteger; const EmfType: TGPEmfType;
  13184. const Description: String);
  13185. var
  13186. Metafile: GpMetafile;
  13187. begin
  13188. Metafile := nil;
  13189. GdipCheck(GdipConvertToEmfPlus(RefGraphics.NativeHandle, FNativeHandle,
  13190. ConversionFailureFlag, EmfType, PWideChar(Description), Metafile));
  13191. GdipDisposeImage(FNativeHandle);
  13192. FNativeHandle := Metafile;
  13193. end;
  13194.  
  13195. procedure TGPMetafile.ConvertToEmfPlus(const RefGraphics: IGPGraphics;
  13196. const Filename: String; const ConversionFailureFlag: PInteger;
  13197. const EmfType: TGPEmfType; const Description: String);
  13198. var
  13199. Metafile: GpMetafile;
  13200. begin
  13201. Metafile := nil;
  13202. GdipCheck(GdipConvertToEmfPlusToFile(RefGraphics.NativeHandle, FNativeHandle,
  13203. ConversionFailureFlag, PWideChar(Filename), EmfType, PWideChar(Description), Metafile));
  13204. GdipDisposeImage(FNativeHandle);
  13205. FNativeHandle := Metafile;
  13206. end;
  13207.  
  13208. procedure TGPMetafile.ConvertToEmfPlus(const RefGraphics: IGPGraphics;
  13209. const Stream: IStream; const ConversionFailureFlag: PInteger;
  13210. const EmfType: TGPEmfType; const Description: String);
  13211. var
  13212. Metafile: GpMetafile;
  13213. begin
  13214. Metafile := nil;
  13215. GdipCheck(GdipConvertToEmfPlusToStream(RefGraphics.NativeHandle, FNativeHandle,
  13216. ConversionFailureFlag, Stream, EmfType, PWideChar(Description), Metafile));
  13217. GdipDisposeImage(FNativeHandle);
  13218. FNativeHandle := Metafile;
  13219. end;
  13220. {$IFEND}
  13221.  
  13222. constructor TGPMetafile.Create(const Filename: String;
  13223. const WmfPlaceableFileHeader: TWmfPlaceableFileHeader);
  13224. begin
  13225. inherited Create;
  13226. GdipCheck(GdipCreateMetafileFromWmfFile(PWideChar(Filename), WmfPlaceableFileHeader, FNativeHandle));
  13227. end;
  13228.  
  13229. constructor TGPMetafile.Create(const Stream: IStream);
  13230. begin
  13231. inherited Create;
  13232. GdipCheck(GdipCreateMetafileFromStream(Stream, FNativeHandle));
  13233. end;
  13234.  
  13235. constructor TGPMetafile.Create(const ReferenceDC: HDC; const EmfType: TGPEmfType;
  13236. const Description: String);
  13237. begin
  13238. inherited Create;
  13239. GdipCheck(GdipRecordMetafile(ReferenceDC, EmfType, nil, MetafileFrameUnitGdi,
  13240. PWideChar(Description), FNativeHandle));
  13241. end;
  13242.  
  13243. constructor TGPMetafile.Create(const Filename: String);
  13244. begin
  13245. inherited Create;
  13246. GdipCheck(GdipCreateMetafileFromFile(PWideChar(Filename), FNativeHandle));
  13247. end;
  13248.  
  13249. constructor TGPMetafile.Create(const Wmf: HMetafile;
  13250. const WmfPlaceableFileHeader: TWmfPlaceableFileHeader;
  13251. const DeleteWmf: Boolean);
  13252. begin
  13253. inherited Create;
  13254. GdipCheck(GdipCreateMetafileFromWmf(Wmf, DeleteWmf, WmfPlaceableFileHeader, FNativeHandle));
  13255. end;
  13256.  
  13257. constructor TGPMetafile.Create(const Emf: HEnhMetafile; const DeleteEmf: Boolean);
  13258. begin
  13259. inherited Create;
  13260. GdipCheck(GdipCreateMetafileFromEmf(Emf, DeleteEmf, FNativeHandle));
  13261. end;
  13262.  
  13263. constructor TGPMetafile.Create(const ReferenceDC: HDC; const FrameRect: TGPRectF;
  13264. const FrameUnit: TGPMetafileFrameUnit; const EmfType: TGPEmfType;
  13265. const Description: String);
  13266. begin
  13267. inherited Create;
  13268. GdipCheck(GdipRecordMetafile(ReferenceDC, EmfType, @FrameRect, FrameUnit,
  13269. PWideChar(Description), FNativeHandle));
  13270. end;
  13271.  
  13272. constructor TGPMetafile.Create(const Stream: IStream; const ReferenceDC: HDC;
  13273. const EmfType: TGPEmfType; const Description: String);
  13274. begin
  13275. inherited Create;
  13276. GdipCheck(GdipRecordMetafileStream(Stream, ReferenceDC, EmfType, nil,
  13277. MetafileFrameUnitGdi, PWideChar(Description), FNativeHandle));
  13278. end;
  13279.  
  13280. constructor TGPMetafile.Create(const Stream: IStream; const ReferenceDC: HDC;
  13281. const FrameRect: TGPRectF; const FrameUnit: TGPMetafileFrameUnit;
  13282. const EmfType: TGPEmfType; const Description: String);
  13283. begin
  13284. inherited Create;
  13285. GdipCheck(GdipRecordMetafileStream(Stream, ReferenceDC, EmfType, @FrameRect,
  13286. FrameUnit, PWideChar(Description), FNativeHandle));
  13287. end;
  13288.  
  13289. constructor TGPMetafile.Create(const Stream: IStream; const ReferenceDC: HDC;
  13290. const FrameRect: TGPRect; const FrameUnit: TGPMetafileFrameUnit;
  13291. const EmfType: TGPEmfType; const Description: String);
  13292. begin
  13293. inherited Create;
  13294. GdipCheck(GdipRecordMetafileStreamI(Stream, ReferenceDC, EmfType, @FrameRect,
  13295. FrameUnit, PWideChar(Description), FNativeHandle));
  13296. end;
  13297.  
  13298. constructor TGPMetafile.Create(const Filename: String; const ReferenceDC: HDC;
  13299. const FrameRect: TGPRect; const FrameUnit: TGPMetafileFrameUnit;
  13300. const EmfType: TGPEmfType; const Description: String);
  13301. begin
  13302. inherited Create;
  13303. GdipCheck(GdipRecordMetafileFileNameI(PWideChar(Filename), ReferenceDC,
  13304. EmfType, @FrameRect, FrameUnit, PWideChar(Description), FNativeHandle));
  13305. end;
  13306.  
  13307. constructor TGPMetafile.Create(const ReferenceDC: HDC; const FrameRect: TGPRect;
  13308. const FrameUnit: TGPMetafileFrameUnit; const EmfType: TGPEmfType;
  13309. const Description: String);
  13310. begin
  13311. inherited Create;
  13312. GdipCheck(GdipRecordMetafileI(ReferenceDC, EmfType, @FrameRect, FrameUnit,
  13313. PWideChar(Description), FNativeHandle));
  13314. end;
  13315.  
  13316. constructor TGPMetafile.Create(const Filename: String; const ReferenceDC: HDC;
  13317. const EmfType: TGPEmfType; const Description: String);
  13318. begin
  13319. inherited Create;
  13320. GdipCheck(GdipRecordMetafileFileName(PWideChar(Filename), ReferenceDC,
  13321. EmfType, nil, MetafileFrameUnitGdi, PWideChar(Description), FNativeHandle));
  13322. end;
  13323.  
  13324. constructor TGPMetafile.Create(const Filename: String; const ReferenceDC: HDC;
  13325. const FrameRect: TGPRectF; const FrameUnit: TGPMetafileFrameUnit;
  13326. const EmfType: TGPEmfType; const Description: String);
  13327. begin
  13328. inherited Create;
  13329. GdipCheck(GdipRecordMetafileFileName(PWideChar(Filename), ReferenceDC,
  13330. EmfType, @FrameRect, FrameUnit, PWideChar(Description), FNativeHandle));
  13331. end;
  13332.  
  13333. class function TGPMetafile.EmfToWmfBits(const Emf: HEnhMetafile;
  13334. const MapMode: Integer; const Flags: TGPEmfToWmfBitsFlags): IGPBuffer;
  13335. var
  13336. Data: Pointer;
  13337. Size: Integer;
  13338. begin
  13339. Data := nil;
  13340. Size := GdipEmfToWmfBits(Emf, 0, nil, MapMode, Flags);
  13341. if (Size > 0) then
  13342. begin
  13343. GetMem(Data, Size);
  13344. GdipEmfToWmfBits(Emf, Size, Data, MapMode, Flags);
  13345. end;
  13346. Result := TGPBuffer.Create(Data, Size);
  13347. end;
  13348.  
  13349. function TGPMetafile.GetDownLevelRasterizationLimit: Cardinal;
  13350. begin
  13351. GdipCheck(GdipGetMetafileDownLevelRasterizationLimit(FNativeHandle, Result));
  13352. end;
  13353.  
  13354. function TGPMetafile.GetHEnhMetafile: HEnhMetafile;
  13355. begin
  13356. GdipCheck(GdipGetHemfFromMetafile(FNativeHandle, Result));
  13357. end;
  13358.  
  13359. class function TGPMetafile.GetMetafileHeader(
  13360. const Emf: HEnhMetafile): TGPMetafileHeader;
  13361. begin
  13362. GdipCheck(GdipGetMetafileHeaderFromEmf(Emf, Result));
  13363. end;
  13364.  
  13365. class function TGPMetafile.GetMetafileHeader(const Wmf: HMetafile;
  13366. const WmfPlaceableFileHeader: TWmfPlaceableFileHeader): TGPMetafileHeader;
  13367. begin
  13368. GdipCheck(GdipGetMetafileHeaderFromWmf(Wmf, WmfPlaceableFileHeader, Result));
  13369. end;
  13370.  
  13371. function TGPMetafile.GetMetafileHeader: TGPMetafileHeader;
  13372. begin
  13373. GdipCheck(GdipGetMetafileHeaderFromMetafile(FNativeHandle, Result));
  13374. end;
  13375.  
  13376. class function TGPMetafile.GetMetafileHeader(
  13377. const Filename: String): TGPMetafileHeader;
  13378. begin
  13379. GdipCheck(GdipGetMetafileHeaderFromFile(PWideChar(Filename), Result));
  13380. end;
  13381.  
  13382. class function TGPMetafile.GetMetafileHeader(
  13383. const Stream: IStream): TGPMetafileHeader;
  13384. begin
  13385. GdipCheck(GdipGetMetafileHeaderFromStream(Stream, Result));
  13386. end;
  13387.  
  13388. procedure TGPMetafile.PlayRecord(const RecordType: TEmfPlusRecordType;
  13389. const Flags, DataSize: Integer; const Data: Pointer);
  13390. begin
  13391. GdipCheck(GdipPlayMetafileRecord(FNativeHandle, RecordType, Flags, DataSize, Data));
  13392. end;
  13393.  
  13394. procedure TGPMetafile.SetDownLevelRasterizationLimit(const Value: Cardinal);
  13395. begin
  13396. GdipCheck(GdipSetMetafileDownLevelRasterizationLimit(FNativeHandle, Value));
  13397. end;
  13398. {$ENDREGION 'GdiplusMetafile.h'}
  13399.  
  13400. {$REGION 'GdiplusImageAttributes.h'}
  13401.  
  13402. { TGPImageAttributes }
  13403.  
  13404. procedure TGPImageAttributes.ClearBrushRemapTable;
  13405. begin
  13406. ClearRemapTable(ColorAdjustTypeBrush);
  13407. end;
  13408.  
  13409. procedure TGPImageAttributes.ClearColorKey(const AdjustType: TGPColorAdjustType);
  13410. begin
  13411. GdipCheck(GdipSetImageAttributesColorKeys(FNativeHandle, AdjustType, False,
  13412. 0, 0));
  13413. end;
  13414.  
  13415. procedure TGPImageAttributes.ClearColorMatrices(
  13416. const AdjustType: TGPColorAdjustType);
  13417. begin
  13418. GdipCheck(GdipSetImageAttributesColorMatrix(FNativeHandle, AdjustType,
  13419. False, nil, nil, ColorMatrixFlagsDefault));
  13420. end;
  13421.  
  13422. procedure TGPImageAttributes.ClearColorMatrix(const AdjustType: TGPColorAdjustType);
  13423. begin
  13424. GdipCheck(GdipSetImageAttributesColorMatrix(FNativeHandle, AdjustType,
  13425. False, nil, nil, ColorMatrixFlagsDefault));
  13426. end;
  13427.  
  13428. procedure TGPImageAttributes.ClearGamma(const AdjustType: TGPColorAdjustType);
  13429. begin
  13430. GdipCheck(GdipSetImageAttributesGamma(FNativeHandle, AdjustType,
  13431. False, 0));
  13432. end;
  13433.  
  13434. procedure TGPImageAttributes.ClearNoOp(const AdjustType: TGPColorAdjustType);
  13435. begin
  13436. GdipCheck(GdipSetImageAttributesNoOp(FNativeHandle, AdjustType, False));
  13437. end;
  13438.  
  13439. procedure TGPImageAttributes.ClearOutputChannel(
  13440. const AdjustType: TGPColorAdjustType);
  13441. begin
  13442. GdipCheck(GdipSetImageAttributesOutputChannel(FNativeHandle, AdjustType, False,
  13443. ColorChannelFlagsLast));
  13444. end;
  13445.  
  13446. procedure TGPImageAttributes.ClearOutputChannelColorProfile(
  13447. const AdjustType: TGPColorAdjustType);
  13448. begin
  13449. GdipCheck(GdipSetImageAttributesOutputChannelColorProfile(FNativeHandle,
  13450. AdjustType, False, nil));
  13451. end;
  13452.  
  13453. procedure TGPImageAttributes.ClearRemapTable(const AdjustType: TGPColorAdjustType);
  13454. begin
  13455. GdipCheck(GdipSetImageAttributesRemapTable(FNativeHandle, AdjustType, False,
  13456. 0, nil));
  13457. end;
  13458.  
  13459. procedure TGPImageAttributes.ClearThreshold(const AdjustType: TGPColorAdjustType);
  13460. begin
  13461. GdipCheck(GdipSetImageAttributesThreshold(FNativeHandle, AdjustType,
  13462. False, 0));
  13463. end;
  13464.  
  13465. function TGPImageAttributes.Clone: IGPImageAttributes;
  13466. var
  13467. NativeClone: GpImageAttributes;
  13468. begin
  13469. GdipCheck(GdipCloneImageAttributes(FNativeHandle, NativeClone));
  13470. Result := TGPImageAttributes.Create(NativeClone);
  13471. end;
  13472.  
  13473. constructor TGPImageAttributes.Create(const NativeAttributes: GpImageAttributes);
  13474. begin
  13475. inherited Create;
  13476. FNativeHandle := NativeAttributes;
  13477. end;
  13478.  
  13479. constructor TGPImageAttributes.Create;
  13480. begin
  13481. inherited Create;
  13482. GdipCheck(GdipCreateImageAttributes(FNativeHandle));
  13483. end;
  13484.  
  13485. destructor TGPImageAttributes.Destroy;
  13486. begin
  13487. GdipDisposeImageAttributes(FNativeHandle);
  13488. inherited;
  13489. end;
  13490.  
  13491. procedure TGPImageAttributes.GetAdjustedPalette(const ColorPalette: IGPColorPalette;
  13492. const ColorAdjustType: TGPColorAdjustType);
  13493. begin
  13494. Assert(Assigned(ColorPalette));
  13495. GdipCheck(GdipGetImageAttributesAdjustedPalette(FNativeHandle,
  13496. ColorPalette.NativePalette, ColorAdjustType));
  13497. end;
  13498.  
  13499. procedure TGPImageAttributes.Reset(const AdjustType: TGPColorAdjustType);
  13500. begin
  13501. GdipCheck(GdipResetImageAttributes(FNativeHandle, AdjustType));
  13502. end;
  13503.  
  13504. procedure TGPImageAttributes.SetBrushRemapTable(const Map: array of TGPColorMap);
  13505. begin
  13506. SetRemapTable(Map, ColorAdjustTypeBrush);
  13507. end;
  13508.  
  13509. procedure TGPImageAttributes.SetColorKey(const ColorLow, ColorHigh: TGPColor;
  13510. const AdjustType: TGPColorAdjustType);
  13511. begin
  13512. GdipCheck(GdipSetImageAttributesColorKeys(FNativeHandle, AdjustType, True,
  13513. ColorLow.Value, ColorHigh.Value));
  13514. end;
  13515.  
  13516. procedure TGPImageAttributes.SetColorMatrices(const ColorMatrix,
  13517. GrayMatrix: TGPColorMatrix; const Mode: TGPColorMatrixFlags;
  13518. const AdjustType: TGPColorAdjustType);
  13519. begin
  13520. GdipCheck(GdipSetImageAttributesColorMatrix(FNativeHandle, AdjustType,
  13521. True, @ColorMatrix, @GrayMatrix, Mode));
  13522. end;
  13523.  
  13524. procedure TGPImageAttributes.SetColorMatrix(const ColorMatrix: TGPColorMatrix;
  13525. const Mode: TGPColorMatrixFlags; const AdjustType: TGPColorAdjustType);
  13526. begin
  13527. GdipCheck(GdipSetImageAttributesColorMatrix(FNativeHandle, AdjustType,
  13528. True, @ColorMatrix, nil, Mode));
  13529. end;
  13530.  
  13531. procedure TGPImageAttributes.SetGamma(const Gamma: Single;
  13532. const AdjustType: TGPColorAdjustType);
  13533. begin
  13534. GdipCheck(GdipSetImageAttributesGamma(FNativeHandle, AdjustType,
  13535. True, Gamma));
  13536. end;
  13537.  
  13538. procedure TGPImageAttributes.SetNoOp(const AdjustType: TGPColorAdjustType);
  13539. begin
  13540. GdipCheck(GdipSetImageAttributesNoOp(FNativeHandle, AdjustType, True));
  13541. end;
  13542.  
  13543. procedure TGPImageAttributes.SetOutputChannel(
  13544. const ChannelFlags: TGPColorChannelFlags; const AdjustType: TGPColorAdjustType);
  13545. begin
  13546. GdipCheck(GdipSetImageAttributesOutputChannel(FNativeHandle, AdjustType, True,
  13547. ChannelFlags));
  13548. end;
  13549.  
  13550. procedure TGPImageAttributes.SetOutputChannelColorProfile(
  13551. const ColorProfileFilename: String; const AdjustType: TGPColorAdjustType);
  13552. begin
  13553. GdipCheck(GdipSetImageAttributesOutputChannelColorProfile(FNativeHandle,
  13554. AdjustType, True, PWideChar(ColorProfileFilename)));
  13555. end;
  13556.  
  13557. procedure TGPImageAttributes.SetRemapTable(const Map: array of TGPColorMap;
  13558. const AdjustType: TGPColorAdjustType);
  13559. begin
  13560. Assert(Length(Map) > 0);
  13561. GdipCheck(GdipSetImageAttributesRemapTable(FNativeHandle, AdjustType, True,
  13562. Length(Map), @Map[0]));
  13563. end;
  13564.  
  13565. procedure TGPImageAttributes.SetThreshold(const Threshold: Single;
  13566. const AdjustType: TGPColorAdjustType);
  13567. begin
  13568. GdipCheck(GdipSetImageAttributesThreshold(FNativeHandle, AdjustType,
  13569. True, Threshold));
  13570. end;
  13571.  
  13572. procedure TGPImageAttributes.SetToIdentity(const AdjustType: TGPColorAdjustType);
  13573. begin
  13574. GdipCheck(GdipSetImageAttributesToIdentity(FNativeHandle, AdjustType));
  13575. end;
  13576.  
  13577. procedure TGPImageAttributes.SetWrapMode(const Wrap: TGPWrapMode;
  13578. const Color: TGPColor; const Clamp: Boolean);
  13579. begin
  13580. GdipCheck(GdipSetImageAttributesWrapMode(FNativeHandle, Wrap, Color.Value,
  13581. Clamp));
  13582. end;
  13583.  
  13584. procedure TGPImageAttributes.SetWrapMode(const Wrap: TGPWrapMode);
  13585. var
  13586. Color: TGPColor;
  13587. begin
  13588. Color := TGPColor.Black;
  13589. SetWrapMode(Wrap, Color);
  13590. end;
  13591.  
  13592. {$ENDREGION 'GdiplusImageAttributes.h'}
  13593.  
  13594. {$REGION 'GdiplusMatrix.h'}
  13595.  
  13596. { TGPMatrix }
  13597.  
  13598. function TGPMatrix.Clone: IGPMatrix;
  13599. var
  13600. NativeClone: GpMatrix;
  13601. begin
  13602. NativeClone := nil;
  13603. GdipCheck(GdipCloneMatrix(FNativeHandle, NativeClone));
  13604. Result := TGPMatrix.Create(NativeClone);
  13605. end;
  13606.  
  13607. constructor TGPMatrix.Create;
  13608. begin
  13609. inherited Create;
  13610. GdipCheck(GdipCreateMatrix(FNativeHandle));
  13611. end;
  13612.  
  13613. constructor TGPMatrix.Create(const NativeMatrix: GpMatrix);
  13614. begin
  13615. inherited Create;
  13616. FNativeHandle := NativeMatrix;
  13617. end;
  13618.  
  13619. constructor TGPMatrix.Create(const Rect: TGPRect; const DstPlg: TGPPlgPoints);
  13620. begin
  13621. inherited Create;
  13622. GdipCheck(GdipCreateMatrix3I(@Rect, @DstPlg, FNativeHandle));
  13623. end;
  13624.  
  13625. constructor TGPMatrix.Create(const Rect: TGPRectF; const DstPlg: TGPPlgPointsF);
  13626. begin
  13627. inherited Create;
  13628. GdipCheck(GdipCreateMatrix3(@Rect, @DstPlg, FNativeHandle));
  13629. end;
  13630.  
  13631. constructor TGPMatrix.Create(const M11, M12, M21, M22, DX, DY: Single);
  13632. begin
  13633. inherited Create;
  13634. GdipCheck(GdipCreateMatrix2(M11, M12, M21, M22, DX, DY, FNativeHandle));
  13635. end;
  13636.  
  13637. destructor TGPMatrix.Destroy;
  13638. begin
  13639. GdipDeleteMatrix(FNativeHandle);
  13640. inherited;
  13641. end;
  13642.  
  13643. function TGPMatrix.Equals(const Matrix: IGPMatrix): Boolean;
  13644. var
  13645. B: Bool;
  13646. begin
  13647. B := False;
  13648. GdipCheck(GdipIsMatrixEqual(FNativeHandle, Matrix.NativeHandle, B));
  13649. Result := B;
  13650. end;
  13651.  
  13652. function TGPMatrix.GetElements: TGPMatrixElements;
  13653. begin
  13654. GdipCheck(GdipGetMatrixElements(FNativeHandle, @Result.M[0]));
  13655. end;
  13656.  
  13657. function TGPMatrix.GetIsIdentity: Boolean;
  13658. var
  13659. B: Bool;
  13660. begin
  13661. B := False;
  13662. GdipCheck(GdipIsMatrixIdentity(FNativeHandle, B));
  13663. Result := B;
  13664. end;
  13665.  
  13666. function TGPMatrix.GetIsInvertible: Boolean;
  13667. var
  13668. B: Bool;
  13669. begin
  13670. B := False;
  13671. GdipCheck(GdipIsMatrixInvertible(FNativeHandle, B));
  13672. Result := B;
  13673. end;
  13674.  
  13675. function TGPMatrix.GetOffsetX: Single;
  13676. var
  13677. Elements: TGPMatrixElements;
  13678. begin
  13679. Elements := GetElements;
  13680. Result := Elements.DX;
  13681. end;
  13682.  
  13683. function TGPMatrix.GetOffsetY: Single;
  13684. var
  13685. Elements: TGPMatrixElements;
  13686. begin
  13687. Elements := GetElements;
  13688. Result := Elements.DY;
  13689. end;
  13690.  
  13691. procedure TGPMatrix.Invert;
  13692. begin
  13693. GdipCheck(GdipInvertMatrix(FNativeHandle));
  13694. end;
  13695.  
  13696. procedure TGPMatrix.Multiply(const Matrix: IGPMatrix; const Order: TGPMatrixOrder);
  13697. begin
  13698. GdipCheck(GdipMultiplyMatrix(FNativeHandle, Matrix.NativeHandle, Order));
  13699. end;
  13700.  
  13701. procedure TGPMatrix.Reset;
  13702. begin
  13703. GdipCheck(GdipSetMatrixElements(FNativeHandle, 1, 0, 0, 1, 0, 0));
  13704. end;
  13705.  
  13706. procedure TGPMatrix.Rotate(const Angle: Single; const Order: TGPMatrixOrder);
  13707. begin
  13708. GdipCheck(GdipRotateMatrix(FNativeHandle, Angle, Order));
  13709. end;
  13710.  
  13711. procedure TGPMatrix.RotateAt(const Angle: Single; const Center: TGPPointF;
  13712. const Order: TGPMatrixOrder);
  13713. begin
  13714. if (Order = MatrixOrderPrepend) then
  13715. begin
  13716. GdipCheck(GdipTranslateMatrix(FNativeHandle, Center.X, Center.Y, Order));
  13717. GdipCheck(GdipRotateMatrix(FNativeHandle, Angle, Order));
  13718. GdipCheck(GdipTranslateMatrix(FNativeHandle, -Center.X, -Center.Y, Order));
  13719. end
  13720. else
  13721. begin
  13722. GdipCheck(GdipTranslateMatrix(FNativeHandle, -Center.X, -Center.Y, Order));
  13723. GdipCheck(GdipRotateMatrix(FNativeHandle, Angle, Order));
  13724. GdipCheck(GdipTranslateMatrix(FNativeHandle, Center.X, Center.Y, Order));
  13725. end;
  13726. end;
  13727.  
  13728. procedure TGPMatrix.Scale(const ScaleX, ScaleY: Single;
  13729. const Order: TGPMatrixOrder);
  13730. begin
  13731. GdipCheck(GdipScaleMatrix(FNativeHandle, ScaleX, ScaleY, Order));
  13732. end;
  13733.  
  13734. procedure TGPMatrix.SetElements(const M11, M12, M21, M22, DX, DY: Single);
  13735. begin
  13736. GdipCheck(GdipSetMatrixElements(FNativeHandle, M11, M12, M21, M22, DX, DY));
  13737. end;
  13738.  
  13739. procedure TGPMatrix.SetElements(const Value: TGPMatrixElements);
  13740. begin
  13741. GdipCheck(GdipSetMatrixElements(FNativeHandle, Value.M11, Value.M12,
  13742. Value.M21, Value.M22, Value.DX, Value.DY));
  13743. end;
  13744.  
  13745. procedure TGPMatrix.Shear(const ShearX, ShearY: Single;
  13746. const Order: TGPMatrixOrder);
  13747. begin
  13748. GdipCheck(GdipShearMatrix(FNativeHandle, ShearX, ShearY, Order));
  13749. end;
  13750.  
  13751. procedure TGPMatrix.TransformPoint(var Point: TGPPointF);
  13752. begin
  13753. GdipCheck(GdipTransformMatrixPoints(FNativeHandle, @Point, 1));
  13754. end;
  13755.  
  13756. procedure TGPMatrix.TransformPoint(var Point: TGPPoint);
  13757. begin
  13758. GdipCheck(GdipTransformMatrixPointsI(FNativeHandle, @Point, 1));
  13759. end;
  13760.  
  13761. procedure TGPMatrix.TransformPoints(const Points: array of TGPPointF);
  13762. begin
  13763. Assert(Length(Points) > 0);
  13764. GdipCheck(GdipTransformMatrixPoints(FNativeHandle, @Points[0], Length(Points)));
  13765. end;
  13766.  
  13767. procedure TGPMatrix.TransformPoints(const Points: array of TGPPoint);
  13768. begin
  13769. Assert(Length(Points) > 0);
  13770. GdipCheck(GdipTransformMatrixPointsI(FNativeHandle, @Points[0], Length(Points)));
  13771. end;
  13772.  
  13773. procedure TGPMatrix.TransformVector(var Point: TGPPoint);
  13774. begin
  13775. GdipCheck(GdipVectorTransformMatrixPointsI(FNativeHandle, @Point, 1));
  13776. end;
  13777.  
  13778. procedure TGPMatrix.TransformVector(var Point: TGPPointF);
  13779. begin
  13780. GdipCheck(GdipVectorTransformMatrixPoints(FNativeHandle, @Point, 1));
  13781. end;
  13782.  
  13783. procedure TGPMatrix.TransformVectors(const Points: array of TGPPoint);
  13784. begin
  13785. Assert(Length(Points) > 0);
  13786. GdipCheck(GdipVectorTransformMatrixPointsI(FNativeHandle, @Points[0], Length(Points)));
  13787. end;
  13788.  
  13789. procedure TGPMatrix.TransformVectors(const Points: array of TGPPointF);
  13790. begin
  13791. Assert(Length(Points) > 0);
  13792. GdipCheck(GdipVectorTransformMatrixPoints(FNativeHandle, @Points[0], Length(Points)));
  13793. end;
  13794.  
  13795. procedure TGPMatrix.Translate(const OffsetX, OffsetY: Single;
  13796. const Order: TGPMatrixOrder);
  13797. begin
  13798. GdipCheck(GdipTranslateMatrix(FNativeHandle, OffsetX, OffsetY, Order));
  13799. end;
  13800. {$ENDREGION 'GdiplusMatrix.h'}
  13801.  
  13802. {$REGION 'GdiplusBrush.h'}
  13803.  
  13804. { TGPBrush }
  13805.  
  13806. function TGPBrush.Clone: IGPBrush;
  13807. var
  13808. NativeClone: GpBrush;
  13809. begin
  13810. GdipCheck(GdipCloneBrush(FNativeHandle, NativeClone));
  13811. Result := TGPBrush.Create(NativeClone);
  13812. end;
  13813.  
  13814. constructor TGPBrush.Create(const NativeBrush: GpBrush);
  13815. begin
  13816. inherited Create;
  13817. FNativeHandle := NativeBrush;
  13818. end;
  13819.  
  13820. constructor TGPBrush.Create;
  13821. begin
  13822. inherited Create;
  13823. end;
  13824.  
  13825. destructor TGPBrush.Destroy;
  13826. begin
  13827. GdipDeleteBrush(FNativeHandle);
  13828. inherited;
  13829. end;
  13830.  
  13831. function TGPBrush.GetType: TGPBrushType;
  13832. begin
  13833. Result := TGPBrushType(-1);
  13834. GdipCheck(GdipGetBrushType(FNativeHandle, Result));
  13835. end;
  13836.  
  13837. { TGPSolidBrush }
  13838.  
  13839. constructor TGPSolidBrush.Create(const Color: TGPColor);
  13840. begin
  13841. inherited Create;
  13842. GdipCheck(GdipCreateSolidFill(Color.Value, FNativeHandle));
  13843. end;
  13844.  
  13845. constructor TGPSolidBrush.Create;
  13846. begin
  13847. inherited Create;
  13848. end;
  13849.  
  13850. function TGPSolidBrush.GetColor: TGPColor;
  13851. begin
  13852. GdipCheck(GdipGetSolidFillColor(FNativeHandle, Result.FArgb));
  13853. end;
  13854.  
  13855. procedure TGPSolidBrush.SetColor(const Value: TGPColor);
  13856. begin
  13857. GdipCheck(GdipSetSolidFillColor(FNativeHandle, Value.FArgb));
  13858. end;
  13859.  
  13860. { TGPTextureBrush }
  13861.  
  13862. constructor TGPTextureBrush.Create(const Image: IGPImage; const WrapMode: TGPWrapMode;
  13863. const DstRect: TGPRect);
  13864. begin
  13865. inherited Create;
  13866. GdipCheck(GdipCreateTexture2I(Image.NativeHandle, WrapMode, DstRect.X,
  13867. DstRect.Y, DstRect.Width, DstRect.Height, FNativeHandle));
  13868. end;
  13869.  
  13870. constructor TGPTextureBrush.Create(const Image: IGPImage; const WrapMode: TGPWrapMode;
  13871. const DstRect: TGPRectF);
  13872. begin
  13873. inherited Create;
  13874. GdipCheck(GdipCreateTexture2(Image.NativeHandle, WrapMode, DstRect.X,
  13875. DstRect.Y, DstRect.Width, DstRect.Height, FNativeHandle));
  13876. end;
  13877.  
  13878. constructor TGPTextureBrush.Create(const Image: IGPImage;
  13879. const WrapMode: TGPWrapMode);
  13880. begin
  13881. inherited Create;
  13882. GdipCheck(GdipCreateTexture(Image.NativeHandle, WrapMode, FNativeHandle));
  13883. end;
  13884.  
  13885. constructor TGPTextureBrush.Create(const Image: IGPImage; const DstRect: TGPRectF;
  13886. const ImageAttributes: IGPImageAttributes);
  13887. begin
  13888. inherited Create;
  13889. GdipCheck(GdipCreateTextureIA(Image.NativeHandle, GdipHandle(ImageAttributes),
  13890. DstRect.X, DstRect.Y, DstRect.Width, DstRect.Height, FNativeHandle));
  13891. end;
  13892.  
  13893. constructor TGPTextureBrush.Create(const Image: IGPImage; const WrapMode: TGPWrapMode;
  13894. const DstX, DstY, DstWidth, DstHeight: Integer);
  13895. begin
  13896. inherited Create;
  13897. GdipCheck(GdipCreateTexture2I(Image.NativeHandle, WrapMode, DstX, DstY,
  13898. DstWidth, DstHeight, FNativeHandle));
  13899. end;
  13900.  
  13901. constructor TGPTextureBrush.Create;
  13902. begin
  13903. inherited Create;
  13904. end;
  13905.  
  13906. constructor TGPTextureBrush.Create(const Image: IGPImage; const WrapMode: TGPWrapMode;
  13907. const DstX, DstY, DstWidth, DstHeight: Single);
  13908. begin
  13909. inherited Create;
  13910. GdipCheck(GdipCreateTexture2(Image.NativeHandle, WrapMode, DstX, DstY,
  13911. DstWidth, DstHeight, FNativeHandle));
  13912. end;
  13913.  
  13914. constructor TGPTextureBrush.Create(const Image: IGPImage; const DstRect: TGPRect;
  13915. const ImageAttributes: IGPImageAttributes);
  13916. begin
  13917. inherited Create;
  13918. GdipCheck(GdipCreateTextureIAI(Image.NativeHandle, GdipHandle(ImageAttributes),
  13919. DstRect.X, DstRect.Y, DstRect.Width, DstRect.Height, FNativeHandle));
  13920. end;
  13921.  
  13922. function TGPTextureBrush.GetImage: IGPImage;
  13923. var
  13924. NativeImage: GpImage;
  13925. begin
  13926. GdipCheck(GdipGetTextureImage(FNativeHandle, NativeImage));
  13927. Result := TGPImage.Create(NativeImage);
  13928. end;
  13929.  
  13930. function TGPTextureBrush.GetTransform: IGPMatrix;
  13931. begin
  13932. Result := TGPMatrix.Create;
  13933. GdipCheck(GdipGetTextureTransform(FNativeHandle, Result.NativeHandle));
  13934. end;
  13935.  
  13936. function TGPTextureBrush.GetWrapMode: TGPWrapMode;
  13937. begin
  13938. GdipCheck(GdipGetTextureWrapMode(FNativeHandle, Result));
  13939. end;
  13940.  
  13941. procedure TGPTextureBrush.MultiplyTransform(const Matrix: IGPMatrix;
  13942. const Order: TGPMatrixOrder);
  13943. begin
  13944. GdipCheck(GdipMultiplyTextureTransform(FNativeHandle, Matrix.NativeHandle,
  13945. Order));
  13946. end;
  13947.  
  13948. procedure TGPTextureBrush.ResetTransform;
  13949. begin
  13950. GdipCheck(GdipResetTextureTransform(FNativeHandle));
  13951. end;
  13952.  
  13953. procedure TGPTextureBrush.RotateTransform(const Angle: Single;
  13954. const Order: TGPMatrixOrder);
  13955. begin
  13956. GdipCheck(GdipRotateTextureTransform(FNativeHandle, Angle, Order));
  13957. end;
  13958.  
  13959. procedure TGPTextureBrush.ScaleTransform(const SX, SY: Single;
  13960. const Order: TGPMatrixOrder);
  13961. begin
  13962. GdipCheck(GdipScaleTextureTransform(FNativeHandle, SX, SY, Order));
  13963. end;
  13964.  
  13965. procedure TGPTextureBrush.SetTransform(const Value: IGPMatrix);
  13966. begin
  13967. GdipCheck(GdipSetTextureTransform(FNativeHandle, Value.NativeHandle));
  13968. end;
  13969.  
  13970. procedure TGPTextureBrush.SetWrapMode(const Value: TGPWrapMode);
  13971. begin
  13972. GdipCheck(GdipSetTextureWrapMode(FNativeHandle, Value));
  13973. end;
  13974.  
  13975. procedure TGPTextureBrush.TranslateTransform(const DX, DY: Single;
  13976. const Order: TGPMatrixOrder);
  13977. begin
  13978. GdipCheck(GdipTranslateTextureTransform(FNativeHandle, DX, DY, Order));
  13979. end;
  13980.  
  13981. { TGPBlend }
  13982.  
  13983. constructor TGPBlend.Create(const ACount: Integer);
  13984. begin
  13985. inherited Create;
  13986. SetLength(FFactors, ACount);
  13987. SetLength(FPositions, ACount);
  13988. end;
  13989.  
  13990. constructor TGPBlend.Create(const AFactors, APositions: array of Single);
  13991. begin
  13992. Assert(Length(AFactors) > 0);
  13993. Assert(Length(APositions) = Length(AFactors));
  13994. Create(Length(AFactors));
  13995. Move(AFactors[0], FFactors[0], Length(AFactors) * SizeOf(Single));
  13996. Move(APositions[0], FPositions[0], Length(APositions) * SizeOf(Single));
  13997. end;
  13998.  
  13999. function TGPBlend.GetCount: Integer;
  14000. begin
  14001. Result := Length(FFactors);
  14002. end;
  14003.  
  14004. function TGPBlend.GetFactor(const Index: Integer): Single;
  14005. begin
  14006. Result := FFactors[Index];
  14007. end;
  14008.  
  14009. function TGPBlend.GetFactorPtr: PSingle;
  14010. begin
  14011. Result := @FFactors[0];
  14012. end;
  14013.  
  14014. function TGPBlend.GetPosition(const Index: Integer): Single;
  14015. begin
  14016. Result := FPositions[Index];
  14017. end;
  14018.  
  14019. function TGPBlend.GetPositionPtr: PSingle;
  14020. begin
  14021. Result := @FPositions[0];
  14022. end;
  14023.  
  14024. procedure TGPBlend.SetFactor(const Index: Integer; const Value: Single);
  14025. begin
  14026. FFactors[Index] := Value;
  14027. end;
  14028.  
  14029. procedure TGPBlend.SetPosition(const Index: Integer; const Value: Single);
  14030. begin
  14031. FPositions[Index] := Value;
  14032. end;
  14033.  
  14034. { TGPColorBlend }
  14035.  
  14036. constructor TGPColorBlend.Create(const ACount: Integer);
  14037. begin
  14038. inherited Create;
  14039. SetLength(FColors, ACount);
  14040. SetLength(FPositions, ACount);
  14041. end;
  14042.  
  14043. constructor TGPColorBlend.Create(const AColors: array of TGPColor;
  14044. const APositions: array of Single);
  14045. begin
  14046. Assert(Length(AColors) > 0);
  14047. Assert(Length(AColors) = Length(APositions));
  14048. Create(Length(AColors));
  14049. Move(AColors[0], FColors[0], Length(AColors) * SizeOf(TGPColor));
  14050. Move(APositions[0], FPositions[0], Length(APositions) * SizeOf(Single));
  14051. end;
  14052.  
  14053. function TGPColorBlend.GetColor(const Index: Integer): TGPColor;
  14054. begin
  14055. Result := FColors[Index];
  14056. end;
  14057.  
  14058. function TGPColorBlend.GetColorPtr: PGPColor;
  14059. begin
  14060. Result := @FColors[0];
  14061. end;
  14062.  
  14063. function TGPColorBlend.GetCount: Integer;
  14064. begin
  14065. Result := Length(FColors);
  14066. end;
  14067.  
  14068. function TGPColorBlend.GetPosition(const Index: Integer): Single;
  14069. begin
  14070. Result := FPositions[Index];
  14071. end;
  14072.  
  14073. function TGPColorBlend.GetPositionPtr: PSingle;
  14074. begin
  14075. Result := @FPositions[0];
  14076. end;
  14077.  
  14078. procedure TGPColorBlend.SetColor(const Index: Integer; const Value: TGPColor);
  14079. begin
  14080. FColors[Index] := Value;
  14081. end;
  14082.  
  14083. procedure TGPColorBlend.SetPosition(const Index: Integer; const Value: Single);
  14084. begin
  14085. FPositions[Index] := Value;
  14086. end;
  14087.  
  14088. { TGPLinearGradientBrush }
  14089.  
  14090. constructor TGPLinearGradientBrush.Create(const Rect: TGPRectF; const Color1,
  14091. Color2: TGPColor; const Mode: TGPLinearGradientMode);
  14092. begin
  14093. inherited Create;
  14094. GdipCheck(GdipCreateLineBrushFromRect(@Rect, Color1.Value, Color2.Value,
  14095. Mode, WrapModeTile, FNativeHandle));
  14096. end;
  14097.  
  14098. constructor TGPLinearGradientBrush.Create(const Rect: TGPRect; const Color1,
  14099. Color2: TGPColor; const Mode: TGPLinearGradientMode);
  14100. begin
  14101. inherited Create;
  14102. GdipCheck(GdipCreateLineBrushFromRectI(@Rect, Color1.Value, Color2.Value,
  14103. Mode, WrapModeTile, FNativeHandle));
  14104. end;
  14105.  
  14106. constructor TGPLinearGradientBrush.Create(const Point1, Point2: TGPPointF;
  14107. const Color1, Color2: TGPColor);
  14108. begin
  14109. inherited Create;
  14110. GdipCheck(GdipCreateLineBrush(@Point1, @Point2, Color1.Value, Color2.Value,
  14111. WrapModeTile, FNativeHandle));
  14112. end;
  14113.  
  14114. constructor TGPLinearGradientBrush.Create(const Point1, Point2: TGPPoint;
  14115. const Color1, Color2: TGPColor);
  14116. begin
  14117. inherited Create;
  14118. GdipCheck(GdipCreateLineBrushI(@Point1, @Point2, Color1.Value, Color2.Value,
  14119. WrapModeTile, FNativeHandle));
  14120. end;
  14121.  
  14122. constructor TGPLinearGradientBrush.Create(const Rect: TGPRectF; const Color1,
  14123. Color2: TGPColor; const Angle: Single; const IsAngleScalable: Boolean);
  14124. begin
  14125. inherited Create;
  14126. GdipCheck(GdipCreateLineBrushFromRectWithAngle(@Rect, Color1.Value, Color2.Value,
  14127. Angle, IsAngleScalable, WrapModeTile, FNativeHandle));
  14128. end;
  14129.  
  14130. constructor TGPLinearGradientBrush.Create(const Rect: TGPRect; const Color1,
  14131. Color2: TGPColor; const Angle: Single; const IsAngleScalable: Boolean);
  14132. begin
  14133. inherited Create;
  14134. GdipCheck(GdipCreateLineBrushFromRectWithAngleI(@Rect, Color1.Value, Color2.Value,
  14135. Angle, IsAngleScalable, WrapModeTile, FNativeHandle));
  14136. end;
  14137.  
  14138. constructor TGPLinearGradientBrush.Create;
  14139. begin
  14140. inherited Create;
  14141. end;
  14142.  
  14143. function TGPLinearGradientBrush.GetBlend: IGPBlend;
  14144. var
  14145. Count: Integer;
  14146. begin
  14147. Count := 0;
  14148. GdipCheck(GdipGetLineBlendCount(FNativeHandle, Count));
  14149. Result := TGPBlend.Create(Count);
  14150. if (Count > 0) then
  14151. GdipCheck(GdipGetLineBlend(FNativeHandle, Result.FactorPtr,
  14152. Result.PositionPtr, Count));
  14153. end;
  14154.  
  14155. function TGPLinearGradientBrush.GetGammaCorrection: Boolean;
  14156. var
  14157. B: Bool;
  14158. begin
  14159. GdipCheck(GdipGetLineGammaCorrection(FNativeHandle, B));
  14160. Result := B;
  14161. end;
  14162.  
  14163. function TGPLinearGradientBrush.GetInterpolationColors: IGPColorBlend;
  14164. var
  14165. Count: Integer;
  14166. begin
  14167. Count := 0;
  14168. GdipCheck(GdipGetLinePresetBlendCount(FNativeHandle, Count));
  14169. Result := TGPColorBlend.Create(Count);
  14170. if (Count > 0) then
  14171. GdipCheck(GdipGetLinePresetBlend(FNativeHandle, PARGB(Result.ColorPtr),
  14172. Result.PositionPtr, Count));
  14173. end;
  14174.  
  14175. function TGPLinearGradientBrush.GetLinearColors: TGPLinearColors;
  14176. begin
  14177. GdipCheck(GdipGetLineColors(FNativeHandle, @Result[0]));
  14178. end;
  14179.  
  14180. procedure TGPLinearGradientBrush.GetRectangle(out Rect: TGPRectF);
  14181. begin
  14182. GdipCheck(GdipGetLineRect(FNativeHandle, Rect));
  14183. end;
  14184.  
  14185. function TGPLinearGradientBrush.GetRectangle: TGPRectF;
  14186. begin
  14187. GdipCheck(GdipGetLineRect(FNativeHandle, Result));
  14188. end;
  14189.  
  14190. procedure TGPLinearGradientBrush.GetRectangle(out Rect: TGPRect);
  14191. begin
  14192. GdipCheck(GdipGetLineRectI(FNativeHandle, Rect));
  14193. end;
  14194.  
  14195. function TGPLinearGradientBrush.GetTransform: IGPMatrix;
  14196. begin
  14197. Result := TGPMatrix.Create;
  14198. GdipCheck(GdipGetLineTransform(FNativeHandle, Result.NativeHandle));
  14199. end;
  14200.  
  14201. function TGPLinearGradientBrush.GetWrapMode: TGPWrapMode;
  14202. begin
  14203. GdipCheck(GdipGetLineWrapMode(FNativeHandle, Result));
  14204. end;
  14205.  
  14206. procedure TGPLinearGradientBrush.MultiplyTransform(const Matrix: IGPMatrix;
  14207. const Order: TGPMatrixOrder);
  14208. begin
  14209. GdipCheck(GdipMultiplyLineTransform(FNativeHandle, Matrix.NativeHandle, Order));
  14210. end;
  14211.  
  14212. procedure TGPLinearGradientBrush.ResetTransform;
  14213. begin
  14214. GdipCheck(GdipResetLineTransform(FNativeHandle));
  14215. end;
  14216.  
  14217. procedure TGPLinearGradientBrush.RotateTransform(const Angle: Single;
  14218. const Order: TGPMatrixOrder);
  14219. begin
  14220. GdipCheck(GdipRotateLineTransform(FNativeHandle, Angle, Order));
  14221. end;
  14222.  
  14223. procedure TGPLinearGradientBrush.ScaleTransform(const SX, SY: Single;
  14224. const Order: TGPMatrixOrder);
  14225. begin
  14226. GdipCheck(GdipScaleLineTransform(FNativeHandle, SX, SY, Order));
  14227. end;
  14228.  
  14229. procedure TGPLinearGradientBrush.SetBlend(const Value: IGPBlend);
  14230. begin
  14231. Assert(Assigned(Value));
  14232. GdipCheck(GdipSetLineBlend(FNativeHandle, Value.FactorPtr,
  14233. Value.PositionPtr, Value.Count));
  14234. end;
  14235.  
  14236. procedure TGPLinearGradientBrush.SetBlendBellShape(const Focus, Scale: Single);
  14237. begin
  14238. GdipCheck(GdipSetLineSigmaBlend(FNativeHandle, Focus, Scale));
  14239. end;
  14240.  
  14241. procedure TGPLinearGradientBrush.SetBlendTriangularShape(const Focus,
  14242. Scale: Single);
  14243. begin
  14244. GdipCheck(GdipSetLineLinearBlend(FNativeHandle, Focus, Scale));
  14245. end;
  14246.  
  14247. procedure TGPLinearGradientBrush.SetGammaCorrection(const Value: Boolean);
  14248. begin
  14249. GdipCheck(GdipSetLineGammaCorrection(FNativeHandle, Value));
  14250. end;
  14251.  
  14252. procedure TGPLinearGradientBrush.SetInterpolationColors(const Value: IGPColorBlend);
  14253. begin
  14254. Assert(Assigned(Value));
  14255. GdipCheck(GdipSetLinePresetBlend(FNativeHandle, PARGB(Value.ColorPtr),
  14256. Value.PositionPtr, Value.Count));
  14257. end;
  14258.  
  14259. procedure TGPLinearGradientBrush.SetLinearColors(const Value: TGPLinearColors);
  14260. begin
  14261. GdipCheck(GdipSetLineColors(FNativeHandle, Value[0].Value, Value[1].Value));
  14262. end;
  14263.  
  14264. procedure TGPLinearGradientBrush.SetTransform(const Value: IGPMatrix);
  14265. begin
  14266. GdipCheck(GdipSetLineTransform(FNativeHandle, Value.NativeHandle));
  14267. end;
  14268.  
  14269. procedure TGPLinearGradientBrush.SetWrapMode(const Value: TGPWrapMode);
  14270. begin
  14271. GdipCheck(GdipSetLineWrapMode(FNativeHandle, Value));
  14272. end;
  14273.  
  14274. procedure TGPLinearGradientBrush.TranslateTransform(const DX, DY: Single;
  14275. const Order: TGPMatrixOrder);
  14276. begin
  14277. GdipCheck(GdipTranslateLineTransform(FNativeHandle, DX, DY, Order));
  14278. end;
  14279.  
  14280. { TGPHatchBrush }
  14281.  
  14282. constructor TGPHatchBrush.Create(const HatchStyle: TGPHatchStyle; const ForeColor,
  14283. BackColor: TGPColor);
  14284. begin
  14285. inherited Create;
  14286. GdipCheck(GdipCreateHatchBrush(HatchStyle, ForeColor.Value, BackColor.Value,
  14287. FNativeHandle));
  14288. end;
  14289.  
  14290. constructor TGPHatchBrush.Create(const HatchStyle: TGPHatchStyle;
  14291. const ForeColor: TGPColor);
  14292. begin
  14293. inherited Create;
  14294. GdipCheck(GdipCreateHatchBrush(HatchStyle, ForeColor.Value, TGPColor.Black,
  14295. FNativeHandle));
  14296. end;
  14297.  
  14298. constructor TGPHatchBrush.Create;
  14299. begin
  14300. inherited Create;
  14301. end;
  14302.  
  14303. function TGPHatchBrush.GetBackgroundColor: TGPColor;
  14304. begin
  14305. GdipCheck(GdipGetHatchBackgroundColor(FNativeHandle, Result.FArgb));
  14306. end;
  14307.  
  14308. function TGPHatchBrush.GetForegroundColor: TGPColor;
  14309. begin
  14310. GdipCheck(GdipGetHatchForegroundColor(FNativeHandle, Result.FArgb));
  14311. end;
  14312.  
  14313. function TGPHatchBrush.GetHatchStyle: TGPHatchStyle;
  14314. begin
  14315. GdipCheck(GdipGetHatchStyle(FNativeHandle, Result));
  14316. end;
  14317. {$ENDREGION 'GdiplusBrush.h'}
  14318.  
  14319. {$REGION 'GdiplusPen.h'}
  14320.  
  14321. { TGPPen }
  14322.  
  14323. function TGPPen.Clone: IGPPen;
  14324. var
  14325. NativeClone: GpPen;
  14326. begin
  14327. GdipCheck(GdipClonePen(FNativeHandle, NativeClone));
  14328. Result := TGPPen.Create(FNativeHandle);
  14329. end;
  14330.  
  14331. constructor TGPPen.Create(const Brush: IGPBrush; const Width: Single);
  14332. begin
  14333. inherited Create;
  14334. GdipCheck(GdipCreatePen2(Brush.NativeHandle, Width, UnitWorld, FNativeHandle));
  14335. end;
  14336.  
  14337. constructor TGPPen.Create(const Color: TGPColor; const Width: Single);
  14338. begin
  14339. inherited Create;
  14340. GdipCheck(GdipCreatePen1(Color.Value, Width, UnitWorld, FNativeHandle));
  14341. end;
  14342.  
  14343. constructor TGPPen.Create(const NativePen: GpPen);
  14344. begin
  14345. inherited Create;
  14346. FNativeHandle := NativePen;
  14347. end;
  14348.  
  14349. destructor TGPPen.Destroy;
  14350. begin
  14351. GdipDeletePen(FNativeHandle);
  14352. inherited;
  14353. end;
  14354.  
  14355. function TGPPen.GetAlignment: TGPPenAlignment;
  14356. begin
  14357. GdipCheck(GdipGetPenMode(FNativeHandle, Result));
  14358. end;
  14359.  
  14360. function TGPPen.GetBrush: IGPBrush;
  14361. var
  14362. PenType: TGPPenType;
  14363. NativeBrush: GpBrush;
  14364. begin
  14365. Result := nil;
  14366. GdipCheck(GdipGetPenFillType(FNativeHandle, PenType));
  14367. case PenType of
  14368. PenTypeSolidColor:
  14369. Result := TGPSolidBrush.Create;
  14370.  
  14371. PenTypeHatchFill:
  14372. Result := TGPHatchBrush.Create;
  14373.  
  14374. PenTypeTextureFill:
  14375. Result := TGPTextureBrush.Create;
  14376.  
  14377. PenTypePathGradient:
  14378. Result := TGPBrush.Create;
  14379.  
  14380. PenTypeLinearGradient:
  14381. Result := TGPLinearGradientBrush.Create;
  14382. end;
  14383.  
  14384. if Assigned(Result) then
  14385. begin
  14386. NativeBrush := nil;
  14387. GdipCheck(GdipGetPenBrushFill(FNativeHandle, NativeBrush));
  14388. Result.NativeHandle := NativeBrush;
  14389. end;
  14390. end;
  14391.  
  14392. function TGPPen.GetColor: TGPColor;
  14393. var
  14394. PenType: TGPPenType;
  14395. begin
  14396. GdipCheck(GdipGetPenFillType(FNativeHandle, PenType));
  14397. if (PenType <> PenTypeSolidColor) then
  14398. GdipCheck(WrongState);
  14399. GdipCheck(GdipGetPenColor(FNativeHandle, Result.FArgb));
  14400. end;
  14401.  
  14402. function TGPPen.GetCompoundArray: IGPCompoundArray;
  14403. var
  14404. Count: Integer;
  14405. begin
  14406. Count := 0;
  14407. GdipCheck(GdipGetPenCompoundCount(FNativeHandle, Count));
  14408. Result := TGPArray<Single>.Create(Count);
  14409. if (Count > 0) then
  14410. GdipCheck(GdipGetPenCompoundArray(FNativeHandle, Result.ItemPtr, Count));
  14411. end;
  14412.  
  14413. function TGPPen.GetCustomEndCap: IGPCustomLineCap;
  14414. var
  14415. NativeCap: GpCustomLineCap;
  14416. begin
  14417. NativeCap := nil;
  14418. GdipCheck(GdipGetPenCustomEndCap(FNativeHandle, NativeCap));
  14419. Result := TGPCustomLineCap.Create(NativeCap);
  14420. end;
  14421.  
  14422. function TGPPen.GetCustomStartCap: IGPCustomLineCap;
  14423. var
  14424. NativeCap: GpCustomLineCap;
  14425. begin
  14426. NativeCap := nil;
  14427. GdipCheck(GdipGetPenCustomStartCap(FNativeHandle, NativeCap));
  14428. Result := TGPCustomLineCap.Create(NativeCap);
  14429. end;
  14430.  
  14431. function TGPPen.GetDashCap: TGPDashCap;
  14432. begin
  14433. GdipCheck(GdipGetPenDashCap197819(FNativeHandle, Result));
  14434. end;
  14435.  
  14436. function TGPPen.GetDashOffset: Single;
  14437. begin
  14438. GdipCheck(GdipGetPenDashOffset(FNativeHandle, Result));
  14439. end;
  14440.  
  14441. function TGPPen.GetDashPattern: IGPDashPattern;
  14442. var
  14443. Count: Integer;
  14444. begin
  14445. Count := 0;
  14446. GdipCheck(GdipGetPenDashCount(FNativeHandle, Count));
  14447. Result := TGPArray<Single>.Create(Count);
  14448. if (Count > 0) then
  14449. GdipCheck(GdipGetPenDashArray(FNativeHandle, Result.ItemPtr, Count));
  14450. end;
  14451.  
  14452. function TGPPen.GetDashStyle: TGPDashStyle;
  14453. begin
  14454. GdipCheck(GdipGetPenDashStyle(FNativeHandle, Result));
  14455. end;
  14456.  
  14457. function TGPPen.GetEndCap: TGPLineCap;
  14458. begin
  14459. GdipCheck(GdipGetPenEndCap(FNativeHandle, Result));
  14460. end;
  14461.  
  14462. function TGPPen.GetLineJoin: TGPLineJoin;
  14463. begin
  14464. GdipCheck(GdipGetPenLineJoin(FNativeHandle, Result));
  14465. end;
  14466.  
  14467. function TGPPen.GetMiterLimit: Single;
  14468. begin
  14469. GdipCheck(GdipGetPenMiterLimit(FNativeHandle, Result));
  14470. end;
  14471.  
  14472. function TGPPen.GetPenType: TGPPenType;
  14473. begin
  14474. GdipCheck(GdipGetPenFillType(FNativeHandle, Result));
  14475. end;
  14476.  
  14477. function TGPPen.GetStartCap: TGPLineCap;
  14478. begin
  14479. GdipCheck(GdipGetPenStartCap(FNativeHandle, Result));
  14480. end;
  14481.  
  14482. function TGPPen.GetTransform: IGPMatrix;
  14483. begin
  14484. Result := TGPMatrix.Create;
  14485. GdipCheck(GdipGetPenTransform(FNativeHandle, Result.NativeHandle));
  14486. end;
  14487.  
  14488. function TGPPen.GetWidth: Single;
  14489. begin
  14490. GdipCheck(GdipGetPenWidth(FNativeHandle, Result));
  14491. end;
  14492.  
  14493. procedure TGPPen.MultiplyTransform(const Matrix: IGPMatrix;
  14494. const Order: TGPMatrixOrder);
  14495. begin
  14496. GdipCheck(GdipMultiplyPenTransform(FNativeHandle, Matrix.NativeHandle, Order));
  14497. end;
  14498.  
  14499. procedure TGPPen.ResetTransform;
  14500. begin
  14501. GdipCheck(GdipResetPenTransform(FNativeHandle));
  14502. end;
  14503.  
  14504. procedure TGPPen.RotateTransform(const Angle: Single; const Order: TGPMatrixOrder);
  14505. begin
  14506. GdipCheck(GdipRotatePenTransform(FNativeHandle, Angle, Order));
  14507. end;
  14508.  
  14509. procedure TGPPen.ScaleTransform(const SX, SY: Single; const Order: TGPMatrixOrder);
  14510. begin
  14511. GdipCheck(GdipScalePenTransform(FNativeHandle, SX, SY, Order));
  14512. end;
  14513.  
  14514. procedure TGPPen.SetAlignment(const Value: TGPPenAlignment);
  14515. begin
  14516. GdipCheck(GdipSetPenMode(FNativeHandle, Value));
  14517. end;
  14518.  
  14519. procedure TGPPen.SetBrush(const Value: IGPBrush);
  14520. begin
  14521. GdipCheck(GdipSetPenBrushFill(FNativeHandle, Value.NativeHandle));
  14522. end;
  14523.  
  14524. procedure TGPPen.SetColor(const Value: TGPColor);
  14525. begin
  14526. GdipCheck(GdipSetPenColor(FNativeHandle, Value.FArgb));
  14527. end;
  14528.  
  14529. procedure TGPPen.SetCompoundArray(const Value: IGPCompoundArray);
  14530. begin
  14531. Assert(Assigned(Value));
  14532. GdipCheck(GdipSetPenCompoundArray(FNativeHandle, Value.ItemPtr, Value.Count));
  14533. end;
  14534.  
  14535. procedure TGPPen.SetCustomEndCap(const Value: IGPCustomLineCap);
  14536. begin
  14537. GdipCheck(GdipSetPenCustomEndCap(FNativeHandle, GdipHandle(Value)));
  14538. end;
  14539.  
  14540. procedure TGPPen.SetCustomStartCap(const Value: IGPCustomLineCap);
  14541. begin
  14542. GdipCheck(GdipSetPenCustomStartCap(FNativeHandle, GdipHandle(Value)));
  14543. end;
  14544.  
  14545. procedure TGPPen.SetDashCap(const Value: TGPDashCap);
  14546. begin
  14547. GdipCheck(GdipSetPenDashCap197819(FNativeHandle, Value));
  14548. end;
  14549.  
  14550. procedure TGPPen.SetDashOffset(const Value: Single);
  14551. begin
  14552. GdipCheck(GdipSetPenDashOffset(FNativeHandle, Value));
  14553. end;
  14554.  
  14555. procedure TGPPen.SetDashPattern(const Pattern: array of Single);
  14556. begin
  14557. Assert(Length(Pattern) > 0);
  14558. GdipCheck(GdipSetPenDashArray(FNativeHandle, @Pattern[0], Length(Pattern)));
  14559. end;
  14560.  
  14561. procedure TGPPen.SetDashPatternInternal(const Value: IGPDashPattern);
  14562. begin
  14563. Assert(Assigned(Value));
  14564. GdipCheck(GdipSetPenDashArray(FNativeHandle, Value.ItemPtr, Value.Count));
  14565. end;
  14566.  
  14567. procedure TGPPen.SetDashStyle(const Value: TGPDashStyle);
  14568. begin
  14569. GdipCheck(GdipSetPenDashStyle(FNativeHandle, Value));
  14570. end;
  14571.  
  14572. procedure TGPPen.SetEndCap(const Value: TGPLineCap);
  14573. begin
  14574. GdipCheck(GdipSetPenEndCap(FNativeHandle, Value));
  14575. end;
  14576.  
  14577. procedure TGPPen.SetLineCap(const StartCap, EndCap: TGPLineCap;
  14578. const DashCap: TGPDashCap);
  14579. begin
  14580. GdipCheck(GdipSetPenLineCap197819(FNativeHandle, StartCap, EndCap, DashCap));
  14581. end;
  14582.  
  14583. procedure TGPPen.SetLineJoin(const Value: TGPLineJoin);
  14584. begin
  14585. GdipCheck(GdipSetPenLineJoin(FNativeHandle, Value));
  14586. end;
  14587.  
  14588. procedure TGPPen.SetMiterLimit(const Value: Single);
  14589. begin
  14590. GdipCheck(GdipSetPenMiterLimit(FNativeHandle, Value));
  14591. end;
  14592.  
  14593. procedure TGPPen.SetStartCap(const Value: TGPLineCap);
  14594. begin
  14595. GdipCheck(GdipSetPenStartCap(FNativeHandle, Value));
  14596. end;
  14597.  
  14598. procedure TGPPen.SetTransform(const Value: IGPMatrix);
  14599. begin
  14600. GdipCheck(GdipSetPenTransform(FNativeHandle, Value.NativeHandle));
  14601. end;
  14602.  
  14603. procedure TGPPen.SetWidth(const Value: Single);
  14604. begin
  14605. GdipCheck(GdipSetPenWidth(FNativeHandle, Value));
  14606. end;
  14607.  
  14608. procedure TGPPen.TranslateTransform(const DX, DY: Single;
  14609. const Order: TGPMatrixOrder);
  14610. begin
  14611. GdipCheck(GdipTranslatePenTransform(FNativeHandle, DX, DY, Order));
  14612. end;
  14613. {$ENDREGION 'GdiplusPen.h'}
  14614.  
  14615. {$REGION 'GdiplusStringFormat.h'}
  14616.  
  14617. { TGPStringFormat }
  14618.  
  14619. function TGPStringFormat.Clone: IGPStringFormat;
  14620. var
  14621. NativeClone: GpStringFormat;
  14622. begin
  14623. NativeClone := nil;
  14624. GdipCheck(GdipCloneStringFormat(FNativeHandle, NativeClone));
  14625. Result := TGPStringFormat.Create(NativeClone);
  14626. end;
  14627.  
  14628. constructor TGPStringFormat.Create(const NativeFormat: GpStringFormat);
  14629. begin
  14630. inherited Create;
  14631. FNativeHandle := NativeFormat;
  14632. end;
  14633.  
  14634. constructor TGPStringFormat.Create(const FormatFlags: TGPStringFormatFlags;
  14635. const Language: LangID);
  14636. begin
  14637. inherited Create;
  14638. GdipCheck(GdipCreateStringFormat(FormatFlags, Language, FNativeHandle));
  14639. end;
  14640.  
  14641. constructor TGPStringFormat.Create(const Format: IGPStringFormat);
  14642. begin
  14643. inherited Create;
  14644. GdipCheck(GdipCloneStringFormat(GdipHandle(Format), FNativeHandle));
  14645. end;
  14646.  
  14647. destructor TGPStringFormat.Destroy;
  14648. begin
  14649. GdipDeleteStringFormat(FNativeHandle);
  14650. inherited;
  14651. end;
  14652.  
  14653. class function TGPStringFormat.GenericDefault: IGPStringFormat;
  14654. var
  14655. NativeDefault: GpStringFormat;
  14656. begin
  14657. if (FGenericDefault = nil) then
  14658. begin
  14659. NativeDefault := nil;
  14660. GdipCheck(GdipStringFormatGetGenericDefault(NativeDefault));
  14661. FGenericDefault := TGPStringFormat.Create(NativeDefault);
  14662. end;
  14663. Result := FGenericDefault;
  14664. end;
  14665.  
  14666. class function TGPStringFormat.GenericTypographic: IGPStringFormat;
  14667. var
  14668. NativeDefault: GpStringFormat;
  14669. begin
  14670. if (FGenericTypographic = nil) then
  14671. begin
  14672. NativeDefault := nil;
  14673. GdipCheck(GdipStringFormatGetGenericTypographic(NativeDefault));
  14674. FGenericTypographic := TGPStringFormat.Create(NativeDefault);
  14675. end;
  14676. Result := FGenericTypographic;
  14677. end;
  14678.  
  14679. function TGPStringFormat.GetAlignment: TGPStringAlignment;
  14680. begin
  14681. GdipCheck(GdipGetStringFormatAlign(FNativeHandle, Result));
  14682. end;
  14683.  
  14684. function TGPStringFormat.GetDigitSubstitutionLanguage: LangID;
  14685. begin
  14686. GdipCheck(GdipGetStringFormatDigitSubstitution(FNativeHandle, @Result, nil));
  14687. end;
  14688.  
  14689. function TGPStringFormat.GetDigitSubstitutionMethod: TGPStringDigitSubstitute;
  14690. begin
  14691. GdipCheck(GdipGetStringFormatDigitSubstitution(FNativeHandle, nil, @Result));
  14692. end;
  14693.  
  14694. function TGPStringFormat.GetFormatFlags: TGPStringFormatFlags;
  14695. begin
  14696. GdipCheck(GdipGetStringFormatFlags(FNativeHandle, Result));
  14697. end;
  14698.  
  14699. function TGPStringFormat.GetHotkeyPrefix: TGPHotkeyPrefix;
  14700. begin
  14701. GdipCheck(GdipGetStringFormatHotkeyPrefix(FNativeHandle, Result));
  14702. end;
  14703.  
  14704. function TGPStringFormat.GetLineAlignment: TGPStringAlignment;
  14705. begin
  14706. GdipCheck(GdipGetStringFormatLineAlign(FNativeHandle, Result));
  14707. end;
  14708.  
  14709. function TGPStringFormat.GetMeasurableCharacterRangeCount: Integer;
  14710. begin
  14711. GdipCheck(GdipGetStringFormatMeasurableCharacterRangeCount(FNativeHandle,
  14712. Result));
  14713. end;
  14714.  
  14715. function TGPStringFormat.GetTabStops(out FirstTabOffset: Single): IGPTabStops;
  14716. var
  14717. Count: Integer;
  14718. begin
  14719. GdipCheck(GdipGetStringFormatTabStopCount(FNativeHandle, Count));
  14720. Result := TGPArray<Single>.Create(Count);
  14721. if (Count > 0) then
  14722. GdipCheck(GdipGetStringFormatTabStops(FNativeHandle, Count, FirstTabOffset,
  14723. Result.ItemPtr));
  14724. end;
  14725.  
  14726. function TGPStringFormat.GetTrimming: TGPStringTrimming;
  14727. begin
  14728. GdipCheck(GdipGetStringFormatTrimming(FNativeHandle, Result));
  14729. end;
  14730.  
  14731. procedure TGPStringFormat.SetAlignment(const Value: TGPStringAlignment);
  14732. begin
  14733. GdipCheck(GdipSetStringFormatAlign(FNativeHandle, Value));
  14734. end;
  14735.  
  14736. procedure TGPStringFormat.SetDigitSubstitution(const Language: LangID;
  14737. const Substitute: TGPStringDigitSubstitute);
  14738. begin
  14739. GdipCheck(GdipSetStringFormatDigitSubstitution(FNativeHandle, Language, Substitute));
  14740. end;
  14741.  
  14742. procedure TGPStringFormat.SetFormatFlags(const Value: TGPStringFormatFlags);
  14743. begin
  14744. GdipCheck(GdipSetStringFormatFlags(FNativeHandle, Value));
  14745. end;
  14746.  
  14747. procedure TGPStringFormat.SetHotkeyPrefix(const Value: TGPHotkeyPrefix);
  14748. begin
  14749. GdipCheck(GdipSetStringFormatHotkeyPrefix(FNativeHandle, Value));
  14750. end;
  14751.  
  14752. procedure TGPStringFormat.SetLineAlignment(const Value: TGPStringAlignment);
  14753. begin
  14754. GdipCheck(GdipSetStringFormatLineAlign(FNativeHandle, Value));
  14755. end;
  14756.  
  14757. procedure TGPStringFormat.SetMeasurableCharacterRanges(
  14758. const Ranges: IGPCharacterRanges);
  14759. begin
  14760. Assert(Assigned(Ranges));
  14761. GdipCheck(GdipSetStringFormatMeasurableCharacterRanges(FNativeHandle,
  14762. Ranges.Count, Ranges.ItemPtr));
  14763. end;
  14764.  
  14765. procedure TGPStringFormat.SetTabStops(const FirstTabOffset: Single;
  14766. const TabStops: array of Single);
  14767. begin
  14768. Assert(Length(TabStops) > 0);
  14769. GdipCheck(GdipSetStringFormatTabStops(FNativeHandle, FirstTabOffset,
  14770. Length(TabStops), @TabStops[0]));
  14771. end;
  14772.  
  14773. procedure TGPStringFormat.SetTrimming(const Value: TGPStringTrimming);
  14774. begin
  14775. GdipCheck(GdipSetStringFormatTrimming(FNativeHandle, Value));
  14776. end;
  14777. {$ENDREGION 'GdiplusStringFormat.h'}
  14778.  
  14779. {$REGION 'GdiplusPath.h'}
  14780.  
  14781. { TGPPathData }
  14782.  
  14783. constructor TGPPathData.Create(const ACount: Integer);
  14784. begin
  14785. inherited Create;
  14786. SetLength(FPoints, ACount);
  14787. SetLength(FTypes, ACount);
  14788. end;
  14789.  
  14790. function TGPPathData.GetCount: Integer;
  14791. begin
  14792. Result := Length(FPoints);
  14793. end;
  14794.  
  14795. function TGPPathData.GetNativePathData: TGPNativePathData;
  14796. begin
  14797. Result.Count := Length(FPoints);
  14798. Result.Points := @FPoints[0];
  14799. Result.Types := @FTypes[0];
  14800. end;
  14801.  
  14802. function TGPPathData.GetPoint(const Index: Integer): TGPPointF;
  14803. begin
  14804. Result := FPoints[Index];
  14805. end;
  14806.  
  14807. function TGPPathData.GetPointPtr: PGPPointF;
  14808. begin
  14809. Result := @FPoints[0];
  14810. end;
  14811.  
  14812. function TGPPathData.GetType(const Index: Integer): Byte;
  14813. begin
  14814. Result := FTypes[Index];
  14815. end;
  14816.  
  14817. function TGPPathData.GetTypePtr: PByte;
  14818. begin
  14819. Result := @FTypes[0];
  14820. end;
  14821.  
  14822. procedure TGPPathData.SetCount(const Value: Integer);
  14823. begin
  14824. if (Value <> Length(FPoints)) then
  14825. begin
  14826. SetLength(FPoints, Value);
  14827. SetLength(FTypes, Value);
  14828. end;
  14829. end;
  14830.  
  14831. { TGPGraphicsPath }
  14832.  
  14833. procedure TGPGraphicsPath.AddArc(const Rect: TGPRectF; const StartAngle,
  14834. SweepAngle: Single);
  14835. begin
  14836. AddArc(Rect.X, Rect.Y, Rect.Width, Rect.Height, StartAngle, SweepAngle);
  14837. end;
  14838.  
  14839. procedure TGPGraphicsPath.AddArc(const X, Y, Width, Height: Integer;
  14840. const StartAngle, SweepAngle: Single);
  14841. begin
  14842. GdipCheck(GdipAddPathArcI(FNativeHandle, X, Y, Width, Height, StartAngle, SweepAngle));
  14843. end;
  14844.  
  14845. procedure TGPGraphicsPath.AddArc(const Rect: TGPRect; const StartAngle,
  14846. SweepAngle: Single);
  14847. begin
  14848. AddArc(Rect.X, Rect.Y, Rect.Width, Rect.Height, StartAngle, SweepAngle);
  14849. end;
  14850.  
  14851. procedure TGPGraphicsPath.AddArc(const X, Y, Width, Height, StartAngle,
  14852. SweepAngle: Single);
  14853. begin
  14854. GdipCheck(GdipAddPathArc(FNativeHandle, X, Y, Width, Height, StartAngle, SweepAngle));
  14855. end;
  14856.  
  14857. procedure TGPGraphicsPath.AddBezier(const Pt1, Pt2, Pt3, Pt4: TGPPoint);
  14858. begin
  14859. AddBezier(Pt1.X, Pt1.Y, Pt2.X, Pt2.Y, Pt3.X, Pt3.Y, Pt4.X, Pt4.Y);
  14860. end;
  14861.  
  14862. procedure TGPGraphicsPath.AddBezier(const Pt1, Pt2, Pt3, Pt4: TGPPointF);
  14863. begin
  14864. AddBezier(Pt1.X, Pt1.Y, Pt2.X, Pt2.Y, Pt3.X, Pt3.Y, Pt4.X, Pt4.Y);
  14865. end;
  14866.  
  14867. procedure TGPGraphicsPath.AddBezier(const X1, Y1, X2, Y2, X3, Y3, X4, Y4: Single);
  14868. begin
  14869. GdipCheck(GdipAddPathBezier(FNativeHandle, X1, Y1, X2, Y2, X3, Y3, X4, Y4));
  14870. end;
  14871.  
  14872. procedure TGPGraphicsPath.AddBezier(const X1, Y1, X2, Y2, X3, Y3, X4,
  14873. Y4: Integer);
  14874. begin
  14875. GdipCheck(GdipAddPathBezierI(FNativeHandle, X1, Y1, X2, Y2, X3, Y3, X4, Y4));
  14876. end;
  14877.  
  14878. procedure TGPGraphicsPath.AddBeziers(const Points: array of TGPPointF);
  14879. begin
  14880. Assert(Length(Points) > 0);
  14881. GdipCheck(GdipAddPathBeziers(FNativeHandle, @Points[0], Length(Points)));
  14882. end;
  14883.  
  14884. procedure TGPGraphicsPath.AddBeziers(const Points: array of TGPPoint);
  14885. begin
  14886. Assert(Length(Points) > 0);
  14887. GdipCheck(GdipAddPathBeziersI(FNativeHandle, @Points[0], Length(Points)));
  14888. end;
  14889.  
  14890. procedure TGPGraphicsPath.AddClosedCurve(const Points: array of TGPPoint);
  14891. begin
  14892. Assert(Length(Points) > 0);
  14893. GdipCheck(GdipAddPathClosedCurveI(FNativeHandle, @Points[0], Length(Points)));
  14894. end;
  14895.  
  14896. procedure TGPGraphicsPath.AddClosedCurve(const Points: array of TGPPoint;
  14897. const Tension: Single);
  14898. begin
  14899. Assert(Length(Points) > 0);
  14900. GdipCheck(GdipAddPathClosedCurve2I(FNativeHandle, @Points[0], Length(Points), Tension));
  14901. end;
  14902.  
  14903. procedure TGPGraphicsPath.AddClosedCurve(const Points: array of TGPPointF);
  14904. begin
  14905. Assert(Length(Points) > 0);
  14906. GdipCheck(GdipAddPathClosedCurve(FNativeHandle, @Points[0], Length(Points)));
  14907. end;
  14908.  
  14909. procedure TGPGraphicsPath.AddClosedCurve(const Points: array of TGPPointF;
  14910. const Tension: Single);
  14911. begin
  14912. Assert(Length(Points) > 0);
  14913. GdipCheck(GdipAddPathClosedCurve2(FNativeHandle, @Points[0], Length(Points), Tension));
  14914. end;
  14915.  
  14916. procedure TGPGraphicsPath.AddCurve(const Points: array of TGPPoint);
  14917. begin
  14918. Assert(Length(Points) > 0);
  14919. GdipCheck(GdipAddPathCurveI(FNativeHandle, @Points[0], Length(Points)));
  14920. end;
  14921.  
  14922. procedure TGPGraphicsPath.AddCurve(const Points: array of TGPPoint;
  14923. const Tension: Single);
  14924. begin
  14925. Assert(Length(Points) > 0);
  14926. GdipCheck(GdipAddPathCurve2I(FNativeHandle, @Points[0], Length(Points), Tension));
  14927. end;
  14928.  
  14929. procedure TGPGraphicsPath.AddCurve(const Points: array of TGPPoint; const Offset,
  14930. NumberOfSegments: Integer; const Tension: Single);
  14931. begin
  14932. Assert(Length(Points) > 0);
  14933. GdipCheck(GdipAddPathCurve3I(FNativeHandle, @Points[0], Length(Points),
  14934. Offset, NumberOfSegments, Tension));
  14935. end;
  14936.  
  14937. procedure TGPGraphicsPath.AddCurve(const Points: array of TGPPointF);
  14938. begin
  14939. Assert(Length(Points) > 0);
  14940. GdipCheck(GdipAddPathCurve(FNativeHandle, @Points[0], Length(Points)));
  14941. end;
  14942.  
  14943. procedure TGPGraphicsPath.AddCurve(const Points: array of TGPPointF;
  14944. const Tension: Single);
  14945. begin
  14946. Assert(Length(Points) > 0);
  14947. GdipCheck(GdipAddPathCurve2(FNativeHandle, @Points[0], Length(Points), Tension));
  14948. end;
  14949.  
  14950. procedure TGPGraphicsPath.AddCurve(const Points: array of TGPPointF; const Offset,
  14951. NumberOfSegments: Integer; const Tension: Single);
  14952. begin
  14953. Assert(Length(Points) > 0);
  14954. GdipCheck(GdipAddPathCurve3(FNativeHandle, @Points[0], Length(Points),
  14955. Offset, NumberOfSegments, Tension));
  14956. end;
  14957.  
  14958. procedure TGPGraphicsPath.AddEllipse(const X, Y, Width, Height: Single);
  14959. begin
  14960. GdipCheck(GdipAddPathEllipse(FNativeHandle, X, Y, Width, Height));
  14961. end;
  14962.  
  14963. procedure TGPGraphicsPath.AddEllipse(const Rect: TGPRectF);
  14964. begin
  14965. AddEllipse(Rect.X, Rect.Y, Rect.Width, Rect.Height);
  14966. end;
  14967.  
  14968. procedure TGPGraphicsPath.AddEllipse(const X, Y, Width, Height: Integer);
  14969. begin
  14970. GdipCheck(GdipAddPathEllipseI(FNativeHandle, X, Y, Width, Height));
  14971. end;
  14972.  
  14973. procedure TGPGraphicsPath.AddEllipse(const Rect: TGPRect);
  14974. begin
  14975. AddEllipse(Rect.X, Rect.Y, Rect.Width, Rect.Height);
  14976. end;
  14977.  
  14978. procedure TGPGraphicsPath.AddLine(const Pt1, Pt2: TGPPoint);
  14979. begin
  14980. AddLine(Pt1.X, Pt1.Y, Pt2.X, Pt2.Y);
  14981. end;
  14982.  
  14983. procedure TGPGraphicsPath.AddLine(const X1, Y1, X2, Y2: Integer);
  14984. begin
  14985. GdipCheck(GdipAddPathLineI(FNativeHandle, X1, Y1, X2, Y2));
  14986. end;
  14987.  
  14988. procedure TGPGraphicsPath.AddLine(const Pt1, Pt2: TGPPointF);
  14989. begin
  14990. AddLine(Pt1.X, Pt1.Y, Pt2.X, Pt2.Y);
  14991. end;
  14992.  
  14993. procedure TGPGraphicsPath.AddLine(const X1, Y1, X2, Y2: Single);
  14994. begin
  14995. GdipCheck(GdipAddPathLine(FNativeHandle, X1, Y1, X2, Y2));
  14996. end;
  14997.  
  14998. procedure TGPGraphicsPath.AddLines(const Points: array of TGPPoint);
  14999. begin
  15000. Assert(Length(Points) > 0);
  15001. GdipCheck(GdipAddPathLine2I(FNativeHandle, @Points[0], Length(Points)));
  15002. end;
  15003.  
  15004. procedure TGPGraphicsPath.AddLines(const Points: array of TGPPointF);
  15005. begin
  15006. Assert(Length(Points) > 0);
  15007. GdipCheck(GdipAddPathLine2(FNativeHandle, @Points[0], Length(Points)));
  15008. end;
  15009.  
  15010. procedure TGPGraphicsPath.AddPath(const AddingPath: IGPGraphicsPath;
  15011. const Connect: Boolean);
  15012. begin
  15013. GdipCheck(GdipAddPathPath(FNativeHandle, GdipHandle(AddingPath), Connect));
  15014. end;
  15015.  
  15016. procedure TGPGraphicsPath.AddPie(const Rect: TGPRect; const StartAngle,
  15017. SweepAngle: Single);
  15018. begin
  15019. AddPie(Rect.X, Rect.Y, Rect.Width, Rect.Height, StartAngle, SweepAngle);
  15020. end;
  15021.  
  15022. procedure TGPGraphicsPath.AddPie(const X, Y, Width, Height: Integer;
  15023. const StartAngle, SweepAngle: Single);
  15024. begin
  15025. GdipCheck(GdipAddPathPieI(FNativeHandle, X, Y, Width, Height, StartAngle, SweepAngle));
  15026. end;
  15027.  
  15028. procedure TGPGraphicsPath.AddPie(const Rect: TGPRectF; const StartAngle,
  15029. SweepAngle: Single);
  15030. begin
  15031. AddPie(Rect.X, Rect.Y, Rect.Width, Rect.Height, StartAngle, SweepAngle);
  15032. end;
  15033.  
  15034. procedure TGPGraphicsPath.AddPie(const X, Y, Width, Height, StartAngle,
  15035. SweepAngle: Single);
  15036. begin
  15037. GdipCheck(GdipAddPathPie(FNativeHandle, X, Y, Width, Height, StartAngle, SweepAngle));
  15038. end;
  15039.  
  15040. procedure TGPGraphicsPath.AddPolygon(const Points: array of TGPPoint);
  15041. begin
  15042. Assert(Length(Points) > 0);
  15043. GdipCheck(GdipAddPathPolygonI(FNativeHandle, @Points[0], Length(Points)));
  15044. end;
  15045.  
  15046. procedure TGPGraphicsPath.AddPolygon(const Points: array of TGPPointF);
  15047. begin
  15048. Assert(Length(Points) > 0);
  15049. GdipCheck(GdipAddPathPolygon(FNativeHandle, @Points[0], Length(Points)));
  15050. end;
  15051.  
  15052. procedure TGPGraphicsPath.AddRectangle(const Rect: TGPRect);
  15053. begin
  15054. GdipCheck(GdipAddPathRectangleI(FNativeHandle, Rect.X, Rect.Y,
  15055. Rect.Width, Rect.Height));
  15056. end;
  15057.  
  15058. procedure TGPGraphicsPath.AddRectangle(const Rect: TGPRectF);
  15059. begin
  15060. GdipCheck(GdipAddPathRectangle(FNativeHandle, Rect.X, Rect.Y,
  15061. Rect.Width, Rect.Height));
  15062. end;
  15063.  
  15064. procedure TGPGraphicsPath.AddRectangles(const Rects: array of TGPRect);
  15065. begin
  15066. Assert(Length(Rects) > 0);
  15067. GdipCheck(GdipAddPathRectanglesI(FNativeHandle, @Rects[0], Length(Rects)));
  15068. end;
  15069.  
  15070. procedure TGPGraphicsPath.AddRectangles(const Rects: array of TGPRectF);
  15071. begin
  15072. Assert(Length(Rects) > 0);
  15073. GdipCheck(GdipAddPathRectangles(FNativeHandle, @Rects[0], Length(Rects)));
  15074. end;
  15075.  
  15076. procedure TGPGraphicsPath.AddString(const Str: String; const Family: IGPFontFamily;
  15077. const Style: TGPFontStyle; const EmSize: Single; const Origin: TGPPoint;
  15078. const Format: IGPStringFormat);
  15079. var
  15080. Rect: TGPRect;
  15081. begin
  15082. Rect.Initialize(Origin.X, Origin.Y, 0, 0);
  15083. GdipCheck(GdipAddPathStringI(FNativeHandle, PWideChar(Str), Length(Str),
  15084. GdipHandle(Family), Style, EmSize, @Rect, GdipHandle(Format)));
  15085. end;
  15086.  
  15087. procedure TGPGraphicsPath.AddString(const Str: String; const Family: IGPFontFamily;
  15088. const Style: TGPFontStyle; const EmSize: Single; const LayoutRect: TGPRect;
  15089. const Format: IGPStringFormat);
  15090. begin
  15091. GdipCheck(GdipAddPathStringI(FNativeHandle, PWideChar(Str), Length(Str),
  15092. GdipHandle(Family), Style, EmSize, @LayoutRect, GdipHandle(Format)));
  15093. end;
  15094.  
  15095. procedure TGPGraphicsPath.AddString(const Str: String; const Family: IGPFontFamily;
  15096. const Style: TGPFontStyle; const EmSize: Single; const Origin: TGPPointF;
  15097. const Format: IGPStringFormat);
  15098. var
  15099. Rect: TGPRectF;
  15100. begin
  15101. Rect.Initialize(Origin.X, Origin.Y, 0, 0);
  15102. GdipCheck(GdipAddPathString(FNativeHandle, PWideChar(Str), Length(Str),
  15103. GdipHandle(Family), Style, EmSize, @Rect, GdipHandle(Format)));
  15104. end;
  15105.  
  15106. procedure TGPGraphicsPath.AddString(const Str: String; const Family: IGPFontFamily;
  15107. const Style: TGPFontStyle; const EmSize: Single; const LayoutRect: TGPRectF;
  15108. const Format: IGPStringFormat);
  15109. begin
  15110. GdipCheck(GdipAddPathString(FNativeHandle, PWideChar(Str), Length(Str),
  15111. GdipHandle(Family), Style, EmSize, @LayoutRect, GdipHandle(Format)));
  15112. end;
  15113.  
  15114. procedure TGPGraphicsPath.ClearMarkers;
  15115. begin
  15116. GdipCheck(GdipClearPathMarkers(FNativeHandle));
  15117. end;
  15118.  
  15119. function TGPGraphicsPath.Clone: IGPGraphicsPath;
  15120. var
  15121. NativeClone: GpPath;
  15122. begin
  15123. NativeClone := nil;
  15124. GdipCheck(GdipClonePath(FNativeHandle, NativeClone));
  15125. Result := TGPGraphicsPath.Create(NativeClone);
  15126. end;
  15127.  
  15128. procedure TGPGraphicsPath.CloseAllFigures;
  15129. begin
  15130. GdipCheck(GdipClosePathFigures(FNativeHandle));
  15131. end;
  15132.  
  15133. procedure TGPGraphicsPath.CloseFigure;
  15134. begin
  15135. GdipCheck(GdipClosePathFigure(FNativeHandle));
  15136. end;
  15137.  
  15138. constructor TGPGraphicsPath.Create(const Points: array of TGPPoint;
  15139. const Types: array of Byte; const FillMode: TGPFillMode);
  15140. begin
  15141. Assert(Length(Points) > 0);
  15142. Assert(Length(Points) = Length(Types));
  15143. inherited Create;
  15144. GdipCheck(GdipCreatePath2I(@Points[0], @Types[0], Length(Points), FillMode,
  15145. FNativeHandle));
  15146. end;
  15147.  
  15148. constructor TGPGraphicsPath.Create(const NativePath: GpPath);
  15149. begin
  15150. inherited Create;
  15151. FNativeHandle := NativePath;
  15152. end;
  15153.  
  15154. constructor TGPGraphicsPath.Create(const FillMode: TGPFillMode);
  15155. begin
  15156. inherited Create;
  15157. GdipCheck(GdipCreatePath(FillMode, FNativeHandle));
  15158. end;
  15159.  
  15160. constructor TGPGraphicsPath.Create(const Points: array of TGPPointF;
  15161. const Types: array of Byte; const FillMode: TGPFillMode);
  15162. begin
  15163. Assert(Length(Points) > 0);
  15164. Assert(Length(Points) = Length(Types));
  15165. inherited Create;
  15166. GdipCheck(GdipCreatePath2(@Points[0], @Types[0], Length(Points), FillMode,
  15167. FNativeHandle));
  15168. end;
  15169.  
  15170. destructor TGPGraphicsPath.Destroy;
  15171. begin
  15172. GdipDeletePath(FNativeHandle);
  15173. inherited;
  15174. end;
  15175.  
  15176. procedure TGPGraphicsPath.Flatten(const Matrix: IGPMatrix; const Flatness: Single);
  15177. begin
  15178. GdipCheck(GdipFlattenPath(FNativeHandle, GdipHandle(Matrix), Flatness));
  15179. end;
  15180.  
  15181. procedure TGPGraphicsPath.GetBounds(out Bounds: TGPRectF; const Matrix: IGPMatrix;
  15182. const Pen: IGPPen);
  15183. begin
  15184. GdipCheck(GdipGetPathWorldBounds(FNativeHandle, @Bounds,
  15185. GdipHandle(Matrix), GdipHandle(Pen)));
  15186. end;
  15187.  
  15188. procedure TGPGraphicsPath.GetBounds(out Bounds: TGPRect; const Matrix: IGPMatrix;
  15189. const Pen: IGPPen);
  15190. begin
  15191. GdipCheck(GdipGetPathWorldBoundsI(FNativeHandle, @Bounds,
  15192. GdipHandle(Matrix), GdipHandle(Pen)));
  15193. end;
  15194.  
  15195. function TGPGraphicsPath.GetFillMode: TGPFillMode;
  15196. begin
  15197. Result := FillModeAlternate;
  15198. GdipCheck(GdipGetPathFillMode(FNativeHandle, Result));
  15199. end;
  15200.  
  15201. function TGPGraphicsPath.GetLastPoint: TGPPointF;
  15202. begin
  15203. GdipCheck(GdipGetPathLastPoint(FNativeHandle, Result));
  15204. end;
  15205.  
  15206. function TGPGraphicsPath.GetPathData: IGPPathData;
  15207. var
  15208. Count: Integer;
  15209. NativeData: TGPNativePathData;
  15210. begin
  15211. Count := GetPointCount;
  15212. Result := TGPPathData.Create(Count);
  15213. NativeData := Result.NativePathData;
  15214. GdipCheck(GdipGetPathData(FNativeHandle, @NativeData));
  15215. end;
  15216.  
  15217. function TGPGraphicsPath.GetPathPoints: IGPPathPoints;
  15218. var
  15219. Count: Integer;
  15220. begin
  15221. Count := GetPointCount;
  15222. Result := TGPArray<TGPPointF>.Create(Count);
  15223. GdipCheck(GdipGetPathPoints(FNativeHandle, Result.ItemPtr, Count));
  15224. end;
  15225.  
  15226. function TGPGraphicsPath.GetPathPointsI: IGPPathPointsI;
  15227. var
  15228. Count: Integer;
  15229. begin
  15230. Count := GetPointCount;
  15231. Result := TGPArray<TGPPoint>.Create(Count);
  15232. GdipCheck(GdipGetPathPointsI(FNativeHandle, Result.ItemPtr, Count));
  15233. end;
  15234.  
  15235. function TGPGraphicsPath.GetPathTypes: IGPPathTypes;
  15236. var
  15237. Count: Integer;
  15238. begin
  15239. Count := GetPointCount;
  15240. Result := TGPArray<Byte>.Create(Count);
  15241. GdipCheck(GdipGetPathTypes(FNativeHandle, Result.ItemPtr, Count));
  15242. end;
  15243.  
  15244. function TGPGraphicsPath.GetPointCount: Integer;
  15245. begin
  15246. Result := 0;
  15247. GdipCheck(GdipGetPointCount(FNativeHandle, Result));
  15248. end;
  15249.  
  15250. function TGPGraphicsPath.IsOutlineVisible(const X, Y: Integer; const Pen: IGPPen;
  15251. const G: IGPGraphics): Boolean;
  15252. var
  15253. B: Bool;
  15254. begin
  15255. B := False;
  15256. GdipCheck(GdipIsOutlineVisiblePathPointI(FNativeHandle, X, Y, GdipHandle(Pen),
  15257. GdipHandle(G), B));
  15258. Result := B;
  15259. end;
  15260.  
  15261. function TGPGraphicsPath.IsOutlineVisible(const Point: TGPPointF; const Pen: IGPPen;
  15262. const G: IGPGraphics): Boolean;
  15263. begin
  15264. Result := IsOutlineVisible(Point.X, Point.Y, Pen, G);
  15265. end;
  15266.  
  15267. function TGPGraphicsPath.IsOutlineVisible(const X, Y: Single; const Pen: IGPPen;
  15268. const G: IGPGraphics): Boolean;
  15269. var
  15270. B: Bool;
  15271. begin
  15272. B := False;
  15273. GdipCheck(GdipIsOutlineVisiblePathPoint(FNativeHandle, X, Y, GdipHandle(Pen),
  15274. GdipHandle(G), B));
  15275. Result := B;
  15276. end;
  15277.  
  15278. function TGPGraphicsPath.IsOutlineVisible(const Point: TGPPoint; const Pen: IGPPen;
  15279. const G: IGPGraphics): Boolean;
  15280. begin
  15281. Result := IsOutlineVisible(Point.X, Point.Y, Pen, G);
  15282. end;
  15283.  
  15284. function TGPGraphicsPath.IsVisible(const X, Y: Single;
  15285. const G: IGPGraphics): Boolean;
  15286. var
  15287. B: Bool;
  15288. begin
  15289. B := False;
  15290. GdipCheck(GdipIsVisiblePathPoint(FNativeHandle, X, Y, GdipHandle(G), B));
  15291. Result := B;
  15292. end;
  15293.  
  15294. function TGPGraphicsPath.IsVisible(const X, Y: Integer;
  15295. const G: IGPGraphics): Boolean;
  15296. var
  15297. B: Bool;
  15298. begin
  15299. B := False;
  15300. GdipCheck(GdipIsVisiblePathPointI(FNativeHandle, X, Y, GdipHandle(G), B));
  15301. Result := B;
  15302. end;
  15303.  
  15304. function TGPGraphicsPath.IsVisible(const Point: TGPPointF;
  15305. const G: IGPGraphics): Boolean;
  15306. begin
  15307. Result := IsVisible(Point.X, Point.Y, G);
  15308. end;
  15309.  
  15310. function TGPGraphicsPath.IsVisible(const Point: TGPPoint;
  15311. const G: IGPGraphics): Boolean;
  15312. begin
  15313. Result := IsVisible(Point.X, Point.Y, G);
  15314. end;
  15315.  
  15316. procedure TGPGraphicsPath.Outline(const Matrix: IGPMatrix; const Flatness: Single);
  15317. begin
  15318. GdipCheck(GdipWindingModeOutline(FNativeHandle, GdipHandle(Matrix), Flatness));
  15319. end;
  15320.  
  15321. procedure TGPGraphicsPath.Reset;
  15322. begin
  15323. GdipCheck(GdipResetPath(FNativeHandle));
  15324. end;
  15325.  
  15326. procedure TGPGraphicsPath.Reverse;
  15327. begin
  15328. GdipCheck(GdipReversePath(FNativeHandle));
  15329. end;
  15330.  
  15331. procedure TGPGraphicsPath.SetFillMode(const Value: TGPFillMode);
  15332. begin
  15333. GdipCheck(GdipSetPathFillMode(FNativeHandle, Value));
  15334. end;
  15335.  
  15336. procedure TGPGraphicsPath.SetMarker;
  15337. begin
  15338. GdipCheck(GdipSetPathMarker(FNativeHandle));
  15339. end;
  15340.  
  15341. procedure TGPGraphicsPath.StartFigure;
  15342. begin
  15343. GdipCheck(GdipStartPathFigure(FNativeHandle));
  15344. end;
  15345.  
  15346. procedure TGPGraphicsPath.Transform(const Matrix: IGPMatrix);
  15347. begin
  15348. if Assigned(Matrix) then
  15349. GdipCheck(GdipTransformPath(FNativeHandle, Matrix.NativeHandle));
  15350. end;
  15351.  
  15352. procedure TGPGraphicsPath.Warp(const DestPoints: array of TGPPointF;
  15353. const SrcRect: TGPRectF; const Matrix: IGPMatrix; const WarpMode: TGPWarpMode;
  15354. const Flatness: Single);
  15355. begin
  15356. Assert(Length(DestPoints) > 0);
  15357. GdipCheck(GdipWarpPath(FNativeHandle, GdipHandle(Matrix), @DestPoints[0],
  15358. Length(DestPoints), SrcRect.X, SrcRect.Y, SrcRect.Width, SrcRect.Height,
  15359. WarpMode, Flatness));
  15360. end;
  15361.  
  15362. procedure TGPGraphicsPath.Widen(const Pen: IGPPen; const Matrix: IGPMatrix;
  15363. const Flatness: Single);
  15364. begin
  15365. GdipCheck(GdipWidenPath(FNativeHandle, Pen.NativeHandle, GdipHandle(Matrix), Flatness));
  15366. end;
  15367.  
  15368. { TGPGraphicsPathIterator }
  15369.  
  15370. function TGPGraphicsPathIterator.CopyData(const StartIndex,
  15371. EndIndex: Integer): IGPPathData;
  15372. var
  15373. Count: Integer;
  15374. begin
  15375. Count := EndIndex - StartIndex + 1;
  15376. Result := TGPPathData.Create(Count);
  15377. GdipCheck(GdipPathIterCopyData(FNativeHandle, Count, Result.PointPtr,
  15378. Result.TypePtr, StartIndex, EndIndex));
  15379. Result.Count := Count;
  15380. end;
  15381.  
  15382. constructor TGPGraphicsPathIterator.Create(const Path: IGPGraphicsPath);
  15383. begin
  15384. inherited Create;
  15385. GdipCheck(GdipCreatePathIter(FNativeHandle, GdipHandle(Path)));
  15386. end;
  15387.  
  15388. destructor TGPGraphicsPathIterator.Destroy;
  15389. begin
  15390. GdipDeletePathIter(FNativeHandle);
  15391. inherited;
  15392. end;
  15393.  
  15394. function TGPGraphicsPathIterator.Enumerate: IGPPathData;
  15395. var
  15396. Count: Integer;
  15397. begin
  15398. Count := GetCount;
  15399. Result := TGPPathData.Create(Count);
  15400. GdipCheck(GdipPathIterEnumerate(FNativeHandle, Count, Result.PointPtr,
  15401. Result.TypePtr, Count));
  15402. Result.Count := Count;
  15403. end;
  15404.  
  15405. function TGPGraphicsPathIterator.GetCount: Integer;
  15406. begin
  15407. GdipCheck(GdipPathIterGetCount(FNativeHandle, Result));
  15408. end;
  15409.  
  15410. function TGPGraphicsPathIterator.GetSubpathCount: Integer;
  15411. begin
  15412. GdipCheck(GdipPathIterGetSubpathCount(FNativeHandle, Result));
  15413. end;
  15414.  
  15415. function TGPGraphicsPathIterator.HasCurve: Boolean;
  15416. var
  15417. B: Bool;
  15418. begin
  15419. GdipCheck(GdipPathIterHasCurve(FNativeHandle, B));
  15420. Result := B;
  15421. end;
  15422.  
  15423. function TGPGraphicsPathIterator.NextMarker(out StartIndex,
  15424. EndIndex: Integer): Integer;
  15425. begin
  15426. GdipCheck(GdipPathIterNextMarker(FNativeHandle, Result, StartIndex, EndIndex));
  15427. end;
  15428.  
  15429. function TGPGraphicsPathIterator.NextMarker(const Path: IGPGraphicsPath): Integer;
  15430. begin
  15431. GdipCheck(GdipPathIterNextMarkerPath(FNativeHandle, Result, GdipHandle(Path)));
  15432. end;
  15433.  
  15434. function TGPGraphicsPathIterator.NextPathType(out PathType: Byte; out StartIndex,
  15435. EndIndex: Integer): Integer;
  15436. begin
  15437. GdipCheck(GdipPathIterNextPathType(FNativeHandle, Result, PathType,
  15438. StartIndex, EndIndex));
  15439. end;
  15440.  
  15441. function TGPGraphicsPathIterator.NextSubPath(out StartIndex, EndIndex: Integer;
  15442. out IsClosed: Boolean): Integer;
  15443. var
  15444. B: Bool;
  15445. begin
  15446. GdipCheck(GdipPathIterNextSubpath(FNativeHandle, Result, StartIndex,
  15447. EndIndex, B));
  15448. IsClosed := B;
  15449. end;
  15450.  
  15451. function TGPGraphicsPathIterator.NextSubPath(const Path: IGPGraphicsPath;
  15452. out IsClosed: Boolean): Integer;
  15453. var
  15454. B: Bool;
  15455. begin
  15456. GdipCheck(GdipPathIterNextSubpathPath(FNativeHandle, Result,
  15457. GdipHandle(Path), B));
  15458. IsClosed := B;
  15459. end;
  15460.  
  15461. procedure TGPGraphicsPathIterator.Rewind;
  15462. begin
  15463. GdipCheck(GdipPathIterRewind(FNativeHandle));
  15464. end;
  15465.  
  15466. { TGPPathGradientBrush }
  15467.  
  15468. constructor TGPPathGradientBrush.Create(const Path: IGPGraphicsPath);
  15469. begin
  15470. inherited Create;
  15471. GdipCheck(GdipCreatePathGradientFromPath(Path.NativeHandle, FNativeHandle));
  15472. end;
  15473.  
  15474. constructor TGPPathGradientBrush.Create(const Points: array of TGPPoint;
  15475. const WrapMode: TGPWrapMode);
  15476. begin
  15477. inherited Create;
  15478. Assert(Length(Points) > 0);
  15479. GdipCheck(GdipCreatePathGradientI(@Points[0], Length(Points), WrapMode, FNativeHandle));
  15480. end;
  15481.  
  15482. constructor TGPPathGradientBrush.Create(const Points: array of TGPPointF;
  15483. const WrapMode: TGPWrapMode);
  15484. begin
  15485. inherited Create;
  15486. Assert(Length(Points) > 0);
  15487. GdipCheck(GdipCreatePathGradient(@Points[0], Length(Points), WrapMode, FNativeHandle));
  15488. end;
  15489.  
  15490. function TGPPathGradientBrush.GetBlend: IGPBlend;
  15491. var
  15492. Count: Integer;
  15493. begin
  15494. Count := 0;
  15495. GdipCheck(GdipGetPathGradientBlendCount(FNativeHandle, Count));
  15496. Result := TGPBlend.Create(Count);
  15497. if (Count > 0) then
  15498. GdipCheck(GdipGetPathGradientBlend(FNativeHandle, Result.FactorPtr,
  15499. Result.PositionPtr, Count));
  15500. end;
  15501.  
  15502. function TGPPathGradientBrush.GetCenterColor: TGPColor;
  15503. begin
  15504. GdipCheck(GdipGetPathGradientCenterColor(FNativeHandle, Result.FArgb));
  15505. end;
  15506.  
  15507. function TGPPathGradientBrush.GetCenterPoint: TGPPointF;
  15508. begin
  15509. GdipCheck(GdipGetPathGradientCenterPoint(FNativeHandle, Result));
  15510. end;
  15511.  
  15512. function TGPPathGradientBrush.GetCenterPointI: TGPPoint;
  15513. begin
  15514. GdipCheck(GdipGetPathGradientCenterPointI(FNativeHandle, Result));
  15515. end;
  15516.  
  15517. procedure TGPPathGradientBrush.GetFocusScales(out XScale, YScale: Single);
  15518. begin
  15519. GdipCheck(GdipGetPathGradientFocusScales(FNativeHandle, XScale, YScale));
  15520. end;
  15521.  
  15522. function TGPPathGradientBrush.GetGammaCorrection: Boolean;
  15523. var
  15524. B: Bool;
  15525. begin
  15526. GdipCheck(GdipGetPathGradientGammaCorrection(FNativeHandle, B));
  15527. Result := B;
  15528. end;
  15529.  
  15530. function TGPPathGradientBrush.GetGraphicsPath: IGPGraphicsPath;
  15531. var
  15532. NativePath: GpPath;
  15533. begin
  15534. NativePath := nil;
  15535. GdipCheck(GdipGetPathGradientPath(FNativeHandle, NativePath));
  15536. Result := TGPGraphicsPath.Create(NativePath);
  15537. end;
  15538.  
  15539. function TGPPathGradientBrush.GetInterpolationColors: IGPColorBlend;
  15540. var
  15541. Count: Integer;
  15542. begin
  15543. Count := 0;
  15544. GdipCheck(GdipGetPathGradientPresetBlendCount(FNativeHandle, Count));
  15545. Result := TGPColorBlend.Create(Count);
  15546. if (Count > 0) then
  15547. GdipCheck(GdipGetPathGradientPresetBlend(FNativeHandle, PARGB(Result.ColorPtr),
  15548. Result.PositionPtr, Count));
  15549. end;
  15550.  
  15551. function TGPPathGradientBrush.GetPointCount: Integer;
  15552. begin
  15553. GdipCheck(GdipGetPathGradientPointCount(FNativeHandle, Result));
  15554. end;
  15555.  
  15556. function TGPPathGradientBrush.GetRectangle: TGPRectF;
  15557. begin
  15558. GdipCheck(GdipGetPathGradientRect(FNativeHandle, Result));
  15559. end;
  15560.  
  15561. function TGPPathGradientBrush.GetRectangleI: TGPRect;
  15562. begin
  15563. GdipCheck(GdipGetPathGradientRectI(FNativeHandle, Result));
  15564. end;
  15565.  
  15566. function TGPPathGradientBrush.GetSurroundColors: IGPColors;
  15567. var
  15568. Count: Integer;
  15569. begin
  15570. GdipCheck(GdipGetPathGradientSurroundColorCount(FNativeHandle, Count));
  15571. Result := TGPArray<TGPColor>.Create(Count);
  15572. if (Count > 0) then
  15573. begin
  15574. GdipCheck(GdipGetPathGradientSurroundColorsWithCount(FNativeHandle,
  15575. Result.ItemPtr, Count));
  15576. Result.Count := Count;
  15577. end;
  15578. end;
  15579.  
  15580. function TGPPathGradientBrush.GetTransform: IGPMatrix;
  15581. begin
  15582. Result := TGPMatrix.Create;
  15583. GdipCheck(GdipGetPathGradientTransform(FNativeHandle, Result.NativeHandle));
  15584. end;
  15585.  
  15586. function TGPPathGradientBrush.GetWrapMode: TGPWrapMode;
  15587. begin
  15588. GdipCheck(GdipGetPathGradientWrapMode(FNativeHandle, Result));
  15589. end;
  15590.  
  15591. procedure TGPPathGradientBrush.MultiplyTransform(const Matrix: IGPMatrix;
  15592. const Order: TGPMatrixOrder);
  15593. begin
  15594. GdipCheck(GdipMultiplyPathGradientTransform(FNativeHandle,
  15595. Matrix.NativeHandle, Order));
  15596. end;
  15597.  
  15598. procedure TGPPathGradientBrush.ResetTransform;
  15599. begin
  15600. GdipCheck(GdipResetPathGradientTransform(FNativeHandle));
  15601. end;
  15602.  
  15603. procedure TGPPathGradientBrush.RotateTransform(const Angle: Single;
  15604. const Order: TGPMatrixOrder);
  15605. begin
  15606. GdipCheck(GdipRotatePathGradientTransform(FNativeHandle, Angle, Order));
  15607. end;
  15608.  
  15609. procedure TGPPathGradientBrush.ScaleTransform(const SX, SY: Single;
  15610. const Order: TGPMatrixOrder);
  15611. begin
  15612. GdipCheck(GdipScalePathGradientTransform(FNativeHandle, SX, SY, Order));
  15613. end;
  15614.  
  15615. procedure TGPPathGradientBrush.SetBlend(const Value: IGPBlend);
  15616. begin
  15617. Assert(Assigned(Value));
  15618. GdipCheck(GdipSetPathGradientBlend(FNativeHandle, Value.FactorPtr,
  15619. Value.PositionPtr, Value.Count));
  15620. end;
  15621.  
  15622. procedure TGPPathGradientBrush.SetBlendBellShape(const Focus, Scale: Single);
  15623. begin
  15624. GdipCheck(GdipSetPathGradientSigmaBlend(FNativeHandle, Focus, Scale));
  15625. end;
  15626.  
  15627. procedure TGPPathGradientBrush.SetBlendTriangularShape(const Focus,
  15628. Scale: Single);
  15629. begin
  15630. GdipCheck(GdipSetPathGradientLinearBlend(FNativeHandle, Focus, Scale));
  15631. end;
  15632.  
  15633. procedure TGPPathGradientBrush.SetCenterColor(const Value: TGPColor);
  15634. begin
  15635. GdipCheck(GdipSetPathGradientCenterColor(FNativeHandle, Value.FArgb));
  15636. end;
  15637.  
  15638. procedure TGPPathGradientBrush.SetCenterPoint(const Value: TGPPointF);
  15639. begin
  15640. GdipCheck(GdipSetPathGradientCenterPoint(FNativeHandle, @Value));
  15641. end;
  15642.  
  15643. procedure TGPPathGradientBrush.SetCenterPointI(const Value: TGPPoint);
  15644. begin
  15645. GdipCheck(GdipSetPathGradientCenterPointI(FNativeHandle, @Value));
  15646. end;
  15647.  
  15648. procedure TGPPathGradientBrush.SetFocusScales(const XScale, YScale: Single);
  15649. begin
  15650. GdipCheck(GdipSetPathGradientFocusScales(FNativeHandle, XScale, YScale));
  15651. end;
  15652.  
  15653. procedure TGPPathGradientBrush.SetGammaCorrection(const Value: Boolean);
  15654. begin
  15655. GdipCheck(GdipSetPathGradientGammaCorrection(FNativeHandle, Value));
  15656. end;
  15657.  
  15658. procedure TGPPathGradientBrush.SetGraphicsPath(const Value: IGPGraphicsPath);
  15659. begin
  15660. if Assigned(Value) then
  15661. GdipCheck(GdipSetPathGradientPath(FNativeHandle, Value.NativeHandle))
  15662. else
  15663. GdipCheck(InvalidParameter);
  15664. end;
  15665.  
  15666. procedure TGPPathGradientBrush.SetInterpolationColors(const Value: IGPColorBlend);
  15667. begin
  15668. GdipCheck(GdipSetPathGradientPresetBlend(FNativeHandle, PARGB(Value.ColorPtr),
  15669. Value.PositionPtr, Value.Count));
  15670. end;
  15671.  
  15672. procedure TGPPathGradientBrush.SetSurroundColors(const Colors: array of TGPColor);
  15673. var
  15674. Count: Integer;
  15675. begin
  15676. Assert(Length(Colors) > 0);
  15677. Count := Length(Colors);
  15678. GdipCheck(GdipSetPathGradientSurroundColorsWithCount(FNativeHandle,
  15679. @Colors[0], Count));
  15680. end;
  15681.  
  15682. procedure TGPPathGradientBrush.SetSurroundColorsInternal(const Value: IGPColors);
  15683. var
  15684. Count: Integer;
  15685. begin
  15686. Assert(Assigned(Value));
  15687. Count := Value.Count;
  15688. GdipCheck(GdipSetPathGradientSurroundColorsWithCount(FNativeHandle,
  15689. Value.ItemPtr, Count));
  15690. Value.Count := Count;
  15691. end;
  15692.  
  15693. procedure TGPPathGradientBrush.SetTransform(const Value: IGPMatrix);
  15694. begin
  15695. GdipCheck(GdipSetPathGradientTransform(FNativeHandle, Value.NativeHandle));
  15696. end;
  15697.  
  15698. procedure TGPPathGradientBrush.SetWrapMode(const Value: TGPWrapMode);
  15699. begin
  15700. GdipCheck(GdipSetPathGradientWrapMode(FNativeHandle, Value));
  15701. end;
  15702.  
  15703. procedure TGPPathGradientBrush.TranslateTransform(const DX, DY: Single;
  15704. const Order: TGPMatrixOrder);
  15705. begin
  15706. GdipCheck(GdipTranslatePathGradientTransform(FNativeHandle, DX, DY, Order));
  15707. end;
  15708. {$ENDREGION 'GdiplusPath.h'}
  15709.  
  15710. {$REGION 'GdiplusGraphics.h'}
  15711.  
  15712. { TGPGraphics }
  15713.  
  15714. procedure TGPGraphics.AddMetafileComment(const Data: array of Byte);
  15715. begin
  15716. Assert(Length(Data) > 0);
  15717. GdipCheck(GdipComment(FNativeHandle, Length(Data), @Data[0]));
  15718. end;
  15719.  
  15720. function TGPGraphics.BeginContainer: TGPGraphicsContainer;
  15721. begin
  15722. GdipCheck(GdipBeginContainer2(FNativeHandle, Result));
  15723. end;
  15724.  
  15725. function TGPGraphics.BeginContainer(const DstRect, SrcRect: TGPRect;
  15726. const MeasureUnit: TGPUnit): TGPGraphicsContainer;
  15727. begin
  15728. GdipCheck(GdipBeginContainerI(FNativeHandle, @DstRect, @SrcRect, MeasureUnit, Result));
  15729. end;
  15730.  
  15731. function TGPGraphics.BeginContainer(const DstRect, SrcRect: TGPRectF;
  15732. const MeasureUnit: TGPUnit): TGPGraphicsContainer;
  15733. begin
  15734. GdipCheck(GdipBeginContainer(FNativeHandle, @DstRect, @SrcRect, MeasureUnit, Result));
  15735. end;
  15736.  
  15737. procedure TGPGraphics.Clear(const Color: TGPColor);
  15738. begin
  15739. GdipCheck(GdipGraphicsClear(FNativeHandle, Color.Value));
  15740. end;
  15741.  
  15742. constructor TGPGraphics.Create(const Image: IGPImage);
  15743. begin
  15744. inherited Create;
  15745. Assert(Assigned(Image));
  15746. GdipCheck(GdipGetImageGraphicsContext(Image.NativeHandle, FNativeHandle));
  15747. end;
  15748.  
  15749. constructor TGPGraphics.Create(const DC: HDC);
  15750. begin
  15751. inherited Create;
  15752. GdipCheck(GdipCreateFromHDC(DC, FNativeHandle));
  15753. end;
  15754.  
  15755. constructor TGPGraphics.Create(const DC: HDC; const Device: THandle);
  15756. begin
  15757. inherited Create;
  15758. GdipCheck(GdipCreateFromHDC2(DC, Device, FNativeHandle));
  15759. end;
  15760.  
  15761. constructor TGPGraphics.Create(const Window: HWnd; const ICM: Boolean);
  15762. begin
  15763. inherited Create;
  15764. if (ICM) then
  15765. GdipCheck(GdipCreateFromHWNDICM(Window, FNativeHandle))
  15766. else
  15767. GdipCheck(GdipCreateFromHWND(Window, FNativeHandle));
  15768. end;
  15769.  
  15770. destructor TGPGraphics.Destroy;
  15771. begin
  15772. GdipDeleteGraphics(FNativeHandle);
  15773. inherited;
  15774. end;
  15775.  
  15776. procedure TGPGraphics.DrawArc(const Pen: IGPPen; const Rect: TGPRect;
  15777. const StartAngle, SweepAngle: Single);
  15778. begin
  15779. DrawArc(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height, StartAngle, SweepAngle);
  15780. end;
  15781.  
  15782. procedure TGPGraphics.DrawArc(const Pen: IGPPen; const X, Y, Width, Height: Integer;
  15783. const StartAngle, SweepAngle: Single);
  15784. begin
  15785. GdipCheck(GdipDrawArcI(FNativeHandle, Pen.NativeHandle, X, Y, Width, Height,
  15786. StartAngle, SweepAngle));
  15787. end;
  15788.  
  15789. procedure TGPGraphics.DrawArc(const Pen: IGPPen; const Rect: TGPRectF;
  15790. const StartAngle, SweepAngle: Single);
  15791. begin
  15792. DrawArc(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height, StartAngle, SweepAngle);
  15793. end;
  15794.  
  15795. procedure TGPGraphics.DrawArc(const Pen: IGPPen; const X, Y, Width, Height,
  15796. StartAngle, SweepAngle: Single);
  15797. begin
  15798. GdipCheck(GdipDrawArc(FNativeHandle, Pen.NativeHandle, X, Y, Width, Height,
  15799. StartAngle, SweepAngle));
  15800. end;
  15801.  
  15802. procedure TGPGraphics.DrawBezier(const Pen: IGPPen; const Pt1, Pt2, Pt3,
  15803. Pt4: TGPPoint);
  15804. begin
  15805. DrawBezier(Pen, Pt1.X, Pt1.Y, Pt2.X, Pt2.Y, Pt3.X, Pt3.Y, Pt4.X, Pt4.Y);
  15806. end;
  15807.  
  15808. procedure TGPGraphics.DrawBezier(const Pen: IGPPen; const X1, Y1, X2, Y2, X3, Y3,
  15809. X4, Y4: Integer);
  15810. begin
  15811. GdipCheck(GdipDrawBezierI(FNativeHandle, Pen.NativeHandle, X1, Y1, X2, Y2,
  15812. X3, Y3, X4, Y4));
  15813. end;
  15814.  
  15815. procedure TGPGraphics.DrawBezier(const Pen: IGPPen; const Pt1, Pt2, Pt3,
  15816. Pt4: TGPPointF);
  15817. begin
  15818. DrawBezier(Pen, Pt1.X, Pt1.Y, Pt2.X, Pt2.Y, Pt3.X, Pt3.Y, Pt4.X, Pt4.Y);
  15819. end;
  15820.  
  15821. procedure TGPGraphics.DrawBezier(const Pen: IGPPen; const X1, Y1, X2, Y2, X3, Y3,
  15822. X4, Y4: Single);
  15823. begin
  15824. GdipCheck(GdipDrawBezier(FNativeHandle, Pen.NativeHandle, X1, Y1, X2, Y2,
  15825. X3, Y3, X4, Y4));
  15826. end;
  15827.  
  15828. procedure TGPGraphics.DrawBeziers(const Pen: IGPPen; const Points: array of TGPPoint);
  15829. begin
  15830. Assert(Length(Points) > 0);
  15831. GdipCheck(GdipDrawBeziersI(FNativeHandle, Pen.NativeHandle, @Points[0], Length(Points)));
  15832. end;
  15833.  
  15834. procedure TGPGraphics.DrawBeziers(const Pen: IGPPen;
  15835. const Points: array of TGPPointF);
  15836. begin
  15837. Assert(Length(Points) > 0);
  15838. GdipCheck(GdipDrawBeziers(FNativeHandle, Pen.NativeHandle, @Points[0], Length(Points)));
  15839. end;
  15840.  
  15841. procedure TGPGraphics.DrawCachedBitmap(const CachedBitmap: IGPCachedBitmap; const X,
  15842. Y: Integer);
  15843. begin
  15844. GdipCheck(GdipDrawCachedBitmap(FNativeHandle, CachedBitmap.NativeHandle, X, Y));
  15845. end;
  15846.  
  15847. procedure TGPGraphics.DrawClosedCurve(const Pen: IGPPen;
  15848. const Points: array of TGPPoint; const Tension: Single);
  15849. begin
  15850. Assert(Length(Points) > 0);
  15851. GdipCheck(GdipDrawClosedCurve2I(FNativeHandle, Pen.NativeHandle, @Points[0],
  15852. Length(Points), Tension));
  15853. end;
  15854.  
  15855. procedure TGPGraphics.DrawClosedCurve(const Pen: IGPPen;
  15856. const Points: array of TGPPointF);
  15857. begin
  15858. Assert(Length(Points) > 0);
  15859. GdipCheck(GdipDrawClosedCurve(FNativeHandle, Pen.NativeHandle, @Points[0],
  15860. Length(Points)));
  15861. end;
  15862.  
  15863. procedure TGPGraphics.DrawClosedCurve(const Pen: IGPPen;
  15864. const Points: array of TGPPointF; const Tension: Single);
  15865. begin
  15866. Assert(Length(Points) > 0);
  15867. GdipCheck(GdipDrawClosedCurve2(FNativeHandle, Pen.NativeHandle, @Points[0],
  15868. Length(Points), Tension));
  15869. end;
  15870.  
  15871. procedure TGPGraphics.DrawClosedCurve(const Pen: IGPPen;
  15872. const Points: array of TGPPoint);
  15873. begin
  15874. Assert(Length(Points) > 0);
  15875. GdipCheck(GdipDrawClosedCurveI(FNativeHandle, Pen.NativeHandle, @Points[0],
  15876. Length(Points)));
  15877. end;
  15878.  
  15879. procedure TGPGraphics.DrawCurve(const Pen: IGPPen; const Points: array of TGPPointF;
  15880. const Offset, NumberOfSegments: Integer; const Tension: Single);
  15881. begin
  15882. Assert(Length(Points) > 0);
  15883. GdipCheck(GdipDrawCurve3(FNativeHandle, Pen.NativeHandle, @Points[0],
  15884. Length(Points), Offset, NumberOfSegments, Tension));
  15885. end;
  15886.  
  15887. procedure TGPGraphics.DrawCurve(const Pen: IGPPen; const Points: array of TGPPointF;
  15888. const Tension: Single);
  15889. begin
  15890. Assert(Length(Points) > 0);
  15891. GdipCheck(GdipDrawCurve2(FNativeHandle, Pen.NativeHandle, @Points[0],
  15892. Length(Points), Tension));
  15893. end;
  15894.  
  15895. procedure TGPGraphics.DrawCurve(const Pen: IGPPen; const Points: array of TGPPointF);
  15896. begin
  15897. Assert(Length(Points) > 0);
  15898. GdipCheck(GdipDrawCurve(FNativeHandle, Pen.NativeHandle, @Points[0], Length(Points)));
  15899. end;
  15900.  
  15901. procedure TGPGraphics.DrawCurve(const Pen: IGPPen; const Points: array of TGPPoint;
  15902. const Offset, NumberOfSegments: Integer; const Tension: Single);
  15903. begin
  15904. Assert(Length(Points) > 0);
  15905. GdipCheck(GdipDrawCurve3I(FNativeHandle, Pen.NativeHandle, @Points[0],
  15906. Length(Points), Offset, NumberOfSegments, Tension));
  15907. end;
  15908.  
  15909. procedure TGPGraphics.DrawCurve(const Pen: IGPPen; const Points: array of TGPPoint;
  15910. const Tension: Single);
  15911. begin
  15912. Assert(Length(Points) > 0);
  15913. GdipCheck(GdipDrawCurve2I(FNativeHandle, Pen.NativeHandle, @Points[0],
  15914. Length(Points), Tension));
  15915. end;
  15916.  
  15917. procedure TGPGraphics.DrawCurve(const Pen: IGPPen; const Points: array of TGPPoint);
  15918. begin
  15919. Assert(Length(Points) > 0);
  15920. GdipCheck(GdipDrawCurveI(FNativeHandle, Pen.NativeHandle, @Points[0], Length(Points)));
  15921. end;
  15922.  
  15923. procedure TGPGraphics.DrawDriverString(const Text: PUInt16; const Length: Integer;
  15924. const Font: IGPFont; const Brush: IGPBrush; const Positions: PGPPointF;
  15925. const Flags: TGPDriverStringOptions; const Matrix: IGPMatrix);
  15926. begin
  15927. GdipCheck(GdipDrawDriverString(FNativeHandle, Text, Length, GdipHandle(Font),
  15928. GdipHandle(Brush), Positions, Flags, GdipHandle(Matrix)));
  15929. end;
  15930.  
  15931. procedure TGPGraphics.DrawEllipse(const Pen: IGPPen; const X, Y, Width,
  15932. Height: Single);
  15933. begin
  15934. GdipCheck(GdipDrawEllipse(FNativeHandle, Pen.NativeHandle, X, Y, Width, Height));
  15935. end;
  15936.  
  15937. procedure TGPGraphics.DrawEllipse(const Pen: IGPPen; const Rect: TGPRect);
  15938. begin
  15939. DrawEllipse(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height);
  15940. end;
  15941.  
  15942. procedure TGPGraphics.DrawEllipse(const Pen: IGPPen; const X, Y, Width,
  15943. Height: Integer);
  15944. begin
  15945. GdipCheck(GdipDrawEllipseI(FNativeHandle, Pen.NativeHandle, X, Y, Width, Height));
  15946. end;
  15947.  
  15948. procedure TGPGraphics.DrawEllipse(const Pen: IGPPen; const Rect: TGPRectF);
  15949. begin
  15950. DrawEllipse(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height);
  15951. end;
  15952.  
  15953. procedure TGPGraphics.DrawImage(const Image: IGPImage; const X, Y, SrcX, SrcY,
  15954. SrcWidth, SrcHeight: Single; const SrcUnit: TGPUnit);
  15955. begin
  15956. GdipCheck(GdipDrawImagePointRect(FNativeHandle, GdipHandle(Image),
  15957. X, Y, SrcX, SrcY, SrcWidth, SrcHeight, SrcUnit));
  15958. end;
  15959.  
  15960. procedure TGPGraphics.DrawImage(const Image: IGPImage; const DestRect: TGPRect;
  15961. const SrcX, SrcY, SrcWidth, SrcHeight: Integer; const SrcUnit: TGPUnit;
  15962. const ImageAttributes: IGPImageAttributes; const Callback: TGPDrawImageAbort;
  15963. const CallbackData: Pointer);
  15964. begin
  15965. GdipCheck(GdipDrawImageRectRectI(FNativeHandle, GdipHandle(Image),
  15966. DestRect.X, DestRect.Y, DestRect.Width, DestRect.Height,
  15967. SrcX, SrcY, SrcWidth, SrcHeight, SrcUnit, GdipHandle(ImageAttributes),
  15968. Callback, CallbackData));
  15969. end;
  15970.  
  15971. procedure TGPGraphics.DrawImage(const Image: IGPImage; const DestPoints: TGPPlgPoints;
  15972. const SrcX, SrcY, SrcWidth, SrcHeight: Integer; const SrcUnit: TGPUnit;
  15973. const ImageAttributes: IGPImageAttributes; const Callback: TGPDrawImageAbort;
  15974. const CallbackData: Pointer);
  15975. begin
  15976. GdipCheck(GdipDrawImagePointsRectI(FNativeHandle, GdipHandle(Image),
  15977. @DestPoints, 3, SrcX, SrcY, SrcWidth, SrcHeight, SrcUnit,
  15978. GdipHandle(ImageAttributes), Callback, CallbackData));
  15979. end;
  15980.  
  15981. procedure TGPGraphics.DrawImage(const Image: IGPImage; const DstX, DstY, DstWidth,
  15982. DstHeight, SrcX, SrcY, SrcWidth, SrcHeight: Single; const SrcUnit: TGPUnit;
  15983. const ImageAttributes: IGPImageAttributes; const Callback: TGPDrawImageAbort;
  15984. const CallbackData: Pointer);
  15985. begin
  15986. GdipCheck(GdipDrawImageRectRect(FNativeHandle, GdipHandle(Image),
  15987. DstX, DstY, DstWidth, DstHeight, SrcX, SrcY, SrcWidth, SrcHeight,
  15988. SrcUnit, GdipHandle(ImageAttributes), Callback, CallbackData));
  15989. end;
  15990.  
  15991. procedure TGPGraphics.DrawImage(const Image: IGPImage; const DstX, DstY, DstWidth,
  15992. DstHeight, SrcX, SrcY, SrcWidth, SrcHeight: Integer; const SrcUnit: TGPUnit;
  15993. const ImageAttributes: IGPImageAttributes; const Callback: TGPDrawImageAbort;
  15994. const CallbackData: Pointer);
  15995. begin
  15996. GdipCheck(GdipDrawImageRectRectI(FNativeHandle, GdipHandle(Image),
  15997. DstX, DstY, DstWidth, DstHeight, SrcX, SrcY, SrcWidth, SrcHeight,
  15998. SrcUnit, GdipHandle(ImageAttributes), Callback, CallbackData));
  15999. end;
  16000.  
  16001. procedure TGPGraphics.DrawImage(const Image: IGPImage; const Rect: TGPRect);
  16002. begin
  16003. DrawImage(Image, Rect.X, Rect.Y, Rect.Width, Rect.Height);
  16004. end;
  16005.  
  16006. procedure TGPGraphics.DrawImage(const Image: IGPImage;
  16007. const DestPoints: TGPPlgPointsF; const SrcX, SrcY, SrcWidth,
  16008. SrcHeight: Single; const SrcUnit: TGPUnit;
  16009. const ImageAttributes: IGPImageAttributes; const Callback: TGPDrawImageAbort;
  16010. const CallbackData: Pointer);
  16011. begin
  16012. GdipCheck(GdipDrawImagePointsRect(FNativeHandle, GdipHandle(Image),
  16013. @DestPoints, 3, SrcX, SrcY, SrcWidth, SrcHeight, SrcUnit,
  16014. GdipHandle(ImageAttributes), Callback, CallbackData));
  16015. end;
  16016.  
  16017. procedure TGPGraphics.DrawImage(const Image: IGPImage; const DestRect: TGPRectF;
  16018. const SrcX, SrcY, SrcWidth, SrcHeight: Single; const SrcUnit: TGPUnit;
  16019. const ImageAttributes: IGPImageAttributes; const Callback: TGPDrawImageAbort;
  16020. const CallbackData: Pointer);
  16021. begin
  16022. GdipCheck(GdipDrawImageRectRect(FNativeHandle, GdipHandle(Image),
  16023. DestRect.X, DestRect.Y, DestRect.Width, DestRect.Height,
  16024. SrcX, SrcY, SrcWidth, SrcHeight, SrcUnit, GdipHandle(ImageAttributes),
  16025. Callback, CallbackData));
  16026. end;
  16027.  
  16028. procedure TGPGraphics.DrawImage(const Image: IGPImage; const X, Y, Width,
  16029. Height: Single);
  16030. begin
  16031. GdipCheck(GdipDrawImageRect(FNativeHandle, GdipHandle(Image), X, Y, Width, Height));
  16032. end;
  16033.  
  16034. procedure TGPGraphics.DrawImage(const Image: IGPImage; const Point: TGPPoint);
  16035. begin
  16036. DrawImage(Image, Point.X, Point.Y);
  16037. end;
  16038.  
  16039. procedure TGPGraphics.DrawImage(const Image: IGPImage; const X, Y: Integer);
  16040. begin
  16041. GdipCheck(GdipDrawImageI(FNativeHandle, GdipHandle(Image), X, Y));
  16042. end;
  16043.  
  16044. procedure TGPGraphics.DrawImage(const Image: IGPImage; const Rect: TGPRectF);
  16045. begin
  16046. DrawImage(Image, Rect.X, Rect.Y, Rect.Width, Rect.Height);
  16047. end;
  16048.  
  16049. procedure TGPGraphics.DrawImage(const Image: IGPImage; const X, Y, SrcX, SrcY,
  16050. SrcWidth, SrcHeight: Integer; const SrcUnit: TGPUnit);
  16051. begin
  16052. GdipCheck(GdipDrawImagePointRectI(FNativeHandle, GdipHandle(Image),
  16053. X, Y, SrcX, SrcY, SrcWidth, SrcHeight, SrcUnit));
  16054. end;
  16055.  
  16056. procedure TGPGraphics.DrawImage(const Image: IGPImage; const Point: TGPPointF);
  16057. begin
  16058. DrawImage(Image, Point.X, Point.Y);
  16059. end;
  16060.  
  16061. procedure TGPGraphics.DrawImage(const Image: IGPImage; const X, Y: Single);
  16062. begin
  16063. GdipCheck(GdipDrawImage(FNativeHandle, GdipHandle(Image), X, Y));
  16064. end;
  16065.  
  16066. procedure TGPGraphics.DrawImage(const Image: IGPImage;
  16067. const DestPoints: TGPPlgPoints);
  16068. begin
  16069. GdipCheck(GdipDrawImagePointsI(FNativeHandle, GdipHandle(Image), @DestPoints[0], 3));
  16070. end;
  16071.  
  16072. procedure TGPGraphics.DrawImage(const Image: IGPImage;
  16073. const DestPoints: TGPPlgPointsF);
  16074. begin
  16075. GdipCheck(GdipDrawImagePoints(FNativeHandle, GdipHandle(Image), @DestPoints[0], 3));
  16076. end;
  16077.  
  16078. procedure TGPGraphics.DrawImage(const Image: IGPImage; const X, Y, Width,
  16079. Height: Integer);
  16080. begin
  16081. GdipCheck(GdipDrawImageRectI(FNativeHandle, GdipHandle(Image), X, Y, Width, Height));
  16082. end;
  16083.  
  16084. {$IF (GDIPVER >= $0110)}
  16085. procedure TGPGraphics.DrawImage(const Image: IGPImage; const DestRect,
  16086. SourceRect: TGPRectF; const SrcUnit: TGPUnit;
  16087. const ImageAttributes: IGPImageAttributes);
  16088. begin
  16089. GdipCheck(GdipDrawImageRectRect(FNativeHandle, Image.NativeHandle,
  16090. DestRect.X, DestRect.Y, DestRect.Width, DestRect.Height,
  16091. SourceRect.X, SourceRect.Y, SourceRect.Width, SourceRect.Height,
  16092. SrcUnit, GdipHandle(ImageAttributes), nil, nil));
  16093. end;
  16094.  
  16095. procedure TGPGraphics.DrawImage(const Image: IGPImage; const SourceRect: TGPRectF;
  16096. const XForm: IGPMatrix; const Effect: IGPEffect;
  16097. const ImageAttributes: IGPImageAttributes; const SrcUnit: TGPUnit);
  16098. begin
  16099. GdipCheck(GdipDrawImageFX(FNativeHandle, Image.NativeHandle, @SourceRect,
  16100. GdipHandle(XForm), GdipHandle(Effect), GdipHandle(ImageAttributes), SrcUnit));
  16101. end;
  16102. {$IFEND}
  16103.  
  16104. procedure TGPGraphics.DrawLine(const Pen: IGPPen; const Pt1, Pt2: TGPPoint);
  16105. begin
  16106. DrawLine(Pen, Pt1.X, Pt1.Y, Pt2.X, Pt2.Y);
  16107. end;
  16108.  
  16109. procedure TGPGraphics.DrawLine(const Pen: IGPPen; const X1, Y1, X2, Y2: Single);
  16110. begin
  16111. GdipCheck(GdipDrawLine(FNativeHandle, Pen.NativeHandle, X1, Y1, X2, Y2));
  16112. end;
  16113.  
  16114. procedure TGPGraphics.DrawLine(const Pen: IGPPen; const Pt1, Pt2: TGPPointF);
  16115. begin
  16116. DrawLine(Pen, Pt1.X, Pt1.Y, Pt2.X, Pt2.Y);
  16117. end;
  16118.  
  16119. procedure TGPGraphics.DrawLine(const Pen: IGPPen; const X1, Y1, X2, Y2: Integer);
  16120. begin
  16121. GdipCheck(GdipDrawLineI(FNativeHandle, Pen.NativeHandle, X1, Y1, X2, Y2));
  16122. end;
  16123.  
  16124. procedure TGPGraphics.DrawLines(const Pen: IGPPen; const Points: array of TGPPoint);
  16125. begin
  16126. Assert(Length(Points) > 0);
  16127. GdipCheck(GdipDrawLinesI(FNativeHandle, Pen.NativeHandle, @Points[0], Length(Points)));
  16128. end;
  16129.  
  16130. procedure TGPGraphics.DrawLines(const Pen: IGPPen; const Points: array of TGPPointF);
  16131. begin
  16132. Assert(Length(Points) > 0);
  16133. GdipCheck(GdipDrawLines(FNativeHandle, Pen.NativeHandle, @Points[0], Length(Points)));
  16134. end;
  16135.  
  16136. procedure TGPGraphics.DrawPath(const Pen: IGPPen; const Path: IGPGraphicsPath);
  16137. begin
  16138. GdipCheck(GdipDrawPath(FNativeHandle, GdipHandle(Pen), GdipHandle(Path)));
  16139. end;
  16140.  
  16141. procedure TGPGraphics.DrawPie(const Pen: IGPPen; const X, Y, Width, Height,
  16142. StartAngle, SweepAngle: Single);
  16143. begin
  16144. GdipCheck(GdipDrawPie(FNativeHandle, Pen.NativeHandle, X, Y, Width, Height,
  16145. StartAngle, SweepAngle));
  16146. end;
  16147.  
  16148. procedure TGPGraphics.DrawPie(const Pen: IGPPen; const Rect: TGPRectF;
  16149. const StartAngle, SweepAngle: Single);
  16150. begin
  16151. DrawPie(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height, StartAngle, SweepAngle);
  16152. end;
  16153.  
  16154. procedure TGPGraphics.DrawPie(const Pen: IGPPen; const X, Y, Width, Height: Integer;
  16155. const StartAngle, SweepAngle: Single);
  16156. begin
  16157. GdipCheck(GdipDrawPieI(FNativeHandle, Pen.NativeHandle, X, Y, Width, Height,
  16158. StartAngle, SweepAngle));
  16159. end;
  16160.  
  16161. procedure TGPGraphics.DrawPie(const Pen: IGPPen; const Rect: TGPRect;
  16162. const StartAngle, SweepAngle: Single);
  16163. begin
  16164. DrawPie(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height, StartAngle, SweepAngle);
  16165. end;
  16166.  
  16167. procedure TGPGraphics.DrawPolygon(const Pen: IGPPen; const Points: array of TGPPoint);
  16168. begin
  16169. Assert(Length(Points) > 0);
  16170. GdipCheck(GdipDrawPolygonI(FNativeHandle, Pen.NativeHandle, @Points[0], Length(Points)));
  16171. end;
  16172.  
  16173. procedure TGPGraphics.DrawPolygon(const Pen: IGPPen;
  16174. const Points: array of TGPPointF);
  16175. begin
  16176. Assert(Length(Points) > 0);
  16177. GdipCheck(GdipDrawPolygon(FNativeHandle, Pen.NativeHandle, @Points[0], Length(Points)));
  16178. end;
  16179.  
  16180. procedure TGPGraphics.DrawRectangle(const Pen: IGPPen; const Rect: TGPRectF);
  16181. begin
  16182. DrawRectangle(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height);
  16183. end;
  16184.  
  16185. procedure TGPGraphics.DrawRectangle(const Pen: IGPPen; const Rect: TGPRect);
  16186. begin
  16187. DrawRectangle(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height);
  16188. end;
  16189.  
  16190. procedure TGPGraphics.DrawRectangle(const Pen: IGPPen; const X, Y, Width,
  16191. Height: Single);
  16192. begin
  16193. GdipCheck(GdipDrawRectangle(FNativeHandle, Pen.NativeHandle, X, Y, Width, Height));
  16194. end;
  16195.  
  16196. procedure TGPGraphics.DrawRectangle(const Pen: IGPPen; const X, Y, Width,
  16197. Height: Integer);
  16198. begin
  16199. GdipCheck(GdipDrawRectangleI(FNativeHandle, Pen.NativeHandle, X, Y, Width, Height));
  16200. end;
  16201.  
  16202. procedure TGPGraphics.DrawRectangles(const Pen: IGPPen;
  16203. const Rects: array of TGPRect);
  16204. begin
  16205. Assert(Length(Rects) > 0);
  16206. GdipCheck(GdipDrawRectanglesI(FNativeHandle, Pen.NativeHandle, @Rects[0], Length(Rects)));
  16207. end;
  16208.  
  16209. procedure TGPGraphics.DrawRectangles(const Pen: IGPPen;
  16210. const Rects: array of TGPRectF);
  16211. begin
  16212. Assert(Length(Rects) > 0);
  16213. GdipCheck(GdipDrawRectangles(FNativeHandle, Pen.NativeHandle, @Rects[0], Length(Rects)));
  16214. end;
  16215.  
  16216. procedure TGPGraphics.DrawString(const Str: String; const Font: IGPFont;
  16217. const Origin: TGPPointF; const Brush: IGPBrush);
  16218. var
  16219. Rect: TGPRectF;
  16220. begin
  16221. Rect.Initialize(Origin.X, Origin.Y, 0, 0);
  16222. GdipCheck(GdipDrawString(FNativeHandle, PWideChar(Str), Length(Str),
  16223. GdipHandle(Font), @Rect, nil, GdipHandle(Brush)));
  16224. end;
  16225.  
  16226. procedure TGPGraphics.DrawString(const Str: String; const Font: IGPFont;
  16227. const Origin: TGPPointF; const Format: IGPStringFormat; const Brush: IGPBrush);
  16228. var
  16229. Rect: TGPRectF;
  16230. begin
  16231. Rect.Initialize(Origin.X, Origin.Y, 0, 0);
  16232. GdipCheck(GdipDrawString(FNativeHandle, PWideChar(Str), Length(Str),
  16233. GdipHandle(Font), @Rect, GdipHandle(Format), GdipHandle(Brush)));
  16234. end;
  16235.  
  16236. procedure TGPGraphics.DrawString(const Str: String; const Font: IGPFont;
  16237. const LayoutRect: TGPRectF; const Format: IGPStringFormat; const Brush: IGPBrush);
  16238. begin
  16239. GdipCheck(GdipDrawString(FNativeHandle, PWideChar(Str), Length(Str),
  16240. GdipHandle(Font), @LayoutRect, GdipHandle(Format), GdipHandle(Brush)));
  16241. end;
  16242.  
  16243. procedure TGPGraphics.EndContainer(const State: TGPGraphicsContainer);
  16244. begin
  16245. GdipCheck(GdipEndContainer(FNativeHandle, State));
  16246. end;
  16247.  
  16248. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile; const DestRect,
  16249. SrcRect: TGPRectF; const SrcUnit: TGPUnit; const Callback: TGPEnumerateMetafileProc;
  16250. const CallbackData: Pointer; const ImageAttributes: IGPImageAttributes);
  16251. begin
  16252. GdipCheck(GdipEnumerateMetafileSrcRectDestRect(FNativeHandle,
  16253. GdipHandle(Metafile), @DestRect, @SrcRect, SrcUnit, Callback,
  16254. CallbackData, GdipHandle(ImageAttributes)));
  16255. end;
  16256.  
  16257. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile;
  16258. const DestPoint: TGPPoint; const SrcRect: TGPRect; const SrcUnit: TGPUnit;
  16259. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer;
  16260. const ImageAttributes: IGPImageAttributes);
  16261. begin
  16262. GdipCheck(GdipEnumerateMetafileSrcRectDestPointI(FNativeHandle,
  16263. GdipHandle(Metafile), @DestPoint, @SrcRect, SrcUnit, Callback,
  16264. CallbackData, GdipHandle(ImageAttributes)));
  16265. end;
  16266.  
  16267. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile;
  16268. const DestPoint: TGPPointF; const SrcRect: TGPRectF; const SrcUnit: TGPUnit;
  16269. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer;
  16270. const ImageAttributes: IGPImageAttributes);
  16271. begin
  16272. GdipCheck(GdipEnumerateMetafileSrcRectDestPoint(FNativeHandle,
  16273. GdipHandle(Metafile), @DestPoint, @SrcRect, SrcUnit, Callback,
  16274. CallbackData, GdipHandle(ImageAttributes)));
  16275. end;
  16276.  
  16277. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile;
  16278. const DestPoints: TGPPlgPoints; const SrcRect: TGPRect; const SrcUnit: TGPUnit;
  16279. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer;
  16280. const ImageAttributes: IGPImageAttributes);
  16281. begin
  16282. GdipCheck(GdipEnumerateMetafileSrcRectDestPointsI(FNativeHandle,
  16283. GdipHandle(Metafile), @DestPoints[0], 3, @SrcRect, SrcUnit, Callback,
  16284. CallbackData, GdipHandle(ImageAttributes)));
  16285. end;
  16286.  
  16287. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile;
  16288. const DestPoints: TGPPlgPointsF; const SrcRect: TGPRectF; const SrcUnit: TGPUnit;
  16289. const Callback: TGPEnumerateMetafileProc; const CallbackData: Pointer;
  16290. const ImageAttributes: IGPImageAttributes);
  16291. begin
  16292. GdipCheck(GdipEnumerateMetafileSrcRectDestPoints(FNativeHandle,
  16293. GdipHandle(Metafile), @DestPoints[0], 3, @SrcRect, SrcUnit, Callback,
  16294. CallbackData, GdipHandle(ImageAttributes)));
  16295. end;
  16296.  
  16297. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile; const DestRect,
  16298. SrcRect: TGPRect; const SrcUnit: TGPUnit; const Callback: TGPEnumerateMetafileProc;
  16299. const CallbackData: Pointer; const ImageAttributes: IGPImageAttributes);
  16300. begin
  16301. GdipCheck(GdipEnumerateMetafileSrcRectDestRectI(FNativeHandle,
  16302. GdipHandle(Metafile), @DestRect, @SrcRect, SrcUnit, Callback,
  16303. CallbackData, GdipHandle(ImageAttributes)));
  16304. end;
  16305.  
  16306. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile;
  16307. const DestRect: TGPRectF; const Callback: TGPEnumerateMetafileProc;
  16308. const CallbackData: Pointer; const ImageAttributes: IGPImageAttributes);
  16309. begin
  16310. GdipCheck(GdipEnumerateMetafileDestRect(FNativeHandle, GdipHandle(Metafile),
  16311. @DestRect, Callback, CallbackData, GdipHandle(ImageAttributes)));
  16312. end;
  16313.  
  16314. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile;
  16315. const DestPoint: TGPPoint; const Callback: TGPEnumerateMetafileProc;
  16316. const CallbackData: Pointer; const ImageAttributes: IGPImageAttributes);
  16317. begin
  16318. GdipCheck(GdipEnumerateMetafileDestPointI(FNativeHandle, GdipHandle(Metafile),
  16319. @DestPoint, Callback, CallbackData, GdipHandle(ImageAttributes)));
  16320. end;
  16321.  
  16322. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile;
  16323. const DestPoint: TGPPointF; const Callback: TGPEnumerateMetafileProc;
  16324. const CallbackData: Pointer; const ImageAttributes: IGPImageAttributes);
  16325. begin
  16326. GdipCheck(GdipEnumerateMetafileDestPoint(FNativeHandle, GdipHandle(Metafile),
  16327. @DestPoint, Callback, CallbackData, GdipHandle(ImageAttributes)));
  16328. end;
  16329.  
  16330. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile;
  16331. const DestPoints: TGPPlgPoints; const Callback: TGPEnumerateMetafileProc;
  16332. const CallbackData: Pointer; const ImageAttributes: IGPImageAttributes);
  16333. begin
  16334. GdipCheck(GdipEnumerateMetafileDestPointsI(FNativeHandle, GdipHandle(Metafile),
  16335. @DestPoints[0], 3, Callback, CallbackData, GdipHandle(ImageAttributes)));
  16336. end;
  16337.  
  16338. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile;
  16339. const DestPoints: TGPPlgPointsF; const Callback: TGPEnumerateMetafileProc;
  16340. const CallbackData: Pointer; const ImageAttributes: IGPImageAttributes);
  16341. begin
  16342. GdipCheck(GdipEnumerateMetafileDestPoints(FNativeHandle, GdipHandle(Metafile),
  16343. @DestPoints[0], 3, Callback, CallbackData, GdipHandle(ImageAttributes)));
  16344. end;
  16345.  
  16346. procedure TGPGraphics.EnumerateMetafile(const Metafile: IGPMetafile;
  16347. const DestRect: TGPRect; const Callback: TGPEnumerateMetafileProc;
  16348. const CallbackData: Pointer; const ImageAttributes: IGPImageAttributes);
  16349. begin
  16350. GdipCheck(GdipEnumerateMetafileDestRectI(FNativeHandle, GdipHandle(Metafile),
  16351. @DestRect, Callback, CallbackData, GdipHandle(ImageAttributes)));
  16352. end;
  16353.  
  16354. procedure TGPGraphics.ExcludeClip(const Region: IGPRegion);
  16355. begin
  16356. GdipCheck(GdipSetClipRegion(FNativeHandle, Region.NativeHandle, CombineModeExclude));
  16357. end;
  16358.  
  16359. procedure TGPGraphics.ExcludeClip(const Rect: TGPRect);
  16360. begin
  16361. GdipCheck(GdipSetClipRectI(FNativeHandle, Rect.X, Rect.Y, Rect.Width,
  16362. Rect.Height, CombineModeExclude));
  16363. end;
  16364.  
  16365. procedure TGPGraphics.ExcludeClip(const Rect: TGPRectF);
  16366. begin
  16367. GdipCheck(GdipSetClipRect(FNativeHandle, Rect.X, Rect.Y, Rect.Width,
  16368. Rect.Height, CombineModeExclude));
  16369. end;
  16370.  
  16371. procedure TGPGraphics.FillClosedCurve(const Brush: IGPBrush;
  16372. const Points: array of TGPPointF);
  16373. begin
  16374. Assert(Length(Points) > 0);
  16375. GdipCheck(GdipFillClosedCurve(FNativeHandle, Brush.NativeHandle, @Points[0],
  16376. Length(Points)));
  16377. end;
  16378.  
  16379. procedure TGPGraphics.FillClosedCurve(const Brush: IGPBrush;
  16380. const Points: array of TGPPoint);
  16381. begin
  16382. Assert(Length(Points) > 0);
  16383. GdipCheck(GdipFillClosedCurveI(FNativeHandle, Brush.NativeHandle, @Points[0],
  16384. Length(Points)));
  16385. end;
  16386.  
  16387. procedure TGPGraphics.FillClosedCurve(const Brush: IGPBrush;
  16388. const Points: array of TGPPoint; const FillMode: TGPFillMode;
  16389. const Tension: Single);
  16390. begin
  16391. Assert(Length(Points) > 0);
  16392. GdipCheck(GdipFillClosedCurve2I(FNativeHandle, Brush.NativeHandle, @Points[0],
  16393. Length(Points), Tension, FillMode));
  16394. end;
  16395.  
  16396. procedure TGPGraphics.FillClosedCurve(const Brush: IGPBrush;
  16397. const Points: array of TGPPointF; const FillMode: TGPFillMode;
  16398. const Tension: Single);
  16399. begin
  16400. Assert(Length(Points) > 0);
  16401. GdipCheck(GdipFillClosedCurve2(FNativeHandle, Brush.NativeHandle, @Points[0],
  16402. Length(Points), Tension, FillMode));
  16403. end;
  16404.  
  16405. procedure TGPGraphics.FillEllipse(const Brush: IGPBrush; const Rect: TGPRect);
  16406. begin
  16407. FillEllipse(Brush, Rect.X, Rect.Y, Rect.Width, Rect.Height);
  16408. end;
  16409.  
  16410. procedure TGPGraphics.FillEllipse(const Brush: IGPBrush; const X, Y, Width,
  16411. Height: Integer);
  16412. begin
  16413. GdipCheck(GdipFillEllipseI(FNativeHandle, Brush.NativeHandle, X, Y, Width, Height));
  16414. end;
  16415.  
  16416. procedure TGPGraphics.FillEllipse(const Brush: IGPBrush; const Rect: TGPRectF);
  16417. begin
  16418. FillEllipse(Brush, Rect.X, Rect.Y, Rect.Width, Rect.Height);
  16419. end;
  16420.  
  16421. procedure TGPGraphics.FillEllipse(const Brush: IGPBrush; const X, Y, Width,
  16422. Height: Single);
  16423. begin
  16424. GdipCheck(GdipFillEllipse(FNativeHandle, Brush.NativeHandle, X, Y, Width, Height));
  16425. end;
  16426.  
  16427. procedure TGPGraphics.FillPath(const Brush: IGPBrush;
  16428. const Path: IGPGraphicsPath);
  16429. begin
  16430. GdipCheck(GdipFillPath(FNativeHandle, Brush.NativeHandle, Path.NativeHandle));
  16431. end;
  16432.  
  16433. procedure TGPGraphics.FillPie(const Brush: IGPBrush; const Rect: TGPRectF;
  16434. const StartAngle, SweepAngle: Single);
  16435. begin
  16436. FillPie(Brush, Rect.X, Rect.Y, Rect.Width, Rect.Height, StartAngle, SweepAngle);
  16437. end;
  16438.  
  16439. procedure TGPGraphics.FillPie(const Brush: IGPBrush; const X, Y, Width,
  16440. Height: Integer; const StartAngle, SweepAngle: Single);
  16441. begin
  16442. GdipCheck(GdipFillPieI(FNativeHandle, Brush.NativeHandle, X, Y, Width, Height,
  16443. StartAngle, SweepAngle));
  16444. end;
  16445.  
  16446. procedure TGPGraphics.FillPie(const Brush: IGPBrush; const Rect: TGPRect;
  16447. const StartAngle, SweepAngle: Single);
  16448. begin
  16449. FillPie(Brush, Rect.X, Rect.Y, Rect.Width, Rect.Height, StartAngle, SweepAngle);
  16450. end;
  16451.  
  16452. procedure TGPGraphics.FillPie(const Brush: IGPBrush; const X, Y, Width, Height,
  16453. StartAngle, SweepAngle: Single);
  16454. begin
  16455. GdipCheck(GdipFillPie(FNativeHandle, Brush.NativeHandle, X, Y, Width, Height,
  16456. StartAngle, SweepAngle));
  16457. end;
  16458.  
  16459. procedure TGPGraphics.FillPolygon(const Brush: IGPBrush;
  16460. const Points: array of TGPPoint);
  16461. begin
  16462. FillPolygon(Brush, Points, FillModeAlternate);
  16463. end;
  16464.  
  16465. procedure TGPGraphics.FillPolygon(const Brush: IGPBrush;
  16466. const Points: array of TGPPointF; const FillMode: TGPFillMode);
  16467. begin
  16468. Assert(Length(Points) > 0);
  16469. GdipCheck(GdipFillPolygon(FNativeHandle, Brush.NativeHandle, @Points[0],
  16470. Length(Points), FillMode));
  16471. end;
  16472.  
  16473. procedure TGPGraphics.FillPolygon(const Brush: IGPBrush;
  16474. const Points: array of TGPPoint; const FillMode: TGPFillMode);
  16475. begin
  16476. Assert(Length(Points) > 0);
  16477. GdipCheck(GdipFillPolygonI(FNativeHandle, Brush.NativeHandle, @Points[0],
  16478. Length(Points), FillMode));
  16479. end;
  16480.  
  16481. procedure TGPGraphics.FillPolygon(const Brush: IGPBrush;
  16482. const Points: array of TGPPointF);
  16483. begin
  16484. FillPolygon(Brush, Points, FillModeAlternate);
  16485. end;
  16486.  
  16487. procedure TGPGraphics.FillRectangle(const Brush: IGPBrush; const X, Y, Width,
  16488. Height: Integer);
  16489. begin
  16490. GdipCheck(GdipFillRectangleI(FNativeHandle, Brush.NativeHandle, X, Y, Width, Height));
  16491. end;
  16492.  
  16493. procedure TGPGraphics.FillRectangle(const Brush: IGPBrush; const Rect: TGPRect);
  16494. begin
  16495. FillRectangle(Brush, Rect.X, Rect.Y, Rect.Width, Rect.Height);
  16496. end;
  16497.  
  16498. procedure TGPGraphics.FillRectangle(const Brush: IGPBrush; const Rect: TGPRectF);
  16499. begin
  16500. FillRectangle(Brush, Rect.X, Rect.Y, Rect.Width, Rect.Height);
  16501. end;
  16502.  
  16503. procedure TGPGraphics.FillRectangle(const Brush: IGPBrush; const X, Y, Width,
  16504. Height: Single);
  16505. begin
  16506. GdipCheck(GdipFillRectangle(FNativeHandle, Brush.NativeHandle, X, Y, Width, Height));
  16507. end;
  16508.  
  16509. procedure TGPGraphics.FillRectangles(const Brush: IGPBrush;
  16510. const Rects: array of TGPRect);
  16511. begin
  16512. Assert(Length(Rects) > 0);
  16513. GdipCheck(GdipFillRectanglesI(FNativeHandle, Brush.NativeHandle, @Rects[0], Length(Rects)));
  16514. end;
  16515.  
  16516. procedure TGPGraphics.FillRectangles(const Brush: IGPBrush;
  16517. const Rects: array of TGPRectF);
  16518. begin
  16519. Assert(Length(Rects) > 0);
  16520. GdipCheck(GdipFillRectangles(FNativeHandle, Brush.NativeHandle, @Rects[0], Length(Rects)));
  16521. end;
  16522.  
  16523. procedure TGPGraphics.FillRegion(const Brush: IGPBrush; const Region: IGPRegion);
  16524. begin
  16525. GdipCheck(GdipFillRegion(FNativeHandle, Brush.NativeHandle, Region.NativeHandle));
  16526. end;
  16527.  
  16528. procedure TGPGraphics.Flush(const Intention: TGPFlushIntention);
  16529. begin
  16530. GdipFlush(FNativeHandle, Intention);
  16531. end;
  16532.  
  16533. class function TGPGraphics.FromHDC(const DC: HDC): IGPGraphics;
  16534. begin
  16535. Result := TGPGraphics.Create(DC);
  16536. end;
  16537.  
  16538. class function TGPGraphics.FromHDC(const DC: HDC;
  16539. const Device: THandle): IGPGraphics;
  16540. begin
  16541. Result := TGPGraphics.Create(DC, Device);
  16542. end;
  16543.  
  16544. class function TGPGraphics.FromHWnd(const Window: HWnd;
  16545. const ICM: Boolean): IGPGraphics;
  16546. begin
  16547. Result := TGPGraphics.Create(Window, ICM);
  16548. end;
  16549.  
  16550. class function TGPGraphics.FromImage(const Image: IGPImage): IGPGraphics;
  16551. begin
  16552. Result := TGPGraphics.Create(Image);
  16553. end;
  16554.  
  16555. function TGPGraphics.GetClip: IGPRegion;
  16556. begin
  16557. Result := TGPRegion.Create;
  16558. GdipCheck(GdipGetClip(FNativeHandle, Result.NativeHandle));
  16559. end;
  16560.  
  16561. function TGPGraphics.GetClipBounds: TGPRectF;
  16562. begin
  16563. GdipCheck(GdipGetClipBounds(FNativeHandle, Result));
  16564. end;
  16565.  
  16566. function TGPGraphics.GetClipBoundsI: TGPRect;
  16567. begin
  16568. GdipCheck(GdipGetClipBoundsI(FNativeHandle, Result));
  16569. end;
  16570.  
  16571. function TGPGraphics.GetCompositingMode: TGPCompositingMode;
  16572. begin
  16573. GdipCheck(GdipGetCompositingMode(FNativeHandle, Result));
  16574. end;
  16575.  
  16576. function TGPGraphics.GetCompositingQuality: TGPCompositingQuality;
  16577. begin
  16578. GdipCheck(GdipGetCompositingQuality(FNativeHandle, Result));
  16579. end;
  16580.  
  16581. function TGPGraphics.GetDpiX: Single;
  16582. begin
  16583. GdipCheck(GdipGetDpiX(FNativeHandle, Result));
  16584. end;
  16585.  
  16586. function TGPGraphics.GetDpiY: Single;
  16587. begin
  16588. GdipCheck(GdipGetDpiY(FNativeHandle, Result));
  16589. end;
  16590.  
  16591. function TGPGraphics.GetHDC: HDC;
  16592. begin
  16593. Result := 0;
  16594. GdipCheck(GdipGetDC(FNativeHandle, Result));
  16595. end;
  16596.  
  16597. function TGPGraphics.GetInterpolationMode: TGPInterpolationMode;
  16598. begin
  16599. GdipCheck(GdipGetInterpolationMode(FNativeHandle, Result));
  16600. end;
  16601.  
  16602. function TGPGraphics.GetIsClipEmpty: Boolean;
  16603. var
  16604. B: Bool;
  16605. begin
  16606. B := False;
  16607. GdipCheck(GdipIsClipEmpty(FNativeHandle, B));
  16608. Result := B;
  16609. end;
  16610.  
  16611. function TGPGraphics.GetIsVisibleClipEmpty: Boolean;
  16612. var
  16613. B: Bool;
  16614. begin
  16615. B := False;
  16616. GdipCheck(GdipIsVisibleClipEmpty(FNativeHandle, B));
  16617. Result := B;
  16618. end;
  16619.  
  16620. function TGPGraphics.GetNearestColor(const Color: TGPColor): TGPColor;
  16621. var
  16622. C: ARGB;
  16623. begin
  16624. C := Color.Value;
  16625. GdipCheck(GdipGetNearestColor(FNativeHandle, @C));
  16626. Result.Value := C;
  16627. end;
  16628.  
  16629. function TGPGraphics.GetPageScale: Single;
  16630. begin
  16631. GdipCheck(GdipGetPageScale(FNativeHandle, Result));
  16632. end;
  16633.  
  16634. function TGPGraphics.GetPageUnit: TGPUnit;
  16635. begin
  16636. GdipCheck(GdipGetPageUnit(FNativeHandle, Result));
  16637. end;
  16638.  
  16639. function TGPGraphics.GetPixelOffsetMode: TGPPixelOffsetMode;
  16640. begin
  16641. GdipCheck(GdipGetPixelOffsetMode(FNativeHandle, Result));
  16642. end;
  16643.  
  16644. procedure TGPGraphics.GetRenderingOrigin(out X, Y: Integer);
  16645. begin
  16646. GdipCheck(GdipGetRenderingOrigin(FNativeHandle, X, Y));
  16647. end;
  16648.  
  16649. function TGPGraphics.GetRenderingOrigin: TGPPoint;
  16650. begin
  16651. GdipCheck(GdipGetRenderingOrigin(FNativeHandle, Result.X, Result.Y));
  16652. end;
  16653.  
  16654. function TGPGraphics.GetSmoothingMode: TGPSmoothingMode;
  16655. begin
  16656. GdipCheck(GdipGetSmoothingMode(FNativeHandle, Result));
  16657. end;
  16658.  
  16659. function TGPGraphics.GetTextContrast: Integer;
  16660. begin
  16661. GdipCheck(GdipGetTextContrast(FNativeHandle, Result));
  16662. end;
  16663.  
  16664. function TGPGraphics.GetTextRenderingHint: TGPTextRenderingHint;
  16665. begin
  16666. GdipCheck(GdipGetTextRenderingHint(FNativeHandle, Result));
  16667. end;
  16668.  
  16669. function TGPGraphics.GetTransform: IGPMatrix;
  16670. begin
  16671. Result := TGPMatrix.Create;
  16672. GdipCheck(GdipGetWorldTransform(FNativeHandle, Result.NativeHandle));
  16673. end;
  16674.  
  16675. function TGPGraphics.GetVisibleClipBounds: TGPRectF;
  16676. begin
  16677. GdipCheck(GdipGetVisibleClipBounds(FNativeHandle, Result));
  16678. end;
  16679.  
  16680. function TGPGraphics.GetVisibleClipBoundsI: TGPRect;
  16681. begin
  16682. GdipCheck(GdipGetVisibleClipBoundsI(FNativeHandle, Result));
  16683. end;
  16684.  
  16685. procedure TGPGraphics.IntersectClip(const Rect: TGPRectF);
  16686. begin
  16687. GdipCheck(GdipSetClipRect(FNativeHandle, Rect.X, Rect.Y, Rect.Width,
  16688. Rect.Height, CombineModeIntersect));
  16689. end;
  16690.  
  16691. procedure TGPGraphics.IntersectClip(const Rect: TGPRect);
  16692. begin
  16693. GdipCheck(GdipSetClipRectI(FNativeHandle, Rect.X, Rect.Y, Rect.Width,
  16694. Rect.Height, CombineModeIntersect));
  16695. end;
  16696.  
  16697. procedure TGPGraphics.IntersectClip(const Region: IGPRegion);
  16698. begin
  16699. GdipCheck(GdipSetClipRegion(FNativeHandle, Region.NativeHandle, CombineModeIntersect));
  16700. end;
  16701.  
  16702. function TGPGraphics.IsVisible(const Rect: TGPRect): Boolean;
  16703. begin
  16704. Result := IsVisible(Rect.X, Rect.Y, Rect.Width, Rect.Height);
  16705. end;
  16706.  
  16707. function TGPGraphics.IsVisible(const Rect: TGPRectF): Boolean;
  16708. begin
  16709. Result := IsVisible(Rect.X, Rect.Y, Rect.Width, Rect.Height);
  16710. end;
  16711.  
  16712. function TGPGraphics.IsVisible(const X, Y, Width, Height: Integer): Boolean;
  16713. var
  16714. B: Bool;
  16715. begin
  16716. B := False;
  16717. GdipCheck(GdipIsVisibleRectI(FNativeHandle, X, Y, Width, Height, B));
  16718. Result := B;
  16719. end;
  16720.  
  16721. function TGPGraphics.IsVisible(const X, Y: Integer): Boolean;
  16722. var
  16723. B: Bool;
  16724. begin
  16725. B := False;
  16726. GdipCheck(GdipIsVisiblePointI(FNativeHandle, X, Y, B));
  16727. Result := B;
  16728. end;
  16729.  
  16730. function TGPGraphics.IsVisible(const Point: TGPPoint): Boolean;
  16731. begin
  16732. Result := IsVisible(Point.X, Point.Y);
  16733. end;
  16734.  
  16735. function TGPGraphics.IsVisible(const X, Y, Width, Height: Single): Boolean;
  16736. var
  16737. B: Bool;
  16738. begin
  16739. B := False;
  16740. GdipCheck(GdipIsVisibleRect(FNativeHandle, X, Y, Width, Height, B));
  16741. Result := B;
  16742. end;
  16743.  
  16744. function TGPGraphics.IsVisible(const Point: TGPPointF): Boolean;
  16745. begin
  16746. Result := IsVisible(Point.X, Point.Y);
  16747. end;
  16748.  
  16749. function TGPGraphics.IsVisible(const X, Y: Single): Boolean;
  16750. var
  16751. B: Bool;
  16752. begin
  16753. B := False;
  16754. GdipCheck(GdipIsVisiblePoint(FNativeHandle, X, Y, B));
  16755. Result := B;
  16756. end;
  16757.  
  16758. function TGPGraphics.MeasureCharacterRanges(const Str: String; const Font: IGPFont;
  16759. const LayoutRect: TGPRectF; const Format: IGPStringFormat): IGPRegions;
  16760. var
  16761. I, Count: Integer;
  16762. NativeRegions: array of GpRegion;
  16763. begin
  16764. if (Format = nil) then
  16765. GdipCheck(InvalidParameter);
  16766. Count := Format.MeasurableCharacterRangeCount;
  16767. SetLength(NativeRegions, Count);
  16768. Result := TGPArray<IGPRegion>.Create(Count);
  16769. for I := 0 to Count - 1 do
  16770. begin
  16771. Result[I] := TGPRegion.Create;
  16772. NativeRegions[I] := Result[I].NativeHandle;
  16773. end;
  16774. GdipCheck(GdipMeasureCharacterRanges(FNativeHandle, PWideChar(Str),
  16775. Length(Str), GdipHandle(Font), @LayoutRect, Format.NativeHandle,
  16776. Count, @NativeRegions[0]));
  16777. end;
  16778.  
  16779. function TGPGraphics.MeasureDriverString(const Text: PUInt16;
  16780. const Length: Integer; const Font: IGPFont; const Positions: PGPPointF;
  16781. const Flags: TGPDriverStringOptions; const Matrix: IGPMatrix): TGPRectF;
  16782. begin
  16783. GdipCheck(GdipMeasureDriverString(FNativeHandle, Text, Length,
  16784. GdipHandle(Font), Positions, Flags, GdipHandle(Matrix),
  16785. Result));
  16786. end;
  16787.  
  16788. function TGPGraphics.MeasureString(const Str: String; const Font: IGPFont;
  16789. const LayoutRect: TGPRectF; const Format: IGPStringFormat): TGPRectF;
  16790. var
  16791. CodepointsFitted, LinesFilled: Integer;
  16792. begin
  16793. Result := MeasureString(Str, Font, LayoutRect, Format, CodepointsFitted, LinesFilled);
  16794. end;
  16795.  
  16796. function TGPGraphics.MeasureString(const Str: String; const Font: IGPFont;
  16797. const LayoutRect: TGPRectF; const Format: IGPStringFormat; out CodepointsFitted,
  16798. LinesFilled: Integer): TGPRectF;
  16799. begin
  16800. GdipCheck(GdipMeasureString(FNativeHandle, PWideChar(Str), Length(Str),
  16801. GdipHandle(Font), @LayoutRect, GdipHandle(Format), Result,
  16802. @CodepointsFitted, @LinesFilled));
  16803. end;
  16804.  
  16805. function TGPGraphics.MeasureString(const Str: String; const Font: IGPFont;
  16806. const LayoutRect: TGPRectF): TGPRectF;
  16807. begin
  16808. GdipCheck(GdipMeasureString(FNativeHandle, PWideChar(Str), Length(Str),
  16809. GdipHandle(Font), @LayoutRect, nil, Result, nil, nil));
  16810. end;
  16811.  
  16812. function TGPGraphics.MeasureString(const Str: String; const Font: IGPFont;
  16813. const Origin: TGPPointF): TGPRectF;
  16814. var
  16815. Rect: TGPRectF;
  16816. begin
  16817. Rect.Initialize(Origin.X, Origin.Y, 0, 0);
  16818. GdipCheck(GdipMeasureString(FNativeHandle, PWideChar(Str), Length(Str),
  16819. GdipHandle(Font), @Rect, nil, Result, nil, nil));
  16820. end;
  16821.  
  16822. function TGPGraphics.MeasureString(const Str: String; const Font: IGPFont;
  16823. const Origin: TGPPointF; const Format: IGPStringFormat): TGPRectF;
  16824. var
  16825. Rect: TGPRectF;
  16826. begin
  16827. Rect.Initialize(Origin.X, Origin.Y, 0, 0);
  16828. GdipCheck(GdipMeasureString(FNativeHandle, PWideChar(Str), Length(Str),
  16829. GdipHandle(Font), @Rect, GdipHandle(Format), Result, nil, nil));
  16830. end;
  16831.  
  16832. function TGPGraphics.MeasureString(const Str: String; const Font: IGPFont;
  16833. const LayoutRectSize: TGPSizeF; const Format: IGPStringFormat): TGPSizeF;
  16834. var
  16835. CodepointsFitted, LinesFilled: Integer;
  16836. begin
  16837. Result := MeasureString(Str, Font, LayoutRectSize, Format, CodepointsFitted, LinesFilled);
  16838. end;
  16839.  
  16840. function TGPGraphics.MeasureString(const Str: String; const Font: IGPFont;
  16841. const LayoutRectSize: TGPSizeF; const Format: IGPStringFormat;
  16842. out CodepointsFitted, LinesFilled: Integer): TGPSizeF;
  16843. var
  16844. LayoutRect, BoundingBox: TGPRectF;
  16845. begin
  16846. LayoutRect.Initialize(0, 0, LayoutRectSize.Width, LayoutRectSize.Height);
  16847. GdipCheck(GdipMeasureString(FNativeHandle, PWideChar(Str), Length(Str),
  16848. GdipHandle(Font), @LayoutRect, GdipHandle(Format), BoundingBox,
  16849. @CodepointsFitted, @LinesFilled));
  16850. Result.Width := BoundingBox.Width;
  16851. Result.Height := BoundingBox.Height;
  16852. end;
  16853.  
  16854. procedure TGPGraphics.MultiplyTransform(const Matrix: IGPMatrix;
  16855. const Order: TGPMatrixOrder);
  16856. begin
  16857. GdipCheck(GdipMultiplyWorldTransform(FNativeHandle, Matrix.NativeHandle, Order));
  16858. end;
  16859.  
  16860. procedure TGPGraphics.ReleaseHDC(const DC: HDC);
  16861. begin
  16862. GdipCheck(GdipReleaseDC(FNativeHandle, DC));
  16863. end;
  16864.  
  16865. procedure TGPGraphics.ResetClip;
  16866. begin
  16867. GdipCheck(GdipResetClip(FNativeHandle));
  16868. end;
  16869.  
  16870. procedure TGPGraphics.ResetTransform;
  16871. begin
  16872. GdipCheck(GdipResetWorldTransform(FNativeHandle));
  16873. end;
  16874.  
  16875. procedure TGPGraphics.Restore(const State: TGPGraphicsState);
  16876. begin
  16877. GdipCheck(GdipRestoreGraphics(FNativeHandle, State));
  16878. end;
  16879.  
  16880. procedure TGPGraphics.RotateTransform(const Angle: Single;
  16881. const Order: TGPMatrixOrder);
  16882. begin
  16883. GdipCheck(GdipRotateWorldTransform(FNativeHandle, Angle, Order));
  16884. end;
  16885.  
  16886. function TGPGraphics.Save: TGPGraphicsState;
  16887. begin
  16888. GdipCheck(GdipSaveGraphics(FNativeHandle, Result));
  16889. end;
  16890.  
  16891. procedure TGPGraphics.ScaleTransform(const SX, SY: Single;
  16892. const Order: TGPMatrixOrder);
  16893. begin
  16894. GdipCheck(GdipScaleWorldTransform(FNativeHandle, SX, SY, Order));
  16895. end;
  16896.  
  16897. {$IF (GDIPVER >= $0110)}
  16898. procedure TGPGraphics.SetAbort(const IAbort: TGdiplusAbort);
  16899. begin
  16900. GdipCheck(GdipGraphicsSetAbort(FNativeHandle, @IAbort));
  16901. end;
  16902. {$IFEND}
  16903.  
  16904. procedure TGPGraphics.SetClip(const Rect: TGPRect; const CombineMode: TGPCombineMode);
  16905. begin
  16906. GdipCheck(GdipSetClipRectI(FNativeHandle, Rect.X, Rect.Y, Rect.Width,
  16907. Rect.Height, CombineMode));
  16908. end;
  16909.  
  16910. procedure TGPGraphics.SetClip(const Path: IGPGraphicsPath;
  16911. const CombineMode: TGPCombineMode);
  16912. begin
  16913. GdipCheck(GdipSetClipPath(FNativeHandle, Path.NativeHandle, CombineMode));
  16914. end;
  16915.  
  16916. procedure TGPGraphics.SetClip(const Region: HRgn;
  16917. const CombineMode: TGPCombineMode);
  16918. begin
  16919. GdipCheck(GdipSetClipHrgn(FNativeHandle, Region, CombineMode));
  16920. end;
  16921.  
  16922. procedure TGPGraphics.SetClip(const G: IGPGraphics;
  16923. const CombineMode: TGPCombineMode);
  16924. begin
  16925. GdipCheck(GdipSetClipGraphics(FNativeHandle, G.NativeHandle, CombineMode));
  16926. end;
  16927.  
  16928. procedure TGPGraphics.SetClip(const Region: IGPRegion;
  16929. const CombineMode: TGPCombineMode);
  16930. begin
  16931. GdipCheck(GdipSetClipRegion(FNativeHandle, Region.NativeHandle, CombineMode));
  16932. end;
  16933.  
  16934. procedure TGPGraphics.SetClip(const Rect: TGPRectF;
  16935. const CombineMode: TGPCombineMode);
  16936. begin
  16937. GdipCheck(GdipSetClipRect(FNativeHandle, Rect.X, Rect.Y, Rect.Width,
  16938. Rect.Height, CombineMode));
  16939. end;
  16940.  
  16941. procedure TGPGraphics.SetClipReplace(const Value: IGPRegion);
  16942. begin
  16943. GdipCheck(GdipSetClipRegion(FNativeHandle, Value.NativeHandle, CombineModeReplace));
  16944. end;
  16945.  
  16946. procedure TGPGraphics.SetCompositingMode(const Value: TGPCompositingMode);
  16947. begin
  16948. GdipCheck(GdipSetCompositingMode(FNativeHandle, Value));
  16949. end;
  16950.  
  16951. procedure TGPGraphics.SetCompositingQuality(const Value: TGPCompositingQuality);
  16952. begin
  16953. GdipCheck(GdipSetCompositingQuality(FNativeHandle, Value));
  16954. end;
  16955.  
  16956. procedure TGPGraphics.SetInterpolationMode(const Value: TGPInterpolationMode);
  16957. begin
  16958. GdipCheck(GdipSetInterpolationMode(FNativeHandle, Value));
  16959. end;
  16960.  
  16961. procedure TGPGraphics.SetPageScale(const Value: Single);
  16962. begin
  16963. GdipCheck(GdipSetPageScale(FNativeHandle, Value));
  16964. end;
  16965.  
  16966. procedure TGPGraphics.SetPageUnit(const Value: TGPUnit);
  16967. begin
  16968. GdipCheck(GdipSetPageUnit(FNativeHandle, Value));
  16969. end;
  16970.  
  16971. procedure TGPGraphics.SetPixelOffsetMode(const Value: TGPPixelOffsetMode);
  16972. begin
  16973. GdipCheck(GdipSetPixelOffsetMode(FNativeHandle, Value));
  16974. end;
  16975.  
  16976. procedure TGPGraphics.SetRenderingOrigin(const Value: TGPPoint);
  16977. begin
  16978. GdipCheck(GdipSetRenderingOrigin(FNativeHandle, Value.X, Value.Y));
  16979. end;
  16980.  
  16981. procedure TGPGraphics.SetRenderingOrigin(const X, Y: Integer);
  16982. begin
  16983. GdipCheck(GdipSetRenderingOrigin(FNativeHandle, X, Y));
  16984. end;
  16985.  
  16986. procedure TGPGraphics.SetSmoothingMode(const Value: TGPSmoothingMode);
  16987. begin
  16988. GdipCheck(GdipSetSmoothingMode(FNativeHandle, Value));
  16989. end;
  16990.  
  16991. procedure TGPGraphics.SetTextContrast(const Value: Integer);
  16992. begin
  16993. GdipCheck(GdipSetTextContrast(FNativeHandle, Value));
  16994. end;
  16995.  
  16996. procedure TGPGraphics.SetTextRenderingHint(const Value: TGPTextRenderingHint);
  16997. begin
  16998. GdipCheck(GdipSetTextRenderingHint(FNativeHandle, Value));
  16999. end;
  17000.  
  17001. procedure TGPGraphics.SetTransform(const Value: IGPMatrix);
  17002. begin
  17003. GdipCheck(GdipSetWorldTransform(FNativeHandle, Value.NativeHandle));
  17004. end;
  17005.  
  17006. procedure TGPGraphics.TransformPoints(const DestSpace, SrcSpace: TGPCoordinateSpace;
  17007. const Points: array of TGPPoint);
  17008. begin
  17009. Assert(Length(Points) > 0);
  17010. GdipCheck(GdipTransformPointsI(FNativeHandle, DestSpace, SrcSpace,
  17011. @Points[0], Length(Points)));
  17012. end;
  17013.  
  17014. procedure TGPGraphics.TransformPoints(const DestSpace, SrcSpace: TGPCoordinateSpace;
  17015. const Points: array of TGPPointF);
  17016. begin
  17017. Assert(Length(Points) > 0);
  17018. GdipCheck(GdipTransformPoints(FNativeHandle, DestSpace, SrcSpace,
  17019. @Points[0], Length(Points)));
  17020. end;
  17021.  
  17022. procedure TGPGraphics.TranslateClip(const DX, DY: Integer);
  17023. begin
  17024. GdipCheck(GdipTranslateClipI(FNativeHandle, DX, DY));
  17025. end;
  17026.  
  17027. procedure TGPGraphics.TranslateClip(const DX, DY: Single);
  17028. begin
  17029. GdipCheck(GdipTranslateClip(FNativeHandle, DX, DY));
  17030. end;
  17031.  
  17032. procedure TGPGraphics.TranslateTransform(const DX, DY: Single;
  17033. const Order: TGPMatrixOrder);
  17034. begin
  17035. GdipCheck(GdipTranslateWorldTransform(FNativeHandle, DX, DY, Order));
  17036. end;
  17037. {$ENDREGION 'GdiplusGraphics.h'}
  17038.  
  17039. {$REGION 'Initialization and Finalization'}
  17040.  
  17041. var
  17042. {$IF (GDIPVER >= $0110)}
  17043. StartupInput: TGdiplusStartupInputEx;
  17044. {$ELSE}
  17045. StartupInput: TGdiplusStartupInput;
  17046. {$IFEND}
  17047. GdiplusToken: ULONG;
  17048.  
  17049. procedure Initialize;
  17050. begin
  17051. TGPImageFormat.FInitialized := False;
  17052. StartupInput.Intialize;
  17053. GdiplusStartup(GdiplusToken, @StartupInput, nil);
  17054. end;
  17055.  
  17056. procedure Finalize;
  17057. begin
  17058. GdiplusShutdown(GdiplusToken);
  17059. end;
  17060.  
  17061. initialization
  17062. Initialize;
  17063.  
  17064. finalization
  17065. Finalize;
  17066. {$ENDREGION 'Initialization and Finalization'}
  17067.  
  17068. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement