Example #1
0
        public DirectBitmap(int width, int height, PixelFormat format)
        {
            Width  = width;
            Height = height;

            _bitmap = new Bitmap(width, height, format);
            if (format == PixelFormat.Format8bppIndexed)
            {
                // There is no regular 8bpp grayscale in .NET, only 16 bit or 8 bit indexed.
                // So we're creating an 8bpp indexed and making the palette 0 -> 255 grayscale
                _bitmap.Palette = ColorExtensions.GetGrayscaleColorPalette(_bitmap);
            }

            IsLocked = false;
        }