Difference between revisions of "TBGRACustomBitmap and IBGRAScanner"

From Lazarus wiki
Jump to navigationJump to search
(→‎TBGRACustomBitmap: resample type)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category: BGRABitmap]]
 
Back to [[BGRABitmap]].
 
Back to [[BGRABitmap]].
  
 
This class and this interface are included in ''BGRABitmapTypes''.
 
This class and this interface are included in ''BGRABitmapTypes''.
 +
 +
For methods (procedure and functions), see [[TBGRABitmap class]].
  
 
=== TBGRACustomBitmap and IBGRAScanner ===
 
=== TBGRACustomBitmap and IBGRAScanner ===
 
==== IBGRAScanner ====
 
==== IBGRAScanner ====
<table style="border-collapse: collapse;">
+
<table style="border-collapse: collapse; width: 100%">
 
<tr style="background: white;"><td colspan="3">''IBGRAScanner'' = '''interface'''</td></tr>
 
<tr style="background: white;"><td colspan="3">''IBGRAScanner'' = '''interface'''</td></tr>
 
<tr style="background: white;"><td width="10%"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;" colspan="2">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. <br/> <br/>Note: it must not implement reference counting even if it is an interface <br/> <br/>''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</td></tr>
 
<tr style="background: white;"><td width="10%"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;" colspan="2">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. <br/> <br/>Note: it must not implement reference counting even if it is an interface <br/> <br/>''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</td></tr>
Line 22: Line 25:
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''procedure''' ScanPutPixels(pdest: PBGRAPixel; count: integer; mode: TDrawMode);</td></tr>
 
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''procedure''' ScanPutPixels(pdest: PBGRAPixel; count: integer; mode: TDrawMode);</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Copy a row of pixels from ''X'' to ''X''+count-1 to a specified destination ''pdest''. ''mode'' indicates how to combine with existing data</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Copy a row of pixels from ''X'' to ''X''+''count''-1 to a specified destination ''pdest''. ''mode'' indicates how to combine with existing data</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''function''' IsScanPutPixelsDefined: boolean;</td></tr>
 
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''function''' IsScanPutPixelsDefined: boolean;</td></tr>
Line 41: Line 44:
 
</table>
 
</table>
 
==== TBGRACustomBitmap ====
 
==== TBGRACustomBitmap ====
<table style="border-collapse: collapse;">
+
<table style="border-collapse: collapse; width: 100%">
 
<tr style="background: white;"><td colspan="3">''TBGRACustomBitmap'' = '''class'''(TFPCustomImage,IBGRAScanner)</td></tr>
 
<tr style="background: white;"><td colspan="3">''TBGRACustomBitmap'' = '''class'''(TFPCustomImage,IBGRAScanner)</td></tr>
 
<tr style="background: white;"><td width="10%"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;" colspan="2">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''</td></tr>
 
<tr style="background: white;"><td width="10%"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;" colspan="2">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''</td></tr>
Line 48: Line 51:
 
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">User defined caption. It does not appear on the image</td></tr>
 
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">User defined caption. It does not appear on the image</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">''FontName'': '''string''';</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">''FillMode'': TFillMode;</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies the font to use. Unless the font renderer accept otherwise, the name is in human readable form, like 'Arial', 'Times New Roman', ...</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Method to use when filling polygons (winding or alternate). See [[BGRABitmap Types imported from Graphics|BGRAGraphics]]</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">''FontStyle'': TFontStyles;</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">''LinearAntialiasing'': boolean;</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">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]]</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies if linear antialiasing must be used when drawing antialiased shapes</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">''FontQuality'' : TBGRAFontQuality;</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">''ResampleFilter'' : TResampleFilter;</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies the quality of rendering. Default value is ''fqSystem''. See [[BGRABitmap Miscellaneous types|miscellaneous types]]</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Resample filter is used when resizing the bitmap. See [[BGRABitmap Miscellaneous types#Images and resampling|resampling types]]</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">''FontOrientation'': integer;</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">''ScanInterpolationFilter'': TResampleFilter;</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies the rotation of the text, for functions that support text rotation. It is expressed in tenth of degrees, positive values going counter-clockwise.</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Scan interpolation filter is used when the bitmap is used as a scanner (interface ''IBGRAScanner'')</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">''FontVerticalAnchor'': TFontVerticalAnchor;</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">''ScanOffset'': TPoint;</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies how the font is vertically aligned relative to the start coordinate. See [[BGRABitmap Miscellaneous types|miscellaneous types]]</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Offset to apply when the image is scanned using ''IBGRAScanner'' interface</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">''JoinStyle'': TPenJoinStyle;</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' Width: integer '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">How to join segments. See [[BGRABitmap Types imported from Graphics|BGRAGraphics]]</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Width of the image in pixels</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">''JoinMiterLimit'': single;</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' Height: integer '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Limit for the extension of the segments when joining them with ''pjsMiter'' join style, expressed in multiples of the width of the pen</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Height of the image in pixels</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">''FillMode'': TFillMode;</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' ClipRect: TRect '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Method to use when filling polygons (winding or alternate). See [[BGRABitmap Types imported from Graphics|BGRAGraphics]]</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Clipping rectangle for all drawing functions</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">''LinearAntialiasing'': boolean;</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' NbPixels: integer '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies if linear antialiasing must be used when drawing antialiased shapes</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Total number of pixels. It is always true that ''NbPixels'' = ''Width'' * ''Height''</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">''ResampleFilter'' : TResampleFilter;</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' ScanLine[y: integer]: PBGRAPixel '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Resample filter is used when resizing the bitmap</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Returns the address of the left-most pixel of any line. The parameter y ranges from 0 to Height-1</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">''ScanInterpolationFilter'': TResampleFilter;</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' LineOrder: TRawImageLineOrder '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Scan interpolation filter is used when the bitmap is used as a scanner (interface ''IBGRAScanner'')</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">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]]</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">''ScanOffset'': TPoint;</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' Data: PBGRAPixel '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Offset to apply when the image is scanned using ''IBGRAScanner'' interface</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">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]]</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' Width: integer</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' RefCount: integer '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Width of the image in pixels</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Number of references to this image. It is increased by the function ''NewReference'' and decreased by the function ''FreeReference''</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' Height: integer</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' Empty: boolean '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Height of the image in pixels</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Returns True if the bitmap only contains transparent pixels or has a size of zero</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' ClipRect: TRect</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' HasTransparentPixels: boolean '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Clipping rectangle for all drawing functions</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Returns True if there are transparent or semitransparent pixels, and so if the image would be stored with an alpha channel</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' NbPixels: integer</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' AverageColor: TColor '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Total number of pixels. It is always true that NbPixels = Width * Height</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Average color of the image</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' ScanLine[y: integer]: PBGRAPixel</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' AveragePixel: TBGRAPixel '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Returns the address of the left-most pixel of any line. The parameter y ranges from 0 to Height-1</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Average color (including alpha) of the image</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' LineOrder: TRawImageLineOrder</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' CanvasFP: TFPImageCanvas '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">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]]</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Canvas compatible with FreePascal</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' Data: PBGRAPixel</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' CanvasDrawModeFP: TDrawMode '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">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]]</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Draw mode to used when image is access using FreePascal functions and ''Colors'' property</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' RefCount: integer</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' Bitmap: TBitmap '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Number of references to this image. It is increased by the function ''NewReference'' and decreased by the function ''FreeReference''</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">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'')</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' Empty: boolean</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' Canvas: TCanvas '''read''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Returns True if the bitmap only contains transparent pixels or has a size of zero</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Canvas provided by the GUI</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' HasTransparentPixels: boolean</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' CanvasOpacity: byte '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Returns True if there are transparent or semitransparent pixels, and so if the image would be stored with an alpha channel</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Opacity to apply to changes made using GUI functions, provided ''CanvasAlphaCorrection'' is set to ''True''</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' AverageColor: TColor</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' CanvasAlphaCorrection: boolean '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Average color of the image</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies if the alpha values must be corrected after GUI access to the bitmap</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' AveragePixel: TBGRAPixel</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">''JoinStyle'': TPenJoinStyle;</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Average color (including alpha) of the image</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">How to join segments. See [[BGRABitmap Types imported from Graphics|BGRAGraphics]]</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' CanvasFP: TFPImageCanvas</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">''JoinMiterLimit'': single;</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Canvas compatible with FreePascal</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Limit for the extension of the segments when joining them with ''pjsMiter'' join style, expressed in multiples of the width of the pen</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' CanvasDrawModeFP: TDrawMode</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' PenStyle: TPenStyle '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Draw mode to used when image is access using FreePascal functions and ''Colors'' property</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Pen style. See [[BGRABitmap Types imported from Graphics|BGRAGraphics]]</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' Bitmap: TBitmap</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' CustomPenStyle: TBGRAPenStyle '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">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'')</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Custom pen style. See [[BGRABitmap Geometry types|geometric types]]</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' Canvas: TCanvas</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' LineCap: TPenEndCap '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Canvas provided by the GUI</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">How to draw the ends of a line</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' CanvasOpacity: byte</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' ArrowStartSize: TPointF '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Opacity to apply to changes made using GUI functions, provided ''CanvasAlphaCorrection'' is set to ''True''</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Size of arrows at the start of the line</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' CanvasAlphaCorrection: boolean</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' ArrowEndSize: TPointF '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies if the alpha values must be corrected after GUI access to the bitmap</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Size of arrows at the end of the line</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' PenStyle: TPenStyle</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' ArrowStartOffset: single '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Pen style. See [[BGRABitmap Types imported from Graphics|BGRAGraphics]]</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Offset of the arrow from the start of the line</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' CustomPenStyle: TBGRAPenStyle</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' ArrowEndOffset: single '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Custom pen style. See [[BGRABitmap_Geometry_types]]</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Offset of the arrow from the end of the line</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' LineCap: TPenEndCap</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' ArrowStartRepeat: integer '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">How to draw the ends of a line</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Number of times to repeat the starting arrow</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' ArrowStartSize: TPointF</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' ArrowEndRepeat: integer '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Size of arrows at the start of the line</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Number of times to repeat the ending arrow</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' ArrowEndSize: TPointF</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">''FontName'': '''string''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Size of arrows at the end of the line</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies the font to use. Unless the font renderer accept otherwise, the name is in human readable form, like 'Arial', 'Times New Roman', ...</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' ArrowStartOffset: single</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">''FontStyle'': TFontStyles;</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Offset of the arrow from the start of the line</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">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]]</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' ArrowEndOffset: single</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">''FontQuality'' : TBGRAFontQuality;</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Offset of the arrow from the end of the line</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies the quality of rendering. Default value is ''fqSystem''. See [[BGRABitmap Miscellaneous types|miscellaneous types]]</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' ArrowStartRepeat: integer</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">''FontOrientation'': integer;</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Number of times to repeat the starting arrow</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies the rotation of the text, for functions that support text rotation. It is expressed in tenth of degrees, positive values going counter-clockwise.</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' ArrowEndRepeat: integer</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">''FontVerticalAnchor'': TFontVerticalAnchor;</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Number of times to repeat the ending arrow</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies how the font is vertically aligned relative to the start coordinate. See [[BGRABitmap Miscellaneous types|miscellaneous types]]</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' FontHeight: integer</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' FontHeight: integer '''read''' '''write''';</td></tr>
 
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">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)</td></tr>
 
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">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)</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' FontFullHeight: integer</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' FontFullHeight: integer '''read''' '''write''';</td></tr>
 
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies the height of the font in pixels, taking into account the additional line spacing defined for the font</td></tr>
 
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies the height of the font in pixels, taking into account the additional line spacing defined for the font</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' FontAntialias: Boolean</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' FontAntialias: Boolean '''read''' '''write''';</td></tr>
 
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Simplified property to specify the quality (see ''FontQuality'')</td></tr>
 
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Simplified property to specify the quality (see ''FontQuality'')</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' FontPixelMetric: TFontPixelMetric</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''property''' FontPixelMetric: TFontPixelMetric '''read''';</td></tr>
 
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Returns measurement for the current font in pixels</td></tr>
 
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Returns measurement for the current font in pixels</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' FontRenderer: TBGRACustomFontRenderer</td></tr>
+
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''property''' FontRenderer: TBGRACustomFontRenderer '''read''' '''write''';</td></tr>
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Specifies the font renderer. By default it is an instance of TLCLFontRenderer of unit BGRAText. Other renderers are provided in BGRATextFX unit and BGRAVectorize unit. Once you assign a renderer, it will automatically be freed. The renderers may provide additional styling for the font</td></tr>
+
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">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. <br/> <br/>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 <br/> <br/>See [[BGRABitmap tutorial Font rendering|font rendering]]</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
</table>
 +
 
 +
==== Load and save files ====
 +
<table style="border-collapse: collapse; width: 100%">
 +
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''procedure''' LoadFromFile('''const''' filename: '''string'''); '''virtual''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Load image from a file. ''filename'' is an ANSI string</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''procedure''' LoadFromFile('''const''' filename:'''string'''; Handler:TFPCustomImageReader); '''virtual''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Load image from a file with the specified image reader. ''filename'' is an ANSI string</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''procedure''' LoadFromFileUTF8('''const''' filenameUTF8: '''string'''); '''virtual''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Load image from a file. ''filename'' is an UTF8 string</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''procedure''' LoadFromFileUTF8('''const''' filenameUTF8: '''string'''; AHandler: TFPCustomImageReader); '''virtual''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Load image from a file with the specified image reader. ''filename'' is an UTF8 string</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''procedure''' LoadFromStream(Str: TStream); '''virtual'''; '''overload''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Load image from a stream. Format is detected automatically</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''procedure''' LoadFromStream(Str: TStream; Handler: TFPCustomImageReader); '''virtual'''; '''overload''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Load image from a stream. The specified image reader is used</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''procedure''' SaveToFile('''const''' filename: '''string'''); '''virtual'''; '''overload''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Save image to a file. The format is guessed from the file extension. ''filename'' is an ANSI string</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''procedure''' SaveToFile('''const''' filename: '''string'''; Handler:TFPCustomImageWriter); '''virtual'''; '''overload''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Save image to a file with the specified image writer. ''filename'' is an ANSI string</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''procedure''' SaveToFileUTF8('''const''' filenameUTF8: '''string'''); '''virtual'''; '''overload''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Save image to a file. The format is guessed from the file extension. ''filename'' is an ANSI string</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''procedure''' SaveToFileUTF8('''const''' filenameUTF8: '''string'''; Handler:TFPCustomImageWriter); '''virtual'''; '''overload''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Save image to a file with the specified image writer. ''filename'' is an UTF8 string</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''procedure''' SaveToStream (Str:TStream; Handler:TFPCustomImageWriter);</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Save image to a stream with the specified image writer</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''procedure''' SaveToStreamAs(Str: TStream; AFormat: TBGRAImageFormat); '''virtual''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Save image to a stream in the specified image format</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''procedure''' SaveToStreamAsPng(Str: TStream); '''virtual''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Save image to a stream in PNG format</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''procedure''' LoadFromDevice(DC: System.THandle); '''virtual'''; '''abstract'''; '''overload''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Gets the content of the specified device context</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''procedure''' LoadFromDevice(DC: System.THandle; ARect: TRect); '''virtual'''; '''abstract'''; '''overload''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Gets the content from the specified rectangular area of a device context</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: #f0f0ff;">'''procedure''' TakeScreenshotOfPrimaryMonitor; '''virtual'''; '''abstract''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: #f0f0ff;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Fills the content with a screenshot of the primary monitor</td></tr>
 +
<tr style="height: 8px;"><td colspan="3"></td></tr>
 +
<tr><td width="10%"></td><td colspan="2" style="background: white;">'''procedure''' TakeScreenshot(ARect: TRect); '''virtual'''; '''abstract''';</td></tr>
 +
<tr><td width="10%"></td><td width="10%" style="background: white;"></td><td style="border: 1px solid #e0e0a0; background: #ffffe4;">Fills the content with a screenshot of the specified rectangular area of the desktop (it can be from any screen)</td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
<tr style="height: 8px;"><td colspan="3"></td></tr>
 
</table>
 
</table>
 +
For more methods, see derived class [[TBGRABitmap class|TBGRABitmap]]

Latest revision as of 13:50, 4 May 2015

Back to BGRABitmap.

This class and this interface are included in BGRABitmapTypes.

For methods (procedure and functions), see TBGRABitmap class.

TBGRACustomBitmap and IBGRAScanner

IBGRAScanner

IBGRAScanner = interface
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
procedure ScanMoveTo(X,Y: Integer);
Move to the position (X,Y) for the next call to ScanNextPixel
function ScanNextPixel: TBGRAPixel;
Scan the pixel at the current location and increments X
function ScanAt(X,Y: Single): TBGRAPixel;
Scan at any location using floating point coordinates
function ScanAtInteger(X,Y: integer): TBGRAPixel;
Scan at any location using integer coordinates
procedure ScanPutPixels(pdest: PBGRAPixel; count: integer; mode: TDrawMode);
Copy a row of pixels from X to X+count-1 to a specified destination pdest. mode indicates how to combine with existing data
function IsScanPutPixelsDefined: boolean;
Returns True if the function ScanPutPixels is available. Otherwise you need to call ScanNextPixel and combine pixels for example with SetPixel
TScanAtFunction = function (X,Y: Single): TBGRAPixel of object;
A type of function of a scanner that returns the content at floating point coordinates
TScanAtIntegerFunction = function (X,Y: Integer): TBGRAPixel of object;
A type of function of a scanner that returns the content at integer coordinates
TScanNextPixelFunction = function: TBGRAPixel of object;
A type of function of a scanner that returns the next pixel
TBGRACustomScanner = class(IBGRAScanner)
Base class for implementing IBGRAScanner interface

TBGRACustomBitmap

TBGRACustomBitmap = class(TFPCustomImage,IBGRAScanner)
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
Caption: string;
User defined caption. It does not appear on the image
FillMode: TFillMode;
Method to use when filling polygons (winding or alternate). See BGRAGraphics
LinearAntialiasing: boolean;
Specifies if linear antialiasing must be used when drawing antialiased shapes
ResampleFilter : TResampleFilter;
Resample filter is used when resizing the bitmap. See resampling types
ScanInterpolationFilter: TResampleFilter;
Scan interpolation filter is used when the bitmap is used as a scanner (interface IBGRAScanner)
ScanOffset: TPoint;
Offset to apply when the image is scanned using IBGRAScanner interface
property Width: integer read;
Width of the image in pixels
property Height: integer read;
Height of the image in pixels
property ClipRect: TRect read write;
Clipping rectangle for all drawing functions
property NbPixels: integer read;
Total number of pixels. It is always true that NbPixels = Width * Height
property ScanLine[y: integer]: PBGRAPixel read;
Returns the address of the left-most pixel of any line. The parameter y ranges from 0 to Height-1
property LineOrder: TRawImageLineOrder read;
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 miscellaneous types
property Data: PBGRAPixel read;
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 RefCount: integer read;
Number of references to this image. It is increased by the function NewReference and decreased by the function FreeReference
property Empty: boolean read;
Returns True if the bitmap only contains transparent pixels or has a size of zero
property HasTransparentPixels: boolean read;
Returns True if there are transparent or semitransparent pixels, and so if the image would be stored with an alpha channel
property AverageColor: TColor read;
Average color of the image
property AveragePixel: TBGRAPixel read;
Average color (including alpha) of the image
property CanvasFP: TFPImageCanvas read;
Canvas compatible with FreePascal
property CanvasDrawModeFP: TDrawMode read write;
Draw mode to used when image is access using FreePascal functions and Colors property
property Bitmap: TBitmap read;
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 Canvas: TCanvas read;
Canvas provided by the GUI
property CanvasOpacity: byte read write;
Opacity to apply to changes made using GUI functions, provided CanvasAlphaCorrection is set to True
property CanvasAlphaCorrection: boolean read write;
Specifies if the alpha values must be corrected after GUI access to the bitmap
JoinStyle: TPenJoinStyle;
How to join segments. See BGRAGraphics
JoinMiterLimit: single;
Limit for the extension of the segments when joining them with pjsMiter join style, expressed in multiples of the width of the pen
property PenStyle: TPenStyle read write;
Pen style. See BGRAGraphics
property CustomPenStyle: TBGRAPenStyle read write;
Custom pen style. See geometric types
property LineCap: TPenEndCap read write;
How to draw the ends of a line
property ArrowStartSize: TPointF read write;
Size of arrows at the start of the line
property ArrowEndSize: TPointF read write;
Size of arrows at the end of the line
property ArrowStartOffset: single read write;
Offset of the arrow from the start of the line
property ArrowEndOffset: single read write;
Offset of the arrow from the end of the line
property ArrowStartRepeat: integer read write;
Number of times to repeat the starting arrow
property ArrowEndRepeat: integer read write;
Number of times to repeat the ending arrow
FontName: string;
Specifies the font to use. Unless the font renderer accept otherwise, the name is in human readable form, like 'Arial', 'Times New Roman', ...
FontStyle: TFontStyles;
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 miscellaneous types
FontQuality : TBGRAFontQuality;
Specifies the quality of rendering. Default value is fqSystem. See miscellaneous types
FontOrientation: integer;
Specifies the rotation of the text, for functions that support text rotation. It is expressed in tenth of degrees, positive values going counter-clockwise.
FontVerticalAnchor: TFontVerticalAnchor;
Specifies how the font is vertically aligned relative to the start coordinate. See miscellaneous types
property FontHeight: integer read write;
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 FontFullHeight: integer read write;
Specifies the height of the font in pixels, taking into account the additional line spacing defined for the font
property FontAntialias: Boolean read write;
Simplified property to specify the quality (see FontQuality)
property FontPixelMetric: TFontPixelMetric read;
Returns measurement for the current font in pixels
property FontRenderer: TBGRACustomFontRenderer read write;
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 font rendering

Load and save files

procedure LoadFromFile(const filename: string); virtual;
Load image from a file. filename is an ANSI string
procedure LoadFromFile(const filename:string; Handler:TFPCustomImageReader); virtual;
Load image from a file with the specified image reader. filename is an ANSI string
procedure LoadFromFileUTF8(const filenameUTF8: string); virtual;
Load image from a file. filename is an UTF8 string
procedure LoadFromFileUTF8(const filenameUTF8: string; AHandler: TFPCustomImageReader); virtual;
Load image from a file with the specified image reader. filename is an UTF8 string
procedure LoadFromStream(Str: TStream); virtual; overload;
Load image from a stream. Format is detected automatically
procedure LoadFromStream(Str: TStream; Handler: TFPCustomImageReader); virtual; overload;
Load image from a stream. The specified image reader is used
procedure SaveToFile(const filename: string); virtual; overload;
Save image to a file. The format is guessed from the file extension. filename is an ANSI string
procedure SaveToFile(const filename: string; Handler:TFPCustomImageWriter); virtual; overload;
Save image to a file with the specified image writer. filename is an ANSI string
procedure SaveToFileUTF8(const filenameUTF8: string); virtual; overload;
Save image to a file. The format is guessed from the file extension. filename is an ANSI string
procedure SaveToFileUTF8(const filenameUTF8: string; Handler:TFPCustomImageWriter); virtual; overload;
Save image to a file with the specified image writer. filename is an UTF8 string
procedure SaveToStream (Str:TStream; Handler:TFPCustomImageWriter);
Save image to a stream with the specified image writer
procedure SaveToStreamAs(Str: TStream; AFormat: TBGRAImageFormat); virtual;
Save image to a stream in the specified image format
procedure SaveToStreamAsPng(Str: TStream); virtual;
Save image to a stream in PNG format
procedure LoadFromDevice(DC: System.THandle); virtual; abstract; overload;
Gets the content of the specified device context
procedure LoadFromDevice(DC: System.THandle; ARect: TRect); virtual; abstract; overload;
Gets the content from the specified rectangular area of a device context
procedure TakeScreenshotOfPrimaryMonitor; virtual; abstract;
Fills the content with a screenshot of the primary monitor
procedure TakeScreenshot(ARect: TRect); virtual; abstract;
Fills the content with a screenshot of the specified rectangular area of the desktop (it can be from any screen)

For more methods, see derived class TBGRABitmap