pub struct Image {
pub uuid: Uuid,
pub width: u32,
pub height: u32,
pub depth: u32,
pub mip_level_count: u32,
pub dimension: ImageDimension,
pub format: PixelFormat,
pub data: Option<Vec<u8>>,
}Expand description
CPU-side image data.
A lightweight, purely owned container of pixel bytes plus the minimal metadata the GPU uploader needs (size, format, dimension).
Image deliberately carries no Arc, RwLock, atomic fields, or
wgpu types. Thread-safe shared access is provided by the
[AssetStorage] layer, which wraps every stored asset in Arc and
guards mutations with a version counter.
Colour-space semantics are intentionally absent — the same image data
can be upload as sRGB or Linear depending on the [Texture] that
references it.
Fields§
§uuid: Uuid§width: u32§height: u32§depth: u32§mip_level_count: u32§dimension: ImageDimension§format: PixelFormat§data: Option<Vec<u8>>Raw pixel bytes. None indicates a placeholder awaiting async load.
Implementations§
Source§impl Image
impl Image
Sourcepub fn new(
width: u32,
height: u32,
depth_or_array_layers: u32,
dimension: ImageDimension,
format: PixelFormat,
data: Option<Vec<u8>>,
) -> Image
pub fn new( width: u32, height: u32, depth_or_array_layers: u32, dimension: ImageDimension, format: PixelFormat, data: Option<Vec<u8>>, ) -> Image
Creates a new image with the given dimensions and optional pixel data.
Sourcepub fn format(&self) -> PixelFormat
pub fn format(&self) -> PixelFormat
Returns the pixel format.
Sourcepub fn dimension(&self) -> ImageDimension
pub fn dimension(&self) -> ImageDimension
Returns the spatial dimensionality.
Sourcepub fn solid_color(rgba: [u8; 4]) -> Image
pub fn solid_color(rgba: [u8; 4]) -> Image
Creates a 1×1 RGBA8 image with the specified colour.
Trait Implementations§
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.