pub struct Scaler { /* private fields */ }Expand description
Represents base scaling structure
Implementations§
Source§impl Scaler
impl Scaler
Sourcepub fn new(filter: ResamplingFunction) -> Self
pub fn new(filter: ResamplingFunction) -> Self
Creates new Scaler instance with corresponding filter
Creates default crate::Scaler with corresponding filter and default ThreadingPolicy::Single
Source§impl Scaler
impl Scaler
Sourcepub fn resize_plane_f32<'a>(
&'a self,
store: &ImageStore<'a, f32, 1>,
into: &mut ImageStoreMut<'a, f32, 1>,
) -> Result<(), PicScaleError>
pub fn resize_plane_f32<'a>( &'a self, store: &ImageStore<'a, f32, 1>, into: &mut ImageStoreMut<'a, f32, 1>, ) -> Result<(), PicScaleError>
Performs rescaling for f32 plane
Source§impl Scaler
impl Scaler
Sourcepub fn resize_plane<'a>(
&'a self,
store: &ImageStore<'a, u8, 1>,
into: &mut ImageStoreMut<'a, u8, 1>,
) -> Result<(), PicScaleError>
pub fn resize_plane<'a>( &'a self, store: &ImageStore<'a, u8, 1>, into: &mut ImageStoreMut<'a, u8, 1>, ) -> Result<(), PicScaleError>
Performs rescaling for u8 plane
Source§impl Scaler
impl Scaler
Sourcepub fn resize_ar30(
&self,
src: &[u32],
src_size: ImageSize,
dst: &mut [u32],
new_size: ImageSize,
order: Ar30ByteOrder,
) -> Result<(), PicScaleError>
pub fn resize_ar30( &self, src: &[u32], src_size: ImageSize, dst: &mut [u32], new_size: ImageSize, order: Ar30ByteOrder, ) -> Result<(), PicScaleError>
Resizes RGBA2101010 image
§Arguments
src - source slice
src_size - Source Image size
dst - destination slice
new_size - New image size
Sourcepub fn resize_ra30(
&self,
src: &[u32],
src_size: ImageSize,
dst: &mut [u32],
new_size: ImageSize,
order: Ar30ByteOrder,
) -> Result<(), PicScaleError>
pub fn resize_ra30( &self, src: &[u32], src_size: ImageSize, dst: &mut [u32], new_size: ImageSize, order: Ar30ByteOrder, ) -> Result<(), PicScaleError>
Resizes RGBA1010102 image
§Arguments
src - source slice
src_size - Source Image size
dst - destination slice
new_size - New image size
Trait Implementations§
Source§impl Scaling for Scaler
impl Scaling for Scaler
Source§fn set_threading_policy(&mut self, threading_policy: ThreadingPolicy)
fn set_threading_policy(&mut self, threading_policy: ThreadingPolicy)
Source§fn resize_rgb<'a>(
&'a self,
store: &ImageStore<'a, u8, 3>,
into: &mut ImageStoreMut<'a, u8, 3>,
) -> Result<(), PicScaleError>
fn resize_rgb<'a>( &'a self, store: &ImageStore<'a, u8, 3>, into: &mut ImageStoreMut<'a, u8, 3>, ) -> Result<(), PicScaleError>
Source§fn resize_rgba<'a>(
&'a self,
store: &ImageStore<'a, u8, 4>,
into: &mut ImageStoreMut<'a, u8, 4>,
premultiply_alpha: bool,
) -> Result<(), PicScaleError>
fn resize_rgba<'a>( &'a self, store: &ImageStore<'a, u8, 4>, into: &mut ImageStoreMut<'a, u8, 4>, premultiply_alpha: bool, ) -> Result<(), PicScaleError>
Source§impl ScalingF32 for Scaler
impl ScalingF32 for Scaler
Source§fn resize_rgb_f32<'a>(
&'a self,
store: &ImageStore<'a, f32, 3>,
into: &mut ImageStoreMut<'a, f32, 3>,
) -> Result<(), PicScaleError>
fn resize_rgb_f32<'a>( &'a self, store: &ImageStore<'a, f32, 3>, into: &mut ImageStoreMut<'a, f32, 3>, ) -> Result<(), PicScaleError>
Source§fn resize_rgba_f32<'a>(
&'a self,
store: &ImageStore<'a, f32, 4>,
into: &mut ImageStoreMut<'a, f32, 4>,
premultiply_alpha: bool,
) -> 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>
Source§impl ScalingU16 for Scaler
impl ScalingU16 for Scaler
Source§fn resize_rgb_u16<'a>(
&'a self,
store: &ImageStore<'a, u16, 3>,
into: &mut ImageStoreMut<'a, u16, 3>,
) -> Result<(), PicScaleError>
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>
fn resize_rgba_u16<'a>( &'a self, store: &ImageStore<'a, u16, 4>, into: &mut ImageStoreMut<'a, u16, 4>, premultiply_alpha: bool, ) -> Result<(), PicScaleError>
Resizes u16 image
§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();Source§fn resize_plane_u16<'a>(
&'a self,
store: &ImageStore<'a, u16, 1>,
into: &mut ImageStoreMut<'a, u16, 1>,
) -> Result<(), PicScaleError>
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();impl Copy for Scaler
Auto Trait Implementations§
impl Freeze for Scaler
impl RefUnwindSafe for Scaler
impl Send for Scaler
impl Sync for Scaler
impl Unpin for Scaler
impl UnwindSafe for Scaler
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