Skip to main content

Format

Enum Format 

Source
pub enum Format {
Show 78 variants Alpha8, Argb4444, Rgb24, Rgba32, Argb32, ArgbFloat, Rgb565, Bgr24, R16, Dxt1, Dxt3, Dxt5, Rgba4444, Bgra32, RHalf, RgHalf, RgbaHalf, RFloat, RgFloat, RgbaFloat, Yuy2, Rgb9e5Float, RgbFloat, Bc6h, Bc7, Bc4, Bc5, Dxt1Crunched, UnityDxt1Crunched, Dxt5Crunched, UnityDxt5Crunched, PvrtcRgb2, PvrtcRgba2, PvrtcRgb4, PvrtcRgba4, EtcRgb4, AtcRgb4, AtcRgba8, EacR, EacRSigned, EacRg, EacRgSigned, Etc2Rgb, Etc2Rgba1, Etc2Rgba8, AstcRgb4x4, AstcRgb5x5, AstcRgb6x6, AstcRgb8x8, AstcRgb10x10, AstcRgb12x12, AstcRgba4x4, AstcRgba5x5, AstcRgba6x6, AstcRgba8x8, AstcRgba10x10, AstcRgba12x12, Rg16, R8, EtcRgb4Crunched, Etc2Rgba8Crunched, AstcHdr4x4, AstcHdr5x5, AstcHdr6x6, AstcHdr8x8, AstcHdr10x10, AstcHdr12x12, Rg32, Rgb48, Rgba64, R8Signed, Rg16Signed, Rgb24Signed, Rgba32Signed, R16Signed, Rg32Signed, Rgb48Signed, Rgba64Signed,
}
Expand description

The formats this crate decodes: the five of docs/plans/extract.md E15 and the rest of the formats UnityPy decodes with Pillow’s raw and bcn decoders (raw’s and bcn’s module docs), the eight ETC and EAC formats texture2ddecoder decodes for it (etc’s module docs), and the twelve ASTC LDR formats astcenc decodes for it (astc’s module docs), the four PVRTC and two ATC formats (pvrtc and atc), and twenty-two raw formats using independent closed forms (tierb). ArgbFloat is a refusal-only sentinel, excluded from ALL.

Variants§

§

Alpha8

Alpha8 (1): Pillow’s raw A into RGBA.

§

Argb4444

ARGB4444 (2): Pillow’s raw RGBA;4B into RGBA, its bands reordered (2, 1, 0, 3).

§

Rgb24

RGB24 (3): Pillow’s raw RGB into RGB.

§

Rgba32

RGBA32 (4): Pillow’s raw RGBA into RGBA.

§

Argb32

ARGB32 (5): Pillow’s raw ARGB into RGBA.

§

ArgbFloat

ARGBFloat (6): refusal only; not in ALL or Formats::DECODED. Its channel order is unknown (PARITY.md section 17.1, Tier U).

§

Rgb565

RGB565 (7): Pillow’s raw BGR;16 into RGB.

§

Bgr24

BGR24 (8): Pillow’s raw BGR into RGB.

§

R16

R16 (9): closed form of PARITY.md sections 17.1 and 19.

§

Dxt1

DXT1 (10): Pillow’s bcn 1 (BC1) into RGBA.

§

Dxt3

DXT3 (11): Pillow’s bcn 2 (BC2) into RGBA.

§

Dxt5

DXT5 (12): Pillow’s bcn 3 (BC3) into RGBA.

§

Rgba4444

RGBA4444 (13): Pillow’s raw RGBA;4B into RGBA, its bands reordered (3, 2, 1, 0).

§

Bgra32

BGRA32 (14): Pillow’s raw BGRA into RGBA.

§

RHalf

RHalf (15): closed form of PARITY.md sections 17.1 and 19.

§

RgHalf

RGHalf (16): closed form of PARITY.md sections 17.1 and 19.

§

RgbaHalf

RGBAHalf (17): closed form of PARITY.md sections 17.1 and 19.

§

RFloat

RFloat (18): closed form of PARITY.md sections 17.1 and 19.

§

RgFloat

RGFloat (19): closed form of PARITY.md sections 17.1 and 19.

§

RgbaFloat

RGBAFloat (20): closed form of PARITY.md sections 17.1 and 19.

§

Yuy2

YUY2 (21): closed form of PARITY.md sections 17.1 and 19.

§

Rgb9e5Float

RGB9e5Float (22): closed form of PARITY.md sections 17.1 and 19.

§

RgbFloat

RGBFloat (23): closed form of PARITY.md sections 17.1 and 19.

§

Bc6h

BC6H (24): specification-defined unsigned RGB half floats.

§

Bc7

BC7 (25): Pillow’s bcn 7 into RGBA.

§

Bc4

BC4 (26): Pillow’s bcn 4 into L.

§

Bc5

BC5 (27): Pillow’s bcn 5 into RGB.

§

Dxt1Crunched

DXT1Crunched (28): legacy CRN, then Pillow BC1; below Unity 2017.3.

§

UnityDxt1Crunched

Unity 2017.3+ DXT1Crunched (28), explicitly selecting Unity’s fork.

§

Dxt5Crunched

DXT5Crunched (29): legacy CRN, then Pillow BC3; below Unity 2017.3.

§

UnityDxt5Crunched

Unity 2017.3+ DXT5Crunched (29), explicitly selecting Unity’s fork.

§

PvrtcRgb2

PVRTC_RGB2 (30): texture2ddecoder into RGBA.

§

PvrtcRgba2

PVRTC_RGBA2 (31): texture2ddecoder into RGBA.

§

PvrtcRgb4

PVRTC_RGB4 (32): texture2ddecoder into RGBA.

§

PvrtcRgba4

PVRTC_RGBA4 (33): texture2ddecoder into RGBA.

§

EtcRgb4

ETC_RGB4 (34): texture2ddecoder’s ETC1 into RGBA.

§

AtcRgb4

ATC_RGB4 (35): texture2ddecoder into RGBA.

§

AtcRgba8

ATC_RGBA8 (36): texture2ddecoder into RGBA.

§

EacR

EAC_R (41): texture2ddecoder’s EAC R into RGBA.

§

EacRSigned

EAC_R_SIGNED (42): texture2ddecoder’s signed EAC R into RGBA.

§

EacRg

EAC_RG (43): texture2ddecoder’s EAC RG into RGBA.

§

EacRgSigned

EAC_RG_SIGNED (44): texture2ddecoder’s signed EAC RG into RGBA.

§

Etc2Rgb

ETC2_RGB (45): texture2ddecoder’s ETC2 into RGBA.

§

Etc2Rgba1

ETC2_RGBA1 (46): texture2ddecoder’s ETC2 A1 into RGBA, with its transparent pixels (0, 0, 0, 0) (Tier C, PARITY.md section 19.1).

§

Etc2Rgba8

ETC2_RGBA8 (47): texture2ddecoder’s ETC2 A8 into RGBA.

§

AstcRgb4x4

ASTC_RGB_4x4 (48): astcenc’s LDR decode of 4x4 blocks into RGBA (the astc module).

§

AstcRgb5x5

ASTC_RGB_5x5 (49): astcenc’s LDR decode of 5x5 blocks into RGBA (the astc module).

§

AstcRgb6x6

ASTC_RGB_6x6 (50): astcenc’s LDR decode of 6x6 blocks into RGBA (the astc module).

§

AstcRgb8x8

ASTC_RGB_8x8 (51): astcenc’s LDR decode of 8x8 blocks into RGBA (the astc module).

§

AstcRgb10x10

ASTC_RGB_10x10 (52): astcenc’s LDR decode of 10x10 blocks into RGBA (the astc module).

§

AstcRgb12x12

ASTC_RGB_12x12 (53): astcenc’s LDR decode of 12x12 blocks into RGBA (the astc module).

§

AstcRgba4x4

ASTC_RGBA_4x4 (54): astcenc’s LDR decode of 4x4 blocks into RGBA (the astc module).

§

AstcRgba5x5

ASTC_RGBA_5x5 (55): astcenc’s LDR decode of 5x5 blocks into RGBA (the astc module).

§

AstcRgba6x6

ASTC_RGBA_6x6 (56): astcenc’s LDR decode of 6x6 blocks into RGBA (the astc module).

§

AstcRgba8x8

ASTC_RGBA_8x8 (57): astcenc’s LDR decode of 8x8 blocks into RGBA (the astc module).

§

AstcRgba10x10

ASTC_RGBA_10x10 (58): astcenc’s LDR decode of 10x10 blocks into RGBA (the astc module).

§

AstcRgba12x12

ASTC_RGBA_12x12 (59): astcenc’s LDR decode of 12x12 blocks into RGBA (the astc module).

§

Rg16

RG16 (62): closed form of PARITY.md sections 17.1 and 19.

§

R8

R8 (63): Pillow’s raw R into RGB.

§

EtcRgb4Crunched

ETC_RGB4Crunched (64): Unity fork, then ETC1.

§

Etc2Rgba8Crunched

ETC2_RGBA8Crunched (65): Unity fork, then ETC2 A8.

§

AstcHdr4x4

ASTC_HDR_4x4: astcenc’s HDR profile, then the half rule.

§

AstcHdr5x5

ASTC_HDR_5x5: astcenc’s HDR profile, then the half rule.

§

AstcHdr6x6

ASTC_HDR_6x6: astcenc’s HDR profile, then the half rule.

§

AstcHdr8x8

ASTC_HDR_8x8: astcenc’s HDR profile, then the half rule.

§

AstcHdr10x10

ASTC_HDR_10x10: astcenc’s HDR profile, then the half rule.

§

AstcHdr12x12

ASTC_HDR_12x12: astcenc’s HDR profile, then the half rule.

§

Rg32

RG32 (72): closed form of PARITY.md sections 17.1 and 19.

§

Rgb48

RGB48 (73): closed form of PARITY.md sections 17.1 and 19.

§

Rgba64

RGBA64 (74): closed form of PARITY.md sections 17.1 and 19.

§

R8Signed

R8_SIGNED (75): closed form of PARITY.md sections 17.1 and 19.

§

Rg16Signed

RG16_SIGNED (76): closed form of PARITY.md sections 17.1 and 19.

§

Rgb24Signed

RGB24_SIGNED (77): closed form of PARITY.md sections 17.1 and 19.

§

Rgba32Signed

RGBA32_SIGNED (78): closed form of PARITY.md sections 17.1 and 19.

§

R16Signed

R16_SIGNED (79): closed form of PARITY.md sections 17.1 and 19.

§

Rg32Signed

RG32_SIGNED (80): closed form of PARITY.md sections 17.1 and 19.

§

Rgb48Signed

RGB48_SIGNED (81): closed form of PARITY.md sections 17.1 and 19.

§

Rgba64Signed

RGBA64_SIGNED (82): closed form of PARITY.md sections 17.1 and 19.

Implementations§

Source§

impl Format

Source

pub const fn mode(self) -> Mode

The output mode: for closed forms, PARITY.md sections 17.1 and 19; otherwise the mode UnityPy decodes it to (CONV_TABLE, export/Texture2DConverter.py:488-566): L for BC4 (:513); RGB for RGB24 (:491), RGB565 (:495), BGR24 (:496), R8 (:497) and BC5 (:514); RGBA for the rest. A texture with a side of 0 is an empty RGBA image whatever its format (crate::decode()).

Source§

impl Format

Source

pub const ALL: [Self; 75]

One variant per decoded TextureFormat value, in numeric order. DXT entries select legacy CRN; select_in and select_crunch choose Unity fork variants at Unity 2017.3+.

Source

pub const EXPORTED: [Self; 5]

The five version 1 of the batch engine exports (docs/BATCH_SPEC.md section 3), in TextureFormat order.

Source

pub const fn from_texture_format(value: i32) -> Option<Self>

The canonical format of a decoded TextureFormat value. DXT crunch entries name legacy input; use crate::select_in with the Unity version to choose the decoder. Both variants have Unity’s same name.

Source

pub const fn texture_format(self) -> i32

Its TextureFormat value.

Source

pub const fn name(self) -> &'static str

Its TextureFormat member name.

Source

pub const fn exported(self) -> bool

Whether version 1 of the batch engine exports it: one of Self::EXPORTED, the five of docs/plans/extract.md E15 (crate::select()).

Source

pub const fn block_bytes(self) -> Option<u64>

The bytes one block holds, for a block format: 8 for DXT1, BC4, PVRTC, ATC_RGB4, ETC_RGB4, EAC_R, EAC_R_SIGNED, ETC2_RGB and ETC2_RGBA1, 16 for the rest, the ASTC formats’ included (calculate_astc_compressed_size, export/Texture2DConverter.py:390-397); None for the raw formats, which UnityPy does not pad (Self::block_size).

Source

pub const fn block_size(self) -> Option<(u8, u8)>

The block a block format is padded to, width by height (get_compressed_image_size, export/Texture2DConverter.py:36-50, with TEXTURE_FORMAT_BLOCK_SIZE_TABLE, :22-33: an ASTC name’s own WxH, 4x4 for names starting DXT, BC, ETC or EAC); PVRTC uses 8x4 at 2bpp and 4x4 at 4bpp. None for raw formats and ATC, which UnityPy does not pad (ATC still stores 4x4 blocks: Self::block_bytes).

Source

pub const fn is_astc_hdr(self) -> bool

Whether this uses the corrected HDR profile.

Source

pub const fn is_crunched(self) -> bool

Whether this format expects CRN rather than plain blocks. Use select_in or select_crunch to choose the DXT variant for the Unity version.

Source

pub const fn is_unity_crunched(self) -> bool

Whether the input uses Unity’s fork of CRN.

Trait Implementations§

Source§

impl Clone for Format

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 Copy for Format

Source§

impl Debug for Format

Source§

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

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

impl Eq for Format

Source§

impl Hash for Format

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Format

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 Format

Auto Trait Implementations§

§

impl Forget for Format

§

impl Freeze for Format

§

impl Move for Format

§

impl RefUnwindSafe for Format

§

impl Send for Format

§

impl Sync for Format

§

impl Unpin for Format

§

impl UnsafeUnpin for Format

§

impl UnwindSafe for Format

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

Source§

type Output = T

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