pub fn encode_ops(ops: &[DrawOp]) -> (Vec<f64>, Vec<String>)Expand description
Flat numeric encoding of a display list for shim/JNI boundaries (§11, §15.3): per op 9 numbers [kind, a, b, c, d, e, f, g, rgba-bits]; text payloads ride separately in order. Kinds: 0 fill-rect, 1 stroke-rect(g=w), 2 fill-rrect(e=r), 3 fill-ellipse, 4 stroke-ellipse(g=w), 5 stroke-arc(e=start°, f=sweep°, g=w), 6 line(a,b→c,d, g=w), 7 text(a,b=pos, e=size, f=anchor: 0 leading / 1 centered), 8 save, 9 restore, 10 concat(a..f=affine), 11 fill-polygon / 12 stroke-polygon(g=w) — polygon points ride the texts channel as “x,y x,y …” (closed automatically), 13 stroke-rrect(e=r, g=w), 14 set-gradient(f=type: 0 linear with a,b=start / c,d=end unit points; 1 radial with a,b=center unit point, c=unit radius; e=stop count) — the stops ride the texts channel as “offset,aarrggbb offset,aarrggbb …”; the gradient applies to the NEXT fill-shape record (whose color slot is then unused) and is cleared after it. Unit geometry resolves against the filled shape’s bounding box, so a radial stretches elliptically in non-square bounds.
Transports join texts with the unit separator U+001F (one entry per kind-7/11/12/14
record, in order), so text payloads must not contain U+001F. Known asymmetry:
Fill(Shape::Arc) encodes as kind 5 (stroke) with width 0 — filled arcs render only on the
direct-replay backends (AppKit/UIKit); use a polygon fan if a filled arc must be portable.