public VirtualPixel2D3(int pixelWidth, int pixelHeight, [System.Runtime.CompilerServices.CallerMemberName] string name = "")
: base(name)
{
if (pixelWidth <= 0 || pixelHeight <= 0)
throw new ArgumentOutOfRangeException("pixelWidth/pixelHeight");
this.pixelWidth = pixelWidth;
this.pixelHeight = pixelHeight;
this.devices = new List<PixelDevice>();
this.outputData.Subscribe(x =>
{
Output();
});
Executor.Current.Blackout.Subscribe(_ => Output());
Executor.Current.Whiteout.Subscribe(_ => Output());
this.imageChanged = new Subject<Bitmap>();
this.outputBitmap = GetBitmap();
this.output = Graphics.FromImage(this.outputBitmap);
this.outputRectangle = new Rectangle(0, 0, this.outputBitmap.Width, this.outputBitmap.Height);
int bytesPerPixel = System.Drawing.Bitmap.GetPixelFormatSize(this.outputBitmap.PixelFormat) / 8;
int stride = 4 * ((this.outputBitmap.Width * bytesPerPixel + 3) / 4);
int byteCount = stride * this.outputBitmap.Height;
this.tempPixels = new byte[byteCount];
this.brightnessMatrix = new ColorMatrix(new float[][]{
new float[] {1, 0, 0, 0, 0},
new float[] {0, 1, 0, 0, 0},
new float[] {0, 0, 1, 0, 0},
new float[] {0, 0, 0, 1, 0},
new float[] {0.5f, 0.5f, 0.5f, 1, 1}
});
}