-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGDIPOBJ.pas
7991 lines (6939 loc) · 282 KB
/
GDIPOBJ.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{******************************************************************}
{ GDI+ Class }
{ }
{ home page : http://www.progdigy.com }
{ email : [email protected] }
{ }
{ date : 15-02-2002 }
{ }
{ The contents of this file are used with permission, subject to }
{ the Mozilla Public License Version 1.1 (the "License"); you may }
{ not use this file except in compliance with the License. You may }
{ obtain a copy of the License at }
{ http://www.mozilla.org/MPL/MPL-1.1.html }
{ }
{ Software distributed under the License is distributed on an }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or }
{ implied. See the License for the specific language governing }
{ rights and limitations under the License. }
{ }
{ *****************************************************************}
unit GDIPOBJ;
interface
uses
Windows,
ActiveX,
DirectDraw,
GDIPAPI;
(**************************************************************************\
*
* GDI+ Codec Image APIs
*
\**************************************************************************)
//--------------------------------------------------------------------------
// Codec Management APIs
//--------------------------------------------------------------------------
function GetImageDecodersSize(out numDecoders, size: UINT): TStatus;
function GetImageDecoders(numDecoders, size: UINT;
decoders: PImageCodecInfo): TStatus;
function GetImageEncodersSize(out numEncoders, size: UINT): TStatus;
function GetImageEncoders(numEncoders, size: UINT;
encoders: PImageCodecInfo): TStatus;
(**************************************************************************\
*
* Private GDI+ header file.
*
\**************************************************************************)
//---------------------------------------------------------------------------
// GDI+ classes for forward reference
//---------------------------------------------------------------------------
type
TGPGraphics = class;
TGPPen = class;
TGPBrush = class;
TGPMatrix = class;
TGPBitmap = class;
TGPMetafile = class;
TGPFontFamily = class;
TGPGraphicsPath = class;
TGPRegion = class;
TGPImage = class;
TGPHatchBrush = class;
TGPSolidBrush = class;
TGPLinearGradientBrush = class;
TGPPathGradientBrush = class;
TGPFont = class;
TGPFontCollection = class;
TGPInstalledFontCollection = class;
TGPPrivateFontCollection = class;
TGPImageAttributes = class;
TGPCachedBitmap = class;
(**************************************************************************\
*
* GDI+ Region, Font, Image, CustomLineCap class definitions.
*
\**************************************************************************)
TGPRegion = class(TGdiplusBase)
protected
nativeRegion: GpRegion;
lastResult: TStatus;
function SetStatus(status: TStatus): TStatus;
procedure SetNativeRegion(nativeRegion: GpRegion);
constructor Create(nativeRegion: GpRegion); reintroduce; overload;
public
constructor Create; reintroduce; overload;
constructor Create(rect: TGPRectF); reintroduce; overload;
constructor Create(rect: TGPRect); reintroduce; overload;
constructor Create(path: TGPGraphicsPath); reintroduce; overload;
constructor Create(regionData: PBYTE; size: Integer); reintroduce; overload;
constructor Create(hRgn: HRGN); reintroduce; overload;
function FromHRGN(hRgn: HRGN): TGPRegion;
destructor Destroy; override;
function Clone: TGPRegion;
function MakeInfinite: TStatus;
function MakeEmpty: TStatus;
function GetDataSize: UINT;
// buffer - where to put the data
// bufferSize - how big the buffer is (should be at least as big as GetDataSize())
// sizeFilled - if not NULL, this is an OUT param that says how many bytes
// of data were written to the buffer.
function GetData(buffer: PBYTE; bufferSize: UINT;
sizeFilled: PUINT = nil): TStatus;
function Intersect(const rect: TGPRect): TStatus; overload;
function Intersect(const rect: TGPRectF): TStatus; overload;
function Intersect(path: TGPGraphicsPath): TStatus; overload;
function Intersect(region: TGPRegion): TStatus; overload;
function Union(const rect: TGPRect): TStatus; overload;
function Union(const rect: TGPRectF): TStatus; overload;
function Union(path: TGPGraphicsPath): TStatus; overload;
function Union(region: TGPRegion): TStatus; overload;
function Xor_(const rect: TGPRect): TStatus; overload;
function Xor_(const rect: TGPRectF): TStatus; overload;
function Xor_(path: TGPGraphicsPath): TStatus; overload;
function Xor_(region: TGPRegion): TStatus; overload;
function Exclude(const rect: TGPRect): TStatus; overload;
function Exclude(const rect: TGPRectF): TStatus; overload;
function Exclude(path: TGPGraphicsPath): TStatus; overload;
function Exclude(region: TGPRegion): TStatus; overload;
function Complement(const rect: TGPRect): TStatus; overload;
function Complement(const rect: TGPRectF): TStatus; overload;
function Complement(path: TGPGraphicsPath): TStatus; overload;
function Complement(region: TGPRegion): TStatus; overload;
function Translate(dx, dy: Single): TStatus; overload;
function Translate(dx, dy: Integer): TStatus; overload;
function Transform(matrix: TGPMatrix): TStatus;
function GetBounds(out rect: TGPRect; g: TGPGraphics): TStatus; overload;
function GetBounds(out rect: TGPRectF; g: TGPGraphics): TStatus; overload;
function GetHRGN(g: TGPGraphics): HRGN;
function IsEmpty(g: TGPGraphics): BOOL;
function IsInfinite(g: TGPGraphics): BOOL ;
function IsVisible(x, y: Integer; g: TGPGraphics = nil): BOOL; overload;
function IsVisible(const point: TGPPoint; g: TGPGraphics = nil): BOOL; overload;
function IsVisible(x, y: Single; g: TGPGraphics = nil): BOOL; overload;
function IsVisible(const point: TGPPointF; g: TGPGraphics = nil): BOOL; overload;
function IsVisible(x, y, width, height: Integer; g: TGPGraphics): BOOL; overload;
function IsVisible(const rect: TGPRect; g: TGPGraphics = nil): BOOL; overload;
function IsVisible(x, y, width, height: Single; g: TGPGraphics = nil): BOOL; overload;
function IsVisible(const rect: TGPRectF; g: TGPGraphics = nil): BOOL; overload;
function Equals(region: TGPRegion; g: TGPGraphics): BOOL;
function GetRegionScansCount(matrix: TGPMatrix): UINT;
function GetRegionScans(matrix: TGPMatrix ;rects: PGPRectF; out count: Integer): TStatus; overload;
function GetRegionScans(matrix: TGPMatrix; rects: PGPRect; out count: Integer): TStatus; overload;
function GetLastStatus: TStatus;
end;
//--------------------------------------------------------------------------
// FontFamily
//--------------------------------------------------------------------------
TGPFontFamily = class(TGdiplusBase)
protected
nativeFamily: GpFontFamily;
lastResult: TStatus;
function SetStatus(status: TStatus): TStatus;
constructor Create(nativeOrig: GpFontFamily;
status: TStatus); reintroduce; overload;
public
constructor Create; reintroduce; overload;
constructor Create(name: WideString; fontCollection: TGPFontCollection = nil); reintroduce; overload;
destructor Destroy; override;
class function GenericSansSerif: TGPFontFamily;
class function GenericSerif: TGPFontFamily;
class function GenericMonospace: TGPFontFamily;
function GetFamilyName(out name: String; language: LANGID = 0): TStatus;
function Clone: TGPFontFamily;
function IsAvailable: BOOL;
function IsStyleAvailable(style: Integer): BOOL;
function GetEmHeight(style: Integer): UINT16;
function GetCellAscent(style: Integer): UINT16;
function GetCellDescent(style: Integer): UINT16;
function GetLineSpacing(style: Integer): UINT16;
function GetLastStatus: TStatus;
end;
//--------------------------------------------------------------------------
// Font Collection
//--------------------------------------------------------------------------
TGPFontCollection = class(TGdiplusBase)
protected
nativeFontCollection: GpFontCollection;
lastResult: TStatus;
function SetStatus(status: TStatus): TStatus;
public
constructor Create;
destructor Destroy; override;
function GetFamilyCount: Integer;
function GetFamilies(numSought: Integer; out gpfamilies: array of TGPFontFamily;
out numFound: Integer): TStatus;
function GetLastStatus: TStatus;
end;
TGPInstalledFontCollection = class(TGPFontCollection)
public
constructor Create; reintroduce;
destructor Destroy; override;
end;
TGPPrivateFontCollection = class(TGPFontCollection)
public
constructor Create; reintroduce;
destructor destroy; override;
function AddFontFile(filename: WideString): TStatus;
function AddMemoryFont(memory: Pointer; length: Integer): TStatus;
end;
//--------------------------------------------------------------------------
// TFont
//--------------------------------------------------------------------------
TGPFont = class(TGdiplusBase)
protected
nativeFont: GpFont;
lastResult: TStatus;
procedure SetNativeFont(Font: GpFont);
function SetStatus(status: TStatus): TStatus;
constructor Create(font: GpFont; status: TStatus); overload;
public
constructor Create(hdc: HDC); reintroduce; overload;
constructor Create(hdc: HDC; logfont: PLogFontA); reintroduce; overload;
constructor Create(hdc: HDC; logfont: PLogFontW); reintroduce; overload;
constructor Create(hdc: HDC; hfont: HFONT); reintroduce; overload;
constructor Create(family: TGPFontFamily; emSize: Single;
style: TFontStyle = FontStyleRegular;
unit_: TUnit = UnitPoint); reintroduce; overload;
constructor Create(familyName: WideString; emSize: Single;
style: TFontStyle = FontStyleRegular; unit_: TUnit = UnitPoint;
fontCollection: TGPFontCollection = nil); reintroduce; overload;
function GetLogFontA(g: TGPGraphics; out logfontA: TLogFontA): TStatus;
function GetLogFontW(g: TGPGraphics; out logfontW: TLogFontW): TStatus;
function Clone: TGPFont;
destructor Destroy; override;
function IsAvailable: BOOL;
function GetStyle: Integer;
function GetSize: Single;
function GetUnit: TUnit;
function GetLastStatus: TStatus;
function GetHeight(graphics: TGPGraphics): Single; overload;
function GetHeight(dpi: Single): Single; overload;
function GetFamily(family: TGPFontFamily): TStatus;
end;
//--------------------------------------------------------------------------
// Abstract base class for Image and Metafile
//--------------------------------------------------------------------------
TGPImage = class(TGdiplusBase)
protected
nativeImage: GpImage;
lastResult: TStatus;
loadStatus: TStatus;
procedure SetNativeImage(nativeImage: GpImage);
function SetStatus(status: TStatus): TStatus;
constructor Create(nativeImage: GpImage; status: TStatus); reintroduce; overload;
public
constructor Create(filename: WideString; useEmbeddedColorManagement: BOOL = FALSE); reintroduce; overload;
constructor Create(stream: IStream; useEmbeddedColorManagement: BOOL = FALSE); reintroduce; overload;
function FromFile(filename: WideString; useEmbeddedColorManagement: BOOL = FALSE): TGPImage;
function FromStream(stream: IStream; useEmbeddedColorManagement: BOOL = FALSE): TGPImage;
destructor destroy; override;
function Clone: TGPImage;
function Save(filename: WideString; const clsidEncoder: TGUID;
encoderParams: PEncoderParameters = nil): TStatus; overload;
function Save(stream: IStream; const clsidEncoder: TGUID;
encoderParams: PEncoderParameters = nil): TStatus; overload;
function SaveAdd(encoderParams: PEncoderParameters): TStatus; overload;
function SaveAdd(newImage: TGPImage; encoderParams: PEncoderParameters): TStatus; overload;
function GetType: TImageType;
function GetPhysicalDimension(out size: TGPSizeF): TStatus;
function GetBounds(out srcRect: TGPRectF; out srcUnit: TUnit): TStatus;
function GetWidth: UINT;
function GetHeight: UINT;
function GetHorizontalResolution: Single;
function GetVerticalResolution: Single;
function GetFlags: UINT;
function GetRawFormat(out format: TGUID): TStatus;
function GetPixelFormat: TPixelFormat;
function GetPaletteSize: Integer;
function GetPalette(palette: PColorPalette; size: Integer): TStatus;
function SetPalette(palette: PColorPalette): TStatus;
function GetThumbnailImage(thumbWidth, thumbHeight: UINT;
callback: GetThumbnailImageAbort = nil; callbackData: pointer = nil): TGPImage;
function GetFrameDimensionsCount: UINT;
function GetFrameDimensionsList(dimensionIDs: PGUID; count: UINT): TStatus;
function GetFrameCount(const dimensionID: TGUID): UINT;
function SelectActiveFrame(const dimensionID: TGUID; frameIndex: UINT): TStatus;
function RotateFlip(rotateFlipType: TRotateFlipType): TStatus;
function GetPropertyCount: UINT;
function GetPropertyIdList(numOfProperty: UINT; list: PPropID): TStatus;
function GetPropertyItemSize(propId: PROPID): UINT;
function GetPropertyItem(propId: PROPID; propSize: UINT; buffer: PPropertyItem): TStatus;
function GetPropertySize(out totalBufferSize, numProperties : UINT): TStatus;
function GetAllPropertyItems(totalBufferSize, numProperties: UINT;
allItems: PPROPERTYITEM): TStatus;
function RemovePropertyItem(propId: TPROPID): TStatus;
function SetPropertyItem(const item: TPropertyItem): TStatus;
function GetEncoderParameterListSize(const clsidEncoder: TGUID): UINT;
function GetEncoderParameterList(const clsidEncoder: TGUID; size: UINT;
buffer: PEncoderParameters): TStatus;
function GetLastStatus: TStatus;
end;
TGPBitmap = class(TGPImage)
protected
constructor Create(nativeBitmap: GpBitmap); reintroduce; overload;
public
constructor Create(filename: WideString; useEmbeddedColorManagement: BOOL = FALSE); reintroduce; overload;
constructor Create(stream: IStream; useEmbeddedColorManagement: BOOL = FALSE); reintroduce; overload;
function FromFile(filename: WideString; useEmbeddedColorManagement: BOOL = FALSE): TGPBitmap;
function FromStream(stream: IStream; useEmbeddedColorManagement: BOOL = FALSE): TGPBitmap;
constructor Create(width, height, stride: Integer; format: TPixelFormat; scan0: PBYTE); reintroduce; overload;
constructor Create(width, height: Integer; format: TPixelFormat = PixelFormat32bppARGB); reintroduce; overload;
constructor Create(width, height: Integer; target: TGPGraphics); reintroduce; overload;
function Clone(rect: TGPRect; format: TPixelFormat): TGPBitmap; overload;
function Clone(x, y, width, height: Integer; format: TPixelFormat): TGPBitmap; overload;
function Clone(rect: TGPRectF; format: TPixelFormat): TGPBitmap; overload;
function Clone(x, y, width, height: Single; format: TPixelFormat): TGPBitmap; overload;
function LockBits(rect: TGPRect; flags: UINT; format: TPixelFormat; out lockedBitmapData: TBitmapData): TStatus;
function UnlockBits(var lockedBitmapData: TBitmapData): TStatus;
function GetPixel(x, y: Integer; out color: TGPColor): TStatus;
function SetPixel(x, y: Integer; color: TGPColor): TStatus;
function SetResolution(xdpi, ydpi: Single): TStatus;
constructor Create(surface: IDirectDrawSurface7); reintroduce; overload;
constructor Create(var gdiBitmapInfo: TBITMAPINFO; gdiBitmapData: Pointer); reintroduce; overload;
constructor Create(hbm: HBITMAP; hpal: HPALETTE); reintroduce; overload;
constructor Create(hicon: HICON); reintroduce; overload;
constructor Create(hInstance: HMODULE; bitmapName: WideString); reintroduce; overload;
function FromDirectDrawSurface7(surface: IDirectDrawSurface7): TGPBitmap;
function FromBITMAPINFO(var gdiBitmapInfo: TBITMAPINFO; gdiBitmapData: Pointer): TGPBitmap;
function FromHBITMAP(hbm: HBITMAP; hpal: HPALETTE): TGPBitmap;
function FromHICON(hicon: HICON): TGPBitmap;
function FromResource(hInstance: HMODULE; bitmapName: WideString): TGPBitmap;
function GetHBITMAP(colorBackground: TGPColor; out hbmReturn: HBITMAP): TStatus;
function GetHICON(out hicon: HICON): TStatus;
end;
TGPCustomLineCap = class(TGdiplusBase)
protected
nativeCap: GpCustomLineCap;
lastResult: TStatus;
procedure SetNativeCap(nativeCap: GpCustomLineCap);
function SetStatus(status: TStatus): TStatus;
constructor Create(nativeCap: GpCustomLineCap;
status: TStatus); reintroduce; overload;
public
constructor Create; reintroduce; overload;
constructor Create(fillPath, strokePath: TGPGraphicsPath;
baseCap: TLineCap = LineCapFlat;
baseInset: Single = 0); reintroduce; overload;
destructor Destroy; override;
function Clone: TGPCustomLineCap;
function SetStrokeCap(strokeCap: TLineCap): TStatus;
function SetStrokeCaps(startCap, endCap: TLineCap): TStatus;
function GetStrokeCaps(out startCap, endCap: TLineCap): TStatus;
function SetStrokeJoin(lineJoin: TLineJoin): TStatus;
function GetStrokeJoin: TLineJoin;
function SetBaseCap(baseCap: TLineCap): TStatus;
function GetBaseCap: TLineCap;
function SetBaseInset(inset: Single): TStatus;
function GetBaseInset: Single;
function SetWidthScale(widthScale: Single): TStatus;
function GetWidthScale: Single;
function GetLastStatus: TStatus;
end;
TGPCachedBitmap = class(TGdiplusBase)
protected
nativeCachedBitmap: GpCachedBitmap;
lastResult: TStatus;
public
constructor Create(bitmap: TGPBitmap; graphics: TGPGraphics); reintroduce;
destructor Destroy; override;
function GetLastStatus: TStatus;
end;
(**************************************************************************\
*
* GDI+ Image Attributes used with Graphics.DrawImage
*
* There are 5 possible sets of color adjustments:
* ColorAdjustDefault,
* ColorAdjustBitmap,
* ColorAdjustBrush,
* ColorAdjustPen,
* ColorAdjustText,
*
* Bitmaps, Brushes, Pens, and Text will all use any color adjustments
* that have been set into the default ImageAttributes until their own
* color adjustments have been set. So as soon as any "Set" method is
* called for Bitmaps, Brushes, Pens, or Text, then they start from
* scratch with only the color adjustments that have been set for them.
* Calling Reset removes any individual color adjustments for a type
* and makes it revert back to using all the default color adjustments
* (if any). The SetToIdentity method is a way to force a type to
* have no color adjustments at all, regardless of what previous adjustments
* have been set for the defaults or for that type.
*
\********************************************************************F******)
TGPImageAttributes = class(TGdiplusBase)
protected
nativeImageAttr: GpImageAttributes;
lastResult: TStatus;
procedure SetNativeImageAttr(nativeImageAttr: GpImageAttributes);
function SetStatus(status: TStatus): TStatus;
constructor Create(imageAttr: GpImageAttributes;
status: GpStatus); reintroduce; overload;
public
constructor Create; reintroduce; overload;
destructor Destroy; override;
function Clone: TGPImageAttributes;
function SetToIdentity(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function Reset(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function SetColorMatrix(const colorMatrix: TColorMatrix;
mode: TColorMatrixFlags = ColorMatrixFlagsDefault;
type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function ClearColorMatrix(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function SetColorMatrices(const colorMatrix: TColorMatrix; const grayMatrix: TColorMatrix;
mode: TColorMatrixFlags = ColorMatrixFlagsDefault;
type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function ClearColorMatrices(Type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function SetThreshold(threshold: Single; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function ClearThreshold(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function SetGamma(gamma: Single; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function ClearGamma( type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function SetNoOp(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function ClearNoOp(Type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function SetColorKey(colorLow, colorHigh: TGPColor; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function ClearColorKey(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function SetOutputChannel(channelFlags: TColorChannelFlags; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function ClearOutputChannel(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function SetOutputChannelColorProfile(colorProfileFilename: WideString;
type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function ClearOutputChannelColorProfile(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function SetRemapTable(mapSize: Cardinal; map: PColorMap; type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function ClearRemapTable(type_: TColorAdjustType = ColorAdjustTypeDefault): TStatus;
function SetBrushRemapTable(mapSize: Cardinal; map: PColorMap): TStatus;
function ClearBrushRemapTable: TStatus;
function SetWrapMode(wrap: TWrapMode; color: TGPColor = aclBlack; clamp: BOOL = FALSE): TStatus;
// The flags of the palette are ignored.
function GetAdjustedPalette(colorPalette: PColorPalette; colorAdjustType: TColorAdjustType): TStatus;
function GetLastStatus: TStatus;
end;
(**************************************************************************\
*
* GDI+ Matrix class
*
\**************************************************************************)
TMatrixArray = array[0..5] of Single;
TGPMatrix = class(TGdiplusBase)
protected
nativeMatrix: GpMatrix;
lastResult: GpStatus ;
procedure SetNativeMatrix(nativeMatrix: GpMatrix);
function SetStatus(status: GpStatus): TStatus;
constructor Create(nativeMatrix: GpMatrix); reintroduce; overload;
public
// Default constructor is set to identity matrix.
constructor Create; reintroduce; overload;
constructor Create(m11, m12, m21, m22, dx, dy: Single); reintroduce; overload;
constructor Create(const rect: TGPRectF; const dstplg: TGPPointF); reintroduce; overload;
constructor Create(const rect: TGPRect; const dstplg: TGPPoint); reintroduce; overload;
destructor Destroy; override;
function Clone: TGPMatrix;
function GetElements(const m: TMatrixArray): TStatus;
function SetElements(m11, m12, m21, m22, dx, dy: Single): TStatus;
function OffsetX: Single;
function OffsetY: Single;
function Reset: TStatus;
function Multiply(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok
function Translate(offsetX, offsetY: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok
function Scale(scaleX, scaleY: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok
function Rotate(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok
function RotateAt(angle: Single; const center: TGPPointF; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok
function Shear(shearX, shearY: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus; // ok
function Invert: TStatus; // ok
function TransformPoints(pts: PGPPointF; count: Integer = 1): TStatus; overload;
function TransformPoints(pts: PGPPoint; count: Integer = 1): TStatus; overload;
function TransformVectors(pts: PGPPointF; count: Integer = 1): TStatus; overload;
function TransformVectors(pts: PGPPoint; count: Integer = 1): TStatus; overload;
function IsInvertible: BOOL;
function IsIdentity: BOOL;
function Equals(matrix: TGPMatrix): BOOL;
function GetLastStatus: TStatus;
end;
(**************************************************************************\
*
* GDI+ Brush class
*
\**************************************************************************)
//--------------------------------------------------------------------------
// Abstract base class for various brush types
//--------------------------------------------------------------------------
TGPBrush = class(TGdiplusBase)
protected
nativeBrush: GpBrush;
lastResult: TStatus;
procedure SetNativeBrush(nativeBrush: GpBrush);
function SetStatus(status: TStatus): TStatus;
constructor Create(nativeBrush: GpBrush; status: TStatus); overload;
public
constructor Create; overload;
destructor Destroy; override;
function Clone: TGPBrush; virtual;
function GetType: TBrushType;
function GetLastStatus: TStatus;
end;
//--------------------------------------------------------------------------
// Solid Fill Brush Object
//--------------------------------------------------------------------------
TGPSolidBrush = class(TGPBrush)
public
constructor Create(color: TGPColor); reintroduce; overload;
constructor Create; reintroduce; overload;
function GetColor(out color: TGPColor): TStatus;
function SetColor(color: TGPColor): TStatus;
end;
//--------------------------------------------------------------------------
// Texture Brush Fill Object
//--------------------------------------------------------------------------
TGPTextureBrush = class(TGPBrush)
public
constructor Create(image: TGPImage; wrapMode: TWrapMode = WrapModeTile); reintroduce; overload;
constructor Create(image: TGPImage; wrapMode: TWrapMode; dstRect: TGPRectF); reintroduce; overload;
constructor Create(image: TGPImage; dstRect: TGPRectF; imageAttributes: TGPImageAttributes = nil); reintroduce; overload;
constructor Create(image: TGPImage; dstRect: TGPRect; imageAttributes: TGPImageAttributes = nil); reintroduce; overload;
constructor Create(image: TGPImage; wrapMode: TWrapMode; dstRect: TGPRect); reintroduce; overload;
constructor Create(image: TGPImage; wrapMode: TWrapMode; dstX, dstY, dstWidth,
dstHeight: Single); reintroduce; overload;
constructor Create(image: TGPImage; wrapMode: TWrapMode; dstX, dstY, dstWidth,
dstHeight: Integer); reintroduce; overload;
constructor Create; reintroduce; overload;
function SetTransform(matrix: TGPMatrix): TStatus;
function GetTransform(matrix: TGPMatrix): TStatus;
function ResetTransform: TStatus;
function MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function TranslateTransform(dx, dy: Single; order: MatrixOrder = MatrixOrderPrepend): TStatus;
function ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function SetWrapMode(wrapMode: TWrapMode): TStatus;
function GetWrapMode: TWrapMode;
function GetImage: TGPImage;
end;
//--------------------------------------------------------------------------
// Linear Gradient Brush Object
//--------------------------------------------------------------------------
TGPLinearGradientBrush = class(TGPBrush)
public
constructor Create; reintroduce; overload;
constructor Create(const point1, point2: TGPPointF; color1,
color2: TGPColor); reintroduce; overload;
constructor Create(const point1, point2: TGPPoint; color1,
color2: TGPColor); reintroduce; overload;
constructor Create(rect: TGPRectF; color1, color2: TGPColor;
mode: TLinearGradientMode); reintroduce; overload;
constructor Create(rect: TGPRect; color1, color2: TGPColor;
mode: TLinearGradientMode); reintroduce; overload;
constructor Create(rect: TGPRectF; color1, color2: TGPColor; angle: Single;
isAngleScalable: BOOL = FALSE); overload;
constructor Create(rect: TGPRect; color1, color2: TGPColor; angle: Single;
isAngleScalable: BOOL = FALSE); overload;
function SetLinearColors(color1, color2: TGPColor): TStatus;
function GetLinearColors(out color1, color2: TGPColor): TStatus;
function GetRectangle(out rect: TGPRectF): TStatus; overload;
function GetRectangle(out rect: TGPRect): TStatus; overload;
function SetGammaCorrection(useGammaCorrection: BOOL): TStatus;
function GetGammaCorrection: BOOL;
function GetBlendCount: Integer;
function SetBlend(blendFactors, blendPositions: PSingle; count: Integer): TStatus;
function GetBlend(blendFactors, blendPositions: PSingle; count: Integer): TStatus;
function GetInterpolationColorCount: Integer;
function SetInterpolationColors(presetColors: PGPColor; blendPositions: PSingle; count: Integer): TStatus;
function GetInterpolationColors(presetColors: PGPColor; blendPositions: PSingle; count: Integer): TStatus;
function SetBlendBellShape(focus: Single; scale: Single = 1.0): TStatus;
function SetBlendTriangularShape(focus: Single; scale: Single = 1.0): TStatus;
function SetTransform(matrix: TGPMatrix): TStatus;
function GetTransform(matrix: TGPMatrix): TStatus;
function ResetTransform: TStatus;
function MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function TranslateTransform(dx, dy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function SetWrapMode(wrapMode: TWrapMode): TStatus;
function GetWrapMode: TWrapMode;
end;
//--------------------------------------------------------------------------
// Hatch Brush Object
//--------------------------------------------------------------------------
TGPHatchBrush = class(TGPBrush)
public
constructor Create; reintroduce; overload;
constructor Create(hatchStyle: THatchStyle; foreColor: TGPColor; backColor: TGPColor = aclBlack); reintroduce; overload; // ok
function GetHatchStyle: THatchStyle;
function GetForegroundColor(out color: TGPColor): TStatus;
function GetBackgroundColor(out color: TGPColor): TStatus;
end;
(**************************************************************************\
*
* GDI+ Pen class
*
\**************************************************************************)
//--------------------------------------------------------------------------
// Pen class
//--------------------------------------------------------------------------
TGPPen = class(TGdiplusBase)
protected
nativePen: GpPen;
lastResult: TStatus;
procedure SetNativePen(nativePen: GpPen);
function SetStatus(status: TStatus): TStatus;
constructor Create(nativePen: GpPen; status: TStatus); reintroduce; overload;
public
constructor Create(color: TGPColor; width: Single = 1.0); reintroduce; overload;
constructor Create(brush: TGPBrush; width: Single = 1.0); reintroduce; overload;
destructor Destroy; override;
function Clone: TGPPen;
function SetWidth(width: Single): TStatus;
function GetWidth: Single;
// Set/get line caps: start, end, and dash
// Line cap and join APIs by using LineCap and LineJoin enums.
function SetLineCap(startCap, endCap: TLineCap; dashCap: TDashCap): TStatus;
function SetStartCap(startCap: TLineCap): TStatus;
function SetEndCap(endCap: TLineCap): TStatus;
function SetDashCap(dashCap: TDashCap): TStatus;
function GetStartCap: TLineCap;
function GetEndCap: TLineCap;
function GetDashCap: TDashCap;
function SetLineJoin(lineJoin: TLineJoin): TStatus;
function GetLineJoin: TLineJoin;
function SetCustomStartCap(customCap: TGPCustomLineCap): TStatus;
function GetCustomStartCap(customCap: TGPCustomLineCap): TStatus;
function SetCustomEndCap(customCap: TGPCustomLineCap): TStatus;
function GetCustomEndCap(customCap: TGPCustomLineCap): TStatus;
function SetMiterLimit(miterLimit: Single): TStatus;
function GetMiterLimit: Single;
function SetAlignment(penAlignment: TPenAlignment): TStatus;
function GetAlignment: TPenAlignment;
function SetTransform(matrix: TGPMatrix): TStatus;
function GetTransform(matrix: TGPMatrix): TStatus;
function ResetTransform: TStatus;
function MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function TranslateTransform(dx, dy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function ScaleTransform(sx, sy: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function RotateTransform(angle: Single; order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function GetPenType: TPenType;
function SetColor(color: TGPColor): TStatus;
function SetBrush(brush: TGPBrush): TStatus;
function GetColor(out Color: TGPColor): TStatus;
function GetBrush: TGPBrush;
function GetDashStyle: TDashStyle;
function SetDashStyle(dashStyle: TDashStyle): TStatus;
function GetDashOffset: Single;
function SetDashOffset(dashOffset: Single): TStatus;
function SetDashPattern(dashArray: PSingle; count: Integer): TStatus;
function GetDashPatternCount: Integer;
function GetDashPattern(dashArray: PSingle; count: Integer): TStatus;
function SetCompoundArray(compoundArray: PSingle; count: Integer): TStatus;
function GetCompoundArrayCount: Integer;
function GetCompoundArray(compoundArray: PSingle; count: Integer): TStatus;
function GetLastStatus: TStatus;
end;
(**************************************************************************\
*
* GDI+ StringFormat class
*
\**************************************************************************)
TGPStringFormat = class(TGdiplusBase)
protected
nativeFormat: GpStringFormat;
lastError: TStatus;
function SetStatus(newStatus: GpStatus): TStatus;
procedure Assign(source: TGPStringFormat);
constructor Create(clonedStringFormat: GpStringFormat; status: TStatus); reintroduce; overload;
public
constructor Create(formatFlags: Integer = 0; language: LANGID = LANG_NEUTRAL); reintroduce; overload;
constructor Create(format: TGPStringFormat); reintroduce; overload;
destructor Destroy; override;
class function GenericDefault: TGPStringFormat;
class function GenericTypographic: TGPStringFormat;
function Clone: TGPStringFormat;
function SetFormatFlags(flags: Integer): TStatus;
function GetFormatFlags: Integer;
function SetAlignment(align: TStringAlignment): TStatus;
function GetAlignment: TStringAlignment;
function SetLineAlignment(align: TStringAlignment): TStatus;
function GetLineAlignment: TStringAlignment;
function SetHotkeyPrefix(hotkeyPrefix: THotkeyPrefix): TStatus;
function GetHotkeyPrefix: THotkeyPrefix;
function SetTabStops(firstTabOffset: Single; count: Integer; tabStops: PSingle): TStatus;
function GetTabStopCount: Integer;
function GetTabStops(count: Integer; firstTabOffset, tabStops: PSingle): TStatus;
function SetDigitSubstitution(language: LANGID; substitute: TStringDigitSubstitute): TStatus;
function GetDigitSubstitutionLanguage: LANGID;
function GetDigitSubstitutionMethod: TStringDigitSubstitute;
function SetTrimming(trimming: TStringTrimming): TStatus;
function GetTrimming: TStringTrimming;
function SetMeasurableCharacterRanges(rangeCount: Integer; ranges: PCharacterRange): TStatus;
function GetMeasurableCharacterRangeCount: Integer;
function GetLastStatus: TStatus;
end;
(**************************************************************************\
*
* GDI+ Graphics Path class
*
\**************************************************************************)
TGPGraphicsPath = class(TGdiplusBase)
protected
nativePath: GpPath;
lastResult: TStatus;
procedure SetNativePath(nativePath: GpPath);
function SetStatus(status: TStatus): TStatus;
constructor Create(nativePath: GpPath); reintroduce; overload;
public
constructor Create(path: TGPGraphicsPath); reintroduce; overload;
constructor Create(fillMode: TFillMode = FillModeAlternate); reintroduce; overload;
constructor Create(points: PGPPointF; types: PBYTE; count: Integer;
fillMode: TFillMode = FillModeAlternate); reintroduce; overload;
constructor Create(points: PGPPoint; types: PBYTE; count: Integer;
fillMode: TFillMode = FillModeAlternate); reintroduce; overload;
destructor destroy; override;
function Clone: TGPGraphicsPath;
// Reset the path object to empty (and fill mode to FillModeAlternate)
function Reset: TStatus;
function GetFillMode: TFillMode;
function SetFillMode(fillmode: TFillMode): TStatus;
function GetPathData(pathData: TPathData): TStatus;
function StartFigure: TStatus;
function CloseFigure: TStatus;
function CloseAllFigures: TStatus;
function SetMarker: TStatus;
function ClearMarkers: TStatus;
function Reverse: TStatus;
function GetLastPoint(out lastPoint: TGPPointF): TStatus;
function AddLine(const pt1, pt2: TGPPointF): TStatus; overload;
function AddLine(x1, y1, x2, y2: Single): TStatus; overload;
function AddLines(points: PGPPointF; count: Integer): TStatus; overload;
function AddLine(const pt1, pt2: TGPPoint): TStatus; overload;
function AddLine(x1, y1, x2, y2: Integer): TStatus; overload;
function AddLines(points: PGPPoint; count: Integer): TStatus; overload;
function AddArc(rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; overload;
function AddArc(x, y, width, height, startAngle, sweepAngle: Single): TStatus; overload;
function AddArc(rect: TGPRect; startAngle, sweepAngle: Single): TStatus; overload;
function AddArc(x, y, width, height: Integer; startAngle, sweepAngle: Single): TStatus; overload;
function AddBezier(pt1, pt2, pt3, pt4: TGPPointF): TStatus; overload;
function AddBezier(x1, y1, x2, y2, x3, y3, x4, y4: Single): TStatus; overload;
function AddBeziers(points: PGPPointF; count: Integer): TStatus; overload;
function AddBezier(pt1, pt2, pt3, pt4: TGPPoint): TStatus; overload;
function AddBezier(x1, y1, x2, y2, x3, y3, x4, y4: Integer): TStatus; overload;
function AddBeziers(points: PGPPoint; count: Integer): TStatus; overload;
function AddCurve(points: PGPPointF; count: Integer): TStatus; overload;
function AddCurve(points: PGPPointF; count: Integer; tension: Single): TStatus; overload;
function AddCurve(points: PGPPointF; count, offset, numberOfSegments: Integer; tension: Single): TStatus; overload;
function AddCurve(points: PGPPoint; count: Integer): TStatus; overload;
function AddCurve(points: PGPPoint; count: Integer; tension: Single): TStatus; overload;
function AddCurve(points: PGPPoint; count, offset, numberOfSegments: Integer; tension: Single): TStatus; overload;
function AddClosedCurve(points: PGPPointF; count: Integer): TStatus; overload;
function AddClosedCurve(points: PGPPointF; count: Integer; tension: Single): TStatus; overload;
function AddClosedCurve(points: PGPPoint; count: Integer): TStatus; overload;
function AddClosedCurve(points: PGPPoint; count: Integer; tension: Single): TStatus; overload;
function AddRectangle(rect: TGPRectF): TStatus; overload;
function AddRectangles(rects: PGPRectF; count: Integer): TStatus; overload;
function AddRectangle(rect: TGPRect): TStatus; overload;
function AddRectangles(rects: PGPRect; count: Integer): TStatus; overload;
function AddEllipse(rect: TGPRectF): TStatus; overload;
function AddEllipse(x, y, width, height: Single): TStatus; overload;
function AddEllipse(rect: TGPRect): TStatus; overload;
function AddEllipse(x, y, width, height: Integer): TStatus; overload;
function AddPie(rect: TGPRectF; startAngle, sweepAngle: Single): TStatus; overload;
function AddPie(x, y, width, height, startAngle, sweepAngle: Single): TStatus; overload;
function AddPie(rect: TGPRect; startAngle, sweepAngle: Single): TStatus; overload;
function AddPie(x, y, width, height: Integer; startAngle, sweepAngle: Single): TStatus; overload;
function AddPolygon(points: PGPPointF; count: Integer): TStatus; overload;
function AddPolygon(points: PGPPoint; count: Integer): TStatus; overload;
function AddPath(addingPath: TGPGraphicsPath; connect: Bool): TStatus;
function AddString(string_: WideString; length: Integer; family : TGPFontFamily;
style : Integer; emSize : Single; origin : TGPPointF; format : TGPStringFormat): TStatus; overload;
function AddString(string_: WideString; length : Integer; family : TGPFontFamily;
style : Integer; emSize : Single; layoutRect: TGPRectF; format : TGPStringFormat): TStatus; overload;
function AddString(string_: WideString; length : Integer; family : TGPFontFamily;
style : Integer; emSize : Single; origin : TGPPoint; format : TGPStringFormat): TStatus; overload;
function AddString(string_: WideString; length : Integer; family : TGPFontFamily;
style : Integer; emSize : Single; layoutRect: TGPRect; format : TGPStringFormat): TStatus; overload;
function Transform(matrix: TGPMatrix): TStatus;
// This is not always the tightest bounds.
function GetBounds(out bounds: TGPRectF; matrix: TGPMatrix = nil; pen: TGPPen = nil): TStatus; overload;
function GetBounds(out bounds: TGPRect; matrix: TGPMatrix = nil; pen: TGPPen = nil): TStatus; overload;
// Once flattened, the resultant path is made of line segments and
// the original path information is lost. When matrix is NULL the
// identity matrix is assumed.
function Flatten(matrix: TGPMatrix = nil; flatness: Single = FlatnessDefault): TStatus;
function Widen(pen: TGPPen; matrix: TGPMatrix = nil; flatness: Single = FlatnessDefault): TStatus;
function Outline(matrix: TGPMatrix = nil; flatness: Single = FlatnessDefault): TStatus;
// Once this is called, the resultant path is made of line segments and
// the original path information is lost. When matrix is NULL, the
// identity matrix is assumed.
function Warp(destPoints: PGPPointF; count: Integer; srcRect: TGPRectF;
matrix: TGPMatrix = nil; warpMode: TWarpMode = WarpModePerspective;
flatness: Single = FlatnessDefault): TStatus;
function GetPointCount: Integer;
function GetPathTypes(types: PBYTE; count: Integer): TStatus;
function GetPathPoints(points: PGPPointF; count: Integer): TStatus; overload;
function GetPathPoints(points: PGPPoint; count: Integer): TStatus; overload;
function GetLastStatus: TStatus;
function IsVisible(point: TGPPointF; g: TGPGraphics = nil): BOOL; overload;
function IsVisible(x, y: Single; g: TGPGraphics = nil): BOOL; overload;
function IsVisible(point: TGPPoint; g : TGPGraphics = nil): BOOL; overload;
function IsVisible(x, y: Integer; g: TGPGraphics = nil): BOOL; overload;
function IsOutlineVisible(point: TGPPointF; pen: TGPPen; g: TGPGraphics = nil): BOOL; overload;
function IsOutlineVisible(x, y: Single; pen: TGPPen; g: TGPGraphics = nil): BOOL; overload;
function IsOutlineVisible(point: TGPPoint; pen: TGPPen; g: TGPGraphics = nil): BOOL; overload;
function IsOutlineVisible(x, y: Integer; pen: TGPPen; g: TGPGraphics = nil): BOOL; overload;
end;
//--------------------------------------------------------------------------
// GraphisPathIterator class
//--------------------------------------------------------------------------
TGPGraphicsPathIterator = class(TGdiplusBase)
protected
nativeIterator: GpPathIterator;
lastResult : TStatus;
procedure SetNativeIterator(nativeIterator: GpPathIterator);
function SetStatus(status: TStatus): TStatus;
public
constructor Create(path: TGPGraphicsPath); reintroduce;
destructor Destroy; override;
function NextSubpath(out startIndex, endIndex: Integer; out isClosed: bool): Integer; overload;
function NextSubpath(path: TGPGraphicsPath; out isClosed: BOOL): Integer; overload;
function NextPathType(out pathType: TPathPointType; out startIndex, endIndex: Integer): Integer;
function NextMarker(out startIndex, endIndex: Integer): Integer; overload;
function NextMarker(path: TGPGraphicsPath): Integer; overload;
function GetCount: Integer;
function GetSubpathCount: Integer;
function HasCurve: BOOL;
procedure Rewind;
function Enumerate(points: PGPPointF; types: PBYTE; count: Integer): Integer;
function CopyData(points: PGPPointF; types: PBYTE; startIndex, endIndex: Integer): Integer;
function GetLastStatus: TStatus;
end;
//--------------------------------------------------------------------------
// Path Gradient Brush
//--------------------------------------------------------------------------
TGPPathGradientBrush = class(TGPBrush)
public
constructor Create(points: PGPPointF; count: Integer;
wrapMode: TWrapMode = WrapModeClamp); reintroduce; overload;
constructor Create(points: PGPPoint; count: Integer;
wrapMode: TWrapMode = WrapModeClamp); reintroduce; overload;
constructor Create(path: TGPGraphicsPath); reintroduce; overload;
constructor Create; reintroduce; overload;
function GetCenterColor(out Color: TGPColor): TStatus;
function SetCenterColor(color: TGPColor): TStatus;
function GetPointCount: Integer;
function GetSurroundColorCount: Integer;
function GetSurroundColors(colors: PARGB; var count: Integer): TStatus;
function SetSurroundColors(colors: PARGB; var count: Integer): TStatus;
function GetGraphicsPath(path: TGPGraphicsPath): TStatus;
function SetGraphicsPath(path: TGPGraphicsPath): TStatus;
function GetCenterPoint(out point: TGPPointF): TStatus; overload;
function GetCenterPoint(out point: TGPPoint): TStatus; overload;
function SetCenterPoint(point: TGPPointF): TStatus; overload;
function SetCenterPoint(point: TGPPoint): TStatus; overload;
function GetRectangle(out rect: TGPRectF): TStatus; overload;
function GetRectangle(out rect: TGPRect): TStatus; overload;
function SetGammaCorrection(useGammaCorrection: BOOL): TStatus; overload;
function GetGammaCorrection: BOOL; overload;
function GetBlendCount: Integer;
function GetBlend(blendFactors, blendPositions: PSingle; count: Integer): TStatus;
function SetBlend(blendFactors, blendPositions: PSingle; count: Integer): TStatus;
function GetInterpolationColorCount: Integer;
function SetInterpolationColors(presetColors: PARGB; blendPositions: PSingle;
count: Integer): TStatus;
function GetInterpolationColors(presetColors: PARGB;
blendPositions: PSingle; count: Integer): TStatus;
function SetBlendBellShape(focus: Single; scale: Single = 1.0): TStatus;
function SetBlendTriangularShape(focus: Single; scale: Single = 1.0): TStatus;
function GetTransform(matrix: TGPMatrix): TStatus;
function SetTransform(matrix: TGPMatrix): TStatus;
function ResetTransform: TStatus;
function MultiplyTransform(matrix: TGPMatrix;
order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function TranslateTransform(dx, dy: Single;
order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function ScaleTransform(sx, sy: Single;
order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function RotateTransform(angle: Single;
order: TMatrixOrder = MatrixOrderPrepend): TStatus;
function GetFocusScales(out xScale, yScale: Single): TStatus;
function SetFocusScales(xScale, yScale: Single): TStatus;
function GetWrapMode: TWrapMode;
function SetWrapMode(wrapMode: TWrapMode): TStatus;
end;
(**************************************************************************\
*
* GDI+ Graphics Object
*
\**************************************************************************)
TGPGraphics = class(TGdiplusBase)
protected
nativeGraphics: GpGraphics;
lastResult: TStatus;
procedure SetNativeGraphics(graphics: GpGraphics);
function SetStatus(status: TStatus): TStatus;
function GetNativeGraphics: GpGraphics;
function GetNativePen(pen: TGPPen): GpPen;
constructor Create(graphics: GpGraphics); reintroduce; overload;
public
function FromHDC(hdc: HDC): TGPGraphics; overload;
function FromHDC(hdc: HDC; hdevice: THANDLE): TGPGraphics; overload;
function FromHWND(hwnd: HWND; icm: BOOL = FALSE): TGPGraphics;
function FromImage(image: TGPImage): TGPGraphics;
constructor Create(hdc: HDC); reintroduce; overload;
constructor Create(hdc: HDC; hdevice: THANDLE); reintroduce; overload;
constructor Create(hwnd: HWND; icm: BOOL{ = FALSE}); reintroduce; overload;
constructor Create(image: TGPImage); reintroduce; overload;
destructor destroy; override;
procedure Flush(intention: TFlushIntention = FlushIntentionFlush);
//------------------------------------------------------------------------
// GDI Interop methods
//------------------------------------------------------------------------
// Locks the graphics until ReleaseDC is called
function GetHDC: HDC;
procedure ReleaseHDC(hdc: HDC);
//------------------------------------------------------------------------
// Rendering modes
//------------------------------------------------------------------------
function SetRenderingOrigin(x, y: Integer): TStatus;
function GetRenderingOrigin(out x, y: Integer): TStatus;
function SetCompositingMode(compositingMode: TCompositingMode): TStatus;
function GetCompositingMode: TCompositingMode;
function SetCompositingQuality(compositingQuality: TCompositingQuality): TStatus;
function GetCompositingQuality: TCompositingQuality;
function SetTextRenderingHint(newMode: TTextRenderingHint): TStatus;
function GetTextRenderingHint: TTextRenderingHint;
function SetTextContrast(contrast: UINT): TStatus; // 0..12
function GetTextContrast: UINT;
function GetInterpolationMode: TInterpolationMode;
function SetInterpolationMode(interpolationMode: TInterpolationMode): TStatus;
function GetSmoothingMode: TSmoothingMode;
function SetSmoothingMode(smoothingMode: TSmoothingMode): TStatus;
function GetPixelOffsetMode: TPixelOffsetMode;
function SetPixelOffsetMode(pixelOffsetMode: TPixelOffsetMode): TStatus;
//------------------------------------------------------------------------
// Manipulate current world transform
//------------------------------------------------------------------------
function SetTransform(matrix: TGPMatrix): TStatus;
function ResetTransform: TStatus;
function MultiplyTransform(matrix: TGPMatrix; order: TMatrixOrder = MatrixOrderPrepend): TStatus;