pub struct TextureAsset3d { /* private fields */ }Expand description
Shared immutable, top-left-origin sRGB RGBA8 pixels with straight alpha.
Construction requires an explicit source-capacity limit. Clones share CPU pixels; editing returns a new snapshot and never modifies existing aliases. Engine generates mipmaps and owns filtering, GPU uploads and recovery.
Implementations§
Source§impl TextureAsset3d
impl TextureAsset3d
Sourcepub fn rgba8(
width: u32,
height: u32,
pixels: Vec<u8>,
max_source_bytes: usize,
) -> Result<Self, TextureVisualError>
pub fn rgba8( width: u32, height: u32, pixels: Vec<u8>, max_source_bytes: usize, ) -> Result<Self, TextureVisualError>
Takes exactly width * height * 4 tightly packed bytes without copying.
Dimensions must be positive, arithmetic must fit usize, and the Vec’s
capacity must fit the inclusive limit. Small Arc metadata is not charged.
This validates CPU data only; device-specific limits are checked on upload.
Sourcepub fn source_bytes(&self) -> usize
pub fn source_bytes(&self) -> usize
Returns retained base-level pixel capacity, excluding fixed Arc metadata.
Reports shared snapshot identity, not equality of pixel contents.
Sourcepub fn is_direct_revision_of(&self, previous: &Self) -> bool
pub fn is_direct_revision_of(&self, previous: &Self) -> bool
Reports whether this snapshot was patched directly from the given snapshot. Equal pixel contents do not imply a revision relationship.
Sourcepub fn with_region_update(
&self,
region: ImageRegion,
row_stride: usize,
pixels: &[u8],
max_source_bytes: usize,
) -> Result<Self, TextureVisualError>
pub fn with_region_update( &self, region: ImageRegion, row_stride: usize, pixels: &[u8], max_source_bytes: usize, ) -> Result<Self, TextureVisualError>
Copies a rectangular strided patch into a new complete CPU snapshot.
row_stride is in bytes and must cover each patch row. The input length
must equal (height - 1) * row_stride + width * 4; final-row padding is
not supplied. The inclusive limit bounds this new pixel allocation;
callers retaining old snapshots also retain their separately charged
storage. Failure leaves all existing snapshots unchanged.
Only the immediate parent’s identity and dirty rectangle are retained, not its pixels or an edit history. Desktop can patch that exact revision; skipped or branched revisions safely fall back to a full replacement.
Sourcepub fn updated_region(&self) -> Option<ImageRegion>
pub fn updated_region(&self) -> Option<ImageRegion>
Returns the patch from the immediate parent, or None for a fresh image. It is not a cumulative patch relative to arbitrary older snapshots.
Trait Implementations§
Source§impl Clone for TextureAsset3d
impl Clone for TextureAsset3d
Source§impl Debug for TextureAsset3d
impl Debug for TextureAsset3d
impl Eq for TextureAsset3d
Auto Trait Implementations§
impl Freeze for TextureAsset3d
impl RefUnwindSafe for TextureAsset3d
impl Send for TextureAsset3d
impl Sync for TextureAsset3d
impl Unpin for TextureAsset3d
impl UnsafeUnpin for TextureAsset3d
impl UnwindSafe for TextureAsset3d
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
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,
impl<T> ConditionalSend for Twhere
T: Send,
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
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
key and return true if they are equal.