Struct ColorProfile

Source
#[repr(C)]
pub struct ColorProfile {
Show 34 fields pub pcs: DataColorSpace, pub color_space: DataColorSpace, pub profile_class: ProfileClass, pub rendering_intent: RenderingIntent, pub red_colorant: Xyzd, pub green_colorant: Xyzd, pub blue_colorant: Xyzd, pub white_point: Xyzd, pub black_point: Option<Xyzd>, pub media_white_point: Option<Xyzd>, pub luminance: Option<Xyzd>, pub measurement: Option<Measurement>, pub red_trc: Option<ToneReprCurve>, pub green_trc: Option<ToneReprCurve>, pub blue_trc: Option<ToneReprCurve>, pub gray_trc: Option<ToneReprCurve>, pub cicp: Option<CicpProfile>, pub chromatic_adaptation: Option<Matrix3d>, pub lut_a_to_b_perceptual: Option<LutWarehouse>, pub lut_a_to_b_colorimetric: Option<LutWarehouse>, pub lut_a_to_b_saturation: Option<LutWarehouse>, pub lut_b_to_a_perceptual: Option<LutWarehouse>, pub lut_b_to_a_colorimetric: Option<LutWarehouse>, pub lut_b_to_a_saturation: Option<LutWarehouse>, pub gamut: Option<LutWarehouse>, pub copyright: Option<ProfileText>, pub description: Option<ProfileText>, pub device_manufacturer: Option<ProfileText>, pub device_model: Option<ProfileText>, pub char_target: Option<ProfileText>, pub viewing_conditions: Option<ViewingConditions>, pub viewing_conditions_description: Option<ProfileText>, pub technology: Option<TechnologySignatures>, pub calibration_date: Option<ColorDateTime>, /* private fields */
}
Expand description

ICC Profile representation

Fields§

§pcs: DataColorSpace§color_space: DataColorSpace§profile_class: ProfileClass§rendering_intent: RenderingIntent§red_colorant: Xyzd§green_colorant: Xyzd§blue_colorant: Xyzd§white_point: Xyzd§black_point: Option<Xyzd>§media_white_point: Option<Xyzd>§luminance: Option<Xyzd>§measurement: Option<Measurement>§red_trc: Option<ToneReprCurve>§green_trc: Option<ToneReprCurve>§blue_trc: Option<ToneReprCurve>§gray_trc: Option<ToneReprCurve>§cicp: Option<CicpProfile>§chromatic_adaptation: Option<Matrix3d>§lut_a_to_b_perceptual: Option<LutWarehouse>§lut_a_to_b_colorimetric: Option<LutWarehouse>§lut_a_to_b_saturation: Option<LutWarehouse>§lut_b_to_a_perceptual: Option<LutWarehouse>§lut_b_to_a_colorimetric: Option<LutWarehouse>§lut_b_to_a_saturation: Option<LutWarehouse>§gamut: Option<LutWarehouse>§copyright: Option<ProfileText>§description: Option<ProfileText>§device_manufacturer: Option<ProfileText>§device_model: Option<ProfileText>§char_target: Option<ProfileText>§viewing_conditions: Option<ViewingConditions>§viewing_conditions_description: Option<ProfileText>§technology: Option<TechnologySignatures>§calibration_date: Option<ColorDateTime>

Implementations§

Source§

impl ColorProfile

Source

pub fn new_srgb() -> ColorProfile

Creates new sRGB profile

Source

pub fn new_adobe_rgb() -> ColorProfile

Creates new Adobe RGB profile

Source

pub fn new_display_p3() -> ColorProfile

Creates new Display P3 profile

Source

pub fn new_display_p3_pq() -> ColorProfile

Creates new Display P3 PQ profile

Source

pub fn new_dci_p3() -> ColorProfile

Creates new DCI P3 profile

Source

pub fn new_pro_photo_rgb() -> ColorProfile

Creates new ProPhoto RGB profile

Source

pub fn new_bt2020() -> ColorProfile

Creates new Bt.2020 profile

Source

pub fn new_bt2020_pq() -> ColorProfile

Creates new Bt.2020 PQ profile

Source

pub fn new_bt2020_hlg() -> ColorProfile

Creates new Bt.2020 HLG profile

Source

pub fn new_gray_with_gamma(gamma: f32) -> ColorProfile

Creates new Monochrome profile

Source

pub fn new_aces_aces_2065_1_linear() -> ColorProfile

Creates new ACES 2065-1/AP0 profile

Source

pub fn new_aces_cg_linear() -> ColorProfile

Creates new ACEScg profile

Source§

impl ColorProfile

Source

pub fn version(&self) -> ProfileVersion

Returns profile version

Source

pub fn new_from_slice(slice: &[u8]) -> Result<Self, CmsError>

Source

pub fn new_from_slice_with_options( slice: &[u8], options: ParsingOptions, ) -> Result<Self, CmsError>

Source§

impl ColorProfile

Source

pub fn colorant_matrix(&self) -> Matrix3d

Source

pub const fn colorants_matrix( white_point: XyY, primaries: ColorPrimaries, ) -> Matrix3d

Computes colorants matrix. Returns not transposed matrix.

To work on const context this method does have restrictions. If invalid values were provided it may return invalid matrix or NaNs.

Source

pub const fn update_rgb_colorimetry( &mut self, white_point: XyY, primaries: ColorPrimaries, )

Updates RGB triple colorimetry from 3 Chromaticity and white point

Source

pub const fn update_rgb_colorimetry_triplet( &mut self, white_point: XyY, red_xyz: Xyzd, green_xyz: Xyzd, blue_xyz: Xyzd, )

Updates RGB triple colorimetry from 3 Xyzd and white point

To work on const context this method does have restrictions. If invalid values were provided it may return invalid matrix or NaNs.

Source

pub fn update_rgb_colorimetry_from_cicp(&mut self, cicp: CicpProfile) -> bool

Updates RGB triple colorimetry from CICP

Source

pub const fn rgb_to_xyz(&self, xyz_matrix: Matrix3f, wp: Xyz) -> Matrix3f

Source

pub const fn rgb_to_xyz_d(xyz_matrix: Matrix3d, wp: Xyzd) -> Matrix3d

If Primaries is invalid will return invalid matrix on const context

Source

pub fn rgb_to_xyz_matrix(&self) -> Matrix3d

Source

pub fn transform_matrix(&self, dest: &ColorProfile) -> Matrix3d

Computes transform matrix RGB -> XYZ -> RGB Current profile is used as source, other as destination

Source

pub fn profile_volume(&self) -> Option<f32>

Returns volume of colors stored in profile

Source§

impl ColorProfile

Source

pub fn is_matrix_shaper(&self) -> bool

Checks if profile is valid Matrix Shaper profile

Source

pub fn create_transform_16bit( &self, src_layout: Layout, dst_pr: &ColorProfile, dst_layout: Layout, options: TransformOptions, ) -> Result<Box<Transform16BitExecutor>, CmsError>

Creates transform between source and destination profile Use for 16 bit-depth data bit-depth only.

Source

pub fn create_transform_12bit( &self, src_layout: Layout, dst_pr: &ColorProfile, dst_layout: Layout, options: TransformOptions, ) -> Result<Box<Transform16BitExecutor>, CmsError>

Creates transform between source and destination profile Use for 12 bit-depth data bit-depth only.

Source

pub fn create_transform_10bit( &self, src_layout: Layout, dst_pr: &ColorProfile, dst_layout: Layout, options: TransformOptions, ) -> Result<Box<Transform16BitExecutor>, CmsError>

Creates transform between source and destination profile Use for 10 bit-depth data bit-depth only.

Source

pub fn create_transform_f32( &self, src_layout: Layout, dst_pr: &ColorProfile, dst_layout: Layout, options: TransformOptions, ) -> Result<Box<TransformF32BitExecutor>, CmsError>

Creates transform between source and destination profile Data has to be normalized into [0, 1] range. ICC profiles and LUT tables do not exist in infinite precision. Thus, this implementation considers f32 as 14-bit values. Floating point transformer works in extended mode, that means returned data might be negative or more than 1.

Source

pub fn create_transform_f64( &self, src_layout: Layout, dst_pr: &ColorProfile, dst_layout: Layout, options: TransformOptions, ) -> Result<Box<TransformF64BitExecutor>, CmsError>

Creates transform between source and destination profile Data has to be normalized into [0, 1] range. ICC profiles and LUT tables do not exist in infinite precision. Thus, this implementation considers f64 as 16-bit values. Floating point transformer works in extended mode, that means returned data might be negative or more than 1.

Source

pub fn create_transform_8bit( &self, src_layout: Layout, dst_pr: &ColorProfile, dst_layout: Layout, options: TransformOptions, ) -> Result<Box<Transform8BitExecutor>, CmsError>

Creates transform between source and destination profile Only 8 bit is supported.

Source§

impl ColorProfile

Source

pub fn build_8bit_lin_table( &self, trc: &Option<ToneReprCurve>, ) -> Result<Box<[f32; 256]>, CmsError>

Produces LUT for 8 bit tone linearization

Source

pub fn build_gray_linearize_table<T: PointeeSizeExpressible, const N: usize, const BIT_DEPTH: usize>( &self, ) -> Result<Box<[f32; N]>, CmsError>

Produces LUT for Gray transfer curve with N depth

Source

pub fn build_r_linearize_table<T: PointeeSizeExpressible, const N: usize, const BIT_DEPTH: usize>( &self, use_cicp: bool, ) -> Result<Box<[f32; N]>, CmsError>

Produces LUT for Red transfer curve with N depth

Source

pub fn build_g_linearize_table<T: PointeeSizeExpressible, const N: usize, const BIT_DEPTH: usize>( &self, use_cicp: bool, ) -> Result<Box<[f32; N]>, CmsError>

Produces LUT for Green transfer curve with N depth

Source

pub fn build_b_linearize_table<T: PointeeSizeExpressible, const N: usize, const BIT_DEPTH: usize>( &self, use_cicp: bool, ) -> Result<Box<[f32; N]>, CmsError>

Produces LUT for Blue transfer curve with N depth

Source

pub fn build_8bit_gamma_table( &self, trc: &Option<ToneReprCurve>, use_cicp: bool, ) -> Result<Box<[u16; 65536]>, CmsError>

Build gamma table for 8 bit depth Only 4092 first bins are used and values scaled in 0..255

Source

pub fn build_10bit_gamma_table( &self, trc: &Option<ToneReprCurve>, use_cicp: bool, ) -> Result<Box<[u16; 65536]>, CmsError>

Build gamma table for 10 bit depth Only 8192 first bins are used and values scaled in 0..1023

Source

pub fn build_12bit_gamma_table( &self, trc: &Option<ToneReprCurve>, use_cicp: bool, ) -> Result<Box<[u16; 65536]>, CmsError>

Build gamma table for 12 bit depth Only 16384 first bins are used and values scaled in 0..4095

Source

pub fn build_16bit_gamma_table( &self, trc: &Option<ToneReprCurve>, use_cicp: bool, ) -> Result<Box<[u16; 65536]>, CmsError>

Build gamma table for 16 bit depth Only 16384 first bins are used and values scaled in 0..65535

Source

pub fn build_gamma_table<T: Default + Copy + 'static + PointeeSizeExpressible + GammaLutInterpolate, const BUCKET: usize, const N: usize, const BIT_DEPTH: usize>( &self, trc: &Option<ToneReprCurve>, use_cicp: bool, ) -> Result<Box<[T; BUCKET]>, CmsError>
where f32: AsPrimitive<T>, u32: AsPrimitive<T>,

Builds gamma table checking CICP for Transfer characteristics first.

Source§

impl ColorProfile

Source

pub fn encode(&self) -> Result<Vec<u8>, CmsError>

Encodes profile

Trait Implementations§

Source§

impl Clone for ColorProfile

Source§

fn clone(&self) -> ColorProfile

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ColorProfile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ColorProfile

Source§

fn default() -> ColorProfile

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.