BGRABitmap Types imported from Graphics

From Free Pascal wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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 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
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
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
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(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(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 GetEmpty;
Returns if the content is completely empty
property Height: Integer read GetHeight write SetHeight;
Returns the height of the bounding rectangle
property Width: Integer read GetWidth write SetWidth;
Returns the width of the bounding rectangle
property Transparent: Boolean read GetTransparent write SetTransparent;
Gets or sets if it is drawn with transparency
TBitmap = class(TGraphic)
Contains a bitmap
property Width: integer read GetWidth write SetWidth;
Width of the bitmap in pixels
property Height: integer read GetHeight write SetHeight;
Height of the bitmap in pixels
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