Skip to main content

ImageAsset

Struct ImageAsset 

Source
pub struct ImageAsset { /* private fields */ }
Expand description

static PNG/JPEG/WebP data with EXIF-corrected linear RGBA16F mipmaps. Clones share every level. Encoded profiles are interpreted as sRGB; ICC/HDR profile transforms and animated frame selection belong to later contracts.

Implementations§

Source§

impl ImageAsset

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self>

Decodes a bounded static PNG/JPEG/WebP and applies EXIF orientation first.

Source

pub fn from_rgba8(width: u32, height: u32, pixels: Vec<u8>) -> Result<Self>

Converts straight encoded-sRGB RGBA8 without retaining or decoding it later.

Source

pub fn from_rgba_float( width: u32, height: u32, pixels: Vec<[f64; 4]>, ) -> Result<Self>

Takes straight LINEAR f64 RGBA, then premultiplies and rounds to half. Extended RGB is allowed when premultiplied values fit RGBA16F; alpha must be in 0..=1. Zero or half-rounded-zero alpha clears hidden RGB.

Source

pub fn width(&self) -> u32

Source width after orientation.

Source

pub fn height(&self) -> u32

Source height after orientation.

Source

pub fn levels(&self) -> &[ImageLevel]

Immutable mip chain, including the base and final 1x1 level.

Source

pub fn retained_bytes(&self) -> usize

Logical shared pixel payload, excluding allocation overhead.

Trait Implementations§

Source§

impl Asset for ImageAsset

Source§

const KIND: &'static str = "image"

Human-readable resource category retained by load diagnostics.
Source§

fn decode(bytes: &[u8], _: &LoadContext) -> Result<Self>

Decodes bounded input without requiring a rendering device. Implementations must be deterministic for these bytes/context; recursive resource dependency graphs are not a supported decoder contract.
Source§

fn retained_bytes(&self) -> usize

Logical decoded payload charge; custom heap-owning assets should override. At least the encoded input length is charged regardless of this value.
Source§

impl Clone for ImageAsset

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ImageAsset

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ImagePixels for ImageAsset

Source§

fn width(&self) -> u32

Base-level width in texels.
Source§

fn height(&self) -> u32

Base-level height in texels.
Source§

fn level_count(&self) -> usize

Number of immutable mip levels.
Source§

fn level_size(&self, level: usize) -> (u32, u32)

Width/height of an existing mip level.
Source§

fn texel(&self, level: usize, column: usize, row: usize) -> [f32; 4]

One in-bounds finite linear-premultiplied texel.
Source§

fn extend_level(&self, level: usize, out: &mut Vec<f32>)

Appends every texel of an existing level in row-major order, four f32 each. Overriding this avoids one dynamic call per texel for backends that upload whole levels.
Source§

fn content_eq(&self, other: &dyn ImagePixels) -> bool

Whether another implementation owns the same immutable pixel content.
Source§

fn as_any(&self) -> &dyn Any

Concrete storage identity, resolved only by its owning content implementation.
Source§

impl PartialEq for ImageAsset

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ImageAsset

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.