pub struct Image {
pub width: u32,
pub height: u32,
pub pixels: Vec<u8>,
}Expand description
Mapped, tightly packed RGBA8 image owned by the caller.
Fields§
§width: u32Width in pixels.
height: u32Height in pixels.
pixels: Vec<u8>Row-major RGBA8 pixels with no row padding.
Implementations§
Source§impl Image
impl Image
Sourcepub fn png_bytes(&self) -> Result<Vec<u8>, RenderError>
pub fn png_bytes(&self) -> Result<Vec<u8>, RenderError>
Encodes the already-tonemapped image as a deterministic RGBA PNG.
The engine performs scene-linear HDR lighting, exposure, display grading and sRGB conversion before the readback. This method therefore serializes publication pixels without applying a second colour curve. No filesystem or application state is touched.
§Errors
Returns RenderError::ImageEncoding if the pixel buffer is malformed
or the PNG encoder rejects the stream.
Sourcepub fn write_png(&self, output: impl Write) -> Result<(), RenderError>
pub fn write_png(&self, output: impl Write) -> Result<(), RenderError>
Streams deterministic RGBA PNG bytes into a caller-owned writer.
§Errors
Returns RenderError::ImageEncoding for malformed pixels or an
encoder/writer failure.
Trait Implementations§
impl Eq for Image
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 UnsafeUnpin 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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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