class

UIng::Area::Draw::Context

Inherits UIng::BlockConstructor < Reference < Object

Constructors

new(*args, &)
Source
new(*args, **kwargs, &)
Source

Instance methods

clip(path : Path) : Nil

Low-level clipping: apply a finished path as clip

Source
clip_path(mode : FillMode = FillMode::Winding, &)

High-level clipping: build a path in a block, end it, and clip

Source
draw_fill(path : Path, brush : Brush) : Nil

Low-level: fill an ended path

Source
draw_image(img : UIng::Image, x : Number, y : Number, width : Number, height : Number) : Nil
Source
draw_image(buffer : UIng::ImageBuffer, x : Number, y : Number, width : Number, height : Number, *, source : UIng::ImageBuffer::SourceRect | Nil = nil, interpolation : UIng::ImageBuffer::Interpolation = UIng::ImageBuffer::Interpolation::Smooth) : Nil

Convenience API; delegates to the C-shaped wrappers above.

Source
draw_image_buffer(buffer : UIng::ImageBuffer, x : Number, y : Number, width : Number, height : Number, interpolation : UIng::ImageBuffer::Interpolation = UIng::ImageBuffer::Interpolation::Smooth) : Nil

Direct wrapper for uiDrawImageBuffer. Only valid inside Draw.

Source
draw_image_buffer_with_params(buffer : UIng::ImageBuffer, params : ImageBufferParams) : Nil

Direct wrapper for uiDrawImageBufferWithParams. Smooth interpolation can sample outside the source rectangle; use Nearest for atlas edges.

Source
draw_path(mode : FillMode = FillMode::Winding, fill : Bool = true, stroke : Bool = false, fill_brush : Brush | Nil = nil, stroke_brush : Brush | Nil = nil, stroke_params : StrokeParams | Nil = nil, &)

High-level: build once, then optionally fill and/or stroke

Source
draw_stroke(path : Path, brush : Brush, stroke_params : StrokeParams) : Nil

Low-level: stroke an ended path

Source
draw_stroke(path : Path, brush : Brush, cap : UIng::Area::Draw::LineCap = LineCap::Flat, join : UIng::Area::Draw::LineJoin = LineJoin::Miter, thickness : Number = 1.0, miter_limit : Number = 10.0, dash_phase : Number = 0.0, dashes : Enumerable(Number) | Nil = nil) : Nil

Convenience overload to build StrokeParams inline

Source
draw_text_layout(text_layout : TextLayout, x : Number, y : Number) : Nil

Text drawing (libui uiDrawText equivalent)

Source
fill_path(brush : Brush, mode : FillMode = FillMode::Winding, &)

High-level: build a path in a block, end it, and fill

Source
restore
Source
save

Save/restore helpers

Source
saved

Runs a drawing block with this Context as receiver and argument. Restores the saved state on block exit and returns the block's value.

Source
stroke_path(brush : Brush, stroke_params : StrokeParams, mode : FillMode = FillMode::Winding, &)

High-level: build a path in a block, end it, and stroke

Source
stroke_path(brush : Brush, cap : UIng::Area::Draw::LineCap = LineCap::Flat, join : UIng::Area::Draw::LineJoin = LineJoin::Miter, thickness : Number = 1.0, miter_limit : Number = 10.0, dash_phase : Number = 0.0, dashes : Enumerable(Number) | Nil = nil, mode : FillMode = FillMode::Winding, &) : Nil
Source
to_unsafe
Source
transform(matrix : Matrix) : Nil

Matrix composition (same semantics as libui's uiDrawTransform)

Source