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...
#include "donner/svg/core/CssTransform.h"
|
| struct | Simple |
| | Stores a precomputed transform. More...
|
| struct | Translate |
| | Stores a deferred translate() operation, which can have two <length-percentage> arguments, such as translate(1em 30px). More...
|
|
|
using | Element = std::variant<Simple, Translate> |
| | A transform or a deferred operation.
|
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).
translate() = translate( <length-percentage> [, <length-percentage> ]? )
To resolve translate(), we need to know the font size and the viewBox size, which is context-dependent, so we cannot precompute the transform from the transform function list. Instead, store a chain of of transforms and deferred operations, and compute the final transform when needed, inside the CssTransform::compute() function.
See https://www.w3.org/TR/css-transforms-1/#two-d-transform-functions for more details about CSS transforms.
CssTransform is parsed by donner::svg::parser::CssTransformParser.
◆ donner::svg::CssTransform::Simple
| struct donner::svg::CssTransform::Simple |
Stores a precomputed transform.
◆ donner::svg::CssTransform::Translate
| struct donner::svg::CssTransform::Translate |
Stores a deferred translate() operation, which can have two <length-percentage> arguments, such as translate(1em 30px).
◆ CssTransform()
| donner::svg::CssTransform::CssTransform |
( |
const Transformd & | transform | ) |
|
|
inlineexplicit |
Construct a transform initialized with the given transform.
- Parameters
-
| transform | Initial transform. |
◆ appendTransform()
| void donner::svg::CssTransform::appendTransform |
( |
const Transformd & | transform | ) |
|
|
inline |
Append a transform to the transform chain.
- Parameters
-
◆ appendTranslate()
| void donner::svg::CssTransform::appendTranslate |
( |
Lengthd | x, |
|
|
Lengthd | y ) |
|
inline |
Append a translate() operation to the transform chain.
- Parameters
-
◆ compute()
Compute the final transform from the list of transforms and deferred operations.
- Parameters
-
| viewBox | ViewBox size, used to resolve percentage units. |
| fontMetrics | Font metrics, used to resolve 'em' and other font-relative units. |
The documentation for this class was generated from the following file: