BGRABitmap Types imported from Graphics

From Lazarus wiki
Revision as of 11:46, 1 May 2015 by Circular (talk | contribs) (category)
Jump to navigationJump to search

Back to BGRABitmap.

Here is the list of types in BGRAGraphics unit. They are imported from the LCL unit called Graphics. They are imported by BGRABitmapTypes unit so that you don't need to add explicitely this unit to the uses clause.

If the LCL is not present, those types are defined to provide their basic features.

Types imported from Graphics

PColor = ^TColor;
Pointer to a TColor value
TColor = Int32;
Contains a color stored as RGB. The red/green/blue values range from 0 to 255. The formula to get the color value is:
color = red + (green shl 8) + (blue shl 16)
except with fpGUI where it is:
color = (red shl 16) + (green shl 8) + blue
function FPColorToTColor(const FPColor: TFPColor): TColor;
Converts a TFPColor into a TColor value
function TColorToFPColor(const c: TColor): TFPColor;
Converts a TColor into a TFPColor value
TGradientDirection = (
Direction of change in a gradient
gdVertical,
Color changes vertically
gdHorizontal);
Color changes horizontally
TAntialiasingMode = (
Antialiasing mode for a Canvas
amDontCare,
It does not matter if there is antialiasing or not
amOn,
Antialiasing is required (BGRACanvas provide it)
amOff);
Antialiasing is disabled
TPenEndCap = (
How to draw the end of line
pecRound,
Draw a half-disk at the end of the line. The diameter of the disk is equal to the pen width.
pecSquare,
Draw a half-square. The size of the square is equal to the pen width. This is visually equivalent to extend the line of half the pen width
pecFlat);
The line ends exactly at the end point
TPenJoinStyle = (
How to join segments. This makes sense only for geometric pens (that have a certain width)
pjsRound,
Segments are joined by filling the gap with an arc
pjsBevel,
Segments are joind by filling the gap with an intermediary segment
pjsMiter);
Segments are joined by extending them up to their intersection. There is a miter limit so that if the intersection is too far, an intermediary segment is used
TPenStyle = TFPPenStyle;
Style to use for the pen. The unit for the pattern is the width of the line
psSolid = FPCanvas.psSolid;
Pen is continuous
psDash = FPCanvas.psDash;
Pen is dashed. The dash have a length of 3 unit and the gaps of 1 unit
psDot = FPCanvas.psDot;
Pen is dotted. The dots have a length of 1 unit and the gaps of 1 unit
psDashDot = FPCanvas.psDashDot;
Pattern is a dash of length 3 followed by a dot of length 1, separated by a gap of length 1
psDashDotDot = FPCanvas.psDashDotDot;
Dash of length 3, and two dots of length 1
psClear = FPCanvas.psClear;
Pen is not drawn
psInsideframe = FPCanvas.psInsideframe;
Not used. Provided for compatibility
psPattern = FPCanvas.psPattern;
Custom pattern used
TPen = class(TFPCustomPen)
A class containing a pen
property Color: TColor read write;
Color of the pen
property EndCap: TPenEndCap read write;
End cap of the pen: how to draw the ends of the lines
property JoinStyle: TPenJoinStyle read write;
Join style: how to join the segments of a polyline
property Style : TPenStyle read write;
Pen style: solid, dash, dot...
property Width : Integer read write;
Pen width in pixels
TTextLayout = (tlTop, tlCenter, tlBottom);
Vertical position of a text
TTextStyle = packed record
Styles to describe how a text is drawn in a rectangle
Alignment : TAlignment;
Horizontal alignment
Layout : TTextLayout;
Vertical alignment
SingleLine: boolean;
If WordBreak is false then process #13, #10 as standard chars and perform no Line breaking
Clipping : boolean;
Clip Text to passed Rectangle
ExpandTabs: boolean;
Replace #9 by apropriate amount of spaces (default is usually 8)
ShowPrefix: boolean;
Process first single '&' per line as an underscore and draw '&&' as '&'
Wordbreak : boolean;
If line of text is too long too fit between left and right boundaries try to break into multiple lines between words. See also EndEllipsis
Opaque : boolean;
Fills background with current brush
SystemFont: Boolean;
Use the system font instead of canvas font
RightToLeft: Boolean;
For RightToLeft text reading (Text Direction)
EndEllipsis: Boolean;
If line of text is too long to fit between left and right boundaries truncates the text and adds "...". If Wordbreak is set as well, Workbreak will dominate
TFillStyle =
Option for floodfill (used in BGRACanvas)
fsSurface,
Fill up to the color (it fills all except the specified color)
fsBorder
Fill the specified color (it fills only connected pixels of this color)
TFillMode = (
How to handle polygons that intersect with themselves and overlapping polygons
fmAlternate,
Each time a boundary is found, it enters or exit the filling zone
fmWinding);
Adds or subtract 1 depending on the order of the points of the polygons (clockwise or counter clockwise) and fill when the result is non-zero. So, to draw a hole, you must specify the points of the hole in the opposite order
TBrushStyle = TFPBrushStyle;
Pattern when filling with a brush. It is used in BGRACanvas but can also be created with TBGRABitmap.CreateBrushTexture function
bsSolid = FPCanvas.bsSolid;
Fill with the current color
bsClear = FPCanvas.bsClear;
Does not fill at all
bsHorizontal = FPCanvas.bsHorizontal;
Draw horizontal lines
bsVertical = FPCanvas.bsVertical;
Draw vertical lines
bsFDiagonal = FPCanvas.bsFDiagonal;
Draw diagonal lines from top-left to bottom-right
bsBDiagonal = FPCanvas.bsBDiagonal;
Draw diagonal lines from bottom-left to top-right
bsCross = FPCanvas.bsCross;
Draw both horizontal and vertical lines
bsDiagCross = FPCanvas.bsDiagCross;
Draw both diagonal lines
TBrush = class(TFPCustomBrush)
A class describing a brush
property Color: TColor read write;
Color of the brush
property Style : TBrushStyle read write;
Style of the brush: solid, diagonal lines, horizontal lines...
TCanvas = class
A surface on which to draw
procedure Draw(x,y: integer; AImage: TGraphic);
Draw an image with top-left corner at (x,y)
procedure StretchDraw(ARect: TRect; AImage: TGraphic);
Draw and stretch an image within the rectangle ARect
TGraphic = class(TPersistent)
A class containing any element that can be drawn within rectangular bounds
procedure LoadFromFile({%H-}const Filename: string); virtual;
Load the content from a given file
procedure LoadFromStream(Stream: TStream); virtual; abstract;
Load the content from a given stream
procedure SaveToFile({%H-}const Filename: string); virtual;
Saves the content to a file
procedure SaveToStream(Stream: TStream); virtual; abstract;
Saves the content into a given stream
class function GetFileExtensions: string; virtual;
Returns the list of possible file extensions
procedure Clear; virtual;
Clears the content
property Empty: Boolean read;
Returns if the content is completely empty
property Height: Integer read write;
Returns the height of the bounding rectangle
property Width: Integer read write;
Returns the width of the bounding rectangle
property Transparent: Boolean read write;
Gets or sets if it is drawn with transparency
TBitmap = class(TGraphic)
Contains a bitmap
property Width: integer read write;
Width of the bitmap in pixels
property Height: integer read write;
Height of the bitmap in pixels
TFontStyle = (
Available font styles
fsBold,
Font is bold
fsItalic,
Font is italic
fsStrikeOut,
An horizontal line is drawn in the middle of the text
fsUnderline);
Text is underlined
TFontStyles = set of TFontStyle;
A combination of font styles
TFontQuality = (fqDefault, fqDraft, fqProof, fqNonAntialiased, fqAntialiased, fqCleartype, fqCleartypeNatural);
Quality to use when font is rendered by the system
TFont = class(TFPCustomFont)
Contains the description of a font
property PixelsPerInch: Integer read write;
Pixels per inches
property Color: TColor read write;
Color of the font
property Height: Integer read write;
Height of the font in pixels. When the number is negative, it indicates a size in pixels
property Size: Integer read write;
Size of the font in inches. When the number is negative, it indicates a height in inches
property Quality: TFontQuality read write;
Quality of the font rendering
property Style: TFontStyles read write;
Style to apply to the text
function MulDiv(nNumber, nNumerator, nDenominator: Integer): Integer;
Multiply and divide the number allowing big intermediate number and rounding the result
function MathRound(AValue: ValReal): Int64; inline;
Round the number using math convention