System.Drawing.Imaging.PixelFormat.Alpha究竟代表什么?看起来这类似于已折旧的 OpenGL.GL_APHA。
我正在尝试转换如下所示的一行 Java 代码:
TextureData textureData = new TextureData(GL.GL_ALPHA, size, size, 0, GL.GL_ALPHA,
GL.GL_UNSIGNED_BYTE, false, false, false, textureBytes.rewind(), null);
到它的 C# 表示。
我已经定义了一个类来封装像素格式,以允许我在 DirectX 和 OpenGL 之间来回切换,如下所示:
public class PixelFormat
{
public static readonly PixelFormat R8 = new PixelFormat(8, 0, DataType.UnsignedByte);
public static readonly PixelFormat R5G5B5A1 = new PixelFormat(5, 1, DataType.UnsignedShort);
public bool IsColorPremultipliedByAlpha { get; private set; }
public bool IsCompressed { get; private set; }
public int Format { get; set; }
public double Gamma { get; private set; }
public int BitsPerPixel { get { return NumberOfRedBits + NumberOfGreenBits + NumberOfBlueBits; }}
public ushort NumberOfRedBits { get; private set; }
public ushort NumberOfGreenBits { get; private set; }
public ushort NumberOfBlueBits { get; private set; }
public ushort NumberOfAlphaBits { get; private set; }
public int IndexIntoColorPallete { get; set; }
public bool IsIndexed { get; set; }
public DataType DataType { get; set; }
public IndexedColorFormat IndexedColorFormat { get; set; }
public OpenglPixelAttributes GetOpenglConstant()
{
return null;
}
}
我想使用我的 PixelFormat 类的实例来表示 System.Drawing.Imaging.PixelFormat.Alpha 或其 OpenGL 表亲。
任何人的想法?