Enum AlphaKind
How a pixel type stores alpha.
public enum AlphaKind
Fields
None = 0The type has no alpha channel. Every pixel is opaque.
Premultiplied = 2Premultiplied alpha: each color channel is stored already multiplied by alpha. The conversions of IPixelType<TSelf> still take and return straight values, so only code that reads the memory directly sees it.
Straight = 1Straight (not premultiplied) alpha.
Examples
// What a pixel type stores, for code that handles any TPixel.
PixelLayoutInfo layout = Rgba16.Layout;
Console.WriteLine($"{layout.ChannelOrder} {layout.ChannelType}: {layout.ChannelCount} channels, {layout.BitsPerChannel} bits each, {layout.BytesPerPixel} bytes");
bool needsAlpha = layout.Alpha != AlphaKind.None;
bool eightBit = layout.ChannelType == PixelChannelType.Unorm8;
bool bgrOrder = Bgr8.Layout.ChannelOrder is PixelChannelOrder.Bgr or PixelChannelOrder.Bgra;