Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::svg Namespace Reference

Donner SVG library, which can load, manipulate and render SVG files. More...

Namespaces

namespace  parser
 Parsers for the SVG XML format, SVGParser, as well as individual parsers for SVG components, such as PathParser and TransformParser.
namespace  components
 Contains the implementation of the Donner ECS,.

Classes

struct  FilterEffect
 Filter effect container, which can contain a reference to another filter effect, or a CSS filter function (such as blur(), grayscale(), etc). More...
class  CssTransform
 Compared to an SVG transform, CSS transforms have additional features, such as the ability to add units to the translate() function, such as translate(1em 30px). More...
struct  Event
 A DOM event object, carrying information about a user interaction. More...
struct  ListenerHandle
 Handle for removing an event listener. Returned by addEventListener. More...
struct  GradientStop
 Values for a gradient stop, https://www.w3.org/TR/SVG2/pservers.html#StopElement. More...
struct  MarkerOrient
 Represents the orientation of a marker. More...
class  PreserveAspectRatio
 Handles SVG's preserveAspectRatio attribute. More...
class  StrokeDasharray
 The parsed result of the 'stroke-dasharray' property, see: https://www.w3.org/TR/SVG2/painting.html#StrokeDasharrayProperty. More...
struct  TransformOrigin
 Represents the transform-origin property value. More...
class  DonnerController
 Provides hit-testing and spatial queries for an SVG document. More...
struct  RecursionGuard
 Helper to guard against recursion when evaluating references. More...
struct  ResolvedReference
 Represents a resolved reference to an SVG entity. More...
struct  Reference
 Represents a reference to an SVG entity by its href, typically created from a url(#id) string. More...
struct  PaintServer
 Represents a paint server, which can be a solid color, a reference to another element, or a special value like "none" or "context-fill". More...
struct  Property
 Holds a CSS property, which has a name and value, and integrates with inheritance to allow cascading values using the CSS model with specificity. More...
class  PropertyRegistry
 Holds CSS properties for a single element. More...
struct  RenderingInstanceView
 A view containing a list of components::RenderingInstanceComponent which can be iterated over. More...
class  Renderer
 Backend-agnostic renderer that resolves to the active build backend (Skia or tiny-skia). More...
class  RendererDriver
 Backend-agnostic renderer driver that prepares documents for rendering and emits drawing commands through a RendererInterface implementation. More...
struct  FrameTimings
 Per-frame performance instrumentation for RendererGeode. More...
class  RendererGeode
 Geode rendering backend — GPU-native via WebGPU + the Slug algorithm. More...
class  RendererImageIO
 Utility class for saving images to disk. More...
struct  RenderViewport
 Describes the viewport for a render pass. More...
struct  RendererBitmap
 CPU-readable bitmap produced by a renderer snapshot. More...
struct  PathShape
 Represents a resolved path along with its fill rule, transform, and layer index for boolean ops. More...
struct  PaintParams
 Paint state derived from resolved style for the current node. More...
struct  ResolvedClip
 Clip stack entry combining rectangles, paths, and optional masks. More...
struct  ImageParams
 Parameters describing how an image should be drawn. More...
struct  TextParams
 Parameters describing how text is drawn and outlined. More...
class  RendererInterface
 Backend-agnostic rendering interface consumed by RendererDriver during document traversal. More...
class  RendererTinySkia
 Rendering backend using tiny-skia-cpp. More...
class  RendererUtils
 Utility functions for the renderer. More...
struct  ResolvedGradientData
 Fully resolved gradient payload that can cross non-SVG package boundaries. More...
struct  StrokeParams
 Stroke configuration used for path and primitive drawing. More...
struct  TerminalCapabilities
 Terminal detection results derived from environment probing. More...
struct  TerminalSize
 Terminal size in columns and rows. More...
struct  TerminalCellSize
 Terminal cell size in pixels. More...
struct  TerminalImageViewerConfig
 Rendering configuration for terminal output. More...
struct  TerminalImageView
 Image view describing an RGBA buffer. More...
struct  QuarterBlock
 Per-cell subpixel sampling for quarter-pixel mode. More...
struct  HalfBlock
 Per-cell subpixel sampling for half-pixel mode. More...
struct  TerminalCell
 Aggregated subpixel data for a terminal cell. More...
struct  TerminalImage
 Sampled representation of an image prepared for terminal rendering. More...
class  TerminalImageViewer
 Terminal image sampler for quarter- and half-pixel block glyphs. More...
class  FontLoader
 Helper to load a font from a URI, using a ResourceLoaderInterface to fetch the raw data and then parsing it as a WOFF file. More...
class  FontHandle
 Opaque handle to a loaded font, used to reference fonts in the FontManager. More...
class  FontManager
 Manages font loading, caching, and lookup for text rendering. More...
struct  SvgImageContent
 Contains raw SVG document bytes, returned by ImageLoader when the referenced resource is an SVG image (image/svg+xml). More...
class  ImageLoader
 Utility class for loading images from a URI. More...
struct  ImageResource
 Contains a decoded image resource in RGBA format. More...
class  NullResourceLoader
 A resource loader that does not load any resources and always returns an error. More...
class  ResourceLoaderInterface
 Interface for loading external resources, such as images. More...
class  SandboxedFileResourceLoader
 A resource loader that loads files from a sandboxed directory. More...
class  UrlLoader
 Utility class for loading a URI or decoding a data URL. More...
class  SVGCircleElement
 DOM object for a "<circle>" element. More...
class  SVGClipPathElement
 DOM object for a "<clipPath>" element. More...
class  SVGDefsElement
 DOM object for a "<defs>" element. More...
class  SVGDocument
 Represents a parsed SVG document containing a tree of SVGElement nodes. More...
class  SVGElement
 Represents a single SVG element (e.g., <rect>, <circle>, <g>, <text>, etc.) within an SVGDocument. More...
class  SVGEllipseElement
 DOM object for a "<ellipse>" element. More...
class  SVGFEBlendElement
 DOM object for a "<feBlend>" element. More...
class  SVGFEColorMatrixElement
 DOM object for a "<feColorMatrix>" element. More...
class  SVGFEComponentTransferElement
 DOM object for a "<feComponentTransfer>" element. More...
class  SVGFECompositeElement
 DOM object for a "<feComposite>" element. More...
class  SVGFEConvolveMatrixElement
 DOM object for a "<feConvolveMatrix>" element. More...
class  SVGFEDiffuseLightingElement
 DOM object for a "<feDiffuseLighting>" element. More...
class  SVGFEDisplacementMapElement
 DOM object for a "<feDisplacementMap>" element. More...
class  SVGFEDistantLightElement
 DOM object for a "<feDistantLight>" element. More...
class  SVGFEDropShadowElement
 DOM object for a "<feDropShadow>" element. More...
class  SVGFEFloodElement
 DOM object for a "<feFlood>" element. More...
class  SVGFEFuncAElement
 DOM object for a "<feFuncA>" element. More...
class  SVGFEFuncBElement
 DOM object for a "<feFuncB>" element. More...
class  SVGFEFuncGElement
 DOM object for a "<feFuncG>" element. More...
class  SVGFEFuncRElement
 DOM object for a "<feFuncR>" element. More...
class  SVGFEGaussianBlurElement
 DOM object for a "<feGaussianBlur>" element. More...
class  SVGFEImageElement
 DOM object for a "<feImage>" element. More...
class  SVGFEMergeElement
 DOM object for a "<feMerge>" element. More...
class  SVGFEMergeNodeElement
 DOM object for a "<feMergeNode>" element. More...
class  SVGFEMorphologyElement
 DOM object for a "<feMorphology>" element. More...
class  SVGFEOffsetElement
 DOM object for a "<feOffset>" element. More...
class  SVGFEPointLightElement
 DOM object for a "<fePointLight>" element. More...
class  SVGFESpecularLightingElement
 DOM object for a "<feSpecularLighting>" element. More...
class  SVGFESpotLightElement
 DOM object for a "<feSpotLight>" element. More...
class  SVGFETileElement
 DOM object for a "<feTile>" element. More...
class  SVGFETurbulenceElement
 DOM object for a "<feTurbulence>" element. More...
class  SVGFilterElement
 DOM object for a "<filter>" element. More...
class  SVGFilterPrimitiveStandardAttributes
 Handles standard attributes for filter primitives, which are children of the "<filter>" element. More...
class  SVGGElement
 DOM object for a "<g>" element. More...
class  SVGGeometryElement
 Base class for all Elements: Basic Shapes. More...
class  SVGGradientElement
 Base class for SVG gradient elements, such as SVGLinearGradientElement and SVGRadialGradientElement. More...
class  SVGGraphicsElement
 Base class for elements which render or impact the rendering tree, such as "<path>" and "<g>". More...
class  SVGImageElement
 DOM object for a "&lt;image&gt;" element. More...
class  SVGLinearGradientElement
 DOM object for a "<linearGradient>" element. More...
class  SVGLineElement
 DOM object for a "<line>" element. More...
class  SVGMarkerElement
 DOM object for a "<marker>" element, which is used to define graphical objects that can be used repeatedly along a path, such as arrowheads or other markers on paths. More...
class  SVGMaskElement
 Represents the "<mask>" element in SVG, which is used to define a mask for graphical elements. More...
class  SVGPathElement
 DOM object for a "<path>" element. More...
class  SVGPatternElement
 DOM object for a "<pattern>" element. More...
class  SVGPolygonElement
 DOM object for a "<polygon>" element. More...
class  SVGPolylineElement
 DOM object for a "<polyline>" element. More...
class  SVGRadialGradientElement
 DOM object for a "<radialGradient>" element. More...
class  SVGRectElement
 DOM object for the "<rect>" element. More...
class  SVGStopElement
 DOM object for a "<stop>" element. More...
class  SVGStyleElement
 DOM object for a "<style>" element, which contains a CSS stylesheet. More...
class  SVGSVGElement
 DOM object for a "<svg>" element. More...
class  SVGSymbolElement
 DOM object for a "&lt;symbol&gt;" element, which defines a graphical template that can be instantiated using a "&lt;use&gt;" element. More...
class  SVGTextContentElement
 Base class for elements that support rendering child text content. More...
class  SVGTextElement
 DOM object for a "<text>" element. More...
class  SVGTextPathElement
 DOM object for a "<textPath>" element. More...
class  SVGTextPositioningElement
 Base class for elements that support per-glyph positioning attributes (x, y, dx, dy, rotate) on top of the basic text content interface. More...
class  SVGTSpanElement
 DOM object for a "<tspan>" element. More...
class  SVGUnknownElement
 DOM object for an unknown SVG element. More...
class  SVGUseElement
 DOM object for a "&lt;use&gt;" element. More...
struct  FontVMetrics
 Font vertical metrics in font design units (unscaled). More...
struct  UnderlineMetrics
 Line decoration positioning metrics in font design units. More...
struct  SubSuperMetrics
 Sub/superscript Y offsets from the OS/2 table, in font design units. More...
class  TextBackend
 Abstract font backend for text rendering operations. More...
class  TextBackendFull
 HarfBuzz + FreeType font backend. More...
class  TextBackendSimple
 stb_truetype-based font backend. More...
class  TextEngine
 Shared SVG text engine. More...
struct  TextLayoutParams
 Layout-only parameters consumed by TextEngine. More...
struct  TextGlyph
 A single positioned glyph in a laid-out text run. More...
struct  TextRun
 A run of positioned glyphs sharing the same font. More...
struct  SampledImageInfo
 Sampled image dimensions and scaling for coordinate mapping. More...

Typedefs

using AllSVGElements
 A type list of all SVG element types, used by donner::svg::parser::AttributeParser and donner::svg::parser::SVGParser.
using EventCallback = std::function<void(Event&)>
 Callback type for event listeners.
template<typename T>
using GetInitialFn = std::optional<T> (*)()
 Callback function to get the initial value of a property.
using SVGDocumentHandle = std::shared_ptr<Registry>
 Shared internal document state used by SVGDocument's by-value facade.

Enumerations

enum class  FilterUnits : std::uint8_t {
  UserSpaceOnUse ,
  ObjectBoundingBox ,
  Default = ObjectBoundingBox
}
 Values for the "filterUnits" attribute which defines the coordinate system for attributes x, y, width, height. More...
enum class  PrimitiveUnits : std::uint8_t {
  UserSpaceOnUse ,
  ObjectBoundingBox ,
  Default = UserSpaceOnUse
}
 Values for the "primitiveUnits" attribute which specifies the coordinate system for the various length values within the filter primitives and for the attributes that define the filter primitive subregion. More...
enum class  ClipPathUnits : uint8_t {
  UserSpaceOnUse ,
  ObjectBoundingBox ,
  Default = UserSpaceOnUse
}
 Values for the "clipPathUnits" attribute, https://drafts.fxtf.org/css-masking-1/#element-attrdef-clippath-clippathunits. More...
enum class  ClipRule : uint8_t {
  NonZero ,
  EvenOdd
}
 The parsed result of the clip-rule property, see: https://drafts.fxtf.org/css-masking-1/#propdef-clip-rule. More...
enum class  ColorInterpolationFilters : std::uint8_t {
  SRGB ,
  LinearRGB ,
  Default = LinearRGB
}
 Values for the "color-interpolation-filters" property which specifies the color space for filter operations. More...
enum class  CursorType : uint8_t {
  Auto ,
  Default ,
  None ,
  Pointer ,
  Crosshair ,
  Move ,
  Text ,
  Wait ,
  Help ,
  NotAllowed ,
  Grab ,
  Grabbing ,
  NResize ,
  EResize ,
  SResize ,
  WResize ,
  NEResize ,
  NWResize ,
  SEResize ,
  SWResize ,
  ColResize ,
  RowResize ,
  ZoomIn ,
  ZoomOut
}
 CSS cursor types, defining which cursor the user agent should display. More...
enum class  Display : uint8_t {
  Inline ,
  Block ,
  ListItem ,
  InlineBlock ,
  Table ,
  InlineTable ,
  TableRowGroup ,
  TableHeaderGroup ,
  TableFooterGroup ,
  TableRow ,
  TableColumnGroup ,
  TableColumn ,
  TableCell ,
  TableCaption ,
  None
}
 The parsed result of the CSS 'display' property, see https://www.w3.org/TR/CSS2/visuren.html#propdef-display. More...
enum class  DominantBaseline : uint8_t {
  Auto ,
  TextBottom ,
  Alphabetic ,
  Ideographic ,
  Middle ,
  Central ,
  Mathematical ,
  Hanging ,
  TextTop
}
 The parsed result of the dominant-baseline property. More...
enum class  EventType : uint8_t {
  Click ,
  DblClick ,
  MouseDown ,
  MouseUp ,
  MouseMove ,
  MouseEnter ,
  MouseLeave ,
  MouseOver ,
  MouseOut ,
  Wheel
}
 Types of DOM events that can be dispatched through the SVG event system. More...
enum class  FontStretch : uint8_t {
  UltraCondensed = 1 ,
  ExtraCondensed = 2 ,
  Condensed = 3 ,
  SemiCondensed = 4 ,
  Normal = 5 ,
  SemiExpanded = 6 ,
  Expanded = 7 ,
  ExtraExpanded = 8 ,
  UltraExpanded = 9
}
 The parsed result of the font-stretch property. More...
enum class  FontStyle : uint8_t {
  Normal ,
  Italic ,
  Oblique
}
 The parsed result of the font-style property. More...
enum class  FontVariant : uint8_t {
  Normal ,
  SmallCaps
}
 The parsed result of the font-variant shorthand property (SVG 1.1 subset). More...
enum class  GradientUnits : uint8_t {
  UserSpaceOnUse ,
  ObjectBoundingBox ,
  Default = ObjectBoundingBox
}
 Values for the "gradientUnits" attribute, https://www.w3.org/TR/SVG2/pservers.html#LinearGradientElementGradientUnitsAttribute and https://www.w3.org/TR/SVG2/pservers.html#RadialGradientElementGradientUnitsAttribute. More...
enum class  GradientSpreadMethod : uint8_t {
  Pad ,
  Reflect ,
  Repeat ,
  Default = Pad
}
 Values for the gradient "spreadMethod" attribute, https://www.w3.org/TR/SVG2/pservers.html#LinearGradientElementSpreadMethodAttribute and https://www.w3.org/TR/SVG2/pservers.html#RadialGradientElementSpreadMethodAttribute. More...
enum class  ImageRendering : uint8_t {
  Auto ,
  OptimizeSpeed ,
  OptimizeQuality ,
  CrispEdges ,
  Pixelated ,
  Smooth
}
 CSS image-rendering property values. More...
enum class  Isolation : uint8_t {
  Auto ,
  Isolate
}
 CSS isolation property values. More...
enum class  LengthAdjust : uint8_t {
  Spacing ,
  SpacingAndGlyphs ,
  Default = Spacing
}
 Values for the "lengthAdjust" attribute, https://www.w3.org/TR/SVG2/text.html#TextElementLengthAdjustAttribute. More...
enum class  MarkerUnits : uint8_t {
  StrokeWidth ,
  UserSpaceOnUse ,
  Default = StrokeWidth
}
 Values for the "markerUnits" attribute, https://www.w3.org/TR/SVG2/painting.html#MarkerUnitsAttribute. More...
enum class  MaskUnits : uint8_t {
  UserSpaceOnUse ,
  ObjectBoundingBox ,
  Default = ObjectBoundingBox
}
 Values for the "maskUnits" attribute, https://drafts.fxtf.org/css-masking-1/#element-attrdef-mask-maskunits. More...
enum class  MaskContentUnits : uint8_t {
  UserSpaceOnUse ,
  ObjectBoundingBox ,
  Default = UserSpaceOnUse
}
 Values for the "maskContentUnits" attribute, https://drafts.fxtf.org/css-masking-1/#element-attrdef-mask-maskcontentunits. More...
enum class  MixBlendMode : uint8_t {
  Normal ,
  Multiply ,
  Screen ,
  Overlay ,
  Darken ,
  Lighten ,
  ColorDodge ,
  ColorBurn ,
  HardLight ,
  SoftLight ,
  Difference ,
  Exclusion ,
  Hue ,
  Saturation ,
  Color ,
  Luminosity
}
 CSS mix-blend-mode property values for compositing blend modes. More...
enum class  Overflow : uint8_t {
  Visible ,
  Hidden ,
  Scroll ,
  Auto
}
 The parsed result of the CSS 'overflow' property, see https://www.w3.org/TR/CSS2/visufx.html#overflow and https://www.w3.org/TR/SVG2/render.html#OverflowAndClipProperties. More...
enum class  PatternUnits : uint8_t {
  UserSpaceOnUse ,
  ObjectBoundingBox ,
  Default = ObjectBoundingBox
}
 PatternUnits controls the coordinate system of the x/y/width/height attributes: More...
enum class  PatternContentUnits : uint8_t {
  UserSpaceOnUse ,
  ObjectBoundingBox ,
  Default = UserSpaceOnUse
}
 PatternContentUnits controls the coordinate system of the children of the pattern: More...
enum class  PointerEvents : uint8_t {
  None ,
  BoundingBox ,
  VisiblePainted ,
  VisibleFill ,
  VisibleStroke ,
  Visible ,
  Painted ,
  Fill ,
  Stroke ,
  All
}
 Values for the 'pointer-events' property, which defines how mouse events interact with an element. More...
enum class  ProcessingMode : uint8_t {
  DynamicInteractive ,
  SecureAnimated ,
  SecureStatic
}
 SVG document processing mode, per SVG2 §2.7.1. More...
enum class  StrokeLinecap : uint8_t {
  Butt ,
  Round ,
  Square
}
 The parsed result of the 'stroke-linecap' property, see: https://www.w3.org/TR/SVG2/painting.html#StrokeLinecapProperty. More...
enum class  StrokeLinejoin : uint8_t {
  Miter ,
  MiterClip ,
  Round ,
  Bevel ,
  Arcs
}
 The parsed result of the 'stroke-linejoin' property, see: https://www.w3.org/TR/SVG2/painting.html#StrokeLinejoinProperty. More...
enum class  TextAnchor : uint8_t {
  Start ,
  Middle ,
  End
}
 The parsed result of the text-anchor property. More...
enum class  TextDecoration : uint8_t {
  None = 0 ,
  Underline = 1 << 0 ,
  Overline = 1 << 1 ,
  LineThrough = 1 << 2
}
 Bitmask for the text-decoration property line types. More...
enum class  Visibility : uint8_t {
  Visible ,
  Hidden ,
  Collapse
}
 The parsed result of the 'visibility' property, see: https://www.w3.org/TR/CSS2/visufx.html#propdef-visibility. More...
enum class  WritingMode : uint8_t {
  HorizontalTb ,
  VerticalRl ,
  VerticalLr
}
 CSS writing-mode property values, controlling the direction of text flow. More...
enum class  ElementType : uint8_t {
  Circle ,
  ClipPath ,
  Defs ,
  Ellipse ,
  FeBlend ,
  FeColorMatrix ,
  FeComponentTransfer ,
  FeComposite ,
  FeConvolveMatrix ,
  FeDiffuseLighting ,
  FeDisplacementMap ,
  FeDistantLight ,
  FeDropShadow ,
  FeFlood ,
  FeFuncA ,
  FeFuncB ,
  FeFuncG ,
  FeFuncR ,
  FeGaussianBlur ,
  FeImage ,
  FeMerge ,
  FeMergeNode ,
  FeMorphology ,
  FeOffset ,
  FePointLight ,
  FeSpecularLighting ,
  FeSpotLight ,
  FeTile ,
  FeTurbulence ,
  Filter ,
  G ,
  Image ,
  Line ,
  LinearGradient ,
  Marker ,
  Mask ,
  Path ,
  Pattern ,
  Polygon ,
  Polyline ,
  RadialGradient ,
  Rect ,
  Stop ,
  Style ,
  SVG ,
  Symbol ,
  Text ,
  TextPath ,
  TSpan ,
  Unknown ,
  Use
}
 SVG element types, corresponds to each XML element name, such as "<circle>", "<svg>", "<rect>", etc. More...
enum class  PropertyCascade {
  None ,
  Inherit ,
  PaintInherit
}
 Defines how this property cascades between the parent and child elements. More...
enum class  PropertyState {
  NotSet = 0 ,
  Set = 1 ,
  Inherit = 2 ,
  ExplicitInitial = 3 ,
  ExplicitUnset = 4
}
 The current property state, which can be either set, not set, or a specific CSS keyword such as "inherit", "initial", or "unset". More...
enum class  PropertyInheritOptions {
  All ,
  NoPaint
}
 Options to control how inheritance is performed, to either inherit everything or conditionally disable inheritance of paint servers. More...
enum class  AlphaType : uint8_t {
  Premultiplied ,
  Unpremultiplied
}
 Alpha channel interpretation for pixel data. More...
enum class  TerminalPixelMode {
  kQuarterPixel ,
  kHalfPixel
}
 Pixel granularity for terminal rendering.
enum class  ResourceLoaderError : uint8_t {
  NotFound ,
  SandboxViolation
}
 Error codes for resource loading. More...
enum class  UrlLoaderError : uint8_t {
  NotFound ,
  UnsupportedFormat ,
  InvalidDataUrl ,
  DataCorrupt
}
 Enum of possible errors that can occur when loading an image. More...
enum class  FillRule
 The parsed result of the 'fill-rule' property, see: https://www.w3.org/TR/SVG2/painting.html#FillRuleProperty.

Functions

std::ostream & operator<< (std::ostream &os, const std::vector< FilterEffect > &filters)
 Ostream output operator for a vector of filter effects.
std::ostream & operator<< (std::ostream &os, ClipPathUnits units)
 Ostream output operator for ClipPathUnits enum, outputs the enum name with prefix, e.g. ClipPathUnits::UserSpaceOnUse.
std::ostream & operator<< (std::ostream &os, const ClipRule &clipRule)
 Output stream operator for ClipRule enum.
std::ostream & operator<< (std::ostream &os, ColorInterpolationFilters cif)
 Ostream output operator for ColorInterpolationFilters.
std::ostream & operator<< (std::ostream &os, CursorType value)
 Output stream operator for CursorType, outputs the CSS string representation.
std::ostream & operator<< (std::ostream &os, Display value)
 Ostream output operator for Display enum, outputs the CSS value.
std::ostream & operator<< (std::ostream &os, DominantBaseline value)
 Ostream output operator for DominantBaseline enum, outputs the CSS value.
std::ostream & operator<< (std::ostream &os, EventType type)
 Output stream operator for EventType.
bool eventBubbles (EventType type)
 Returns true if the event type bubbles up the DOM tree.
std::ostream & operator<< (std::ostream &os, FontStretch value)
 Ostream output operator for FontStretch enum, outputs the CSS value.
std::ostream & operator<< (std::ostream &os, FontStyle value)
 Ostream output operator for FontStyle enum, outputs the CSS value.
std::ostream & operator<< (std::ostream &os, FontVariant value)
 Ostream output operator for FontVariant enum, outputs the CSS value.
std::ostream & operator<< (std::ostream &os, ImageRendering value)
 ostream output operator for ImageRendering.
std::ostream & operator<< (std::ostream &os, Isolation value)
 ostream output operator for Isolation.
std::ostream & operator<< (std::ostream &os, LengthAdjust units)
 Ostream output operator for LengthAdjust enum, outputs the enum name with prefix, e.g. LengthAdjust::Spacing.
std::ostream & operator<< (std::ostream &os, MarkerUnits units)
 Ostream output operator for MarkerUnits enum, outputs the enum name with prefix, e.g. MarkerUnits::UserSpaceOnUse.
std::ostream & operator<< (std::ostream &os, MaskUnits units)
 Ostream output operator for MaskUnits enum, outputs the enum name with prefix, e.g. MaskUnits::UserSpaceOnUse.
std::ostream & operator<< (std::ostream &os, MaskContentUnits units)
 Ostream output operator for MaskContentUnits enum, outputs the enum name with prefix, e.g. MaskContentUnits::UserSpaceOnUse.
std::ostream & operator<< (std::ostream &os, MixBlendMode value)
 ostream output operator for MixBlendMode.
std::ostream & operator<< (std::ostream &os, Overflow value)
 Ostream output operator for Overflow enum, outputs the CSS value.
std::ostream & operator<< (std::ostream &os, PointerEvents value)
 Output stream operator for PointerEvents, outputs the CSS string representation for this enum, e.g. "none", "bounding-box", etc.
std::ostream & operator<< (std::ostream &os, PreserveAspectRatio::Align value)
 Outputs Align value to stream (e.g., "Align::XMidYMid").
std::ostream & operator<< (std::ostream &os, PreserveAspectRatio::MeetOrSlice value)
 Outputs MeetOrSlice value to stream (e.g., "MeetOrSlice::Meet").
std::ostream & operator<< (std::ostream &os, StrokeLinecap value)
 Ostream output operator for StrokeLinecap enum, outputs the CSS value.
std::ostream & operator<< (std::ostream &os, StrokeLinejoin value)
 Ostream output operator for StrokeLinejoin enum, outputs the CSS value.
std::ostream & operator<< (std::ostream &os, TextAnchor value)
 Ostream output operator for TextAnchor enum, outputs the CSS value.
constexpr TextDecoration operator| (TextDecoration a, TextDecoration b)
 Bitwise OR for combining TextDecoration values.
constexpr TextDecoration operator& (TextDecoration a, TextDecoration b)
 Bitwise AND for testing TextDecoration flags.
constexpr TextDecorationoperator|= (TextDecoration &a, TextDecoration b)
 Bitwise OR assignment.
constexpr bool hasFlag (TextDecoration value, TextDecoration flags)
 Returns true if any of the flags in flags are set in value.
std::ostream & operator<< (std::ostream &os, TextDecoration value)
 Ostream output operator for TextDecoration bitmask, outputs CSS values.
std::ostream & operator<< (std::ostream &os, const TransformOrigin &origin)
 Ostream output operator.
std::ostream & operator<< (std::ostream &os, Visibility value)
 Ostream output operator for Visibility enum, outputs the CSS value.
bool isVertical (WritingMode mode)
 Returns true if the writing mode is vertical (VerticalRl or VerticalLr).
std::ostream & operator<< (std::ostream &os, WritingMode value)
 ostream output operator for WritingMode, outputs the CSS3 value name.
std::ostream & operator<< (std::ostream &os, ElementType type)
 Ostream output operator for ElementType, outputs the element name.
template<typename ReturnType, typename FnT>
ReturnType ToConstexpr (ElementType type, FnT fn)
 Converts a ElementType runtime value to a compile-time value, allowing conditional behavior for different element types with constexpr.
template<typename T, PropertyCascade kCascade>
std::ostream & operator<< (std::ostream &os, const Property< T, kCascade > &property)
 Ostream output operator, which outputs the current property value, how it was set (e.g.
std::tuple< Lengthd, double > CalculateRadiusMaybeAuto (const Property< Lengthd > &property, const Property< Lengthd > &fallbackProperty, const Box2d &viewBox, const FontMetrics &fontMetrics)
 Calculates the the radius for elements with rx and ry radius, in pixels, taking into account the "auto" identifier and handling negative values.
void ApplyFilterGraphToPixmap (tiny_skia::Pixmap &pixmap, const components::FilterGraph &filterGraph, const Transform2d &deviceFromFilter, const std::optional< Box2d > &filterRegion, bool clipSourceToFilterRegion=false, const tiny_skia::Pixmap *fillPaintInput=nullptr, const tiny_skia::Pixmap *strokePaintInput=nullptr)
 Applies a Donner filter graph to a premultiplied RGBA pixmap in place.
void ClipFilterOutputToRegion (tiny_skia::Pixmap &pixmap, const std::optional< Box2d > &filterRegion, const Transform2d &deviceFromFilter)
 Clears pixels outside the transformed filter region.
std::vector< std::uint8_t > PremultiplyRgba (std::span< const std::uint8_t > rgbaPixels)
 Convert tightly-packed straight-alpha RGBA8 to premultiplied RGBA8.
void UnpremultiplyRgbaInPlace (std::vector< std::uint8_t > &rgba)
 Convert tightly-packed premultiplied RGBA8 to straight-alpha RGBA8, in place. Fully-opaque pixels (alpha == 255) are unchanged; fully-transparent pixels (alpha == 0) become (0, 0, 0, 0).
std::vector< std::uint8_t > UnpremultiplyRgba (std::span< const std::uint8_t > rgbaPixels)
 Non-mutating variant of UnpremultiplyRgbaInPlace that allocates. Prefer the in-place form on hot paths; use this when the caller needs to preserve the input.
std::optional< ResolvedGradientDataFlattenResolvedGradient (const components::ResolvedPaintServer &paint)
 Flatten a resolved paint server if it points at a materialized linear or radial gradient.
components::ResolvedPaintServer MaterializeResolvedGradient (Registry &registry, const ResolvedGradientData &gradient)
 Materialize a resolved gradient payload into a fresh ECS paint server entity.
std::optional< FontMetadataParseFontMetadata (std::span< const uint8_t > data)
 Parse CSS-relevant metadata from a raw OpenType/TrueType font file.
std::string_view ToString (UrlLoaderError err)
 Converts a UrlLoaderError to a human-readable string.
std::ostream & operator<< (std::ostream &os, UrlLoaderError err)
 Ostream operator for UrlLoaderError.
uint32_t ReadBe32 (const uint8_t *p)
 Read a 32-bit big-endian unsigned integer from p.
uint16_t ReadUnitsPerEm (std::span< const uint8_t > data)
 Check if raw font data has a valid 'head' table and read unitsPerEm. Returns 0 if missing.
bool HasOutlineTables (std::span< const uint8_t > data)
 Returns true if the raw font has a scalable outline table.
int RunDonnerSvgTool (int argc, char *argv[], std::ostream &out, std::ostream &err)
 Run the donner-svg command line tool.
std::string BuildCssSelectorPath (const SVGElement &element)
 Build a CSS-like selector path for an element.
void CompositeAABBRect (RendererBitmap &bitmap, const Box2d &bounds, const SampledImageInfo &imageInfo)
 Draw a 1-sub-pixel blue AABB outline directly into the bitmap, aligned to the terminal sub-pixel grid.

Variables

constexpr std::string_view kUserAgentStylesheet
 The user agent stylesheet to be used by default on all SVG documents.
constexpr auto kSVGElementNames = detail::extractTagNames(AllSVGElements{})
 Compile-time array of all known SVG element tag names (e.g. "rect", "circle", "path"). Derived from AllSVGElements and each element class's static Tag constant.
constexpr std::array< std::string_view, 70 > kSVGPresentationAttributeNames
 Compile-time array of all known SVG presentation attributes and geometry attributes. Each entry is an attribute name string (e.g. "fill", "stroke", "transform").

Detailed Description

Donner SVG library, which can load, manipulate and render SVG files.

Loading SVG files can be done using donner::svg::parser::SVGParser

std::string_view svgSource("<svg>...</svg>");
auto maybeResult = SVGParser::ParseSVG(svgSource, warnings);
if (maybeResult.hasError()) {
const auto& e = maybeResult.error();
std::cerr << "Parse Error: " << e << "\n";
exit(1);
}
std::cout << "Parsed successfully.\n";
if (warnings.hasWarnings()) {
std::cout << "Warnings:\n";
for (auto& w : warnings.warnings()) {
std::cout << " " << w << "\n";
}
}
Collects parse warnings during parsing.
Definition ParseWarningSink.h:28
const std::vector< ParseDiagnostic > & warnings() const
Access the collected warnings.
Definition ParseWarningSink.h:66
bool hasWarnings() const
Returns true if any warnings have been added.
Definition ParseWarningSink.h:69

The resulting SVGDocument can be used to traverse the SVG file:

SVGDocument document = std::move(maybeResult.result());
if (auto myPath = document.querySelector("#myPath")) {
std::cout << "Found #myPath" << std::endl;
myPath->setStyle("fill: red");
myPath->setStyle("stroke: white");
}
Represents a parsed SVG document containing a tree of SVGElement nodes.
Definition SVGDocument.h:39
std::optional< SVGElement > querySelector(std::string_view selector)
Find the first element in the tree that matches the given CSS selector.

The SVG file can be rendered using donner::svg::Renderer

Renderer renderer;
renderer.draw(document);
if (renderer.save("output.png")) {
std::cout << "Saved to output.png\n";
} else {
std::cerr << "Failed to save to file\n";
}
Backend-agnostic renderer that resolves to the active build backend (Skia or tiny-skia).
Definition Renderer.h:27
bool save(const char *filename)
Saves the last rendered frame to a PNG file.
void draw(SVGDocument &document) override
Draws the SVG document using the active backend.

For hit-testing and spatial queries, use donner::svg::DonnerController.


Class Documentation

◆ donner::svg::GradientStop

struct donner::svg::GradientStop

Values for a gradient stop, https://www.w3.org/TR/SVG2/pservers.html#StopElement.

This is used on "<stop>" elements.

Collaboration diagram for donner::svg::GradientStop:
[legend]
Class Members
Color color {css::RGBA(0, 0, 0, 0xFF)} Color of the gradient stop.
float offset = 0.0 Offset of the gradient stop, in the range [0, 1].
float opacity = 1.0f Opacity of the gradient stop, in the range [0, 1].

◆ donner::svg::TransformOrigin

struct donner::svg::TransformOrigin

Represents the transform-origin property value.

Collaboration diagram for donner::svg::TransformOrigin:
[legend]
Class Members
Lengthd x X coordinate.
Lengthd y Y coordinate.

◆ donner::svg::FrameTimings

struct donner::svg::FrameTimings

Per-frame performance instrumentation for RendererGeode.

Returned by RendererGeode::lastFrameTimings(). Each field reports the cost of the most recent beginFrameendFrame window. Counters are the durable CI signal; the GPU-timestamp fields are advisory and require enableTimestamps(true) + driver support (see GeodeDevice).

See docs/design_docs/0030-geode_performance.md for the target ceilings each optimization milestone drives these toward.

Collaboration diagram for donner::svg::FrameTimings:
[legend]
Class Members
GeodeCounters counters Counters for resource creation and command submission in the last frame. Available regardless of timestamp support.
uint64_t renderPassNs = 0 GPU render-pass duration in nanoseconds. Zero if timestamps are disabled or unsupported by the driver. Reserved for future work — currently always zero.
uint64_t totalGpuNs = 0 Total GPU work duration in nanoseconds (end of beginFrame's first submit to completion of endFrame's final submit). Zero if timestamps are disabled or unsupported. Reserved for future work — currently always zero.

◆ donner::svg::RenderViewport

struct donner::svg::RenderViewport

Describes the viewport for a render pass.

Collaboration diagram for donner::svg::RenderViewport:
[legend]
Class Members
double devicePixelRatio = 1.0 Device pixel ratio used to map logical coordinates to device pixels.
Vector2d size = Vector2d::Zero() Logical size in CSS/SVG units after layout.

◆ donner::svg::PathShape

struct donner::svg::PathShape

Represents a resolved path along with its fill rule, transform, and layer index for boolean ops.

Collaboration diagram for donner::svg::PathShape:
[legend]
Class Members
FillRule fillRule = FillRule::NonZero
int layer = 0 Layer index for boolean combination: paths on the same layer are unioned, layers are intersected.
Transform2d parentFromEntity Transform from clip path child to the clip path's coordinate system.
Path path
EntityHandle sourceEntity Source entity this path was derived from. Set by the driver at the drawPath call site (RendererDriver::traverseRange). Backends that cache per-entity state key off this (see GeodePathCacheComponent). A null EntityHandle (the default) means "no associated entity" — non-driver callers (overlay drawing, test harnesses) leave it null and backends fall back to the un-cached path.

◆ donner::svg::PaintParams

struct donner::svg::PaintParams

Paint state derived from resolved style for the current node.

Collaboration diagram for donner::svg::PaintParams:
[legend]
Class Members
Color currentColor = css::Color(css::RGBA()) CurrentColor value for paint server resolution.
ResolvedPaintServer fill = PaintServer::None{}
double fillOpacity = 1.0
double opacity = 1.0 Multiplicative opacity applied to all drawing.
ResolvedPaintServer stroke = PaintServer::None{}
double strokeOpacity = 1.0
StrokeParams strokeParams
Box2d viewBox View box used for unit resolution and gradient coordinate conversion.

◆ donner::svg::ImageParams

struct donner::svg::ImageParams

Parameters describing how an image should be drawn.

Collaboration diagram for donner::svg::ImageParams:
[legend]
Class Members
bool imageRenderingPixelated = false Whether to favor nearest-neighbor sampling for pixelated rendering.
double opacity = 1.0
Box2d targetRect Destination rectangle in device-independent units.

◆ donner::svg::TextParams

struct donner::svg::TextParams

Parameters describing how text is drawn and outlined.

Collaboration diagram for donner::svg::TextParams:
[legend]
Class Members
DominantBaseline dominantBaseline = DominantBaseline::Auto
Color fillColor = css::Color(css::RGBA())
span< const FontFace > fontFaces @font-face declarations for custom font resolution.
SmallVector< RcString, 1 > fontFamilies
FontMetrics fontMetrics
Lengthd fontSize
LengthAdjust lengthAdjust = LengthAdjust::Default
double letterSpacingPx = 0.0 Extra spacing added after each character (CSS letter-spacing). 0 = normal.
double opacity = 1.0
Color strokeColor = css::Color(css::RGBA())
StrokeParams strokeParams
TextAnchor textAnchor = TextAnchor::Start
TextDecoration textDecoration = TextDecoration::None
optional< Lengthd > textLength If set, stretches or compresses text to fill the given length.
entity textRootEntity = entt::null Entity of the text root element, for cached layout lookup. entt::null if unknown.
Box2d viewBox
double wordSpacingPx = 0.0 Extra spacing added after each word/space character (CSS word-spacing). 0 = normal.
WritingMode writingMode = WritingMode::HorizontalTb CSS writing-mode for this text element. Controls horizontal vs vertical text flow.

◆ donner::svg::StrokeParams

struct donner::svg::StrokeParams

Stroke configuration used for path and primitive drawing.

Collaboration diagram for donner::svg::StrokeParams:
[legend]
Class Members
vector< double > dashArray Dash pattern lengths alternating on/off segments.
double dashOffset = 0.0 Dash phase offset.
StrokeLinecap lineCap = StrokeLinecap::Butt
StrokeLinejoin lineJoin = StrokeLinejoin::Miter
double miterLimit = 4.0 Maximum miter ratio before converting to bevel.
double pathLength = 0.0 SVG pathLength attribute value; 0 means unused. When non-zero, dash arrays and offsets are scaled by the ratio of the actual path length to this value.
double strokeWidth = 0.0 Stroke width in user units.

◆ donner::svg::TerminalCapabilities

struct donner::svg::TerminalCapabilities

Terminal detection results derived from environment probing.

Class Members
bool supportsITermInlineImages = false Terminal supports iTerm2 inline image protocol (iTerm2, VSCode, WezTerm, and others).
bool supportsTrueColor = false Terminal advertises 24-bit color support.

◆ donner::svg::TerminalSize

struct donner::svg::TerminalSize

Terminal size in columns and rows.

Class Members
int columns = 80 Terminal width in columns (default fallback).
int rows = 24 Terminal height in rows (default fallback).

◆ donner::svg::TerminalCellSize

struct donner::svg::TerminalCellSize

Terminal cell size in pixels.

Class Members
int heightPixels = 20 Cell height in pixels (default fallback).
int widthPixels = 10 Cell width in pixels (default fallback).

◆ donner::svg::TerminalImageViewerConfig

struct donner::svg::TerminalImageViewerConfig

Rendering configuration for terminal output.

Collaboration diagram for donner::svg::TerminalImageViewerConfig:
[legend]
Class Members
bool autoScale = false Automatically calculate scale based on terminal size. When true, the scale parameter is ignored and calculated dynamically.
bool enableITermInlineImages = false Use iTerm2 inline image protocol (supported by iTerm2, VSCode, WezTerm, and others).
string imageName Optional name for the image. When using iTerm inline images, this will be included in the protocol metadata. For text mode, this can be used as a caption.
int maxTerminalHeight = 80 Maximum terminal height to target when auto-scaling (rows).
int maxTerminalWidth = 200 Maximum terminal width to target when auto-scaling (columns).
TerminalPixelMode pixelMode = TerminalPixelMode::kQuarterPixel Pixel granularity.
double scale = 0.67 Overall scale factor for image size. Only used when autoScale=false.
bool useTrueColor = true Emit 24-bit ANSI sequences when true, fallback to 256-color when false.
double verticalScaleFactor = 0.5 Vertical scaling factor to compensate for terminal character aspect ratio (typically ~2:1 height/width). Default 0.5 accounts for typical terminal fonts.

◆ donner::svg::TerminalImageView

struct donner::svg::TerminalImageView

Image view describing an RGBA buffer.

Collaboration diagram for donner::svg::TerminalImageView:
[legend]
Class Members
span< const uint8_t > data Pixel data in RGBA order.
int height = 0 Height of the image in pixels.
size_t strideInPixels = 0 Number of pixels per row (not bytes).
int width = 0 Width of the image in pixels.

◆ donner::svg::QuarterBlock

struct donner::svg::QuarterBlock

Per-cell subpixel sampling for quarter-pixel mode.

Collaboration diagram for donner::svg::QuarterBlock:
[legend]
Class Members
RGBA bottomLeft
RGBA bottomRight
RGBA topLeft
RGBA topRight

◆ donner::svg::HalfBlock

struct donner::svg::HalfBlock

Per-cell subpixel sampling for half-pixel mode.

Collaboration diagram for donner::svg::HalfBlock:
[legend]
Class Members
RGBA lower
RGBA upper

◆ donner::svg::TerminalCell

struct donner::svg::TerminalCell

Aggregated subpixel data for a terminal cell.

Collaboration diagram for donner::svg::TerminalCell:
[legend]
Class Members
HalfBlock half
TerminalPixelMode mode
QuarterBlock quarter

◆ donner::svg::FontMetadata

struct donner::svg::FontMetadata

Metadata extracted from a raw OpenType/TrueType font file.

Collaboration diagram for donner::svg::FontMetadata:
[legend]
Class Members
string familyName CSS font-family name from the name table.
int fontStretch = 5 CSS font-stretch (1-9, 5=normal).
int fontStyle = 0 CSS font-style (0=normal, 1=italic, 2=oblique).
int fontWeight = 400 CSS font-weight (100-900).

◆ donner::svg::SvgImageContent

struct donner::svg::SvgImageContent

Contains raw SVG document bytes, returned by ImageLoader when the referenced resource is an SVG image (image/svg+xml).

This must be parsed into an SVGDocument separately.

Collaboration diagram for donner::svg::SvgImageContent:
[legend]
Class Members
vector< uint8_t > data Raw SVG document bytes (XML text).

◆ donner::svg::ImageResource

struct donner::svg::ImageResource

Contains a decoded image resource in RGBA format.

Collaboration diagram for donner::svg::ImageResource:
[legend]
Class Members
vector< uint8_t > data Pixel data in RGBA format.
int height Height of the image, in pixels.
int width Width of the image, in pixels.

◆ donner::svg::FontVMetrics

struct donner::svg::FontVMetrics

Font vertical metrics in font design units (unscaled).

Class Members
int ascent = 0 Positive, above baseline.
int descent = 0 Negative, below baseline.
int lineGap = 0

◆ donner::svg::UnderlineMetrics

struct donner::svg::UnderlineMetrics

Line decoration positioning metrics in font design units.

Class Members
double position = 0 Signed offset from baseline in font design units (negative = below).
double thickness = 0 Stroke thickness in font design units.

◆ donner::svg::SubSuperMetrics

struct donner::svg::SubSuperMetrics

Sub/superscript Y offsets from the OS/2 table, in font design units.

Class Members
int subscriptYOffset = 0
int superscriptYOffset = 0

◆ donner::svg::TextLayoutParams

struct donner::svg::TextLayoutParams

Layout-only parameters consumed by TextEngine.

Collaboration diagram for donner::svg::TextLayoutParams:
[legend]
Class Members
DominantBaseline dominantBaseline = DominantBaseline::Auto
SmallVector< RcString, 1 > fontFamilies
FontMetrics fontMetrics
Lengthd fontSize
LengthAdjust lengthAdjust = LengthAdjust::Default
double letterSpacingPx = 0.0
TextAnchor textAnchor = TextAnchor::Start
optional< Lengthd > textLength
Box2d viewBox
double wordSpacingPx = 0.0
WritingMode writingMode = WritingMode::HorizontalTb

◆ donner::svg::TextGlyph

struct donner::svg::TextGlyph

A single positioned glyph in a laid-out text run.

Produced by both TextLayout (simple backend) and TextShaper (full backend).

Class Members
uint32_t cluster = 0 Byte offset into the span text for the glyph's source cluster.
float fontSizeScale = 1.0f Per-glyph font size multiplier (< 1.0 for small-caps).
int glyphIndex = 0 Glyph index (backend-specific: stbtt or HarfBuzz).
double rotateDegrees = 0 Per-glyph rotation in degrees.
float stretchScaleX = 1.0f Additional X-axis glyph stretch from lengthAdjust.
float stretchScaleY = 1.0f Additional Y-axis glyph stretch from lengthAdjust.
double xAdvance = 0 Horizontal advance to next glyph.
double xKern = 0 Kerning adjustment applied before this glyph (for path layout).
double xPosition = 0 Absolute X position for this glyph.
double yAdvance = 0 Vertical advance (used in vertical writing modes).
double yPosition = 0 Absolute Y baseline position.

◆ donner::svg::TextRun

struct donner::svg::TextRun

A run of positioned glyphs sharing the same font.

Collaboration diagram for donner::svg::TextRun:
[legend]
Class Members
FontHandle font Font handle for this run.
vector< TextGlyph > glyphs Positioned glyphs.
bool onPath = false True if glyphs are positioned along a textPath.

◆ donner::svg::SampledImageInfo

struct donner::svg::SampledImageInfo

Sampled image dimensions and scaling for coordinate mapping.

Class Members
int columns = 0
int rows = 0
double xScale = 1.0 Inverse scale: maps sub-pixel index to image X pixel via int(subPixel * xScale).
double yScale = 1.0 Inverse scale: maps sub-pixel index to image Y pixel via int(subPixel * yScale).

Typedef Documentation

◆ GetInitialFn

template<typename T>
using donner::svg::GetInitialFn = std::optional<T> (*)()

Callback function to get the initial value of a property.

The function returns a std::optional to allow for properties that have no initial value.

Enumeration Type Documentation

◆ AlphaType

enum class donner::svg::AlphaType : uint8_t
strong

Alpha channel interpretation for pixel data.

Enumerator
Premultiplied 

RGB channels are pre-multiplied by alpha.

Unpremultiplied 

RGB channels are independent of alpha (straight alpha).

◆ ClipPathUnits

enum class donner::svg::ClipPathUnits : uint8_t
strong

Values for the "clipPathUnits" attribute, https://drafts.fxtf.org/css-masking-1/#element-attrdef-clippath-clippathunits.

This is used on the "<clipPath>" element, and defines the coordinate system for the contents of the clip path.

Enumerator
UserSpaceOnUse 

The clip path is defined in user space, which is the coordinate system of the element that references the clip path.

ObjectBoundingBox 

The clip path is defined in object space, where (0, 0) is the top-left corner of the element that references the clip path, and (1, 1) is the bottom-right corner.

Note that this may result in non-uniform scaling if the element is not square.

Default 

The default value for the "clipPathUnits" attribute, which is userSpaceOnUse.

◆ ClipRule

enum class donner::svg::ClipRule : uint8_t
strong

The parsed result of the clip-rule property, see: https://drafts.fxtf.org/css-masking-1/#propdef-clip-rule.

Enumerator
NonZero 

[DEFAULT] Determines "insideness" of a point by counting crossings of a ray drawn from that point to infinity and path segments. If crossings is non-zero, the point is inside, else outside.

EvenOdd 

Determines "insideness" of a point by counting the number of path segments from the shape crossed by a ray drawn from that point to infinity. If count is odd, point is inside, else outside.

◆ ColorInterpolationFilters

enum class donner::svg::ColorInterpolationFilters : std::uint8_t
strong

Values for the "color-interpolation-filters" property which specifies the color space for filter operations.

See also
https://www.w3.org/TR/filter-effects/#element-attrdef-filter-color-interpolation-filters
Enumerator
SRGB 

Operations are performed in the sRGB color space.

LinearRGB 

Operations are performed in the linearRGB color space.

Default 

The default value, which is linearRGB.

◆ CursorType

enum class donner::svg::CursorType : uint8_t
strong

CSS cursor types, defining which cursor the user agent should display.

See also
https://www.w3.org/TR/css-ui-4/#cursor
Enumerator
Auto 

The browser determines the cursor based on context.

Default 

Platform default cursor (usually an arrow).

None 

No cursor is rendered.

Pointer 

Indicates a link (usually a hand).

Crosshair 

Cross cursor, often for selection.

Move 

Indicates something can be moved.

Text 

Indicates text can be selected.

Wait 

Indicates the program is busy.

Help 

Indicates help is available.

NotAllowed 

Indicates the action is not allowed.

Grab 

Indicates something can be grabbed.

Grabbing 

Indicates something is being grabbed.

NResize 

Resize north.

EResize 

Resize east.

SResize 

Resize south.

WResize 

Resize west.

NEResize 

Resize north-east.

NWResize 

Resize north-west.

SEResize 

Resize south-east.

SWResize 

Resize south-west.

ColResize 

Resize column.

RowResize 

Resize row.

ZoomIn 

Zoom in.

ZoomOut 

Zoom out.

◆ Display

enum class donner::svg::Display : uint8_t
strong

The parsed result of the CSS 'display' property, see https://www.w3.org/TR/CSS2/visuren.html#propdef-display.

Note that in SVG2, there are only two distinct behaviors, 'none', and everything else rendered as normal, see https://www.w3.org/TR/SVG2/render.html#VisibilityControl

Elements that have any other display value than none are rendered as normal.

Enumerator
Inline 

[DEFAULT] "inline": Causes an element to generate one or more inline boxes.

Block 

"block": Causes an element to generate a block box.

ListItem 

"list-item": Causes an element to act as a list item.

InlineBlock 

"inline-block": Causes an element to generate an inline-level block container.

Table 

"table": Specifies that an element defines a block-level table, see https://www.w3.org/TR/CSS2/tables.html#table-display.

InlineTable 

"inline-table": Specifies that an element defines a inline-level table, see https://www.w3.org/TR/CSS2/tables.html#table-display.

TableRowGroup 

"table-row-group": Specifies that an element groups one or more rows.

TableHeaderGroup 

"table-header-group": Like 'table-row-group', but for visual formatting, the row group is always displayed before all other rows and row groups and after any top captions.

TableFooterGroup 

"table-footer-group": Like 'table-row-group', but for visual formatting, the row group is always displayed after all other rows and row groups and before any bottom captions.

TableRow 

"table-row": Specifies that an element is a row of cells.

TableColumnGroup 

"table-column-group": Specifies that an element groups one or more columns.

TableColumn 

"table-column": Specifies that an element is a column of cells.

TableCell 

"table-cell": Specifies that an element represents a table cell.

TableCaption 

"table-caption": Specifies a caption for the table.

None 

"none": The element is not rendered.

◆ DominantBaseline

enum class donner::svg::DominantBaseline : uint8_t
strong

The parsed result of the dominant-baseline property.

Determines which baseline of the font is used to align the text.

See also
https://www.w3.org/TR/css-inline-3/#dominant-baseline-property
Enumerator
Auto 

[DEFAULT] Use the default baseline for the script.

TextBottom 

Align to the bottom of the text.

Alphabetic 

Align to the alphabetic baseline.

Ideographic 

Align to the ideographic baseline.

Middle 

Align to the middle of the em box.

Central 

Align to the central baseline.

Mathematical 

Align to the mathematical baseline.

Hanging 

Align to the hanging baseline.

TextTop 

Align to the top of the text.

◆ ElementType

enum class donner::svg::ElementType : uint8_t
strong

SVG element types, corresponds to each XML element name, such as "<circle>", "<svg>", "<rect>", etc.

Enumerator
Circle 

"<circle>"

ClipPath 

"<clipPath>"

Defs 

"<defs>"

Ellipse 

"<ellipse>"

FeBlend 

"<feBlend>"

FeColorMatrix 

"<feColorMatrix>"

FeComponentTransfer 

"<feComponentTransfer>"

FeComposite 

"<feComposite>"

FeConvolveMatrix 

"<feConvolveMatrix>"

FeDiffuseLighting 

"<feDiffuseLighting>"

FeDisplacementMap 

"<feDisplacementMap>"

FeDistantLight 

"<feDistantLight>"

FeDropShadow 

"<feDropShadow>"

FeFlood 

"<feFlood>"

FeFuncA 

"<feFuncA>"

FeFuncB 

"<feFuncB>"

FeFuncG 

"<feFuncG>"

FeFuncR 

"<feFuncR>"

FeGaussianBlur 

"<feGaussianBlur>"

FeImage 

"<feImage>"

FeMerge 

"<feMerge>"

FeMergeNode 

"<feMergeNode>"

FeMorphology 

"<feMorphology>"

FeOffset 

"<feOffset>"

FePointLight 

"<fePointLight>"

FeSpecularLighting 

"<feSpecularLighting>"

FeSpotLight 

"<feSpotLight>"

FeTile 

"<feTile>"

FeTurbulence 

"<feTurbulence>"

Filter 

"<filter>"

"<g>"

Image 

"&lt;image&gt;"

Line 

"<line>"

LinearGradient 

"<linearGradient>"

Marker 

"<marker>"

Mask 

"<mask>"

Path 

"<path>"

Pattern 

"<pattern>"

Polygon 

"<polygon>"

Polyline 

"<polyline>"

RadialGradient 

"<radialGradient>"

Rect 

"<rect>"

Stop 

"<stop>", for gradient stops.

Style 

"<style>"

SVG 

"<svg>", SVG root element.

Symbol 

"&lt;symbol&gt;"

Text 

"<text>"

TextPath 

"<textPath>"

TSpan 

"<tspan>"

Unknown 

For unknown elements.

Use 

"&lt;use&gt;"

◆ EventType

enum class donner::svg::EventType : uint8_t
strong

Types of DOM events that can be dispatched through the SVG event system.

See also
https://www.w3.org/TR/uievents/
Enumerator
Click 

A click (mousedown + mouseup on same element).

DblClick 

A double click.

MouseDown 

A mouse button was pressed.

MouseUp 

A mouse button was released.

MouseMove 

The mouse pointer moved.

MouseEnter 

The mouse entered the element (does not bubble).

MouseLeave 

The mouse left the element (does not bubble).

MouseOver 

The mouse is over the element (bubbles).

MouseOut 

The mouse moved out of the element (bubbles).

Wheel 

A wheel event (scroll).

◆ FilterUnits

enum class donner::svg::FilterUnits : std::uint8_t
strong

Values for the "filterUnits" attribute which defines the coordinate system for attributes x, y, width, height.

See also
https://www.w3.org/TR/filter-effects/#element-attrdef-filter-filterunits.

This is used on "<filter>" element.

Enumerator
UserSpaceOnUse 

If filterUnits is equal to userSpaceOnUse, x, y, width, height represent values in the current user coordinate system in place at the time when the filter element is referenced (i.e., the user coordinate system for the element referencing the filter element via a filter property).

ObjectBoundingBox 

If filterUnits is equal to objectBoundingBox, then x, y, width, height represent fractions or percentages of the bounding box on the referencing element (see object bounding box units).

Default 

The default value for the "filterUnits" attribute, which is objectBoundingBox.

◆ FontStretch

enum class donner::svg::FontStretch : uint8_t
strong

The parsed result of the font-stretch property.

Values are ordered from narrowest to widest to allow relative keyword resolution.

See also
https://www.w3.org/TR/css-fonts-4/#font-stretch-prop
Enumerator
UltraCondensed 

Ultra-condensed width (50%).

ExtraCondensed 

Extra-condensed width (62.5%).

Condensed 

Condensed width (75%).

SemiCondensed 

Semi-condensed width (87.5%).

Normal 

[DEFAULT] Normal width (100%).

SemiExpanded 

Semi-expanded width (112.5%).

Expanded 

Expanded width (125%).

ExtraExpanded 

Extra-expanded width (150%).

UltraExpanded 

Ultra-expanded width (200%).

◆ FontStyle

enum class donner::svg::FontStyle : uint8_t
strong

The parsed result of the font-style property.

See also
https://www.w3.org/TR/css-fonts-4/#font-style-prop
Enumerator
Normal 

[DEFAULT] Normal (upright) style.

Italic 

Italic style, uses a specifically designed italic face if available.

Oblique 

Oblique style, a slanted version of the normal face.

◆ FontVariant

enum class donner::svg::FontVariant : uint8_t
strong

The parsed result of the font-variant shorthand property (SVG 1.1 subset).

See also
https://www.w3.org/TR/CSS21/fonts.html#propdef-font-variant
Enumerator
Normal 

[DEFAULT] Normal variant.

SmallCaps 

Small-caps variant; lowercase letters rendered as smaller uppercase glyphs.

◆ GradientSpreadMethod

enum class donner::svg::GradientSpreadMethod : uint8_t
strong

Values for the gradient "spreadMethod" attribute, https://www.w3.org/TR/SVG2/pservers.html#LinearGradientElementSpreadMethodAttribute and https://www.w3.org/TR/SVG2/pservers.html#RadialGradientElementSpreadMethodAttribute.

Specifies what happens at the start or end of a gradient, when the gradient coordinates are inside the bounds of the referencing element.

This is used on "<linearGradient>" and "<radialGradient>" elements.

Default Pad Reflect Repeat

Enumerator
Pad 

The gradient is filled with the start or end color.

Reflect 

The gradient is reflected at the start or end.

Repeat 

The gradient is repeated at the start or end.

Default 

The default value for the "spreadMethod" attribute, which is Pad.

◆ GradientUnits

enum class donner::svg::GradientUnits : uint8_t
strong

Values for the "gradientUnits" attribute, https://www.w3.org/TR/SVG2/pservers.html#LinearGradientElementGradientUnitsAttribute and https://www.w3.org/TR/SVG2/pservers.html#RadialGradientElementGradientUnitsAttribute.

This is used on "<linearGradient>" and "<radialGradient>" elements.

  • For linear gradients, this defines the coordinate system for attributes x1, y1, x2, and y2.
  • For radial gradients, this defines the coordinate system for attributes cx, cy, r, fx, fy, and fr.
Enumerator
UserSpaceOnUse 

The gradient is defined in user space, which is the coordinate system of the element that references the gradient.

ObjectBoundingBox 

The gradient is defined in object space, where (0, 0) is the top-left corner of the element that references the gradient, and (1, 1) is the bottom-right corner.

Note that this may result in non-uniform scaling if the element is not square.

Default 

The default value for the "gradientUnits" attribute, which is objectBoundingBox.

◆ ImageRendering

enum class donner::svg::ImageRendering : uint8_t
strong

CSS image-rendering property values.

Controls the sampling filter used when a raster image is scaled.

See also
https://drafts.csswg.org/css-images/#the-image-rendering
Enumerator
Auto 

[DEFAULT] UA picks the algorithm; typically bilinear/trilinear.

OptimizeSpeed 

Legacy SVG 1.1 alias; treated as pixelated here.

OptimizeQuality 

Legacy SVG 1.1 alias; treated as auto.

CrispEdges 

Preserves sharp edges; treated as pixelated for nearest-neighbor.

Pixelated 

Nearest-neighbor sampling for blocky upscaling.

Smooth 

Bilinear/trilinear (same as auto).

◆ Isolation

enum class donner::svg::Isolation : uint8_t
strong

CSS isolation property values.

Controls whether an element creates a new stacking context.

Enumerator
Auto 

[DEFAULT] Element does not necessarily create a new stacking context.

Isolate 

Element creates a new stacking context (isolated group).

◆ LengthAdjust

enum class donner::svg::LengthAdjust : uint8_t
strong

Values for the "lengthAdjust" attribute, https://www.w3.org/TR/SVG2/text.html#TextElementLengthAdjustAttribute.

This is used on the "<text>" and "<tspan>" elements, and controls how the text is stretched, either by adding spacing between glyphs or also by stretching the glyphs themselves.

Enumerator
Spacing 

The text is stretched by adding spacing between glyphs, but the glyphs themselves are not scaled.

SpacingAndGlyphs 

The text is stretched by adding spacing, and the glyphs are also stretched or compressed to fit the textLength.

Default 

The default value for the "lengthAdjust" attribute, which is spacing.

◆ MarkerUnits

enum class donner::svg::MarkerUnits : uint8_t
strong

Values for the "markerUnits" attribute, https://www.w3.org/TR/SVG2/painting.html#MarkerUnitsAttribute.

This is used on the "<marker>" element, and defines the coordinate system for markerWidth, markerHeight, and the contents of the marker.

Enumerator
StrokeWidth 

Marker scales to the stroke width.

Defines a coordinate system where 1.0 is scaled to the stroke-width of the shape.

UserSpaceOnUse 

The marker contents are defined in user space, which is the coordinate system of the element that references the marker.

Default 

The default value for the "markerUnits" attribute, which is strokeWidth.

◆ MaskContentUnits

enum class donner::svg::MaskContentUnits : uint8_t
strong

Values for the "maskContentUnits" attribute, https://drafts.fxtf.org/css-masking-1/#element-attrdef-mask-maskcontentunits.

This is used on the "<mask>" element, and defines the coordinate system for the contents of the mask.

Enumerator
UserSpaceOnUse 

The mask contents are defined in user space, which is the coordinate system of the element that references the mask.

ObjectBoundingBox 

The mask contents are defined in object space, where (0, 0) is the top-left corner of the element that references the mask, and (1, 1) is the bottom-right corner.

Note that this may result in non-uniform scaling if the element is not square.

Default 

The default value for the "maskContentUnits" attribute, which is userSpaceOnUse.

◆ MaskUnits

enum class donner::svg::MaskUnits : uint8_t
strong

Values for the "maskUnits" attribute, https://drafts.fxtf.org/css-masking-1/#element-attrdef-mask-maskunits.

This is used on the "<mask>" element, and defines the coordinate system for the x, y, width, and height attributes of the mask.

Enumerator
UserSpaceOnUse 

The attributes are defined in user space, which is the coordinate system of the element that references the mask.

ObjectBoundingBox 

The attributes are defined in object space, where (0, 0) is the top-left corner of the element that references the mask, and (1, 1) is the bottom-right corner.

Default 

The default value for the "maskUnits" attribute, which is objectBoundingBox.

◆ MixBlendMode

enum class donner::svg::MixBlendMode : uint8_t
strong

CSS mix-blend-mode property values for compositing blend modes.

Maps to tiny_skia::BlendMode values at the renderer level.

Enumerator
Normal 

[DEFAULT] Source over destination (no blending effect).

Multiply 

Component-wise multiply.

Screen 

Inverse multiply.

Overlay 

Multiply or screen based on destination.

Darken 

Minimum of source and destination.

Lighten 

Maximum of source and destination.

ColorDodge 

Brighten destination toward source.

ColorBurn 

Darken destination toward source.

HardLight 

Multiply or screen based on source.

SoftLight 

Soft version of hard light.

Difference 

Absolute difference.

Exclusion 

Similar to Difference but lower contrast.

Hue 

Source hue, destination saturation and luminosity.

Saturation 

Source saturation, destination hue and luminosity.

Color 

Source hue and saturation, destination luminosity.

Luminosity 

Source luminosity, destination hue and saturation.

◆ Overflow

enum class donner::svg::Overflow : uint8_t
strong

The parsed result of the CSS 'overflow' property, see https://www.w3.org/TR/CSS2/visufx.html#overflow and https://www.w3.org/TR/SVG2/render.html#OverflowAndClipProperties.

The 'overflow' property specifies whether to clip content, render scrollbars, or display content outside the element's box.

In SVG, the 'overflow' property applies to container elements and determines how to handle content that exceeds the bounds of the viewport.

Enumerator
Visible 

[DEFAULT] "visible": Content is not clipped, and may render outside the box.

Hidden 

"hidden": Content is clipped, and no scrollbars are provided.

Scroll 

"scroll": Content is clipped, but scrollbars are provided to scroll the content. Donner does not implement scrolling so this is equivalent to "hidden".

Auto 

"auto": If content overflows, scrollbars are provided.

◆ PatternContentUnits

enum class donner::svg::PatternContentUnits : uint8_t
strong

PatternContentUnits controls the coordinate system of the children of the pattern:

With userSpaceOnUse, as the shape size changes, padding will be added between tiles. With objectBoundingBox, the tiles will be stretched to fill the shape.

<pattern id="contentUserspace" patternContentUnits="userSpaceOnUse"
x="0" y="0.2" width="0.5" height="0.5">
<rect x="0" y="0" width="12" height="12" fill="lime" />
<rect x="10" y="10" width="12" height="12" fill="gray" />
</pattern>
<pattern id="contentBbox" patternContentUnits="objectBoundingBox"
x="0" y="0.2" width="0.5" height="0.5">
<rect x="0" y="0" width="0.24" height="0.24" fill="lime" />
<rect x="0.2" y="0.2" width="0.24" height="0.24" fill="gray" />
</pattern>

PatternContentUnits userSpaceOnUse (default) objectBoundingBox

Enumerator
UserSpaceOnUse 

The children of the pattern are specified in the current user space where the pattern is referenced.

ObjectBoundingBox 

The children of the pattern are specified as percentages of the object bounding box, where 0.0 is the left and 1.0 is the right, and similarly for the y axis.

Default 

The default value, PatternContentUnits::UserSpaceOnUse.

◆ PatternUnits

enum class donner::svg::PatternUnits : uint8_t
strong

PatternUnits controls the coordinate system of the x/y/width/height attributes:

  • For PatternUnits::ObjectBoundingBox (default), coordinates are percentages of the object bounding box, where 0.0 is the left and 1.0 is the right, and similarly for the y axis.
  • For PatternUnits::UserSpaceOnUse, patternUnits="objectBoundingBox", coordinates are specified in the current user space where the pattern is referenced.

See also: PatternContentUnits

For example, both of these patterns appear the same when applied to a 50x50 shape, but the objectBoundingBox one changes based on the shape the pattern is applied to:

<pattern id="bbox" x="0.1" y="0.2" width="0.5" height="0.5">
<rect x="0" y="0" width="12" height="12" fill="lime" />
<rect x="10" y="10" width="12" height="12" fill="gray" />
</pattern>
<pattern id="userspace" patternUnits="userSpaceOnUse" x="5" y="10" width="25" height="25">
<rect x="0" y="0" width="12" height="12" fill="lime" />
<rect x="10" y="10" width="12" height="12" fill="gray" />
</pattern>

See also: PatternUnits

PatternUnits objectBoundingBox (default) userSpaceOnUse

Enumerator
UserSpaceOnUse 

The pattern's x/y/width/height attributes are specified in the current user space where the pattern is referenced.

ObjectBoundingBox 

The pattern's x/y/width/height attributes are specified as percentages of the object bounding.

Default 

The default value, PatternUnits::ObjectBoundingBox.

◆ PointerEvents

enum class donner::svg::PointerEvents : uint8_t
strong

Values for the 'pointer-events' property, which defines how mouse events interact with an element.

See also
https://www.w3.org/TR/SVG2/interact.html#PointerEventsProp
Enumerator
None 

Do not respond to pointer events.

BoundingBox 

The element's bounding box is used instead of the path.

VisiblePainted 

Responds to pointer events only if the element is visible and the pointer is over the painted area, which is the fill or stroke if they are not none.

VisibleFill 

Responds to pointer events only if the element is visible and within the fill, regardless of fill value.

VisibleStroke 

Responds to pointer events only if the element is visible and within the stroke, regardless of stroke value.

Visible 

Responds to pointer events only if the element is visible, if the pointer is within either the fill or stroke, regardless of their value.

Painted 

Responds to pointer events only if the pointer is over the painted area, which is the fill or stroke if they are not none. Ignores the visibility property.

Fill 

Responds to pointer events only if the pointer is within the fill area, regardless of fill or visibility property values.

Stroke 

Responds to pointer events only if the pointer is within the stroke area, regardless of stroke or visibility property values.

All 

Responds to pointer events regardless of the element's visibility or painted area, if the pointer is within either the fill or stroke areas.

◆ PrimitiveUnits

enum class donner::svg::PrimitiveUnits : std::uint8_t
strong

Values for the "primitiveUnits" attribute which specifies the coordinate system for the various length values within the filter primitives and for the attributes that define the filter primitive subregion.

See also
https://www.w3.org/TR/filter-effects/#element-attrdef-filter-primitiveunits

This is used on "<filter>" element.

Enumerator
UserSpaceOnUse 

If primitiveUnits is equal to userSpaceOnUse, any length values within the filter definitions represent values in the current local coordinate system in place at the time when the "<filter>" element is referenced (i.e., the user coordinate system for the element referencing the filter element via a filter property).

ObjectBoundingBox 

If primitiveUnits is equal to objectBoundingBox, then any length values within the filter definitions represent fractions or percentages of the bounding box on the referencing element (see object bounding box units).

Note that if only one number was specified in a <number-optional-number> value this number is expanded out before the primitiveUnits computation takes place.

Default 

The default value for the "primitiveUnits" attribute, which is userSpaceOnUse.

◆ ProcessingMode

enum class donner::svg::ProcessingMode : uint8_t
strong

SVG document processing mode, per SVG2 §2.7.1.

Controls which features are available when processing a document. Sub-documents referenced by <image> are loaded in SecureStatic or SecureAnimated mode to prevent external resource loading and script execution.

Enumerator
DynamicInteractive 

Full features enabled (default for top-level documents).

SecureAnimated 

No scripts, no external refs; animations allowed.

SecureStatic 

No scripts, no external refs, no animations.

◆ PropertyCascade

enum class donner::svg::PropertyCascade
strong

Defines how this property cascades between the parent and child elements.

Enumerator
None 

Property does not inherit.

Inherit 

Property inherits unconditionally.

PaintInherit 

Property inherits unless the child is instantiated as a paint server. This is handled as a special case to prevent recursion for "<pattern>".

◆ PropertyInheritOptions

Options to control how inheritance is performed, to either inherit everything or conditionally disable inheritance of paint servers.

Enumerator
All 

Inherit everything (default).

NoPaint 

Inherit everything except paint servers, for "<pattern>" elements.

◆ PropertyState

enum class donner::svg::PropertyState
strong

The current property state, which can be either set, not set, or a specific CSS keyword such as "inherit", "initial", or "unset".

Enumerator
NotSet 

If the property has no value set.

Set 

If the property has a value set.

Inherit 

If the property's value is "inherit".

ExplicitInitial 

If the property's value is "initial", explicitly set by the user.

Sets the property to its initial value with a specificity.

ExplicitUnset 

If the property's value is "unset", explicitly set by the user.

Resolves to either inherit or initial, depending on if the property is inheritable.

See also
https://www.w3.org/TR/css-cascade-3/#inherit-initial

◆ ResourceLoaderError

enum class donner::svg::ResourceLoaderError : uint8_t
strong

Error codes for resource loading.

Enumerator
NotFound 

File not found.

SandboxViolation 

File access violation, such as attempting to access a file outside the sandbox.

◆ StrokeLinecap

enum class donner::svg::StrokeLinecap : uint8_t
strong

The parsed result of the 'stroke-linecap' property, see: https://www.w3.org/TR/SVG2/painting.html#StrokeLinecapProperty.

Enumerator
Butt 

[DEFAULT] The stroke is squared off at the endpoint of the path.

Round 

The stroke is rounded at the endpoint of the path.

Square 

The stroke extends beyond the endpoint of the path by half of the stroke width and is squared off.

◆ StrokeLinejoin

enum class donner::svg::StrokeLinejoin : uint8_t
strong

The parsed result of the 'stroke-linejoin' property, see: https://www.w3.org/TR/SVG2/painting.html#StrokeLinejoinProperty.

Enumerator
Miter 

[DEFAULT] The outer edges of the strokes for the two segments are extended until they meet at an angle, creating a sharp point.

MiterClip 

Same as miter except the stroke will be clipped if the miter limit is exceeded.

Round 

The corners of the stroke are rounded off using an arc of a circle with a radius equal to the half of the stroke width.

Bevel 

A triangular shape is used to fill the area between the two stroked segments.

Arcs 

Similar to miter join, but uses an elliptical arc to join the segments, creating a smoother joint than miter join when the angle is acute. It is only used for large angles where a miter join would be too sharp.

◆ TextAnchor

enum class donner::svg::TextAnchor : uint8_t
strong

The parsed result of the text-anchor property.

Determines the alignment of text relative to its anchor position (the x/y coordinates).

See also
https://www.w3.org/TR/SVG2/text.html#TextAnchorProperty
Enumerator
Start 

[DEFAULT] Text starts at the anchor position.

Middle 

Text is centered on the anchor position.

End 

Text ends at the anchor position.

◆ TextDecoration

enum class donner::svg::TextDecoration : uint8_t
strong

Bitmask for the text-decoration property line types.

Values can be combined: Underline | Overline represents both an underline and overline. The CSS text-decoration shorthand parses space-separated values into this bitmask.

See also
https://www.w3.org/TR/SVG2/text.html#TextDecorationProperties
Enumerator
None 

[DEFAULT] No text decoration.

Underline 

Draw a line below the text.

Overline 

Draw a line above the text.

LineThrough 

Draw a line through the middle of the text.

◆ UrlLoaderError

enum class donner::svg::UrlLoaderError : uint8_t
strong

Enum of possible errors that can occur when loading an image.

Enumerator
NotFound 

The file was not found.

UnsupportedFormat 

The format is not supported (for images, mime type must be either "image/png" or "image/jpeg").

InvalidDataUrl 

The data URL is invalid.

DataCorrupt 

The loaded data is corrupt and cannot be decoded.

◆ Visibility

enum class donner::svg::Visibility : uint8_t
strong

The parsed result of the 'visibility' property, see: https://www.w3.org/TR/CSS2/visufx.html#propdef-visibility.

This determines whether the element is visible or hidden, and whether it affects layout.

Enumerator
Visible 

[DEFAULT] Visible is the default value.

Hidden 

Hidden elements are invisible, but still affect layout.

Collapse 

Collapsed elements are invisible, and do not affect layout.

◆ WritingMode

enum class donner::svg::WritingMode : uint8_t
strong

CSS writing-mode property values, controlling the direction of text flow.

SVG1 values (lr-tb, rl-tb, tb-rl, etc.) are mapped to these CSS3 equivalents during parsing.

Enumerator
HorizontalTb 

[DEFAULT] Left-to-right, top-to-bottom (horizontal text).

VerticalRl 

Top-to-bottom, right-to-left (vertical CJK style).

VerticalLr 

Top-to-bottom, left-to-right.

Function Documentation

◆ ApplyFilterGraphToPixmap()

void donner::svg::ApplyFilterGraphToPixmap ( tiny_skia::Pixmap & pixmap,
const components::FilterGraph & filterGraph,
const Transform2d & deviceFromFilter,
const std::optional< Box2d > & filterRegion,
bool clipSourceToFilterRegion = false,
const tiny_skia::Pixmap * fillPaintInput = nullptr,
const tiny_skia::Pixmap * strokePaintInput = nullptr )

Applies a Donner filter graph to a premultiplied RGBA pixmap in place.

Parameters
pixmapPremultiplied RGBA pixmap containing SourceGraphic on entry.
filterGraphFilter graph to execute.
deviceFromFilterTransform from filter local coordinates to device coordinates.
filterRegionOptional filter region in filter local coordinates.
clipSourceToFilterRegionIf true, clip pixmap's contents to filterRegion before running the filter graph.
fillPaintInputOptional FillPaint input pixmap, or nullptr if unused.
strokePaintInputOptional StrokePaint input pixmap, or nullptr if unused.

◆ BuildCssSelectorPath()

std::string donner::svg::BuildCssSelectorPath ( const SVGElement & element)

Build a CSS-like selector path for an element.

Parameters
elementElement to describe.
Returns
Selector path from the root to the element.

◆ CalculateRadiusMaybeAuto()

std::tuple< Lengthd, double > donner::svg::CalculateRadiusMaybeAuto ( const Property< Lengthd > & property,
const Property< Lengthd > & fallbackProperty,
const Box2d & viewBox,
const FontMetrics & fontMetrics )

Calculates the the radius for elements with rx and ry radius, in pixels, taking into account the "auto" identifier and handling negative values.

This is used for "<rect>" or "<ellipse>".

Parameters
propertyThe property to compute, the storage for either rx or ry.
fallbackPropertyThe other property to use if the first one is "auto".
viewBoxThe viewBox to use for computing the length.
fontMetricsThe font metrics to use for computing the length.
Returns
Tuple containing the resolved length, and the converted length to pixels.

◆ ClipFilterOutputToRegion()

void donner::svg::ClipFilterOutputToRegion ( tiny_skia::Pixmap & pixmap,
const std::optional< Box2d > & filterRegion,
const Transform2d & deviceFromFilter )

Clears pixels outside the transformed filter region.

Parameters
pixmapPremultiplied RGBA pixmap to modify in place.
filterRegionOptional filter region in filter local coordinates.
deviceFromFilterTransform from filter local coordinates to device coordinates.

◆ CompositeAABBRect()

void donner::svg::CompositeAABBRect ( RendererBitmap & bitmap,
const Box2d & bounds,
const SampledImageInfo & imageInfo )

Draw a 1-sub-pixel blue AABB outline directly into the bitmap, aligned to the terminal sub-pixel grid.

Parameters
bitmapBitmap to draw into (modified in-place).
boundsAABB in image coordinates.
imageInfoTerminal sampling info for sub-pixel alignment.

◆ FlattenResolvedGradient()

std::optional< ResolvedGradientData > donner::svg::FlattenResolvedGradient ( const components::ResolvedPaintServer & paint)
nodiscard

Flatten a resolved paint server if it points at a materialized linear or radial gradient.

Parameters
paintThe resolved paint server to inspect.
Returns
Gradient payload on success, or std::nullopt if paint is not a supported gradient.

◆ MaterializeResolvedGradient()

components::ResolvedPaintServer donner::svg::MaterializeResolvedGradient ( Registry & registry,
const ResolvedGradientData & gradient )

Materialize a resolved gradient payload into a fresh ECS paint server entity.

Parameters
registryRegistry that will own the temporary paint server entity.
gradientGradient payload to materialize.
Returns
A resolved paint server referencing the newly created entity.

◆ operator<<() [1/2]

std::ostream & donner::svg::operator<< ( std::ostream & os,
const ClipRule & clipRule )
inline

Output stream operator for ClipRule enum.

Parameters
osThe output stream.
clipRuleThe ClipRule value to output.
Returns
The output stream.

◆ operator<<() [2/2]

template<typename T, PropertyCascade kCascade>
std::ostream & donner::svg::operator<< ( std::ostream & os,
const Property< T, kCascade > & property )

Ostream output operator, which outputs the current property value, how it was set (e.g.

directly set or inherited, see PropertyState), and the property's specificity.

Example output:

color: Color(rgba(0, 255, 0, 255)) (set) @ Specificity(0, 0, 0)
@ Color
Source hue and saturation, destination luminosity.
Definition MixBlendMode.h:31
Parameters
osOutput stream to write to.
propertyProperty to output.

◆ ParseFontMetadata()

std::optional< FontMetadata > donner::svg::ParseFontMetadata ( std::span< const uint8_t > data)

Parse CSS-relevant metadata from a raw OpenType/TrueType font file.

Parameters
dataRaw font bytes.
Returns
Metadata if the required tables are present and readable.

◆ PremultiplyRgba()

std::vector< std::uint8_t > donner::svg::PremultiplyRgba ( std::span< const std::uint8_t > rgbaPixels)
nodiscard

Convert tightly-packed straight-alpha RGBA8 to premultiplied RGBA8.

Parameters
rgbaPixelsStraight-alpha RGBA bytes (size must be a multiple of 4).
Returns
Newly-allocated premul RGBA buffer of the same size.

◆ RunDonnerSvgTool()

int donner::svg::RunDonnerSvgTool ( int argc,
char * argv[],
std::ostream & out,
std::ostream & err )

Run the donner-svg command line tool.

Parameters
argcNumber of command line arguments.
argvCommand line arguments.
outOutput stream for normal user-facing output.
errOutput stream for errors.
Returns
Process-style exit code.

◆ ToConstexpr()

template<typename ReturnType, typename FnT>
ReturnType donner::svg::ToConstexpr ( ElementType type,
FnT fn )

Converts a ElementType runtime value to a compile-time value, allowing conditional behavior for different element types with constexpr.

Takes the runtime value and invokes a function with std::integral_constant<ElementType> as a parameter.

Example 1:

SVGElement element = ...;
ToConstexpr<void>(element.type(), [&](auto elementType) {
if constexpr (std::is_same_v<elementType(), ElementType::Circle>) {
// Handle circle element.
return ParseCircleAttributes(element);
}
}
Represents a single SVG element (e.g., <rect>, <circle>, <g>, <text>, etc.) within an SVGDocument.
Definition SVGElement.h:52
ElementType type() const
Get the ElementType for known XML element types.
ReturnType ToConstexpr(ElementType type, FnT fn)
Converts a ElementType runtime value to a compile-time value, allowing conditional behavior for diffe...
Definition ElementType.h:104

Example 2:

template <ElementType Type>
ParseResult<bool> myFunction();
ElementType type = element.type();
return ToConstexpr<ParseResult<bool>>(type, [&](auto elementType) {
return ParsePresentationAttribute<elementType()>(element, name, value);
*});
A parser result, which may contain a result of type T, or an error, or both.
Definition ParseResult.h:17
ElementType
SVG element types, corresponds to each XML element name, such as "<circle>", "<svg>",...
Definition ElementType.h:13
Template Parameters
ReturnTypeReturn type of the function.
FnTFunction type, with signature ReturnType(std::integral_constant<ElementType>).
Parameters
typeRuntime element type.
fnFunction to call with the compile-time element type, with signature ReturnType(std::integral_constant<ElementType>).

◆ UnpremultiplyRgba()

std::vector< std::uint8_t > donner::svg::UnpremultiplyRgba ( std::span< const std::uint8_t > rgbaPixels)
nodiscard

Non-mutating variant of UnpremultiplyRgbaInPlace that allocates. Prefer the in-place form on hot paths; use this when the caller needs to preserve the input.

Parameters
rgbaPixelsPremultiplied RGBA bytes (size must be a multiple of 4).

◆ UnpremultiplyRgbaInPlace()

void donner::svg::UnpremultiplyRgbaInPlace ( std::vector< std::uint8_t > & rgba)

Convert tightly-packed premultiplied RGBA8 to straight-alpha RGBA8, in place. Fully-opaque pixels (alpha == 255) are unchanged; fully-transparent pixels (alpha == 0) become (0, 0, 0, 0).

Parameters
rgbaPremultiplied RGBA bytes (size must be a multiple of 4).

Variable Documentation

◆ kUserAgentStylesheet

std::string_view donner::svg::kUserAgentStylesheet
constexpr
Initial value:
= R"(
@namespace url(http://www.w3.org/2000/svg);
@namespace xml url(http://www.w3.org/XML/1998/namespace);
svg:not(:root), image, marker, pattern, symbol { overflow: hidden; }
*:not(svg),
*:not(foreignObject) > svg {
transform-origin: 0 0;
}
*[xml|space=preserve] {
text-space-collapse: preserve-spaces;
}
:host(use) > symbol {
display: inline !important;
}
:link, :visited {
cursor: pointer;
}
)"

The user agent stylesheet to be used by default on all SVG documents.

See also
https://www.w3.org/TR/SVG2/styling.html#UAStyleSheet