Alexandria.Raster.Raster C# (CSharp) Method

Raster() public method

Initialize the Raster.
public Raster ( Vector2i size, IList palette, int colorBlend = null, byte sourceData = null ) : System
size Vector2i The dimensions of the raster image.
palette IList The palette to use for colours. This may be a regular palette or a colour blend palette.
colorBlend int If non-negative this is the number of colours in the base palette for a colour-blended palette.
sourceData byte
return System
        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();
            }
        }

Same methods

Raster::Raster ( int width, int height, IList palette, int colorBlendBaseCount = null, byte data = null ) : System