Module: ninty.gx2
class Surface
Represents a GX2Surface.
SUPPORTED_SURFACE_FORMATS: list
The list of surface formats supported by decode().
def deswizzle(data: bytes, width: int, height: int, format: int, tilemode: int, swizzle: int) -> bytes
Deswizzles a 2D texture and its mipmaps with the given parameters. All texture formats and tile modes are supported.
def swizzle(data: bytes, width: int, height: int, format: int, tilemode: int, swizzle: int) -> bytes
Swizzles a 2D texture and its mipmaps with the given parameters. All texture formats and tile modes are supported.
def decode(data: bytes, width: int, height: int, format: int) -> bytes
Decodes a 2D texture and its mipmaps to RGBA. Only a limited number of formats are supported.
Surface
dim: int = GX2_SURFACE_DIM_TEXTURE_2D
width: int = 0
height: int = 0
depth: int = 0
mip_levels: int = 0
format: int = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8
aa: int = GX2_AA_MODE_1X
use: int = GX2_SURFACE_USE_TEXTURE
image_size: int = 0
image: bytes = b""
mipmap_size: int = 0
mipmaps: bytes = b""
tile_mode: int = GX2_TILE_MODE_LINEAR_SPECIAL
swizzle: int = 0
alignment: int = 0
pitch: int = 0
mip_level_offset: list[int] = [0] * 13
def __init__()
Creates a new Surface object.
def calc_size_and_alignment() -> None
This is an implementation of GX2CalcSurfaceSizeAndAlignment.
The following fields are updated: alignment, pitch, swizzle, image_size, mipmap_size, mip_levels and mip_level_offset.
If tilemode is set to GX2_TILE_MODE_DEFAULT it is updated as well.
def deswizzle() -> None
Deswizzles the surface.
def swizzle(tilemode: int, swizzle: int) -> None
Swizzles the surface.
def decode() -> None
Decodes the surface to RGBA. Only deswizzled surfaces can be decoded.