jpegxl_sys\color/
cms_interface.rs1use std::ffi::c_void;
26
27use crate::common::types::JxlBool;
28
29use super::color_encoding::JxlColorEncoding;
30
31pub type JpegXlCmsSetFieldsFromIccFunc = extern "C-unwind" fn(
32 user_data: *mut c_void,
33 icc_data: *const u8,
34 icc_size: usize,
35 c: *mut JxlColorEncoding,
36 cmyk: *mut JxlBool,
37) -> JxlBool;
38
39#[repr(C)]
40#[derive(Debug, Clone)]
41pub struct JxlColorProfileIcc {
42 data: *const u8,
43 size: usize,
44}
45
46#[repr(C)]
47#[derive(Debug, Clone)]
48pub struct JxlColorProfile {
49 pub icc: JxlColorProfileIcc,
50 pub color_encoding: JxlColorEncoding,
51 pub num_channels: usize,
52}
53
54pub type JpegXlCmsInitFunc = extern "C-unwind" fn(
55 init_data: *mut c_void,
56 num_threads: usize,
57 pixels_per_thread: usize,
58 input_profile: *const JxlColorProfile,
59 output_profile: *const JxlColorProfile,
60 intensity_target: f32,
61) -> *mut c_void;
62
63pub type JpegXlCmsGetBufferFunc =
64 extern "C-unwind" fn(user_data: *mut c_void, thread: usize) -> *mut f32;
65
66pub type JpegXlCmsRunFunc = extern "C-unwind" fn(
67 user_data: *mut c_void,
68 thread: usize,
69 input_buffer: *const f32,
70 output_buffer: *mut f32,
71 num_pixels: usize,
72) -> JxlBool;
73
74pub type JpegXlCmsDestroyFun = extern "C-unwind" fn(user_data: *mut c_void);
75
76#[repr(C)]
77#[derive(Debug, Clone)]
78pub struct JxlCmsInterface {
79 pub set_fields_data: *mut c_void,
80 pub set_fields_from_icc: JpegXlCmsSetFieldsFromIccFunc,
81 pub init_data: *mut c_void,
82 pub init: JpegXlCmsInitFunc,
83 pub get_src_buf: JpegXlCmsGetBufferFunc,
84 pub get_dst_buf: JpegXlCmsGetBufferFunc,
85 pub run: JpegXlCmsRunFunc,
86 pub destroy: JpegXlCmsDestroyFun,
87}