Table of Contents

Class CanvasBuilder

Namespace
RatatuiUnity

Fluent builder for canvas widgets: world map, geometric shapes, text, and point clouds.

public sealed class CanvasBuilder
Inheritance
CanvasBuilder
Inherited Members

Examples

term.BeginCanvas(area, -180, 180, -90, 90, Marker.Braille)
    .Map(MapResolution.High)
    .Layer()
    .Points(serverCoords, Color.yellow)
    .Render();

Methods

Circle(double, double, double, Color)

Draw a circle outline.

public CanvasBuilder Circle(double x, double y, double radius, Color color)

Parameters

x double
y double
radius double
color Color

Returns

CanvasBuilder

Layer()

Flush the current drawing layer so subsequent shapes render on top of previously drawn shapes.

public CanvasBuilder Layer()

Returns

CanvasBuilder

Line(double, double, double, double, Color)

Draw a line segment.

public CanvasBuilder Line(double x1, double y1, double x2, double y2, Color color)

Parameters

x1 double
y1 double
x2 double
y2 double
color Color

Returns

CanvasBuilder

Map(MapResolution)

Draw the world map.

public CanvasBuilder Map(MapResolution resolution = MapResolution.High)

Parameters

resolution MapResolution

Returns

CanvasBuilder

Points(double[], Color)

Draw a scatter of points. coords is interleaved (x, y) doubles: [x0, y0, x1, y1, ...].

public CanvasBuilder Points(double[] coords, Color color)

Parameters

coords double[]
color Color

Returns

CanvasBuilder

Rectangle(double, double, double, double, Color)

Draw a rectangle outline.

public CanvasBuilder Rectangle(double x, double y, double width, double height, Color color)

Parameters

x double
y double
width double
height double
color Color

Returns

CanvasBuilder

Render()

Finalize and enqueue the canvas widget command. Must be called exactly once; the builder is unusable afterward.

public void Render()

Text(double, double, string, Color)

Print a text label at the given canvas coordinates.

public CanvasBuilder Text(double x, double y, string text, Color color)

Parameters

x double
y double
text string
color Color

Returns

CanvasBuilder