Package-level declarations
The two entry points with their fetch companion scanSvgRefs, the JVM File conveniences, and the sealed SvgFormatException hierarchy naming every way a document or scene can fail the format.
The element vocabulary
Seven SVG elements carry the eight CGA shapes and the group tree. Element identity is resolved by k:type, never by geometry.
| Element | Reading |
|---|---|
<rect> | a rectangle Polygon (parse-only — a save writes <polygon>); a FlatPoint when k:type="flat-point" |
<circle> | a Circle; a RoundPoint when k:type="round-point" |
<line> | a Segment; an infinite Line when k:type="line" |
<polygon> | a Polygon |
<polyline> | a Polyline |
<g> | a nested GroupNode; a Dipole when k:type="dipole" |
<use href="doc.svg"> | parse-only expansion of an external template document — a save writes the placed shapes |
Degenerate CGA states persist faithfully: imaginary and inside-out circles ride k:flags, an imaginary dipole needs no flag at all (its round-point children rebuild it exactly), and an infinite line writes display endpoints on the scene's world border. Only a shape the format cannot place — a line or dipole endpoint at infinity — is skipped with a warning on save.
The two entry points with their fetch companion scanSvgRefs, the JVM File conveniences, and the sealed SvgFormatException hierarchy naming every way a document or scene can fail the format.
The element vocabulary
Seven SVG elements carry the eight CGA shapes and the group tree. Element identity is resolved by k:type, never by geometry.
| Element | Reading |
|---|---|
<rect> | a rectangle Polygon (parse-only — a save writes <polygon>); a FlatPoint when k:type="flat-point" |
<circle> | a Circle; a RoundPoint when k:type="round-point" |
<line> | a Segment; an infinite Line when k:type="line" |
<polygon> | a Polygon |
<polyline> | a Polyline |
<g> | a nested GroupNode; a Dipole when k:type="dipole" |
<use href="doc.svg"> | parse-only expansion of an external template document — a save writes the placed shapes |
Degenerate CGA states persist faithfully: imaginary and inside-out circles ride k:flags, an imaginary dipole needs no flag at all (its round-point children rebuild it exactly), and an infinite line writes display endpoints on the scene's world border. Only a shape the format cannot place — a line or dipole endpoint at infinity — is skipped with a warning on save.
Types
The rejection of a <circle> with no usable radius.
The rejection of a dipole carrier <g k:type="dipole"> that holds no valid endpoint pair.
The rejection of a <line k:type="line"> missing part of its geometry.
The rejection of a <polygon> whose points close no polygon.
The rejection of a <polyline> whose points chain into no polyline.
The rejection of a <rect> that fits neither of the element's two readings.
The rejection of a round-point <circle> (k:type="round-point") with no usable marker size.
The rejection of a bare <line> that builds no segment.
The rejection of a template document that violates the template size contract.
The rejection of a <use> that doesn't fit the format's external-template form.
The rejection of a viewBox attribute that describes no viewport.
The rejection of input with no <svg> element at all — nothing to parse.
The absence of a template document a <use> references.
The absence of a viewport on the document or scene root.
The violation of the /v1 format by a document or scene — the sealed base of every failure the module's entry points raise.
The rejection of template documents that reference each other in a loop.
The rejection of a paint value outside the /v1 color grammar.
The rejection of an SVG element outside the /v1 vocabulary.