Unit BGRAPen

📄 Source code

Description

Configuration and computation of pen style and width, as well as line caps and join styles.

A line consists in two points. A polyline consists in one or more lines, defined by two points or more. A poly-polyline consists in a series of polylines, defined by polyline points separated by empty points (see EmptyPointF and EmptyPoint)

Uses

Overview

Structures

Name Description
Class TBGRAPenStroker Class to hold pen stroker configuration and compute path

Functions and Procedures

procedure BGRADrawLineAliased(dest: TBGRACustomBitmap; x1, y1, x2, y2: integer; c: TBGRAPixel; DrawLastPixel: boolean; ADrawMode: TDrawMode = dmDrawWithTransparency); deprecated;
procedure BGRADrawLineAntialias(dest: TBGRACustomBitmap; x1, y1, x2, y2: integer; c: TBGRAPixel; DrawLastPixel: boolean; LinearBlend : boolean = false); overload; deprecated;
procedure BGRADrawLineAntialias(dest: TBGRACustomBitmap; x1, y1, x2, y2: integer; c1, c2: TBGRAPixel; dashLen: integer; DrawLastPixel: boolean; var DashPos: integer; LinearBlend : boolean = false); overload; deprecated;
procedure BGRAEraseLineAliased(dest: TBGRACustomBitmap; x1, y1, x2, y2: integer; alpha: byte; DrawLastPixel: boolean); deprecated;
procedure BGRAEraseLineAntialias(dest: TBGRACustomBitmap; x1, y1, x2, y2: integer; calpha: byte; DrawLastPixel: boolean); overload; deprecated;
function BGRAToPenStyle(ACustomPenStyle: TBGRAPenStyle): TPenStyle;
function ComputeWidePolylinePoints(const linepts: array of TPointF; width: single; pencolor: TBGRAPixel; linecap: TPenEndCap; joinstyle: TPenJoinStyle; const penstyle: TBGRAPenStyle; options: TBGRAPolyLineOptions; miterLimit: single = 2; arrow: TBGRACustomArrow = nil): ArrayOfTPointF;
function ComputeWidePolyPolylinePoints(const linepts: array of TPointF; width: single; pencolor: TBGRAPixel; linecap: TPenEndCap; joinstyle: TPenJoinStyle; const penstyle: TBGRAPenStyle; options: TBGRAPolyLineOptions; miterLimit: single = 2; arrow: TBGRACustomArrow = nil): ArrayOfTPointF;
function CreateBrushTexture(prototype: TBGRACustomBitmap; brushstyle: TBrushStyle; PatternColor, BackgroundColor: TBGRAPixel; width: integer = 8; height: integer = 8; penwidth: single = 1): TBGRACustomBitmap;
function DuplicatePenStyle(ACustomPenStyle: array of single): TBGRAPenStyle;
function GetAlphaJoinFactor(alpha: byte): single;
function IsClearPenStyle(ACustomPenStyle: TBGRAPenStyle): boolean;
function IsSolidPenStyle(ACustomPenStyle: TBGRAPenStyle): boolean;
function PenStyleEqual(AStyle1, AStyle2: TBGRAPenStyle): boolean;
function PenStyleToBGRA(APenStyle: TPenStyle): TBGRAPenStyle;

Types

TBGRAPolyLineOption = (...);
TBGRAPolyLineOptions = set of TBGRAPolyLineOption;
TComputeArrowHeadProc = function(const APosition: TPointF; const ADirection: TPointF; const AWidth: single; const ACurrentPos: single): ArrayOfTPointF of object;
TPenEndCap = BGRAGraphics.TPenEndCap;
TPenJoinStyle = BGRAGraphics.TPenJoinStyle;

Variables

ClearPenStyle: TBGRAPenStyle;
DashDotDotPenStyle: TBGRAPenStyle;
DashDotPenStyle: TBGRAPenStyle;
DashPenStyle: TBGRAPenStyle;
DotPenStyle: TBGRAPenStyle;
SolidPenStyle: TBGRAPenStyle;

Description

Functions and Procedures

procedure BGRADrawLineAliased(dest: TBGRACustomBitmap; x1, y1, x2, y2: integer; c: TBGRAPixel; DrawLastPixel: boolean; ADrawMode: TDrawMode = dmDrawWithTransparency); deprecated;

Warning: this symbol is deprecated.

aliased version

procedure BGRADrawLineAntialias(dest: TBGRACustomBitmap; x1, y1, x2, y2: integer; c: TBGRAPixel; DrawLastPixel: boolean; LinearBlend : boolean = false); overload; deprecated;

Warning: this symbol is deprecated.

antialiased version

procedure BGRADrawLineAntialias(dest: TBGRACustomBitmap; x1, y1, x2, y2: integer; c1, c2: TBGRAPixel; dashLen: integer; DrawLastPixel: boolean; var DashPos: integer; LinearBlend : boolean = false); overload; deprecated;

Warning: this symbol is deprecated.

antialiased version with bicolor dashes (to draw a frame)

procedure BGRAEraseLineAliased(dest: TBGRACustomBitmap; x1, y1, x2, y2: integer; alpha: byte; DrawLastPixel: boolean); deprecated;

Warning: this symbol is deprecated.

This item has no description.

procedure BGRAEraseLineAntialias(dest: TBGRACustomBitmap; x1, y1, x2, y2: integer; calpha: byte; DrawLastPixel: boolean); overload; deprecated;

Warning: this symbol is deprecated.

This item has no description.

function BGRAToPenStyle(ACustomPenStyle: TBGRAPenStyle): TPenStyle;

This item has no description.

function ComputeWidePolylinePoints(const linepts: array of TPointF; width: single; pencolor: TBGRAPixel; linecap: TPenEndCap; joinstyle: TPenJoinStyle; const penstyle: TBGRAPenStyle; options: TBGRAPolyLineOptions; miterLimit: single = 2; arrow: TBGRACustomArrow = nil): ArrayOfTPointF;

Compute the path for a polyline

function ComputeWidePolyPolylinePoints(const linepts: array of TPointF; width: single; pencolor: TBGRAPixel; linecap: TPenEndCap; joinstyle: TPenJoinStyle; const penstyle: TBGRAPenStyle; options: TBGRAPolyLineOptions; miterLimit: single = 2; arrow: TBGRACustomArrow = nil): ArrayOfTPointF;

Compute the path for a poly-polyline

function CreateBrushTexture(prototype: TBGRACustomBitmap; brushstyle: TBrushStyle; PatternColor, BackgroundColor: TBGRAPixel; width: integer = 8; height: integer = 8; penwidth: single = 1): TBGRACustomBitmap;

create standard brush texture

function DuplicatePenStyle(ACustomPenStyle: array of single): TBGRAPenStyle;

This item has no description.

function GetAlphaJoinFactor(alpha: byte): single;

length added to ensure accepable alpha join (using TBGRAMultishapeFiller is still better)

function IsClearPenStyle(ACustomPenStyle: TBGRAPenStyle): boolean;

This item has no description.

function IsSolidPenStyle(ACustomPenStyle: TBGRAPenStyle): boolean;

check special pen styles

function PenStyleEqual(AStyle1, AStyle2: TBGRAPenStyle): boolean;

This item has no description.

function PenStyleToBGRA(APenStyle: TPenStyle): TBGRAPenStyle;

This item has no description.

Types

TBGRAPolyLineOption = (...);

This item has no description.

Values
  • plRoundCapOpen
  • plCycle: specifies that the line ending is opened
  • plAutoCycle: specifies that it is a polygon
  • plNoStartCap: specifies that a cycle must be used if the last point is the first point
  • plNoEndCap
TBGRAPolyLineOptions = set of TBGRAPolyLineOption;

This item has no description.

TComputeArrowHeadProc = function(const APosition: TPointF; const ADirection: TPointF; const AWidth: single; const ACurrentPos: single): ArrayOfTPointF of object;

This item has no description.

TPenEndCap = BGRAGraphics.TPenEndCap;

This item has no description.

TPenJoinStyle = BGRAGraphics.TPenJoinStyle;

This item has no description.

Variables

ClearPenStyle: TBGRAPenStyle;

predefined pen styles

DashDotDotPenStyle: TBGRAPenStyle;

predefined pen styles

DashDotPenStyle: TBGRAPenStyle;

predefined pen styles

DashPenStyle: TBGRAPenStyle;

predefined pen styles

DotPenStyle: TBGRAPenStyle;

predefined pen styles

SolidPenStyle: TBGRAPenStyle;

predefined pen styles