Skip to content
Member Filters
Show Inherited
Show Protected
Show abstract
GR32_ColorGradients🞂TXGradientSamplerClass

TXGradientSampler

Linear 2D vector gradient sampler.

Inheritance:TObject 🞂 TPersistent 🞂 TNotifiablePersistent 🞂 TCustomSampler 🞂 TCustomGradientSampler 🞂 TCustomGradientLookUpTableSampler 🞂 TCustomCenterLutGradientSampler 🞂 TCustomCenterRadiusLutGradientSampler 🞂 TCustomCenterRadiusAngleLutGradientSampler 🞂 TXGradientSampler

Declaration ​

pascal
TXGradientSampler = class(TCustomCenterRadiusAngleLutGradientSampler)

Description ​

TXGradientSampler samples a 1D linear gradient projected along a vector defined by StartPoint and EndPoint.

ClampMirrorRepeat

Mathematics & Algorithm ​

Given start point P1=(X1,Y1) and end point P2=(X2,Y2), direction vector V=P2−P1.

For any sampling point P=(X,Y), linear parameter u is the scalar projection onto V:

u=(P−P1)⋅V∥V∥2=(X−X1)(X2−X1)+(Y−Y1)(Y2−Y1)(X2−X1)2+(Y2−Y1)2