Table of Contents

Class KtxDetails

Namespace
Egami.Formats.Extended.Ktx
Assembly
Egami.Formats.Extended.dll

Details only KTX and KTX 2 have, kept in FormatDetails.

public sealed class KtxDetails : FormatDetails
Inheritance
KtxDetails
Inherited Members

Examples

// What the file says: the Vulkan format, supercompression, layout, mips, colour, orientation and key/value data.
using Raster texture = Raster.Load("texture.ktx2", context);
if (texture.Metadata.FormatDetails is KtxDetails ktx)
{
    Console.WriteLine($"{ktx.FormatName} (VkFormat {ktx.VkFormat}), {ktx.Supercompression}, {ktx.MipLevels} mips");
    Console.WriteLine($"{ktx.Dimension}, cube: {ktx.IsCube}, sRGB {ktx.IsSrgb}, alpha {ktx.AlphaMode}, orientation {ktx.Orientation}");
    foreach ((string key, string value) in ktx.KeyValues)
    {
        Console.WriteLine($"{key} = {value}");
    }
}

Properties

AlphaMode

Gets or sets how the alpha channel is meant to be read.

public KtxAlphaMode AlphaMode { get; set; }

Property Value

KtxAlphaMode

Depth

Gets or sets the depth of mip 0 of a volume texture, else 1.

public int Depth { get; set; }

Property Value

int

Dimension

Gets or sets the texture's dimension.

public KtxDimension Dimension { get; set; }

Property Value

KtxDimension

Faces

Gets or sets the number of faces in each layer: 6 for a cube map, else 1.

public int Faces { get; set; }

Property Value

int

FormatName

Gets or sets the format's name: its Vulkan name without VK_FORMAT_, such as BC7_SRGB_BLOCK.

public string FormatName { get; set; }

Property Value

string

GlInternalFormat

Gets or sets a KTX 1 file's OpenGL internal format (0x8058 is RGBA8), or 0 for a KTX 2 file.

public int GlInternalFormat { get; set; }

Property Value

int

IsCube

Gets or sets whether the texture is a cube map: 6 faces in each layer.

public bool IsCube { get; set; }

Property Value

bool

IsSrgb

Gets or sets whether the values are sRGB-encoded: an _SRGB format, or a KTX 2 descriptor with the sRGB transfer.

public bool IsSrgb { get; set; }

Property Value

bool

KeyValues

Gets or sets the file's other key/value pairs, such as KTXwriter, their values as UTF-8 text without the closing NUL. Values that are not text are left out; KTXorientation and KTXswizzle are in their own properties.

public IReadOnlyDictionary<string, string> KeyValues { get; set; }

Property Value

IReadOnlyDictionary<string, string>

Layers

Gets or sets the number of array layers, at least 1.

public int Layers { get; set; }

Property Value

int

MipLevel

Gets or sets the mip level this raster is; 0 is full size.

public int MipLevel { get; set; }

Property Value

int

MipLevels

Gets or sets the number of mip levels the file stores, at least 1.

public int MipLevels { get; set; }

Property Value

int

Orientation

Gets or sets the stored orientation in KTX 2's form: r or l for the direction of x, d or u for y, and for a volume i or o for z, such as rd (rows top-down, the default) or ru (bottom-up). A load turns the texture to rd unless KeepStoredLayout is set.

public string Orientation { get; set; }

Property Value

string

Supercompression

Gets or sets how the mip levels are compressed on top of the format.

public KtxSupercompression Supercompression { get; set; }

Property Value

KtxSupercompression

Surface

Gets or sets the surface this raster is: layer-major, then face (+X, −X, +Y, −Y, +Z, −Z), then depth slice.

public int Surface { get; set; }

Property Value

int

Swizzle

Gets or sets the file's channel swizzle, four of r, g, b, a, 0 and 1, such as rrr1 for luminance stored in red. rgba (the default) changes nothing. A load applies it unless KeepStoredLayout is set.

public string Swizzle { get; set; }

Property Value

string

VkFormat

Gets or sets the Vulkan format number, as KTX 2 stores it (37 is R8G8B8A8_UNORM, 145 BC7_UNORM_BLOCK). For a KTX 1 file, the Vulkan format its OpenGL format matches, or 0 for none.

public int VkFormat { get; set; }

Property Value

int

Methods

Copy()

Returns a deep copy.

public override FormatDetails Copy()

Returns

FormatDetails

The copy.