pub struct CicpTransform {
from: Cicp,
into: Cicp,
u8: RgbTransforms<u8>,
u16: RgbTransforms<u16>,
f32: RgbTransforms<f32>,
output_coefs: [f32; 3],
}Expand description
Apply to colors of the input color space to get output color values.
We do not support all possible Cicp color spaces, but when we support one then all builtin
Pixel types can be converted with their respective components. This value is used to signify
that some particular combination is supported.
Fields§
§from: Cicp§into: Cicp§u8: RgbTransforms<u8>§u16: RgbTransforms<u16>§f32: RgbTransforms<f32>§output_coefs: [f32; 3]Implementations§
Source§impl CicpTransform
impl CicpTransform
const LAYOUTS: [(LayoutWithColor, LayoutWithColor); 4]
Sourcepub fn new(from: Cicp, into: Cicp) -> Option<Self>
pub fn new(from: Cicp, into: Cicp) -> Option<Self>
Construct a transform between two color spaces.
Returns Some if the transform is guaranteed to be supported by image. Both color spaces
are well understood and can be expected to be supported in future versions. However, we do
not make guarantees about adjusting the rounding modes, accuracy, and exact numeric values
used in the transform. Also, out-of-gamut colors may be handled differently per API.
Returns None if the transformation is not (yet) supported.
This is used with ConvertColorOptions in
ImageBuffer::copy_from_color_space,
DynamicImage::copy_from_color_space.
Sourcepub(crate) fn supported_transform_fn<From: PixelWithColorType, Into: PixelWithColorType>(
&self,
) -> &(dyn Fn(&[From::Subpixel], &mut [From::Subpixel]) + Send + Sync + '_)
pub(crate) fn supported_transform_fn<From: PixelWithColorType, Into: PixelWithColorType>( &self, ) -> &(dyn Fn(&[From::Subpixel], &mut [From::Subpixel]) + Send + Sync + '_)
For a Pixel with known color layout (ColorType) get a transform that is accurate.
This returns None if we do not support the transform. At writing that is true for
instance for transforms involved ’Lumapixels which are interpreted as theYin aYCbCrcolor based off the actual whitepoint, with coefficients according to each primary's luminance. Only Rgb transforms are supported viamoxcms`.
Maybe provide publicly?
Sourcepub(crate) fn check_applicable(
&self,
from: Cicp,
into: Cicp,
) -> Result<(), ImageError>
pub(crate) fn check_applicable( &self, from: Cicp, into: Cicp, ) -> Result<(), ImageError>
Does this transform realize the conversion from to into.
fn build_transforms<P: ColorComponentForCicp + Default + 'static>( trs: [Option<Arc<dyn TransformExecutor<P> + Send + Sync>>; 4], f32: [Arc<dyn TransformExecutor<f32> + Send + Sync>; 4], output_coef: [f32; 3], ) -> Option<RgbTransforms<P>>
pub(crate) fn transform_dynamic( &self, lhs: &mut DynamicImage, rhs: &DynamicImage, )
pub(crate) fn select_transform_u8<P: SealedPixelWithColorType<TransformableSubpixel = u8>>( &self, into: LayoutWithColor, ) -> &Arc<dyn Fn(&[u8], &mut [u8]) + Send + Sync + 'static>
pub(crate) fn select_transform_u16<O: SealedPixelWithColorType<TransformableSubpixel = u16>>( &self, into: LayoutWithColor, ) -> &Arc<dyn Fn(&[u16], &mut [u16]) + Send + Sync + 'static>
pub(crate) fn select_transform_f32<O: SealedPixelWithColorType<TransformableSubpixel = f32>>( &self, into: LayoutWithColor, ) -> &Arc<dyn Fn(&[f32], &mut [f32]) + Send + Sync + 'static>
pub(crate) fn expand_luma_rgb<P: ColorComponentForCicp>( luma: &[P], rgb: &mut [f32], )
pub(crate) fn expand_luma_rgba<P: ColorComponentForCicp>( luma: &[P], rgb: &mut [f32], )
pub(crate) fn expand_rgb<P: ColorComponentForCicp>( input: &[P], output: &mut [f32], )
pub(crate) fn expand_rgba<P: ColorComponentForCicp>( input: &[P], output: &mut [f32], )
pub(crate) fn clamp_rgb<P: ColorComponentForCicp>( input: &[f32], output: &mut [P], )
pub(crate) fn clamp_rgba<P: ColorComponentForCicp>( input: &[f32], output: &mut [P], )
pub(crate) fn clamp_rgb_luma<P: ColorComponentForCicp>( input: &[f32], output: &mut [P], coef: [f32; 3], )
pub(crate) fn clamp_rgba_luma<P: ColorComponentForCicp>( input: &[f32], output: &mut [P], coef: [f32; 3], )
Trait Implementations§
Source§impl Clone for CicpTransform
impl Clone for CicpTransform
Source§fn clone(&self) -> CicpTransform
fn clone(&self) -> CicpTransform
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CicpTransform
impl !RefUnwindSafe for CicpTransform
impl Send for CicpTransform
impl Sync for CicpTransform
impl Unpin for CicpTransform
impl UnsafeUnpin for CicpTransform
impl !UnwindSafe for CicpTransform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more