40typedef enum : uint32_t {
330priv_ra8_svgp_attr(
const uint8_t* s,
size_t len,
const char* name,
size_t* voff,
size_t* vlen);
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
int32_t priv_ra8_svgp_sx(const svg_xform_t *t, int32_t sw)
Scale a user-space length by the user x scale and the viewBox x ratio.
struct svg_grads svg_grads_t
Forward decl: the document's gradient set (defined after svg_xform_t).
uint32_t priv_ra8_svgp_paint(const uint8_t *s, size_t len)
Parse an SVG paint value ('rgb'/'rrggbb'/name/'none') to 0x00RRGGBB.
int32_t priv_ra8_svgp_num(const uint8_t *s, size_t len, size_t *i)
Parse the integer part of one SVG number at s[*i]; truncate fractions.
void priv_ra8_svgp_fill_poly_grad(const int32_t *xs, const int32_t *ys, int32_t n, const svg_grad_t *g)
Per-pixel gradient scanline fill of polygon (xs,ys)[0..n).
void priv_ra8_svgp_draw_circle(const uint8_t *s, size_t len, const svg_xform_t *t)
Draw one SVG 'circle' element using its fill colour or gradient.
void priv_ra8_svgp_draw_polygon(const uint8_t *s, size_t len, const svg_xform_t *t)
Draw one SVG 'polygon' element as a filled polygon.
void priv_ra8_svgp_fill_poly(const int32_t *xs, const int32_t *ys, int32_t n, uint32_t color)
Even-odd scanline fill of polygon (xs,ys)[0..n) with a solid colour.
void priv_ra8_svgp_map_point(const svg_xform_t *t, int32_t ux, int32_t uy, int32_t *fx, int32_t *fy)
Map a user-space point through the FULL affine, then viewBox->box.
void priv_ra8_svgp_draw_polyline(const uint8_t *s, size_t len, const svg_xform_t *t)
Draw one SVG 'polyline' element as connected stroke line segments.
float priv_ra8_svgp_numf(const uint8_t *s, size_t len, size_t *i)
Parse one SVG floating-point number at s[*i], skipping separators.
void priv_ra8_svgp_draw_rect(const uint8_t *s, size_t len, const svg_xform_t *t)
Draw one SVG 'rect' element using its fill colour or gradient.
void priv_ra8_svgp_flatten_arc(const svg_xform_t *t, svg_pt_t p0, const int32_t *args, svg_pt_t p_end, int32_t *xs, int32_t *ys, int32_t *n)
Flatten an SVG elliptical arc into the polygon vertex array.
void priv_ra8_svgp_apply_xform(svg_xform_t *t, const uint8_t *tag, size_t tlen)
Compose the 'transform=' attribute from tag onto t's user affine.
bool priv_ra8_svgp_ws(char c)
Test whether a character is XML whitespace.
bool priv_ra8_svgp_attr(const uint8_t *s, size_t len, const char *name, size_t *voff, size_t *vlen)
Find attribute name in tag span s[0..len); return its value slice.
uint32_t priv_ra8_svgp_resolve_fill(const uint8_t *s, size_t len, const svg_xform_t *t, uint32_t def, int32_t *gi)
Resolve a shape's 'fill': a solid colour, or a gradient index via gi.
int32_t priv_ra8_svgp_mx(const svg_xform_t *t, int32_t sx)
Map a user-space x coordinate to a framebuffer x coordinate.
uint32_t priv_ra8_svgp_attr_paint(const uint8_t *s, size_t len, const char *name, uint32_t def)
Read an SVG attribute as a paint colour, returning def when absent.
size_t priv_ra8_svgp_find_ci(const uint8_t *s, size_t len, size_t from, const char *lit)
Find the first case-insensitive occurrence of lit in s[from..len).
int32_t priv_match_grad(const svg_grads_t *grads, const uint8_t *val, size_t vlen)
Match a 'url(id)' paint value to a gradient index in the document set.
bool priv_ra8_svgp_starts_ci(const uint8_t *s, size_t len, size_t at, const char *lit)
Case-insensitive prefix test of lit at at within s[0..len).
void priv_ra8_svgp_draw_line(const uint8_t *s, size_t len, const svg_xform_t *t)
Draw one SVG 'line' element using its stroke colour.
int32_t priv_ra8_svgp_attr_num(const uint8_t *s, size_t len, const char *name, int32_t def)
Read an SVG attribute as a signed integer, returning def when absent.
char priv_ra8_svgp_lc(char c)
ASCII-fold a character to lower case.
bool priv_ra8_svgp_has_rot(const svg_xform_t *t)
Test whether the user transform contains rotation or shear.
priv_svg_consts_t
Parse + colour constants for the SVG subset.
@ k_svg_arc_ey
A arg index: endpoint Y.
@ k_svg_path_args
Max args of a path command (A).
@ k_svg_bom2
UTF-8 BOM byte 2.
@ k_svg_arc_ex
A arg index: endpoint X.
@ k_svg_hex6
#rrggbb digit count.
@ k_svg_grad_linear
<linearGradient> kind.
@ k_svg_grad_radial
<radialGradient> kind.
@ k_svg_def_fill
SVG default fill is black.
@ k_svg_grad_max
Max gradients defined per document.
@ k_svg_hex_a10
Value of hex 'a'/'A'.
@ k_svg_arc_large
A arg index: large-arc flag.
@ k_svg_sh_r
Red shift within 0x00RRGGBB.
@ k_svg_arc_seg_max
Max segments per arc flatten.
@ k_svg_hex3
#rgb digit count.
@ k_svg_poly_min
Min points for a fillable polygon.
@ k_svg_arc_rx
A arg index: semi-axis X.
@ k_svg_hex_chan
Bits per colour channel.
@ k_svg_bom0
UTF-8 BOM byte 0.
@ k_svg_no_paint
none / absent paint sentinel.
@ k_svg_hex_base
Hex base / "not a hex digit".
@ k_svg_hex_nib
Bits per hex nibble.
@ k_svg_poly_max
Max points / scanline crossings.
@ k_svg_path_ep
Endpoint pair size (x, y); M/L/T.
@ k_svg_arc_ry
A arg index: semi-axis Y.
@ k_svg_viewbox_n
viewBox number count.
@ k_svg_g_depth_max
Max nested <g> transform depth.
@ k_svg_arc_sweep
A arg index: sweep flag.
@ k_svg_bom_len
UTF-8 BOM length.
@ k_svg_rect_pts
Corner count of a rectangle.
@ k_svg_argc_cube
Arg count of C.
@ k_svg_arc_rot
A arg index: x-axis rotation.
@ k_svg_grad_id
Max gradient id length, bytes.
@ k_svg_bom1
UTF-8 BOM byte 1.
@ k_svg_circle_seg
N-gon segments for a transformed circle.
@ k_svg_curve_seg
Segments per cubic-Bezier flatten.
@ k_svg_cube_ey
C endpoint-y argument index.
@ k_svg_grad_stops
Max colour stops per gradient.
@ k_svg_argc_quad
Arg count of S / Q.
@ k_svg_chan_mask
One 8-bit RGB channel mask.
void priv_ra8_svgp_draw_path(const uint8_t *s, size_t len, const svg_xform_t *t)
Draw one SVG 'path' element as a filled polygon.
int32_t priv_ra8_svgp_my(const svg_xform_t *t, int32_t sy)
Map a user-space y coordinate to a framebuffer y coordinate.
A parsed linear/radial gradient in objectBoundingBox units.
float x2
Linear end x / radial radius.
uint8_t kind
k_svg_grad_linear / k_svg_grad_radial.
float y1
Linear start y / radial centre y.
float y2
Linear end y (unused for radial).
uint8_t nstops
Number of valid stops.
float x1
Linear start x / radial centre x.
svg_stop_t stops[k_svg_grad_stops]
Colour stops, in document order.
Bounded set of gradients scanned from the document before the render.
svg_grad_t g[k_svg_grad_max]
The gradient table.
int32_t n
Number of valid gradients (<= k_svg_grad_max).
A 2-D point in SVG user space (an x/y pair).
One gradient colour stop: an offset in [0,1] and an 0x00RRGGBB colour.
float off
Stop offset, clamped to [0,1].
uint32_t col
Stop colour, 0x00RRGGBB.
A user transform= as a full 2x3 affine matrix.
float c
Row0 col1 (x shear).
float a
Row0 col0 (x scale).
float b
Row1 col0 (y shear).
float d
Row1 col1 (y scale).