class

CrImage::Draw::RadialGradient

Inherits Reference / Object

RadialGradient represents a circular color gradient radiating from a center point.

The gradient interpolates colors radially from the center outward to the radius, using the defined color stops. Colors are smoothly blended between stops.

Example:

stops = [
  CrImage::Draw::ColorStop.new(0.0, CrImage::Color::WHITE),
  CrImage::Draw::ColorStop.new(1.0, CrImage::Color::BLACK),
]
gradient = CrImage::Draw::RadialGradient.new(
  CrImage.point(200, 150),
  100,
  stops
)

Constructors

new(center : CrImage::Point, radius : Int32, stops : Array(CrImage::Draw::ColorStop))
Source

Instance methods

center
Source
center=(center : Point)
Source
color_at(t : Float64) : Color::Color

Gets the interpolated color at a given distance from center.

Parameters:

  • t : Normalized distance from center (0.0 = center, 1.0 = radius)

Returns: Interpolated color at distance t

Source
radius
Source
radius=(radius : Int32)
Source
stops
Source
stops=(stops : Array(ColorStop))
Source