Table of Contents

Enum DdsAlphaMode

Namespace
Egami.Formats.Extended.Dds
Assembly
Egami.Formats.Extended.dll

How a DDS file's alpha channel is meant to be read, from its DX10 header.

public enum DdsAlphaMode

Fields

Custom = 4

The fourth channel is not alpha but data of the application's own.

Opaque = 3

Alpha is fully opaque.

Premultiplied = 2

Colours premultiplied by alpha (also DXT2 and DXT4). Egami un-premultiplies them on load.

Straight = 1

Straight alpha.

Unknown = 0

Not stated; Egami reads alpha as straight.

Examples

// What the header says: the DXGI format, the mip count, the dimension, cube and array layout and the alpha mode.
using Raster texture = Raster.Load("rock.dds", context);
if (texture.Metadata.FormatDetails is DdsDetails dds)
{
    Console.WriteLine($"{dds.FormatName} (DXGI {dds.DxgiFormat}), {dds.MipLevels} mips, {dds.Dimension}, cube: {dds.IsCube}");
    Console.WriteLine($"alpha {dds.AlphaMode}, sRGB {dds.IsSrgb}, DX10 header {dds.Dx10Header}");
}

// An _SRGB format is tagged sRGB; any other loads its values as stored.
bool srgb = texture.Metadata.ColorSpace == ColorSpaceHint.Srgb;