private void processPixelFormat(PixelFormat pixelFormat)
{
//See GdiPlusPixelFormats.h for details
if (pixelFormat == PixelFormat.Format16bppGrayScale)
{
m_bitsPerComponent = 16;
m_componentsPerSample = 1;
m_colorspace = Colorspace.Grayscale;
return;
}
byte formatIndexByte = (byte)((int)pixelFormat & 0x000000FF);
byte pixelSizeByte = (byte)((int)pixelFormat & 0x0000FF00);
if (pixelSizeByte == 32 && formatIndexByte == 15) //PixelFormat32bppCMYK (15 | (32 << 8))
{
m_bitsPerComponent = 8;
m_componentsPerSample = 4;
m_colorspace = Colorspace.CMYK;
return;
}
m_bitsPerComponent = 8;
m_componentsPerSample = 3;
m_colorspace = Colorspace.RGB;
if (pixelSizeByte == 16)
m_bitsPerComponent = 6;
else if (pixelSizeByte == 24 || pixelSizeByte == 32)
m_bitsPerComponent = 8;
else if (pixelSizeByte == 48 || pixelSizeByte == 64)
m_bitsPerComponent = 16;
}