Skip to main content

Module drawing

Module drawing 

Source
Expand description

The closed drawing command set a Canvas node carries.

The Renderer is compiled ahead of time, so drawing code cannot cross the boundary. A fixed vocabulary of commands does instead. Every command is the same 36 bytes, which is what lets a reader skip a command it does not know and what keeps the list free of pointers: a path with many points is registered once as an asset and referenced by id.

Colour is a Paint, never a raw colour, so a canvas can draw in a ColorRole and the design system still decides what that role looks like.

Structs§

DrawCommandSchema
DrawFieldSchema
DrawList
An encoded drawing command list, ready to go on the wire as one property value.
DrawListBuilder
Builds a command list. Each call appends one fixed-size record; TextAt also appends its bytes to the text region, which is written after every record.

Enums§

DrawCommand
One drawing command. Coordinates are dp from the widget’s top-left corner.
DrawFieldType
How one of the six words of a command is read back.

Constants§

COMMAND_LEN
Bytes of one command record: tag, length, paint, then six 32-bit words.
DRAW_COMMAND_SCHEMA
Every command in wire order. Appending is the only allowed edit.
TAG_ARC
TAG_CIRCLE
TAG_LINE
TAG_POLYLINE_REF
TAG_RECT
TAG_ROUND_RECT
TAG_TEXT_AT

Functions§

decode_commands
Decodes a command list: n fixed-size records followed by the TextAt strings.