Struct ImageSampler
pub struct ImageSampler {
pub x_extend: Extend,
pub y_extend: Extend,
pub quality: ImageQuality,
pub alpha: f32,
}Expand description
Parameters which specify how to sample an image during rendering.
When a renderer is drawing an image, they will (in most cases) not directly copy the bytes from the source image to their render target; instead, they will sample from the image. This involves determining from which part of the source image to read, and how to handle cases where the source image’s pixels are not aligned with the render target exactly, in any combination of scale, position or rotation. They might also perform an alpha multiplication, as done here. This struct contains the parameters used by sampling.
Fields§
§x_extend: ExtendExtend mode in the horizontal direction.
y_extend: ExtendExtend mode in the vertical direction.
quality: ImageQualityHint for desired rendering quality.
alpha: f32An additional alpha multiplier to use with the image.
Implementations§
§impl ImageSampler
impl ImageSampler
pub fn new() -> ImageSampler
pub fn new() -> ImageSampler
Creates a new ImageSampler with default values
pub fn with_extend(self, mode: Extend) -> ImageSampler
pub fn with_extend(self, mode: Extend) -> ImageSampler
Builder method for setting the image extend mode in both directions.
pub fn with_x_extend(self, mode: Extend) -> ImageSampler
pub fn with_x_extend(self, mode: Extend) -> ImageSampler
Builder method for setting the image extend mode in the horizontal direction.
pub fn with_y_extend(self, mode: Extend) -> ImageSampler
pub fn with_y_extend(self, mode: Extend) -> ImageSampler
Builder method for setting the image extend mode in the vertical direction.
pub fn with_quality(self, quality: ImageQuality) -> ImageSampler
pub fn with_quality(self, quality: ImageQuality) -> ImageSampler
Builder method for setting a hint for the desired image quality when rendering.
pub fn with_alpha(self, alpha: f32) -> ImageSampler
pub fn with_alpha(self, alpha: f32) -> ImageSampler
Returns the image with the alpha multiplier set to alpha.
pub fn multiply_alpha(self, alpha: f32) -> ImageSampler
pub fn multiply_alpha(self, alpha: f32) -> ImageSampler
Returns the image with the alpha multiplier multiplied again by alpha.
The behaviour of this transformation is undefined if alpha is negative.
Trait Implementations§
§impl Clone for ImageSampler
impl Clone for ImageSampler
§fn clone(&self) -> ImageSampler
fn clone(&self) -> ImageSampler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ImageSampler
impl Debug for ImageSampler
§impl Default for ImageSampler
impl Default for ImageSampler
§fn default() -> ImageSampler
fn default() -> ImageSampler
§impl PartialEq for ImageSampler
impl PartialEq for ImageSampler
impl Copy for ImageSampler
impl StructuralPartialEq for ImageSampler
Auto Trait Implementations§
impl Freeze for ImageSampler
impl RefUnwindSafe for ImageSampler
impl Send for ImageSampler
impl Sync for ImageSampler
impl Unpin for ImageSampler
impl UnsafeUnpin for ImageSampler
impl UnwindSafe for ImageSampler
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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