class

Tryst::Vector::Gradient

Inherits Reference < Object

A color transition ThorVG paints for a Shape's #fill or #stroke instead of a flat color. Built via .linear/.radial - once built, a Gradient has no public state of its own; it's only ever handed to Shape#fill/#stroke.

Constructors

linear(x1 : Float64, y1 : Float64, x2 : Float64, y2 : Float64, stops : Array(Tuple(Float64, UInt8, UInt8, UInt8, UInt8))) : Gradient

A straight-line color transition from (x1, y1) to (x2, y2). stops pairs a 0.0-1.0 offset with the color at that point along the line - {0.0, 255_u8, 0_u8, 0_u8, 255_u8} is opaque red at the start.

Source
radial(cx : Float64, cy : Float64, r : Float64, stops : Array(Tuple(Float64, UInt8, UInt8, UInt8, UInt8))) : Gradient

A color transition radiating out from (cx, cy) to radius r.

Source

Instance methods

handle

@api private - Shape reads this to attach the gradient.

Source