-
Notifications
You must be signed in to change notification settings - Fork 12
/
bgracustombitmap.inc
2361 lines (2111 loc) · 117 KB
/
bgracustombitmap.inc
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
{=== TBGRACustomBitmap and IBGRAScanner ===}
{$IFDEF INCLUDE_SCANNER_INTERFACE}
{$UNDEF INCLUDE_SCANNER_INTERFACE}
//type
TBGRACustomBitmap = class;
{==== IBGRAScanner ====}
{* Interface for a scanner. A scanner is like an image, but its content
has no limit and it can be calculated on the fly. It is like a
infinite readonly image.
*
* Note: it must not implement reference counting even if it is an interface
*
* ''TBGRACustomBitmap'' implements this interface and the content is repeated
horizontally and vertically. There are also various classes
in ''BGRAGradientScanner'' unit that generate gradients on the fly and
in ''BGRATransform'' unit that provide geometrical transformations of images }
IBGRAScanner = interface
['{B7E5C7A9-867E-4CBA-828F-4DE6E605B632}']
{** Move to the position (''X'',''Y'') for the next call to ''ScanNextPixel'' }
procedure ScanMoveTo(X,Y: Integer);
{** Scan the pixel at the current location and increments ''X'' }
function ScanNextPixel: TBGRAPixel;
function ScanNextExpandedPixel: TExpandedPixel;
{** Scan at any location using floating point coordinates }
function ScanAt(X,Y: Single): TBGRAPixel;
function ScanAtExpanded(X,Y: Single): TExpandedPixel;
{** Scan at any location using integer coordinates }
function ScanAtInteger(X,Y: integer): TBGRAPixel;
function ScanAtIntegerExpanded(X,Y: integer): TExpandedPixel;
{** Copy a row of pixels from ''X'' to ''X''+''count''-1 to a specified destination
''pdest''. ''mode'' indicates how to combine with existing data }
procedure ScanPutPixels(pdest: PBGRAPixel; count: integer; mode: TDrawMode);
{** Returns True if the function ''ScanPutPixels'' is available. Otherwise
you need to call ''ScanNextPixel'' and combine pixels for example
with ''SetPixel'' }
function IsScanPutPixelsDefined: boolean;
{** Returns the corresponding OpenGL texture. The value is ''nil'' if no texture is associated. **}
function GetTextureGL: IUnknown;
function GetImageBoundsWithin(const ARect: TRect; Channel: TChannel = cAlpha; ANothingValue: Byte = 0): TRect; overload;
function GetImageBoundsWithin(const ARect: TRect; Channels: TChannels; ANothingValue: Byte = 0): TRect; overload;
function ProvidesScanline(ARect: TRect): boolean;
function GetScanlineAt(X,Y: integer): PBGRAPixel;
function GetInstance: TObject;
end;
{** A type of function of a scanner that returns the content at floating point coordinates }
TScanAtFunction = function (X,Y: Single): TBGRAPixel of object;
{** A type of function of a scanner that returns the content at integer coordinates }
TScanAtIntegerFunction = function (X,Y: Integer): TBGRAPixel of object;
{** A type of function of a scanner that returns the next pixel }
TScanNextPixelFunction = function: TBGRAPixel of object;
{ TBGRACustomScanner }
{* Base class for implementing ''IBGRAScanner'' interface }
TBGRACustomScanner = class(TObject, IBGRAScanner)
private
FCurX,FCurY: integer;
public
function GetInstance: TObject;
function ScanAtInteger(X,Y: integer): TBGRAPixel; virtual;
function ScanAtIntegerExpanded(X,Y: integer): TExpandedPixel; virtual;
procedure ScanMoveTo(X,Y: Integer); virtual;
function ScanNextPixel: TBGRAPixel; virtual;
function ScanNextExpandedPixel: TExpandedPixel; virtual;
function ScanAt(X,Y: Single): TBGRAPixel; virtual; abstract;
function ScanAtExpanded(X,Y: Single): TExpandedPixel; virtual;
procedure ScanPutPixels(pdest: PBGRAPixel; count: integer; mode: TDrawMode); virtual;
function IsScanPutPixelsDefined: boolean; virtual;
function GetTextureGL: IUnknown; virtual;
function GetImageBoundsWithin(const ARect: TRect; Channel: TChannel = cAlpha; ANothingValue: Byte = 0): TRect; overload; virtual;
function GetImageBoundsWithin(const ARect: TRect; Channels: TChannels; ANothingValue: Byte = 0): TRect; overload; virtual;
function ProvidesScanline({%H-}ARect: TRect): boolean; virtual;
function GetScanlineAt({%H-}X,{%H-}Y: integer): PBGRAPixel; virtual;
protected
{$IFNDEF FPC}
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function _AddRef: Integer; stdcall;
function _Release: Integer; stdcall;
{$ELSE}
function QueryInterface({$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): HResult; {$IF (not defined(WINDOWS)) AND (not defined(FPC20501))}cdecl{$ELSE}stdcall{$IFEND};
function _AddRef: Integer; {$IF (not defined(WINDOWS)) AND (not defined(FPC20501))}cdecl{$ELSE}stdcall{$IFEND};
function _Release: Integer; {$IF (not defined(WINDOWS)) AND (not defined(FPC20501))}cdecl{$ELSE}stdcall{$IFEND};
{$ENDIF}
end;
{$ENDIF}
{$IFDEF INCLUDE_INTERFACE}
{$UNDEF INCLUDE_INTERFACE}
//type
{==== TBGRACustomBitmap ====}
{ TBGRACustomBitmap }
{* This is the base class for ''TBGRABitmap''. It is the direct parent of
''TBGRADefaultBitmap'' class, which is the parent of the diverse
implementations. A bitmap can be used as a scanner using the interface
''IBGRAScanner'' }
TBGRACustomBitmap = class(TFPCustomImage,IBGRAScanner)
private
function GetFontAntialias: Boolean;
procedure SetFontAntialias(const AValue: Boolean);
protected
FXorMask: TBGRACustomBitmap;
{ accessors to properies }
function GetArrowEndRepeat: integer; virtual; abstract;
function GetArrowStartRepeat: integer; virtual; abstract;
procedure SetArrowEndRepeat(AValue: integer); virtual; abstract;
procedure SetArrowStartRepeat(AValue: integer); virtual; abstract;
function GetArrowEndOffset: single; virtual; abstract;
function GetArrowStartOffset: single; virtual; abstract;
procedure SetArrowEndOffset(AValue: single); virtual; abstract;
procedure SetArrowStartOffset(AValue: single); virtual; abstract;
function GetArrowEndSize: TPointF; virtual; abstract;
function GetArrowStartSize: TPointF; virtual; abstract;
procedure SetArrowEndSize(AValue: TPointF); virtual; abstract;
procedure SetArrowStartSize(AValue: TPointF); virtual; abstract;
function GetLineCap: TPenEndCap; virtual; abstract;
procedure SetLineCap(AValue: TPenEndCap); virtual; abstract;
function GetFontRenderer: TBGRACustomFontRenderer; virtual; abstract;
procedure SetFontRenderer(AValue: TBGRACustomFontRenderer); virtual; abstract;
function GetHeight: integer; virtual; abstract;
function GetWidth: integer; virtual; abstract;
function GetDataPtr: PBGRAPixel; virtual; abstract;
function GetNbPixels: integer; virtual; abstract;
function CheckEmpty: boolean; virtual; abstract;
function CheckIsZero: boolean; virtual; abstract;
function GetHasTransparentPixels: boolean; virtual; abstract;
function GetHasSemiTransparentPixels: boolean; virtual; abstract;
function GetAverageColor: TColor; virtual; abstract;
function GetAveragePixel: TBGRAPixel; virtual; abstract;
procedure SetCanvasOpacity(AValue: byte); virtual; abstract;
function GetScanLine(y: integer): PBGRAPixel; virtual; abstract;
function GetRefCount: integer; virtual; abstract;
function GetBitmap: TBitmap; virtual; abstract;
function GetLineOrder: TRawImageLineOrder; virtual; abstract;
function GetCanvasFP: TFPImageCanvas; virtual; abstract;
function GetCanvasDrawModeFP: TDrawMode; virtual; abstract;
procedure SetCanvasDrawModeFP(const AValue: TDrawMode); virtual; abstract;
function GetCanvas: TCanvas; virtual; abstract;
function GetCanvasOpacity: byte; virtual; abstract;
function GetCanvasAlphaCorrection: boolean; virtual; abstract;
procedure SetCanvasAlphaCorrection(const AValue: boolean); virtual; abstract;
function GetFontHeight: integer; virtual; abstract;
procedure SetFontHeight(AHeight: integer); virtual; abstract;
function GetFontFullHeight: integer; virtual; abstract;
procedure SetFontFullHeight(AHeight: integer); virtual; abstract;
function GetPenJoinStyle: TPenJoinStyle; virtual; abstract;
procedure SetPenJoinStyle(const AValue: TPenJoinStyle); virtual; abstract;
function GetPenMiterLimit: single; virtual; abstract;
procedure SetPenMiterLimit(const AValue: single); virtual; abstract;
function GetPenStyle: TPenStyle; virtual; abstract;
procedure SetPenStyle(const AValue: TPenStyle); virtual; abstract;
function GetCustomPenStyle: TBGRAPenStyle; virtual; abstract;
procedure SetCustomPenStyle(const AValue: TBGRAPenStyle); virtual; abstract;
function GetPenStroker: TBGRACustomPenStroker; virtual; abstract;
function GetClipRect: TRect; virtual; abstract;
procedure SetClipRect(const AValue: TRect); virtual; abstract;
function GetFontPixelMetric: TFontPixelMetric; virtual; abstract;
procedure ClearTransparentPixels; virtual; abstract;
procedure InternalArc(cx,cy,rx,ry: single; const StartPoint,EndPoint: TPointF; ABorderColor: TBGRAPixel; w: single; AFillColor: TBGRAPixel; AOptions: TArcOptions; ADrawChord: boolean = false; ATexture: IBGRAScanner = nil); overload;
procedure InternalArc(cx,cy,rx,ry: single; StartAngleRad,EndAngleRad: Single; ABorderColor: TBGRAPixel; w: single; AFillColor: TBGRAPixel; AOptions: TArcOptions; ADrawChord: boolean = false; ATexture: IBGRAScanner = nil); overload; virtual; abstract;
procedure InternalArcInRect(r: TRect; StartAngleRad,EndAngleRad: Single; ABorderColor : TBGRAPixel; w: single; AFillColor: TBGRAPixel; AOptions: TArcOptions; ADrawChord: boolean = false; ATexture: IBGRAScanner = nil);
procedure InternalFillArcInRect(r: TRect; StartAngleRad,EndAngleRad: Single; AFillColor: TBGRAPixel; AOptions: TArcOptions; ATexture: IBGRAScanner = nil);
function GetTextureGL: IUnknown; virtual;
function GetFontRightToLeftFor(AText: string): boolean;
function GetInstance: TObject;
public
{** User defined caption. It does not appear on the image }
Caption: string;
{** Method to use when filling polygons (winding or alternate).
See [[BGRABitmap Types imported from Graphics|BGRAGraphics]] }
FillMode: TFillMode;
{** Specifies if linear antialiasing must be used when drawing
antialiased shapes }
LinearAntialiasing: boolean;
{** Resample filter is used when resizing the bitmap. See [[BGRABitmap Miscellaneous types#Images and resampling|resampling types]] }
ResampleFilter : TResampleFilter;
{** Scan interpolation filter is used when the bitmap is used
as a scanner (interface ''IBGRAScanner'') }
ScanInterpolationFilter: TResampleFilter;
{** Offset to apply when the image is scanned using ''IBGRAScanner'' interface }
ScanOffset: TPoint;
{** Cursor position for mouse pointer }
HotSpot: TPoint;
{ ** Free reference to xor mask }
procedure DiscardXorMask; virtual; abstract;
{ ** Allocate xor mask }
procedure NeedXorMask; virtual; abstract;
{** Xor mask to be applied when image is drawn }
property XorMask: TBGRACustomBitmap read FXorMask;
{** Width of the image in pixels }
property Width: integer Read GetWidth;
{** Height of the image in pixels }
property Height: integer Read GetHeight;
{** Clipping rectangle for all drawing functions }
property ClipRect: TRect read GetClipRect write SetClipRect;
{** Total number of pixels. It is always true that ''NbPixels'' = ''Width'' * ''Height'' }
property NbPixels: integer Read GetNbPixels;
{** Returns the address of the left-most pixel of any line.
The parameter y ranges from 0 to Height-1 }
property ScanLine[y: integer]: PBGRAPixel Read GetScanLine;
{** Indicates the order in which lines are stored in memory.
If it is equal to ''riloTopToBottom'', the first line is the top line.
If it is equal to ''riloBottomToTop'', the first line is the bottom line.
See [[BGRABitmap Miscellaneous types|miscellaneous types]] }
property LineOrder: TRawImageLineOrder Read GetLineOrder;
{** Provides a pointer to the first pixel in memory.
Depending on the ''LineOrder'' property, this can be the top-left pixel or the bottom-left pixel.
There is no padding between scanlines, so the start of the next line is at the address ''Data'' + ''Width''.
See [[BGRABitmap tutorial 4]] }
property Data: PBGRAPixel Read GetDataPtr;
{** Number of references to this image. It is increased by the function
''NewReference'' and decreased by the function ''FreeReference'' }
property RefCount: integer Read GetRefCount;
{** Returns True if the bitmap only contains transparent pixels or has a size of zero }
property Empty: boolean Read CheckEmpty;
property IsZero: boolean Read CheckIsZero;
{** Returns True if there are transparent or semitransparent pixels,
and so if the image would be stored with an alpha channel }
property HasTransparentPixels: boolean Read GetHasTransparentPixels;
property HasSemiTransparentPixels: boolean Read GetHasSemiTransparentPixels;
{** Average color of the image }
property AverageColor: TColor Read GetAverageColor;
{** Average color (including alpha) of the image }
property AveragePixel: TBGRAPixel Read GetAveragePixel;
{** Canvas compatible with FreePascal }
property CanvasFP: TFPImageCanvas read GetCanvasFP;
{** Draw mode to used when image is access using FreePascal functions
and ''Colors'' property }
property CanvasDrawModeFP: TDrawMode read GetCanvasDrawModeFP write SetCanvasDrawModeFP;
{** Bitmap in a format compatible with the current GUI.
Don't forget to call ''InvalidateBitmap'' before using it
if you changed something with direct pixel access (''Scanline''
and ''Data'') }
property Bitmap: TBitmap Read GetBitmap;
{** Canvas provided by the GUI }
property Canvas: TCanvas Read GetCanvas;
{** Opacity to apply to changes made using GUI functions, provided
''CanvasAlphaCorrection'' is set to ''True'' }
property CanvasOpacity: byte Read GetCanvasOpacity Write SetCanvasOpacity;
{** Specifies if the alpha values must be corrected after GUI access
to the bitmap }
property CanvasAlphaCorrection: boolean Read GetCanvasAlphaCorrection Write SetCanvasAlphaCorrection;
public {----------- pen style ----------------}
{** How to join segments. See [[BGRABitmap Types imported from Graphics|BGRAGraphics]] }
property JoinStyle: TPenJoinStyle read GetPenJoinStyle Write SetPenJoinStyle;
{** Limit for the extension of the segments when joining them
with ''pjsMiter'' join style, expressed in multiples of the width
of the pen }
property JoinMiterLimit: single read GetPenMiterLimit Write SetPenMiterLimit;
{** Pen style. See [[BGRABitmap Types imported from Graphics|BGRAGraphics]] }
property PenStyle: TPenStyle read GetPenStyle Write SetPenStyle;
{** Custom pen style. See [[BGRABitmap Geometry types|geometric types]] }
property CustomPenStyle: TBGRAPenStyle read GetCustomPenStyle write SetCustomPenStyle;
{** How to draw the ends of a line }
property LineCap: TPenEndCap read GetLineCap write SetLineCap;
{** You can use this class to generate strokes polygonal representations }
property Pen: TBGRACustomPenStroker read GetPenStroker;
{** Size of arrows at the start of the line }
property ArrowStartSize: TPointF read GetArrowStartSize write SetArrowStartSize;
{** Size of arrows at the end of the line }
property ArrowEndSize: TPointF read GetArrowEndSize write SetArrowEndSize;
{** Offset of the arrow from the start of the line }
property ArrowStartOffset: single read GetArrowStartOffset write SetArrowStartOffset;
{** Offset of the arrow from the end of the line }
property ArrowEndOffset: single read GetArrowEndOffset write SetArrowEndOffset;
{** Number of times to repeat the starting arrow }
property ArrowStartRepeat: integer read GetArrowStartRepeat write SetArrowStartRepeat;
{** Number of times to repeat the ending arrow }
property ArrowEndRepeat: integer read GetArrowEndRepeat write SetArrowEndRepeat;
public {-------------------font style------------------------}
{** Specifies the font to use. Unless the font renderer accept otherwise,
the name is in human readable form, like 'Arial', 'Times New Roman', ... }
FontName: string;
{** Specifies the set of styles to be applied to the font.
These can be ''fsBold'', ''fsItalic'', ''fsStrikeOut'', ''fsUnderline''.
So the value [''fsBold'',''fsItalic''] means that the font must be bold and italic.
See [[BGRABitmap Miscellaneous types|miscellaneous types]] }
FontStyle: TFontStyles;
{** Specifies the quality of rendering. Default value is ''fqSystem''.
See [[BGRABitmap Miscellaneous types|miscellaneous types]] }
FontQuality : TBGRAFontQuality;
{** Specifies the rotation of the text, for functions that support text rotation.
It is expressed in tenth of degrees, positive values going counter-clockwise. }
FontOrientation: integer;
{** Specifies how the font is vertically aligned relative to the start coordinate.
See [[BGRABitmap Miscellaneous types|miscellaneous types]]}
FontVerticalAnchor: TFontVerticalAnchor;
{** Specifies the base direction of the text (cf Unicode). By default, it is
automatically determined by the first strongly oriented character.
You can specify another base direction here however it is not taken
into account by the LCL on Linux. }
FontBidiMode: TFontBidiMode;
{** Specifies the height of the font in pixels without taking into account
additional line spacing. A negative value means that it is the
full height instead (see below) }
property FontHeight: integer Read GetFontHeight Write SetFontHeight;
{** Specifies the height of the font in pixels, taking into account the
additional line spacing defined for the font }
property FontFullHeight: integer read GetFontFullHeight write SetFontFullHeight;
{** Simplified property to specify the quality (see ''FontQuality'') }
property FontAntialias: Boolean read GetFontAntialias write SetFontAntialias;
{** Returns measurement for the current font in pixels }
property FontPixelMetric: TFontPixelMetric read GetFontPixelMetric;
{** Specifies the font renderer. When working with the LCL,
by default it is an instance of ''TLCLFontRenderer'' of
unit ''BGRAText''. Other renderers are provided in ''BGRATextFX''
unit and ''BGRAVectorize'' unit. Additionally, ''BGRAFreeType''
provides a renderer independent from the LCL.
*
* Once you assign a renderer, it will automatically be freed when
the bitmap is freed. The renderers may provide additional styling
for the font, not accessible with the properties in this class
*
* See [[BGRABitmap tutorial Font rendering|font rendering]]}
property FontRenderer: TBGRACustomFontRenderer read GetFontRenderer write SetFontRenderer;
public
constructor Create; overload; virtual; abstract;
constructor Create(AFPImage: TFPCustomImage); overload; virtual; abstract;
constructor Create(ABitmap: TBitmap; AUseTransparent: boolean = true); overload; virtual; abstract;
constructor Create(AWidth, AHeight: integer; Color: TColor); overload; virtual; abstract;
constructor Create(AWidth, AHeight: integer; Color: TBGRAPixel); overload; virtual; abstract;
constructor Create(AFilename: string); overload; virtual; abstract;
constructor Create(AFilename: string; AIsUtf8Filename: boolean); overload; virtual; abstract;
constructor Create(AFilename: string; AIsUtf8Filename: boolean; AOptions: TBGRALoadingOptions); overload; virtual; abstract;
constructor Create(AStream: TStream); overload; virtual; abstract;
function NewBitmap(AWidth, AHeight: integer): TBGRACustomBitmap; overload; virtual; abstract;
function NewBitmap(AWidth, AHeight: integer; Color: TBGRAPixel): TBGRACustomBitmap; overload; virtual; abstract;
function NewBitmap(Filename: string): TBGRACustomBitmap; overload; virtual; abstract;
function NewBitmap(Filename: string; AIsUtf8: boolean): TBGRACustomBitmap; overload; virtual; abstract;
function NewBitmap(Filename: string; AIsUtf8: boolean; AOptions: TBGRALoadingOptions): TBGRACustomBitmap; overload; virtual; abstract;
function NewBitmap(AFPImage: TFPCustomImage): TBGRACustomBitmap; overload; virtual; abstract;
//there are UTF8 functions that are different from standard function as those
//depend on TFPCustomImage that does not clearly handle UTF8
{==== Load and save files ====}
{** Load image from a file. ''filename'' is an ANSI string }
procedure LoadFromFile(const filename: string); overload; virtual;
procedure LoadFromFile(const filename: string; AOptions: TBGRALoadingOptions); overload; virtual;
{** Load image from a file with the specified image reader. ''filename'' is an ANSI string }
procedure LoadFromFile(const filename:String; Handler:TFPCustomImageReader); overload; virtual;
procedure LoadFromFile(const filename:String; Handler:TFPCustomImageReader; AOptions: TBGRALoadingOptions); overload; virtual;
{** Load image from a file. ''filename'' is an UTF8 string }
procedure LoadFromFileUTF8(const filenameUTF8: string; AOptions: TBGRALoadingOptions = []); overload; virtual;
{** Load image from a file with the specified image reader. ''filename'' is an UTF8 string }
procedure LoadFromFileUTF8(const filenameUTF8: string; AHandler: TFPCustomImageReader; AOptions: TBGRALoadingOptions = []); overload; virtual;
{** Load image from a stream. Format is detected automatically }
procedure LoadFromStream(Str: TStream);overload; virtual;
procedure LoadFromStream(Str: TStream; AOptions: TBGRALoadingOptions);overload; virtual;
{** Load image from a stream. The specified image reader is used }
procedure LoadFromStream(Str: TStream; Handler: TFPCustomImageReader);overload; virtual;
procedure LoadFromStream(Str: TStream; Handler: TFPCustomImageReader; AOptions: TBGRALoadingOptions);overload; virtual;
{** Save image to a file. The format is guessed from the file extension. ''filename'' is an ANSI string }
procedure SaveToFile(const filename: string);overload; virtual;
{** Save image to a file with the specified image writer. ''filename'' is an ANSI string }
procedure SaveToFile(const filename: string; Handler:TFPCustomImageWriter);overload; virtual;
{** Save image to a file. The format is guessed from the file extension. ''filename'' is an ANSI string }
procedure SaveToFileUTF8(const filenameUTF8: string);overload; virtual;
{** Save image to a file with the specified image writer. ''filename'' is an UTF8 string }
procedure SaveToFileUTF8(const filenameUTF8: string; Handler:TFPCustomImageWriter);overload; virtual;
{** Save image to a stream with the specified image writer }{inherited
procedure SaveToStream (Str:TStream; Handler:TFPCustomImageWriter);
}{** Save image to a stream in the specified image format }
procedure SaveToStreamAs(Str: TStream; AFormat: TBGRAImageFormat); virtual;
{** Save image to a stream in PNG format }
procedure SaveToStreamAsPng(Str: TStream); virtual;
procedure Serialize(AStream: TStream); virtual; abstract;
procedure Deserialize(AStream: TStream); virtual; abstract;
{** Gets the content of the specified device context }
procedure LoadFromDevice(DC: HDC); overload; virtual; abstract;
{** Gets the content from the specified rectangular area of a device context }
procedure LoadFromDevice(DC: HDC; ARect: TRect); overload; virtual; abstract;
{** Fills the content with a screenshot of the primary monitor }
procedure TakeScreenshotOfPrimaryMonitor; virtual; abstract;
{** Fills the content with a screenshot of the specified rectangular area of the desktop
(it can be from any screen) }
procedure TakeScreenshot(ARect: TRect); virtual; abstract;
{** For more methods, see derived class [[TBGRABitmap class|TBGRABitmap]] }
{Pixel functions}
procedure SetPixel(x, y: int32or64; c: TColor); overload; virtual; abstract;
procedure XorPixel(x, y: int32or64; c: TBGRAPixel); overload; virtual; abstract;
procedure SetPixel(x, y: int32or64; c: TBGRAPixel); overload; virtual; abstract;
procedure DrawPixel(x, y: int32or64; c: TBGRAPixel); overload; virtual; abstract;
procedure DrawPixel(x, y: int32or64; c: TBGRAPixel; ADrawMode: TDrawMode); overload;
procedure DrawPixel(x, y: int32or64; ec: TExpandedPixel); overload; virtual; abstract;
procedure FastBlendPixel(x, y: int32or64; c: TBGRAPixel); virtual; abstract;
procedure ErasePixel(x, y: int32or64; alpha: byte); virtual; abstract;
procedure AlphaPixel(x, y: int32or64; alpha: byte); virtual; abstract;
function GetPixel(x, y: int32or64): TBGRAPixel; overload; virtual; abstract;
function GetPixel256(x, y, fracX256,fracY256: int32or64; AResampleFilter: TResampleFilter = rfLinear; smoothBorder: boolean = true): TBGRAPixel; virtual; abstract;
function GetPixel(x, y: single; AResampleFilter: TResampleFilter = rfLinear; smoothBorder: boolean = true): TBGRAPixel; overload; virtual; abstract;
function GetPixelCycle(x, y: int32or64): TBGRAPixel;overload; virtual;
function GetPixelCycle(x, y: single; AResampleFilter: TResampleFilter = rfLinear): TBGRAPixel; overload; virtual; abstract;
function GetPixelCycle(x, y: single; AResampleFilter: TResampleFilter; repeatX: boolean; repeatY: boolean): TBGRAPixel; overload; virtual; abstract;
function GetPixelCycle256(x, y, fracX256,fracY256: int32or64; AResampleFilter: TResampleFilter = rfLinear): TBGRAPixel; overload; virtual; abstract;
function GetPixelCycle256(x, y, fracX256,fracY256: int32or64; AResampleFilter: TResampleFilter; repeatX: boolean; repeatY: boolean): TBGRAPixel; overload; virtual; abstract;
{Line primitives}
procedure SetHorizLine(x, y, x2: int32or64; c: TBGRAPixel); virtual; abstract;
procedure XorHorizLine(x, y, x2: int32or64; c: TBGRAPixel); virtual; abstract;
procedure DrawHorizLine(x, y, x2: int32or64; c: TBGRAPixel); overload; virtual; abstract;
procedure DrawHorizLine(x, y, x2: int32or64; ec: TExpandedPixel); overload; virtual; abstract;
procedure DrawHorizLine(x, y, x2: int32or64; texture: IBGRAScanner); overload;
procedure FastBlendHorizLine(x, y, x2: int32or64; c: TBGRAPixel); virtual; abstract;
procedure HorizLine(x,y,x2: Int32or64; c: TBGRAPixel; ADrawMode: TDrawMode); overload;
procedure HorizLine(x,y,x2: Int32or64; texture: IBGRAScanner; ADrawMode: TDrawMode); overload; virtual; abstract;
procedure DrawHorizLineDiff(x, y, x2: int32or64; c, compare: TBGRAPixel; maxDiff: byte); virtual; abstract;
procedure AlphaHorizLine(x, y, x2: int32or64; alpha: byte); virtual; abstract;
procedure SetVertLine(x, y, y2: int32or64; c: TBGRAPixel); virtual; abstract;
procedure XorVertLine(x, y, y2: int32or64; c: TBGRAPixel); virtual; abstract;
procedure DrawVertLine(x, y, y2: int32or64; c: TBGRAPixel); virtual; abstract;
procedure AlphaVertLine(x, y, y2: int32or64; alpha: byte); virtual; abstract;
procedure FastBlendVertLine(x, y, y2: int32or64; c: TBGRAPixel); virtual; abstract;
procedure VertLine(x,y,y2: Int32or64; c: TBGRAPixel; ADrawMode: TDrawMode);
{Shapes}
procedure DrawPath(APath: IBGRAPath; AStrokeColor: TBGRAPixel; AWidth: single; AFillColor: TBGRAPixel); overload; virtual; abstract;
procedure DrawPath(APath: IBGRAPath; AStrokeTexture: IBGRAScanner; AWidth: single; AFillColor: TBGRAPixel); overload; virtual; abstract;
procedure DrawPath(APath: IBGRAPath; AStrokeColor: TBGRAPixel; AWidth: single; AFillTexture: IBGRAScanner); overload; virtual; abstract;
procedure DrawPath(APath: IBGRAPath; AStrokeTexture: IBGRAScanner; AWidth: single; AFillTexture: IBGRAScanner); overload; virtual; abstract;
procedure DrawPath(APath: IBGRAPath; AStrokeColor: TBGRAPixel; AWidth: single); overload; virtual; abstract;
procedure DrawPath(APath: IBGRAPath; AStrokeTexture: IBGRAScanner; AWidth: single); overload; virtual; abstract;
procedure DrawPath(APath: IBGRAPath; AMatrix: TAffineMatrix; AStrokeColor: TBGRAPixel; AWidth: single; AFillColor: TBGRAPixel); overload; virtual; abstract;
procedure DrawPath(APath: IBGRAPath; AMatrix: TAffineMatrix; AStrokeTexture: IBGRAScanner; AWidth: single; AFillColor: TBGRAPixel); overload; virtual; abstract;
procedure DrawPath(APath: IBGRAPath; AMatrix: TAffineMatrix; AStrokeColor: TBGRAPixel; AWidth: single; AFillTexture: IBGRAScanner); overload; virtual; abstract;
procedure DrawPath(APath: IBGRAPath; AMatrix: TAffineMatrix; AStrokeTexture: IBGRAScanner; AWidth: single; AFillTexture: IBGRAScanner); overload; virtual; abstract;
procedure DrawPath(APath: IBGRAPath; AMatrix: TAffineMatrix; AStrokeColor: TBGRAPixel; AWidth: single); overload; virtual; abstract;
procedure DrawPath(APath: IBGRAPath; AMatrix: TAffineMatrix; AStrokeTexture: IBGRAScanner; AWidth: single); overload; virtual; abstract;
procedure ArrowStartAsNone; virtual; abstract;
procedure ArrowStartAsClassic(AFlipped: boolean = false; ACut: boolean = false; ARelativePenWidth: single = 1); virtual; abstract;
procedure ArrowStartAsTriangle(ABackOffset: single = 0; ARounded: boolean = false; AHollow: boolean = false; AHollowPenWidth: single = 0.5); virtual; abstract;
procedure ArrowStartAsTail; virtual; abstract;
procedure ArrowEndAsNone; virtual; abstract;
procedure ArrowEndAsClassic(AFlipped: boolean = false; ACut: boolean = false; ARelativePenWidth: single = 1); virtual; abstract;
procedure ArrowEndAsTriangle(ABackOffset: single = 0; ARounded: boolean = false; AHollow: boolean = false; AHollowPenWidth: single = 0.5); virtual; abstract;
procedure ArrowEndAsTail; virtual; abstract;
procedure DrawLine(x1, y1, x2, y2: integer; c: TBGRAPixel; DrawLastPixel: boolean; ADrawMode: TDrawMode= dmDrawWithTransparency); virtual; abstract;
procedure DrawLineAntialias(x1, y1, x2, y2: integer; c: TBGRAPixel; DrawLastPixel: boolean); overload; virtual; abstract;
procedure DrawLineAntialias(x1, y1, x2, y2: integer; c1, c2: TBGRAPixel; dashLen: integer; DrawLastPixel: boolean); overload; virtual; abstract;
procedure DrawLineAntialias(x1, y1, x2, y2: integer; c1, c2: TBGRAPixel; dashLen: integer; DrawLastPixel: boolean; var DashPos: integer); overload; virtual; abstract;
procedure DrawLineAntialias(x1, y1, x2, y2: single; c: TBGRAPixel; w: single); overload; virtual; abstract;
procedure DrawLineAntialias(x1, y1, x2, y2: single; texture: IBGRAScanner; w: single); overload; virtual; abstract;
procedure DrawLineAntialias(x1, y1, x2, y2: single; c: TBGRAPixel; w: single; ClosedCap: boolean); overload; virtual; abstract;
procedure DrawLineAntialias(x1, y1, x2, y2: single; texture: IBGRAScanner; w: single; ClosedCap: boolean); overload; virtual; abstract;
procedure DrawPolyLine(const points: array of TPoint; c: TBGRAPixel; DrawLastPixel: boolean; ADrawMode: TDrawMode=dmDrawWithTransparency);
procedure DrawPolyLineAntialias(const points: array of TPoint; c: TBGRAPixel; DrawLastPixel: boolean);overload; virtual;
procedure DrawPolyLineAntialias(const points: array of TPoint; c1, c2: TBGRAPixel; dashLen: integer; DrawLastPixel: boolean);overload; virtual;
procedure DrawPolyLineAntialias(const points: array of TPointF; c: TBGRAPixel; w: single); overload; virtual; abstract;
procedure DrawPolyLineAntialias(const points: array of TPointF; texture: IBGRAScanner; w: single); overload; virtual; abstract;
procedure DrawPolyLineAntialias(const points: array of TPointF; c: TBGRAPixel; w: single; ClosedCap: boolean); overload; virtual; abstract;
procedure DrawPolyLineAntialias(const points: array of TPointF; texture: IBGRAScanner; w: single; ClosedCap: boolean); overload; virtual; abstract;
procedure DrawPolyLineAntialias(const points: array of TPointF; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel); overload; virtual; abstract;
procedure DrawPolyLineAntialiasAutocycle(const points: array of TPointF; c: TBGRAPixel; w: single); overload; virtual; abstract;
procedure DrawPolyLineAntialiasAutocycle(const points: array of TPointF; texture: IBGRAScanner; w: single); overload; virtual; abstract;
procedure DrawPolygon(const points: array of TPoint; c: TBGRAPixel; ADrawMode: TDrawMode=dmDrawWithTransparency);
procedure DrawPolygonAntialias(const points: array of TPoint; c: TBGRAPixel); overload;
procedure DrawPolygonAntialias(const points: array of TPointF; c: TBGRAPixel; w: single); overload; virtual; abstract;
procedure DrawPolygonAntialias(const points: array of TPointF; texture: IBGRAScanner; w: single); overload; virtual; abstract;
procedure DrawPolygonAntialias(const points: array of TPointF; c: TBGRAPixel; w: single; fillcolor: TBGRAPixel); overload; virtual; abstract;
procedure EraseLine(x1, y1, x2, y2: integer; alpha: byte; DrawLastPixel: boolean); virtual; abstract;
procedure EraseLineAntialias(x1, y1, x2, y2: integer; alpha: byte; DrawLastPixel: boolean); overload; virtual; abstract;
procedure EraseLineAntialias(x1, y1, x2, y2: single; alpha: byte; w: single); overload; virtual; abstract;
procedure EraseLineAntialias(x1, y1, x2, y2: single; alpha: byte; w: single; Closed: boolean); overload; virtual; abstract;
procedure ErasePolyLine(const points: array of TPoint; alpha: byte; DrawLastPixel: boolean);
procedure ErasePolyLineAntialias(const points: array of TPoint; alpha: byte; DrawLastPixel: boolean); overload;
procedure ErasePolyLineAntialias(const points: array of TPointF; alpha: byte; w: single); overload; virtual; abstract;
procedure ErasePolygonOutline(const points: array of TPoint; alpha: byte);
procedure ErasePolygonOutlineAntialias(const points: array of TPoint; alpha: byte);
procedure FillPath(APath: IBGRAPath; c: TBGRAPixel); overload; virtual; abstract;
procedure FillPath(APath: IBGRAPath; texture: IBGRAScanner); overload; virtual; abstract;
procedure ErasePath(APath: IBGRAPath; alpha: byte); overload; virtual; abstract;
procedure FillPath(APath: IBGRAPath; AMatrix: TAffineMatrix; AFillColor: TBGRAPixel); overload; virtual; abstract;
procedure FillPath(APath: IBGRAPath; AMatrix: TAffineMatrix; AFillTexture: IBGRAScanner); overload; virtual; abstract;
procedure ErasePath(APath: IBGRAPath; AMatrix: TAffineMatrix; alpha: byte); overload; virtual; abstract;
procedure FillTriangleLinearColor(pt1,pt2,pt3: TPointF; c1,c2,c3: TBGRAPixel); overload; virtual; abstract;
procedure FillTriangleLinearColorAntialias(pt1,pt2,pt3: TPointF; c1,c2,c3: TBGRAPixel); overload; virtual; abstract;
procedure FillTriangleLinearMapping(pt1,pt2,pt3: TPointF; texture: IBGRAScanner; tex1, tex2, tex3: TPointF; TextureInterpolation: Boolean= True); overload; virtual; abstract;
procedure FillTriangleLinearMappingLightness(pt1,pt2,pt3: TPointF; texture: IBGRAScanner; tex1, tex2, tex3: TPointF; light1,light2,light3: BGRAWord; TextureInterpolation: Boolean= True); overload; virtual; abstract;
procedure FillTriangleLinearMappingAntialias(pt1,pt2,pt3: TPointF; texture: IBGRAScanner; tex1, tex2, tex3: TPointF); overload; virtual; abstract;
procedure FillQuadLinearColor(pt1,pt2,pt3,pt4: TPointF; c1,c2,c3,c4: TBGRAPixel); overload; virtual; abstract;
procedure FillQuadLinearColorAntialias(pt1,pt2,pt3,pt4: TPointF; c1,c2,c3,c4: TBGRAPixel); overload; virtual; abstract;
procedure FillQuadLinearMapping(pt1,pt2,pt3,pt4: TPointF; texture: IBGRAScanner; tex1, tex2, tex3, tex4: TPointF; TextureInterpolation: Boolean= True; ACulling: TFaceCulling = fcNone); overload; virtual; abstract;
procedure FillQuadLinearMappingLightness(pt1,pt2,pt3,pt4: TPointF; texture: IBGRAScanner; tex1, tex2, tex3, tex4: TPointF; light1,light2,light3,light4: BGRAWord; TextureInterpolation: Boolean= True); overload; virtual; abstract;
procedure FillQuadLinearMappingAntialias(pt1,pt2,pt3,pt4: TPointF; texture: IBGRAScanner; tex1, tex2, tex3, tex4: TPointF; ACulling: TFaceCulling = fcNone); overload; virtual; abstract;
procedure FillQuadPerspectiveMapping(pt1,pt2,pt3,pt4: TPointF; texture: IBGRAScanner; tex1, tex2, tex3, tex4: TPointF; ADrawMode: TDrawMode = dmDrawWithTransparency); overload; virtual; abstract;
procedure FillQuadPerspectiveMapping(pt1,pt2,pt3,pt4: TPointF; texture: IBGRAScanner; tex1, tex2, tex3, tex4: TPointF; ACleanBorders: TRect; ADrawMode: TDrawMode = dmDrawWithTransparency); overload; virtual; abstract;
procedure FillQuadPerspectiveMappingAntialias(pt1,pt2,pt3,pt4: TPointF; texture: IBGRAScanner; tex1, tex2, tex3, tex4: TPointF); overload; virtual; abstract;
procedure FillQuadPerspectiveMappingAntialias(pt1,pt2,pt3,pt4: TPointF; texture: IBGRAScanner; tex1, tex2, tex3, tex4: TPointF; ACleanBorders: TRect); overload; virtual; abstract;
procedure FillQuadAffineMapping(Orig,HAxis,VAxis: TPointF; AImage: TBGRACustomBitmap; APixelCenteredCoordinates: boolean = true; ADrawMode: TDrawMode = dmDrawWithTransparency; AOpacity: byte = 255); virtual; abstract;
procedure FillQuadAffineMappingAntialias(Orig,HAxis,VAxis: TPointF; AImage: TBGRACustomBitmap; APixelCenteredCoordinates: boolean = true; AOpacity: byte = 255); virtual; abstract;
procedure FillPolyLinearColor(const points: array of TPointF; AColors: array of TBGRAPixel); overload; virtual; abstract;
procedure FillPolyLinearMapping(const points: array of TPointF; texture: IBGRAScanner; texCoords: array of TPointF; TextureInterpolation: Boolean); overload; virtual; abstract;
procedure FillPolyLinearMappingLightness(const points: array of TPointF; texture: IBGRAScanner; texCoords: array of TPointF; lightnesses: array of BGRAWord; TextureInterpolation: Boolean); overload; virtual; abstract;
procedure FillPolyPerspectiveMapping(const points: array of TPointF; const pointsZ: array of single; texture: IBGRAScanner; texCoords: array of TPointF; TextureInterpolation: Boolean; zbuffer: psingle = nil); overload; virtual; abstract;
procedure FillPolyPerspectiveMappingLightness(const points: array of TPointF; const pointsZ: array of single; texture: IBGRAScanner; texCoords: array of TPointF; lightnesses: array of BGRAWord; TextureInterpolation: Boolean; zbuffer: psingle = nil); overload; virtual; abstract;
procedure FillPoly(const points: array of TPointF; c: TBGRAPixel; drawmode: TDrawMode; APixelCenteredCoordinates: boolean = true); overload; virtual; abstract;
procedure FillPoly(const points: array of TPointF; texture: IBGRAScanner; drawmode: TDrawMode; APixelCenteredCoordinates: boolean = true); overload; virtual; abstract;
procedure FillPolyAntialias(const points: array of TPointF; c: TBGRAPixel; APixelCenteredCoordinates: boolean = true); overload; virtual; abstract;
procedure FillPolyAntialias(const points: array of TPointF; texture: IBGRAScanner; APixelCenteredCoordinates: boolean = true); overload; virtual; abstract;
procedure ErasePoly(const points: array of TPointF; alpha: byte; APixelCenteredCoordinates: boolean = true); virtual; abstract;
procedure ErasePolyAntialias(const points: array of TPointF; alpha: byte; APixelCenteredCoordinates: boolean = true); virtual; abstract;
procedure FillShape(shape: TBGRACustomFillInfo; c: TBGRAPixel; drawmode: TDrawMode); overload; virtual; abstract;
procedure FillShape(shape: TBGRACustomFillInfo; texture: IBGRAScanner; drawmode: TDrawMode); overload; virtual; abstract;
procedure FillShapeAntialias(shape: TBGRACustomFillInfo; c: TBGRAPixel); overload; virtual; abstract;
procedure FillShapeAntialias(shape: TBGRACustomFillInfo; texture: IBGRAScanner); overload; virtual; abstract;
procedure EraseShape(shape: TBGRACustomFillInfo; alpha: byte); overload; virtual; abstract;
procedure EraseShapeAntialias(shape: TBGRACustomFillInfo; alpha: byte); virtual; abstract;
procedure EllipseAntialias(x, y, rx, ry: single; c: TBGRAPixel; w: single); overload; virtual; abstract;
procedure EllipseAntialias(x, y, rx, ry: single; texture: IBGRAScanner; w: single); overload; virtual; abstract;
procedure EllipseAntialias(x, y, rx, ry: single; c: TBGRAPixel; w: single; back: TBGRAPixel); overload; virtual; abstract;
procedure FillEllipseAntialias(x, y, rx, ry: single; c: TBGRAPixel); overload; virtual; abstract;
procedure FillEllipseAntialias(x, y, rx, ry: single; texture: IBGRAScanner); overload; virtual; abstract;
procedure FillEllipseLinearColorAntialias(x, y, rx, ry: single; outercolor, innercolor: TBGRAPixel); virtual; abstract;
procedure EraseEllipseAntialias(x, y, rx, ry: single; alpha: byte); virtual; abstract;
procedure Arc(cx,cy,rx,ry: single; const StartPoint,EndPoint: TPointF; AColor: TBGRAPixel; w: single; ADrawChord: boolean; AFillColor: TBGRAPixel); overload;
procedure Arc(cx,cy,rx,ry: single; StartAngleRad,EndAngleRad: Single; AColor: TBGRAPixel; w: single; ADrawChord: boolean; AFillColor: TBGRAPixel); overload;
procedure FillChord(cx,cy,rx,ry: single; const StartPoint,EndPoint: TPointF; AFillColor: TBGRAPixel); overload;
procedure FillChord(cx,cy,rx,ry: single; StartAngleRad,EndAngleRad: Single; AFillColor: TBGRAPixel); overload;
procedure FillChord(cx,cy,rx,ry: single; const StartPoint,EndPoint: TPointF; texture: IBGRAScanner); overload;
procedure FillChord(cx,cy,rx,ry: single; StartAngleRad,EndAngleRad: Single; texture: IBGRAScanner); overload;
procedure FillChordInRect(const ARect: TRect; StartAngleRad,EndAngleRad: Single; AFillColor: TBGRAPixel); overload;
procedure FillChordInRect(const ARect: TRect; StartAngleRad,EndAngleRad: Single; texture: IBGRAScanner); overload;
procedure Pie(cx,cy,rx,ry: single; const StartPoint,EndPoint: TPointF; AColor: TBGRAPixel; w: single; AFillColor: TBGRAPixel); overload;
procedure Pie(cx,cy,rx,ry: single; StartAngleRad,EndAngleRad: Single; AColor: TBGRAPixel; w: single; AFillColor: TBGRAPixel); overload;
procedure FillPie(cx,cy,rx,ry: single; const StartPoint,EndPoint: TPointF; AFillColor: TBGRAPixel); overload;
procedure FillPie(cx,cy,rx,ry: single; StartAngleRad,EndAngleRad: Single; AFillColor: TBGRAPixel); overload;
procedure FillPie(cx,cy,rx,ry: single; const StartPoint,EndPoint: TPointF; texture: IBGRAScanner); overload;
procedure FillPie(cx,cy,rx,ry: single; StartAngleRad,EndAngleRad: Single; texture: IBGRAScanner); overload;
procedure FillPieInRect(const ARect: TRect; StartAngleRad,EndAngleRad: Single; AFillColor: TBGRAPixel); overload;
procedure FillPieInRect(const ARect: TRect; StartAngleRad,EndAngleRad: Single; texture: IBGRAScanner); overload;
procedure Rectangle(x, y, x2, y2: integer; c: TBGRAPixel; mode: TDrawMode); overload; virtual; abstract;
procedure Rectangle(x, y, x2, y2: integer; BorderColor, FillColor: TBGRAPixel; mode: TDrawMode); overload; virtual; abstract;
procedure Rectangle(x, y, x2, y2: integer; c: TColor);overload; virtual;
procedure Rectangle(r: TRect; c: TBGRAPixel; mode: TDrawMode);overload; virtual;
procedure Rectangle(r: TRect; BorderColor, FillColor: TBGRAPixel; mode: TDrawMode); overload; virtual;
procedure Rectangle(r: TRect; c: TColor);overload; virtual;
procedure RectangleAntialias(x, y, x2, y2: single; c: TBGRAPixel; w: single);overload; virtual;
procedure RectangleAntialias(x, y, x2, y2: single; c: TBGRAPixel; w: single; back: TBGRAPixel); overload; virtual; abstract;
procedure RectangleAntialias(x, y, x2, y2: single; texture: IBGRAScanner; w: single); overload; virtual; abstract;
procedure RectangleWithin(x1,y1,x2,y2: single; ABorderColor: TBGRAPixel; w: single; AFillColor: TBGRAPixel; APixelCenteredCoordinates: boolean = true); overload;
procedure RectangleWithin(r: TRect; ABorderColor: TBGRAPixel; w: single; AFillColor: TBGRAPixel); overload;
procedure RoundRect(X1, Y1, X2, Y2: integer; DX, DY: integer; BorderColor, FillColor: TBGRAPixel; ADrawMode: TDrawMode = dmDrawWithTransparency); overload; virtual; abstract;
procedure RoundRect(X1, Y1, X2, Y2: integer; DX, DY: integer; BorderColor: TBGRAPixel; ADrawMode: TDrawMode = dmDrawWithTransparency); overload; virtual; abstract;
procedure RoundRectAntialias(x,y,x2,y2,rx,ry: single; c: TBGRAPixel; w: single; options: TRoundRectangleOptions = []); overload; virtual; abstract;
procedure RoundRectAntialias(x,y,x2,y2,rx,ry: single; pencolor: TBGRAPixel; w: single; fillcolor: TBGRAPixel; options: TRoundRectangleOptions = []); overload; virtual; abstract;
procedure RoundRectAntialias(x,y,x2,y2,rx,ry: single; penTexture: IBGRAScanner; w: single; fillTexture: IBGRAScanner; options: TRoundRectangleOptions = []); overload; virtual; abstract;
procedure RoundRectAntialias(x,y,x2,y2,rx,ry: single; texture: IBGRAScanner; w: single; options: TRoundRectangleOptions = []); overload; virtual; abstract;
procedure FillRoundRect(X1, Y1, X2, Y2: integer; DX, DY: integer; FillColor: TBGRAPixel; ADrawMode: TDrawMode = dmDrawWithTransparency); virtual;
procedure FillRoundRectAntialias(x,y,x2,y2,rx,ry: single; c: TBGRAPixel; options: TRoundRectangleOptions = []; pixelCenteredCoordinates: boolean = true); overload; virtual; abstract;
procedure FillRoundRectAntialias(x,y,x2,y2,rx,ry: single; texture: IBGRAScanner; options: TRoundRectangleOptions = []; pixelCenteredCoordinates: boolean = true); overload; virtual; abstract;
procedure EraseRoundRectAntialias(x,y,x2,y2,rx,ry: single; alpha: byte; options: TRoundRectangleOptions = []; pixelCenteredCoordinates: boolean = true); virtual; abstract;
procedure EllipseInRect(r: TRect; BorderColor: TBGRAPixel; ADrawMode: TDrawMode = dmDrawWithTransparency);overload; virtual;
procedure EllipseInRect(r: TRect; BorderColor,FillColor: TBGRAPixel; ADrawMode: TDrawMode = dmDrawWithTransparency);overload; virtual;
procedure FillEllipseInRect(r: TRect; FillColor: TBGRAPixel; ADrawMode: TDrawMode = dmDrawWithTransparency); virtual;
procedure FillRect(r: TRect; c: TColor);overload; virtual;
procedure FillRect(r: TRect; c: TBGRAPixel; mode: TDrawMode);overload; virtual;
procedure FillRect(r: TRect; texture: IBGRAScanner; mode: TDrawMode);overload; virtual;
procedure FillRect(r: TRect; texture: IBGRAScanner; mode: TDrawMode; AScanOffset: TPoint);overload; virtual;
procedure FillRect(r: TRect; texture: IBGRAScanner; mode: TDrawMode; ditheringAlgorithm: TDitheringAlgorithm);overload; virtual;
procedure FillRect(r: TRect; texture: IBGRAScanner; mode: TDrawMode; AScanOffset: TPoint; ditheringAlgorithm: TDitheringAlgorithm);overload; virtual;
procedure FillRect(x, y, x2, y2: integer; c: TColor);overload; virtual;
procedure FillRect(x, y, x2, y2: integer; c: TBGRAPixel; mode: TDrawMode); overload; virtual; abstract;
procedure FillRect(x, y, x2, y2: integer; texture: IBGRAScanner; mode: TDrawMode);overload; virtual;
procedure FillRect(x, y, x2, y2: integer; texture: IBGRAScanner; mode: TDrawMode; AScanOffset: TPoint); overload; virtual; abstract;
procedure FillRect(x, y, x2, y2: integer; texture: IBGRAScanner; mode: TDrawMode; ditheringAlgorithm: TDitheringAlgorithm);overload; virtual;
procedure FillRect(x, y, x2, y2: integer; texture: IBGRAScanner; mode: TDrawMode; AScanOffset: TPoint; ditheringAlgorithm: TDitheringAlgorithm); overload; virtual; abstract;
procedure FillRectAntialias(x, y, x2, y2: single; c: TBGRAPixel; pixelCenteredCoordinates: boolean = true); overload; virtual; abstract;
procedure FillRectAntialias(x, y, x2, y2: single; texture: IBGRAScanner; pixelCenteredCoordinates: boolean = true); overload; virtual; abstract;
procedure EraseRectAntialias(x, y, x2, y2: single; alpha: byte; pixelCenteredCoordinates: boolean = true); virtual; abstract;
procedure AlphaFillRect(x, y, x2, y2: integer; alpha: byte); virtual; abstract;
procedure TextOut(x, y: single; sUTF8: string; c: TBGRAPixel; align: TAlignment; ARightToLeft: boolean); overload; virtual; abstract;
procedure TextOut(x, y: single; sUTF8: string; texture: IBGRAScanner; align: TAlignment; ARightToLeft: boolean); overload; virtual; abstract;
procedure TextOutCurved(ACursor: TBGRACustomPathCursor; sUTF8: string; AColor: TBGRAPixel; AAlign: TAlignment; ALetterSpacing: single); overload; virtual; abstract;
procedure TextOutCurved(ACursor: TBGRACustomPathCursor; sUTF8: string; ATexture: IBGRAScanner; AAlign: TAlignment; ALetterSpacing: single); overload; virtual; abstract;
procedure TextOutCurved(APath: IBGRAPath; sUTF8: string; AColor: TBGRAPixel; AAlign: TAlignment; ALetterSpacing: single);overload; virtual;
procedure TextOutCurved(APath: IBGRAPath; sUTF8: string; ATexture: IBGRAScanner; AAlign: TAlignment; ALetterSpacing: single);overload; virtual;
procedure TextOutAngle(x, y: single; orientationTenthDegCCW: integer; sUTF8: string; c: TBGRAPixel; align: TAlignment); overload; virtual; abstract;
procedure TextOutAngle(x, y: single; orientationTenthDegCCW: integer; sUTF8: string; texture: IBGRAScanner; align: TAlignment); overload; virtual; abstract;
procedure TextRect(ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; c: TBGRAPixel); overload; virtual; abstract;
procedure TextRect(ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; texture: IBGRAScanner); overload; virtual; abstract;
procedure TextMultiline(x,y: single; sUTF8: string; c: TBGRAPixel; AAlign: TBidiTextAlignment = btaLeftJustify; AVertAlign: TTextLayout = tlTop; AParagraphSpacing: single = 0); overload;
procedure TextMultiline(x,y: single; sUTF8: string; ATexture: IBGRAScanner; AAlign: TBidiTextAlignment = btaLeftJustify; AVertAlign: TTextLayout = tlTop; AParagraphSpacing: single = 0); overload;
procedure TextMultiline(ALeft,ATop,AWidth: single; sUTF8: string; c: TBGRAPixel; AAlign: TBidiTextAlignment = btaNatural; AVertAlign: TTextLayout = tlTop; AParagraphSpacing: single = 0); overload; virtual; abstract;
procedure TextMultiline(ALeft,ATop,AWidth: single; sUTF8: string; ATexture: IBGRAScanner; AAlign: TBidiTextAlignment = btaNatural; AVertAlign: TTextLayout = tlTop; AParagraphSpacing: single = 0); overload; virtual; abstract;
function TextSize(sUTF8: string): TSize; overload; virtual; abstract;
function TextAffineBox(sUTF8: string): TAffineBox; virtual; abstract;
function TextSize(sUTF8: string; AMaxWidth: integer): TSize; overload; virtual; abstract;
function TextSize(sUTF8: string; AMaxWidth: integer; ARightToLeft: boolean): TSize; overload; virtual; abstract;
function TextFitInfo(sUTF8: string; AMaxWidth: integer): integer; virtual; abstract;
{ Draw the UTF8 encoded string, (x,y) being the top-left corner. The color c or texture is used to fill the text.
The value of FontOrientation is taken into account, so that the text may be rotated. }
procedure TextOut(x, y: single; sUTF8: string; c: TBGRAPixel; align: TAlignment);overload; virtual;
procedure TextOut(x, y: single; sUTF8: string; texture: IBGRAScanner; align: TAlignment);overload; virtual;
procedure TextOut(x, y: single; sUTF8: string; c: TBGRAPixel);overload; virtual;
procedure TextOut(x, y: single; sUTF8: string; c: TBGRAPixel; ARightToLeft: boolean);overload; virtual;
procedure TextOut(x, y: single; sUTF8: string; c: TColor);overload; virtual;
procedure TextOut(x, y: single; sUTF8: string; c: TColor; ARightToLeft: boolean);overload; virtual;
procedure TextOut(x, y: single; sUTF8: string; texture: IBGRAScanner);overload; virtual;
procedure TextOut(x, y: single; sUTF8: string; texture: IBGRAScanner; ARightToLeft: boolean);overload; virtual;
{ Draw the UTF8 encoded string in the rectangle ARect. Text is wrapped if necessary.
The position depends on the specified horizontal alignment halign and vertical alignement valign.
The color c or texture is used to fill the text. No rotation is applied. }
procedure TextRect(ARect: TRect; sUTF8: string; halign: TAlignment; valign: TTextLayout; c: TBGRAPixel);overload; virtual;
procedure TextRect(ARect: TRect; sUTF8: string; halign: TAlignment; valign: TTextLayout; texture: IBGRAScanner);overload; virtual;
{Spline}
function ComputeClosedSpline(const APoints: array of TPointF; AStyle: TSplineStyle): ArrayOfTPointF; virtual; abstract;
function ComputeOpenedSpline(const APoints: array of TPointF; AStyle: TSplineStyle): ArrayOfTPointF; virtual; abstract;
function ComputeBezierCurve(const curve: TCubicBezierCurve): ArrayOfTPointF; overload; virtual; abstract;
function ComputeBezierCurve(const curve: TQuadraticBezierCurve): ArrayOfTPointF; overload; virtual; abstract;
function ComputeBezierSpline(const spline: array of TCubicBezierCurve): ArrayOfTPointF; overload; virtual; abstract;
function ComputeBezierSpline(const spline: array of TQuadraticBezierCurve): ArrayOfTPointF; overload; virtual; abstract;
function ComputeWidePolyline(const points: array of TPointF; w: single): ArrayOfTPointF; overload; virtual; abstract;
function ComputeWidePolyline(const points: array of TPointF; w: single; ClosedCap: boolean): ArrayOfTPointF; overload; virtual; abstract;
function ComputeWidePolygon(const points: array of TPointF; w: single): ArrayOfTPointF; virtual; abstract;
function ComputeEllipse(x,y,rx,ry: single): ArrayOfTPointF; overload; deprecated;
function ComputeEllipse(x,y,rx,ry,w: single): ArrayOfTPointF; overload; deprecated;
function ComputeEllipseContour(x,y,rx,ry: single; quality: single = 1): ArrayOfTPointF; virtual; abstract;
function ComputeEllipseBorder(x,y,rx,ry,w: single; quality: single = 1): ArrayOfTPointF; virtual; abstract;
function ComputeArc65536(x,y,rx,ry: single; start65536,end65536: BGRAWord; quality: single = 1): ArrayOfTPointF; virtual; abstract;
function ComputeArcRad(x,y,rx,ry: single; startRad,endRad: single; quality: single = 1): ArrayOfTPointF; virtual; abstract;
function ComputeRoundRect(x1,y1,x2,y2,rx,ry: single; quality: single = 1): ArrayOfTPointF; overload; virtual; abstract;
function ComputeRoundRect(x1,y1,x2,y2,rx,ry: single; options: TRoundRectangleOptions; quality: single = 1): ArrayOfTPointF; overload; virtual; abstract;
function ComputePie65536(x,y,rx,ry: single; start65536,end65536: BGRAWord; quality: single = 1): ArrayOfTPointF; virtual; abstract;
function ComputePieRad(x,y,rx,ry: single; startRad,endRad: single; quality: single = 1): ArrayOfTPointF; virtual; abstract;
{Filling}
procedure FillTransparent; virtual;
procedure NoClip; virtual; abstract;
procedure ApplyGlobalOpacity(alpha: byte); overload; virtual; abstract;
procedure ApplyGlobalOpacity(ARect: TRect; alpha: byte); overload; virtual; abstract;
procedure Fill(c: TColor);overload; virtual;
procedure Fill(c: TBGRAPixel);overload; virtual;
procedure Fill(texture: IBGRAScanner; mode: TDrawMode); overload; virtual; abstract;
procedure Fill(texture: IBGRAScanner); overload; virtual; abstract;
procedure Fill(c: TBGRAPixel; start, Count: integer); overload; virtual; abstract;
procedure DrawPixels(c: TBGRAPixel; start, Count: integer); virtual; abstract;
procedure AlphaFill(alpha: byte);overload; virtual;
procedure AlphaFill(alpha: byte; start, Count: integer); overload; virtual; abstract;
procedure FillMask(x,y: integer; AMask: TBGRACustomBitmap; color: TBGRAPixel);overload; virtual;
procedure FillMask(x,y: integer; AMask: TBGRACustomBitmap; texture: IBGRAScanner);overload; virtual;
procedure FillMask(x,y: integer; AMask: TBGRACustomBitmap; color: TBGRAPixel; ADrawMode: TDrawMode); overload; virtual; abstract;
procedure FillMask(x,y: integer; AMask: TBGRACustomBitmap; texture: IBGRAScanner; ADrawMode: TDrawMode; AOpacity: byte = 255); overload; virtual; abstract;
procedure FillClearTypeMask(x,y: integer; xThird: integer; AMask: TBGRACustomBitmap; color: TBGRAPixel; ARGBOrder: boolean = true); overload; virtual; abstract;
procedure FillClearTypeMask(x,y: integer; xThird: integer; AMask: TBGRACustomBitmap; texture: IBGRAScanner; ARGBOrder: boolean = true); overload; virtual; abstract;
procedure ReplaceColor(before, after: TColor); overload; virtual; abstract;
procedure ReplaceColor(before, after: TBGRAPixel); overload; virtual; abstract;
procedure ReplaceColor(ARect: TRect; before, after: TColor); overload; virtual; abstract;
procedure ReplaceColor(ARect: TRect; before, after: TBGRAPixel); overload; virtual; abstract;
procedure ReplaceTransparent(after: TBGRAPixel); overload; virtual; abstract;
procedure ReplaceTransparent(ABounds: TRect; after: TBGRAPixel); overload; virtual; abstract;
procedure FloodFill(X, Y: integer; Color: TBGRAPixel;
mode: TFloodfillMode; Tolerance: byte = 0); virtual;
procedure ParallelFloodFill(X, Y: integer; Dest: TBGRACustomBitmap; Color: TBGRAPixel;
mode: TFloodfillMode; Tolerance: byte = 0); virtual; abstract;
procedure GradientFill(x, y, x2, y2: integer; c1, c2: TBGRAPixel;
gtype: TGradientType; o1, o2: TPointF; mode: TDrawMode;
gammaColorCorrection: boolean = True; Sinus: Boolean=False;
ditherAlgo: TDitheringAlgorithm = daNearestNeighbor); overload; virtual; abstract;
procedure GradientFill(x, y, x2, y2: integer; gradient: TBGRACustomGradient;
gtype: TGradientType; o1, o2: TPointF; mode: TDrawMode;
Sinus: Boolean=False;
ditherAlgo: TDitheringAlgorithm = daNearestNeighbor); overload; virtual; abstract;
function CreateBrushTexture(ABrushStyle: TBrushStyle; APatternColor, ABackgroundColor: TBGRAPixel;
AWidth: integer = 8; AHeight: integer = 8; APenWidth: single = 1): TBGRACustomBitmap; virtual; abstract;
{Canvas drawing functions}
procedure DataDrawTransparent(ACanvas: TCanvas; Rect: TRect;
AData: Pointer; ALineOrder: TRawImageLineOrder; AWidth, AHeight: integer); virtual; abstract;
procedure DataDrawOpaque(ACanvas: TCanvas; ARect: TRect; AData: Pointer;
ALineOrder: TRawImageLineOrder; AWidth, AHeight: integer); virtual; abstract;
procedure GetImageFromCanvas(CanvasSource: TCanvas; x, y: integer); virtual; abstract;
procedure Draw(ACanvas: TCanvas; x, y: integer; Opaque: boolean = True); overload; virtual; abstract;
procedure Draw(ACanvas: TCanvas; Rect: TRect; Opaque: boolean = True); overload; virtual; abstract;
procedure DrawPart(ARect: TRect; ACanvas: TCanvas; x, y: integer; Opaque: boolean); virtual;
function GetPart(ARect: TRect): TBGRACustomBitmap; virtual; abstract;
function GetPtrBitmap(Top,Bottom: Integer): TBGRACustomBitmap; virtual; abstract;
procedure InvalidateBitmap; virtual; abstract; //call if you modify with Scanline
procedure LoadFromBitmapIfNeeded; virtual; abstract; //call to ensure that bitmap data is up to date
{BGRA bitmap functions}
procedure CrossFade(ARect: TRect; Source1, Source2: IBGRAScanner; AFadePosition: byte; mode: TDrawMode = dmDrawWithTransparency); overload; virtual; abstract;
procedure CrossFade(ARect: TRect; Source1, Source2: IBGRAScanner; AFadeMask: IBGRAScanner; mode: TDrawMode = dmDrawWithTransparency); overload; virtual; abstract;
procedure PutImage(x, y: integer; Source: TBGRACustomBitmap; mode: TDrawMode; AOpacity: byte = 255); overload; virtual; abstract;
procedure PutImage(x, y: integer; Source: TBitmap; mode: TDrawMode; AOpacity: byte = 255); overload;
procedure StretchPutImage(ARect: TRect; Source: TBGRACustomBitmap; mode: TDrawMode; AOpacity: byte = 255); virtual; abstract;
procedure PutImageSubpixel(x, y: single; Source: TBGRACustomBitmap; AOpacity: byte = 255);
procedure PutImagePart(x,y: integer; Source: TBGRACustomBitmap; SourceRect: TRect; mode: TDrawMode; AOpacity: byte = 255);
procedure PutImageAffine(Origin,HAxis,VAxis: TPointF; Source: TBGRACustomBitmap; AOpacity: Byte=255; ACorrectBlur: Boolean = false); overload;
procedure PutImageAffine(Origin,HAxis,VAxis: TPointF; Source: TBGRACustomBitmap; AResampleFilter: TResampleFilter; AOpacity: Byte=255); overload;
procedure PutImageAffine(Origin,HAxis,VAxis: TPointF; Source: TBGRACustomBitmap; AOutputBounds: TRect; AResampleFilter: TResampleFilter; AMode: TDrawMode; AOpacity: Byte=255); overload;
procedure PutImageAffine(Origin,HAxis,VAxis: TPointF; Source: TBGRACustomBitmap; AOutputBounds: TRect; AOpacity: Byte=255; ACorrectBlur: Boolean = false); overload;
procedure PutImageAffine(AMatrix: TAffineMatrix; Source: TBGRACustomBitmap; AOpacity: Byte=255; ACorrectBlur: Boolean = false); overload;
procedure PutImageAffine(AMatrix: TAffineMatrix; Source: TBGRACustomBitmap; AResampleFilter: TResampleFilter; AOpacity: Byte=255); overload;
procedure PutImageAffine(AMatrix: TAffineMatrix; Source: TBGRACustomBitmap; AResampleFilter: TResampleFilter; AMode: TDrawMode; AOpacity: Byte=255); overload;
procedure PutImageAffine(AMatrix: TAffineMatrix; Source: TBGRACustomBitmap; AOutputBounds: TRect; AResampleFilter: TResampleFilter; AMode: TDrawMode; AOpacity: Byte=255); overload; virtual; abstract;
procedure PutImageAffine(AMatrix: TAffineMatrix; Source: TBGRACustomBitmap; AOutputBounds: TRect; AOpacity: Byte=255; ACorrectBlur: Boolean = false); overload;
function GetImageAffineBounds(Origin,HAxis,VAxis: TPointF; Source: TBGRACustomBitmap): TRect; overload;
function GetImageAffineBounds(Origin,HAxis,VAxis: TPointF; ASourceWidth, ASourceHeight: integer; const ASourceBounds: TRect; AClipOutput: boolean = true): TRect; overload;
function GetImageAffineBounds(AMatrix: TAffineMatrix; Source: TBGRACustomBitmap): TRect; overload;
function GetImageAffineBounds(AMatrix: TAffineMatrix; ASourceBounds: TRect; AClipOutput: boolean = true): TRect; overload; virtual; abstract;
function IsAffineRoughlyTranslation(AMatrix: TAffineMatrix; ASourceBounds: TRect): boolean; virtual; abstract;
procedure PutImageAngle(x,y: single; Source: TBGRACustomBitmap; angle: single; AOutputBounds: TRect; imageCenterX: single = 0; imageCenterY: single = 0; AOpacity: Byte=255; ARestoreOffsetAfterRotation: boolean = false; ACorrectBlur: Boolean = false); overload;
procedure PutImageAngle(x,y: single; Source: TBGRACustomBitmap; angle: single; imageCenterX: single = 0; imageCenterY: single = 0; AOpacity: Byte=255; ARestoreOffsetAfterRotation: boolean = false; ACorrectBlur: Boolean = false); overload;
procedure PutImageAngle(x,y: single; Source: TBGRACustomBitmap; angle: single; AOutputBounds: TRect; AResampleFilter: TResampleFilter; imageCenterX: single = 0; imageCenterY: single = 0; AOpacity: Byte=255; ARestoreOffsetAfterRotation: boolean = false); overload;
procedure PutImageAngle(x,y: single; Source: TBGRACustomBitmap; angle: single; AResampleFilter: TResampleFilter; imageCenterX: single = 0; imageCenterY: single = 0; AOpacity: Byte=255; ARestoreOffsetAfterRotation: boolean = false); overload;
procedure ComputeImageAngleAxes(x,y,w,h,angle: single; imageCenterX,imageCenterY: single; ARestoreOffsetAfterRotation: boolean;
out Origin,HAxis,VAxis: TPointF);
function GetImageAngleBounds(x,y: single; Source: TBGRACustomBitmap; angle: single; imageCenterX: single = 0; imageCenterY: single = 0; ARestoreOffsetAfterRotation: boolean = false): TRect;
procedure BlendImage(x, y: integer; Source: TBGRACustomBitmap; operation: TBlendOperation); virtual; abstract;
procedure BlendImageOver(x, y: integer; Source: TBGRACustomBitmap; operation: TBlendOperation; AOpacity: byte = 255;
ALinearBlend: boolean = false); virtual; abstract;
function Duplicate(DuplicateProperties: Boolean = False; DuplicateXorMask: Boolean = False): TBGRACustomBitmap; virtual; abstract;
function Equals(comp: TBGRACustomBitmap): boolean; overload; virtual; abstract;
function Equals(comp: TBGRAPixel): boolean; overload; virtual; abstract;
function Resample(newWidth, newHeight: integer;
mode: TResampleMode = rmFineResample): TBGRACustomBitmap; virtual; abstract;
procedure VerticalFlip;overload; virtual;
procedure VerticalFlip(ARect: TRect); overload; virtual; abstract;
procedure HorizontalFlip;overload; virtual;
procedure HorizontalFlip(ARect: TRect); overload; virtual; abstract;
function RotateCW: TBGRACustomBitmap; virtual; abstract;
function RotateCCW: TBGRACustomBitmap; virtual; abstract;
procedure Negative; virtual; abstract;
procedure NegativeRect(ABounds: TRect); virtual; abstract;
procedure LinearNegative; virtual; abstract;
procedure LinearNegativeRect(ABounds: TRect); virtual; abstract;
procedure InplaceGrayscale(AGammaCorrection: boolean = true); overload; virtual; abstract;
procedure InplaceGrayscale(ABounds: TRect; AGammaCorrection: boolean = true); overload; virtual; abstract;
procedure InplaceNormalize(AEachChannel: boolean = True); overload; virtual; abstract;
procedure InplaceNormalize(ABounds: TRect; AEachChannel: boolean = True); overload; virtual; abstract;
procedure ConvertToLinearRGB; virtual; abstract;
procedure ConvertFromLinearRGB; virtual; abstract;
procedure SwapRedBlue; overload; virtual; abstract;
procedure SwapRedBlue(ARect: TRect); overload; virtual; abstract;
procedure GrayscaleToAlpha; virtual; abstract;
procedure AlphaToGrayscale; virtual; abstract;
procedure ApplyMask(mask: TBGRACustomBitmap); overload;
procedure ApplyMask(mask: TBGRACustomBitmap; ARect: TRect); overload;
procedure ApplyMask(mask: TBGRACustomBitmap; ARect: TRect; AMaskRectTopLeft: TPoint); overload; virtual; abstract;
function GetMaskFromAlpha: TBGRACustomBitmap; virtual; abstract;
function GetImageBounds(Channel: TChannel = cAlpha; ANothingValue: Byte = 0): TRect; overload; virtual;
function GetImageBounds(Channels: TChannels; ANothingValue: Byte = 0): TRect; overload; virtual;
function GetImageBoundsWithin(const ARect: TRect; Channel: TChannel = cAlpha; ANothingValue: Byte = 0): TRect; overload; virtual;
function GetImageBoundsWithin(const ARect: TRect; Channels: TChannels; ANothingValue: Byte = 0): TRect; overload; virtual;
function GetDifferenceBounds(ABitmap: TBGRACustomBitmap): TRect; virtual; abstract;
function MakeBitmapCopy(BackgroundColor: TColor): TBitmap; virtual; abstract;
{Filters}
function FilterSmartZoom3(Option: TMedianOption): TBGRACustomBitmap; virtual; abstract;
function FilterMedian(Option: TMedianOption): TBGRACustomBitmap; virtual; abstract;
function FilterSmooth: TBGRACustomBitmap; virtual; abstract;
function FilterSharpen(Amount: single = 1): TBGRACustomBitmap; overload; virtual; abstract;
function FilterSharpen(ABounds: TRect; Amount: single = 1): TBGRACustomBitmap; overload; virtual; abstract;
function FilterContour: TBGRACustomBitmap; virtual; abstract;
function FilterPixelate(pixelSize: integer; useResample: boolean; filter: TResampleFilter = rfLinear): TBGRACustomBitmap; virtual; abstract;
function FilterBlurRadial(radius: single; blurType: TRadialBlurType): TBGRACustomBitmap; overload; virtual; abstract;
function FilterBlurRadial(ABounds: TRect; radius: single; blurType: TRadialBlurType): TBGRACustomBitmap; overload; virtual; abstract;
function FilterBlurRadial(radiusX, radiusY: single; blurType: TRadialBlurType): TBGRACustomBitmap; overload; virtual; abstract;
function FilterBlurRadial(ABounds: TRect; radiusX, radiusY: single; blurType: TRadialBlurType): TBGRACustomBitmap; overload; virtual; abstract;
function FilterBlurMotion(distance: single; angle: single; oriented: boolean): TBGRACustomBitmap; overload; virtual; abstract;
function FilterBlurMotion(ABounds: TRect; distance: single; angle: single; oriented: boolean): TBGRACustomBitmap; overload; virtual; abstract;
function FilterCustomBlur(mask: TBGRACustomBitmap): TBGRACustomBitmap; overload; virtual; abstract;
function FilterCustomBlur(ABounds: TRect; mask: TBGRACustomBitmap): TBGRACustomBitmap; overload; virtual; abstract;
function FilterEmboss(angle: single; AStrength: integer= 64; AOptions: TEmbossOptions = []): TBGRACustomBitmap; overload; virtual; abstract;
function FilterEmboss(angle: single; ABounds: TRect; AStrength: integer= 64; AOptions: TEmbossOptions = []): TBGRACustomBitmap; overload; virtual; abstract;
function FilterEmbossHighlight(FillSelection: boolean): TBGRACustomBitmap; overload; virtual; abstract;
function FilterEmbossHighlight(FillSelection: boolean; BorderColor: TBGRAPixel): TBGRACustomBitmap; overload; virtual; abstract;
function FilterEmbossHighlight(FillSelection: boolean; BorderColor: TBGRAPixel; var Offset: TPoint): TBGRACustomBitmap; overload; virtual; abstract;
function FilterGrayscale: TBGRACustomBitmap; overload; virtual; abstract;
function FilterGrayscale(ABounds: TRect): TBGRACustomBitmap; overload; virtual; abstract;
function FilterNormalize(eachChannel: boolean = True): TBGRACustomBitmap; overload; virtual; abstract;
function FilterNormalize(ABounds: TRect; eachChannel: boolean = True): TBGRACustomBitmap; overload; virtual; abstract;
function FilterRotate(origin: TPointF; angle: single; correctBlur: boolean = false): TBGRACustomBitmap; virtual; abstract;
function FilterAffine(AMatrix: TAffineMatrix; correctBlur: boolean = false): TBGRACustomBitmap; virtual; abstract;
function FilterSphere: TBGRACustomBitmap; virtual; abstract;
function FilterTwirl(ACenter: TPoint; ARadius: Single; ATurn: Single=1; AExponent: Single=3): TBGRACustomBitmap; overload; virtual; abstract;
function FilterTwirl(ABounds: TRect; ACenter: TPoint; ARadius: Single; ATurn: Single=1; AExponent: Single=3): TBGRACustomBitmap; overload; virtual; abstract;
function FilterCylinder: TBGRACustomBitmap; virtual; abstract;
function FilterPlane: TBGRACustomBitmap; virtual; abstract;
//IBGRAScanner
function ScanAtInteger(X,Y: integer): TBGRAPixel; virtual; abstract;
function ScanAtIntegerExpanded(X,Y: integer): TExpandedPixel; virtual;
procedure ScanMoveTo(X,Y: Integer); virtual; abstract;
function ScanNextPixel: TBGRAPixel; virtual; abstract;
function ScanNextExpandedPixel: TExpandedPixel; virtual;
function ScanAt(X,Y: Single): TBGRAPixel; virtual; abstract;
function ScanAtExpanded(X,Y: Single): TExpandedPixel; virtual;
procedure ScanPutPixels(pdest: PBGRAPixel; count: integer; mode: TDrawMode); virtual;
function IsScanPutPixelsDefined: boolean; virtual;
function ProvidesScanline(ARect: TRect): boolean; virtual;
function GetScanlineAt(X, Y: integer): PBGRAPixel; virtual;
protected
//interface
{$IFNDEF FPC}
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function _AddRef: Integer; stdcall;
function _Release: Integer; stdcall;
{$ELSE}
function QueryInterface({$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): HResult; {$IF (not defined(WINDOWS)) AND (not defined(FPC20501))}cdecl{$ELSE}stdcall{$IFEND};
function _AddRef: Integer; {$IF (not defined(WINDOWS)) AND (not defined(FPC20501))}cdecl{$ELSE}stdcall{$IFEND};
function _Release: Integer; {$IF (not defined(WINDOWS)) AND (not defined(FPC20501))}cdecl{$ELSE}stdcall{$IFEND};
{$ENDIF}
end;
type
TBGRABitmapAny = class of TBGRACustomBitmap; //used to create instances of the same type (see NewBitmap)
var
BGRABitmapFactory : TBGRABitmapAny;
{$ENDIF}
{$IFDEF INCLUDE_IMPLEMENTATION}
{$UNDEF INCLUDE_IMPLEMENTATION}
function InternalGetImageBoundsWithin(ASourceBitmap: TBGRACustomBitmap; ASourceTexture: IBGRAScanner;
const ARect: TRect; Channels: TChannels; ANothingValue: Byte): TRect;
var
minx, miny, maxx, maxy: integer;
xb, xb2, yb: integer;
p: {$IFDEF BDS}PBGRAPixel;{$ELSE}PBGRADWord;{$ENDIF}
colorMask, colorZeros: BGRADWord;
actualRect: TRect;
pixelBuffer: TBGRAPixelBuffer;
begin
pixelBuffer := nil;
if ASourceBitmap <> nil then
begin
actualRect := EmptyRect;
IntersectRect(actualRect,ARect,rect(0,0,ASourceBitmap.Width,ASourceBitmap.Height))
end
else if ASourceTexture <> nil then
begin
actualRect := ARect;
AllocateBGRAPixelBuffer(pixelBuffer, ARect.Right-ARect.Left)
end
else
begin
result := EmptyRect;
exit;
end;
maxx := actualRect.Left-1;
maxy := actualRect.Top-1;
minx := actualRect.Right;
miny := actualRect.Bottom;
colorMask := 0;
colorZeros := 0;
if cBlue in Channels then
begin
colorMask := colorMask or BGRALongWord(BGRA(0,0,255,0));
colorZeros:= colorZeros or BGRALongWord(BGRA(0,0,ANothingValue,0));
end;
if cGreen in Channels then
begin
colorMask := colorMask or BGRALongWord(BGRA(0,255,0,0));
colorZeros:= colorZeros or BGRALongWord(BGRA(0,ANothingValue,0,0));
end;
if cRed in Channels then
begin
colorMask := colorMask or BGRALongWord(BGRA(255,0,0,0));
colorZeros:= colorZeros or BGRALongWord(BGRA(ANothingValue,0,0,0));
end;
if cAlpha in Channels then
begin
colorMask := colorMask or BGRALongWord(BGRA(0,0,0,255));
colorZeros:= colorZeros or BGRALongWord(BGRA(0,0,0,ANothingValue));
end;
{$IFNDEF BDS}colorMask := NtoLE(colorMask){$ENDIF};
{$IFNDEF BDS}colorZeros := NtoLE(colorZeros){$ENDIF};
for yb := actualRect.Top to actualRect.Bottom-1 do
begin
if ASourceBitmap <> nil then
p := {$IFDEF BDS}ASourceBitmap.Scanline[yb]{$ELSE}PBGRADWord(ASourceBitmap.Scanline[yb]){$ENDIF} + actualRect.Left
else
begin
p := @pixelBuffer[0];
ASourceTexture.ScanMoveTo(actualRect.Left,actualRect.Top);
ASourceTexture.ScanPutPixels(PBGRAPixel(p),ARect.Right-ARect.Left, dmSet);
end;
for xb := actualRect.Left to actualRect.Right - 1 do
begin
if {$IFDEF BDS}(BGRALongWord(p^){$ELSE}(p^{$ENDIF} and colorMask) <> colorZeros then
begin
if xb < minx then
minx := xb;
if yb < miny then
miny := yb;
if xb > maxx then
maxx := xb;
if yb > maxy then
maxy := yb;
inc(p, actualRect.Right-1-xb);
for xb2 := actualRect.Right-1 downto xb+1 do
begin
if (BGRALongWord(p^) and colorMask) <> colorZeros then
begin
if xb2 > maxx then
maxx := xb2;
break;
end;
dec(p);
end;
break;
end;
Inc(p);
end;
end;
if minx > maxx then
begin
Result.left := 0;
Result.top := 0;
Result.right := 0;
Result.bottom := 0;
end
else
begin
Result.left := minx;
Result.top := miny;
Result.right := maxx + 1;
Result.bottom := maxy + 1;
end;
end;
{ TBGRACustomScanner }
{ The abstract class record the position so that a derived class
need only to redefine ScanAt }
function TBGRACustomScanner.GetInstance : TObject;
begin
result := Self;
end;