Skip to main content

Sheet

Struct Sheet 

Source
pub struct Sheet<'a> { /* private fields */ }
Expand description

What a sprite renders from (module docs): the decoded texture, or the texture with its alpha texture merged in.

Implementations§

Source§

impl<'a> Sheet<'a>

Source

pub fn new( texture: &'a Image, alpha: Option<&Image>, meter: &Arc<Meter>, ) -> Result<Self, SpriteError>

get_image (export/SpriteHelper.py:44-59): texture as crate::decode() gave it, and, where the render data names an alpha texture, the first three bands of texture with the first of alpha (Image.merge("RGBA", ...), :50-52), an RGBA image charged to meter before it is allocated.

The renderer is verified on RGB and RGBA sheets, the five formats’ (PARITY.md section 19.2), so it takes no other, and refuses before anything is charged or drawn:

  • a texture that decodes to L (BC4) beside an alpha texture is SpriteError::AlphaBandCount, Image.merge’s ValueError “wrong number of bands”, which it raises before it compares sizes;
  • decoded sizes that differ are SpriteError::AlphaSizeMismatch, its “size mismatch”;
  • an L texture alone, or an L alpha texture of the texture’s size, which UnityPy renders, is SpriteError::UnverifiedMode, unityrs’s own refusal (Tier U) until a render of them is checked against UnityPy’s.

UnityPy’s cache of the merged sheet is the caller’s: a sheet serves every sprite of its group.

Source

pub fn merged( texture: &Image, alpha: &Image, meter: &Arc<Meter>, ) -> Result<Sheet<'static>, SpriteError>

Sheet::new with an alpha texture: the merged sheet, which borrows neither image, so the caller may drop both once it is made.

Source

pub fn mode(&self) -> Mode

The mode: the texture’s, or RGBA when merged.

Source

pub fn width(&self) -> u32

The width in pixels.

Source

pub fn height(&self) -> u32

The height in pixels.

Trait Implementations§

Source§

impl<'a> Debug for Sheet<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Sheet<'a>

§

impl<'a> !UnwindSafe for Sheet<'a>

§

impl<'a> Forget for Sheet<'a>

§

impl<'a> Freeze for Sheet<'a>

§

impl<'a> Move for Sheet<'a>

§

impl<'a> Send for Sheet<'a>

§

impl<'a> Sync for Sheet<'a>

§

impl<'a> Unpin for Sheet<'a>

§

impl<'a> UnsafeUnpin for Sheet<'a>

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<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> Same for T

Source§

type Output = T

Should always be Self
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.