Trait ScalingF32

Source
pub trait ScalingF32 {
    // Required methods
    fn resize_cbcr_f32<'a>(
        &'a self,
        store: &ImageStore<'a, f32, 2>,
        into: &mut ImageStoreMut<'a, f32, 2>,
    ) -> Result<(), PicScaleError>;
    fn resize_rgb_f32<'a>(
        &'a self,
        store: &ImageStore<'a, f32, 3>,
        into: &mut ImageStoreMut<'a, f32, 3>,
    ) -> Result<(), PicScaleError>;
    fn resize_rgba_f32<'a>(
        &'a self,
        store: &ImageStore<'a, f32, 4>,
        into: &mut ImageStoreMut<'a, f32, 4>,
        premultiply_alpha: bool,
    ) -> Result<(), PicScaleError>;
}

Required Methods§

Source

fn resize_cbcr_f32<'a>( &'a self, store: &ImageStore<'a, f32, 2>, into: &mut ImageStoreMut<'a, f32, 2>, ) -> Result<(), PicScaleError>

Performs rescaling for CbCr f32

Scales an interleaved CbCr f32. Also could handle LumaAlpha images.

§Example

#[no_build]

 use pic_scale::{ImageStore, ImageStoreMut, ResamplingFunction, Scaler, Scaling, ScalingF32};
 let mut scaler = Scaler::new(ResamplingFunction::Lanczos3);
 let src_store = ImageStore::alloc(100, 100);
 let mut dst_store = ImageStoreMut::<f32, 2>::alloc(50, 50);
 scaler.resize_cbcr_f32(&src_store, &mut dst_store).unwrap();
Source

fn resize_rgb_f32<'a>( &'a self, store: &ImageStore<'a, f32, 3>, into: &mut ImageStoreMut<'a, f32, 3>, ) -> Result<(), PicScaleError>

Performs rescaling for RGB f32

Scales an image RGB f32, channel order does not matter

§Example

#[no_build]

 use pic_scale::{ImageStore, ImageStoreMut, ResamplingFunction, Scaler, Scaling, ScalingF32};
 let mut scaler = Scaler::new(ResamplingFunction::Lanczos3);
 let src_store = ImageStore::alloc(100, 100);
 let mut dst_store = ImageStoreMut::<f32, 3>::alloc(50, 50);
 scaler.resize_rgb_f32(&src_store, &mut dst_store).unwrap();
Source

fn resize_rgba_f32<'a>( &'a self, store: &ImageStore<'a, f32, 4>, into: &mut ImageStoreMut<'a, f32, 4>, premultiply_alpha: bool, ) -> Result<(), PicScaleError>

Performs rescaling for RGBA f32

Scales an image RGBA f32, alpha expected to be at last position if alpha pre-multiplication is requested

§Example

#[no_build]

 use pic_scale::{ImageStore, ImageStoreMut, ResamplingFunction, Scaler, Scaling, ScalingF32};
 let mut scaler = Scaler::new(ResamplingFunction::Lanczos3);
 let src_store = ImageStore::alloc(100, 100);
 let mut dst_store = ImageStoreMut::<f32, 4>::alloc(50, 50);
 scaler.resize_rgba_f32(&src_store, &mut dst_store, false).unwrap();

Implementors§