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§
Source§impl ImageSampler
impl ImageSampler
Sourcepub fn with_extend(self, mode: Extend) -> Self
pub fn with_extend(self, mode: Extend) -> Self
Builder method for setting the image extend mode in both directions.
Sourcepub fn with_x_extend(self, mode: Extend) -> Self
pub fn with_x_extend(self, mode: Extend) -> Self
Builder method for setting the image extend mode in the horizontal direction.
Sourcepub fn with_y_extend(self, mode: Extend) -> Self
pub fn with_y_extend(self, mode: Extend) -> Self
Builder method for setting the image extend mode in the vertical direction.
Sourcepub fn with_quality(self, quality: ImageQuality) -> Self
pub fn with_quality(self, quality: ImageQuality) -> Self
Builder method for setting a hint for the desired image quality when rendering.
Sourcepub fn with_alpha(self, alpha: f32) -> Self
pub fn with_alpha(self, alpha: f32) -> Self
Returns the image with the alpha multiplier set to alpha.
Sourcepub fn multiply_alpha(self, alpha: f32) -> Self
pub fn multiply_alpha(self, alpha: f32) -> Self
Returns the image with the alpha multiplier multiplied again by alpha.
The behaviour of this transformation is undefined if alpha is negative.
Trait Implementations§
Source§impl Clone for ImageSampler
impl Clone for ImageSampler
Source§fn clone(&self) -> ImageSampler
fn clone(&self) -> ImageSampler
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more