Object TEasyBezierCurve
Unit
Declaration
type TEasyBezierCurve = object(TObject)
Description
Object representing an easy-to-use Bezier curve.
Curve is configured with approximate points, with configurable curve modes and transformation functions
Hierarchy
- TObject
- TEasyBezierCurve
Overview
Fields
FClosed: boolean; |
|
FCurves: array of record
isCurvedToNext,isCurvedToPrevious: boolean;
Center,ControlPoint,NextCenter: TPointF;
end; |
|
FInvalidated: boolean; |
|
FMinimumDotProduct: single; |
|
FPoints: array of record
Coord: TPointF;
CurveMode: TEasyBezierCurveMode;
end; |
Methods
function ComputeLength: single; |
|
function ToPoints: ArrayOfTPointF; |
|
function MaybeCurve(start1, end1, start2, end2: integer): boolean; |
|
function PointTransformNone(APoint: PPointF; AData: Pointer): TPointF; |
|
function PointTransformOffset(APoint: PPointF; AData: Pointer): TPointF; |
|
procedure Clear; |
|
procedure CopyToPath(ADest: IBGRAPath; AOffset: TPointF; AReverse: boolean = false); overload; |
|
procedure CopyToPath(ADest: IBGRAPath; ATransformFunc: TEasyBezierPointTransformFunc; ATransformData: Pointer; AReverse: boolean = false); overload; |
|
procedure CopyToPath(ADest: IBGRAPath); overload; |
|
procedure Init; |
|
procedure SetPoints(APoints: array of TPointF; ACurveMode: array of TEasyBezierCurveMode); overload; |
|
procedure SetPoints(APoints: array of TPointF; ACurveMode: TEasyBezierCurveMode); overload; |
|
procedure SetPoints(APoints: array of TPointF; ACurveMode: array of TEasyBezierCurveMode; AStart, ACount: integer); overload; |
|
procedure SetPoints(APoints: array of TPointF; ACurveMode: TEasyBezierCurveMode; AStart, ACount: integer); overload; |
|
procedure ComputeQuadraticCurves; |
Properties
property Closed: boolean read FClosed write SetClosed; |
|
property CurveMode[AIndex: integer]: TEasyBezierCurveMode read GetCurveMode write SetCurveMode; |
|
property CurveStartPoint: TPointF read GetCurveStartPoint; |
|
property MinimumDotProduct: single read FMinimumDotProduct write SetMinimumDotProduct; |
|
property Point[AIndex: integer]: TPointF read GetPoint write SetPoint; |
|
property PointCount: integer read GetPointCount; |
Description
Fields
FClosed: boolean; |
|
Is the curve is closed |
FCurves: array of record
isCurvedToNext,isCurvedToPrevious: boolean;
Center,ControlPoint,NextCenter: TPointF;
end; |
|
Computed Bézier control points |
FInvalidated: boolean; |
|
Whether the curve need to be recomputed |
FMinimumDotProduct: single; |
|
Minimum dot product to form a curve instead of an angle |
FPoints: array of record
Coord: TPointF;
CurveMode: TEasyBezierCurveMode;
end; |
|
Definition of the curve by the user |
Methods
function ComputeLength: single; |
|
Computes the total length of the Bezier curve |
function ToPoints: ArrayOfTPointF; |
|
Converts the Bezier curve into an array of points |
function PointTransformNone(APoint: PPointF; AData: Pointer): TPointF; |
|
Fonction to apply no transformation |
function PointTransformOffset(APoint: PPointF; AData: Pointer): TPointF; |
|
Fonction to apply an offset |
procedure Clear; |
|
Clears all points and resets the curve |
procedure CopyToPath(ADest: IBGRAPath; AOffset: TPointF; AReverse: boolean = false); overload; |
|
Copies the Bezier curve to a path object with an offset and optional reversal |
procedure CopyToPath(ADest: IBGRAPath; ATransformFunc: TEasyBezierPointTransformFunc; ATransformData: Pointer; AReverse: boolean = false); overload; |
|
Copies the Bezier curve to a path object with a custom transformation |
procedure CopyToPath(ADest: IBGRAPath); overload; |
|
Copies the Bezier curve to a path object |
procedure Init; |
|
Initializes the Bezier curve object |
procedure SetPoints(APoints: array of TPointF; ACurveMode: array of TEasyBezierCurveMode); overload; |
|
Sets the points and individual curve modes for each point |
procedure SetPoints(APoints: array of TPointF; ACurveMode: TEasyBezierCurveMode); overload; |
|
Sets the points and curve mode for the entire curve |
procedure SetPoints(APoints: array of TPointF; ACurveMode: array of TEasyBezierCurveMode; AStart, ACount: integer); overload; |
|
Sets a subset of points and individual curve modes for each of these points |
procedure SetPoints(APoints: array of TPointF; ACurveMode: TEasyBezierCurveMode; AStart, ACount: integer); overload; |
|
Sets a subset of points and a single curve mode for these points |
procedure ComputeQuadraticCurves; |
|
Computes the control points for the classical quadratic curve |
Properties
property Closed: boolean read FClosed write SetClosed; |
|
Gets or sets whether to close the curve |
property CurveMode[AIndex: integer]: TEasyBezierCurveMode read GetCurveMode write SetCurveMode; |
|
Mode to use for each point |
property CurveStartPoint: TPointF read GetCurveStartPoint; |
|
Coordinates of the starting point |
property MinimumDotProduct: single read FMinimumDotProduct write SetMinimumDotProduct; |
|
Minimum dot product to form a curve rather than an angle when using cmAuto mode |
property Point[AIndex: integer]: TPointF read GetPoint write SetPoint; |
|
Coordinates of the points |
property PointCount: integer read GetPointCount; |
|
Number of points |