pub struct MulDiv { /* private fields */ }Expand description
Methods of this structure used to multiply or divide color-channels (RGB or Luma) by alpha-channel. Supported pixel types: U8x2, U8x4, U16x2, U16x4, F32x2 and F32x4.
By default, the instance of MulDiv created with the best CPU-extension provided by your CPU.
You can change this by using method MulDiv::set_cpu_extensions.
§Examples
use fast_image_resize::pixels::PixelType;
use fast_image_resize::images::Image;
use fast_image_resize::MulDiv;
let width: u32 = 10;
let height: u32 = 7;
let src_image = Image::new(width, height, PixelType::U8x4);
let mut dst_image = Image::new(width, height, PixelType::U8x4);
let mul_div = MulDiv::new();
mul_div.multiply_alpha(&src_image, &mut dst_image).unwrap();Implementations§
Source§impl MulDiv
 
impl MulDiv
pub fn new() -> Self
pub fn cpu_extensions(&self) -> CpuExtensions
Sourcepub unsafe fn set_cpu_extensions(&mut self, extensions: CpuExtensions)
 
pub unsafe fn set_cpu_extensions(&mut self, extensions: CpuExtensions)
§Safety
This is unsafe because this method allows you to set a CPU-extensions that is not actually supported by your CPU.
Sourcepub fn multiply_alpha(
    &self,
    src_image: &impl IntoImageView,
    dst_image: &mut impl IntoImageViewMut,
) -> Result<(), MulDivImagesError>
 
pub fn multiply_alpha( &self, src_image: &impl IntoImageView, dst_image: &mut impl IntoImageViewMut, ) -> Result<(), MulDivImagesError>
Multiplies color-channels (RGB or Luma) of source image by alpha-channel and store result into destination image.
pub fn multiply_alpha_typed<P: PixelTrait>( &self, src_view: &impl ImageView<Pixel = P>, dst_view: &mut impl ImageViewMut<Pixel = P>, ) -> Result<(), MulDivImagesError>
Sourcepub fn multiply_alpha_inplace(
    &self,
    image: &mut impl IntoImageViewMut,
) -> Result<(), ImageError>
 
pub fn multiply_alpha_inplace( &self, image: &mut impl IntoImageViewMut, ) -> Result<(), ImageError>
Multiplies color-channels (RGB or Luma) of image by alpha-channel inplace.
pub fn multiply_alpha_inplace_typed<P: PixelTrait>( &self, img_view: &mut impl ImageViewMut<Pixel = P>, ) -> Result<(), ImageError>
Sourcepub fn divide_alpha(
    &self,
    src_image: &impl IntoImageView,
    dst_image: &mut impl IntoImageViewMut,
) -> Result<(), MulDivImagesError>
 
pub fn divide_alpha( &self, src_image: &impl IntoImageView, dst_image: &mut impl IntoImageViewMut, ) -> Result<(), MulDivImagesError>
Divides color-channels (RGB or Luma) of source image by alpha-channel and store result into destination image.
pub fn divide_alpha_typed<P: PixelTrait>( &self, src_view: &impl ImageView<Pixel = P>, dst_view: &mut impl ImageViewMut<Pixel = P>, ) -> Result<(), MulDivImagesError>
Sourcepub fn divide_alpha_inplace(
    &self,
    image: &mut impl IntoImageViewMut,
) -> Result<(), ImageError>
 
pub fn divide_alpha_inplace( &self, image: &mut impl IntoImageViewMut, ) -> Result<(), ImageError>
Divides color-channels (RGB or Luma) of image by alpha-channel inplace.