public Raster(Vector2i size, IList<Color> palette, int? colorBlend = null, byte[] sourceData = null)
{
this.size = size;
Palette = palette;
Image = new Bitmap(size.X, size.Y, PixelFormat.Format32bppArgb);
Image4x = new Bitmap(size.X * 4, size.Y * 4, PixelFormat.Format32bppArgb);
Graphics4x = Graphics.FromImage(Image4x);
ColorBlendBaseCount = colorBlend.GetValueOrDefault(16);
ditherBlend = colorBlend.HasValue;
ArgbRow = new byte[size.X * 4];
data = new int[size.X * size.Y];
Stride = size.X;
if (sourceData != null) {
Lock();
sourceData.CopyTo(data, 0);
DirtyAll();
Unlock();
}
}