Trait ScalingU16

Source
pub trait ScalingU16 {
    // Required methods
    fn resize_plane_u16<'a>(
        &'a self,
        store: &ImageStore<'a, u16, 1>,
        into: &mut ImageStoreMut<'a, u16, 1>,
    ) -> Result<(), PicScaleError>;
    fn resize_cbcr_u16<'a>(
        &'a self,
        store: &ImageStore<'a, u16, 2>,
        into: &mut ImageStoreMut<'a, u16, 2>,
    ) -> Result<(), PicScaleError>;
    fn resize_rgb_u16<'a>(
        &'a self,
        store: &ImageStore<'a, u16, 3>,
        into: &mut ImageStoreMut<'a, u16, 3>,
    ) -> Result<(), PicScaleError>;
    fn resize_rgba_u16<'a>(
        &'a self,
        store: &ImageStore<'a, u16, 4>,
        into: &mut ImageStoreMut<'a, u16, 4>,
        premultiply_alpha: bool,
    ) -> Result<(), PicScaleError>;
}

Required Methods§

Source

fn resize_plane_u16<'a>( &'a self, store: &ImageStore<'a, u16, 1>, into: &mut ImageStoreMut<'a, u16, 1>, ) -> Result<(), PicScaleError>

Performs rescaling for Planar u16

Scales planar high bit-depth image stored in u16 type. To perform scaling image bit-depth should be set in target image, source image expects to have the same one.

§Arguments

store - original image store into - target image store

§Panic

Method panics if bit-depth < 1 or bit-depth > 16

§Example

#[no_build]

 use pic_scale::{ImageStore, ImageStoreMut, ResamplingFunction, Scaler, ScalingU16};
 let mut scaler = Scaler::new(ResamplingFunction::Lanczos3);
 let src_store = ImageStore::alloc(100, 100);
 let mut dst_store = ImageStoreMut::<u16, 1>::alloc_with_depth(50, 50, 10);
 scaler.resize_plane_u16(&src_store, &mut dst_store).unwrap();
Source

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

Performs rescaling for CbCr16

Scales CbCr high bit-depth interleaved image in u16 type, optionally it could handle LumaAlpha images also To perform scaling image bit-depth should be set in target image, source image expects to have the same one. Channel order does not matter.

§Arguments

store - original image store into - target image store

§Panics

Method panics if bit-depth < 1 or bit-depth > 16

§Example

#[no_build]

 use pic_scale::{ImageStore, ImageStoreMut, ResamplingFunction, Scaler, ScalingU16};
 let mut scaler = Scaler::new(ResamplingFunction::Bilinear);
 let src_store = ImageStore::alloc(100, 100);
 let mut dst_store = ImageStoreMut::<u16, 2>::alloc_with_depth(50, 50, 10);
 scaler.resize_cbcr_u16(&src_store, &mut dst_store).unwrap();
Source

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

Performs rescaling for RGB

Scales RGB high bit-depth image stored in u16 type. To perform scaling image bit-depth should be set in target image, source image expects to have the same one. Channel order does not matter.

§Arguments

store - original image store into - target image store

§Panics

Method panics if bit-depth < 1 or bit-depth > 16

§Example

#[no_build]

 use pic_scale::{ImageStore, ImageStoreMut, ResamplingFunction, Scaler, ScalingU16};
 let mut scaler = Scaler::new(ResamplingFunction::Bilinear);
 let src_store = ImageStore::alloc(100, 100);
 let mut dst_store = ImageStoreMut::<u16, 3>::alloc_with_depth(50, 50, 10);
 scaler.resize_rgb_u16(&src_store, &mut dst_store).unwrap();
Source

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

Performs rescaling for RGBA high bit-depth

Scales RGB high bit-depth image stored in u16 type. To perform scaling image bit-depth should be set in target image, source image expects to have the same one. If pre-multiplication is requested alpha should be at last, otherwise channel order does not matter.

§Arguments

store - original image store into - target image store premultiply_alpha - flags is alpha is premultiplied

§Panics

Method panics if bit-depth < 1 or bit-depth > 16

§Example

#[no_build]

 use pic_scale::{ImageStore, ImageStoreMut, ResamplingFunction, Scaler, ScalingU16};
 let mut scaler = Scaler::new(ResamplingFunction::Bilinear);
 let src_store = ImageStore::alloc(100, 100);
 let mut dst_store = ImageStoreMut::<u16, 4>::alloc_with_depth(50, 50, 10);
 scaler.resize_rgba_u16(&src_store, &mut dst_store, true).unwrap();

Implementors§