public PixelDevice(int pixelWidth, int pixelHeight, Dictionary<int, Utility.PixelMap[]> pixelMapping, Action<byte[]> pixelsChangedAction)
{
this.pixelsChangedAction = pixelsChangedAction;
this.outputBitmap = new Bitmap(pixelWidth, pixelHeight, PixelFormat.Format24bppRgb);
this.outputGraphics = Graphics.FromImage(this.outputBitmap);
this.outputRectangle = new Rectangle(0, 0, pixelWidth, pixelHeight);
int bytesPerPixel = System.Drawing.Bitmap.GetPixelFormatSize(this.outputBitmap.PixelFormat) / 8;
this.stride = 4 * ((this.outputBitmap.Width * bytesPerPixel + 3) / 4);
int byteCount = stride * this.outputBitmap.Height;
this.pixels = new byte[bytesPerPixel * this.outputBitmap.Width * this.outputBitmap.Height];
this.pixelMapping = new int[byteCount];
UpdatePixelMapping(pixelMapping);
}