RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
Loading...
Searching...
No Matches
image_svg.h File Reference

Static, memory-only SVG geometry with explicit caller-owned workspaces. More...

#include "image.h"

Data Structures

struct  rmgui_svg_diagnostic_t
 First issue's byte offset and static message; count includes all issues found. More...
struct  rmgui_svg_t
 Immutable parsed document. More...

Enumerations

enum  rmgui_svg_issue_t {
  RMGUI_SVG_MALFORMED = 1 , RMGUI_SVG_UNSUPPORTED = 2 , RMGUI_SVG_STORAGE = 4 , RMGUI_SVG_RANGE = 8 ,
  RMGUI_SVG_REFERENCE = 16
}
 Diagnostic flags are combinable. More...

Functions

int rmgui_svg_parse (rmgui_svg_t *out, const char *bytes, size_t length, void *storage, size_t capacity, int strict, rmgui_svg_diagnostic_t *diagnostic)
 Parse bounded UTF-8 XML without allocation, external entities or file I/O.
int rmgui_svg_paint_to (const rmgui_svg_t *, rmgui_target_t *, rmgui_rect_t viewport, rmgui_rect_t clip, void *workspace, size_t capacity, rmgui_svg_diagnostic_t *diagnostic)
 Paint geometry at viewport, preserving the viewBox aspect ratio with centred meet alignment.
int rmgui_svg_decode_into (const rmgui_svg_t *, rmgui_fb_t *, void *workspace, size_t capacity, rmgui_svg_diagnostic_t *diagnostic)
 Rasterize from geometry into an existing caller-sized positive RGBA8 buffer.
int rmgui_image_decode_svg (rmgui_fb_t *, const uint8_t *, size_t, const rmgui_image_limits_t *)
 Registry-compatible strict decode at the intrinsic ceil(width/height) extent.

Variables

const rmgui_image_codec_t rmgui_image_codec_svg
 Immutable descriptor; registration is explicit and caller-owned.

Detailed Description

Static, memory-only SVG geometry with explicit caller-owned workspaces.

Enumeration Type Documentation

◆ rmgui_svg_issue_t

Diagnostic flags are combinable.

Unsupported features are warnings only in permissive parsing; malformed XML, invalid values and broken references refuse.

Enumerator
RMGUI_SVG_MALFORMED 
RMGUI_SVG_UNSUPPORTED 
RMGUI_SVG_STORAGE 
RMGUI_SVG_RANGE 
RMGUI_SVG_REFERENCE 

Function Documentation

◆ rmgui_svg_parse()

int rmgui_svg_parse ( rmgui_svg_t * out,
const char * bytes,
size_t length,
void * storage,
size_t capacity,
int strict,
rmgui_svg_diagnostic_t * diagnostic )

Parse bounded UTF-8 XML without allocation, external entities or file I/O.

storage must have max_align_t alignment. Capacity is bytes, not node count; zero capacity permits a sizing refusal, reported as STORAGE. Unknown elements, attributes, units and unsupported SVG features are diagnosed; strict != 0 refuses them, otherwise their containing unsupported element is skipped. Returns 0/-1; *out is unchanged on refusal. Workspace contents are unspecified. Presentation attributes and inline style are supported, not CSS stylesheets. Node/value syntax is validated before success; geometry range and paint workspace requirements are checked again at the requested render extent.

◆ rmgui_svg_paint_to()

int rmgui_svg_paint_to ( const rmgui_svg_t * ,
rmgui_target_t * ,
rmgui_rect_t viewport,
rmgui_rect_t clip,
void * workspace,
size_t capacity,
rmgui_svg_diagnostic_t * diagnostic )

Paint geometry at viewport, preserving the viewBox aspect ratio with centred meet alignment.

Workspace is max_align_t-aligned, borrowed only for this call, disjoint from document, target storage and pixels; it never grows or allocates. Solids emit path commands; gradients and isolated opacity groups emit coverage samples, never a scaled source bitmap. RECORD snapshots all emitted values. Returns 0/-1; CPU pixels and logical RECORD counts remain unchanged on refusal. Capacity failures can be retried with a larger workspace.

◆ rmgui_svg_decode_into()

int rmgui_svg_decode_into ( const rmgui_svg_t * ,
rmgui_fb_t * ,
void * workspace,
size_t capacity,
rmgui_svg_diagnostic_t * diagnostic )

Rasterize from geometry into an existing caller-sized positive RGBA8 buffer.

Its prior pixels are replaced by transparent-background artwork on success. The same workspace/alignment/refusal rules as paint_to apply.

◆ rmgui_image_decode_svg()

int rmgui_image_decode_svg ( rmgui_fb_t * ,
const uint8_t * ,
size_t ,
const rmgui_image_limits_t *  )

Registry-compatible strict decode at the intrinsic ceil(width/height) extent.

Allocates pixels and temporary parse/paint workspaces; success transfers only pixels (rmgui_fb_free). Limits and failure-atomic output match image.h.

Variable Documentation

◆ rmgui_image_codec_svg

const rmgui_image_codec_t rmgui_image_codec_svg
extern

Immutable descriptor; registration is explicit and caller-owned.