pub(crate) struct CicpRgb {
pub(crate) primaries: CicpColorPrimaries,
pub(crate) transfer: CicpTransferCharacteristics,
pub(crate) luminance: DerivedLuminance,
}Expand description
An internal representation of what our T: PixelWithColorType can do, i.e. ImageBuffer.
Fields§
§primaries: CicpColorPrimaries§transfer: CicpTransferCharacteristics§luminance: DerivedLuminanceImplementations§
Source§impl CicpRgb
impl CicpRgb
Sourcepub(crate) fn cast_pixels<FromColor, IntoColor>(
&self,
buffer: &[FromColor::Subpixel],
color_space_fallback: &dyn Fn() -> [f32; 3],
) -> Vec<IntoColor::Subpixel>where
FromColor: Pixel + SealedPixelWithColorType<TransformableSubpixel = FromColor::Subpixel>,
IntoColor: Pixel + CicpPixelCast<FromColor>,
FromColor::Subpixel: ColorComponentForCicp,
IntoColor::Subpixel: ColorComponentForCicp + FromPrimitive<FromColor::Subpixel>,
pub(crate) fn cast_pixels<FromColor, IntoColor>(
&self,
buffer: &[FromColor::Subpixel],
color_space_fallback: &dyn Fn() -> [f32; 3],
) -> Vec<IntoColor::Subpixel>where
FromColor: Pixel + SealedPixelWithColorType<TransformableSubpixel = FromColor::Subpixel>,
IntoColor: Pixel + CicpPixelCast<FromColor>,
FromColor::Subpixel: ColorComponentForCicp,
IntoColor::Subpixel: ColorComponentForCicp + FromPrimitive<FromColor::Subpixel>,
Internal utility for converting color buffers of different pixel representations, assuming they have this same cicp. This method returns a buffer, avoiding the pre-zeroing the vector.
fn cast_pixels_by_layout<FromSubpixel, IntoSubpixel>(
&self,
buffer: &[FromSubpixel],
color_space_fallback: &dyn Fn() -> [f32; 3],
from_layout: LayoutWithColor,
into_layout: LayoutWithColor,
) -> Vec<IntoSubpixel>where
FromSubpixel: ColorComponentForCicp + Primitive,
IntoSubpixel: ColorComponentForCicp + FromPrimitive<FromSubpixel> + Primitive,
fn create_output<Into: Primitive>( output: &mut Vec<Into>, pixels: usize, into_layout: LayoutWithColor, )
fn cast_pixels_by_fallback<From: Primitive + ColorComponentForCicp, Into: ColorComponentForCicp>( buffer: &[From], output: &mut [Into], from_layout: LayoutWithColor, into_layout: LayoutWithColor, color_space_coefs: [f32; 3], )
Sourcepub(crate) fn cast_pixels_from_subpixels<FromSubpixel, IntoSubpixel>(
&self,
buffer: &[FromSubpixel],
from_layout: LayoutWithColor,
into_layout: LayoutWithColor,
) -> Result<Vec<IntoSubpixel>, Vec<IntoSubpixel>>where
FromSubpixel: ColorComponentForCicp,
IntoSubpixel: ColorComponentForCicp + FromPrimitive<FromSubpixel> + Primitive,
pub(crate) fn cast_pixels_from_subpixels<FromSubpixel, IntoSubpixel>(
&self,
buffer: &[FromSubpixel],
from_layout: LayoutWithColor,
into_layout: LayoutWithColor,
) -> Result<Vec<IntoSubpixel>, Vec<IntoSubpixel>>where
FromSubpixel: ColorComponentForCicp,
IntoSubpixel: ColorComponentForCicp + FromPrimitive<FromSubpixel> + Primitive,
Make sure this is only monomorphized for subpixel combinations, not for every pixel
combination! There’s ample time to do that in cast_pixels.
fn subpixel_cast_rgb_to_rgba<FromSubpixel, IntoSubpixel>(
output: &mut Vec<IntoSubpixel>,
buffer: &[FromSubpixel],
)where
FromSubpixel: ColorComponentForCicp,
IntoSubpixel: ColorComponentForCicp + FromPrimitive<FromSubpixel> + Primitive,
fn subpixel_cast_rgba_to_rgb<FromSubpixel, IntoSubpixel>(
output: &mut Vec<IntoSubpixel>,
buffer: &[FromSubpixel],
)where
FromSubpixel: ColorComponentForCicp,
IntoSubpixel: ColorComponentForCicp + FromPrimitive<FromSubpixel> + Primitive,
fn subpixel_cast_luma_to_luma_alpha<FromSubpixel, IntoSubpixel>(
output: &mut Vec<IntoSubpixel>,
buffer: &[FromSubpixel],
)where
FromSubpixel: ColorComponentForCicp,
IntoSubpixel: ColorComponentForCicp + FromPrimitive<FromSubpixel> + Primitive,
fn subpixel_cast_luma_alpha_to_luma<FromSubpixel, IntoSubpixel>(
output: &mut Vec<IntoSubpixel>,
buffer: &[FromSubpixel],
)where
FromSubpixel: ColorComponentForCicp,
IntoSubpixel: ColorComponentForCicp + FromPrimitive<FromSubpixel> + Primitive,
Trait Implementations§
impl Copy for CicpRgb
impl Eq for CicpRgb
impl StructuralPartialEq for CicpRgb
Auto Trait Implementations§
impl Freeze for CicpRgb
impl RefUnwindSafe for CicpRgb
impl Send for CicpRgb
impl Sync for CicpRgb
impl Unpin for CicpRgb
impl UnsafeUnpin for CicpRgb
impl UnwindSafe for CicpRgb
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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