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§
- Draw
Command Schema - Draw
Field Schema - Draw
List - An encoded drawing command list, ready to go on the wire as one property value.
- Draw
List Builder - Builds a command list. Each call appends one fixed-size record;
TextAtalso appends its bytes to the text region, which is written after every record.
Enums§
- Draw
Command - One drawing command. Coordinates are dp from the widget’s top-left corner.
- Draw
Field Type - 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:
nfixed-size records followed by theTextAtstrings.