TBLGradient
Gradient.
Definition
Unit: Blend2D
Properties
Name | Description |
---|---|
Angle | |
Capacity | The gradient capacity [in stops]. |
Conic | |
ConicAngle | |
ConicRepeat | |
ExtendMode | The gradient extend mode. |
HasTransform | Tests whether the gradient has a non-identity transformation matrix. |
IsEmpty | Whether the gradient is empty. |
Kind | The type of the gradient. |
Linear | |
R0 | |
R1 | |
Radial | |
Size | The number of stops the gradient has. |
StopData | The gradient stop data. |
Stops | Gradient stop at AIndex . |
Transform | The transformation matrix applied to the gradient. |
TransformKind | Returns the type of the transformation matrix returned by Transform . |
Values | |
X0 | |
X1 | |
Y0 | |
Y1 |
Constructors
Operators
Name | Description |
---|---|
Equal(TBLGradient, TBLGradient) | Equality operator, performs the same operation as ALeft.Equals(ARight) . |
Equal(TBLGradient, Pointer) | Used to compare against nil . |
NotEqual(TBLGradient, TBLGradient) | Equality operator, performs the same operation as not ALeft.Equals(ARight) . |
NotEqual(TBLGradient, Pointer) | Used to compare against nil . |
Methods
Property Descriptions
Angle
property Angle: Double read GetAngle write SetAngle
Type: Double
Capacity
The gradient capacity [in stops].
property Capacity: NativeInt read GetCapacity
Type: NativeInt
Conic
property Conic: TBLConicGradientValues read GetConic write SetConic
Type: TBLConicGradientValues
ConicAngle
property ConicAngle: Double read GetConicAngle write SetConicAngle
Type: Double
ConicRepeat
property ConicRepeat: Double read GetConicRepeat write SetConicRepeat
Type: Double
ExtendMode
The gradient extend mode.
property ExtendMode: TBLExtendMode read GetExtendMode write SetExtendMode
Type: TBLExtendMode
Exceptions
EBlend2DError
: Raised on failure.
HasTransform
Tests whether the gradient has a non-identity transformation matrix.
property HasTransform: Boolean read GetHasTransform
Type: Boolean
IsEmpty
Whether the gradient is empty.
Empty gradient is considered any gradient that has no stops.
property IsEmpty: Boolean read GetIsEmpty
Type: Boolean
Kind
The type of the gradient.
property Kind: TBLGradientKind read GetKind write SetKind
Type: TBLGradientKind
Exceptions
EBlend2DError
: Raised on failure.
Linear
property Linear: TBLLinearGradientValues read GetLinear write SetLinear
Type: TBLLinearGradientValues
R0
property R0: Double read GetR0 write SetR0
Type: Double
R1
property R1: Double read GetR1 write SetR1
Type: Double
Radial
property Radial: TBLRadialGradientValues read GetRadial write SetRadial
Type: TBLRadialGradientValues
Size
The number of stops the gradient has.
property Size: NativeInt read GetSize
Type: NativeInt
StopData
The gradient stop data.
property StopData: PBLGradientStop read GetStopData
Type: PBLGradientStop
Stops
Gradient stop at AIndex
.
property Stops[const AIndex: NativeInt]: TBLGradientStop read GetStop
Type: TBLGradientStop
Transform
The transformation matrix applied to the gradient.
property Transform: TBLMatrix2D read GetTransform write SetTransform
Type: TBLMatrix2D
Exceptions
EBlend2DError
: Raised on failure.
TransformKind
Returns the type of the transformation matrix returned by Transform
.
property TransformKind: TBLTransformKind read GetTransformKind
Type: TBLTransformKind
See Also
Values
property Values[const AIndex: NativeInt]: Double read GetValue write SetValue
Type: Double
X0
property X0: Double read GetX0 write SetX0
Type: Double
X1
property X1: Double read GetX1 write SetX1
Type: Double
Y0
property Y0: Double read GetY0 write SetY0
Type: Double
Y1
property Y1: Double read GetY1 write SetY1
Type: Double
Constructor Descriptions
Assign
Copy constructor creates a weak copy of ASrc
.
constructor Assign(var ADest: TBLGradient; const ASrc: TBLGradient); inline
Parameters
ADest
: TBLGradient
ASrc
: TBLGradient
Exceptions
EBlend2DError
: Raised on failure.
Create
constructor Create(const AValues: TBLConicGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>; const ATransform: TBLMatrix2D); overload
Parameters
AValues
: TBLConicGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
ATransform
: TBLMatrix2D
Create
constructor Create(const AValues: TBLRadialGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>; const ATransform: TBLMatrix2D); overload
Parameters
AValues
: TBLRadialGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
ATransform
: TBLMatrix2D
Create
constructor Create(const AValues: TBLLinearGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>; const ATransform: TBLMatrix2D); overload
Parameters
AValues
: TBLLinearGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
ATransform
: TBLMatrix2D
Create
constructor Create(const AValues: TBLConicGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>); overload
Parameters
AValues
: TBLConicGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
Create
constructor Create(const AValues: TBLRadialGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>); overload
Parameters
AValues
: TBLRadialGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
Create
constructor Create(const AValues: TBLLinearGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>); overload
Parameters
AValues
: TBLLinearGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
Create
constructor Create(const AValues: TBLConicGradientValues; const AExtendMode: TBLExtendMode = TBLExtendMode.Pad); overload
Parameters
AValues
: TBLConicGradientValues
AExtendMode
: TBLExtendMode = TBLExtendMode.Pad
Create
constructor Create(const AValues: TBLRadialGradientValues; const AExtendMode: TBLExtendMode = TBLExtendMode.Pad); overload
Parameters
AValues
: TBLRadialGradientValues
AExtendMode
: TBLExtendMode = TBLExtendMode.Pad
Create
constructor Create(const AValues: TBLLinearGradientValues; const AExtendMode: TBLExtendMode = TBLExtendMode.Pad); overload
Parameters
AValues
: TBLLinearGradientValues
AExtendMode
: TBLExtendMode = TBLExtendMode.Pad
Create
constructor Create(const AKind: TBLGradientKind; const AValues: PDouble = nil); overload
Parameters
AKind
: TBLGradientKind
AValues
: PDouble = nil
Create
constructor Create(const AKind: TBLGradientKind; const AValues: TArray<Double>); overload
Parameters
AKind
: TBLGradientKind
AValues
: TArray<Double>
Finalize
Destroys the gradient.
destructor Finalize(var ADest: TBLGradient)
Parameters
ADest
: TBLGradient
Exceptions
EBlend2DError
: Raised on failure.
Initialize
Creates a default constructed gradient.
A default constructed gradient has TBLGradientKind.Linear
type, all values set to zero, and has no color stops.
constructor Initialize(out ADest: TBLGradient)
Parameters
ADest
: TBLGradient
Exceptions
EBlend2DError
: Raised on failure.
Operator Descriptions
Equal(TBLGradient, TBLGradient)
Equality operator, performs the same operation as ALeft.Equals(ARight)
.
class operator Equal(const ALeft, ARight: TBLGradient): Boolean; inline; static
Parameters
ALeft
: TBLGradient
ARight
: TBLGradient
Returns
Boolean
Equal(TBLGradient, Pointer)
Used to compare against nil
.
class operator Equal(const ALeft: TBLGradient; const ARight: Pointer): Boolean; inline; static
Parameters
ALeft
: TBLGradient
ARight
: Pointer
Returns
Boolean
NotEqual(TBLGradient, TBLGradient)
Equality operator, performs the same operation as not ALeft.Equals(ARight)
.
class operator NotEqual(const ALeft, ARight: TBLGradient): Boolean; inline; static
Parameters
ALeft
: TBLGradient
ARight
: TBLGradient
Returns
Boolean
NotEqual(TBLGradient, Pointer)
Used to compare against nil
.
class operator NotEqual(const ALeft: TBLGradient; const ARight: Pointer): Boolean; inline; static
Parameters
ALeft
: TBLGradient
ARight
: Pointer
Returns
Boolean
Method Descriptions
AddStop(Double, TAlphaColor)
Adds a color stop described as a AColor
at the given AOffset
.
procedure AddStop(const AOffset: Double; const AColor: TAlphaColor); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AOffset
: Double
AColor
: TAlphaColor
Remarks
The offset value must be in [0, 1]
range.
AddStop(Double, TBLRgba64)
Adds a color stop described as a 64-bit color ARgba64
at the given AOffset
.
procedure AddStop(const AOffset: Double; const ARgba64: TBLRgba64); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AOffset
: Double
ARgba64
: TBLRgba64
Remarks
The offset value must be in [0, 1]
range.
AddStop(Double, TBLRgba32)
Adds a color stop described as a 32-bit color ARgba32
at the given AOffset
.
procedure AddStop(const AOffset: Double; const ARgba32: TBLRgba32); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AOffset
: Double
ARgba32
: TBLRgba32
Remarks
The offset value must be in [0, 1]
range.
ApplyTransform(TBLMatrix2D)
procedure ApplyTransform(const ATransform: TBLMatrix2D); inline
Parameters
ATransform
: TBLMatrix2D
AssignStops(TBLArrayView<TBLGradientStop>)
Assigns colors stops of the gradient to AStops
.
procedure AssignStops(const AStops: TBLArrayView<TBLGradientStop>); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AStops
: TBLArrayView<TBLGradientStop>
AssignStops(PBLGradientStop, NativeInt)
Assigns colors stops of the gradient to AStops
of size ACount
.
procedure AssignStops(const AStops: PBLGradientStop; const ACount: NativeInt); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AStops
: PBLGradientStop
ACount
: NativeInt
AssignStops(TArray<TBLGradientStop>)
Assigns colors stops of the gradient to AStops
.
procedure AssignStops(const AStops: TArray<TBLGradientStop>); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AStops
: TArray<TBLGradientStop>
Equals(TBLGradient)
Tests whether the gradient equals AOther
.
function Equals(const AOther: TBLGradient): Boolean; inline
Parameters
AOther
: TBLGradient
Returns
Boolean
Remarks
The equality check returns True if both gradients are the same value-wise.
IndexOfStop(Double)
Returns the index of a color stop in Stops array of the given AOffset
.
function IndexOfStop(const AOffset: Double): NativeInt; inline
Parameters
AOffset
: Double
Returns
NativeInt
Remarks
If there is no such offset, -1
is returned.
Make(TBLConicGradientValues, TBLExtendMode, TArray<TBLGradientStop>, TBLMatrix2D)
procedure Make(const AValues: TBLConicGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>; const ATransform: TBLMatrix2D); overload; inline
Parameters
AValues
: TBLConicGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
ATransform
: TBLMatrix2D
Make(TBLRadialGradientValues, TBLExtendMode, TArray<TBLGradientStop>, TBLMatrix2D)
procedure Make(const AValues: TBLRadialGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>; const ATransform: TBLMatrix2D); overload; inline
Parameters
AValues
: TBLRadialGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
ATransform
: TBLMatrix2D
Make(TBLLinearGradientValues, TBLExtendMode, TArray<TBLGradientStop>, TBLMatrix2D)
procedure Make(const AValues: TBLLinearGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>; const ATransform: TBLMatrix2D); overload; inline
Parameters
AValues
: TBLLinearGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
ATransform
: TBLMatrix2D
Make(TBLConicGradientValues, TBLExtendMode, TArray<TBLGradientStop>)
procedure Make(const AValues: TBLConicGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>); overload; inline
Parameters
AValues
: TBLConicGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
Make(TBLRadialGradientValues, TBLExtendMode, TArray<TBLGradientStop>)
procedure Make(const AValues: TBLRadialGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>); overload; inline
Parameters
AValues
: TBLRadialGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
Make(TBLLinearGradientValues, TBLExtendMode, TArray<TBLGradientStop>)
procedure Make(const AValues: TBLLinearGradientValues; const AExtendMode: TBLExtendMode; const AStops: TArray<TBLGradientStop>); overload; inline
Parameters
AValues
: TBLLinearGradientValues
AExtendMode
: TBLExtendMode
AStops
: TArray<TBLGradientStop>
Make(TBLConicGradientValues, TBLExtendMode)
procedure Make(const AValues: TBLConicGradientValues; const AExtendMode: TBLExtendMode = TBLExtendMode.Pad); overload; inline
Parameters
AValues
: TBLConicGradientValues
AExtendMode
: TBLExtendMode = TBLExtendMode.Pad
Make(TBLRadialGradientValues, TBLExtendMode)
procedure Make(const AValues: TBLRadialGradientValues; const AExtendMode: TBLExtendMode = TBLExtendMode.Pad); overload; inline
Parameters
AValues
: TBLRadialGradientValues
AExtendMode
: TBLExtendMode = TBLExtendMode.Pad
Make(TBLLinearGradientValues, TBLExtendMode)
procedure Make(const AValues: TBLLinearGradientValues; const AExtendMode: TBLExtendMode = TBLExtendMode.Pad); overload; inline
Parameters
AValues
: TBLLinearGradientValues
AExtendMode
: TBLExtendMode = TBLExtendMode.Pad
PostRotate(Double, TBLPointI)
procedure PostRotate(const AAngle: Double; const AOrigin: TBLPointI); overload; inline
Parameters
AAngle
: Double
AOrigin
: TBLPointI
PostRotate(Double, TBLPoint)
procedure PostRotate(const AAngle: Double; const AOrigin: TBLPoint); overload; inline
Parameters
AAngle
: Double
AOrigin
: TBLPoint
PostRotate(Double, Double, Double)
procedure PostRotate(const AAngle, AX, AY: Double); overload; inline
Parameters
AAngle
: Double
AX
: Double
AY
: Double
PostRotate(Double)
procedure PostRotate(const AAngle: Double); overload; inline
Parameters
AAngle
: Double
PostScale(TBLPointI)
procedure PostScale(const AP: TBLPointI); overload; inline
Parameters
AP
: TBLPointI
PostScale(TBLPoint)
procedure PostScale(const AP: TBLPoint); overload; inline
Parameters
AP
: TBLPoint
PostScale(Double, Double)
procedure PostScale(const AX, AY: Double); overload; inline
Parameters
AX
: Double
AY
: Double
PostScale(Double)
procedure PostScale(const AXY: Double); overload; inline
Parameters
AXY
: Double
PostSkew(TBLPoint)
procedure PostSkew(const AP: TBLPoint); overload; inline
Parameters
AP
: TBLPoint
PostSkew(Double, Double)
procedure PostSkew(const AX, AY: Double); overload; inline
Parameters
AX
: Double
AY
: Double
PostTransform(TBLMatrix2D)
procedure PostTransform(const ATransform: TBLMatrix2D); inline
Parameters
ATransform
: TBLMatrix2D
PostTranslate(TBLPointI)
procedure PostTranslate(const AP: TBLPointI); overload; inline
Parameters
AP
: TBLPointI
PostTranslate(TBLPoint)
procedure PostTranslate(const AP: TBLPoint); overload; inline
Parameters
AP
: TBLPoint
PostTranslate(Double, Double)
procedure PostTranslate(const AX, AY: Double); overload; inline
Parameters
AX
: Double
AY
: Double
RemoveStop(NativeInt)
Removes stop at the given AIndex
.
procedure RemoveStop(const AIndex: NativeInt); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AIndex
: NativeInt
See Also
Remarks
This method should be used together with IndexOfStop
, which returns index to the stop array.
RemoveStopByOffset(Double, Boolean)
Removes stop at the given AOffset
, which should be in [0, 1]
range.
The AAll
parameter specifies whether all stops at the given offset should be removed as there are cases in which two stops can occupy the same offset to create sharp transitions. If AAll
is False and there is a sharp transition only the first stop would be removed. If AAll
is True both stops will be removed.
procedure RemoveStopByOffset(const AOffset: Double; const AAll: Boolean = True); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AOffset
: Double
AAll
: Boolean = True
Remarks
There are never 3 stops occupying the same AOffset
.
RemoveStops(TBLRange)
Removes all stops in the given range, which describes indexes in the stop array.
procedure RemoveStops(const ARange: TBLRange); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ARange
: TBLRange
RemoveStopsByOffset(Double, Double)
Removes all stops in the given interval [AOffsetMin, AOffsetMax]
, which specifies stop offsets, which are between [0, 1].
procedure RemoveStopsByOffset(const AOffsetMin, AOffsetMax: Double); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AOffsetMin
: Double
AOffsetMax
: Double
ReplaceStop(NativeInt, Double, TAlphaColor)
Replaces stop at the given AIndex
with a new color stop described by AOffset
and AColor
.
The operation leads to the same result as RemoveStop(AIndex)
followed by AddStop(AOffset, AColor)
.
procedure ReplaceStop(const AIndex: NativeInt; const AOffset: Double; const AColor: TAlphaColor); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AIndex
: NativeInt
AOffset
: Double
AColor
: TAlphaColor
See Also
ReplaceStop(NativeInt, Double, TBLRgba64)
Replaces stop at the given AIndex
with a new color stop described by AOffset
and ARgba64
.
The operation leads to the same result as RemoveStop(AIndex)
followed by AddStop(AOffset, ARgba64)
.
procedure ReplaceStop(const AIndex: NativeInt; const AOffset: Double; const ARgba64: TBLRgba64); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AIndex
: NativeInt
AOffset
: Double
ARgba64
: TBLRgba64
See Also
ReplaceStop(NativeInt, Double, TBLRgba32)
Replaces stop at the given AIndex
with a new color stop described by AOffset
and ARgba32
.
The operation leads to the same result as RemoveStop(AIndex)
followed by AddStop(AOffset, ARgba32)
.
procedure ReplaceStop(const AIndex: NativeInt; const AOffset: Double; const ARgba32: TBLRgba32); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AIndex
: NativeInt
AOffset
: Double
ARgba32
: TBLRgba32
See Also
Reserve(NativeInt)
Reserves the capacity of gradient for at least AMinCapacity
stops.
procedure Reserve(const AMinCapacity: NativeInt); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AMinCapacity
: NativeInt
Reset
Resets the gradient to its construction state.
procedure Reset; inline
ResetExtendMode
Resets the gradient extend mode to TBLExtendMode.Pad
.
procedure ResetExtendMode; inline
Exceptions
EBlend2DError
: Raised on failure.
See Also
ResetStops
Resets all stops of the gradient.
After the operation the gradient will have no color stops.
procedure ResetStops; inline
Exceptions
EBlend2DError
: Raised on failure.
ResetTransform
procedure ResetTransform; inline
Rotate(Double, TBLPointI)
procedure Rotate(const AAngle: Double; const AOrigin: TBLPointI); overload; inline
Parameters
AAngle
: Double
AOrigin
: TBLPointI
Rotate(Double, TBLPoint)
procedure Rotate(const AAngle: Double; const AOrigin: TBLPoint); overload; inline
Parameters
AAngle
: Double
AOrigin
: TBLPoint
Rotate(Double, Double, Double)
procedure Rotate(const AAngle, AX, AY: Double); overload; inline
Parameters
AAngle
: Double
AX
: Double
AY
: Double
Rotate(Double)
procedure Rotate(const AAngle: Double); overload; inline
Parameters
AAngle
: Double
Scale(TBLPointI)
procedure Scale(const AP: TBLPointI); overload; inline
Parameters
AP
: TBLPointI
Scale(TBLPoint)
procedure Scale(const AP: TBLPoint); overload; inline
Parameters
AP
: TBLPoint
Scale(Double, Double)
procedure Scale(const AX, AY: Double); overload; inline
Parameters
AX
: Double
AY
: Double
Scale(Double)
procedure Scale(const AXY: Double); overload; inline
Parameters
AXY
: Double
SetValues(TBLConicGradientValues)
procedure SetValues(const AValues: TBLConicGradientValues); overload; inline
Parameters
AValues
: TBLConicGradientValues
SetValues(TBLRadialGradientValues)
procedure SetValues(const AValues: TBLRadialGradientValues); overload; inline
Parameters
AValues
: TBLRadialGradientValues
SetValues(TBLLinearGradientValues)
procedure SetValues(const AValues: TBLLinearGradientValues); overload; inline
Parameters
AValues
: TBLLinearGradientValues
SetValues(NativeInt, PDouble, NativeInt)
procedure SetValues(const AIndex: NativeInt; const AValues: PDouble; const ACount: NativeInt); overload; inline
Parameters
AIndex
: NativeInt
AValues
: PDouble
ACount
: NativeInt
SetValues(NativeInt, TArray<Double>)
procedure SetValues(const AIndex: NativeInt; const AValues: TArray<Double>); overload; inline
Parameters
AIndex
: NativeInt
AValues
: TArray<Double>
Shrink
Shrinks the capacity of gradient stops to fit the current use.
procedure Shrink; inline
Exceptions
EBlend2DError
: Raised on failure.
Skew(TBLPoint)
procedure Skew(const AP: TBLPoint); overload; inline
Parameters
AP
: TBLPoint
Skew(Double, Double)
procedure Skew(const AX, AY: Double); overload; inline
Parameters
AX
: Double
AY
: Double
StopsView
Returns gradient stops and their count as TBLArrayView<tblgradientstop>
.
function StopsView: TBLArrayView<TBLGradientStop>; inline
Returns
Swap(TBLGradient)
Swaps this gradient with AOther
.
procedure Swap(var AOther: TBLGradient); inline
Parameters
AOther
: TBLGradient
Translate(TBLPointI)
procedure Translate(const AP: TBLPointI); overload; inline
Parameters
AP
: TBLPointI
Translate(TBLPoint)
procedure Translate(const AP: TBLPoint); overload; inline
Parameters
AP
: TBLPoint
Translate(Double, Double)
procedure Translate(const AX, AY: Double); overload; inline
Parameters
AX
: Double
AY
: Double