1#![forbid(unsafe_code)]
4
5#[cfg(feature = "captions")]
6use captions::{CaptionCue, CaptionTrack};
7#[cfg(feature = "diagram")]
8use diagram::Scale;
9
10use motion_core::MorphPath;
11
12pub mod asset;
13pub mod atmosphere;
14#[cfg(feature = "captions")]
15pub mod captions;
16#[cfg(feature = "diagram")]
17pub mod diagram;
18#[cfg(feature = "text")]
19pub mod font;
20pub mod image;
21#[cfg(feature = "particles")]
22pub mod particles;
23#[cfg(feature = "svg")]
24pub mod svg;
25#[cfg(feature = "text")]
26pub mod text;
27pub mod vector;
28
29pub use asset::AssetsExt;
30#[cfg(feature = "text")]
31pub use font::{FontFace, FontIdentifier, FontLibrary, MAX_FONT_FACE_BYTES};
32#[cfg(feature = "image")]
33pub use image::{AnimatedImage, AnimatedImageAsset, ImageLoopMode};
34pub use image::{Fit, Image, ImageAsset, ImageLevel, Sampling};
35#[cfg(feature = "particles")]
36pub use particles::{
37 Attractor, Ballistic, BounceBox, BurstEmitter, ColorOverLifetime, Converge, CurlNoise,
38 DiskEmitter, Drag, Gravity, NoiseDrift, Orbit, Particle, ParticleEmitter, ParticleModifier,
39 ParticleSimulation, ParticleStyle, ParticleTrajectory, PathEmitter, PointEmitter, RectEmitter,
40 Seek, SimulationLimits, SimulationStats, SizeOverLifetime, SurfaceEmitter, TrajectoryModel,
41 Vortex, Wind,
42};
43
44#[cfg(feature = "svg")]
45pub use svg::{Svg, SvgAsset, SvgDiagnostic};
46#[cfg(feature = "text")]
47pub use text::{
48 FontWeight, ParagraphLayout, PartStyle, Text, TextAlignment, TextGlyph, TextPart, TextSpan,
49 TextSplit,
50};
51pub use vector::{
52 Morph, SurfaceTriangle, VectorGroup, VectorImage, VectorItem, VectorLeaf, VectorMask,
53 VectorPath, VectorSurface, VectorTree, WriteOptions,
54};
55
56pub mod prelude {
58 #[cfg(feature = "image")]
59 pub use crate::{AnimatedImage, AnimatedImageAsset, ImageLoopMode};
60 pub use crate::{
61 AssetsExt, Fit, Image, ImageAsset, ImageLevel, Morph, Sampling, VectorGroup, VectorImage,
62 VectorItem, VectorLeaf, VectorMask, VectorPath, VectorSurface, VectorTree, WriteOptions,
63 };
64 #[cfg(feature = "text")]
65 pub use crate::{
66 FontFace, FontIdentifier, FontLibrary, FontWeight, ParagraphLayout, PartStyle, Text,
67 TextAlignment, TextGlyph, TextPart, TextSpan, TextSplit,
68 };
69 #[cfg(test)]
70 pub use motion_render::{Composition, RenderOptions, RenderPrepare, Renderer, render_still};
71}
72
73const MAX_CUBE_BYTES: u64 = 8 * 1024 * 1024;
75
76pub fn load_lut(path: impl AsRef<std::path::Path>) -> motion_core::Result<motion_core::Lut3d> {
78 use std::io::Read;
79 let file = std::fs::File::open(path)?;
80 let mut text = String::new();
81 file.take(MAX_CUBE_BYTES + 1).read_to_string(&mut text)?;
82 Ok(motion_core::Lut3d::from_cube(&text)?)
83}
84
85pub fn load_shaper(path: impl AsRef<std::path::Path>) -> motion_core::Result<motion_core::Lut1d> {
87 use std::io::Read;
88 let file = std::fs::File::open(path)?;
89 let mut text = String::new();
90 file.take(MAX_CUBE_BYTES + 1).read_to_string(&mut text)?;
91 Ok(motion_core::Lut1d::from_cube(&text)?)
92}
93
94#[cfg(feature = "image")]
95pub(crate) fn image_error(error: ::image::ImageError) -> motion_core::Error {
96 motion_core::Error::Other(Box::new(error))
97}