Skip to main content

ocio/
lib.rs

1//! # ocio
2//!
3//! A pure Rust port of [OpenColorIO](https://opencolorio.org), the color
4//! management framework for visual effects and animation.
5//!
6//! ```no_run
7//! use ocio::Config;
8//!
9//! let config = Config::create_from_file("config.ocio").unwrap();
10//! let processor = config.get_processor("ACEScg", "sRGB - Display").unwrap();
11//! let cpu = processor.default_cpu_processor();
12//! let mut pixel = [0.18f32, 0.18, 0.18];
13//! cpu.apply_rgb(&mut pixel);
14//! ```
15
16// Lints that conflict with a faithful port of the C++ numerics: float
17// literals are kept exactly as in OCIO, index loops mirror the original
18// code, and negated comparisons preserve the NaN semantics of the C++.
19#![allow(
20    clippy::excessive_precision,
21    clippy::needless_range_loop,
22    clippy::neg_cmp_op_on_partial_ord,
23    clippy::too_many_arguments,
24    clippy::field_reassign_with_default,
25    clippy::manual_clamp,
26    clippy::neg_multiply,
27    clippy::nonminimal_bool,
28    clippy::enum_variant_names,
29    clippy::blocks_in_conditions,
30    clippy::redundant_closure_call,
31    clippy::wrong_self_convention,
32    clippy::ptr_arg
33)]
34#![cfg_attr(test, allow(clippy::approx_constant))]
35#![warn(missing_docs)]
36
37pub mod apphelpers;
38pub mod baker;
39pub mod builtins;
40pub mod config;
41pub mod context;
42pub mod dynamic_property;
43pub mod error;
44pub mod fileformats;
45pub mod format_metadata;
46pub mod gpu;
47pub mod hash_utils;
48pub mod image_desc;
49pub mod math_utils;
50pub mod ops;
51pub mod path_utils;
52pub mod processor;
53pub mod transforms;
54pub mod types;
55
56pub use baker::Baker;
57pub use config::Config;
58pub use context::Context;
59pub use dynamic_property::{DynamicProperty, SharedValue};
60pub use error::{Error, Result};
61pub use format_metadata::FormatMetadata;
62pub use image_desc::{ImageData, ImageDesc, PackedImageDesc, PlanarImageDesc};
63pub use processor::{CpuProcessor, Processor, ProcessorMetadata};
64pub use transforms::grading::*;
65pub use transforms::*;
66pub use types::*;
67
68/// Clear all the caches of the library (port of `ClearAllCaches`): the file
69/// transform cache (files are read again on the next use).
70pub fn clear_all_caches() {
71    fileformats::file_transform::clear_file_transform_caches();
72}
73
74/// Library version: the latest OCIO release fully covered by this port
75/// (see `UPSTREAM.md`).
76pub const OCIO_VERSION: &str = "2.5.2";
77/// Version of this crate.
78pub const VERSION: &str = env!("CARGO_PKG_VERSION");