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>
impl<'a> Sheet<'a>
Sourcepub fn new(
texture: &'a Image,
alpha: Option<&Image>,
meter: &Arc<Meter>,
) -> Result<Self, SpriteError>
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 isSpriteError::AlphaBandCount,Image.merge’sValueError“wrong number of bands”, which it raises before it compares sizes; - decoded sizes that differ are
SpriteError::AlphaSizeMismatch, its “size mismatch”; - an
Ltexture alone, or anLalpha texture of the texture’s size, which UnityPy renders, isSpriteError::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.
Sourcepub fn merged(
texture: &Image,
alpha: &Image,
meter: &Arc<Meter>,
) -> Result<Sheet<'static>, SpriteError>
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.