|
|
Donner
C++20 SVG rendering library
|
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 filter effect itself (of any type). 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 | GradientStop |
| Values for a gradient stop, https://www.w3.org/TR/SVG2/pservers.html#StopElement. More... | |
| struct | MarkerOrient |
| Represents the orientation of a marker. More... | |
| class | PathSpline |
| Container for a spline, which is a series of points connected by lines and curves. More... | |
| class | PreserveAspectRatio |
| Handles SVG's preserveAspectRatio attribute. More... | |
| class | StrokeDasharray |
| The parsed result of the 'stroke-dasharray' property, see: https://www.w3.org/TR/SVG2/painting.html#StrokeDasharrayProperty. More... | |
| struct | TransformOrigin |
| Represents the transform-origin property value. More... | |
| class | DonnerController |
| Allows querying and controlling the Donner scene, beyond what the DOM provides. More... | |
| struct | RecursionGuard |
| Helper to guard against recursion when evaluating references. More... | |
| struct | ResolvedReference |
| Represents a resolved reference to an SVG entity. More... | |
| struct | Reference |
| Represents a reference to an SVG entity by its href, typically created from a url(#id) string. More... | |
| struct | PaintServer |
| Represents a paint server, which can be a solid color, a reference to another element, or a special value like "none" or "context-fill". More... | |
| struct | Property |
| Holds a CSS property, which has a name and value, and integrates with inheritance to allow cascading values using the CSS model with specificity. More... | |
| class | PropertyRegistry |
| Holds CSS properties for a single element. More... | |
| struct | RenderingInstanceView |
| A view containing a list of components::RenderingInstanceComponent which can be iterated over. More... | |
| class | Trace |
| Implements a simple RAII execution time tracer. More... | |
| class | RendererImageIO |
| Utility class for saving images to disk. More... | |
| class | RendererSkia |
| Rendering backend using Skia, https://github.com/google/skia. More... | |
| class | RendererUtils |
| Utility functions for the renderer. More... | |
| struct | ImageComparisonParams |
| Parameters for controlling image comparison tests. More... | |
| struct | ImageComparisonTestcase |
| Represents a single test case for image comparison. More... | |
| class | ImageComparisonTestFixture |
| A Google Test fixture for tests that compare rendered SVG output against golden images. More... | |
| struct | Image |
| Stores an uncompressed RGBA-format image. More... | |
| struct | AsciiImage |
| Stores an ASCII representation of a rendered image, and supports diffing it to another image. More... | |
| class | RendererTestUtils |
| Test utilities for rendering and saving SVGs in tests. More... | |
| class | FontLoader |
| Helper to load a font from a URI, using a ResourceLoaderInterface to fetch the raw data and then parsing it as a WOFF file. More... | |
| class | ImageLoader |
| Utility class for loading images from a URI. More... | |
| struct | ImageResource |
| Contains a decoded image resource in RGBA format. More... | |
| class | NullResourceLoader |
| A resource loader that does not load any resources and always returns an error. More... | |
| class | ResourceLoaderInterface |
| Interface for loading external resources, such as images. More... | |
| class | SandboxedFileResourceLoader |
| A resource loader that loads files from a sandboxed directory. More... | |
| class | UrlLoader |
| Utility class for loading a URI or decoding a data URL. More... | |
| class | SVGCircleElement |
| DOM object for a "<circle>" element. More... | |
| class | SVGClipPathElement |
| DOM object for a "<clipPath>" element. More... | |
| class | SVGDefsElement |
| DOM object for a "<defs>" element. More... | |
| class | SVGDocument |
| Represents an SVG document, which holds a collection of SVGElement as the document tree. More... | |
| class | SVGElement |
| Represents an SVG entity belonging to an SVGDocument. More... | |
| class | SVGEllipseElement |
| DOM object for a "<ellipse>" element. More... | |
| class | SVGFEGaussianBlurElement |
| DOM object for a "<feGaussianBlur>" 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 | SVGPathElement |
| DOM object for a "<path>" element. More... | |
| class | SVGPatternElement |
| DOM object for a "<pattern>" element. More... | |
| class | SVGPolygonElement |
| DOM object for a "<polygon>" element. More... | |
| class | SVGPolylineElement |
| DOM object for a "<polyline>" element. More... | |
| class | SVGRadialGradientElement |
| DOM object for a "<radialGradient>" element. More... | |
| class | SVGRectElement |
| DOM object for the "<rect>" element. More... | |
| class | SVGStopElement |
| DOM object for a "<stop>" element. More... | |
| class | SVGStyleElement |
| DOM object for a "<style>" element, which contains a CSS stylesheet. More... | |
| class | SVGSVGElement |
| DOM object for a "<svg>" element. More... | |
| class | SVGSymbolElement |
| DOM object for a "<symbol>" element, which defines a graphical template that can be instantiated using a "<use>" element. More... | |
| class | SVGTextContentElement |
| Base class for elements that support rendering child text content. More... | |
| class | SVGTextElement |
| DOM object for a "<text>" element. More... | |
| class | SVGTextPositioningElement |
| Base class for elements that support per-glyph positioning attributes (x, y, dx, dy, rotate) on top of the basic text content interface. More... | |
| class | SVGTSpanElement |
| DOM object for a "<tspan>" element. More... | |
| class | SVGUnknownElement |
| DOM object for an unknown SVG element. More... | |
| class | SVGUseElement |
| DOM object for a "<use>" element. More... | |
| struct | ParsedFragment |
| class | DataUrlParser |
| Parse a URL, which can be an external resource or a data URL. More... | |
Typedefs | |
| using | AllSVGElements |
| A type list of all SVG element types, used by donner::svg::parser::AttributeParser and donner::svg::parser::SVGParser. | |
| template<typename T> | |
| using | GetInitialFn = std::optional<T> (*)() |
| Callback function to get the initial value of a property. | |
| using | Params = ImageComparisonParams |
Enumerations | |
| enum class | FilterUnits { UserSpaceOnUse , ObjectBoundingBox , Default = ObjectBoundingBox } |
| Values for the "filterUnits" attribute which defines the coordinate system for attributes x, y, width, height. More... | |
| enum class | PrimitiveUnits { 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 | 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 | FillRule : uint8_t { NonZero , EvenOdd } |
| The parsed result of the 'fill-rule' property, see: https://www.w3.org/TR/SVG2/painting.html#FillRuleProperty. 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 | LengthAdjust : uint8_t { Spacing , SpacingAndGlyphs , Default = Spacing } |
| Values for the "lengthAdjust" attribute, https://www.w3.org/TR/SVG2/text.html#TextElementLengthAdjustAttribute. More... | |
| enum class | MarkerUnits : uint8_t { StrokeWidth , UserSpaceOnUse , Default = StrokeWidth } |
| Values for the "markerUnits" attribute, https://www.w3.org/TR/SVG2/painting.html#MarkerUnitsAttribute. More... | |
| enum class | MaskUnits : uint8_t { UserSpaceOnUse , ObjectBoundingBox , Default = ObjectBoundingBox } |
| Values for the "maskUnits" attribute, https://drafts.fxtf.org/css-masking-1/#element-attrdef-mask-maskunits. More... | |
| enum class | MaskContentUnits : uint8_t { UserSpaceOnUse , ObjectBoundingBox , Default = UserSpaceOnUse } |
| Values for the "maskContentUnits" attribute, https://drafts.fxtf.org/css-masking-1/#element-attrdef-mask-maskcontentunits. More... | |
| enum class | Overflow : uint8_t { Visible , Hidden , Scroll , Auto } |
| The parsed result of the CSS 'overflow' property, see https://www.w3.org/TR/CSS2/visufx.html#overflow and https://www.w3.org/TR/SVG2/render.html#OverflowAndClipProperties. More... | |
| enum class | PatternUnits : uint8_t { UserSpaceOnUse , ObjectBoundingBox , Default = ObjectBoundingBox } |
| PatternUnits controls the coordinate system of the x/y/width/height attributes: More... | |
| enum class | PatternContentUnits : uint8_t { UserSpaceOnUse , ObjectBoundingBox , Default = UserSpaceOnUse } |
| PatternContentUnits controls the coordinate system of the children of the pattern: More... | |
| enum class | PointerEvents : uint8_t { None , BoundingBox , VisiblePainted , VisibleFill , VisibleStroke , Visible , Painted , Fill , Stroke , All } |
| Values for the 'pointer-events' property, which defines how mouse events interact with an element. More... | |
| enum class | 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 | 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 | ElementType : uint8_t { Circle , ClipPath , Defs , Ellipse , FeGaussianBlur , Filter , G , Image , Line , LinearGradient , Marker , Mask , Path , Pattern , Polygon , Polyline , RadialGradient , Rect , Stop , Style , SVG , Symbol , Text , 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 | ResourceLoaderError : uint8_t { NotFound , SandboxViolation } |
| Error codes for resource loading. More... | |
| enum class | UrlLoaderError : uint8_t { NotFound , UnsupportedFormat , InvalidDataUrl , DataCorrupt } |
| Enum of possible errors that can occur when loading an image. More... | |
| enum class | DataUrlParserError |
| Enum of possible errors that can occur when loading an image. | |
Functions | |
| std::ostream & | operator<< (std::ostream &os, const FilterEffect &paint) |
| Ostream output operator. | |
| 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, Display value) |
| Ostream output operator for Display enum, outputs the CSS value. | |
| std::ostream & | operator<< (std::ostream &os, FillRule value) |
| Ostream output operator for FillRule enum, outputs the CSS value. | |
| std::ostream & | operator<< (std::ostream &os, LengthAdjust units) |
| Ostream output operator for LengthAdjust enum, outputs the enum name with prefix, e.g. LengthAdjust::Spacing. | |
| std::ostream & | operator<< (std::ostream &os, MarkerUnits units) |
| Ostream output operator for MarkerUnits enum, outputs the enum name with prefix, e.g. MarkerUnits::UserSpaceOnUse. | |
| std::ostream & | operator<< (std::ostream &os, MaskUnits units) |
| Ostream output operator for MaskUnits enum, outputs the enum name with prefix, e.g. MaskUnits::UserSpaceOnUse. | |
| std::ostream & | operator<< (std::ostream &os, MaskContentUnits units) |
| Ostream output operator for MaskContentUnits enum, outputs the enum name with prefix, e.g. MaskContentUnits::UserSpaceOnUse. | |
| std::ostream & | operator<< (std::ostream &os, Overflow value) |
| Ostream output operator for Overflow enum, outputs the CSS value. | |
| std::ostream & | operator<< (std::ostream &os, PathSpline::CommandType type) |
| std::ostream & | operator<< (std::ostream &os, const PathSpline::Command &command) |
| std::ostream & | operator<< (std::ostream &os, const PathSpline &spline) |
| 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, const PreserveAspectRatio &value) |
| 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. | |
| MATCHER_P2 (PointsAndCommandsAre, pointsMatcher, commandsMatcher, "") | |
| Matches the points and commands of a PathSpline. | |
| MATCHER_P (VertexPointsAre, pointsMatcher, "") | |
| Matches the points of a from the PathSpline vertices list. | |
| template<typename... Matchers> | |
| auto | VertexPointsAre (Matchers... matchers) |
| Matches the points of a from the PathSpline vertices list. | |
| std::ostream & | operator<< (std::ostream &os, const TransformOrigin &origin) |
| std::ostream & | operator<< (std::ostream &os, Visibility value) |
| Ostream output operator for Visibility enum, outputs the CSS value. | |
| 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. | |
| void | DumpTree (SVGElement element, int depth=0) |
Dump the SVG tree to the console, starting with element. | |
| std::ostream & | operator<< (std::ostream &os, const PaintServer &paint) |
| Output stream operator for PaintServer. | |
| 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::ostream & | operator<< (std::ostream &os, const PropertyRegistry ®istry) |
| std::tuple< Lengthd, double > | CalculateRadiusMaybeAuto (const Property< Lengthd > &property, const Property< Lengthd > &fallbackProperty, const Boxd &viewBox, const FontMetrics &fontMetrics) |
| Calculates the the radius for elements with rx and ry radius, in pixels, taking into account the "auto" identifier and handling negative values. | |
| std::string | TestNameFromFilename (const testing::TestParamInfo< ImageComparisonTestcase > &info) |
| Generates a test name from the SVG filename in the test parameter info. | |
| TEST_P (ImageComparisonTestFixture, ResvgTest) | |
| INSTANTIATE_TEST_SUITE_P (Color, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-color", { {"a-color-interpolation-filters-001.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Display, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-display", { {"a-display-005.svg", Params::Skip()}, {"a-display-006.svg", Params::Skip()}, {"a-display-009.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Fill, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-fill", { {"a-fill-010.svg", Params::Skip()}, {"a-fill-015.svg", Params::Skip()}, {"a-fill-027.svg", Params::Skip()}, {"a-fill-031.svg", Params::Skip()}, {"a-fill-032.svg", Params::Skip()}, {"a-fill-033.svg", Params::Skip()}, {"a-fill-opacity-004.svg", Params::Skip()}, {"a-fill-opacity-006.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (MarkerAttrib, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-marker")), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Opacity, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-opacity", { {"a-opacity-005.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Overflow, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-overflow")), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Shape, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-shape", { {"a-shape-rendering-005.svg", Params::Skip()}, {"a-shape-rendering-008.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (StopAttributes, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-stop")), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Stroke, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-stroke", { {"a-stroke-007.svg", Params::Skip()}, {"a-stroke-008.svg", Params::Skip()}, {"a-stroke-009.svg", Params::Skip()}, {"a-stroke-dasharray-005.svg", Params::Skip()}, {"a-stroke-dasharray-007.svg", Params::Skip()}, {"a-stroke-dasharray-009.svg", Params::Skip()}, {"a-stroke-dasharray-013.svg", Params::WithThreshold(0.13f)}, {"a-stroke-dashoffset-004.svg", Params::Skip()}, {"a-stroke-linejoin-004.svg", Params::Skip()}, {"a-stroke-linejoin-005.svg", Params::Skip()}, {"a-stroke-opacity-004.svg", Params::Skip()}, {"a-stroke-opacity-006.svg", Params::Skip()}, {"a-stroke-width-004.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Style, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-style", { {"a-style-003.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Transform, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-transform", { {"a-transform-007.svg", Params::WithThreshold(0.05f)}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Visibility, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("a-visibility", { {"a-visibility-003.svg", Params::Skip()}, {"a-visibility-004.svg", Params::Skip()}, {"a-visibility-007.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Circle, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-circle")), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (ClipPath, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-clipPath", { {"e-clipPath-007.svg", Params::Skip()}, {"e-clipPath-009.svg", Params::Skip()}, {"e-clipPath-010.svg", Params::Skip()}, {"e-clipPath-011.svg", Params::Skip()}, {"e-clipPath-012.svg", Params::Skip()}, {"e-clipPath-042.svg", Params::Skip()}, {"e-clipPath-044.svg", Params::Skip()}, {"e-clipPath-046.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Defs, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-defs", { {"e-defs-007.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Ellipse, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-ellipse")), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (G, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-g")), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Image, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-image", { {"e-image-003.svg", Params::Skip()}, {"e-image-006.svg", Params::Skip()}, {"e-image-007.svg", Params::Skip()}, {"e-image-008.svg", Params::Skip()}, {"e-image-017.svg", Params::Skip()}, {"e-image-018.svg", Params::Skip()}, {"e-image-019.svg", Params::Skip()}, {"e-image-020.svg", Params::Skip()}, {"e-image-021.svg", Params::Skip()}, {"e-image-022.svg", Params::Skip()}, {"e-image-023.svg", Params::Skip()}, {"e-image-024.svg", Params::Skip()}, {"e-image-029.svg", Params::Skip()}, {"e-image-030.svg", Params::Skip()}, {"e-image-031.svg", Params::Skip()}, {"e-image-032.svg", Params::Skip()}, {"e-image-033.svg", Params::Skip()}, {"e-image-034.svg", Params::Skip()}, {"e-image-039.svg", Params::Skip()}, {"e-image-040.svg", Params::Skip()}, {"e-image-041.svg", Params::Skip()}, }, Params::WithThreshold(0.2f).disableDebugSkpOnFailure())), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Line, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-line-", { {"e-line-001.svg", Params::WithThreshold(0.02f)}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (LinearGradient, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-linearGradient", { {"e-linearGradient-037.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Marker, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-marker", { {"e-marker-008.svg", Params::Skip()}, {"e-marker-017.svg", Params::Skip()}, {"e-marker-018.svg", Params::Skip()}, {"e-marker-019.svg", Params::Skip()}, {"e-marker-022.svg", Params::Skip()}, {"e-marker-032.svg", Params::Skip()}, {"e-marker-044.svg", Params::Skip()}, {"e-marker-045.svg", Params::WithGoldenOverride("donner/svg/renderer/testdata/golden/resvg-e-marker-045.png")}, {"e-marker-051.svg", Params::WithGoldenOverride("donner/svg/renderer/testdata/golden/resvg-e-marker-051.png")}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Mask, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-mask", { {"e-mask-017.svg", Params::Skip()}, {"e-mask-022.svg", Params::Skip()}, {"e-mask-025.svg", Params::Skip()}, {"e-mask-026.svg", Params::Skip()}, {"e-mask-027.svg", Params::Skip()}, {"e-mask-029.svg", Params::Skip()}, {"e-mask-030.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Path, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-path")), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Pattern, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-pattern", { {"e-pattern-003.svg", Params::Skip()}, {"e-pattern-008.svg", Params::WithThreshold(kDefaultThreshold, 250)}, {"e-pattern-010.svg", Params::WithThreshold(kDefaultThreshold, 150)}, {"e-pattern-018.svg", Params::Skip()}, {"e-pattern-019.svg", Params::WithThreshold(0.2f)}, {"e-pattern-020.svg", Params::WithThreshold(0.6f, 300)}, {"e-pattern-021.svg", Params::WithThreshold(0.2f)}, {"e-pattern-022.svg", Params::WithThreshold(0.2f)}, {"e-pattern-023.svg", Params::WithThreshold(0.2f)}, {"e-pattern-028.svg", Params::Skip()}, {"e-pattern-030.svg", Params::WithThreshold(0.02f)}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Polygon, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-polygon")), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Polyline, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-polyline")), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (RadialGradient, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-radialGradient", { {"e-radialGradient-031.svg", Params::Skip()}, {"e-radialGradient-032.svg", Params::Skip()}, {"e-radialGradient-039.svg", Params::Skip()}, {"e-radialGradient-040.svg", Params::Skip()}, {"e-radialGradient-043.svg", Params::Skip()}, {"e-radialGradient-044.svg", Params::Skip()}, {"e-radialGradient-045.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Rect, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-rect", { {"e-rect-022.svg", Params::Skip()}, {"e-rect-023.svg", Params::Skip()}, {"e-rect-029.svg", Params::Skip()}, {"e-rect-031.svg", Params::Skip()}, {"e-rect-034.svg", Params::Skip()}, {"e-rect-036.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (StopElement, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-stop", { {"e-stop-011.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (StyleElement, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-style", { {"e-style-012.svg", Params::Skip()}, {"e-style-014.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (SvgElement, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-svg", { {"e-svg-002.svg", Params::Skip()}, {"e-svg-003.svg", Params::Skip()}, {"e-svg-005.svg", Params::Skip()}, {"e-svg-007.svg", Params::Skip()}, {"e-svg-008.svg", Params::WithThreshold(0.13f)}, {"e-svg-009.svg", Params::WithThreshold(0.13f)}, {"e-svg-010.svg", Params::WithThreshold(0.13f)}, {"e-svg-011.svg", Params::WithThreshold(0.13f)}, {"e-svg-012.svg", Params::WithThreshold(0.13f)}, {"e-svg-013.svg", Params::WithThreshold(0.13f)}, {"e-svg-014.svg", Params::WithThreshold(0.13f)}, {"e-svg-015.svg", Params::WithThreshold(0.13f)}, {"e-svg-016.svg", Params::WithThreshold(0.13f)}, {"e-svg-017.svg", Params::WithThreshold(0.13f)}, {"e-svg-018.svg", Params::Skip()}, {"e-svg-019.svg", Params::Skip()}, {"e-svg-020.svg", Params::Skip()}, {"e-svg-021.svg", Params::Skip()}, {"e-svg-028.svg", Params::Skip()}, {"e-svg-029.svg", Params::Skip()}, {"e-svg-031.svg", Params::Skip()}, {"e-svg-032.svg", Params::Skip()}, {"e-svg-033.svg", Params::Skip()}, {"e-svg-036.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (SymbolElement, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-symbol", { {"e-symbol-010.svg", Params::Skip()}, })), TestNameFromFilename) | |
| INSTANTIATE_TEST_SUITE_P (Use, ImageComparisonTestFixture, ValuesIn(getTestsWithPrefix("e-use", { {"e-use-008.svg", Params::Skip()}, })), TestNameFromFilename) | |
| 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. | |
| SVGDocument | instantiateSubtree (std::string_view str, const parser::SVGParser::Options &options, const Vector2i &size) |
| ParsedFragment | instantiateSubtreeElement (std::string_view str, const parser::SVGParser::Options &options, Vector2i size) |
| template<typename ElementT> | |
| ParsedFragment< ElementT > | instantiateSubtreeElementAs (std::string_view str, const parser::SVGParser::Options &options={}, Vector2i size=kTestSvgDefaultSize) |
Variables | |
| constexpr std::string_view | kUserAgentStylesheet |
| The user agent stylesheet to be used by default on all SVG documents. | |
Donner SVG library, which can load, manipulate and render SVG files.
Loading SVG files can be done using donner::svg::parser::SVGParser
The resulting SVGDocument can be used to traverse the SVG file:
The SVG file can be rendered using donner::svg::RendererSkia
| 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]. |
| struct donner::svg::TransformOrigin |
| struct donner::svg::Image |
Stores an uncompressed RGBA-format image.
Loaded by RendererTestUtils::readRgbaImageFromPngFile.
| Class Members | ||
|---|---|---|
| vector< uint8_t > | data | Pixel data, in RGBA format. Rows are are strideInPixels long (byte length is strideInPixels * 4). |
| int | height | Image height in pixels. |
| size_t | strideInPixels | The stride of data, in pixels. |
| int | width | Image width in pixels. |
| 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. |
A type list of all SVG element types, used by donner::svg::parser::AttributeParser and donner::svg::parser::SVGParser.
| 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.
|
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.
|
strong |
The parsed result of the clip-rule property, see: https://drafts.fxtf.org/css-masking-1/#propdef-clip-rule.
|
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. |
|
strong |
SVG element types, corresponds to each XML element name, such as "<circle>", "<svg>", "<rect>", etc.
| Enumerator | |
|---|---|
| Circle | |
| ClipPath | |
| Defs | |
| Ellipse | |
| FeGaussianBlur | |
| Filter | |
| G | |
| Image | |
| Line | |
| LinearGradient | |
| Marker | |
| Mask | |
| Path | |
| Pattern | |
| Polygon | |
| Polyline | |
| RadialGradient | |
| Rect | |
| Stop | "<stop>", for gradient stops. |
| Style | |
| SVG | "<svg>", SVG root element. |
| Symbol | |
| Text | |
| TSpan | |
| Unknown | For unknown elements. |
| Use | |
|
strong |
The parsed result of the 'fill-rule' property, see: https://www.w3.org/TR/SVG2/painting.html#FillRuleProperty.
|
strong |
Values for the "filterUnits" attribute which defines the coordinate system for attributes x, y, width, height.
This is used on "<filter>" element.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
| 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. |
|
strong |
PatternUnits controls the coordinate system of the x/y/width/height attributes:
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:
See also: PatternUnits
| 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. |
|
strong |
Values for the 'pointer-events' property, which defines how mouse events interact with an element.
|
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.
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. |
|
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>". |
|
strong |
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. |
|
strong |
The current property state, which can be either set, not set, or a specific CSS keyword such as "inherit", "initial", or "unset".
|
strong |
|
strong |
The parsed result of the 'stroke-linecap' property, see: https://www.w3.org/TR/SVG2/painting.html#StrokeLinecapProperty.
|
strong |
The parsed result of the 'stroke-linejoin' property, see: https://www.w3.org/TR/SVG2/painting.html#StrokeLinejoinProperty.
|
strong |
Enum of possible errors that can occur when loading an image.
|
strong |
The parsed result of the 'visibility' property, see: https://www.w3.org/TR/CSS2/visufx.html#propdef-visibility.
This determines whether the element is visible or hidden, and whether it affects layout.
| Enumerator | |
|---|---|
| Visible | [DEFAULT] Visible is the default value. |
| Hidden | Hidden elements are invisible, but still affect layout. |
| Collapse | Collapsed elements are invisible, and do not affect layout. |
| std::tuple< Lengthd, double > donner::svg::CalculateRadiusMaybeAuto | ( | const Property< Lengthd > & | property, |
| const Property< Lengthd > & | fallbackProperty, | ||
| const Boxd & | viewBox, | ||
| const FontMetrics & | fontMetrics ) |
Calculates the the radius for elements with rx and ry radius, in pixels, taking into account the "auto" identifier and handling negative values.
This is used for "<rect>" or "<ellipse>".
| property | The property to compute, the storage for either rx or ry. |
| fallbackProperty | The other property to use if the first one is "auto". |
| viewBox | The viewBox to use for computing the length. |
| fontMetrics | The font metrics to use for computing the length. |
| void donner::svg::DumpTree | ( | SVGElement | element, |
| int | depth = 0 ) |
Dump the SVG tree to the console, starting with element.
| element | The root element of the tree to dump. |
| depth | The depth of the current element in the tree, used to control indentation. Defaults to 0 for the root. |
| donner::svg::MATCHER_P2 | ( | PointsAndCommandsAre | , |
| pointsMatcher | , | ||
| commandsMatcher | , | ||
| "" | ) |
Matches the points and commands of a PathSpline.
| pointsMatcher | Points array matcher. |
| commandsMatcher | Commands array matcher. |
|
inline |
| std::ostream & donner::svg::operator<< | ( | std::ostream & | os, |
| const PaintServer & | paint ) |
Output stream operator for PaintServer.
Ostream output operator.
| std::ostream & donner::svg::operator<< | ( | std::ostream & | os, |
| const PathSpline & | spline ) |
| os | Output stream. |
| spline | Spline to output. |
| std::ostream & donner::svg::operator<< | ( | std::ostream & | os, |
| const PathSpline::Command & | command ) |
| os | Output stream. |
| command | Command to output. |
| std::ostream & donner::svg::operator<< | ( | std::ostream & | os, |
| const PreserveAspectRatio & | value ) |
Format: "PreserveAspectRatio {<align>, <meetOrSlice>}" Example: "PreserveAspectRatio {Align::XMidYMid, MeetOrSlice::Meet}"
| 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:
| os | Output stream to write to. |
| property | Property to output. |
| std::ostream & donner::svg::operator<< | ( | std::ostream & | os, |
| const PropertyRegistry & | registry ) |
Example output:
| os | Output stream. |
| registry | PropertyRegistry to output. |
| std::ostream & donner::svg::operator<< | ( | std::ostream & | os, |
| PathSpline::CommandType | type ) |
CommandType::MoveTo.
| os | Output stream. |
| type | Command type. |
| std::string donner::svg::TestNameFromFilename | ( | const testing::TestParamInfo< ImageComparisonTestcase > & | info | ) |
Generates a test name from the SVG filename in the test parameter info.
This is used by GTest to create human-readable test names for parameterized tests.
| info | Test parameter information containing the ImageComparisonTestcase. |
| 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:
Example 2:
| ReturnType | Return type of the function. |
| FnT | Function type, with signature ReturnType(std::integral_constant<ElementType>). |
| type | Runtime element type. |
| fn | Function to call with the compile-time element type, with signature ReturnType(std::integral_constant<ElementType>). |
| auto donner::svg::VertexPointsAre | ( | Matchers... | matchers | ) |
Matches the points of a from the PathSpline vertices list.
Variadic template function that accepts matchers or expected values for each vertex point.
|
constexpr |
The user agent stylesheet to be used by default on all SVG documents.