1#![doc(html_logo_url = "https://kornelski.github.io/rust-lcms2/lcms_logo.png")]
5#![doc(html_root_url = "https://docs.rs/lcms2-sys")]
6
7pub mod ffi;
8pub use crate::ffi::*;
9use std::mem::MaybeUninit;
10
11#[doc(hidden)]
12extern crate libc;
13
14impl CIEXYZ {
15 #[must_use]
16 pub fn d50() -> &'static CIEXYZ {
17 unsafe { cmsD50_XYZ() }
18 }
19}
20
21impl CIExyY {
22 #[must_use]
23 pub fn d50() -> &'static CIExyY {
24 unsafe { cmsD50_xyY() }
25 }
26}
27
28impl From<CIEXYZ> for CIExyY {
29 fn from(f: CIEXYZ) -> Self {
30 unsafe {
31 let mut new = MaybeUninit::uninit();
32 cmsXYZ2xyY(new.as_mut_ptr(), &f);
33 new.assume_init()
34 }
35 }
36}
37
38impl From<CIExyY> for CIEXYZ {
39 fn from(f: CIExyY) -> Self {
40 unsafe {
41 let mut new = MaybeUninit::uninit();
42 cmsxyY2XYZ(new.as_mut_ptr(), &f);
43 new.assume_init()
44 }
45 }
46}
47
48impl From<CIELab> for CIELCh {
49 fn from(f: CIELab) -> Self {
50 unsafe {
51 let mut new = MaybeUninit::uninit();
52 cmsLab2LCh(new.as_mut_ptr(), &f);
53 new.assume_init()
54 }
55 }
56}
57
58impl From<CIELCh> for CIELab {
59 fn from(f: CIELCh) -> Self {
60 unsafe {
61 let mut new = MaybeUninit::uninit();
62 cmsLCh2Lab(new.as_mut_ptr(), &f);
63 new.assume_init()
64 }
65 }
66}
67
68#[test]
69fn it_works() {
70 unsafe {
71 let c = cmsCreateContext(std::ptr::null_mut(), std::ptr::null_mut());
72 cmsDeleteContext(c);
73
74 let xyz: CIEXYZ = ::std::default::Default::default();
75 let _: CIExyY = xyz.into();
76 }
77}