### Execute Traced Render Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/index.html Full example of setting environment variables and running a traced render command. ```powershell $env:RASTERLOTTIE_TRACE='1' $env:RUST_LOG='rasterlottie_cli=debug,rasterlottie=trace' cargo run --example rasterlottie_cli --features tracing -- render-mp4 work\input.json work\output.mp4 --fps 60 ``` -------------------------------- ### Create a new GifRenderConfig Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.GifRenderConfig.html Constructor method for initializing a new GIF render configuration instance. ```rust pub const fn new( render: RenderConfig, max_fps: f32, max_duration_seconds: f32, color_quantizer_speed: i32, ) -> Self ``` -------------------------------- ### GifRenderConfig::new Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.GifRenderConfig.html Creates a new GIF render configuration instance with the specified rendering settings and output constraints. ```APIDOC ## GifRenderConfig::new(render, max_fps, max_duration_seconds, color_quantizer_speed) ### Description Creates a GIF render configuration from per-frame settings and output limits. ### Parameters - **render** (RenderConfig) - Required - Per-frame rasterization settings. - **max_fps** (f32) - Required - Maximum output frame rate. - **max_duration_seconds** (f32) - Required - Maximum output duration in seconds. - **color_quantizer_speed** (i32) - Required - Quantizer speed passed to the GIF encoder. ``` -------------------------------- ### Renderer::new Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Renderer.html Creates a new renderer instance using the provided support profile. ```APIDOC ## Renderer::new(profile: SupportProfile) ### Description Creates a renderer that uses the provided support profile. ### Parameters - **profile** (SupportProfile) - Required - The support profile to use for the renderer. ``` -------------------------------- ### Benchmark Rendering Performance Source: https://docs.rs/rasterlottie Commands to benchmark raw frame rendering performance. ```bash cargo run --example benchmark_render -- --mode gif --json ``` ```bash cargo run --example benchmark_render --features dotlottie -- --mode gif --json ``` -------------------------------- ### Analyze and Render Lottie Files Source: https://docs.rs/rasterlottie Commands to analyze Lottie files and render them into various formats like GIF, PNG, and MP4. ```bash cargo run --example rasterlottie_cli -- analyze ``` ```bash cargo run --example rasterlottie_cli -- render-gif ``` ```bash cargo run --example rasterlottie_cli -- render-png ``` ```bash cargo run --example rasterlottie_cli -- render-mp4 ``` -------------------------------- ### Run RasterLottie CLI Commands Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/index.html Commands for analyzing, rendering, and benchmarking animations using the CLI tool. ```bash cargo run --example rasterlottie_cli -- analyze ``` ```bash cargo run --example rasterlottie_cli -- render-gif ``` ```bash cargo run --example rasterlottie_cli -- render-png ``` ```bash cargo run --example rasterlottie_cli -- render-mp4 ``` ```bash cargo run --example rasterlottie_cli --features dotlottie -- analyze ``` ```bash cargo run --example rasterlottie_cli --features dotlottie -- render-gif ``` ```bash cargo run --example rasterlottie_cli --features dotlottie -- render-png ``` ```bash cargo run --example rasterlottie_cli --features dotlottie -- render-mp4 ``` ```bash cargo run --example benchmark_render -- --mode gif --json ``` ```bash cargo run --example benchmark_render --features dotlottie -- --mode gif --json ``` -------------------------------- ### Run Benchmark Comparison Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/index.html Compare rasterlottie render timing against rlottie using PowerShell. ```powershell tools/bench/compare-with-rlottie-docker.ps1 -InputJson work\input.json -Mode both ``` -------------------------------- ### Analyze and Render dotLottie Archives Source: https://docs.rs/rasterlottie Commands to process packaged dotLottie archives using the dotlottie feature. ```bash cargo run --example rasterlottie_cli --features dotlottie -- analyze ``` ```bash cargo run --example rasterlottie_cli --features dotlottie -- render-gif ``` ```bash cargo run --example rasterlottie_cli --features dotlottie -- render-png ``` ```bash cargo run --example rasterlottie_cli --features dotlottie -- render-mp4 ``` -------------------------------- ### Configure Tracing Environment Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/index.html Set environment variables to enable and configure tracing output. ```bash RUST_LOG=rasterlottie_cli=debug ``` ```bash RUST_LOG=rasterlottie=trace ``` -------------------------------- ### Load a dotlottie archive Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/index.html Load a packaged .lottie archive from bytes when the dotlottie feature is enabled. ```rust use rasterlottie::Animation; let dotlottie = std::fs::read("example.lottie")?; let animation = Animation::from_dotlottie_bytes(&dotlottie)?; ``` -------------------------------- ### TextDocument Implementation Methods Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.TextDocument.html Methods for converting color components and calculating layout metrics. ```rust pub fn fill_color_rgba(&self) -> Option<[u8; 4]> ``` ```rust pub fn stroke_color_rgba(&self) -> Option<[u8; 4]> ``` ```rust pub fn effective_line_height(&self) -> f32 ``` -------------------------------- ### Run Tracing Enabled CLI Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/index.html Commands to run the CLI with the tracing feature enabled. ```bash cargo run --example rasterlottie_cli --features tracing -- analyze ``` ```bash cargo run --example rasterlottie_cli --features tracing -- render-gif --fps 60 ``` ```bash cargo run --example rasterlottie_cli --features tracing -- render-mp4 --fps 60 ``` -------------------------------- ### Configure rasterlottie dependencies Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/index.html Add the rasterlottie crate to your Cargo.toml file. Use feature flags to enable dotlottie support or disable default features for a minimal build. ```toml [dependencies] rasterlottie = "" ``` ```toml [dependencies] rasterlottie = { version = "", features = ["dotlottie"] } ``` ```toml [dependencies] rasterlottie = { version = "", default-features = false } ``` -------------------------------- ### Pixmap::new Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Pixmap.html Allocates a new pixmap filled with transparent black by default. ```APIDOC ## pub fn new(width: u32, height: u32) -> Option ### Description Allocates a new pixmap. A pixmap is filled with transparent black by default (0, 0, 0, 0). Returns None if the size is zero or exceeds limits. ``` -------------------------------- ### pub fn analyze_animation_with_profile Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/fn.analyze_animation_with_profile.html Analyzes an animation with the provided support profile. ```APIDOC ## analyze_animation_with_profile ### Description Analyzes an animation with the provided support profile. ### Signature `pub fn analyze_animation_with_profile(animation: &Animation, profile: SupportProfile) -> SupportReport` ### Parameters - **animation** (&Animation) - The animation to analyze. - **profile** (SupportProfile) - The support profile to use for the analysis. ### Returns - **SupportReport** - A report detailing the support status of the animation based on the provided profile. ``` -------------------------------- ### GifRenderConfig Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.GifRenderConfig.html The structure definition for GIF rendering configuration, containing fields for frame rendering, frame rate, duration, and quantizer speed. ```rust #[non_exhaustive] pub struct GifRenderConfig { pub render: RenderConfig, pub max_fps: f32, pub max_duration_seconds: f32, pub color_quantizer_speed: i32, } ``` -------------------------------- ### Render a Lottie animation frame Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/index.html Parse a Lottie JSON string and render a specific frame using the default renderer configuration. ```rust use rasterlottie::{Animation, RenderConfig, Renderer}; let animation = Animation::from_json_str( r#"{ "v":"5.7.6", "fr":30, "ip":0, "op":30, "w":64, "h":64, "layers":[] }"#, )?; let frame = Renderer::default().render_frame(&animation, 0.0, RenderConfig::default())?; assert_eq!((frame.width, frame.height), (64, 64)); ``` -------------------------------- ### render_gif Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.PreparedAnimation.html Renders the prepared animation as a GIF. This method is only available when the 'gif' feature is enabled. ```APIDOC ## pub fn render_gif(&self, config: GifRenderConfig) -> Result, RasterlottieError> ### Description Renders the prepared animation as a GIF. Returns an error if the animation cannot be encoded. ### Parameters - **config** (GifRenderConfig) - Configuration settings for the GIF rendering process. ### Returns - **Result, RasterlottieError>** - A byte vector containing the encoded GIF data, or an error. ``` -------------------------------- ### Animation::from_dotlottie_bytes Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Animation.html Parses the primary animation from a .lottie archive. ```APIDOC ## pub fn from_dotlottie_bytes(dotlottie: &[u8]) -> Result ### Description Parses the primary animation from a .lottie archive. Requires the 'dotlottie' feature. Returns an error if the archive is invalid or the embedded JSON cannot be parsed. ### Parameters - **dotlottie** (&[u8]) - Required - The byte array of the .lottie archive. ``` -------------------------------- ### Rgba8::new Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Rgba8.html Creates a new RGBA color instance from individual channel values. ```APIDOC ## pub const fn new(r: u8, g: u8, b: u8, a: u8) -> Self ### Description Creates a new RGBA color from the provided red, green, blue, and alpha channel values. ### Parameters - **r** (u8) - The red channel value. - **g** (u8) - The green channel value. - **b** (u8) - The blue channel value. - **a** (u8) - The alpha channel value. ### Returns - **Self** - A new Rgba8 instance. ``` -------------------------------- ### analyze_animation_with_profile Function Signature Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/fn.analyze_animation_with_profile.html Displays the function signature for analyzing an animation with a support profile. ```rust pub fn analyze_animation_with_profile( animation: &Animation, profile: SupportProfile, ) -> SupportReport ``` -------------------------------- ### SupportProfile::with_external_image_assets Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.SupportProfile.html Returns a copy of this profile with external image assets enabled or disabled. ```APIDOC ## pub const fn with_external_image_assets(self, allow: bool) -> Self ### Description Returns a copy of this profile with external image assets enabled or disabled. ### Parameters - **allow** (bool) - Required - Whether to enable or disable external image assets. ``` -------------------------------- ### Define RenderConfig Struct Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.RenderConfig.html The structure definition for RenderConfig, which is marked as non-exhaustive. ```rust #[non_exhaustive] pub struct RenderConfig { pub background: Rgba8, pub scale: f32, } ``` -------------------------------- ### pub fn analyze_animation(animation: &Animation) -> SupportReport Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/fn.analyze_animation.html Analyzes an animation with the default target-corpus profile. ```APIDOC ## analyze_animation ### Description Analyzes an animation with the default target-corpus profile. ### Signature `pub fn analyze_animation(animation: &Animation) -> SupportReport` ### Parameters - **animation** (&Animation) - The animation object to be analyzed. ### Returns - **SupportReport** - A report detailing the support status of the animation. ``` -------------------------------- ### RasterFrame::new Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.RasterFrame.html Creates a new RasterFrame instance from the specified dimensions and pixel data. ```APIDOC ## pub const fn new(width: u32, height: u32, pixels: Vec) -> Self ### Description Creates a raster frame from dimensions and packed RGBA pixels. ### Parameters - **width** (u32) - Width in pixels. - **height** (u32) - Height in pixels. - **pixels** (Vec) - Packed RGBA8 pixels in row-major order. ``` -------------------------------- ### new_scratch_pixmap Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.PreparedAnimation.html Allocates a new scratch pixmap based on the animation's native size. ```APIDOC ## pub fn new_scratch_pixmap(&self) -> Result ### Description Allocates a scratch pixmap that matches the animation’s native canvas size. ### Returns - **Result** - The allocated pixmap or an error if the native size is invalid. ``` -------------------------------- ### Renderer::render_frame Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Renderer.html Renders a single frame without retaining preprocessing state. ```APIDOC ## Renderer::render_frame(&self, animation: &Animation, frame: f32, config: RenderConfig) ### Description Renders a single frame without retaining preprocessing state. ### Parameters - **animation** (&Animation) - Required - The animation to render. - **frame** (f32) - Required - The frame index to render. - **config** (RenderConfig) - Required - Configuration for the rendering process. ### Errors Returns an error when preprocessing fails or the frame cannot be rasterized. ``` -------------------------------- ### Renderer::render_gif Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Renderer.html Renders an animation as a GIF without retaining preprocessing state. Requires the 'gif' feature. ```APIDOC ## Renderer::render_gif(&self, animation: &Animation, config: GifRenderConfig) ### Description Renders an animation as a GIF without retaining preprocessing state. Available on crate feature `gif` only. ### Parameters - **animation** (&Animation) - Required - The animation to render. - **config** (GifRenderConfig) - Required - Configuration for the GIF output. ### Errors Returns an error when preprocessing fails or GIF encoding cannot be completed. ``` -------------------------------- ### Animation Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Animation.html The structure definition for the root Lottie animation document. ```rust pub struct Animation { pub version: String, pub frame_rate: f32, pub in_point: f32, pub out_point: f32, pub width: u32, pub height: u32, pub layers: Vec, pub assets: Vec, pub fonts: FontList, pub chars: Vec, } ``` -------------------------------- ### Renderer::analyze Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Renderer.html Analyzes an animation with the renderer's support profile. ```APIDOC ## Renderer::analyze(&self, animation: &Animation) ### Description Analyzes an animation with this renderer’s support profile. ### Parameters - **animation** (&Animation) - Required - The animation to analyze. ``` -------------------------------- ### as_color_rgba Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.AnimatedValue.html Retrieves the static value as RGBA8 color components. ```APIDOC ## pub fn as_color_rgba(&self) -> Option<[u8; 4]> Returns the static value as RGBA8 color components. ``` -------------------------------- ### Layer Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Layer.html The structure definition for a Lottie layer, containing all fields required for rendering and animation. ```rust pub struct Layer {Show 19 fields pub name: String, pub layer_type: LayerType, pub index: Option, pub parent: Option, pub hidden: bool, pub in_point: Option, pub out_point: Option, pub ref_id: Option, pub start_time: f32, pub stretch: f32, pub transform: Option, pub time_remap: Option, pub shapes: Vec, pub masks: Vec, pub track_matte: Option, pub matte_parent: Option, pub matte_source: Option, pub effects: Vec, pub text: Option, } ``` -------------------------------- ### SupportProfile Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.SupportProfile.html The structure defining the feature gates used by the support analyzer to validate Lottie features. ```rust pub struct SupportProfile { pub allow_masks: bool, pub allow_track_mattes: bool, pub allow_parenting: bool, pub allow_effects: bool, pub allow_text_layers: bool, pub allow_image_layers: bool, pub allow_image_assets: bool, pub allow_external_image_assets: bool, pub allow_expressions: bool, pub allow_animated_values: bool, pub allow_unknown_shape_items: bool, } ``` -------------------------------- ### render_frame_into_pixmap Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.PreparedAnimation.html Renders a frame directly into an existing pixmap buffer. ```APIDOC ## pub fn render_frame_into_pixmap(&self, frame: f32, config: RenderConfig, pixmap: &mut Pixmap) -> Result<(), RasterlottieError> ### Description Renders a frame directly into an existing pixmap. Returns an error if the pixmap size does not match the config or if rendering fails. ### Parameters - **frame** (f32) - The frame index to render. - **config** (RenderConfig) - Configuration settings for the rendering process. - **pixmap** (&mut Pixmap) - The target pixmap buffer. ``` -------------------------------- ### Animation::from_json_str Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Animation.html Parses a Lottie animation from a JSON string. ```APIDOC ## pub fn from_json_str(json: &str) -> Result ### Description Parses a Lottie animation from a JSON string. Returns an error if the input is not valid Lottie JSON. ### Parameters - **json** (&str) - Required - The JSON string representing the Lottie animation. ``` -------------------------------- ### Define Font struct Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Font.html The structure definition for a font used in Lottie documents. ```rust pub struct Font { pub name: String, pub family: String, pub style: String, pub ascent: f32, } ``` -------------------------------- ### BezierPath Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.BezierPath.html The primary structure definition for a static cubic Bezier path. ```rust pub struct BezierPath { pub closed: bool, pub vertices: Vec, } ``` -------------------------------- ### LayerType Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.LayerType.html The core structure definition for LayerType. ```rust pub struct LayerType(pub u8); ``` -------------------------------- ### SupportReport Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.SupportReport.html The primary structure for holding a collection of unsupported features. ```rust #[non_exhaustive] pub struct SupportReport { pub issues: Vec, } ``` -------------------------------- ### ImageAssetResolver Implementation for Closures Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/trait.ImageAssetResolver.html A blanket implementation allowing any function or closure matching the signature to act as an ImageAssetResolver. ```rust impl ImageAssetResolver for F where F: Fn(&Asset) -> Result>, RasterlottieError>, ``` -------------------------------- ### Pixmap::save_png Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Pixmap.html Saves the pixmap as a PNG file. ```APIDOC ## pub fn save_png

(&self, path: P) -> Result<(), EncodingError> ### Description Saves the current pixmap as a PNG file at the specified path. Requires the 'png-format' feature. ``` -------------------------------- ### advance_for_size Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.FontCharacter.html Calculates the scaled advance width for a given font size. ```APIDOC ## fn advance_for_size(&self, size: f32) -> Option ### Description Returns the scaled advance width for the requested font size. ### Parameters - **size** (f32) - The target font size for the calculation. ### Returns - **Option** - The scaled advance width if available, otherwise None. ``` -------------------------------- ### matches Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.FontCharacter.html Checks if the current glyph matches a specific grapheme and font metadata. ```APIDOC ## fn matches(&self, grapheme: &str, font: &Font) -> bool ### Description Returns true when this glyph matches the provided grapheme and font metadata. ### Parameters - **grapheme** (&str) - The grapheme string to compare against. - **font** (&Font) - The font metadata object to compare against. ### Returns - **bool** - True if the glyph matches, false otherwise. ``` -------------------------------- ### Analyze animation signature Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/fn.analyze_animation.html The function signature for analyzing an animation using the default target-corpus profile. ```rust pub fn analyze_animation(animation: &Animation) -> SupportReport ``` -------------------------------- ### as_vec3 Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.AnimatedValue.html Retrieves the static value as a 3D vector. ```APIDOC ## pub fn as_vec3(&self) -> Option<[f32; 3]> Returns the static value as a 3D vector. ``` -------------------------------- ### Transform Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Transform.html The core structure definition for Transform, containing optional animated properties for Lottie transformations. ```rust pub struct Transform { pub anchor: Option, pub position: Option, pub scale: Option, pub rotation: Option, pub opacity: Option, pub skew: Option, pub skew_axis: Option, } ``` -------------------------------- ### as_vec2 Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.AnimatedValue.html Retrieves the static value as a 2D vector. ```APIDOC ## pub fn as_vec2(&self) -> Option<[f32; 2]> Returns the static value as a 2D vector. ``` -------------------------------- ### Define TextData Struct Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.TextData.html The primary structure for holding text layer data including document collections and raw definitions. ```rust pub struct TextData { pub document: TextDocumentCollection, pub animators: Vec, pub path: Value, } ``` -------------------------------- ### Asset Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Asset.html The primary data structure representing an asset within the Lottie schema. ```rust pub struct Asset { pub id: String, pub name: Option, pub width: Option, pub height: Option, pub base_path: Option, pub path: Option, pub embedded: Option, pub layers: Vec, } ``` -------------------------------- ### Pixmap::fill_path Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Pixmap.html Draws a filled path onto the pixmap. ```APIDOC ## pub fn fill_path(&mut self, path: &Path, paint: &Paint<'_>, fill_rule: FillRule, transform: Transform, mask: Option<&Mask>) ### Description Draws a filled path onto the pixmap using the specified paint, fill rule, transform, and optional mask. ``` -------------------------------- ### as_scalar Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.AnimatedValue.html Retrieves the static value as a scalar float. ```APIDOC ## pub fn as_scalar(&self) -> Option Returns the static value as a scalar. ``` -------------------------------- ### Pixmap Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Pixmap.html The primary structure for holding premultiplied RGBA pixel data. ```rust pub struct Pixmap { /* private fields */ } ``` -------------------------------- ### Pixmap::fill Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Pixmap.html Fills the entire pixmap with a specified color. ```APIDOC ## pub fn fill(&mut self, color: Color) ### Description Fills the entire pixmap with the provided color. ``` -------------------------------- ### render_frame Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.PreparedAnimation.html Renders a specific frame of the animation using the preprocessed data. ```APIDOC ## pub fn render_frame(&self, frame: f32, config: RenderConfig) -> Result ### Description Renders one frame while reusing the stored preprocessing results. ### Parameters - **frame** (f32) - The frame index to render. - **config** (RenderConfig) - Configuration settings for the rendering process. ### Returns - **Result** - The rendered frame or an error if rasterization fails. ``` -------------------------------- ### SupportProfile::target_corpus Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.SupportProfile.html Returns the default profile used for the validated target corpus. ```APIDOC ## pub const fn target_corpus() -> Self ### Description Returns the default profile used for the validated target corpus. ``` -------------------------------- ### Animation::lookup_glyph Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Animation.html Finds a glyph entry that matches the given grapheme and font. ```APIDOC ## pub fn lookup_glyph(&self, grapheme: &str, font: &Font) -> Option<&FontCharacter> ### Description Retrieves a specific glyph entry based on the provided grapheme and font object. ### Parameters - **grapheme** (&str) - Required - The character or grapheme to look up. - **font** (&Font) - Required - The font object to search within. ``` -------------------------------- ### TextDocument Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.TextDocument.html The primary data structure for storing resolved text styling and layout information. ```rust pub struct TextDocument { pub text: String, pub font: String, pub size: f32, pub justify: u8, pub tracking: f32, pub line_height: f32, pub baseline_shift: f32, pub fill_color: Vec, pub stroke_color: Vec, pub stroke_width: f32, pub position: Option<[f32; 2]>, pub box_size: Option<[f32; 2]>, } ``` -------------------------------- ### Animation::lookup_font Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Animation.html Finds a font by its Lottie font name. ```APIDOC ## pub fn lookup_font(&self, name: &str) -> Option<&Font> ### Description Searches for a font within the animation metadata by its name. ### Parameters - **name** (&str) - Required - The Lottie font name to search for. ``` -------------------------------- ### ImageAssetResolver Source: https://docs.rs/rasterlottie Trait for resolving external image assets into encoded bytes. ```APIDOC ## ImageAssetResolver ### Description Resolves external image assets into encoded bytes. ``` -------------------------------- ### RasterFrame struct definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.RasterFrame.html The definition of the RasterFrame struct, containing width, height, and pixel data. ```rust #[non_exhaustive] pub struct RasterFrame { pub width: u32, pub height: u32, pub pixels: Vec, } ``` -------------------------------- ### ShapeItem Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.ShapeItem.html The definition of the ShapeItem struct containing all fields for Lottie shape representation. ```rust pub struct ShapeItem {Show 19 fields pub name: String, pub item_type: String, pub items: Vec, pub hidden: bool, pub expression: Option, pub path: Option, pub position: Option, pub size: Option, pub color: Option, pub opacity: Option, pub width: Option, pub anchor: Option, pub skew: Option, pub skew_axis: Option, pub line_cap: Option, pub line_join: Option, pub miter_limit: Option, pub miter_limit_value: Option, pub extra: BTreeMap, } ``` -------------------------------- ### Rgba8::TRANSPARENT Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Rgba8.html A constant representing a fully transparent black color. ```APIDOC ## pub const TRANSPARENT: Self ### Description A constant value representing a fully transparent black color (r=0, g=0, b=0, a=0). ``` -------------------------------- ### is_static Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.AnimatedValue.html Checks if the property is stored as a static literal value. ```APIDOC ## pub fn is_static(&self) -> bool Returns `true` when the property is stored as a static literal value. ``` -------------------------------- ### resolve_image_asset Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/trait.ImageAssetResolver.html Resolves an external image asset into encoded bytes. Returns the bytes as a vector, or None if the asset cannot be resolved. ```APIDOC ## fn resolve_image_asset(&self, asset: &Asset) -> Result>, RasterlottieError> ### Description Resolves external image assets into encoded bytes. This method is required for implementations of the ImageAssetResolver trait. ### Parameters - **asset** (&Asset) - The image asset to be resolved. ### Returns - **Result>, RasterlottieError>** - Returns Ok(Some(Vec)) containing the encoded bytes if successful, Ok(None) if the asset is unavailable, or an Err(RasterlottieError) if resolution fails. ``` -------------------------------- ### AnimatedValue Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.AnimatedValue.html The primary structure definition for an animated property. ```rust pub struct AnimatedValue { pub animated: Option, pub keyframes: Option, pub expression: Option, } ``` -------------------------------- ### SplitPosition Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.SplitPosition.html The structure definition for SplitPosition, containing optional animated values for spatial coordinates and a split flag. ```rust pub struct SplitPosition { pub split: Option, pub x: Option, pub y: Option, pub z: Option, } ``` -------------------------------- ### Define BezierVertex struct Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.BezierVertex.html The structure definition for a cubic Bezier vertex, containing the anchor point and its associated tangents. ```rust pub struct BezierVertex { pub vertex: [f32; 2], pub in_tangent: [f32; 2], pub out_tangent: [f32; 2], } ``` -------------------------------- ### Rgba8 Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Rgba8.html The definition of the Rgba8 struct, which contains four u8 fields for color channels. ```rust #[non_exhaustive] pub struct Rgba8 { pub r: u8, pub g: u8, pub b: u8, pub a: u8, } ``` -------------------------------- ### Pixmap::decode_png Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Pixmap.html Decodes PNG data into a Pixmap. ```APIDOC ## pub fn decode_png(data: &[u8]) -> Result ### Description Decodes PNG data into a Pixmap. Requires the 'png-format' feature. Only 8-bit images are supported. ``` -------------------------------- ### UnsupportedFeature Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.UnsupportedFeature.html The definition of the UnsupportedFeature struct, which is marked as non-exhaustive to allow for future field additions. ```rust #[non_exhaustive] pub struct UnsupportedFeature { pub path: String, pub kind: UnsupportedKind, pub detail: String, } ``` -------------------------------- ### ShapePathValue Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.ShapePathValue.html The primary data structure for storing shape path properties in rasterlottie. ```rust pub struct ShapePathValue { pub animated: Option, pub keyframes: Option, pub expression: Option, } ``` -------------------------------- ### is_split Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.SplitPosition.html Checks if the SplitPosition property is explicitly marked as split. ```APIDOC ## pub fn is_split(&self) -> bool ### Description Returns `true` when the property is explicitly marked as split. ### Parameters - **&self** - The instance of SplitPosition. ### Returns - **bool** - Returns true if split, false otherwise. ``` -------------------------------- ### Animation::duration_seconds Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Animation.html Returns the duration of the animation in seconds. ```APIDOC ## pub fn duration_seconds(&self) -> f32 ### Description Calculates and returns the total duration of the animation in seconds. ``` -------------------------------- ### ImageAssetResolver Trait Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/trait.ImageAssetResolver.html The core trait definition requiring the implementation of resolve_image_asset to fetch image data. ```rust pub trait ImageAssetResolver { // Required method fn resolve_image_asset( &self, asset: &Asset, ) -> Result>, RasterlottieError>; } ``` -------------------------------- ### TrackMatteMode Enum Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/enum.TrackMatteMode.html The definition of the TrackMatteMode enum, which includes variants for Alpha, AlphaInverted, Luma, and LumaInverted modes. ```rust #[non_exhaustive] pub enum TrackMatteMode { Alpha, AlphaInverted, Luma, LumaInverted, } ``` -------------------------------- ### FontCharacter Struct Definition Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.FontCharacter.html The primary data structure representing an embedded glyph outline. ```rust pub struct FontCharacter { pub character: String, pub size: f32, pub style: String, pub width: f32, pub data: FontCharacterData, pub family: Option, } ``` -------------------------------- ### MaskMode Enum Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/enum.MaskMode.html The MaskMode enum defines the available modes for mask operations. It is marked as non-exhaustive, requiring a wildcard arm when matching. ```APIDOC ## Enum: MaskMode ### Description Defines the supported mask modes for rasterization operations. ### Variants - **Add**: Additive mask. - **Subtract**: Subtractive mask. - **Intersect**: Intersection mask. - **None**: Disabled mask. ### Note This enum is marked as `#[non_exhaustive]`. When matching against these variants, you must include a wildcard arm to handle potential future additions. ``` -------------------------------- ### Define UnsupportedKind Enum Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/enum.UnsupportedKind.html The enum structure representing various unsupported feature categories in rasterlottie. ```rust #[non_exhaustive] pub enum UnsupportedKind { Show 14 variants LayerType, Masks, TrackMatte, Parenting, LayerTiming, TimeRemap, Effects, Expressions, AnimatedValue, TransformFeature, ImageAsset, Text, ShapeItem, MissingAsset, } ``` -------------------------------- ### Animation::duration_frames Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.Animation.html Returns the duration of the animation in frames. ```APIDOC ## pub fn duration_frames(&self) -> f32 ### Description Calculates and returns the total duration of the animation in frames. ``` -------------------------------- ### Define MaskMode Enum Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/enum.MaskMode.html The definition of the MaskMode enum, which is marked as non-exhaustive. ```rust #[non_exhaustive] pub enum MaskMode { Add, Subtract, Intersect, None, } ``` -------------------------------- ### has_expression Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/struct.AnimatedValue.html Checks if the animated property contains an expression. ```APIDOC ## pub const fn has_expression(&self) -> bool Returns `true` when the property carries an expression. ``` -------------------------------- ### Define PositionValue enum Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/enum.PositionValue.html The structure of the PositionValue enum, which is marked as non-exhaustive to allow for future variants. ```rust #[non_exhaustive] pub enum PositionValue { Split(SplitPosition), Combined(AnimatedValue), } ``` -------------------------------- ### Define RasterlottieError Enum Source: https://docs.rs/rasterlottie/0.2.1/rasterlottie/enum.RasterlottieError.html The structure of the RasterlottieError enum, representing various error conditions within the library. ```rust #[non_exhaustive] pub enum RasterlottieError { Parse(Error), DotLottieArchive(ZipError), InvalidDotLottie { detail: String, }, GifEncoding(EncodingError), Internal { detail: String, }, UnsupportedFeatures { report: SupportReport, }, InvalidCanvasSize { width: u32, height: u32, }, InvalidImageAsset { id: String, detail: String, }, InvalidTextLayer { layer: String, detail: String, }, } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.