CrImage::Draw::LinearGradient
Inherits Reference / Object
LinearGradient represents a linear color gradient between two points.
The gradient interpolates colors along a line from start_point to end_point, using the defined color stops. Colors are smoothly blended between stops.
Example:
stops = [
CrImage::Draw::ColorStop.new(0.0, CrImage::Color::RED),
CrImage::Draw::ColorStop.new(0.5, CrImage::Color::GREEN),
CrImage::Draw::ColorStop.new(1.0, CrImage::Color::BLUE),
]
gradient = CrImage::Draw::LinearGradient.new(
CrImage.point(0, 0),
CrImage.point(100, 0),
stops
)
Constructors
new(start_point : CrImage::Point, end_point : CrImage::Point, stops : Array(CrImage::Draw::ColorStop))
SourceInstance methods
color_at(t : Float64) : Color::Color
Gets the interpolated color at a given position along the gradient.
Parameters:
t: Position along gradient (0.0 = start, 1.0 = end)
Returns: Interpolated color at position t
end_point
Sourceend_point=(end_point : Point)
Sourcestart_point
Sourcestart_point=(start_point : Point)
Sourcestops
Sourcestops=(stops : Array(ColorStop))
Source