class

Tryst::Vector::Shape

Inherits Reference < Object

One drawn shape within a Surface#draw block - built via Context's #rect/#rounded_rect/#circle, then given a fill and/or stroke. Already added to the frame's canvas by the time a caller gets one back; #fill/#stroke only configure how it renders, not whether it does.

Constructors

new(handle : LibThorVG::Paint, canvas : LibThorVG::Canvas)

@api private - only Context builds these.

Source

Instance methods

fill(r : UInt8, g : UInt8, b : UInt8, a : UInt8 = 255) : self

A flat fill color. Overwrites any gradient #fill already set - ThorVG itself keeps only the more recent of the two (see tvg_shape_set_gradient's own doc comment).

Source
fill(gradient : Gradient) : self

A gradient fill instead of a flat color.

Source
stroke(width : Float64, r : UInt8, g : UInt8, b : UInt8, a : UInt8 = 255, cap : StrokeCap = :butt) : self

An outline in a flat color, width logical pixels wide - already scaled for the Surface's HiDPI factor along with everything else about this shape (see Context's own doc comment). cap: only matters on a shape with an open path (Context#arc); harmless to pass on a closed one (rect/circle/polygon), it just has nothing to apply to.

Source
stroke(width : Float64, gradient : Gradient, cap : StrokeCap = :butt) : self

An outline painted with a gradient instead of a flat color.

Source