Graphic

Graphic

A TVG graphic

graphic : { width ? U16, height ? U16, scale ? U8, format ? ColorEncoding, precision ? Precision } -> Graphic

Create a new graphic with the given options.

graphic {} # Produces a 100x100 graphic, 1/1 scale, u8888 encoding, default precision

applyColor : Graphic, Color, (Graphic, ColorIndex -> Graphic) -> Graphic

Adds a color to the graphic and returns the updated graphic and the color's index which is required for styling

g0 = Graphic.graphic {}
g1, white <- g0 |> Graphic.applyColor (Color.fromBasic White)
g2, purple <- g1 |> Graphic.applyColor (Color.rocPurple)

This is an example to add two colors.

addCommand : Graphic, Command -> Graphic

Adds a draw command to the graphic

toText : Graphic -> Str

Build TVG text format from a graphic