pub struct Image {
pub uuid: Uuid,
pub width: u32,
pub height: u32,
pub depth: u32,
pub mip_level_count: u32,
pub description: ImageDescriptor,
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).
§Design
Image deliberately carries no Arc, RwLock, or atomic fields.
Thread-safe shared access is provided by the [AssetStorage] layer,
which wraps every stored asset in Arc and guards mutations with a
version counter. This keeps Image trivially movable and avoids
hidden synchronisation costs on the hot read path.
Fields§
§uuid: Uuid§width: u32§height: u32§depth: u32§mip_level_count: u32§description: ImageDescriptor§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: TextureDimension,
format: TextureFormat,
data: Option<Vec<u8>>,
) -> Image
pub fn new( width: u32, height: u32, depth_or_array_layers: u32, dimension: TextureDimension, format: TextureFormat, data: Option<Vec<u8>>, ) -> Image
Creates a new image with the given dimensions and optional pixel data.
Sourcepub fn format(&self) -> TextureFormat
pub fn format(&self) -> TextureFormat
Shorthand for the texel format.
Sourcepub fn dimension(&self) -> TextureDimension
pub fn dimension(&self) -> TextureDimension
Shorthand for the texture dimension.
Sourcepub fn solid_color(rgba: [u8; 4]) -> Image
pub fn solid_color(rgba: [u8; 4]) -> Image
Creates a 1×1 RGBA8 sRGB image with the specified color.
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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.