Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 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  CursorImage
 One authored cursor image candidate and its optional hotspot. More...
struct  Cursor
 Cascaded CSS cursor value with authored URL candidates and a required keyword fallback. 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...
struct  PaintOrder
 CSS paint-order property value: the order in which the fill, stroke, and markers of a shape/text are painted. 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  TextDecorationThickness
 CSS thickness of decoration lines originating on an element. More...
struct  TransformOrigin
 Represents the transform-origin property value. More...
class  DocumentAccessLock
 Lightweight reader/writer gate for document access. More...
struct  DetachedNodeDiagnostics
 Summary of detached-node collection state. More...
struct  DocumentAccessDiagnostics
 Summary of document access and lock state. More...
struct  DocumentMutationRecord
 One committed document mutation revision. More...
struct  DocumentMutationLogSnapshot
 Snapshot of mutation-log records after a caller-owned sequence number. More...
struct  DetachedNodeState
 Document-local detached-node collection state. More...
class  DocumentState
 Shared mutable state behind SVGDocument and SVGElement facades. More...
class  DocumentReadAccess
 Scoped read access to a DocumentState. More...
class  DocumentWriteAccess
 Scoped write access to a DocumentState. More...
class  DetachedNodeCollectionDeferral
 Scoped deferral for detached-node collection during snapshot or observer epochs. More...
class  DocumentMutationBatch
 Scoped write access that coalesces nested DOM mutation revision bumps. 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  RadialClipPath
 Shared reference box and center for radial CSS clipping shapes. More...
struct  CircleClipPath
 A circle used as a CSS clipping shape. More...
struct  EllipseClipPath
 An ellipse used as a CSS clipping shape, with independently resolved axis radii. More...
struct  PolygonClipPath
 A polygon used as a CSS clipping shape. More...
struct  InsetClipPath
 An inset rectangle with optional elliptical corners used as a CSS clipping shape. More...
struct  PathClipPath
 A CSS path clipping shape with parsed, owned SVG geometry. More...
struct  ClipPath
 A referenced SVG clip or a supported CSS basic shape; absence is represented by the property. 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...
struct  FilterInputMargin
 Input a filter layer's capture must include beyond each output pixel, in device pixels. More...
struct  FilterInputMarginBuilder
 Accumulates each primitive's input reach in device pixels, converting lengths with the same helpers and bounds the filter executors use. The executors round each primitive to whole pixels (offsets and morphology radii to the nearest pixel, blur kernels up), so each primitive's reach rounds up to whole pixels before the chain adds them. More...
struct  FilterInputBuffer
 Filter input raster layout around a viewport: the viewport plus input margins on each side. More...
struct  FilterInputAxis
 One axis of a FilterInputBuffer. More...
struct  FilterRegionSample
 Resolved clipping bounds and optional un-clipped animated geometry, in user coordinates. More...
struct  FilterRegionContext
 Per-invocation filter coordinates and subregion history, independent of GPU resources. More...
class  GifEncoder
 Incremental in-memory encoder for looping animated GIF89a images. More...
struct  PatternTileRasterMetrics
 Validated dimensions and scale for a rasterized pattern tile. More...
struct  PreparedTextDraw
 Immutable layout slice and full-element bounds prepared once for a text effect owner. More...
struct  TextDrawGeometry
 Mutable per-call run copy after effect ownership and visibility filtering. More...
struct  GlyphOutlineAndPlacement
 A glyph's outline split into the part that depends only on the glyph and the part that depends only on where the glyph sits in the run. More...
struct  GlyphFaceScale
 The face that draws one glyph, with its outline scale and whether it has only bitmap glyphs. More...
struct  AtlasDocumentPlacement
 Placement of one document inside a shared atlas render target. More...
class  Renderer
 Backend-agnostic renderer that resolves to the active build backend (tiny-skia by default, or Geode). More...
class  RendererDriver
 Backend-agnostic renderer driver that prepares documents for rendering and emits drawing commands through a RendererInterface implementation. More...
class  RendererGeodeTextureSnapshot
 GPU runtime texture snapshot exported by RendererGeode. More...
struct  FrameTimings
 Per-frame performance instrumentation for RendererGeode. More...
struct  RendererGeodeTexturePoolStats
 Retained-memory instrumentation for RendererGeode's transient texture pool. More...
class  RendererGeode
 Geode rendering backend - GPU-native via 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  RendererReadbackStats
 Aggregate diagnostics for CPU readbacks run by a renderer and any offscreen instances that share its backend device, plus the device-health outcome those readbacks observed. More...
class  RendererSurfaceBudget
 Aggregate budget for render targets, layers, masks, clips, and pattern tiles. More...
class  RendererFilterPreparationBudget
 Aggregate filter-graph preparation and source-image materialization budget for one frame. More...
class  RendererDrawBudget
 Aggregate conversion, rasterization, and upload work shared by a render frame. More...
class  RendererTextMaterializationBudget
 Aggregate text outline, bitmap, path-copy, and cache-storage budget for one renderer frame. More...
struct  RendererResourceStats
 Bounded-resource diagnostics for the most recently started render frame. More...
class  RendererTextureSnapshot
 Backend-owned GPU texture snapshot produced by a renderer. More...
class  RendererImage
 A rendered image that lives either in a backend GPU texture or in CPU pixels. More...
struct  PathShape
 A path to draw, along with its fill rule and the entity it came from. More...
struct  ClipPathShape
 One resolved clip-path shape, owned by the ResolvedClip that holds it. 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...
struct  RendererTinySkiaFrameCounters
 Per-frame counts of the conversions RendererTinySkia caches. More...
class  RendererTinySkia
 Rendering backend using tiny-skia-cpp. More...
class  RendererUtils
 Utility functions for the renderer. More...
class  RenderSnapshot
 Immutable command stream captured from a prepared SVG document. More...
class  RenderSnapshotRecorder
 RendererInterface implementation that records commands into a RenderSnapshot. More...
struct  RetainedSpanKey
 Everything a captured blit sequence depends on, besides the shape's geometry. More...
struct  RetainedSpanSlot
 One retained fill or stroke pass of one shape. More...
struct  RetainedSpansComponent
 Retained rasterization output for one shape, attached to the entity its geometry came from. More...
struct  RetainedSpanDocumentState
 Document-wide state for retained coverage, stored in the registry context. More...
struct  RetainedSpanStats
 Counters describing what a renderer's retained coverage did, for tests and benchmarks. 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...
struct  CatalogFontAsset
 Build-pinned catalog metadata. Runtime responses never add entries or choose package paths. More...
class  CatalogEncodedFontStore
 Session-owned verified encoded bytes and shared catalog decode admission. More...
class  EmbeddedFontProvider
 Curated bundled fonts, sharing one generated WOFF2 catalog on native and Wasm. More...
class  FontCatalog
 Aggregate font catalog: the single surface the editor's font picker and FontManager resolution consume. More...
struct  FontFamilyInfo
 One entry in the font catalog: a family name plus how it was discovered and classified. More...
struct  FontFaceRequest
 Which face inside a family a font-family lookup wants, taken from the element's computed CSS font properties. More...
struct  FontFaceAvailability
 Nonblocking metadata for a face. Empty contentId preserves legacy synchronous providers. More...
struct  FontFaceDependency
 Copyable dependency record suitable for handing off before a temporary document is destroyed. More...
class  FontFaceLoadReservation
 A reservation stays alive through the provider copy, decoder, and transfer into retained data. More...
struct  FontFaceAdmission
 Nonblocking admission result. Synchronous custom providers need no reservation by default. More...
class  FontFamilyProvider
 Interface implemented by each font source (embedded, system) and by the aggregate FontCatalog. More...
class  ScopedFontLoadInterruption
 Lets the calling thread abandon provider font loads that are no longer wanted. More...
struct  FontDataRenderingOptions
 Owned rendering attributes for a provider face reloaded from encoded bytes. More...
struct  FontLoadingDomainIdentity
 Non-owning identity of an installed font-loading domain. 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  SystemFontProvider
 FontFamilyProvider backed by the host operating system's installed fonts. More...
class  UrlLoader
 Utility class for loading a URI or decoding a data URL. More...
class  SVGAElement
 DOM object for a <a> element. More...
class  SVGAnimateElement
 DOM object for a <animate> element. More...
class  SVGAnimateMotionElement
 DOM wrapper for the <animateMotion> element. More...
class  SVGAnimateTransformElement
 DOM object for a <animateTransform> element. 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  SVGDescElement
 DOM object for a <desc> element. More...
struct  SVGAnimationEvent
 A declarative animation boundary observed over a time interval. More...
struct  SVGAnimationEventBatch
 Bounded lifecycle query result. An incomplete query returns no partial events. More...
struct  FontResourcePreflight
 Readiness of catalog-dependent geometry or pixels for an explicit element target. More...
class  SVGDocument
 Represents a parsed SVG document containing a tree of SVGElement nodes. More...
class  SVGDocumentMutation
 Typed DOM mutation helper used by SVGDocument::withWriteAccess. More...
class  ElementAnchor
 Lifetime-aware reference to an SVG element entity. 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 <image> 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  SVGMetadataElement
 DOM object for a <metadata> element. More...
class  SVGMPathElement
 DOM wrapper for the <mpath> element. 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  SVGSetElement
 DOM object for a <set> 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...
struct  SVGMatchedStyleRule
 Diagnostic record for one stylesheet rule that matched an element. More...
struct  SVGStylesheetDeclaration
 Parsed declaration within a stylesheet rule, with an optional document source range. More...
struct  SVGStylesheetRule
 Stylesheet rule in a document; built-in rules have no document source ranges. More...
struct  SVGStyleRuleAtSourceOffset
 Stylesheet rule found at a document source offset. More...
class  SVGSVGElement
 DOM object for a <svg> element. More...
class  SVGSwitchElement
 DOM object for a <switch> element. More...
class  SVGSymbolElement
 DOM object for a <symbol> element, which defines a graphical template that can be instantiated using a <use> element. More...
struct  TextGlyphOutline
 A single placed glyph outline paired with the element that painted it. 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  SVGTitleElement
 DOM object for a <title> element. 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 <use> element. More...
struct  BidiResourceBudget
 Cumulative admission for one text layout, including fast paths and all source spans. More...
class  BidiParagraph
 Owns stable Unicode scalar storage and resolved paragraphs. No library handle escapes. More...
class  GraphemeBreaker
 Streaming Unicode 17.0.0 extended grapheme boundaries (UAX #29 revision 47). State is constant size and may continue across adjacent text spans. More...
class  LamAlefCandidateBreaker
 Detect potential Unicode lam-alef groups; actual font shaping must qualify their boundaries. 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...
struct  TextStyleContext
 Internal, frame-owned mapping from authored text entities to one rendered instance's styles. Callers pass it synchronously; layout and draw results retain no reference to this map. More...
class  TextEngine
 Shared SVG text engine. More...
struct  TextLayoutParams
 Layout-only parameters consumed by TextEngine. More...
class  TextPathMeasurementReservation
 Lifetime charge for retained text-path measurement geometry. More...
struct  StretchedTextPath
 Shared path mapping used to warp glyph outlines for textPath method="stretch". More...
struct  ResolvedTextFont
 Resolved face and used font size for layout or declaring-element decoration metrics. More...
struct  TextGlyph
 A single positioned glyph in a laid-out text run. More...
struct  TextRun
 A run of positioned glyphs laid out with one primary face. 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<DocumentState>
 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  ColorInterpolation : std::uint8_t {
  Auto ,
  SRGB ,
  LinearRGB ,
  Default = SRGB
}
 Values of the inherited color-interpolation property. Luminance masks use this color space. 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 ,
  ContextMenu ,
  Progress ,
  Cell ,
  VerticalText ,
  Alias ,
  Copy ,
  NoDrop ,
  AllScroll ,
  EWResize ,
  NSResize ,
  NESWResize ,
  NWSEResize
}
 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 ,
  UseScript ,
  NoChange ,
  ResetSize
}
 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  FontKerning : uint8_t {
  Auto ,
  Normal ,
  None
}
 Computed CSS font-kerning policy. Auto currently enables kerning at every size. 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  FontSynthesisSmallCaps : uint8_t {
  Auto ,
  None
}
 Whether the CSS font-synthesis-small-caps property permits synthetic small caps. More...
enum class  FontSynthesisStyle : uint8_t {
  Auto ,
  None ,
  ObliqueOnly
}
 CSS permission to synthesize an oblique face when a matching designed face is absent. 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  HitTestMode {
  SvgPointerEvents ,
  EditorSelection
}
 Select whether a hit query follows SVG interaction rules or targets editable artwork. More...
enum class  ImageRendering : uint8_t {
  Auto ,
  OptimizeSpeed ,
  OptimizeQuality ,
  CrispEdges ,
  Pixelated ,
  Smooth ,
  HighQuality
}
 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  MaskType : uint8_t {
  Luminance ,
  Alpha
}
 CSS mask-type property values. 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  NonScalingStrokeMode : uint8_t {
  Scaling ,
  ScaledLocal ,
  HostSpace
}
 How an element's stroke is realized under its current CTM. 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  OverflowWrap : uint8_t {
  Normal ,
  BreakWord ,
  Anywhere
}
 CSS emergency wrapping policy. BreakWord and Anywhere differ in intrinsic sizing.
enum class  PaintComponent : uint8_t {
  Fill ,
  Stroke ,
  Markers
}
 One of the three paint operations whose draw order is controlled by the CSS paint-order property. 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 ,
  Auto
}
 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  TextDecorationStyle : uint8_t {
  Solid ,
  Double ,
  Dotted ,
  Dashed ,
  Wavy
}
 The text-decoration-style property: how each decoration line is drawn. More...
enum class  TextOrientation : uint8_t {
  Mixed ,
  Upright ,
  Sideways
}
 CSS text-orientation values used in vertical writing modes.
enum class  TextTransform : uint8_t {
  None ,
  FullWidth
}
 Supported CSS text-transform operations. Case and kana-size transforms are not implemented.
enum class  VectorEffect : uint8_t {
  None ,
  NonScalingStroke ,
  NonScalingSize ,
  NonRotation ,
  FixedPosition
}
 Values for the vector-effect property, which modifies how an element is affected by the coordinate system transformations in effect (such as viewBox scaling and transform). 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  WhiteSpace : uint8_t {
  Normal ,
  Pre ,
  Nowrap ,
  PreWrap ,
  BreakSpaces ,
  PreLine
}
 CSS white-space keywords controlling collapsing and line breaking.
enum class  WritingMode : uint8_t {
  HorizontalTb ,
  VerticalRl ,
  VerticalLr
}
 CSS writing-mode property values, controlling the direction of text flow. More...
enum class  ThreadingMode {
  SingleThreaded ,
  ConcurrentDom
}
 DOM threading policy for a document. More...
enum class  ElementType : uint8_t {
  A ,
  Animate ,
  AnimateMotion ,
  AnimateTransform ,
  Circle ,
  ClipPath ,
  Defs ,
  Desc ,
  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 ,
  MPath ,
  Metadata ,
  Path ,
  Pattern ,
  Polygon ,
  Polyline ,
  RadialGradient ,
  Rect ,
  Set ,
  Stop ,
  Style ,
  SVG ,
  Switch ,
  Symbol ,
  Text ,
  TextPath ,
  Title ,
  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  ImageSamplingKernel : std::uint8_t {
  Nearest ,
  Bilinear ,
  MitchellCubic ,
  PixelatedSmooth
}
 Resampling kernel a backend applies when it scales a raster <image>. More...
enum class  AlphaType : uint8_t {
  Premultiplied ,
  Unpremultiplied
}
 Alpha channel interpretation for pixel data. More...
enum class  GpuWaitTimeoutSite : uint8_t {
  None ,
  ReadbackMap ,
  QueueIdle ,
  Present ,
  Unknown
}
 Bounded CPU-blocks-on-GPU wait that exceeded its deadline and caused a renderer backend to declare its device lost. More...
enum class  RendererTextureSnapshotBackend : uint8_t {
  Unknown ,
  Geode
}
 Backend type for RendererTextureSnapshot payloads.
enum class  TerminalPixelMode {
  kQuarterPixel ,
  kHalfPixel
}
 Pixel granularity for terminal rendering.
enum class  FontSource {
  Bundled ,
  System
}
 Where a font family in the FontCatalog originates. More...
enum class  FontCategory {
  SansSerif ,
  Serif ,
  Monospace ,
  Display ,
  Handwriting ,
  Unknown
}
 Coarse style bucket for a font family, used to give the picker variety and (later) to inform generic-family fallback. More...
enum class  FontFileFormat {
  Unknown ,
  Sfnt ,
  Woff2
}
 Encoded file format, independently of transport and consumer decoding state.
enum class  FontAssetState {
  Unavailable ,
  Absent ,
  Queued ,
  Fetching ,
  Ready ,
  Failed
}
 Availability of encoded bytes. Looking this up never starts a request.
enum class  FontFaceLoadState {
  WaitingForBytes ,
  WaitingForAdmission ,
  Resolving ,
  Loaded ,
  Failed
}
 State of one consumer's resolution, distinct from the availability of shared encoded bytes.
enum class  FontFaceWaitReason {
  None ,
  SharedDecodeSlot ,
  RetainedBudget
}
 What can make a deferred face eligible again. Consumer budgets are independent of the shared catalog decode slot; releasing another consumer's slot cannot repair retained-byte pressure.
enum class  FontDataTrust {
  Untrusted ,
  Trusted
}
 Declares whether font bytes come from a trusted local source. More...
enum class  ResourceLoaderError : uint8_t {
  NotFound ,
  SandboxViolation ,
  TooLarge
}
 Error codes for resource loading. More...
enum class  UrlLoaderError : uint8_t {
  NotFound ,
  UnsupportedFormat ,
  InvalidDataUrl ,
  DataCorrupt ,
  ResourceTooLarge
}
 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, ColorInterpolation value)
 Prints a color interpolation value.
std::ostream & operator<< (std::ostream &os, ColorInterpolationFilters cif)
 Ostream output operator for ColorInterpolationFilters.
std::ostream & operator<< (std::ostream &os, const Cursor &cursor)
 Human-readable output for diagnostics and tests.
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, FontKerning value)
 Writes the CSS keyword for a kerning policy.
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, FontSynthesisSmallCaps value)
 Write the CSS keyword for the given synthesis policy.
std::ostream & operator<< (std::ostream &os, FontSynthesisStyle value)
 Write the CSS keyword for a synthesis policy.
std::ostream & operator<< (std::ostream &os, FontVariant value)
 Ostream output operator for FontVariant enum, outputs the CSS value.
std::ostream & operator<< (std::ostream &os, HitTestMode mode)
 Output stream operator for HitTestMode.
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, MaskType value)
 Ostream output operator for MaskType.
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.
bool IsSimilarityTransform (const Transform2d &transform)
 Returns whether transform's linear part is a similarity: uniform scale combined with rotation and optionally reflection.
NonScalingStrokeMode ResolveNonScalingStrokeMode (VectorEffect vectorEffect, const Transform2d &worldFromEntity, bool geometryMustStayLocal)
 Resolves how an element's stroke is realized.
double EffectiveStrokeWidth (double authoredWidth, NonScalingStrokeMode mode, const Transform2d &worldFromEntity)
 Returns the stroke width the renderer expands the centerline by, in the space that centerline is stroked in: local space for NonScalingStrokeMode::Scaling and NonScalingStrokeMode::ScaledLocal, host space for NonScalingStrokeMode::HostSpace.
double StrokeCullHalfExtent (double strokeWidth, StrokeLinecap linecap, StrokeLinejoin linejoin, double miterLimit)
 Returns the furthest distance a stroke of strokeWidth can reach from its centerline.
std::ostream & operator<< (std::ostream &os, Overflow value)
 Ostream output operator for Overflow enum, outputs the CSS value.
std::ostream & operator<< (std::ostream &os, OverflowWrap value)
 Write the CSS keyword for the policy.
std::ostream & operator<< (std::ostream &os, PaintComponent value)
 ostream output operator for PaintComponent.
std::ostream & operator<< (std::ostream &os, const PaintOrder &value)
 ostream output operator for PaintOrder.
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.
std::ostream & operator<< (std::ostream &os, TextDecorationStyle style)
 Print a CSS text-decoration-style keyword.
std::ostream & operator<< (std::ostream &os, const TextDecorationThickness &thickness)
 Print a CSS decoration thickness value.
bool IsValidDecorationWidth (double value)
 Return whether a resolved width can enter renderer geometry.
double ResolveDecorationThickness (const TextDecorationThickness &thickness, double automatic, double underline, double deviceScale)
 Resolve a decoration width using the originating declaration and font metrics.
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 TextDecoration & operator|= (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, TextOrientation value)
 Writes the CSS keyword for p value.
std::ostream & operator<< (std::ostream &os, TextTransform value)
 Writes the CSS keyword for value.
std::ostream & operator<< (std::ostream &os, const TransformOrigin &origin)
 Ostream output operator.
std::ostream & operator<< (std::ostream &os, VectorEffect value)
 Output stream operator for VectorEffect, outputs the CSS string representation for this enum, e.g. "none", "non-scaling-stroke", etc.
std::ostream & operator<< (std::ostream &os, Visibility value)
 Ostream output operator for Visibility enum, outputs the CSS value.
constexpr bool PreservesSpaces (WhiteSpace value)
 Whether spaces and tabs retain their authored widths.
constexpr bool PreservesSegmentBreaks (WhiteSpace value)
 Whether source segment breaks force a new line.
constexpr bool AllowsSoftWrap (WhiteSpace value)
 Whether unforced line breaking is permitted.
std::ostream & operator<< (std::ostream &os, WhiteSpace value)
 Writes the CSS keyword for 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.
std::ostream & operator<< (std::ostream &os, const ClipPath &clip)
 Print a parsed clip-path value for diagnostics.
ParseResult< ClipPath > ParseBasicShapeClipPath (std::span< const css::ComponentValue > components, bool allowUserUnits)
 Parse a supported basic clipping shape and its optional reference box.
template<typename T>
std::ostream & operator<< (std::ostream &os, const std::optional< T > &value)
 Write an optional property's value, or none when no value is present.
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, Lengthd::Extent propertyExtent, Lengthd::Extent fallbackExtent)
 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, components::FilterExecutionBudget *executionBudget=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.
double BoundedPositiveFilterPixels (double value)
 Clamp a finite nonnegative radius to the filter-work bound.
double BoundedSignedFilterPixels (double value)
 Clamp a finite offset to the filter-work bound.
size_t FilterInputSlotCount (const components::FilterNode &node)
 The number of inputs a primitive reads through the filter attribute surface. feComposite, feBlend and feDisplacementMap each take a second input (in2); feMerge is variadic and reads exactly the list it was built with, and every other primitive reads at most one input. The cap of two is deliberate rather than a lower bound: those primitives never sample a third input, so an extra entry a caller appends must not widen the node's subregion either.
components::FilterInput FilterInputOrDefault (const components::FilterNode &node, size_t index)
 The input in slot index, or the default for a slot the graph left empty. A slot the graph never populated is an unspecified in/in2 attribute, and both resolve the same way: to the preceding primitive's result, which is SourceGraphic only when this node is the first primitive in the filter. Falling back to the node's own first input instead would silently composite, blend, or displace a buffer against itself.
double FilterDeviceScaleX (const Transform2d &transform)
 Device scale of the filter X axis.
double FilterDeviceScaleY (const Transform2d &transform, double scaleX)
 Device scale of the filter Y axis.
double FilterLengthInPixels (double value, double bound, double scale, bool objectBounds)
 Resolve an effect length in device pixels.
Vector2d FilterOffsetInPixels (Vector2d offset, Vector2d bounds, bool objectBounds, const Transform2d &transform)
 Resolve a filter offset vector in device coordinates.
const components::FilterNode * FilterFirstInputNode (const components::FilterGraph &graph, size_t index)
 The node a primitive's first input names, or nullptr when it reads a standard input.
Vector2d FinishFilterReach (Vector2d reach)
 Finish a device reach: one more pixel covers rounding at the reach's edge.
FilterInputMargin ComputeFilterSamplingReach (const components::FilterGraph &graph, const Transform2d &deviceFromFilter)
 Conservatively measure how far beyond each output pixel a filter graph reads its raster. Every primitive counts, including those fed only by generators: feFlood, feImage and feTurbulence produce output only over the raster, so a later blur or tile still needs the raster to extend past the viewport. Reaches add up, since chained primitives compound.
FilterInputMargin ComputeFilterInputMargin (const components::FilterGraph &graph, const Transform2d &deviceFromFilter)
 The input margin a filter layer's capture gets: the graph's sampling reach, or none when the capture must stay viewport-aligned (see components::FilterGraph::keepsViewportAlignedCapture and feTurbulence).
int FilterInputExtension (double beyond, double needed)
 Pixels to extend a filter input raster past one viewport edge.
FilterInputAxis LayoutFilterInputAxis (std::pair< double, double > region, double reach, std::optional< std::pair< double, double > > capture, int viewport)
 Lay out one raster axis.
FilterInputBuffer ComputeFilterInputBuffer (const components::FilterGraph &graph, const std::optional< Box2d > &filterRegion, const Transform2d &deviceFromFilter, int viewportWidth, int viewportHeight)
 Lay out the input raster for a filter layer over a viewportWidth by viewportHeight surface. Primitives that read input away from the output position need the filtered content just past the viewport, so the raster extends by the graph's input margin wherever the filter region extends past the viewport, up to the whole region for a graph with unbounded reach. Each axis stays within the surface dimension limit; a layout over the pixel limit falls back to the viewport. Renderers also fall back to the viewport when the larger raster would not fit the frame's filter budgets.
std::optional< Transform2d > FiniteFilterInverse (const Transform2d &deviceFromFilter)
 Invert only finite, nonsingular transforms whose inverse remains finite.
std::ostream & operator<< (std::ostream &out, GifEncoder::Error error)
 Ostream operator for GifEncoder::Error.
std::ostream & operator<< (std::ostream &os, ImageSamplingKernel kernel)
 ostream output operator for ImageSamplingKernel.
constexpr ImageSamplingKernel ImageSamplingKernelFor (ImageRendering imageRendering)
 Selects the raster resampling kernel for a resolved image-rendering value.
ImageSamplingKernel ImageSamplingKernelFor (ImageRendering imageRendering, const Transform2d &deviceFromImage)
 Selects the resampling kernel for drawing a raster through deviceFromImage.
std::vector< std::uint8_t > RasterizeImagePremultiplied (std::span< const std::uint8_t > premultipliedPixels, int sourceWidth, int sourceHeight, const Transform2d &deviceFromImage, int outputWidth, int outputHeight, ImageSamplingKernel kernel)
 Rasterizes a premultiplied image through an affine transform into a bounded device surface.
std::optional< PatternTileRasterMetrics > ComputePatternTileRasterMetrics (const Box2d &tileRect, const Transform2d &deviceFromPattern)
 Computes bounded raster dimensions for a logical pattern tile.
Transform2d TargetFromPatternRaster (const Transform2d &targetFromPattern, const Vector2d &rasterFromPatternScale)
 Converts a logical pattern-to-target transform into a raster-tile-to-target transform.
bool HasExactRgbaPayload (std::span< const std::uint8_t > rgbaPixels, int width, int height)
 Returns whether a byte span is exactly one tightly packed RGBA8 payload.
std::vector< std::uint8_t > PremultiplyRgba (std::span< const std::uint8_t > rgbaPixels)
 Convert tightly-packed straight-alpha RGBA8 to premultiplied RGBA8.
void PremultiplyRgbaInto (std::span< const std::uint8_t > rgbaPixels, std::vector< std::uint8_t > &out)
 Convert tightly-packed straight-alpha RGBA8 to premultiplied RGBA8, writing into a caller-owned buffer.
std::vector< std::uint8_t > CopyTightRgbaRows (std::span< const std::uint8_t > rgbaPixels, int width, int height, std::size_t rowBytes)
 Copy row-strided RGBA8 bytes into a tightly-packed RGBA8 buffer.
void CopyTightRgbaRowsInto (std::span< const std::uint8_t > rgbaPixels, int width, int height, std::size_t rowBytes, std::vector< std::uint8_t > &out)
 Copy row-strided RGBA8 bytes into a caller-owned tightly-packed buffer.
std::vector< std::uint8_t > PremultiplyRgbaRows (std::span< const std::uint8_t > rgbaPixels, int width, int height, std::size_t rowBytes)
 Convert row-strided straight-alpha RGBA8 to tightly-packed premultiplied RGBA8.
void PremultiplyRgbaRowsInto (std::span< const std::uint8_t > rgbaPixels, int width, int height, std::size_t rowBytes, std::vector< std::uint8_t > &out)
 Convert row-strided straight-alpha RGBA8 to tightly-packed premultiplied RGBA8, writing into a caller-owned buffer.
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::vector< std::uint8_t > UnpremultiplyRgbaRows (std::span< const std::uint8_t > rgbaPixels, int width, int height, std::size_t rowBytes)
 Convert row-strided premultiplied RGBA8 to tightly-packed straight-alpha RGBA8.
TextLayoutParams ToTextLayoutParams (const TextParams &params)
 Convert renderer-facing text parameters to the shared layout engine's input.
TextDrawGeometry PrepareTextDrawGeometry (Registry &registry, const components::ComputedTextComponent &text, const TextParams &params, TextEngine &textEngine)
 Resolve one backend draw from a shared element preparation or the direct-caller fallback.
Path TransformPath (const Path &path, const Transform2d &transform)
 Apply an affine transform to every point of a path.
Transform2d GlyphPlacementTransform (const TextGlyph &glyph)
 The affine that places a glyph's unplaced outline at its baseline position in the text element's local space.
GlyphOutlineAndPlacement UnplacedGlyphOutline (const TextEngine &textEngine, FontHandle font, const TextGlyph &glyph, float scale)
 Build a glyph's unplaced outline and its placement transform.
Path PlacedGlyphOutline (const TextEngine &textEngine, FontHandle font, const TextRun &run, const TextGlyph &glyph, float scale, double warpTolerance)
 Build the placed outline for a single glyph in document space.
GlyphFaceScale ResolveGlyphFace (const TextEngine &textEngine, const TextRun &run, const TextGlyph &glyph, float runScale, bool runBitmapOnly)
 Resolves the face that draws glyph.
Path WarpGlyphOutline (const Path &outline, const StretchedTextPath &mapping, const TextGlyph &glyph, double tolerance=Path::kLocalFlattenTolerance)
 Warp a glyph-local outline onto the perpendicular vectors of a stretched text path.
double TextWarpToleranceFor (const Transform2d &deviceFromLocal)
 Derive a path-local warp tolerance from a local-to-device transform.
Box2d ComputeTextBounds (const TextEngine &textEngine, const std::vector< TextRun > &runs)
 Compute the text element's bounding box for objectBoundingBox paint.
void ClearUnpaintedSpanGlyphs (const components::ComputedTextComponent &text, entt::entity spanEffectOwner, std::vector< TextRun > &runs)
 Drop the glyphs of runs this draw is not responsible for painting.
template<typename DrawFn>
void ForEachEmittingOrigin (std::span< const components::TextDecorationOrigin > origins, TextDecoration emittedLines, const DrawFn &draw)
 Call draw for each origin that has a line in emittedLines, so a paint pass skips origins it would draw nothing for before resolving their paint.
template<typename FillFn, typename StrokeFn>
void PaintFillAndStroke (const PaintOrder &paintOrder, const FillFn &fill, const StrokeFn &stroke)
 Run fill and stroke in the order paintOrder gives them; SVG 2 section 11.11 orders a decoration's own fill and stroke by the paint-order where it is declared.
void EmitTextDecorationPaths (const TextRun &run, const components::TextDecorationOrigin &origin, TextDecoration emittedLines, std::size_t originCount, float fontSize, const TextEngine &engine, const Transform2d &deviceFromLocal, std::size_t &remainingWork, const std::function< void(const Path &)> &emit)
 Emit bounded decoration paths while preserving each originating declaration.
RendererBitmap RenderDocumentsToAtlasBitmap (RendererInterface &renderer, std::span< const AtlasDocumentPlacement > placements, Vector2i atlasSizePx)
 Rasterize several documents into one render target and read it back once.
ImageParams BitmapBlitImageParams (ImageParams params)
 Returns params with the sampling policy for a bitmap blit, such as a compositor layer or tile raster.
std::size_t RetainedEntryBytes (const RetainedSpansComponent &entry)
 Returns everything an entry holds: recorded coverage, the paints kept beside it, and the entry itself.
void EnsureRetainedSpanInvalidationWired (Registry &registry)
 Connects the resolved-path invalidation listener to registry, once per registry.
RetainedSpanDocumentState & RetainedSpanStateFor (Registry &registry, std::size_t budgetBytes)
 Returns the document's retained-coverage state, creating it if needed.
void ClearRetainedSpans (Registry &registry)
 Drops every retained entry in registry and resets its accounting.
void EvictRetainedSpansToBudget (Registry &registry, std::uint64_t currentFrame)
 Evicts the coldest entries until the document is under budget.
std::span< const CatalogFontAsset > CatalogFontAssets ()
 The small, compiled catalog manifest; does not reference native embedded byte arrays.
std::ostream & operator<< (std::ostream &os, const FontFaceRequest &request)
 Ostream output operator, so test failures print the requested face instead of an opaque struct.
std::ostream & operator<< (std::ostream &os, const FontFaceAvailability &availability)
 Diagnostic output for dependency-bearing test failures and application logs.
std::ostream & operator<< (std::ostream &os, const FontFaceDependency &dependency)
 Print a dependency for diagnostic output.
std::optional< FontMetadata > ParseFontMetadata (std::span< const uint8_t > data)
 Parse CSS-relevant metadata from a raw OpenType/TrueType font file.
std::string_view ToString (ResourceLoaderError error)
 Convert a resource-loader error to a stable human-readable string.
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.
bool IsAnimationTarget (const SVGElement &element)
 Conservatively determine whether an animation may target element.
std::ostream & operator<< (std::ostream &os, FontResourcePreflight::Status status)
 Write the font-preflight status type and numeric value for diagnostics.
std::vector< SVGMatchedStyleRule > CollectMatchedStyleRules (const SVGElement &element)
 Collect stylesheet rules that match element.
std::vector< SVGStylesheetRule > CollectStylesheetRules (const SVGDocument &document, bool includeUserAgent=false)
 Collect source-backed author stylesheet rules in document, optionally with the built-in user agent stylesheet rules.
bool AuthorStyleDependsOnTreePosition (const SVGDocument &document)
 Return true when an author stylesheet rule in document matches on tree position.
std::optional< SVGStyleRuleAtSourceOffset > FindStyleRuleAtSourceOffset (const SVGDocument &document, std::size_t documentSourceOffset)
 Find the author stylesheet rule at documentSourceOffset.
constexpr bool IsBidiControlCodepoint (char32_t cp)
 Unicode Bidi_Control characters affect ordering but consume no SVG character position.
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.
std::optional< TextStyleContext > BuildShadowTextStyleContext (Registry &registry, Entity root, const components::ComputedTextComponent &text, std::size_t *remainingWork=nullptr)
 Build the bounded authored-to-occurrence style mapping for one shadow text root.
std::optional< Vector2d > MapTextPathPoint (const StretchedTextPath &mapping, const TextGlyph &glyph, const Vector2d &point)
 Map one glyph-local point through a stretched text-path placement.
Path WarpTextPathOutline (const Path &outline, const StretchedTextPath &mapping, const TextGlyph &glyph, double tolerance=kDefaultTextPathWarpTolerance)
 Warp glyph outline endpoints and control points along text-path perpendiculars.
Path PlaceStretchedTextPathOutline (Path outline, const TextRun &run, const TextGlyph &glyph, double tolerance=kDefaultTextPathWarpTolerance)
 Apply glyph-local authored rotation and the shared nonlinear text-path mapping.
Path PlaceStretchedTextPathCell (const TextRun &run, const TextGlyph &glyph, double emTop, double emBottom, double tolerance=kDefaultTextPathWarpTolerance)
 Build and place the full-font glyph cell for a stretched horizontal run.
FontHandle GlyphFont (const TextRun &run, const TextGlyph &glyph)
 Returns the face that draws glyph: its fallback face when it has one, otherwise the run's.
int RunDonnerSvgTool (int argc, char *argv[], std::ostream &out, std::ostream &err)
 Run the donner-cli command line tool.
std::string BuildCssSelectorPath (const SVGElement &element)
 Build a CSS-like selector path for an element.
std::optional< std::filesystem::path > ResourceSandboxRootForAbsoluteInput (const std::filesystem::path &absoluteInputPath)
 Return the narrowest sandbox root for an absolute input document path.
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.
std::optional< std::span< const uint8_t > > FindSfntTable (std::span< const uint8_t > data, std::string_view tag)
 Read a 32-bit big-endian unsigned integer from p.
uint32_t ReadBe32 (const uint8_t *p)
 Read a 32-bit big-endian unsigned integer from p.
bool ValidateSfnt (std::span< const uint8_t > data)
 Return true when data passes the bounded sfnt and outline validation policy.
std::string EscapeTerminalText (std::string_view text, bool preserveNewlines=false)
 Escape untrusted bytes and terminal format controls while preserving printable UTF-8.

Variables

constexpr std::string_view kUserAgentStylesheet
 The user agent stylesheet to be used by default on all SVG documents.
constexpr size_t kElementTypeCount = static_cast<size_t>(ElementType::Use) + 1
 Number of distinct ElementType values, for sizing arrays indexed by element type.
constexpr std::int64_t kMaxImageSamplingDimension = 16384
 Maximum output axis of a materialized procedural image-sampling surface.
constexpr std::size_t kMaxImageSamplingSurfacePixels = 16 * 1024 * 1024
 Maximum pixels in one materialized image-sampling surface.
constexpr int kMaxPatternTileRasterDimension = 4096
 Maximum accepted raster dimension for one pattern-tile axis.
constexpr TextDecoration kDecorationLinesBeneathText
 Lines that CSS Text Decoration 3 paints beneath a run's glyphs; line-through paints above them.
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, 71 > kSVGPresentationAttributeNames
 Compile-time array of SVG presentation attributes and geometry attributes. Each entry is an attribute name string (e.g. "fill", "stroke", "transform").
constexpr size_t kMaximumTextPathWarpExpansion = 256u
constexpr double kDefaultTextPathWarpTolerance = 0.1

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:29
const std::vector< ParseDiagnostic > & warnings() const
Access the collected warnings.
Definition ParseWarningSink.h:79
bool hasWarnings() const
Returns true if any warnings have been added.
Definition ParseWarningSink.h:82

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; stroke: white");
}
Represents a parsed SVG document containing a tree of SVGElement nodes.
Definition SVGDocument.h:106
std::optional< SVGElement > querySelector(std::string_view selector)
Find the first descendant of the root <svg> element, in document order, that matches the given CSS se...

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 (tiny-skia by default,...
Definition Renderer.h:82
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.

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.

Class Members
Lengthd x X coordinate.
Lengthd y Y coordinate.

◆ donner::svg::DetachedNodeDiagnostics

struct donner::svg::DetachedNodeDiagnostics

Summary of detached-node collection state.

Class Members
size_t collectedInLastPass = 0 Roots destroyed in the last pass.
bool isCollecting = false True while collection is active.
uint32_t maxPublicHandlesOnRetainedRoot = 0 Max handles on a retained root.
uint64_t maxRetainedSnapshotOrObserverEpoch = 0 Future epoch retention high-water.
size_t queuedDetachedRoots = 0 Detached roots pending collection.
size_t retainedByPublicHandles = 0 Queued roots currently retained by public handles.
size_t retainedByPublicHandlesInLastPass = 0 Roots skipped in the last pass.
size_t retainedBySnapshotOrObserverEpochs = 0 Roots skipped due to future epochs.

◆ donner::svg::DocumentAccessDiagnostics

struct donner::svg::DocumentAccessDiagnostics

Summary of document access and lock state.

Class Members
uint32_t activeReadLocks = 0 Shared read locks currently held.
uint64_t maxReadLockHeldNs = 0 Longest read-lock hold time in nanoseconds.
uint64_t maxWriteLockHeldNs = 0 Longest write-lock hold time in nanoseconds.
uint64_t readAccesses = 0 Read access guards created in ConcurrentDom.
uint64_t readLocksAcquired = 0 Shared locks acquired by read guards.
uint64_t reentrantReadAccesses = 0 Read guards nested inside a write guard.
uint64_t reentrantWriteAccesses = 0 Write guards nested inside a write guard.
uint64_t totalReadLockHeldNs = 0 Total read-lock hold time in nanoseconds.
uint64_t totalWriteLockHeldNs = 0 Total write-lock hold time in nanoseconds.
uint64_t writeAccesses = 0 Write access guards created in ConcurrentDom.
bool writeLockHeld = false True while a unique write lock is held.
uint64_t writeLocksAcquired = 0 Unique locks acquired by write guards.

◆ donner::svg::DocumentMutationRecord

struct donner::svg::DocumentMutationRecord

One committed document mutation revision.

Class Members
uint64_t revision = 0 Document revision after the mutation committed.
uint64_t sequence = 0 Monotonic mutation-log sequence number.

◆ donner::svg::DocumentMutationLogSnapshot

struct donner::svg::DocumentMutationLogSnapshot

Snapshot of mutation-log records after a caller-owned sequence number.

Class Members
uint64_t latestSequence = 0 Latest sequence in the document.
bool missedRecords = false True if older records were truncated.
vector< DocumentMutationRecord > records Mutation records newer than the caller cursor.

◆ donner::svg::FilterInputMargin

struct donner::svg::FilterInputMargin

Input a filter layer's capture must include beyond each output pixel, in device pixels.

Class Members
Vector2d captureReach Input read beyond userCapture by the primitives feeding it.
Vector2d pixels Farthest input read from an output pixel, per axis.
optional< Box2d > userCapture User-space rectangle the capture must cover in full.
bool wholeRegion = false Some primitive can read any position in its input.

◆ donner::svg::FilterInputAxis

struct donner::svg::FilterInputAxis

One axis of a FilterInputBuffer.

Class Members
int before = 0 Pixels before the viewport.
int extent = 0 Total pixels.

◆ donner::svg::FilterRegionSample

struct donner::svg::FilterRegionSample

Resolved clipping bounds and optional un-clipped animated geometry, in user coordinates.

Class Members
optional< Box2d > animatedRegion Un-clipped region for image placement when sampled.
Box2d bounds Clip region, intersected with the filter region.

◆ donner::svg::PatternTileRasterMetrics

struct donner::svg::PatternTileRasterMetrics

Validated dimensions and scale for a rasterized pattern tile.

Class Members
int pixelHeight
int pixelWidth
Vector2d rasterFromPatternScale

◆ donner::svg::PreparedTextDraw

struct donner::svg::PreparedTextDraw

Immutable layout slice and full-element bounds prepared once for a text effect owner.

Class Members
Box2d elementBounds
vector< TextRun > runs

◆ donner::svg::TextDrawGeometry

struct donner::svg::TextDrawGeometry

Mutable per-call run copy after effect ownership and visibility filtering.

Class Members
Box2d elementBounds
vector< TextRun > runs

◆ donner::svg::GlyphOutlineAndPlacement

struct donner::svg::GlyphOutlineAndPlacement

A glyph's outline split into the part that depends only on the glyph and the part that depends only on where the glyph sits in the run.

The two compose back into the placed outline: TransformPath(outline, glyphFromLocal) maps to the same place PlacedGlyphOutline does. It is not the same arithmetic - that one composes the placement into a single affine - so the two agree as mappings, not bit for bit, whenever a rotation is present.

Splitting them lets a renderer key a cache on glyph identity (font, glyph index, effective scale, stretch, rotation) and reuse one outline for every occurrence, carrying the per-occurrence placement as a transform instead of re-deriving and re-transforming the outline for each one.

Class Members
Transform2d glyphFromLocal Pure translation placing outline at its baseline position in the text element's local space.
Path outline Raw glyph outline at the glyph's effective scale, with the lengthAdjust stretch and the per-glyph rotation already baked in. Empty for .notdef and for glyphs with no vector outline.

◆ donner::svg::GlyphFaceScale

struct donner::svg::GlyphFaceScale

The face that draws one glyph, with its outline scale and whether it has only bitmap glyphs.

Class Members
bool bitmapOnly = false True when font has no vector outlines.
FontHandle font Face that draws the glyph.
float scale = 0.0f scaleForPixelHeight of font at the run's used size.

◆ donner::svg::AtlasDocumentPlacement

struct donner::svg::AtlasDocumentPlacement

Placement of one document inside a shared atlas render target.

See also
RenderDocumentsToAtlasBitmap
Class Members
SVGDocument * document = nullptr Document to rasterize. Must outlive the atlas call; null entries are skipped.

Outliving the call is a hard requirement, not a lifetime convenience. A GPU backend keeps each document's resident geometry and bind groups in state owned by that document and consumes them when the frame is submitted, so a document released before this call returns frees buffers the recorded draws still reference and its tile comes back blank. Callers bounding peak memory must therefore shrink the batch, not shorten a document's lifetime inside one.

Vector2i originPx = Vector2i::Zero() Top-left corner of this document's tile, in atlas device pixels.

◆ 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 beginFrame to endFrame window. Counters are the durable CI signal. GPU timestamps are not captured yet, so the GPU-timestamp fields are always zero.

GeodePerf_tests.cc pins the steady-state ceilings these drive toward.

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::RendererGeodeTexturePoolStats

struct donner::svg::RendererGeodeTexturePoolStats

Retained-memory instrumentation for RendererGeode's transient texture pool.

Counts include only free textures available for cross-frame reuse, not textures currently in use by an active frame or the renderer's primary target.

Class Members
size_t bucketCount = 0 Number of non-empty exact-size texture buckets.
uint64_t budgetBytes = 0 Hard upper bound for retained bytes.
uint64_t bytes = 0 Estimated GPU bytes retained by reusable textures.
size_t textureCount = 0 Number of reusable textures currently retained by the pool.

◆ donner::svg::RenderViewport

struct donner::svg::RenderViewport

Describes the viewport for a render pass.

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::RendererReadbackStats

struct donner::svg::RendererReadbackStats

Aggregate diagnostics for CPU readbacks run by a renderer and any offscreen instances that share its backend device, plus the device-health outcome those readbacks observed.

Class Members
uint64_t bindgroupCreates = 0
uint64_t bufferCreates = 0
uint64_t captureCancellations = 0 Capture cancellation and total-budget expiry, independent of device loss.
uint64_t captureTimeouts = 0
uint64_t contextCreates = 0 Readback-only contexts and the allocation/submission work they performed.
int count = 0 Readback buffer-map waits run since the last consume, including waits that were cancelled or timed out.
bool deviceLost = false True once the backend device has been declared lost. Sticky: a device that hangs never recovers, and a caller whose frame produced nothing has no other evidence to report.
int pollIterations = 0 Bounded wait iterations those readbacks ran. A wait cancelled or past its deadline before its first iteration adds none.
uint64_t poolBytes = 0
uint64_t poolEntries = 0 Idle pooled readback sets and their logical backing bytes.
uint64_t sharedTextureTailBytes = 0 Bytes of this renderer's released textures still resident because another context still reads them. Allocation accounting no longer counts them, so a working set adds these.
uint64_t submits = 0
uint64_t textureCreates = 0
int timedOutWaitMs = 0 Wall time that wait spent before giving up, in milliseconds. Zero while timedOutWaitSite is GpuWaitTimeoutSite::None.
GpuWaitTimeoutSite timedOutWaitSite = GpuWaitTimeoutSite::None Which bounded wait declared that loss, when a deadline did.
bool usedTimedWaitAny = false True when any of those waits blocked on the map's completion event rather than only polling for it.

◆ donner::svg::RendererResourceStats

struct donner::svg::RendererResourceStats

Bounded-resource diagnostics for the most recently started render frame.

Class Members
bool drawBudgetRejected = false
bool drawBudgetSupported = false
size_t drawCalls = 0
bool filterBudgetRejected = false
bool filterBudgetSupported = false
uint64_t filterCaptureBytesReserved = 0
uint64_t filterExecutions = 0
uint64_t filterRetainedBytes = 0
uint64_t filterWorkUnits = 0
bool geometryBudgetRejected = false
bool geometryBudgetSupported = false
size_t geometryDraws = 0
size_t geometryItems = 0
size_t geometryRetainedBytes = 0
size_t gradientStops = 0
uint64_t imageBytes = 0
size_t imageDraws = 0
size_t pathCommands = 0
bool pathMeasurementWorkSupported = false
size_t pathMeasurementWorkUnits = 0
bool surfaceBudgetRejected = false
bool surfaceBudgetSupported = false
uint64_t surfaceBytes = 0
size_t surfaceCount = 0
size_t textGlyphDecodeWork = 0
size_t textGlyphOccurrences = 0
bool textMaterializationBudgetRejected = false
bool textMaterializationBudgetSupported = false
uint64_t textMaterializationBytes = 0
size_t textMaterializationCommands = 0
size_t textMaterializationPoints = 0
size_t textUniqueOutlines = 0

◆ donner::svg::ClipPathShape

struct donner::svg::ClipPathShape

One resolved clip-path shape, owned by the ResolvedClip that holds it.

Unlike PathShape this owns its geometry: a ResolvedClip is copied into render snapshots that outlive the document registry, so it cannot borrow from the source ComputedClipPathsComponent.

Class Members
FillRule fillRule = FillRule::NonZero
size_t groupPathCount = 0 Nonzero for a group marker whose geometry is the preceding counted record span.
int layer = 0 Nested paths precede their referencing shape at a greater layer index. Their union intersects only that shape; resulting sibling shapes at the same layer are unioned.
Transform2d parentFromEntity Transform from clip path child to the clip path's coordinate system.
Path path

◆ donner::svg::PaintParams

struct donner::svg::PaintParams

Paint state derived from resolved style for the current node.

Class Members
Color currentColor = css::Color(css::RGBA()) CurrentColor value for paint server resolution.
bool drawFillComponent = true When paint-order reorders fill and stroke around markers, the driver issues a shape draw per paint component, restricting which of fill/stroke a single drawPath/drawRect/drawEllipse call emits. Defaults to drawing both in the usual fill-then-stroke order.
bool drawStrokeComponent = true
See also
drawFillComponent
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.

Class Members
ImageRendering imageRendering = ImageRendering::Auto Resolved CSS image sampling policy.
bool imageRenderingPixelated = false Legacy source-compatibility switch. New callers set imageRendering.
EntityHandle sourceEntity Source entity the drawn image was loaded onto. Set by the driver at the drawImage call site. Backends that cache a converted form of the pixels key off this, the same way PathShape::sourceEntity keys converted geometry. A null EntityHandle (the default) means "no associated entity" - non-driver callers leave it null and backends fall back to converting per draw.
Box2d targetRect Destination rectangle in device-independent units.

◆ donner::svg::TextParams

struct donner::svg::TextParams

Parameters describing how text is drawn and outlined.

Class Members
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
double inlineSizePx = 0.0 SVG2 inline-size measure in pixels. > 0 wraps horizontal or vertical text to this measure; 0 = no wrapping area.
See also
https://www.w3.org/TR/SVG2/text.html#InlineSizeProperty
LengthAdjust lengthAdjust = LengthAdjust::Default
double letterSpacingPx = 0.0 Extra spacing added after each character (CSS letter-spacing). 0 = normal.
shared_ptr< const PreparedTextDraw > preparedTextDraw Optional driver-prepared runs for this draw. Shared ownership keeps them alive through the synchronous backend call; the runs align with the text spans passed to drawText.
entity spanEffectOwner = entt::null Paints only the spans whose effectOwner matches this entity. entt::null selects the spans that no span-level clip-path, mask, or filter claims, which is what the text root's own draw paints.
Color strokeColor = css::Color(css::RGBA())
StrokeParams strokeParams
TextAnchor textAnchor = TextAnchor::Start
TextDecoration textDecoration = TextDecoration::None
double textIndentPx = 0.0 Computed CSS first-line start margin for a positive inline-size area; paths ignore it.
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::RendererTinySkiaFrameCounters

struct donner::svg::RendererTinySkiaFrameCounters

Per-frame counts of the conversions RendererTinySkia caches.

Reset at every RendererTinySkia::beginFrame, so a read after a frame reports that frame's work alone. Both count only the conversion sites the caches cover, not every conversion the backend performs. Both are zero on a settled frame of an unchanged document, because every cached shape and image is served from its per-entity cache; that invariant is what keeps the caches from silently regressing into per-draw conversions, so it is pinned by a test.

Class Members
uint64_t imagePremultiplies = 0 Straight-alpha -> premultiplied image conversions performed for <image> draws, the only site the image cache covers. Layer and bitmap composites premultiply their own payloads outside the cache and are not counted.
See also
pathConversions
uint64_t pathConversions = 0 donner::Path -> tiny_skia::Path conversions performed at the shape-draw call sites the path cache covers: cache misses plus shape draws that carry no source entity to cache on. Conversions the cache does not reach are not counted, so this is not a total for the frame; clip-path shapes and text glyph and decoration outlines convert outside it.
uint64_t textGlyphMaterializations = 0 Vector-outline or bitmap materializations attempted for text glyphs in this frame.

◆ donner::svg::RetainedSpanStats

struct donner::svg::RetainedSpanStats

Counters describing what a renderer's retained coverage did, for tests and benchmarks.

Counts are per fill or stroke pass of a shape draw, and cover the frame most recently drawn. Draw kinds retention does not reach at all (text, images, layer composites) are not counted here at all, not even as bypassed.

Class Members
uint64_t bypassedDraws = 0 Passes retention did not apply to.
uint64_t capturedDraws = 0 Passes that rasterized and recorded their coverage.
bool documentDisabled = false Whether the document fell back to immediate mode.
uint64_t evictions = 0 Entries evicted to stay under budget.
uint64_t invalidatedDraws = 0 Captures that replaced a recording whose key changed.
size_t liveBytes = 0 Bytes retained by the document at the end of the frame.
uint64_t refusedReplays = 0 Draws whose recording was refused at replay, which then rasterized instead. A refusal is the surface-size guard doing its job, never a dropped shape.
uint64_t replayedDraws = 0 Passes served from retained coverage.
uint64_t unrecordableDraws = 0 Draws that could not be recorded (a tiled surface, or a blit the packed record cannot hold). The pixels are painted regardless.

◆ donner::svg::StrokeParams

struct donner::svg::StrokeParams

Stroke configuration used for path and primitive drawing.

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.

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.

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.

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.

Class Members
RGBA lower
RGBA upper

◆ donner::svg::TerminalCell

struct donner::svg::TerminalCell

Aggregated subpixel data for a terminal cell.

Class Members
HalfBlock half
TerminalPixelMode mode
QuarterBlock quarter

◆ donner::svg::CatalogFontAsset

struct donner::svg::CatalogFontAsset

Build-pinned catalog metadata. Runtime responses never add entries or choose package paths.

Class Members
FontCategory category = FontCategory::Unknown
string contentId SHA-256 of the encoded WOFF2 bytes, in lowercase hexadecimal.
size_t decodedBytes = 0
size_t encodedBytes = 0
string family
string packagePath

◆ donner::svg::FontFaceAdmission

struct donner::svg::FontFaceAdmission

Nonblocking admission result. Synchronous custom providers need no reservation by default.

Class Members
unique_ptr< FontFaceLoadReservation > reservation
FontFaceLoadState state = FontFaceLoadState::Resolving
FontFaceWaitReason waitReason = FontFaceWaitReason::None

◆ donner::svg::FontDataRenderingOptions

struct donner::svg::FontDataRenderingOptions

Owned rendering attributes for a provider face reloaded from encoded bytes.

These values configure the new face before a backend can cache it. They do not name or query a provider, and do not associate the face with a CSS family.

Class Members
bool genericSans = false The source face belongs to the generic sans-serif provider.
bool immutableCatalog = false The source face belongs to an immutable font catalog.
optional< FontFaceRequest > providerRequest Requested weight, style and stretch.

◆ donner::svg::FontLoadingDomainIdentity

struct donner::svg::FontLoadingDomainIdentity

Non-owning identity of an installed font-loading domain.

Compare owner control blocks, including after expiration. The allowance conservatively accounts for the fixed coallocation kept alive by a weak reference, not live font data or physical RSS.

Class Members
weak_ptr< const void > owner Does not retain the source or its resources.
size_t retainedStorageBytes = 0 Conservative fixed weak-identity storage allowance.

◆ donner::svg::FontMetadata

struct donner::svg::FontMetadata

Metadata extracted from a raw OpenType/TrueType font file.

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.

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.

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::SVGAnimationEventBatch

struct donner::svg::SVGAnimationEventBatch

Bounded lifecycle query result. An incomplete query returns no partial events.

Examples
svg_animation.cc.
Class Members
bool complete = true False for invalid bounds or budget exhaustion.
vector< SVGAnimationEvent > events Boundaries sorted by document time.

◆ donner::svg::SVGStylesheetDeclaration

struct donner::svg::SVGStylesheetDeclaration

Parsed declaration within a stylesheet rule, with an optional document source range.

Class Members
Declaration declaration Parsed CSS declaration.
size_t declarationIndex = 0 Index within the rule.
optional< SourceRange > declarationSourceRange Declaration range in SVG source.

◆ donner::svg::SVGStylesheetRule

struct donner::svg::SVGStylesheetRule

Stylesheet rule in a document; built-in rules have no document source ranges.

Class Members
vector< SVGStylesheetDeclaration > declarations Rule declarations.
bool isUserAgentStylesheet = false True for a built-in rule without document source ranges.
size_t ruleIndex = 0 Index within the stylesheet.
optional< SourceRange > ruleSourceRange Rule range in SVG source.
optional< SourceRange > selectorSourceRange Selector range in SVG source.
Entity stylesheetEntity = entt::null Owning <style> or <svg> element key.

◆ donner::svg::TextGlyphOutline

struct donner::svg::TextGlyphOutline

A single placed glyph outline paired with the element that painted it.

source is the text-content element (<text>, <tspan>, <a>, or <textPath>) whose computed style (fill, stroke, opacity, paint-server reference, currentColor, ...) colors this glyph. Callers that must preserve per-span paint - such as "Convert Text to Outlines" - resolve paint from source.getComputedStyle() rather than from the text root's attributes alone.

Class Members
Path path Glyph outline in text-element local coordinates.
SVGElement source Text-content element whose computed style paints this glyph.

◆ 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 Extra spacing between lines. x-height in design units, from OS/2 sxHeight or the lowercase x glyph's top bearing. Zero means neither metric is available.
int unitsPerEm = 0 Number of design units in one em, or zero when unavailable.
int xHeight = 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.

Baseline alignment (dominant-baseline / alignment-baseline) is resolved per span into donner::svg::components::ComputedTextComponent::TextSpan::alignmentBaseline rather than carried here, since each span may resolve a different baseline.

Class Members
SmallVector< RcString, 1 > fontFamilies
FontKerning fontKerning = FontKerning::Auto
FontMetrics fontMetrics
Lengthd fontSize
optional< double > fontSizeAdjust
double inlineSizePx = 0.0 SVG2 inline-size measure in pixels. When greater than 0 (and the writing mode is horizontal or vertical), the engine wraps glyph runs to this measure, producing stacked lines. 0 means no wrapping area (ordinary single-line SVG text).
See also
https://www.w3.org/TR/SVG2/text.html#InlineSizeProperty
LengthAdjust lengthAdjust = LengthAdjust::Default
double letterSpacingPx = 0.0
TextAnchor textAnchor = TextAnchor::Start
double textIndentPx = 0.0 Signed CSS first-line start margin in pixels. Used only with a positive inlineSizePx; percentages resolve against the own-area measure before layout; em computes in style. Does not affect text paths.
optional< Lengthd > textLength
Box2d viewBox
double wordSpacingPx = 0.0
WritingMode writingMode = WritingMode::HorizontalTb

◆ donner::svg::StretchedTextPath

struct donner::svg::StretchedTextPath

Shared path mapping used to warp glyph outlines for textPath method="stretch".

Class Members
bool closed = false
bool linear = false
MeasuredPath measuredPath
shared_ptr< TextPathMeasurementReservation > measurementReservation
vector< double > segmentEndDistances
double startOffset = 0.0

◆ donner::svg::ResolvedTextFont

struct donner::svg::ResolvedTextFont

Resolved face and used font size for layout or declaring-element decoration metrics.

Class Members
FontHandle font
float usedSizePx = 0.0f

◆ donner::svg::TextGlyph

struct donner::svg::TextGlyph

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

Produced by the text engine for simple and full shaping backends.

Class Members
bool absoluteInlinePosition = false This visual chunk origin applies an authored horizontal absolute position.
bool allowSyntheticOblique = true Immutable outline policy resolved from the source span and its requested font style.
uint32_t cluster = 0 Byte offset into the span text for the glyph's source cluster. Byte offset of the SVG positioning group; absent uses the source cluster.
bool emergencyBreakBefore = false A safe emergency boundary precedes this visual glyph group after contextual shaping.
bool emergencyLineStart = false First visual group of a planned line, retaining logical order between backward lines.
FontHandle font Face for a cluster that the run's face cannot render; null when TextRun::font renders it. Use GlyphFont to resolve the face that draws the glyph.
float fontSizeScale = 1.0f Per-glyph font size multiplier (< 1.0 for small-caps).
int glyphIndex = 0 Glyph index (backend-specific: stbtt or HarfBuzz).
bool hangingBefore = false Preserved logical end space hanging before a backward line's visual content.
optional< uint32_t > positioningCluster
bool rightToLeft = false Resolved horizontal source-character direction. Global visual adjacency for source-span decoration continuity; absent on legacy layouts.
double rotateDegrees = 0 Per-glyph rotation in degrees.
bool sideways = false
float stretchScaleX = 1.0f Additional X-axis glyph stretch from lengthAdjust.
float stretchScaleY = 1.0f Additional Y-axis glyph stretch from lengthAdjust.
optional< double > textPathLocalRotateDegrees Authored rotation before path warping. True when vertical layout set this glyph sideways, a quarter turn from upright, so the glyph's own x axis runs along the inline axis.
double textPathNormalOffset = 0.0 Offset from the path along its left normal.
optional< double > textPathOrigin Logical path distance for a stretched outline origin.
double verticalOriginOffset = 0 Inline-axis distance from the pen position to an upright vertical glyph's origin, already included in yPosition. Zero for horizontal and sideways glyphs.
optional< uint32_t > visualOrder
double xAdvance = 0 Horizontal advance; staged paths use canonical local X.
double xKern = 0 Kerning adjustment applied before this glyph (for path layout).
double xPosition = 0 Absolute X position for this glyph.
double yAdvance = 0 Flat vertical advance; zero after text-path staging.
double yPosition = 0 Absolute Y baseline position.

◆ donner::svg::TextRun

struct donner::svg::TextRun

A run of positioned glyphs laid out with one primary face.

Clusters that face cannot render carry their fallback face in TextGlyph::font.

Class Members
FontHandle font Primary font handle for this run.
vector< TextGlyph > glyphs Positioned glyphs.
bool onPath = false True if glyphs are positioned along a textPath.
shared_ptr< const StretchedTextPath > stretchedTextPath Shared nonlinear path mapping.
bool textLengthAppliedOnPath True when path placement consumed this run's textLength.
float usedFontSizePx = 0.0f Font size used for shaping, including font-size-adjust.

◆ 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.

◆ ColorInterpolation

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

Values of the inherited color-interpolation property. Luminance masks use this color space.

Enumerator
Auto 

Let the renderer choose its color space; luminance masks use sRGB.

SRGB 

Use sRGB color values.

LinearRGB 

Convert color values to linear RGB.

Default 

Initial color space.

◆ 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.

ContextMenu 

A context menu is available.

Progress 

The application is busy but interaction remains possible.

Cell 

A table cell or cell collection can be selected.

VerticalText 

Vertical text can be selected.

Alias 

An alias or shortcut will be created.

Copy 

Content will be copied.

NoDrop 

A dragged item cannot be dropped here.

AllScroll 

Content can be scrolled in any direction.

EWResize 

Bidirectional east-west resize.

NSResize 

Bidirectional north-south resize.

NESWResize 

Bidirectional north-east to south-west resize.

NWSEResize 

Bidirectional north-west to south-east resize.

◆ 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. Also text-after-edge / after-edge.

Alphabetic 

Align to the alphabetic baseline.

Ideographic 

Align to the ideographic baseline.

Middle 

Align to the middle of the x-height.

Central 

Align to the central baseline (middle of the em box).

Mathematical 

Align to the mathematical baseline.

Hanging 

Align to the hanging baseline.

TextTop 

Align to the top of the text. Also text-before-edge / before-edge.

UseScript 

Deprecated SVG 1.1 keyword; behaves like DominantBaseline::Auto.

NoChange 

Deprecated SVG 1.1 keyword; uses the parent's dominant baseline.

ResetSize 

Deprecated SVG 1.1 keyword; behaves like DominantBaseline::Auto.

◆ 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
A 

<a>

Animate 

<animate>, value animation element.

AnimateMotion 

<animateMotion>, motion animation.

AnimateTransform 

<animateTransform>, transform animation element.

Circle 

<circle>

ClipPath 

<clipPath>

Defs 

<defs>

Desc 

<desc>

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 

<g>

Image 

<image>

Line 

<line>

LinearGradient 

<linearGradient>

Marker 

<marker>

Mask 

<mask>

MPath 

<mpath>, motion path reference.

Metadata 

<metadata>

Path 

<path>

Pattern 

<pattern>

Polygon 

<polygon>

Polyline 

<polyline>

RadialGradient 

<radialGradient>

Rect 

<rect>

Set 

<set>, discrete animation element.

Stop 

<stop>, for gradient stops.

Style 

<style>

SVG 

<svg>, SVG root element.

Switch 

<switch>

Symbol 

<symbol>

Text 

<text>

TextPath 

<textPath>

Title 

<title>

TSpan 

<tspan>

Unknown 

For unknown elements.

Use 

<use>

◆ 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.

◆ FontCategory

enum class donner::svg::FontCategory
strong

Coarse style bucket for a font family, used to give the picker variety and (later) to inform generic-family fallback.

Best-effort: Unknown is used when a provider cannot classify a family.

◆ FontDataTrust

enum class donner::svg::FontDataTrust
strong

Declares whether font bytes come from a trusted local source.

Enumerator
Untrusted 

Document-provided or otherwise attacker-controlled bytes.

Trusted 

Embedded, system, or explicitly trusted application bytes.

◆ FontKerning

enum class donner::svg::FontKerning : uint8_t
strong

Computed CSS font-kerning policy. Auto currently enables kerning at every size.

Enumerator
Auto 

The user agent selects when to apply kerning.

Normal 

Apply font kerning.

None 

Suppress font kerning.

◆ FontSource

enum class donner::svg::FontSource
strong

Where a font family in the FontCatalog originates.

The picker groups families by source, and resolution prefers Bundled over System (see FontCatalog and FontManager).

Enumerator
Bundled 

Bundled with the build (curated fonts supplied by the application package).

System 

Discovered from the host OS (CoreText on macOS; none on other platforms).

◆ 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.

◆ FontSynthesisSmallCaps

enum class donner::svg::FontSynthesisSmallCaps : uint8_t
strong

Whether the CSS font-synthesis-small-caps property permits synthetic small caps.

Enumerator
Auto 

Permit synthesis when the selected face lacks native small caps.

None 

Use native small caps when available, but never synthesize them.

◆ FontSynthesisStyle

enum class donner::svg::FontSynthesisStyle : uint8_t
strong

CSS permission to synthesize an oblique face when a matching designed face is absent.

Enumerator
Auto 

Permit the backend's existing synthetic oblique behavior.

None 

Never synthesize an oblique outline.

ObliqueOnly 

Permit synthesis for oblique requests, but not italic requests.

◆ 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.

◆ GpuWaitTimeoutSite

enum class donner::svg::GpuWaitTimeoutSite : uint8_t
strong

Bounded CPU-blocks-on-GPU wait that exceeded its deadline and caused a renderer backend to declare its device lost.

Backend-neutral mirror of the GPU backend's own wait vocabulary, so a consumer of RendererReadbackStats can distinguish the two very different hangs without depending on a graphics API. Backends that never block on the GPU always report GpuWaitTimeoutSite::None.

Enumerator
None 

No bounded wait has timed out. A device reported lost with this site was reported by the driver, not by a deadline. This is a positive claim, so never use it as a fallback for a site that could not be translated - see GpuWaitTimeoutSite::Unknown.

ReadbackMap 

A buffer-map wait for GPU-to-CPU readback.

QueueIdle 

A wait for the GPU queue to drain.

Present 

A present's wait for its frame's own work before the frame is shown.

Unknown 

A backend wait this build cannot name. Reported rather than folded into GpuWaitTimeoutSite::None so a report never claims the driver declared a loss that one of the backend's own deadlines actually did.

◆ 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.

◆ HitTestMode

enum class donner::svg::HitTestMode
strong

Select whether a hit query follows SVG interaction rules or targets editable artwork.

Enumerator
SvgPointerEvents 

Honor the element's computed pointer-events property.

EditorSelection 

Test visible painted geometry regardless of pointer-events.

◆ 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-defined; Donner uses the Mitchell cubic, like resvg.

OptimizeSpeed 

Legacy alias with the same behavior as crisp-edges.

OptimizeQuality 

CSS Images aliases this to smooth; Donner follows resvg, which renders it with the Mitchell cubic.

CrispEdges 

Preserves contrast without blending source colors.

Pixelated 

Integer nearest-neighbor scale followed by smooth scaling.

Smooth 

Bilinear interpolation.

HighQuality 

High-quality smooth scaling; Donner samples it like auto.

◆ ImageSamplingKernel

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

Resampling kernel a backend applies when it scales a raster <image>.

Enumerator
Nearest 

Nearest neighbor, for crisp-edges and its optimizeSpeed alias.

Bilinear 

Bilinear interpolation, for smooth.

MitchellCubic 

Mitchell-Netravali cubic (B = C = 1/3) on premultiplied sRGB texels.

PixelatedSmooth 

Integer nearest-neighbor scale followed by bilinear, for pixelated.

◆ 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.

◆ MaskType

enum class donner::svg::MaskType : uint8_t
strong

CSS mask-type property values.

See also
https://drafts.fxtf.org/css-masking-1/#the-mask-type
Enumerator
Luminance 

[DEFAULT] Derive mask coverage from luminance multiplied by alpha.

Alpha 

Derive mask coverage from the alpha channel only.

◆ 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.

◆ NonScalingStrokeMode

enum class donner::svg::NonScalingStrokeMode : uint8_t
strong

How an element's stroke is realized under its current CTM.

vector-effect: non-scaling-stroke is defined in terms of a constant width in host space, but only geometry that the renderer can map into host space achieves that exactly. This enum names which of the two realizations applies, so the draw path, the culling bounds, and the editor's selection bounds all answer the question the same way.

Enumerator
Scaling 

Not a non-scaling stroke: the authored width applies in the element's own local space and scales with the CTM like the geometry does.

ScaledLocal 

The authored width divided by sqrt(|det(CTM)|) applies in local space. Exact when the CTM is a similarity; under an anisotropic CTM the drawn width is the geometric mean of the two axis widths, because the geometry is stroked before the CTM is applied.

HostSpace 

The centerline is mapped into host (root canvas) space and stroked there at the authored width, which is exact under any affine CTM.

◆ 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.

◆ PaintComponent

enum class donner::svg::PaintComponent : uint8_t
strong

One of the three paint operations whose draw order is controlled by the CSS paint-order property.

See also
https://www.w3.org/TR/SVG2/painting.html#PaintOrder
Enumerator
Fill 

The fill of a shape or glyph.

Stroke 

The stroke of a shape or glyph.

Markers 

The markers drawn along a shape's vertices.

◆ 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.

Auto 

[DEFAULT] Behaves as visiblePainted for SVG content.

◆ 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. Select the mode of a top-level document with donner::svg::SVGDocument::Settings::processingMode when parsing. Unless the host supplies its own donner::svg::SVGDocument::Settings::svgParseCallback, sub-documents referenced by <image> are parsed in ProcessingMode::SecureStatic mode, so they neither load external resources nor animate. Donner never executes scripts in any mode.

Enumerator
DynamicInteractive 

Full features enabled (default for top-level documents), including external resources through the document's resource loader, animation, host event dispatch and host-scheduled animation begin and end.

SecureAnimated 

No external resources. Authored animation timing runs, but host event dispatch and host-scheduled animation begin and end are rejected.

SecureStatic 

No external resources and no animation: animated values never apply.

◆ 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.

TooLarge 

Resource exceeds the configured byte limit.

◆ 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.

◆ TextDecorationStyle

enum class donner::svg::TextDecorationStyle : uint8_t
strong

The text-decoration-style property: how each decoration line is drawn.

CSS Text Decoration 3 leaves exact proportions to the user agent. Donner derives every style from the solid band of thickness t: Double draws two bands of thickness t separated by a gap of t, Dotted draws round dots of diameter t every 2t, Dashed draws dashes 3t long every 5t, and Wavy draws a band of thickness t that follows a wave of amplitude t with a half-period near 2t.

See also
https://www.w3.org/TR/css-text-decor-3/#text-decoration-style-property
Enumerator
Solid 

[DEFAULT] A single line.

Double 

Two parallel lines.

Dotted 

A series of round dots.

Dashed 

A series of dashes.

Wavy 

A wavy line.

◆ ThreadingMode

enum class donner::svg::ThreadingMode
strong

DOM threading policy for a document.

Enumerator
SingleThreaded 

Keep current zero-lock behavior for single-threaded users.

ConcurrentDom 

Reserve the document for future guarded multi-threaded DOM access.

◆ 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.

ResourceTooLarge 

The loaded or decoded resource exceeds the byte limit.

◆ VectorEffect

enum class donner::svg::VectorEffect : uint8_t
strong

Values for the vector-effect property, which modifies how an element is affected by the coordinate system transformations in effect (such as viewBox scaling and transform).

Only non-scaling-stroke is honored during rendering. The remaining values are at-risk in the SVG 2 Candidate Recommendation; they parse successfully but fall back to none behavior.

See also
https://www.w3.org/TR/SVG2/coords.html#VectorEffects
Enumerator
None 

[DEFAULT] No vector effect; the element scales normally with the coordinate system.

NonScalingStroke 

The stroke width and dash pattern are held constant in host (root canvas) space, ignoring the element's own transform and viewBox scaling. For paths the centerline is transformed forward into that space and dashed and stroked there, so uniform scaling, non-uniform scaling, and shear all preserve the authored width and dash lengths; stroke paint servers stay authored in the element's user space and are remapped onto the host-space outline. Text strokes and pattern-painted strokes are stroked in local space, so under an anisotropic CTM their drawn width is the geometric mean of the two axis widths. Caveat: SVG 2 defines the host space as the nearest viewport, not the root canvas, and allows an explicit viewport/screen keyword to select it; neither is implemented, and ParseVectorEffect rejects the two-keyword syntax.

NonScalingSize 

At-risk in SVG 2 CR. Parses but is treated as none.

NonRotation 

At-risk in SVG 2 CR. Parses but is treated as none.

FixedPosition 

At-risk in SVG 2 CR. Parses but is treated as none.

◆ 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 painted. In SVG both non-visible values suppress painting only: collapse has its CSS table-row meaning nowhere in SVG, so for text content it behaves as hidden, and a span with either value is still laid out, still advances the pen for the spans that follow it, and still contributes to the element's object bounding box.

Enumerator
Visible 

[DEFAULT] Visible is the default value.

Hidden 

Hidden elements are not painted, but are still laid out.

Collapse 

Behaves as Visibility::Hidden for SVG content.

◆ 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,
components::FilterExecutionBudget * executionBudget = 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.
executionBudgetOptional shared per-frame budget. Direct callers may omit it to apply only the graph-local limit.

◆ AuthorStyleDependsOnTreePosition()

bool donner::svg::AuthorStyleDependsOnTreePosition ( const SVGDocument & document)

Return true when an author stylesheet rule in document matches on tree position.

Such a rule (#layer rect, svg > rect, rect:first-child) can start or stop matching when an element is moved to a different parent or a different place among its siblings, so a caller that must not change how the document paints has to treat a move as unsafe while one exists.

The user agent stylesheet is excluded. It is a fixed part of every document, and each of its position-based rules keys on the document root (svg:not(:root)) or on having a foreignObject parent (*:not(foreignObject) > svg). Moving an element between a <g> and the document root changes none of those, so excluding them does not weaken the answer for a caller asking about such a move.

Parameters
documentSVG document to inspect.
Returns
True when any author stylesheet rule depends on tree position.

◆ BitmapBlitImageParams()

ImageParams donner::svg::BitmapBlitImageParams ( ImageParams params)
inline

Returns params with the sampling policy for a bitmap blit, such as a compositor layer or tile raster.

auto resolves to smooth there: the quality kernel applies to <image> content, and bitmap blits keep bilinear sampling.

Parameters
paramsPlacement parameters passed to drawBitmap.

◆ BoundedPositiveFilterPixels()

double donner::svg::BoundedPositiveFilterPixels ( double value)
inline

Clamp a finite nonnegative radius to the filter-work bound.

Parameters
valueRequested pixels.

◆ BoundedSignedFilterPixels()

double donner::svg::BoundedSignedFilterPixels ( double value)
inline

Clamp a finite offset to the filter-work bound.

Parameters
valueRequested pixels.

◆ 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,
Lengthd::Extent propertyExtent,
Lengthd::Extent fallbackExtent )

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>.

Percentages resolve against the axis of the property they belong to: rx against the viewport width (Lengthd::Extent::X) and ry against the viewport height (Lengthd::Extent::Y). The "auto" fallback uses the other property's value, which must resolve against the other axis - so the primary and fallback extents are distinct.

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.
propertyExtentThe viewport axis percentages of property resolve against.
fallbackExtentThe viewport axis percentages of fallbackProperty resolve against.
Returns
Tuple containing the resolved length, and the converted length to pixels.

◆ ClearUnpaintedSpanGlyphs()

void donner::svg::ClearUnpaintedSpanGlyphs ( const components::ComputedTextComponent & text,
entt::entity spanEffectOwner,
std::vector< TextRun > & runs )

Drop the glyphs of runs this draw is not responsible for painting.

Two reasons take a run out of a draw:

  1. visibility: hidden and visibility: collapse suppress painting only, so such a span is still laid out, still advances the pen for the spans that follow it, and still contributes to the element's object bounding box.
  2. A span whose clip-path, mask, or filter gives it its own rendering instance is painted by that instance, inside that effect's layer, and not by the text root's draw. effectOwner names the instance responsible, and spanEffectOwner is the one doing the drawing.

Backends call this on their local copy of the layout runs after ComputeTextBounds, so the element-level bounding box that objectBoundingBox paint maps through stays the same for every draw of the element.

Runs are index-aligned with text.spans; a run past the end of the span list is left alone.

Parameters
textThe computed text component supplying per-span visibility and ownership.
spanEffectOwnerThe span entity this draw paints, or entt::null for the text root's own draw.
runsLayout runs to filter in place.

◆ 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.

◆ CollectMatchedStyleRules()

std::vector< SVGMatchedStyleRule > donner::svg::CollectMatchedStyleRules ( const SVGElement & element)

Collect stylesheet rules that match element.

Parameters
elementElement to inspect.
Returns
Matched stylesheet rules in cascade scan order.

◆ CollectStylesheetRules()

std::vector< SVGStylesheetRule > donner::svg::CollectStylesheetRules ( const SVGDocument & document,
bool includeUserAgent = false )

Collect source-backed author stylesheet rules in document, optionally with the built-in user agent stylesheet rules.

Parameters
documentSVG document to inspect.
includeUserAgentInclude built-in rules without document source ranges. Defaults to false.
Returns
Author rules and optionally built-in rules in the existing stylesheet scan order.

◆ 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.

◆ ComputeFilterInputMargin()

FilterInputMargin donner::svg::ComputeFilterInputMargin ( const components::FilterGraph & graph,
const Transform2d & deviceFromFilter )
inline

The input margin a filter layer's capture gets: the graph's sampling reach, or none when the capture must stay viewport-aligned (see components::FilterGraph::keepsViewportAlignedCapture and feTurbulence).

Parameters
graphFilter graph.
deviceFromFilterFilter user space to raster pixels.

◆ ComputeFilterSamplingReach()

FilterInputMargin donner::svg::ComputeFilterSamplingReach ( const components::FilterGraph & graph,
const Transform2d & deviceFromFilter )
inline

Conservatively measure how far beyond each output pixel a filter graph reads its raster. Every primitive counts, including those fed only by generators: feFlood, feImage and feTurbulence produce output only over the raster, so a later blur or tile still needs the raster to extend past the viewport. Reaches add up, since chained primitives compound.

Parameters
graphFilter graph.
deviceFromFilterFilter user space to raster pixels.

◆ ComputePatternTileRasterMetrics()

std::optional< PatternTileRasterMetrics > donner::svg::ComputePatternTileRasterMetrics ( const Box2d & tileRect,
const Transform2d & deviceFromPattern )

Computes bounded raster dimensions for a logical pattern tile.

Parameters
tileRectLogical pattern tile rectangle.
deviceFromPatternTransform from logical pattern coordinates to device pixels.
Returns
Raster metrics, or nullopt when an input is non-finite, non-positive, singular, or would exceed kMaxPatternTileRasterDimension.

◆ ComputeTextBounds()

Box2d donner::svg::ComputeTextBounds ( const TextEngine & textEngine,
const std::vector< TextRun > & runs )

Compute the text element's bounding box for objectBoundingBox paint.

Encodes tiny-skia's computation: the union over rendered glyphs of em-box cells - horizontally [xPosition, xPosition + xAdvance], vertically [yPosition - ascent*scale, yPosition - descent*scale] (font v-metrics, not the raw font size), per the SVG spec for text objectBoundingBox. A tspan has no bbox of its own, so gradient/pattern paint on a span maps through this element-level box.

Returns an empty (default) Box2d when there are no rendered glyphs.

Parameters
textEngineEngine providing per-run scale + font v-metrics.
runsPositioned layout runs.
Returns
The text bounding box in the element's local space.

◆ CopyTightRgbaRows()

std::vector< std::uint8_t > donner::svg::CopyTightRgbaRows ( std::span< const std::uint8_t > rgbaPixels,
int width,
int height,
std::size_t rowBytes )
nodiscard

Copy row-strided RGBA8 bytes into a tightly-packed RGBA8 buffer.

Parameters
rgbaPixelsSource RGBA bytes.
widthPixel width.
heightPixel height.
rowBytesBytes between source rows.
Returns
A tightly-packed RGBA buffer, or an empty vector when dimensions or row storage are invalid.

◆ CopyTightRgbaRowsInto()

void donner::svg::CopyTightRgbaRowsInto ( std::span< const std::uint8_t > rgbaPixels,
int width,
int height,
std::size_t rowBytes,
std::vector< std::uint8_t > & out )

Copy row-strided RGBA8 bytes into a caller-owned tightly-packed buffer.

Buffer-reusing form of CopyTightRgbaRows. rgbaPixels must not alias out.

See also
PremultiplyRgbaInto
Parameters
rgbaPixelsSource RGBA bytes.
widthPixel width.
heightPixel height.
rowBytesBytes between source rows.
outDestination buffer, resized to the tightly-packed size, or emptied when dimensions or row storage are invalid.

◆ EffectiveStrokeWidth()

double donner::svg::EffectiveStrokeWidth ( double authoredWidth,
NonScalingStrokeMode mode,
const Transform2d & worldFromEntity )

Returns the stroke width the renderer expands the centerline by, in the space that centerline is stroked in: local space for NonScalingStrokeMode::Scaling and NonScalingStrokeMode::ScaledLocal, host space for NonScalingStrokeMode::HostSpace.

Parameters
authoredWidthThe computed stroke-width.
modeThe element's resolved mode.
worldFromEntityThe element's CTM.

◆ EmitTextDecorationPaths()

void donner::svg::EmitTextDecorationPaths ( const TextRun & run,
const components::TextDecorationOrigin & origin,
TextDecoration emittedLines,
std::size_t originCount,
float fontSize,
const TextEngine & engine,
const Transform2d & deviceFromLocal,
std::size_t & remainingWork,
const std::function< void(const Path &)> & emit )

Emit bounded decoration paths while preserving each originating declaration.

Parameters
runLaid-out glyph run.
originDeclaration whose geometry is emitted.
emittedLinesSubset of the origin's lines to emit, so callers can paint lines beneath and above the glyphs in separate passes. Positions still account for all of the origin's lines.
originCountNumber of declarations affecting the span.
fontSizeUsed run size for direct-caller fallback metrics.
engineFont metrics provider.
deviceFromLocalTransform used to resolve each segment's thickness direction.
remainingWorkShared per-draw geometry work allowance.
emitPaint callback for each generated path.

◆ EscapeTerminalText()

std::string donner::EscapeTerminalText ( std::string_view text,
bool preserveNewlines = false )
inline

Escape untrusted bytes and terminal format controls while preserving printable UTF-8.

Bytes that are not valid UTF-8, C0 controls, and DEL are written as \xHH; C1 controls as \u00HH; and invisible format and bidirectional controls (U+061C, U+180E, U+200B to U+200F, U+2028 to U+202E, U+2060 to U+206F, and U+FEFF) as \uHHHH. Hex digits are lowercase.

Parameters
textText to escape.
preserveNewlinesWhen true, \n is copied unchanged instead of escaped.

◆ EvictRetainedSpansToBudget()

void donner::svg::EvictRetainedSpansToBudget ( Registry & registry,
std::uint64_t currentFrame )

Evicts the coldest entries until the document is under budget.

Entries last used before currentFrame go first. When dropping all of those still leaves the document over budget, its working set does not fit, so retention is disabled for the document and everything is dropped.

◆ FilterDeviceScaleX()

double donner::svg::FilterDeviceScaleX ( const Transform2d & transform)
inline

Device scale of the filter X axis.

Parameters
transformFilter-to-device transform.

◆ FilterDeviceScaleY()

double donner::svg::FilterDeviceScaleY ( const Transform2d & transform,
double scaleX )
inline

Device scale of the filter Y axis.

Parameters
transformTransform.
scaleXX-axis scale.

◆ FilterInputExtension()

int donner::svg::FilterInputExtension ( double beyond,
double needed )
inline

Pixels to extend a filter input raster past one viewport edge.

Parameters
beyondHow far the filter region extends past the edge.
neededInput the graph reads past that edge.

◆ FilterLengthInPixels()

double donner::svg::FilterLengthInPixels ( double value,
double bound,
double scale,
bool objectBounds )
inline

Resolve an effect length in device pixels.

Parameters
valueLength.
boundObject extent.
scaleDevice scale.
objectBoundsWhether unitless lengths use object-bounding-box units.

◆ FilterOffsetInPixels()

Vector2d donner::svg::FilterOffsetInPixels ( Vector2d offset,
Vector2d bounds,
bool objectBounds,
const Transform2d & transform )
inline

Resolve a filter offset vector in device coordinates.

Parameters
offsetUser offset.
boundsObject extents.
objectBoundsUnit mode.
transformFilter-to-device transform.

◆ FindStyleRuleAtSourceOffset()

std::optional< SVGStyleRuleAtSourceOffset > donner::svg::FindStyleRuleAtSourceOffset ( const SVGDocument & document,
std::size_t documentSourceOffset )

Find the author stylesheet rule at documentSourceOffset.

Parameters
documentSVG document to inspect.
documentSourceOffsetOffset in the SVG document source.
Returns
Stylesheet rule at documentSourceOffset, or std::nullopt.

◆ FinishFilterReach()

Vector2d donner::svg::FinishFilterReach ( Vector2d reach)
inline

Finish a device reach: one more pixel covers rounding at the reach's edge.

Parameters
reachAccumulated device reach per axis.

◆ FiniteFilterInverse()

std::optional< Transform2d > donner::svg::FiniteFilterInverse ( const Transform2d & deviceFromFilter)
inline

Invert only finite, nonsingular transforms whose inverse remains finite.

Parameters
deviceFromFilterTransform to validate.

◆ GlyphFont()

FontHandle donner::svg::GlyphFont ( const TextRun & run,
const TextGlyph & glyph )
inline

Returns the face that draws glyph: its fallback face when it has one, otherwise the run's.

Parameters
runRun that contains glyph.
glyphGlyph to resolve.

◆ GlyphPlacementTransform()

Transform2d donner::svg::GlyphPlacementTransform ( const TextGlyph & glyph)

The affine that places a glyph's unplaced outline at its baseline position in the text element's local space.

A pure translation to (xPosition, yPosition). Per-glyph rotation is NOT here: it is baked into the outline by UnplacedGlyphOutline, so a renderer that rasterises in the outline's own space keeps that space aligned with the pixel grid. Depends only on the glyph's position, so a renderer that caches outlines by glyph identity can compute this per occurrence without touching the font backend.

Parameters
glyphThe positioned glyph.
Returns
The placement transform.

◆ HasExactRgbaPayload()

bool donner::svg::HasExactRgbaPayload ( std::span< const std::uint8_t > rgbaPixels,
int width,
int height )
nodiscard

Returns whether a byte span is exactly one tightly packed RGBA8 payload.

This internal renderer guard performs no allocation and rejects non-positive dimensions and any byte-count multiplication that cannot be represented by size_t.

Parameters
rgbaPixelsCandidate tightly packed RGBA8 bytes.
widthDeclared pixel width.
heightDeclared pixel height.
Returns
True only when the span size is exactly width * height * 4.

◆ ImageSamplingKernelFor() [1/2]

ImageSamplingKernel donner::svg::ImageSamplingKernelFor ( ImageRendering imageRendering)
constexpr

Selects the raster resampling kernel for a resolved image-rendering value.

Both renderer backends map <image> draws and feImage raster placement through this function, so their image kernels cannot drift apart. resvg likewise renders an feImage raster as an image.

auto is UA-defined; Donner, like resvg, uses the Mitchell cubic, and gives optimizeQuality and high-quality the same quality kernel.

Parameters
imageRenderingThe resolved image-rendering value.

◆ ImageSamplingKernelFor() [2/2]

ImageSamplingKernel donner::svg::ImageSamplingKernelFor ( ImageRendering imageRendering,
const Transform2d & deviceFromImage )
inline

Selects the resampling kernel for drawing a raster through deviceFromImage.

tiny-skia, whose image sampling Donner's software renderer and resvg share, samples the texel containing each sample whenever the transform is a pure translation, fractional ones included, so every interpolating kernel becomes ImageSamplingKernel::Nearest there.

Parameters
imageRenderingThe resolved image-rendering value.
deviceFromImageTransform from source-pixel coordinates to output pixels.

◆ IsAnimationTarget()

bool donner::svg::IsAnimationTarget ( const SVGElement & element)

Conservatively determine whether an animation may target element.

An animation element (<animate>, <animateTransform>, <animateMotion>, <set>) animates the element named by its href, or its own parent when href is absent. A caller that must not change how a document paints uses this to tell whether an element is observed by an animation: a group holding an animation element is animated without naming itself anywhere, and moving a child out of it changes what the animation applies to.

Work is bounded. When the analysis exhausts its budget, this returns true, so callers cannot treat an incomplete query as permission to move an element out of an animated container.

Parameters
elementElement to test.
Returns
True for a target or exhausted analysis; false only for a proven non-target.

◆ IsSimilarityTransform()

bool donner::svg::IsSimilarityTransform ( const Transform2d & transform)

Returns whether transform's linear part is a similarity: uniform scale combined with rotation and optionally reflection.

Under a similarity the CTM's scale is exactly sqrt(|det|), so a non-scaling stroke reaches its authored width from local space with a scalar width adjustment; only a non-uniform scale or shear needs the geometry in host space.

Parameters
transformTransform to classify.

◆ LayoutFilterInputAxis()

FilterInputAxis donner::svg::LayoutFilterInputAxis ( std::pair< double, double > region,
double reach,
std::optional< std::pair< double, double > > capture,
int viewport )
inline

Lay out one raster axis.

Parameters
regionFilter region extent on the axis, in device pixels.
reachInput read past an output pixel.
captureInput rectangle to cover.
viewportViewport extent on the axis.

◆ operator<<() [1/9]

std::ostream & donner::svg::operator<< ( std::ostream & os,
ColorInterpolation value )
inline

Prints a color interpolation value.

Parameters
osOutput stream.
valueValue to print.
Returns
The output stream.

◆ operator<<() [2/9]

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<<() [3/9]

std::ostream & donner::svg::operator<< ( std::ostream & os,
const FontFaceDependency & dependency )
inline

Print a dependency for diagnostic output.

Parameters
osStream receiving the diagnostic.
dependencyDependency to print.
Returns
The output stream.

◆ operator<<() [4/9]

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.

◆ operator<<() [5/9]

template<typename T>
std::ostream & donner::svg::operator<< ( std::ostream & os,
const std::optional< T > & value )

Write an optional property's value, or none when no value is present.

Template Parameters
TValue type supported by the output stream.
Parameters
osDestination output stream.
valueOptional value to print.

◆ operator<<() [6/9]

std::ostream & donner::svg::operator<< ( std::ostream & os,
FontResourcePreflight::Status status )
inline

Write the font-preflight status type and numeric value for diagnostics.

Parameters
osOutput stream.
statusStatus value to format.
Returns
The output stream.

◆ operator<<() [7/9]

std::ostream & donner::svg::operator<< ( std::ostream & os,
FontSynthesisSmallCaps value )
inline

Write the CSS keyword for the given synthesis policy.

Parameters
osOutput stream.
valuePolicy to write.
Returns
The output stream.

◆ operator<<() [8/9]

std::ostream & donner::svg::operator<< ( std::ostream & os,
FontSynthesisStyle value )
inline

Write the CSS keyword for a synthesis policy.

Parameters
osOutput stream.
valuePolicy to write.
Returns
The output stream.

◆ operator<<() [9/9]

std::ostream & donner::svg::operator<< ( std::ostream & os,
OverflowWrap value )
inline

Write the CSS keyword for the policy.

Parameters
osDestination stream.
valueEmergency wrapping policy.

◆ ParseBasicShapeClipPath()

ParseResult< ClipPath > donner::svg::ParseBasicShapeClipPath ( std::span< const css::ComponentValue > components,
bool allowUserUnits )

Parse a supported basic clipping shape and its optional reference box.

Parameters
componentsTrimmed CSS component values.
allowUserUnitsPermit SVG presentation-attribute user units.

◆ 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.

◆ PlacedGlyphOutline()

Path donner::svg::PlacedGlyphOutline ( const TextEngine & textEngine,
FontHandle font,
const TextRun & run,
const TextGlyph & glyph,
float scale,
double warpTolerance )

Build the placed outline for a single glyph in document space.

Encodes tiny-skia's exact placement sequence: stretch the raw outline, then position it with Rotate(rotateDegrees) * Translate(xPosition, yPosition) composed into ONE affine and applied once. The single composition is load-bearing rather than incidental: the CPU backend's golden images are pinned to that arithmetic, so UnplacedGlyphOutline's two-step form is not a drop-in substitute for it.

Returns an empty path for .notdef (glyphIndex 0) or when the font has no vector outline for the glyph (e.g. bitmap-only fonts) - callers handle those cases (skip / bitmap path) exactly as before.

Parameters
textEngineEngine providing glyph outlines.
fontFont handle for the run.
glyphThe positioned glyph (carries position, rotation, stretch).
scalePer-run pixel-height scale (scaleForPixelHeight(font, sizePx)).
Returns
The placed outline path in the text element's local space.

◆ 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.

◆ PremultiplyRgbaInto()

void donner::svg::PremultiplyRgbaInto ( std::span< const std::uint8_t > rgbaPixels,
std::vector< std::uint8_t > & out )

Convert tightly-packed straight-alpha RGBA8 to premultiplied RGBA8, writing into a caller-owned buffer.

Same conversion as PremultiplyRgba, but out's existing storage is reused when it is large enough, so a caller that converts once per frame keeps one buffer instead of allocating and freeing a new one every time.

rgbaPixels must not alias out; see the aliasing note at the top of this file.

Parameters
rgbaPixelsStraight-alpha RGBA bytes (size must be a multiple of 4).
outDestination buffer, resized to match rgbaPixels.

◆ PremultiplyRgbaRows()

std::vector< std::uint8_t > donner::svg::PremultiplyRgbaRows ( std::span< const std::uint8_t > rgbaPixels,
int width,
int height,
std::size_t rowBytes )
nodiscard

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

Parameters
rgbaPixelsStraight-alpha source RGBA bytes.
widthPixel width.
heightPixel height.
rowBytesBytes between source rows.
Returns
A tightly-packed premul RGBA buffer, or an empty vector when dimensions or row storage are invalid.

◆ PremultiplyRgbaRowsInto()

void donner::svg::PremultiplyRgbaRowsInto ( std::span< const std::uint8_t > rgbaPixels,
int width,
int height,
std::size_t rowBytes,
std::vector< std::uint8_t > & out )

Convert row-strided straight-alpha RGBA8 to tightly-packed premultiplied RGBA8, writing into a caller-owned buffer.

Buffer-reusing form of PremultiplyRgbaRows. rgbaPixels must not alias out.

See also
PremultiplyRgbaInto
Parameters
rgbaPixelsStraight-alpha source RGBA bytes.
widthPixel width.
heightPixel height.
rowBytesBytes between source rows.
outDestination buffer, resized to the tightly-packed size, or emptied when dimensions or row storage are invalid.

◆ RasterizeImagePremultiplied()

std::vector< std::uint8_t > donner::svg::RasterizeImagePremultiplied ( std::span< const std::uint8_t > premultipliedPixels,
int sourceWidth,
int sourceHeight,
const Transform2d & deviceFromImage,
int outputWidth,
int outputHeight,
ImageSamplingKernel kernel )

Rasterizes a premultiplied image through an affine transform into a bounded device surface.

Parameters
premultipliedPixelsExact tightly packed premultiplied RGBA8 source payload.
sourceWidthSource width in pixels.
sourceHeightSource height in pixels.
deviceFromImageTransform from source-pixel coordinates to output pixels.
outputWidthOutput width in pixels.
outputHeightOutput height in pixels.
kernelResampling kernel.
Returns
Tightly packed premultiplied RGBA8 output. Malformed payloads, invalid dimensions, and over-budget surfaces return empty; invalid transforms return a correctly sized transparent output.

◆ RenderDocumentsToAtlasBitmap()

RendererBitmap donner::svg::RenderDocumentsToAtlasBitmap ( RendererInterface & renderer,
std::span< const AtlasDocumentPlacement > placements,
Vector2i atlasSizePx )
nodiscard

Rasterize several documents into one render target and read it back once.

Each document is drawn at its own atlas origin inside a single beginFrame/endFrame window, so the whole set costs exactly one GPU-to-CPU readback instead of one per document. Where a readback is a round trip through an asynchronous buffer mapping - WebGPU in a browser - that difference dominates: N serialized readback latencies collapse into one.

Every tile renders as it would standalone: each document is prepared and traversed through the same driver path, translated by its origin. Slicing the returned atlas therefore yields per-document bitmaps identical to rendering each document on its own.

Peak memory scales with the batch, because every document has to stay alive until the frame is submitted. That cost is not small - fourteen editor icons in one batch measured a 101.5 MB Wasm boot heap high-water against under 32 MB in small batches - so a caller with many documents should split them across several calls and trade a few readbacks for the headroom.

Parameters
rendererBackend instance used for the atlas pass.
placementsDocuments and their atlas origins. Tiles must not overlap.
atlasSizePxAtlas dimensions in device pixels, large enough to contain every placed tile.
Returns
The atlas bitmap, or an empty bitmap when nothing could be rendered.

◆ ResolveDecorationThickness()

double donner::svg::ResolveDecorationThickness ( const TextDecorationThickness & thickness,
double automatic,
double underline,
double deviceScale )
inline

Resolve a decoration width using the originating declaration and font metrics.

Parameters
thicknessOrigin's computed thickness (explicit dimensions are in local pixels).
automaticAutomatic width for this line type.
underlinePreferred underline width for from-font.
deviceScaleDevice pixels per local thickness unit.

◆ ResolveGlyphFace()

GlyphFaceScale donner::svg::ResolveGlyphFace ( const TextEngine & textEngine,
const TextRun & run,
const TextGlyph & glyph,
float runScale,
bool runBitmapOnly )

Resolves the face that draws glyph.

A glyph without a fallback face reuses the run's already computed values; a fallback glyph queries its own face.

Parameters
textEngineEngine providing font metrics.
runRun that contains glyph.
glyphGlyph to resolve.
runScalescaleForPixelHeight of the run's face at its used size.
runBitmapOnlyWhether the run's face has only bitmap glyphs.

◆ ResolveNonScalingStrokeMode()

NonScalingStrokeMode donner::svg::ResolveNonScalingStrokeMode ( VectorEffect vectorEffect,
const Transform2d & worldFromEntity,
bool geometryMustStayLocal )

Resolves how an element's stroke is realized.

A CTM with a non-finite component never resolves to NonScalingStrokeMode::HostSpace. Mapping the centerline through it would produce non-finite geometry, and the caches keyed on that transform could never hit again, because a NaN component compares unequal to itself.

Parameters
vectorEffectThe element's computed vector-effect.
worldFromEntityThe element's CTM.
geometryMustStayLocalTrue when the stroke pass cannot hand host-space geometry to the backend, which is the case for a pattern-painted stroke (the tile placement is built in path-local space) and for text (the stroke expands glyph outlines, not a path).

◆ ResourceSandboxRootForAbsoluteInput()

std::optional< std::filesystem::path > donner::svg::ResourceSandboxRootForAbsoluteInput ( const std::filesystem::path & absoluteInputPath)

Return the narrowest sandbox root for an absolute input document path.

A document grants access only to its containing directory, never to an ambient process working directory.

◆ RetainedEntryBytes()

std::size_t donner::svg::RetainedEntryBytes ( const RetainedSpansComponent & entry)
nodiscard

Returns everything an entry holds: recorded coverage, the paints kept beside it, and the entry itself.

The paints are counted because a gradient paint owns its stop list and an entry keeps two of them, so a document of many small gradient-painted shapes would otherwise grow the cache in a way the budget could not see. Recorded coverage still dominates in practice.

◆ RunDonnerSvgTool()

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

Run the donner-cli 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.

◆ StrokeCullHalfExtent()

double donner::svg::StrokeCullHalfExtent ( double strokeWidth,
StrokeLinecap linecap,
StrokeLinejoin linejoin,
double miterLimit )

Returns the furthest distance a stroke of strokeWidth can reach from its centerline.

Half the stroke width, except at the two places a stroke reaches past that:

  • A miter join's outer tip sits strokeWidth / (2 * sin(theta/2)) from the vertex, clamped by stroke-miterlimit to miterLimit * strokeWidth / 2.
  • A square cap extends the segment by half the width, putting its far corners sqrt(2) * strokeWidth / 2 from the endpoint.

Callers inflating a centerline box for a culling or selection decision need that worst case, not the half width. An infinite stroke-miterlimit yields an infinite result rather than a smaller finite one: such a bound may only over-count, so the caller must decline to cull instead of substituting a tighter number.

Parameters
strokeWidthStroke width in the space the centerline is stroked in.
linecapThe element's computed stroke-linecap.
linejoinThe element's computed stroke-linejoin.
miterLimitThe element's computed stroke-miterlimit.

◆ TargetFromPatternRaster()

Transform2d donner::svg::TargetFromPatternRaster ( const Transform2d & targetFromPattern,
const Vector2d & rasterFromPatternScale )

Converts a logical pattern-to-target transform into a raster-tile-to-target transform.

Parameters
targetFromPatternTransform from logical pattern coordinates to target coordinates.
rasterFromPatternScaleRaster pixels per logical pattern unit.
Returns
Transform from raster-tile pixel coordinates to target coordinates.

◆ 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:265
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:125

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>, <rect>,...
Definition ElementType.h:14
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>).

◆ TransformPath()

Path donner::svg::TransformPath ( const Path & path,
const Transform2d & transform )

Apply an affine transform to every point of a path.

Backend-agnostic replacement for the byte-identical TransformPath free functions that previously lived in each renderer TU.

Parameters
pathThe source path.
transformThe transform to apply to each point.
Returns
A new path with all points transformed.

◆ UnplacedGlyphOutline()

GlyphOutlineAndPlacement donner::svg::UnplacedGlyphOutline ( const TextEngine & textEngine,
FontHandle font,
const TextGlyph & glyph,
float scale )

Build a glyph's unplaced outline and its placement transform.

Encodes tiny-skia's placement inputs, split at the point where the glyph-identity-dependent work ends:

  1. glyphOutline(font, glyph.glyphIndex, scale * glyph.fontSizeScale, glyph.allowSyntheticOblique),
  2. stretch the raw outline by Scale(stretchScaleX, stretchScaleY) (only when either differs from 1),
  3. rotate by rotateDegrees about the glyph's own origin – these three produce outline,
  4. Translate(xPosition, yPosition) – this is glyphFromLocal.

Steps 1 to 3 depend only on (font, glyph index, scale * fontSizeScale, stretch, rotation, synthesis permission); step 4 depends only on the glyph's position.

Parameters
textEngineEngine providing glyph outlines.
fontFont handle for the run.
glyphThe positioned glyph (carries position, rotation, stretch).
scalePer-run pixel-height scale (scaleForPixelHeight(font, sizePx)).
Returns
The unplaced outline plus its placement transform.

◆ 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).

◆ UnpremultiplyRgbaRows()

std::vector< std::uint8_t > donner::svg::UnpremultiplyRgbaRows ( std::span< const std::uint8_t > rgbaPixels,
int width,
int height,
std::size_t rowBytes )
nodiscard

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

Parameters
rgbaPixelsPremultiplied source RGBA bytes.
widthPixel width.
heightPixel height.
rowBytesBytes between source rows.
Returns
A tightly-packed straight-alpha RGBA buffer, or an empty vector when dimensions or row storage are invalid.

Variable Documentation

◆ kDecorationLinesBeneathText

TextDecoration donner::svg::kDecorationLinesBeneathText
inlineconstexpr
Initial value:
=
@ Underline
Draw a line below the text.
Definition TextDecoration.h:29
@ Overline
Draw a line above the text.
Definition TextDecoration.h:30

Lines that CSS Text Decoration 3 paints beneath a run's glyphs; line-through paints above them.

◆ kElementTypeCount

size_t donner::svg::kElementTypeCount = static_cast<size_t>(ElementType::Use) + 1
inlineconstexpr

Number of distinct ElementType values, for sizing arrays indexed by element type.

Derived from ElementType::Use being the last enumerator. Adding an enumerator after it requires updating this expression; callers that size a table with it should static_assert that the element types they index with fit, so the mismatch is caught at compile time rather than silently truncating the table.

◆ 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);
*|style { display: none !important; }
*|symbol { display: none !important; }
svg:not(:root), image, marker, pattern, symbol { overflow: hidden; }
*:not(svg),
*:not(foreignObject) > svg {
transform-origin: 0 0;
}
: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