#[repr(transparent)]pub struct Profile<Context = GlobalContext> { /* private fields */ }
Expand description
An ICC color profile
Implementations§
source§impl Profile<GlobalContext>
impl Profile<GlobalContext>
These are the basic functions on opening profiles.
For simpler operation, you must open two profiles using new_file
, and then create a transform with these open profiles with Transform
.
Using this transform you can color correct your bitmaps.
sourcepub fn new_icc(data: &[u8]) -> LCMSResult<Self>
pub fn new_icc(data: &[u8]) -> LCMSResult<Self>
Parse ICC profile from the in-memory array
sourcepub fn new_srgb() -> Self
pub fn new_srgb() -> Self
Create an ICC virtual profile for sRGB space. sRGB is a standard RGB color space created cooperatively by HP and Microsoft in 1996 for use on monitors, printers, and the Internet.
sourcepub fn new_rgb(
white_point: &CIExyY,
primaries: &CIExyYTRIPLE,
transfer_function: &[&ToneCurve]
) -> LCMSResult<Self>
pub fn new_rgb( white_point: &CIExyY, primaries: &CIExyYTRIPLE, transfer_function: &[&ToneCurve] ) -> LCMSResult<Self>
This function creates a display RGB profile based on White point, primaries and transfer functions. It populates following tags; this conform a standard RGB Display Profile, and then I add (As per addendum II) chromaticity tag.
ProfileDescriptionTag
MediaWhitePointTag
RedColorantTag
GreenColorantTag
BlueColorantTag
RedTRCTag
GreenTRCTag
BlueTRCTag
- Chromatic adaptation Tag
ChromaticityTag
sourcepub fn new_gray(white_point: &CIExyY, curve: &ToneCurve) -> LCMSResult<Self>
pub fn new_gray(white_point: &CIExyY, curve: &ToneCurve) -> LCMSResult<Self>
This function creates a gray profile based on White point and transfer function. It populates following tags; this conform a standard gray display profile.
ProfileDescriptionTag
MediaWhitePointTag
GrayTRCTag
sourcepub fn new_xyz() -> Self
pub fn new_xyz() -> Self
Creates a XYZ XYZ identity, marking it as v4 ICC profile. WhitePoint
used in Absolute colorimetric intent is D50.
sourcepub fn new_null() -> Self
pub fn new_null() -> Self
Creates a fake NULL profile. This profile return 1 channel as always 0. Is useful only for gamut checking tricks.
sourcepub fn new_placeholder() -> Self
pub fn new_placeholder() -> Self
Creates an empty profile object, ready to be populated by the programmer.
WARNING: The obtained profile without adding any information is not directly useable.
sourcepub fn ink_limiting(
color_space: ColorSpaceSignature,
limit: f64
) -> LCMSResult<Self>
pub fn ink_limiting( color_space: ColorSpaceSignature, limit: f64 ) -> LCMSResult<Self>
This is a devicelink operating in CMYK for ink-limiting. Currently only cmsSigCmykData
is supported.
Limit: Amount of ink limiting in % (0..400%)
sourcepub fn new_device_link<F, T>(
transform: &Transform<F, T>,
version: f64,
flags: Flags
) -> LCMSResult<Self>
pub fn new_device_link<F, T>( transform: &Transform<F, T>, version: f64, flags: Flags ) -> LCMSResult<Self>
Generates a device-link profile from a given color transform. This profile can then be used by any other function accepting profile handle. Depending on the specified version number, the implementation of the devicelink may vary. Accepted versions are in range 1.0…4.3
source§impl<Ctx: Context> Profile<Ctx>
impl<Ctx: Context> Profile<Ctx>
sourcepub fn icc(&self) -> LCMSResult<Vec<u8>>
pub fn icc(&self) -> LCMSResult<Vec<u8>>
Create ICC file in memory buffer
sourcepub fn device_class(&self) -> ProfileClassSignature
pub fn device_class(&self) -> ProfileClassSignature
Gets the device class signature from profile header.
sourcepub fn set_device_class(&mut self, cls: ProfileClassSignature)
pub fn set_device_class(&mut self, cls: ProfileClassSignature)
Sets the device class signature in profile header.
sourcepub fn encoded_icc_version(&self) -> u32
pub fn encoded_icc_version(&self) -> u32
Returns the profile ICC version in the same format as it is stored in the header.
pub fn set_encoded_icc_version(&self, v: u32)
sourcepub fn header_attributes(&self) -> u64
pub fn header_attributes(&self) -> u64
Gets the attribute flags. Currently defined values correspond to the low 4 bytes of the 8 byte attribute quantity.
Reflective
Transparency
Glossy
Matte
sourcepub fn set_header_attributes(&mut self, flags: u64)
pub fn set_header_attributes(&mut self, flags: u64)
Sets the attribute flags in the profile header.
pub fn header_creator(&self) -> u32
sourcepub fn header_flags(&self) -> u32
pub fn header_flags(&self) -> u32
Get header flags of given ICC profile object.
The profile flags field does contain flags to indicate various hints for the CMM such as distributed processing and caching options. The least-significant 16 bits are reserved for the ICC. Flags in bit positions 0 and 1 shall be used as indicated in Table 7 of LCMS PDF.
sourcepub fn set_header_flags(&mut self, flags: u32)
pub fn set_header_flags(&mut self, flags: u32)
Sets header flags of given ICC profile object. Valid flags are defined in Table 7 of LCMS PDF.
sourcepub fn header_manufacturer(&self) -> u32
pub fn header_manufacturer(&self) -> u32
Returns the manufacturer signature as described in the header.
This funcionality is widely superseded by the manufaturer tag. Of use only in elder profiles.
sourcepub fn set_header_manufacturer(&mut self, m: u32)
👎Deprecated: This funcionality is widely superseded by the manufaturer tag
pub fn set_header_manufacturer(&mut self, m: u32)
Sets the manufacturer signature in the header.
This funcionality is widely superseded by the manufaturer tag. Of use only in elder profiles.
sourcepub fn header_model(&self) -> u32
pub fn header_model(&self) -> u32
Returns the model signature as described in the header.
This funcionality is widely superseded by the model tag. Of use only in elder profiles.
sourcepub fn set_header_model(&mut self, model: u32)
👎Deprecated: This funcionality is widely superseded by the model tag
pub fn set_header_model(&mut self, model: u32)
Sets the model signature in the profile header.
This funcionality is widely superseded by the model tag. Of use only in elder profiles.
sourcepub fn header_rendering_intent(&self) -> Intent
pub fn header_rendering_intent(&self) -> Intent
Gets the profile header rendering intent.
From the ICC spec: “The rendering intent field shall specify the rendering intent which should be used (or, in the case of a Devicelink profile, was used) when this profile is (was) combined with another profile. In a sequence of more than two profiles, it applies to the combination of this profile and the next profile in the sequence and not to the entire sequence. Typically, the user or application will set the rendering intent dynamically at runtime or embedding time. Therefore, this flag may not have any meaning until the profile is used in some context, e.g. in a Devicelink or an embedded source profile.”
pub fn set_header_rendering_intent(&mut self, intent: Intent)
sourcepub fn pcs(&self) -> ColorSpaceSignature
pub fn pcs(&self) -> ColorSpaceSignature
Gets the profile connection space used by the given profile, using the ICC convention.
sourcepub fn set_pcs(&mut self, pcs: ColorSpaceSignature)
pub fn set_pcs(&mut self, pcs: ColorSpaceSignature)
Sets the profile connection space signature in profile header, using ICC convention.
pub fn info(&self, info: InfoType, locale: Locale) -> Option<String>
sourcepub fn version(&self) -> f64
pub fn version(&self) -> f64
Returns the profile ICC version. The version is decoded to readable floating point format.
sourcepub fn set_version(&mut self, ver: f64)
pub fn set_version(&mut self, ver: f64)
Sets the ICC version in profile header. The version is given to this function as a float n.m
pub fn tag_signatures(&self) -> Vec<TagSignature>
pub fn detect_black_point(&self, intent: Intent) -> Option<CIEXYZ>
pub fn detect_destination_black_point(&self, intent: Intent) -> Option<CIEXYZ>
pub fn detect_tac(&self) -> f64
sourcepub fn color_space(&self) -> ColorSpaceSignature
pub fn color_space(&self) -> ColorSpaceSignature
Gets the color space used by the given profile, using the ICC convention.
sourcepub fn set_color_space(&mut self, sig: ColorSpaceSignature)
pub fn set_color_space(&mut self, sig: ColorSpaceSignature)
Sets the profile connection space signature in profile header, using ICC convention.
pub fn is_clut(&self, intent: Intent, used_direction: u32) -> bool
pub fn is_intent_supported(&self, intent: Intent, used_direction: u32) -> bool
pub fn is_matrix_shaper(&self) -> bool
pub fn has_tag(&self, sig: TagSignature) -> bool
pub fn read_tag(&self, sig: TagSignature) -> Tag<'_>
pub fn write_tag(&mut self, sig: TagSignature, tag: Tag<'_>) -> bool
pub fn remove_tag(&mut self, sig: TagSignature) -> bool
pub fn link_tag(&mut self, sig: TagSignature, dst: TagSignature) -> bool
sourcepub fn profile_id(&self) -> ProfileID
pub fn profile_id(&self) -> ProfileID
Retrieves the Profile ID stored in the profile header.
sourcepub fn set_default_profile_id(&mut self)
pub fn set_default_profile_id(&mut self)
Computes a MD5 checksum and stores it as Profile ID in the profile header.
pub fn set_profile_id(&mut self, id: ProfileID)
pub fn save_profile_to_file(&mut self, path: &Path) -> Result<()>
source§impl<Ctx: Context> Profile<Ctx>
impl<Ctx: Context> Profile<Ctx>
Per-context functions that can be used with a ThreadContext
pub fn new_icc_context( context: impl AsRef<Ctx>, data: &[u8] ) -> LCMSResult<Self>
pub fn new_file_context<P: AsRef<Path>>( context: impl AsRef<Ctx>, path: P ) -> Result<Self>
pub fn new_srgb_context(context: impl AsRef<Ctx>) -> Self
pub fn new_rgb_context( context: impl AsRef<Ctx>, white_point: &CIExyY, primaries: &CIExyYTRIPLE, transfer_function: &[&ToneCurve] ) -> LCMSResult<Self>
pub fn new_gray_context( context: impl AsRef<Ctx>, white_point: &CIExyY, curve: &ToneCurve ) -> LCMSResult<Self>
sourcepub unsafe fn new_linearization_device_link_context(
context: impl AsRef<Ctx>,
color_space: ColorSpaceSignature,
curves: &[ToneCurveRef]
) -> LCMSResult<Self>
pub unsafe fn new_linearization_device_link_context( context: impl AsRef<Ctx>, color_space: ColorSpaceSignature, curves: &[ToneCurveRef] ) -> LCMSResult<Self>
This is a devicelink operating in the target colorspace with as many transfer functions as components. Number of tone curves must be sufficient for the color space.
sourcepub fn new_bchsw_abstract_context(
context: impl AsRef<Ctx>,
lut_points: usize,
bright: f64,
contrast: f64,
hue: f64,
saturation: f64,
temp_src_dst: Option<(u32, u32)>
) -> LCMSResult<Self>
pub fn new_bchsw_abstract_context( context: impl AsRef<Ctx>, lut_points: usize, bright: f64, contrast: f64, hue: f64, saturation: f64, temp_src_dst: Option<(u32, u32)> ) -> LCMSResult<Self>
Creates an abstract devicelink operating in Lab for Bright/Contrast/Hue/Saturation and white point translation. White points are specified as temperatures ºK
nLUTPoints
: Resulting color map resolution
Bright: Bright increment. May be negative
Contrast : Contrast increment. May be negative.
Hue : Hue displacement in degree.
Saturation: Saturation increment. May be negative
TempSrc
: Source white point temperature
TempDest
: Destination white point temperature.
To prevent white point adjustment, set Temp to None
sourcepub fn ink_limiting_context(
context: impl AsRef<Ctx>,
color_space: ColorSpaceSignature,
limit: f64
) -> LCMSResult<Self>
pub fn ink_limiting_context( context: impl AsRef<Ctx>, color_space: ColorSpaceSignature, limit: f64 ) -> LCMSResult<Self>
This is a devicelink operating in CMYK for ink-limiting. Currently only cmsSigCmykData
is supported.
Limit: Amount of ink limiting in % (0..400%)
sourcepub fn new_xyz_context(context: impl AsRef<Ctx>) -> Self
pub fn new_xyz_context(context: impl AsRef<Ctx>) -> Self
Creates a XYZ XYZ identity, marking it as v4 ICC profile. WhitePoint
used in Absolute colorimetric intent is D50.
sourcepub fn new_null_context(context: impl AsRef<Ctx>) -> Self
pub fn new_null_context(context: impl AsRef<Ctx>) -> Self
Creates a fake NULL profile. This profile return 1 channel as always 0. Is useful only for gamut checking tricks.
sourcepub fn new_lab2_context(
context: impl AsRef<Ctx>,
white_point: &CIExyY
) -> LCMSResult<Self>
pub fn new_lab2_context( context: impl AsRef<Ctx>, white_point: &CIExyY ) -> LCMSResult<Self>
Creates a Lab Lab identity, marking it as v2 ICC profile.
Adjustments for accomodating PCS endoing shall be done by Little CMS when using this profile.
sourcepub fn new_lab4_context(
context: impl AsRef<Ctx>,
white_point: &CIExyY
) -> LCMSResult<Self>
pub fn new_lab4_context( context: impl AsRef<Ctx>, white_point: &CIExyY ) -> LCMSResult<Self>
Creates a Lab Lab identity, marking it as v4 ICC profile.