Oregami
Repositories/oxedyne/fe2o3

oxedyne/fe2o3/fe2o3_graphics/src/icc/mod.rs

1.5 KiB, 4 runs

created by r1870400018:68831, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1//! ICC profiles: a reader of version 2 and 4 profiles, the matrix path, and two spaces built in.
2//!
3//! [`read`] parses a profile's header, its tag table and the tags a transform is built from, with
4//! every read bounded by the tag's declared size and the file's length. [`matrix`] carries the
5//! RGB-to-XYZ path through colorants and curves, and RGB to grey through a grey curve's inverse.
6//! [`builtin`] holds sRGB and sGray as formulas.
7//!
8//! # The bundled profile
9//!
10//! With the `fogra39` feature on, [`FOGRA39L`] holds the bytes of FOGRA39L Coated (122 KB, CC0,
11//! from colord; `data/icc/LICENCE.txt`) and [`fogra39l`] reads them. The feature is off by default,
12//! and a build for `wasm32` leaves it off, so a wasm package carries no profile bytes.
13//!
14//! [Written with AI entirely](https://need2know.ai/entirely-ai/code)\
15//! Anthropic Claude
16
17pub mod builtin;
18pub mod grid;
19pub mod lab;
20pub mod lut;
21pub mod matrix;
22pub mod read;
23pub mod transform;
24
25use oxedyne_fe2o3_core::prelude::*;
26
27#[cfg(feature = "fogra39")]
28pub const FOGRA39L: &[u8] = include_bytes!("../../data/icc/FOGRA39L_coated.icc");
29
30/// Reads the bundled FOGRA39L Coated profile.
31#[cfg(feature = "fogra39")]
32pub fn fogra39l() -> Outcome<read::Profile> {
33 read::Profile::read("FOGRA39L_coated.icc (bundled)", FOGRA39L)
34}
35
36/// Refuses the bundled profile in a build that does not carry it.
37#[cfg(not(feature = "fogra39"))]
38pub fn fogra39l() -> Outcome<read::Profile> {
39 Err(err!("The FOGRA39L Coated profile is not bundled in this build; name a profile file instead."; Invalid, Input, Unimplemented))
40}