Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
036a71b
Add SVG preserveAspectRatio and viewport-relative percentage geometry…
Sep 27, 2026
ea58487
Phase 2: implement clipPath and mask element support
Sep 27, 2026
a57482b
Fix FilterWorkBudget under-charging for combined clip-path/mask/filter
Sep 27, 2026
30e7ee1
Fix Phase 2 formal-review findings: reqstream traceability, sysml2 so…
Sep 27, 2026
6c1cd6f
Phase 3: implement pattern fill/stroke paint server support
Sep 27, 2026
9dfad71
Fix orphaned SvgPatternRendering requirement chain
Sep 27, 2026
4ac5952
Phase 4: implement SVG image element support
Sep 27, 2026
9fdc37f
Fix uncaught UnsupportedImageFeatureException crashing SVG render on …
Sep 27, 2026
ed5e4fc
Update SvgCodec docs for image element exception-handling fix
Sep 27, 2026
0ac145d
Implement phase 5 SVG filter primitives
Sep 27, 2026
e22b94a
Fix feConvolveMatrix kernel flip to match SVG spec convolution formula
Sep 27, 2026
707ae5a
Fix feColorMatrix hueRotate to use spec formula instead of geometric …
Sep 27, 2026
46b9756
Strengthen feDisplacementMap test coverage per formal-review finding
Sep 27, 2026
63d1b6f
feat(svg): implement feDiffuseLighting, feSpecularLighting, feTurbulence
Sep 27, 2026
cc71b8c
docs(svg): document feDiffuseLighting/feSpecularLighting/feTurbulence
Sep 27, 2026
84c977b
chore(lint): fix markdown wrap artifact and add lighting/turbulence t…
Sep 27, 2026
9831a96
Fix stale no-op docs and test naming convention per Phase 6 formal-re…
Sep 27, 2026
7db0585
Phase 7: implement CSS style element and selector support
Sep 27, 2026
b485705
Fix malformed XML-doc comment in CSS malformed-rule test (Phase 7 qua…
Sep 27, 2026
78dbb12
Fix CSS work-budget cost model and malformed-rule stylesheet resync
Sep 28, 2026
8084c38
Fix stale feBlend-only doc line and add missing CSS field XML docs
Sep 28, 2026
e8b8d27
Phase 8: implement feBlend and fix feComposite arithmetic operator
Sep 28, 2026
4d290a4
docs: fix separable blend mode count in verification doc
Sep 28, 2026
c017040
docs: fix stale SVG filter/pattern/image documentation seams
Sep 28, 2026
bfb61e7
docs: propagate full 17-primitive filter list into user_guide introdu…
Sep 28, 2026
ca525dc
Fix 3 Copilot PR review findings: feBlend overlay mode, CSS descendan…
Sep 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ words:
- basn
- Beziers
- BGRA
- Blinn
- BITMAPCOREHEADER
- BITMAPFILEHEADER
- BITMAPINFOHEADER
Expand All @@ -36,8 +37,10 @@ words:
- bowtie
- buildmark
- Casteljau
- chokepoint
- CMYK
- coeffs
- combinators
- CSUM
- Decodability
- dequantize
Expand Down Expand Up @@ -78,6 +81,7 @@ words:
- Inkscape
- interoperating
- JFIF
- Lambertian
- lerp
- libjpeg
- luma
Expand Down Expand Up @@ -106,13 +110,17 @@ words:
- Pandoc
- packbits
- PackBits
- Perlin
- Phong
- pHYs
- Pels
- Premultiply
- premultiplication
- premultiplied
- premultiplies
- premultiplying
- PRNG
- Prng
- Qube
- rasterizer
- rasterizes
Expand All @@ -129,7 +137,9 @@ words:
- sarifmark
- scanline
- scanlines
- Schrage
- Skia
- Sobel
- sonarmark
- Subsampling
- subsampling
Expand All @@ -147,6 +157,15 @@ words:
- trns
- tRNS
- Truecolor
- unclipped
- Unclipped
- unmasked
- Unmasked
- unstroked
- Unstroked
- unduplicated
- rects
- letterboxing
- Unpremultiply
- unioning
- unpremultiplication
Expand Down Expand Up @@ -180,6 +199,8 @@ words:
- Maxp
- notdef
- Stanislaw
- stylesheet
- Stylesheet
- tryparse

# Exclude common build artifacts, dependencies, and vendored third-party code
Expand Down
14 changes: 14 additions & 0 deletions .reviewmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,20 @@ reviews:
- "docs/sysml2/model/canvas-net/codecs/svg-codec.sysml" # unit SysML2 model
- "src/DemaConsulting.CanvasNet/Codecs/SvgCodec.cs" # unit source (public API entry point)
- "src/DemaConsulting.CanvasNet/Codecs/Svg/**/*.cs" # unit source (partial-class implementation files)
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.ColorMatrix.cs" # phase 5 filter partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.ComponentTransfer.cs" # phase 5 filter partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Morphology.cs" # phase 5 filter partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Convolution.cs" # phase 5 filter partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.DisplacementMap.cs" # phase 5 filter partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Tile.cs" # phase 5 filter partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.DropShadow.cs" # phase 5 filter partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.FeImage.cs" # phase 5 filter partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Lighting.cs" # phase 6 filter partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Turbulence.cs" # phase 6 filter partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Css.Parser.cs" # phase 7 CSS styling partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Css.Selectors.cs" # phase 7 CSS styling partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Css.Cascade.cs" # phase 7 CSS styling partial
- "src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Blend.cs" # phase 8 filter partial
- "src/DemaConsulting.CanvasNet/Codecs/NamespaceDoc.cs" # Codecs namespace documentation
- "test/DemaConsulting.CanvasNet.Tests/Codecs/SvgCodecTests.cs" # unit tests
- "test/DemaConsulting.CanvasNet.Tests/Codecs/SvgFixtureTests.cs" # fixture conformance tests
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ image operations using `Span<T>`, and supports independent-copy cropping for loa
- 🖨️ **TIFF Codec** - Load/save 8-bit RGB/RGBA/Grayscale TIFF files
- 🗜️ **JPEG Codec** - Load baseline/progressive; save baseline JPEG
- 🎞️ **GIF Codec** - Decode-only load of first GIF frame; `GetInfo` reports the true frame count
- 📐 **SVG Codec** - Rasterize a common SVG subset, including markers/filters and weight/style-aware
font matching, to a surface
- 📐 **SVG Codec** - Rasterize a common SVG subset, including markers/filters/clip-paths/masks and
weight/style-aware font matching, to a surface
- 🔍 **Header-Only Probing** - `GetInfo` reads headers without decoding pixels (GIF excepted)
- 🖌️ **Path Filling** - Antialiased nonzero/even-odd fill of vector paths
- 🖊️ **Stroke-to-Fill** - Convert stroked paths into fillable outlines
Expand Down
826 changes: 720 additions & 106 deletions docs/design/canvas-net/codecs/svg-codec.md

Large diffs are not rendered by default.

229 changes: 200 additions & 29 deletions docs/reqstream/canvas-net.yaml

Large diffs are not rendered by default.

259 changes: 234 additions & 25 deletions docs/reqstream/canvas-net/codecs.yaml

Large diffs are not rendered by default.

754 changes: 734 additions & 20 deletions docs/reqstream/canvas-net/codecs/svg-codec.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/sysml2/model/canvas-net/codecs/svg-codec.sysml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package CanvasNet {
part def SvgCodec {
doc /* Decode/rasterize-only loader for a common real-world subset of SVG documents, rasterizing them into Surface pixel buffers. */

comment sourceRef /* Source: src/DemaConsulting.CanvasNet/Codecs/SvgCodec.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Core.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Parsing.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Elements.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Shapes.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.PathData.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.PathRender.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Paint.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Gradients.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Markers.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Text.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Attributes.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgFontFace.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgFontStyle.cs, src/DemaConsulting.CanvasNet/Codecs/ImageInfo.cs */
comment sourceRef /* Source: src/DemaConsulting.CanvasNet/Codecs/SvgCodec.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Core.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Parsing.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Elements.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Shapes.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.PathData.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.PathRender.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.ColorMatrix.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.ComponentTransfer.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Morphology.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Convolution.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.DisplacementMap.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Tile.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.DropShadow.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.FeImage.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Paint.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Gradients.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Markers.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Text.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Attributes.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgFontFace.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgFontStyle.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.ClippingAndMasking.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Patterns.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.PreserveAspectRatio.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Image.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Lighting.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Turbulence.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Filters.Blend.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Css.Parser.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Css.Selectors.cs, src/DemaConsulting.CanvasNet/Codecs/Svg/SvgCodec.Css.Cascade.cs, src/DemaConsulting.CanvasNet/Codecs/ImageInfo.cs */
comment testRef /* Test: test/DemaConsulting.CanvasNet.Tests/Codecs/SvgCodecTests.cs, test/DemaConsulting.CanvasNet.Tests/Codecs/SvgFixtureTests.cs */
comment designRef /* Design: docs/design/canvas-net/codecs/svg-codec.md */
comment verificationRef /* Verification: docs/verification/canvas-net/codecs/svg-codec.md */
Expand Down
44 changes: 37 additions & 7 deletions docs/user_guide/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<!-- cspell:ignore glyf sfnt codepoint -->
<!-- cspell:ignore rasterizing unparseable SMIL renderable -->
<!-- cspell:ignore unitless -->

## Purpose

Expand Down Expand Up @@ -894,18 +895,47 @@ elements (referenced via `marker-start`/`marker-mid`/`marker-end`, with `markerW
`markerHeight`, `refX`/`refY`, `markerUnits`, `orient`, and an optional `viewBox`), `filter`
elements (referenced via the `filter` presentation attribute on any directly renderable shape or
`text` element, or on a `g`/`symbol` reference/`use` element - applied to the whole referenced
subtree as a single unit - with `x`/`y`/`width`/`height` filter-region attributes and `feFlood`/
`feGaussianBlur`/`feOffset`/`feComposite`/`feMerge` primitive children), and best-effort,
subtree as a single unit - with `x`/`y`/`width`/`height` filter-region attributes and `feBlend`/
`feColorMatrix`/`feComponentTransfer`/`feComposite`/`feConvolveMatrix`/`feDiffuseLighting`/
`feDisplacementMap`/`feDropShadow`/`feFlood`/`feGaussianBlur`/`feImage`/`feMerge`/`feMorphology`/
`feOffset`/`feSpecularLighting`/`feTile`/`feTurbulence` primitive children), `clipPath` elements
(referenced via the `clip-path` presentation attribute, hard-clipping to the union of the
`clipPath` element's own rect/circle/ellipse/polyline/polygon/path/text children, honoring
`clipPathUnits` and each child's own `clip-rule`), `mask` elements (referenced via the `mask`
presentation attribute, attenuating alpha by the referenced content's own computed luminance,
honoring `maskUnits`/`x`/`y`/`width`/`height` and `maskContentUnits` as independent attributes) -
`clip-path`/`mask` apply to the same per-shape/per-group targets `filter` does, and, when
combined with `filter` on the same element, are applied before that element's own filter chain
runs - `pattern` elements (referenced from a shape/text element's own `fill`/`stroke` as a tiled
paint server, honoring `patternUnits`/`patternContentUnits`, `patternTransform`, an optional
`viewBox`/`preserveAspectRatio`, and `href`/`xlink:href` tile-content inheritance) - `image`
elements (a base64-encoded `data:` URI in a supported raster format, decoded through that
format's own existing codec and drawn into the element's own `x`/`y`/`width`/`height` placement
rect) - and best-effort,
weight/style-aware `text` rendering against a caller-supplied dictionary of per-family font faces:
either a single `TrueTypeFont` per family (the legacy shape), or a list of `SvgFontFace` values -
each pairing a `TrueTypeFont` with the `font-weight`/`font-style` it represents - letting a caller
register distinct bold/italic variants of a family and have `SvgCodec` pick the closest-matching
face for each `text` element's own cascaded `font-weight`/`font-style`. The root
`viewBox`/`width`/`height` are fit into the requested raster using a "meet, centered" policy
equivalent to CSS `object-fit: contain` (`preserveAspectRatio` itself is not read). Well-formed but
out-of-scope constructs (`style`, `mask`, `clipPath`, `animate`/SMIL, `image`,
`foreignObject`, `pattern`, nested `svg`, CSS selectors, and every filter primitive other than
the five listed above) are silently skipped/passed through so the rest of the document still
`viewBox`/`width`/`height` are fit into the requested raster via the root `svg` element's own
`preserveAspectRatio` attribute (`[defer] <align> [<meetOrSlice>]` - all 10 aligns and both
`meet`/`slice`), defaulting to "xMidYMid meet" (equivalent to CSS `object-fit: contain`) when the
attribute is absent - the same pre-existing centered-letterbox default every document without an
explicit `preserveAspectRatio` attribute already rendered with. This same fit algorithm also
applies to a `use` element referencing a `symbol` element with its own `viewBox`, and to a
`marker` element's own explicit `preserveAspectRatio` attribute. Every shape/text geometry
attribute (`x`/`y`/`width`/`height`/`rx`/`ry`/`cx`/`cy`/`r`/`x1`/`y1`/`x2`/`y2`/`font-size`/
`stroke-width`/`stroke-dasharray`/`stroke-dashoffset`/`use`'s `x`/`y`/`width`/`height`/`text`'s
`x`/`y`) also accepts a trailing `%`, resolved against the current viewport (or, for `font-size`,
the parent element's own `font-size`) - `stroke-miterlimit` is the sole exception, since it is a
unitless ratio rather than a length. A `style` element's text content is parsed as CSS, matching
type/class/id/universal/compound selectors (including comma-separated lists and
descendant/child combinators) against elements, with standard CSS specificity/cascade-order
resolution and a 3-tier precedence (presentation attribute, then any matching stylesheet rule,
then an inline `style="..."` attribute, which always wins). Well-formed but
out-of-scope constructs (`animate`/SMIL,
`foreignObject`, nested `svg`, and any remaining unrecognized filter primitive type)
are silently skipped/passed through so the rest of the document still
renders; malformed/unparseable input throws `InvalidDataException`.

#### SvgCodec Methods
Expand Down
Loading
Loading