Skip to main content

Module scene

Module scene 

Source
Expand description

A vello Encoding as bytes, with fonts and images by id.

The streams go over as they are — path tags, path data, draw tags, draw data, transforms and styles are already plain words — and so do the late bound resources, except that a glyph run names its font and an image patch its image by the FontId/ImageId the app registered them under. Decoding reads every byte once into a fresh Encoding: a record in shared memory that the app keeps writing to is copied, not revisited, so what crate::validate checks is what the GPU later sees.

Layout, all little-endian, every section padded to four bytes:

counts      16 × u32  path tags, path data, draw tags, draw data,
                      transforms, styles, patches, color stops, glyphs,
                      glyph runs, coords, n_paths, n_path_segments,
                      n_clips, n_open_clips, flags
path tags   u8 each
path data   u32 each
draw tags   u32 each
draw data   u32 each
transforms  6 × f32 each
styles      2 × u32 each
patches     5 × u32 each: kind, then its fields
stops       f32 offset, u8 colour space, u8 missing, u16 0, 4 × f32
glyphs      u32 id, f32 x, f32 y
glyph runs  see `write_glyph_run`
coords      i16 each

Constants§

MAX_DASHES
Dashes one stroked glyph run may carry.

Traits§

ResourceIds
What an app’s encoder asks of its resource registry: the id a font or an image goes by on this connection, registering it on first sight.
Resources
What the service’s decoder needs: the font and image an id stands for on this connection. None for an id the connection never registered.

Functions§

decode
Read one encoding written by encode, resolving its ids through resources. Only the record’s shape is checked here (every count backed by bytes, every enumeration known, every id registered); whether it is safe to draw is crate::validate::validate’s question.
encode
Append encoding to out.