Unit BGRAPath

Description

Implements path and path cursor

There are different conventions for angles.

First is about the unit. It can be one of the following:

Second is about the origin. It can be one of the following:

Third is about the sign. It can be one of the following:

TBGRAPath and TBGRACanvas2D follow HTML5 convention which is: (radian, right-most, clockwise) that can be shortened to (radian, clockwise) because right-most is the default for radian. This is abbreviated as "radCW".

When radian are CCW, it is also specified in order to make it clear, even if it is the default convention in mathematics.

In order to make things easier, there are some functions that accept angles in degrees. The convention used here is the usual degree convention: (degrees, top-most, clockwise) that can be shortened to (degree) because top-most and clockwise is the default for degrees.

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TBGRAPath Path (in 2D) that allows to define custom shapes that can be drawn
Class TBGRAPathCursor Cursor to determine position along a path

Functions and Procedures

function ArcEndPoint(const arc: TArcDef): TPointF;
function ArcStartPoint(const arc: TArcDef): TPointF;
function ClosedSplineStartPoint(const points: array of TPointF; Style: TSplineStyle): TPointF;
function ComputeArc(const arc: TArcDef; quality: single = 1): ArrayOfTPointF;
function ComputeArc65536(x, y, rx, ry: single; start65536,end65536: word; quality: single = 1): ArrayOfTPointF; overload;
function ComputeArc65536(AOrigin, AXAxis, AYAxis: TPointF; start65536,end65536: word; quality: single = 1): ArrayOfTPointF; overload;
function ComputeArcRad(AOrigin, AXAxis, AYAxis: TPointF; startRadCCW,endRadCCW: single; quality: single = 1): ArrayOfTPointF; overload;
function ComputeArcRad(x, y, rx, ry: single; startRadCCW,endRadCCW: single; quality: single = 1): ArrayOfTPointF; overload;
function ComputeBezierCurve(const curve: TQuadraticBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;
function ComputeBezierCurve(const curve: TCubicBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;
function ComputeBezierSpline(const spline: array of TCubicBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;
function ComputeBezierSpline(const spline: array of TQuadraticBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;
function ComputeClosedSpline(const APoints: array of TPointF; AStyle: TSplineStyle; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;
function ComputeClosedSpline(const APoints: array of TPointF; AStart, ACount: integer; AStyle: TSplineStyle; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;
function ComputeEasyBezier(const curve: TEasyBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;
function ComputeEllipse(x,y,rx,ry: single; quality: single = 1): ArrayOfTPointF; overload;
function ComputeEllipse(AOrigin, AXAxis, AYAxis: TPointF; quality: single = 1): ArrayOfTPointF; overload;
function ComputeOpenedSpline(const APoints: array of TPointF; AStyle: TSplineStyle; AEndCoeff: single = 0.25; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;
function ComputeOpenedSpline(const APoints: array of TPointF; AStart, ACount: integer; AStyle: TSplineStyle; AEndCoeff: single = 0.25; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;
function ComputeRoundRect(x1,y1,x2,y2,rx,ry: single; options: TRoundRectangleOptions; quality: single = 1): ArrayOfTPointF; overload;
function ComputeRoundRect(x1,y1,x2,y2,rx,ry: single; quality: single = 1): ArrayOfTPointF; overload;
function Html5ArcTo(const p0, p1, p2: TPointF; radius: single): TArcDef;
function IsLargeArc(const arc: TArcDef): boolean;
function SplineVertexToSide(y0, y1, y2, y3: single; t: single): single;
function SvgArcTo(const p0: TPointF; rx, ry, xAngleRadCW: single; largeArc, anticlockwise: boolean; const p1: TPointF): TArcDef;

Types

TBGRAPathDrawProc = BGRABitmapTypes.TBGRAPathDrawProc;
TBGRAPathElementType = (...);
TBGRAPathFillProc = BGRABitmapTypes.TBGRAPathFillProc;

Constants

DefaultDeviation = 0.1;

Description

Functions and Procedures

function ArcEndPoint(const arc: TArcDef): TPointF;

This item has no description.

function ArcStartPoint(const arc: TArcDef): TPointF;

This item has no description.

function ClosedSplineStartPoint(const points: array of TPointF; Style: TSplineStyle): TPointF;

This item has no description.

function ComputeArc(const arc: TArcDef; quality: single = 1): ArrayOfTPointF;

This item has no description.

function ComputeArc65536(x, y, rx, ry: single; start65536,end65536: word; quality: single = 1): ArrayOfTPointF; overload;

This item has no description.

function ComputeArc65536(AOrigin, AXAxis, AYAxis: TPointF; start65536,end65536: word; quality: single = 1): ArrayOfTPointF; overload;

This item has no description.

function ComputeArcRad(AOrigin, AXAxis, AYAxis: TPointF; startRadCCW,endRadCCW: single; quality: single = 1): ArrayOfTPointF; overload;

This item has no description.

function ComputeArcRad(x, y, rx, ry: single; startRadCCW,endRadCCW: single; quality: single = 1): ArrayOfTPointF; overload;

This item has no description.

function ComputeBezierCurve(const curve: TQuadraticBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;

This item has no description.

function ComputeBezierCurve(const curve: TCubicBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;

This item has no description.

function ComputeBezierSpline(const spline: array of TCubicBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;

This item has no description.

function ComputeBezierSpline(const spline: array of TQuadraticBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;

This item has no description.

function ComputeClosedSpline(const APoints: array of TPointF; AStyle: TSplineStyle; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;

This item has no description.

function ComputeClosedSpline(const APoints: array of TPointF; AStart, ACount: integer; AStyle: TSplineStyle; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;

This item has no description.

function ComputeEasyBezier(const curve: TEasyBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;

This item has no description.

function ComputeEllipse(x,y,rx,ry: single; quality: single = 1): ArrayOfTPointF; overload;

Compute points to draw an antialiased ellipse

function ComputeEllipse(AOrigin, AXAxis, AYAxis: TPointF; quality: single = 1): ArrayOfTPointF; overload;

This item has no description.

function ComputeOpenedSpline(const APoints: array of TPointF; AStyle: TSplineStyle; AEndCoeff: single = 0.25; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;

This item has no description.

function ComputeOpenedSpline(const APoints: array of TPointF; AStart, ACount: integer; AStyle: TSplineStyle; AEndCoeff: single = 0.25; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;

This item has no description.

function ComputeRoundRect(x1,y1,x2,y2,rx,ry: single; options: TRoundRectangleOptions; quality: single = 1): ArrayOfTPointF; overload;

This item has no description.

function ComputeRoundRect(x1,y1,x2,y2,rx,ry: single; quality: single = 1): ArrayOfTPointF; overload;

This item has no description.

function Html5ArcTo(const p0, p1, p2: TPointF; radius: single): TArcDef;

This item has no description.

function IsLargeArc(const arc: TArcDef): boolean;

This item has no description.

function SplineVertexToSide(y0, y1, y2, y3: single; t: single): single;

———————– Spline ——————

function SvgArcTo(const p0: TPointF; rx, ry, xAngleRadCW: single; largeArc, anticlockwise: boolean; const p1: TPointF): TArcDef;

This item has no description.

Types

TBGRAPathDrawProc = BGRABitmapTypes.TBGRAPathDrawProc;

This item has no description.

TBGRAPathElementType = (...);

This item has no description.

Values
  • peNone
  • peMoveTo
  • peLineTo
  • peCloseSubPath
  • peQuadraticBezierTo
  • peCubicBezierTo
  • peArc
  • peOpenedSpline
  • peClosedSpline
TBGRAPathFillProc = BGRABitmapTypes.TBGRAPathFillProc;

This item has no description.

Constants

DefaultDeviation = 0.1;

This item has no description.