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
impl Format
Sourcepub const fn mode(self) -> Mode
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
impl Format
Sourcepub const ALL: [Format; 75]
pub const ALL: [Format; 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+.
Sourcepub const EXPORTED: [Format; 5]
pub const EXPORTED: [Format; 5]
The five version 1 of the batch engine exports
(docs/BATCH_SPEC.md section 3), in TextureFormat order.
Sourcepub const fn from_texture_format(value: i32) -> Option<Format>
pub const fn from_texture_format(value: i32) -> Option<Format>
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.
Sourcepub const fn texture_format(self) -> i32
pub const fn texture_format(self) -> i32
Its TextureFormat value.
Sourcepub const fn exported(self) -> bool
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()).
Sourcepub const fn block_bytes(self) -> Option<u64>
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).
Sourcepub const fn block_size(self) -> Option<(u8, u8)>
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).
Sourcepub const fn is_astc_hdr(self) -> bool
pub const fn is_astc_hdr(self) -> bool
Whether this uses the corrected HDR profile.
Sourcepub const fn is_crunched(self) -> bool
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.
Sourcepub const fn is_unity_crunched(self) -> bool
pub const fn is_unity_crunched(self) -> bool
Whether the input uses Unity’s fork of CRN.