pub struct CpuImage { /* private fields */ }Expand description
A CPU picture of premultiplied sRGB RGBA, like every GPU intermediate.
Only the content rectangle is stored; everything outside is transparent, so a small label on a large canvas stores only the label.
Implementations§
Source§impl CpuImage
impl CpuImage
Sourcepub fn from_premultiplied_rgba8(
size: RenderSize,
rgba8: &[u8],
) -> Result<Self, RenderError>
pub fn from_premultiplied_rgba8( size: RenderSize, rgba8: &[u8], ) -> Result<Self, RenderError>
A picture from packed premultiplied sRGB RGBA8, sampled like the texture
crate::Renderer::upload_rgba8 creates.
§Errors
RenderError::InvalidImageData when rgba8 is not four bytes per pixel of size.
Sourcepub const fn size(&self) -> RenderSize
pub const fn size(&self) -> RenderSize
The picture’s dimensions.
Sourcepub fn retained_bytes(&self) -> u64
pub fn retained_bytes(&self) -> u64
Bytes the picture holds.
Sourcepub fn read_rgba8(&self) -> Vec<u8> ⓘ
pub fn read_rgba8(&self) -> Vec<u8> ⓘ
Packed RGBA8 rounded to nearest, as crate::Renderer::read_rgba8 reads a texture.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CpuImage
impl RefUnwindSafe for CpuImage
impl Send for CpuImage
impl Sync for CpuImage
impl Unpin for CpuImage
impl UnsafeUnpin for CpuImage
impl UnwindSafe for CpuImage
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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