moxcms/
lib.rs

1/*
2 * // Copyright (c) Radzivon Bartoshyk 2/2025. All rights reserved.
3 * //
4 * // Redistribution and use in source and binary forms, with or without modification,
5 * // are permitted provided that the following conditions are met:
6 * //
7 * // 1.  Redistributions of source code must retain the above copyright notice, this
8 * // list of conditions and the following disclaimer.
9 * //
10 * // 2.  Redistributions in binary form must reproduce the above copyright notice,
11 * // this list of conditions and the following disclaimer in the documentation
12 * // and/or other materials provided with the distribution.
13 * //
14 * // 3.  Neither the name of the copyright holder nor the names of its
15 * // contributors may be used to endorse or promote products derived from
16 * // this software without specific prior written permission.
17 * //
18 * // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 * // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 * // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29#![allow(clippy::manual_clamp, clippy::excessive_precision)]
30#![cfg_attr(docsrs, feature(doc_cfg))]
31#![deny(unreachable_pub)]
32#![deny(
33    clippy::print_stdout,
34    clippy::print_stderr,
35    clippy::print_literal,
36    clippy::print_in_format_impl
37)]
38#![allow(stable_features)]
39#![cfg_attr(
40    not(any(feature = "avx", feature = "sse", feature = "avx512", feature = "neon")),
41    forbid(unsafe_code)
42)]
43#![cfg_attr(all(feature = "avx512", target_arch = "x86_64"), feature(cfg_version))]
44#![cfg_attr(
45    all(feature = "avx512", target_arch = "x86_64"),
46    feature(avx512_target_feature)
47)]
48#![cfg_attr(
49    all(feature = "avx512", target_arch = "x86_64"),
50    feature(stdarch_x86_avx512)
51)]
52mod chad;
53mod cicp;
54mod conversions;
55mod dat;
56mod defaults;
57mod err;
58mod gamma;
59mod gamut;
60mod ictcp;
61mod jzazbz;
62mod jzczhz;
63mod lab;
64mod luv;
65/// One of main intent is to provide fast math available in const context
66/// ULP most of the methods <= 0.5
67mod math;
68mod matrix;
69mod mlaf;
70mod nd_array;
71mod oklab;
72mod oklch;
73mod profile;
74mod reader;
75mod rgb;
76mod safe_math;
77mod tag;
78mod transform;
79mod trc;
80mod writer;
81mod yrg;
82// Simple math analysis module
83mod chromaticity;
84mod dt_ucs;
85mod helpers;
86mod lut_hint;
87mod matan;
88mod srlab2;
89mod xyy;
90
91pub use chad::{
92    adapt_to_d50, adapt_to_d50_d, adapt_to_illuminant, adapt_to_illuminant_d,
93    adapt_to_illuminant_xyz, adapt_to_illuminant_xyz_d, adaption_matrix, adaption_matrix_d,
94};
95pub use chromaticity::Chromaticity;
96pub use cicp::{CicpColorPrimaries, ColorPrimaries, MatrixCoefficients, TransferCharacteristics};
97pub use dat::ColorDateTime;
98pub use defaults::{
99    HLG_LUT_TABLE, PQ_LUT_TABLE, WHITE_POINT_D50, WHITE_POINT_D60, WHITE_POINT_D65,
100    WHITE_POINT_DCI_P3,
101};
102pub use dt_ucs::{DtUchHcb, DtUchHsb, DtUchJch};
103pub use err::{CmsError, MalformedSize};
104pub use gamut::filmlike_clip;
105pub use ictcp::ICtCp;
106pub use jzazbz::Jzazbz;
107pub use jzczhz::Jzczhz;
108pub use lab::Lab;
109pub use luv::{LCh, Luv};
110pub use math::rounding_div_ceil;
111pub use matrix::{
112    BT2020_MATRIX, DISPLAY_P3_MATRIX, Matrix3, Matrix3d, Matrix3f, Matrix4f, SRGB_MATRIX, Vector3,
113    Vector3d, Vector3f, Vector3i, Vector3u, Vector4, Vector4d, Vector4f, Vector4i, Xyz, Xyzd,
114};
115pub use nd_array::{Cube, Hypercube};
116pub use oklab::Oklab;
117pub use oklch::Oklch;
118pub use profile::{
119    CicpProfile, ColorProfile, DataColorSpace, DescriptionString, LocalizableString, LutDataType,
120    LutMultidimensionalType, LutStore, LutType, LutWarehouse, Measurement, MeasurementGeometry,
121    ParsingOptions, ProfileClass, ProfileSignature, ProfileText, ProfileVersion, RenderingIntent,
122    StandardIlluminant, StandardObserver, TechnologySignatures, ViewingConditions,
123};
124pub use rgb::{FusedExp, FusedExp2, FusedExp10, FusedLog, FusedLog2, FusedLog10, FusedPow, Rgb};
125pub use srlab2::Srlab2;
126pub use transform::{
127    BarycentricWeightScale, InPlaceStage, InterpolationMethod, Layout, PointeeSizeExpressible,
128    Stage, Transform8BitExecutor, Transform16BitExecutor, TransformExecutor,
129    TransformF32BitExecutor, TransformF64BitExecutor, TransformOptions,
130};
131pub use trc::{GammaLutInterpolate, ToneCurveEvaluator, ToneReprCurve, curve_from_gamma};
132pub use xyy::{XyY, XyYRepresentable};
133pub use yrg::{Ych, Yrg, cie_y_1931_to_cie_y_2006};