pub struct Scaler {
pub workload_strategy: WorkloadStrategy,
/* private fields */
}
Expand description
Represents base scaling structure
Fields§
§workload_strategy: WorkloadStrategy
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
Sourcepub fn set_workload_strategy(&mut self, workload_strategy: WorkloadStrategy)
pub fn set_workload_strategy(&mut self, workload_strategy: WorkloadStrategy)
Sets preferred workload strategy
This is hint only, it may change something, or may not.
Source§impl Scaler
impl Scaler
Sourcepub fn resize_ar30(
&self,
src_image: &ImageStore<'_, u8, 4>,
dst_image: &mut ImageStoreMut<'_, u8, 4>,
order: Ar30ByteOrder,
) -> Result<(), PicScaleError>
pub fn resize_ar30( &self, src_image: &ImageStore<'_, u8, 4>, dst_image: &mut ImageStoreMut<'_, u8, 4>, order: Ar30ByteOrder, ) -> Result<(), PicScaleError>
Resizes RGBA2101010 image
This method ignores alpha scaling.
§Arguments
src_image
- source AR30 image
dst_image
- destination AR30 image
new_size
- New image size
Sourcepub fn resize_ra30(
&self,
src_image: &ImageStore<'_, u8, 4>,
dst_image: &mut ImageStoreMut<'_, u8, 4>,
order: Ar30ByteOrder,
) -> Result<(), PicScaleError>
pub fn resize_ra30( &self, src_image: &ImageStore<'_, u8, 4>, dst_image: &mut ImageStoreMut<'_, u8, 4>, order: Ar30ByteOrder, ) -> Result<(), PicScaleError>
Resizes RGBA1010102 image
This method ignores alpha scaling.
§Arguments
src_image
- source RA30 image
dst_image
- destination RA30 image
Source§impl Scaler
Implements f16
type support
impl Scaler
Implements f16
type support
Sourcepub fn resize_rgba_f16<'a>(
&'a self,
store: &ImageStore<'a, f16, 4>,
into: &mut ImageStoreMut<'a, f16, 4>,
premultiply_alpha: bool,
) -> Result<(), PicScaleError>
Available on crate feature nightly_f16
only.
pub fn resize_rgba_f16<'a>( &'a self, store: &ImageStore<'a, f16, 4>, into: &mut ImageStoreMut<'a, f16, 4>, premultiply_alpha: bool, ) -> Result<(), PicScaleError>
nightly_f16
only.Performs rescaling for RGBA f16
Scales RGBA high bit-depth interleaved image in f16
type.
Channel order does not matter.
To handle alpha pre-multiplication alpha channel expected to be at last position.
§Arguments
store
- original image store
into
- target image store
premultiply_alpha
- flag if it should handle alpha or not
§Example
#[no_build]
use pic_scale::{ImageStore, ImageStoreMut, ResamplingFunction, Scaler};
let mut scaler = Scaler::new(ResamplingFunction::Bilinear);
let src_store = ImageStore::alloc(100, 100);
let mut dst_store = ImageStoreMut::<f16, 4>::alloc_with_depth(50, 50, 10);
scaler.resize_rgba_f16(&src_store, &mut dst_store, false).unwrap();
Sourcepub fn resize_rgb_f16<'a>(
&'a self,
store: &ImageStore<'a, f16, 3>,
into: &mut ImageStoreMut<'a, f16, 3>,
) -> Result<(), PicScaleError>
Available on crate feature nightly_f16
only.
pub fn resize_rgb_f16<'a>( &'a self, store: &ImageStore<'a, f16, 3>, into: &mut ImageStoreMut<'a, f16, 3>, ) -> Result<(), PicScaleError>
nightly_f16
only.Performs rescaling for RGB f16
Scales RGB high bit-depth interleaved image in f16
type.
Channel order does not matter.
§Arguments
store
- original image store
into
- target image store
§Example
#[no_build]
use pic_scale::{ImageStore, ImageStoreMut, ResamplingFunction, Scaler};
let mut scaler = Scaler::new(ResamplingFunction::Bilinear);
let src_store = ImageStore::alloc(100, 100);
let mut dst_store = ImageStoreMut::<f16, 3>::alloc_with_depth(50, 50, 10);
scaler.resize_rgb_f16(&src_store, &mut dst_store).unwrap();
Sourcepub fn resize_cbcr_f16<'a>(
&'a self,
store: &ImageStore<'a, f16, 2>,
into: &mut ImageStoreMut<'a, f16, 2>,
) -> Result<(), PicScaleError>
Available on crate feature nightly_f16
only.
pub fn resize_cbcr_f16<'a>( &'a self, store: &ImageStore<'a, f16, 2>, into: &mut ImageStoreMut<'a, f16, 2>, ) -> Result<(), PicScaleError>
nightly_f16
only.Performs rescaling for CbCr f16
Scales CbCr high bit-depth interleaved image in f16
type, optionally it could handle LumaAlpha images also
Channel order does not matter.
§Arguments
store
- original image store
into
- target image store
§Example
#[no_build]
use pic_scale::{ImageStore, ImageStoreMut, ResamplingFunction, Scaler};
let mut scaler = Scaler::new(ResamplingFunction::Bilinear);
let src_store = ImageStore::alloc(100, 100);
let mut dst_store = ImageStoreMut::<f16, 2>::alloc_with_depth(50, 50, 10);
scaler.resize_cbcr_f16(&src_store, &mut dst_store).unwrap();
Sourcepub fn resize_plane_f16<'a>(
&'a self,
store: &ImageStore<'a, f16, 1>,
into: &mut ImageStoreMut<'a, f16, 1>,
) -> Result<(), PicScaleError>
Available on crate feature nightly_f16
only.
pub fn resize_plane_f16<'a>( &'a self, store: &ImageStore<'a, f16, 1>, into: &mut ImageStoreMut<'a, f16, 1>, ) -> Result<(), PicScaleError>
nightly_f16
only.Performs rescaling for Planar image f16
Scales planar high bit-depth image in f16
type, optionally it could handle LumaAlpha images also
Channel order does not matter.
§Arguments
store
- original image store
into
- target image store
§Example
#[no_build]
use pic_scale::{ImageStore, ImageStoreMut, ResamplingFunction, Scaler};
let mut scaler = Scaler::new(ResamplingFunction::Bilinear);
let src_store = ImageStore::alloc(100, 100);
let mut dst_store = ImageStoreMut::<f16, 1>::alloc_with_depth(50, 50, 10);
scaler.resize_plane_f16(&src_store, &mut dst_store).unwrap();
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_plane<'a>(
&'a self,
store: &ImageStore<'a, u8, 1>,
into: &mut ImageStoreMut<'a, u8, 1>,
) -> Result<(), PicScaleError>
fn resize_plane<'a>( &'a self, store: &ImageStore<'a, u8, 1>, into: &mut ImageStoreMut<'a, u8, 1>, ) -> Result<(), PicScaleError>
Source§fn resize_cbcr8<'a>(
&'a self,
store: &ImageStore<'a, u8, 2>,
into: &mut ImageStoreMut<'a, u8, 2>,
) -> Result<(), PicScaleError>
fn resize_cbcr8<'a>( &'a self, store: &ImageStore<'a, u8, 2>, into: &mut ImageStoreMut<'a, u8, 2>, ) -> Result<(), PicScaleError>
Source§fn resize_gray_alpha<'a>(
&'a self,
store: &ImageStore<'a, u8, 2>,
into: &mut ImageStoreMut<'a, u8, 2>,
premultiply_alpha: bool,
) -> Result<(), PicScaleError>
fn resize_gray_alpha<'a>( &'a self, store: &ImageStore<'a, u8, 2>, into: &mut ImageStoreMut<'a, u8, 2>, premultiply_alpha: bool, ) -> Result<(), PicScaleError>
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_plane_f32<'a>(
&'a self,
store: &ImageStore<'a, f32, 1>,
into: &mut ImageStoreMut<'a, f32, 1>,
) -> Result<(), PicScaleError>
fn resize_plane_f32<'a>( &'a self, store: &ImageStore<'a, f32, 1>, into: &mut ImageStoreMut<'a, f32, 1>, ) -> Result<(), PicScaleError>
Source§fn resize_cbcr_f32<'a>(
&'a self,
store: &ImageStore<'a, f32, 2>,
into: &mut ImageStoreMut<'a, f32, 2>,
) -> Result<(), PicScaleError>
fn resize_cbcr_f32<'a>( &'a self, store: &ImageStore<'a, f32, 2>, into: &mut ImageStoreMut<'a, f32, 2>, ) -> Result<(), PicScaleError>
Source§fn resize_gray_alpha_f32<'a>(
&'a self,
store: &ImageStore<'a, f32, 2>,
into: &mut ImageStoreMut<'a, f32, 2>,
premultiply_alpha: bool,
) -> Result<(), PicScaleError>
fn resize_gray_alpha_f32<'a>( &'a self, store: &ImageStore<'a, f32, 2>, into: &mut ImageStoreMut<'a, f32, 2>, premultiply_alpha: bool, ) -> Result<(), PicScaleError>
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();
Source§fn resize_cbcr_u16<'a>(
&'a self,
store: &ImageStore<'a, u16, 2>,
into: &mut ImageStoreMut<'a, u16, 2>,
) -> Result<(), PicScaleError>
fn resize_cbcr_u16<'a>( &'a self, store: &ImageStore<'a, u16, 2>, into: &mut ImageStoreMut<'a, u16, 2>, ) -> Result<(), PicScaleError>
Source§fn resize_gray_alpha16<'a>(
&'a self,
store: &ImageStore<'a, u16, 2>,
into: &mut ImageStoreMut<'a, u16, 2>,
premultiply_alpha: bool,
) -> Result<(), PicScaleError>
fn resize_gray_alpha16<'a>( &'a self, store: &ImageStore<'a, u16, 2>, into: &mut ImageStoreMut<'a, u16, 2>, premultiply_alpha: bool, ) -> Result<(), PicScaleError>
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