pub struct Image {
pub data: Blob<u8>,
pub format: ImageFormat,
pub width: u32,
pub height: u32,
pub x_extend: Extend,
pub y_extend: Extend,
pub quality: ImageQuality,
pub alpha: f32,
}
Expand description
Owned shareable image resource.
Fields§
§data: Blob<u8>
Blob containing the image data.
format: ImageFormat
Pixel format of the image.
width: u32
Width of the image.
height: u32
Height of the image.
x_extend: Extend
Extend mode in the horizontal direction.
y_extend: Extend
Extend mode in the vertical direction.
quality: ImageQuality
Hint for desired rendering quality.
alpha: f32
An additional alpha multiplier to use with the image.
Implementations§
Source§impl Image
impl Image
Sourcepub fn new(data: Blob<u8>, format: ImageFormat, width: u32, height: u32) -> Self
pub fn new(data: Blob<u8>, format: ImageFormat, width: u32, height: u32) -> Self
Creates a new image with the given data, format and dimensions.
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.