grablab.svg
svg
Explicit, host-free SVG postprocessing. Install the svg extra.
Trees are edited in memory; write_svg exclusively creates a NEW output. Raw captures are never rewritten. Data URIs must match known decoded PNG pixels; named source aliases explicitly distinguish vector provenance from equivalence. Semantic bounds indicate containment, not pixel ownership.
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
ICON_MODES |
attribute | ||
INDEX_SCHEMA |
attribute | ||
SVG |
attribute | ||
XLINK |
attribute | ||
build_raster_index |
function | (manifest: str | Path, source_dirs: list[str | Path]=()) -> dict |
Index exported PNG variants and exact-pixel authoritative source aliases. |
compose |
function | (panels: list[tuple[str | Path, float, float]], *, width: float, height: float, output: str | Path | None=Non… |
Assemble in paint order; pass output to rebase relative image URLs. |
deduplicate_paths |
function | (root: ET.Element) -> dict |
Remove only identical consecutive opaque fill-only paths in safe groups. |
inline_images |
function | (root: ET.Element, mapping: dict) -> dict |
Replace uniquely matched rasters in place with nested SVG viewports. |
map_images |
function | (root: ET.Element, index: dict) -> dict |
Return a JSON-serializable data-URI mapping with all candidate paths. |
pixel_key |
function | (data: bytes) -> str |
Hash exact 8-bit premultiplied pixels, including dimensions and alpha. |
process_images |
function | (root: ET.Element, mapping: dict | None=None, *, icon_mode: str='inline-svg', output: str | Path | None=None)… |
Keep, link or inline mapped icons; URL modes require the output SVG path. |
read_svg |
function | (path: str | Path) -> ET.Element |
Read trusted local capture/export XML without touching the source. |
restyle |
function | (root: ET.Element, *, stroke: str | None=None, fill: str | None=None, stroke_width: float | None=None, backgr… |
Restyle presentation/inline CSS; retain opacity and none paints. |
tag_widgets |
function | (root: ET.Element, record: dict) -> dict |
Tag original paint shapes by smallest containing root-logical widget rect. |
write_svg |
function | (root: ET.Element, output: str | Path) -> Path |
Publish a new processed artifact; refuse raw/existing destinations. |