#![forbid(unsafe_code)]
#[cfg(feature = "captions")]
use captions::{CaptionCue, CaptionTrack};
#[cfg(feature = "diagram")]
use diagram::Scale;
use motion_core::MorphPath;
pub mod asset;
pub mod atmosphere;
#[cfg(feature = "captions")]
pub mod captions;
#[cfg(feature = "diagram")]
pub mod diagram;
#[cfg(feature = "text")]
pub mod font;
pub mod image;
mod options;
#[cfg(feature = "particles")]
pub mod particles;
#[cfg(feature = "svg")]
pub mod svg;
#[cfg(feature = "text")]
pub mod text;
pub mod vector;
pub use asset::AssetsExt;
#[cfg(feature = "text")]
pub use font::{FontFace, FontIdentifier, FontLibrary, MAX_FONT_FACE_BYTES};
#[cfg(feature = "image")]
pub use image::{AnimatedImage, AnimatedImageAsset, ImageLoopMode};
pub use image::{Fit, Image, ImageAsset, ImageLevel, Sampling};
pub use options::{
CollisionResponse, FieldCoordinate, Inherit, ParticleEventKind, Preset, TextAlignment,
TextSplit,
};
#[cfg(feature = "particles")]
pub use particles::{
Attractor, Ballistic, BounceBox, BurstEmitter, ColorOverLifetime, Converge, CurlNoise,
DiskEmitter, Drag, Gravity, NoiseDrift, Orbit, Particle, ParticleEmitter, ParticleModifier,
ParticleSimulation, ParticleSimulationBuilder, ParticleStyle, ParticleTrajectory, PathEmitter,
PointEmitter, RectEmitter, Seek, SimulationLimits, SimulationStats, SizeOverLifetime,
SurfaceEmitter, TrajectoryModel, Vortex, Wind,
};
#[cfg(feature = "svg")]
pub use svg::{Svg, SvgAsset, SvgDiagnostic};
#[cfg(feature = "text")]
pub use text::{
FontWeight, ParagraphLayout, ParagraphStyle, PartStyle, Text, TextGlyph, TextPart, TextSpan,
};
pub use vector::{
CompileCache, Morph, SurfaceTriangle, VectorGroup, VectorImage, VectorItem, VectorLeaf,
VectorMask, VectorPath, VectorSelection, VectorSurface, VectorTree, WriteOptions,
};
pub mod prelude {
#[cfg(feature = "image")]
pub use crate::{AnimatedImage, AnimatedImageAsset, ImageLoopMode};
pub use crate::{
AssetsExt, Fit, Image, ImageAsset, ImageLevel, Morph, Sampling, VectorGroup, VectorImage,
VectorItem, VectorLeaf, VectorMask, VectorPath, VectorSurface, VectorTree, WriteOptions,
};
#[cfg(feature = "text")]
pub use crate::{
FontFace, FontIdentifier, FontLibrary, FontWeight, ParagraphLayout, ParagraphStyle,
PartStyle, Text, TextAlignment, TextGlyph, TextPart, TextSpan, TextSplit,
};
#[cfg(test)]
pub use motion_render::{BackendKind, Composition, RenderOptions, RenderPrepare, render_still};
}
const MAX_CUBE_BYTES: u64 = 8 * 1024 * 1024;
pub fn load_lut(path: impl AsRef<std::path::Path>) -> motion_core::Result<motion_core::Lut3d> {
use std::io::Read;
let file = std::fs::File::open(path)?;
let mut text = String::new();
file.take(MAX_CUBE_BYTES + 1).read_to_string(&mut text)?;
Ok(motion_core::Lut3d::from_cube(&text)?)
}
pub fn load_shaper(path: impl AsRef<std::path::Path>) -> motion_core::Result<motion_core::Lut1d> {
use std::io::Read;
let file = std::fs::File::open(path)?;
let mut text = String::new();
file.take(MAX_CUBE_BYTES + 1).read_to_string(&mut text)?;
Ok(motion_core::Lut1d::from_cube(&text)?)
}
#[cfg(feature = "image")]
pub(crate) fn image_error(error: ::image::ImageError) -> motion_core::Error {
motion_core::Error::Other(Box::new(error))
}