pub struct Image {
pub data: Blob<u8>,
pub format: Format,
pub width: u32,
pub height: u32,
pub extend: Extend,
pub alpha: u8,
}
Expand description
Owned shareable image resource.
Fields§
§data: Blob<u8>
Blob containing the image data.
format: Format
Pixel format of the image.
width: u32
Width of the image.
height: u32
Height of the image.
extend: Extend
Extend mode.
alpha: u8
An additional alpha multiplier to use with the image.
Implementations§
source§impl Image
impl Image
sourcepub fn new(data: Blob<u8>, format: Format, width: u32, height: u32) -> Self
pub fn new(data: Blob<u8>, format: Format, 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.
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.
If any resulting alphas would overflow, these currently saturate (to opaque).
Trait Implementations§
source§impl<'de> Deserialize<'de> for Image
impl<'de> Deserialize<'de> for Image
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Image
Auto Trait Implementations§
impl Freeze for Image
impl !RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl !UnwindSafe for Image
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)