Twilight Princess
Remastered version of the GameCube game
Loading...
Searching...
No Matches
STGenericTexture Class Referenceabstract
+ Inheritance diagram for STGenericTexture:
+ Collaboration diagram for STGenericTexture:

Classes

class  FormatInfo
 
class  Properties
 
class  Surface
 A Surface contains mip levels of compressed/uncompressed texture data. More...
 

Public Member Functions

 STGenericTexture ()
 
byte[] GetImageData (int ArrayLevel=0, int MipLevel=0, int DepthLevel=0)
 
virtual byte[] GetPaletteData ()
 
List< SurfaceGet3DSurfaces (int IndexStart=0, bool GetAllSurfaces=true, int GetSurfaceAmount=1)
 
List< SurfaceGetSurfaces (int ArrayIndexStart=0, bool GetAllSurfaces=true, int GetSurfaceAmount=1)
 
void SetImageData (Bitmap bitmap, int ArrayLevel)
 
void CreateGenericTexture (uint width, uint height, List< Surface > surfaces, TEX_FORMAT format)
 
string DebugInfo ()
 Gets a Bitmap given an array and mip index.
 
uint GenerateMipCount (int Width, int Height)
 
byte[] GetBitmapData ()
 
Bitmap GetBitmapWithChannel ()
 
Bitmap GetBitmap (int ArrayLevel=0, int MipLevel=0, int DepthLevel=0)
 Gets a Bitmap given an array and mip index.
 
void SaveBitmap (string path)
 
void SaveDDS (string FileName, bool ExportSurfaceLevel=false, bool ExportMipMapLevel=false, int SurfaceLevel=0, int MipLevel=0)
 
uint GenerateMipCount (uint Width, uint Height)
 
Bitmap GetComponentBitmap (Bitmap image, bool ShowAlpha=true)
 

Static Public Member Functions

static bool IsCompressed (TEX_FORMAT Format)
 
static bool IsCompressed2 (TEX_FORMAT Format)
 
static uint GetBytesPerPixel (TEX_FORMAT Format)
 
static uint GetBlockHeight (TEX_FORMAT Format)
 
static uint GetBlockWidth (TEX_FORMAT Format)
 
static uint GetBlockDepth (TEX_FORMAT Format)
 
static byte[] DecodeBlock (byte[] data, uint Width, uint Height, TEX_FORMAT Format, byte[] paletteData, ImageParameters parameters, PALETTE_FORMAT PaletteFormat=PALETTE_FORMAT.None, PlatformSwizzle PlatformSwizzle=PlatformSwizzle.None)
 Decodes a byte array of image data given the source image in bytes, width, height, and DXGI format.
 
static bool IsAtscFormat (TEX_FORMAT Format)
 
static STChannelType[] SetChannelsByFormat (TEX_FORMAT Format)
 
static int GenerateTotalMipCount (uint Width, uint Height)
 
static string SetNameFromPath (string path)
 
static byte[] ConvertBgraToRgba (byte[] bytes)
 

Public Attributes

ImageParameters Parameters = new()
 
STSurfaceType SurfaceType = STSurfaceType.Texture2D
 
PlatformSwizzle PlatformSwizzle
 The swizzle method to use when decoding or encoding back a texture.
 
STChannelType RedChannel = STChannelType.Red
 
STChannelType GreenChannel = STChannelType.Green
 
STChannelType BlueChannel = STChannelType.Blue
 
STChannelType AlphaChannel = STChannelType.Alpha
 

Properties

bool IsCubemap [get]
 
bool IsSwizzled = true [get, set]
 
bool IsEdited = false [get, set]
 Is the texture edited or not. Used for the image editor for saving changes.
 
EditedBitmap[] EditedImages [get, set]
 An array of EditedBitmap from the image editor to be saved back.
 
bool CanEdit [get, set]
 
long DataSizeInBytes [get]
 The total length of all the bytes given from GetImageData.
 
uint ArrayCount [get, set]
 The total amount of surfaces for the texture.
 
uint MipCount [get, set]
 The total amount of mipmaps for the texture.
 
uint Width [get, set]
 The width of the image in pixels.
 
uint Height [get, set]
 The height of the image in pixels.
 
uint Depth [get, set]
 The depth of the image in pixels. Used for 3D types.
 
TEX_FORMAT Format = TEX_FORMAT.R8G8B8A8_UNORM [get, set]
 The TEX_FORMAT Format of the image.
 
TEX_FORMAT[] SupportedFormats [get]
 The PALETTE_FORMAT Format of the image.
 
Properties GenericProperties [get]
 

Private Types

enum  TargetBuffer { Color = 1 , Depth = 2 , Stencil = 3 , DepthStencil = 4 }
 

Private Member Functions

bool UseRGBA ()
 

Static Private Member Functions

static byte[] ConvertBgraToRgba (byte[] bytes, string Format, int bpp, int width, int height, byte[] compSel)
 
static byte[] GetComponentsFromPixel (string Format, int pixel, byte[] comp)
 

Private Attributes

byte[] paletteData = new byte[0]
 
uint arrayCount = 1
 
uint mipCount = 1
 

Static Private Attributes

static readonly Dictionary< TEX_FORMAT, FormatInfoFormatTable
 

Member Enumeration Documentation

◆ TargetBuffer

Enumerator
Color 
Depth 
Stencil 
DepthStencil 

Constructor & Destructor Documentation

◆ STGenericTexture()

STGenericTexture.STGenericTexture ( )

Member Function Documentation

◆ ConvertBgraToRgba() [1/2]

static byte[] STGenericTexture.ConvertBgraToRgba ( byte[] bytes)
static

◆ ConvertBgraToRgba() [2/2]

static byte[] STGenericTexture.ConvertBgraToRgba ( byte[] bytes,
string Format,
int bpp,
int width,
int height,
byte[] compSel )
staticprivate

◆ CreateGenericTexture()

void STGenericTexture.CreateGenericTexture ( uint width,
uint height,
List< Surface > surfaces,
TEX_FORMAT format )

◆ DebugInfo()

string STGenericTexture.DebugInfo ( )

Gets a Bitmap given an array and mip index.

Parameters
ArrayIndexThe index of the surface/array. Cubemaps will have 6
MipLevelThe index of the mip level.
Returns

Decodes a byte array of image data given the source image in bytes, width, height, and DXGI format.

Parameters
byte[]The byte array of the image
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
DDS.DXGI_FORMATThe image format.
Returns
Returns a byte array of decoded data.

◆ DecodeBlock()

static byte[] STGenericTexture.DecodeBlock ( byte[] data,
uint Width,
uint Height,
TEX_FORMAT Format,
byte[] paletteData,
ImageParameters parameters,
PALETTE_FORMAT PaletteFormat = PALETTE_FORMAT::None,
PlatformSwizzle PlatformSwizzle = PlatformSwizzle::None )
static

Decodes a byte array of image data given the source image in bytes, width, height, and DXGI format.

Parameters
byte[]The byte array of the image
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
DDS.DXGI_FORMATThe image format.
Returns
Returns a byte array of decoded data.

◆ GenerateMipCount() [1/2]

uint STGenericTexture.GenerateMipCount ( int Width,
int Height )

◆ GenerateMipCount() [2/2]

uint STGenericTexture.GenerateMipCount ( uint Width,
uint Height )

◆ GenerateTotalMipCount()

static int STGenericTexture.GenerateTotalMipCount ( uint Width,
uint Height )
static

◆ Get3DSurfaces()

List< Surface > STGenericTexture.Get3DSurfaces ( int IndexStart = 0,
bool GetAllSurfaces = true,
int GetSurfaceAmount = 1 )

◆ GetBitmap()

Bitmap STGenericTexture.GetBitmap ( int ArrayLevel = 0,
int MipLevel = 0,
int DepthLevel = 0 )

Gets a Bitmap given an array and mip index.

Parameters
ArrayIndexThe index of the surface/array. Cubemaps will have 6
MipLevelThe index of the mip level.
Returns

◆ GetBitmapData()

byte[] STGenericTexture.GetBitmapData ( )

◆ GetBitmapWithChannel()

Bitmap STGenericTexture.GetBitmapWithChannel ( )

◆ GetBlockDepth()

static uint STGenericTexture.GetBlockDepth ( TEX_FORMAT Format)
static

◆ GetBlockHeight()

static uint STGenericTexture.GetBlockHeight ( TEX_FORMAT Format)
static

◆ GetBlockWidth()

static uint STGenericTexture.GetBlockWidth ( TEX_FORMAT Format)
static

◆ GetBytesPerPixel()

static uint STGenericTexture.GetBytesPerPixel ( TEX_FORMAT Format)
static

◆ GetComponentBitmap()

Bitmap STGenericTexture.GetComponentBitmap ( Bitmap image,
bool ShowAlpha = true )

◆ GetComponentsFromPixel()

static byte[] STGenericTexture.GetComponentsFromPixel ( string Format,
int pixel,
byte[] comp )
staticprivate

◆ GetImageData()

byte[] STGenericTexture.GetImageData ( int ArrayLevel = 0,
int MipLevel = 0,
int DepthLevel = 0 )
abstract

◆ GetPaletteData()

virtual byte[] STGenericTexture.GetPaletteData ( )
virtual

◆ GetSurfaces()

List< Surface > STGenericTexture.GetSurfaces ( int ArrayIndexStart = 0,
bool GetAllSurfaces = true,
int GetSurfaceAmount = 1 )

◆ IsAtscFormat()

static bool STGenericTexture.IsAtscFormat ( TEX_FORMAT Format)
static

◆ IsCompressed()

static bool STGenericTexture.IsCompressed ( TEX_FORMAT Format)
static

◆ IsCompressed2()

static bool STGenericTexture.IsCompressed2 ( TEX_FORMAT Format)
static

◆ SaveBitmap()

void STGenericTexture.SaveBitmap ( string path)

◆ SaveDDS()

void STGenericTexture.SaveDDS ( string FileName,
bool ExportSurfaceLevel = false,
bool ExportMipMapLevel = false,
int SurfaceLevel = 0,
int MipLevel = 0 )

◆ SetChannelsByFormat()

static STChannelType[] STGenericTexture.SetChannelsByFormat ( TEX_FORMAT Format)
static

◆ SetImageData()

void STGenericTexture.SetImageData ( Bitmap bitmap,
int ArrayLevel )
abstract

◆ SetNameFromPath()

static string STGenericTexture.SetNameFromPath ( string path)
static

◆ UseRGBA()

bool STGenericTexture.UseRGBA ( )
private

Member Data Documentation

◆ AlphaChannel

STChannelType STGenericTexture.AlphaChannel = STChannelType.Alpha

◆ arrayCount

uint STGenericTexture.arrayCount = 1
private

◆ BlueChannel

STChannelType STGenericTexture.BlueChannel = STChannelType.Blue

◆ FormatTable

readonly Dictionary<TEX_FORMAT, FormatInfo> STGenericTexture.FormatTable
staticprivate

◆ GreenChannel

STChannelType STGenericTexture.GreenChannel = STChannelType.Green

◆ mipCount

uint STGenericTexture.mipCount = 1
private

◆ paletteData

byte [] STGenericTexture.paletteData = new byte[0]
private

◆ Parameters

ImageParameters STGenericTexture.Parameters = new()

◆ PlatformSwizzle

PlatformSwizzle STGenericTexture.PlatformSwizzle

The swizzle method to use when decoding or encoding back a texture.

◆ RedChannel

STChannelType STGenericTexture.RedChannel = STChannelType.Red

◆ SurfaceType

STSurfaceType STGenericTexture.SurfaceType = STSurfaceType.Texture2D

Property Documentation

◆ ArrayCount

uint STGenericTexture.ArrayCount
getset

The total amount of surfaces for the texture.

◆ CanEdit

bool STGenericTexture.CanEdit
getsetabstract

◆ DataSizeInBytes

long STGenericTexture.DataSizeInBytes
get

The total length of all the bytes given from GetImageData.

◆ Depth

uint STGenericTexture.Depth
getset

The depth of the image in pixels. Used for 3D types.

◆ EditedImages

EditedBitmap [] STGenericTexture.EditedImages
getset

An array of EditedBitmap from the image editor to be saved back.

◆ Format

TEX_FORMAT STGenericTexture.Format = TEX_FORMAT.R8G8B8A8_UNORM
getset

The TEX_FORMAT Format of the image.

◆ GenericProperties

Properties STGenericTexture.GenericProperties
get

◆ Height

uint STGenericTexture.Height
getset

The height of the image in pixels.

◆ IsCubemap

bool STGenericTexture.IsCubemap
get

◆ IsEdited

bool STGenericTexture.IsEdited = false
getset

Is the texture edited or not. Used for the image editor for saving changes.

◆ IsSwizzled

bool STGenericTexture.IsSwizzled = true
getset

◆ MipCount

uint STGenericTexture.MipCount
getset

The total amount of mipmaps for the texture.

◆ SupportedFormats

TEX_FORMAT [] STGenericTexture.SupportedFormats
getabstract

The PALETTE_FORMAT Format of the image.

◆ Width

uint STGenericTexture.Width
getset

The width of the image in pixels.


The documentation for this class was generated from the following file: