pub enum Generator {
Fill {
paint: Paint,
},
Shapes {
items: Vec<ShapeItem>,
},
Text {
text: TextContent,
style: TextStyle,
},
Layout {
root: Box<LayoutNode>,
},
}Expand description
The picture of a generated source.
A generated picture has the canvas’s size and aspect. Positions are normalized, (0, 0)
top-left to (1, 1) bottom-right, and lengths are fractions of the shorter side, so the
picture is the same at any render resolution. A fill never changes over time; text
changes only through its style’s animators; shapes and layouts may change.
Variants§
Fill
Paint over the whole picture.
Shapes
Shapes drawn from an ordered content tree, as an After Effects or Lottie shape layer draws them. Every value in the tree may be keyframed in picture time.
Text
Text on a transparent picture, laid out and placed by its style as caption cues are, and drawn with the host’s registered fonts.
Fields
text: TextContentThe text, a string or runs; \n starts a line. Non-empty, at most
MAX_TEXT_CONTENT_BYTES bytes. Run times are picture time.
style: TextStyleHow it looks and where it lies. The font size is at most
MAX_TEXT_GENERATOR_FONT_SIZE.
Layout
Boxes laid out by CSS flexbox around their text and shapes, with the engine’s fonts. Any
value in the tree may be keyframed in picture time. See LayoutNode.
Fields
root: Box<LayoutNode>The root box: the whole picture.
Implementations§
Source§impl Generator
impl Generator
Sourcepub fn validate(&self) -> Result<(), GeneratorIssue>
pub fn validate(&self) -> Result<(), GeneratorIssue>
Checks every field. A shapes or layout generator’s problem names where in its tree it
lies. A layout’s pixel font sizes are checked only by Self::validate_on, which knows
the canvas.
§Errors
Returns the first problem, if any.
Sourcepub fn validate_on(&self, width: u32, height: u32) -> Result<(), GeneratorIssue>
pub fn validate_on(&self, width: u32, height: u32) -> Result<(), GeneratorIssue>
Self::validate for a generator drawn on a width by height canvas, which a layout’s
pixel lengths refer to.
§Errors
Returns the first problem, if any.