Class TBGRACustomArrow
Unit
Declaration
type TBGRACustomArrow = class(TObject)
Description
Generic class configuring and rendering an arrow.
Example using different kind of arrows:
uses BGRABitmap, BGRABitmapTypes; procedure TForm1.FormPaint(Sender: TObject); var bmp:TBGRABitmap; w: single; begin bmp := TBGRABitmap.Create(ClientWidth,ClientHeight,BGRAWhite); w := sqrt(ClientWidth*ClientHeight)/50; // diagonal arrow bmp.Arrow.StartAsTail; bmp.Arrow.StartRepeatCount := 2; bmp.Arrow.EndAsTriangle(0.25,False,True); bmp.DrawPolyLineAntialias( bmp.ComputeOpenedSpline([PointF(80,80),PointF(ClientWidth-160,ClientHeight div 2),PointF(ClientWidth-80,ClientHeight-20)],ssCrossingWithEnds), BGRABlack,w); bmp.Arrow.StartRepeatCount := 1; //restore default value // top arrow bmp.Arrow.StartAsClassic(True,True,3); bmp.Arrow.StartOffsetX := -8; bmp.Arrow.EndAsClassic(False,True); bmp.DrawPolyLineAntialias( bmp.ComputeOpenedSpline([PointF(40,60),PointF(ClientWidth div 3,20),PointF(ClientWidth-80,40)],ssCrossingWithEnds), BGRABlack,w); bmp.Arrow.StartOffsetX := 0; //restore default value // left arrow bmp.Arrow.StartAsClassic(True,True); bmp.Arrow.StartSize := PointF(1,2); bmp.Arrow.StartOffsetX := -5.5; bmp.Arrow.StartRepeatCount := 3; bmp.Arrow.EndAsTriangle(0.75); bmp.DrawLineAntialias(20,90, 80,ClientHeight-40, BGRABlack,w); bmp.Arrow.StartSize := PointF(2,2); //restore default values bmp.Arrow.StartOffsetX := 0; bmp.Arrow.StartRepeatCount := 1; // right arrow bmp.Arrow.StartAsClassic; bmp.Arrow.EndAsClassic(False,False,2); bmp.DrawLineAntialias(ClientWidth-40,40,ClientWidth-40,ClientHeight-80,BGRABlack,w); bmp.Draw(Canvas,0,0); bmp.Free; end;
Hierarchy
- TObject
- TBGRACustomArrow
Overview
Methods
function ComputeEndAt(const APosition, ADirection: TPointF; const AWidth, ACurrentPos: single): ArrayOfTPointF; virtual; abstract; |
|
function ComputeStartAt(const APosition, ADirection: TPointF; const AWidth, ACurrentPos: single): ArrayOfTPointF; virtual; abstract; |
|
function GetEndOffsetX: single; virtual; abstract; |
|
function GetEndRepeatCount: integer; virtual; abstract; |
|
function GetEndSizeFactor: TPointF; virtual; abstract; |
|
function GetIsEndDefined: boolean; virtual; abstract; |
|
function GetIsStartDefined: boolean; virtual; abstract; |
|
function GetLineCap: TPenEndCap; virtual; abstract; |
|
function GetStartOffsetX: single; virtual; abstract; |
|
function GetStartRepeatCount: integer; virtual; abstract; |
|
function GetStartSizeFactor: TPointF; virtual; abstract; |
|
procedure EndAsClassic(AFlipped: boolean = false; ACut: boolean = false; ARelativePenWidth: single = 1); virtual; abstract; |
|
procedure EndAsNone; virtual; abstract; |
|
procedure EndAsTail; virtual; abstract; |
|
procedure EndAsTriangle(ABackOffset: single = 0; ARounded: boolean = false; AHollow: boolean = false; AHollowPenWidth: single = 0.5); virtual; abstract; |
|
procedure StartAsClassic(AFlipped: boolean = false; ACut: boolean = false; ARelativePenWidth: single = 1); virtual; abstract; |
|
procedure StartAsNone; virtual; abstract; |
|
procedure StartAsTail; virtual; abstract; |
|
procedure StartAsTriangle(ABackOffset: single = 0; ARounded: boolean = false; AHollow: boolean = false; AHollowPenWidth: single = 0.5); virtual; abstract; |
|
procedure SetEndOffsetX(AValue: single); virtual; abstract; |
|
procedure SetEndRepeatCount(AValue: integer); virtual; abstract; |
|
procedure SetEndSizeFactor(AValue: TPointF); virtual; abstract; |
|
procedure SetLineCap(AValue: TPenEndCap); virtual; abstract; |
|
procedure SetStartOffsetX(AValue: single); virtual; abstract; |
|
procedure SetStartRepeatCount(AValue: integer); virtual; abstract; |
|
procedure SetStartSizeFactor(AValue: TPointF); virtual; abstract; |
Properties
property EndOffsetX: single read GetEndOffsetX write SetEndOffsetX; |
|
property EndRepeatCount: integer read GetEndRepeatCount write SetEndRepeatCount; |
|
property EndSize: TPointF read GetEndSizeFactor write SetEndSizeFactor; |
|
property IsEndDefined: boolean read GetIsEndDefined; |
|
property IsStartDefined: boolean read GetIsStartDefined; |
|
property LineCap: TPenEndCap read GetLineCap write SetLineCap; |
|
property StartOffsetX: single read GetStartOffsetX write SetStartOffsetX; |
|
property StartRepeatCount: integer read GetStartRepeatCount write SetStartRepeatCount; |
|
property StartSize: TPointF read GetStartSizeFactor write SetStartSizeFactor; |
Description
Methods
function ComputeEndAt(const APosition, ADirection: TPointF; const AWidth, ACurrentPos: single): ArrayOfTPointF; virtual; abstract; |
|
Computes the end of the arrow at a given position and direction |
function ComputeStartAt(const APosition, ADirection: TPointF; const AWidth, ACurrentPos: single): ArrayOfTPointF; virtual; abstract; |
|
Computes the start of the arrow at a given position and direction |
function GetEndOffsetX: single; virtual; abstract; |
|
Retrieves the X-offset for the end of the arrow |
function GetEndRepeatCount: integer; virtual; abstract; |
|
Retrieves the repeat count for the end symbol |
function GetEndSizeFactor: TPointF; virtual; abstract; |
|
Retrieves the size factor for the end of the arrow |
function GetIsEndDefined: boolean; virtual; abstract; |
|
Determines if the end of the arrow is defined |
function GetIsStartDefined: boolean; virtual; abstract; |
|
Determines if the start of the arrow is defined |
function GetLineCap: TPenEndCap; virtual; abstract; |
|
Retrieves the line cap style for the classic arrow |
function GetStartOffsetX: single; virtual; abstract; |
|
Retrieves the X-offset for the start of the arrow |
function GetStartRepeatCount: integer; virtual; abstract; |
|
Retrieves the repeat count for the start symbol |
function GetStartSizeFactor: TPointF; virtual; abstract; |
|
procedure EndAsClassic(AFlipped: boolean = false; ACut: boolean = false; ARelativePenWidth: single = 1); virtual; abstract; |
|
Sets the end of the arrow to a classic style |
procedure EndAsNone; virtual; abstract; |
|
Sets the end of the arrow to no style |
procedure EndAsTail; virtual; abstract; |
|
Sets the end of the arrow to a tail style |
procedure EndAsTriangle(ABackOffset: single = 0; ARounded: boolean = false; AHollow: boolean = false; AHollowPenWidth: single = 0.5); virtual; abstract; |
|
Sets the end of the arrow to a triangle style |
procedure StartAsClassic(AFlipped: boolean = false; ACut: boolean = false; ARelativePenWidth: single = 1); virtual; abstract; |
|
Sets the start of the arrow to a classic style |
procedure StartAsNone; virtual; abstract; |
|
Sets the start of the arrow to no style |
procedure StartAsTail; virtual; abstract; |
|
Sets the start of the arrow to a tail style |
procedure StartAsTriangle(ABackOffset: single = 0; ARounded: boolean = false; AHollow: boolean = false; AHollowPenWidth: single = 0.5); virtual; abstract; |
|
Sets the start of the arrow to a triangle style |
procedure SetEndOffsetX(AValue: single); virtual; abstract; |
|
Sets the X-offset for the end of the arrow |
procedure SetEndRepeatCount(AValue: integer); virtual; abstract; |
|
Sets the repeat count for the end symbol |
procedure SetEndSizeFactor(AValue: TPointF); virtual; abstract; |
|
Sets the size factor for the end of the arrow |
procedure SetLineCap(AValue: TPenEndCap); virtual; abstract; |
|
Sets the line cap style for the classic arrow |
procedure SetStartOffsetX(AValue: single); virtual; abstract; |
|
Sets the X-offset for the start of the arrow |
procedure SetStartRepeatCount(AValue: integer); virtual; abstract; |
|
Sets the repeat count for the start symbol |
procedure SetStartSizeFactor(AValue: TPointF); virtual; abstract; |
|
Properties
property EndOffsetX: single read GetEndOffsetX write SetEndOffsetX; |
|
X-offset for the end of the arrow |
property EndRepeatCount: integer read GetEndRepeatCount write SetEndRepeatCount; |
|
Repeat count for the end symbol |
property EndSize: TPointF read GetEndSizeFactor write SetEndSizeFactor; |
|
Size factor for the end of the arrow |
property IsEndDefined: boolean read GetIsEndDefined; |
|
Check if the end of the arrow is defined |
property IsStartDefined: boolean read GetIsStartDefined; |
|
Check if the start of the arrow is defined |
property LineCap: TPenEndCap read GetLineCap write SetLineCap; |
|
Line cap style |
property StartOffsetX: single read GetStartOffsetX write SetStartOffsetX; |
|
X-offset for the start of the arrow |
property StartRepeatCount: integer read GetStartRepeatCount write SetStartRepeatCount; |
|
Repeat count for the start symbol |
property StartSize: TPointF read GetStartSizeFactor write SetStartSizeFactor; |
|