CrImage::Draw::ConicGradient
Inherits Reference / Object
ConicGradient represents an angular/conic color gradient sweeping around a center point.
The gradient interpolates colors based on angle from the center, creating a "pie chart" or "gauge" style effect. Useful for gauge charts, color wheels, and angular progress indicators.
Example:
stops = [
CrImage::Draw::ColorStop.new(0.0, CrImage::Color::RED),
CrImage::Draw::ColorStop.new(0.5, CrImage::Color::YELLOW),
CrImage::Draw::ColorStop.new(1.0, CrImage::Color::GREEN),
]
gradient = CrImage::Draw::ConicGradient.new(
CrImage.point(200, 150),
stops,
start_angle: -Math::PI / 2 # Start from top
)
Constructors
Instance methods
center
Sourcecenter=(center : Point)
Sourcecolor_at(t : Float64) : Color::Color
Gets the interpolated color at a given angle.
Parameters:
t: Normalized angle position (0.0 = start_angle, 1.0 = start_angle + 2π)
Returns: Interpolated color at angle t
start_angle
Sourcestart_angle=(start_angle : Float64)
Sourcestops
Sourcestops=(stops : Array(ColorStop))
Source