zenjxl_decoder/api/
mod.rs1mod color;
9mod convenience;
10mod data_types;
11mod decoder;
12mod inner;
13mod input;
14#[cfg(feature = "cms")]
15mod moxcms_wrapper;
16mod options;
17mod signature;
18mod xyb_constants;
19
20pub use crate::image::JxlOutputBuffer;
21pub use color::*;
22pub use convenience::{JxlImage, JxlImageInfo, decode, decode_with, read_header, read_header_with};
23#[cfg(feature = "jpeg")]
24pub use convenience::{reconstruct_jpeg, reconstruct_jpeg_with};
25pub use data_types::*;
26pub use decoder::*;
27pub use enough::{Stop, Unstoppable};
28pub use inner::*;
29pub use input::*;
30#[cfg(feature = "cms")]
31pub use moxcms_wrapper::*;
32pub use options::*;
33pub use signature::*;
34
35pub use crate::error::{Error, Result};
37
38pub use crate::image::{
40 DataTypeTag, Image, ImageDataType, ImageRect, ImageRectMut, OwnedRawImage, RawImageRect,
41 RawImageRectMut, Rect,
42};
43
44pub use crate::headers::color_encoding::RenderingIntent;
46pub use crate::headers::extra_channels::ExtraChannel;
47pub use crate::headers::image_metadata::Orientation;
48
49pub use crate::container::gain_map::GainMapBundle;
51
52pub use crate::features::spline::Point;
54
55#[cfg(feature = "profiling")]
57pub use crate::util::profiling::print_profile_report;
58
59#[derive(Debug, PartialEq)]
67pub enum ProcessingResult<T, U> {
68 Complete { result: T },
69 NeedsMoreInput { size_hint: usize, fallback: U },
70}
71
72impl<T> ProcessingResult<T, ()> {
73 fn new(
74 result: Result<T, crate::error::Error>,
75 ) -> Result<ProcessingResult<T, ()>, crate::error::Error> {
76 match result {
77 Ok(v) => Ok(ProcessingResult::Complete { result: v }),
78 Err(crate::error::Error::OutOfBounds(v)) => Ok(ProcessingResult::NeedsMoreInput {
79 size_hint: v,
80 fallback: (),
81 }),
82 Err(e) => Err(e),
83 }
84 }
85}
86
87#[derive(Clone)]
88#[non_exhaustive]
89pub struct ToneMapping {
90 pub intensity_target: f32,
91 pub min_nits: f32,
92 pub relative_to_max_display: bool,
93 pub linear_below: f32,
94}
95
96#[derive(Clone)]
97#[non_exhaustive]
98pub struct JxlBasicInfo {
99 pub size: (usize, usize),
100 pub bit_depth: JxlBitDepth,
101 pub orientation: Orientation,
102 pub extra_channels: Vec<JxlExtraChannel>,
103 pub animation: Option<JxlAnimation>,
104 pub uses_original_profile: bool,
105 pub tone_mapping: ToneMapping,
106 pub preview_size: Option<(usize, usize)>,
107 pub intrinsic_size: Option<(usize, usize)>,
113}