pub struct PreparedAnimation { /* private fields */ }Expand description
A preprocessed animation that can be rendered repeatedly.
Expression resolution, support analysis, and image-asset preparation are performed once and then reused across multiple frames.
Implementations§
Source§impl PreparedAnimation
impl PreparedAnimation
Sourcepub fn render_gif(
&self,
config: GifRenderConfig,
) -> Result<Vec<u8>, RasterlottieError>
Available on crate feature gif only.
pub fn render_gif( &self, config: GifRenderConfig, ) -> Result<Vec<u8>, RasterlottieError>
gif only.Renders the prepared animation as a GIF.
§Errors
Returns an error when the prepared animation cannot be encoded as a GIF.
Source§impl PreparedAnimation
impl PreparedAnimation
Sourcepub fn render_frame(
&self,
frame: f32,
config: RenderConfig,
) -> Result<RasterFrame, RasterlottieError>
pub fn render_frame( &self, frame: f32, config: RenderConfig, ) -> Result<RasterFrame, RasterlottieError>
Renders one frame while reusing the stored preprocessing results.
§Errors
Returns an error when the frame cannot be rasterized with the prepared assets.
Sourcepub fn new_scratch_pixmap(&self) -> Result<Pixmap, RasterlottieError>
pub fn new_scratch_pixmap(&self) -> Result<Pixmap, RasterlottieError>
Allocates a scratch pixmap that matches the animation’s native canvas size.
§Errors
Returns an error when the native canvas size is invalid.
Sourcepub fn new_scratch_pixmap_for_config(
&self,
config: RenderConfig,
) -> Result<Pixmap, RasterlottieError>
pub fn new_scratch_pixmap_for_config( &self, config: RenderConfig, ) -> Result<Pixmap, RasterlottieError>
Allocates a scratch pixmap sized for config.
§Errors
Returns an error when config produces an invalid output canvas size.
Sourcepub fn render_frame_into_pixmap(
&self,
frame: f32,
config: RenderConfig,
pixmap: &mut Pixmap,
) -> Result<(), RasterlottieError>
pub fn render_frame_into_pixmap( &self, frame: f32, config: RenderConfig, pixmap: &mut Pixmap, ) -> Result<(), RasterlottieError>
Renders a frame directly into an existing pixmap.
§Errors
Returns an error when the pixmap size does not match config or the
frame cannot be rasterized.