public BITMAPINFOHEADER(Size size, ColorDepth colorDepth)
{
this.biSize = 0;
this.biWidth = size.Width;
this.biHeight = size.Height * 2;
this.biPlanes = 1;
this.biCompression = 0;
this.biSizeImage = 0;
this.biXPelsPerMeter = 0;
this.biYPelsPerMeter = 0;
this.biClrUsed = 0;
this.biClrImportant = 0;
switch (colorDepth)
{
case ColorDepth.Depth16Bit:
this.biBitCount = 0x10;
break;
case ColorDepth.Depth24Bit:
this.biBitCount = 0x18;
break;
case ColorDepth.Depth32Bit:
this.biBitCount = 0x20;
break;
case ColorDepth.Depth4Bit:
this.biBitCount = 4;
break;
case ColorDepth.Depth8Bit:
this.biBitCount = 8;
break;
default:
this.biBitCount = 4;
break;
}
this.biSize = Marshal.SizeOf(base.GetType());
}