public PixelDevice(int pixelCount, int startPosition, int endPosition, bool reverse, Action<byte[]> pixelsChangedAction)
{
this.reverse = reverse;
this.pixelsChangedAction = pixelsChangedAction;
StartPosition = startPosition;
this.outputBitmap = new Bitmap(endPosition - startPosition + 1, 1, PixelFormat.Format24bppRgb);
this.outputGraphics = Graphics.FromImage(this.outputBitmap);
this.outputRectangle = new Rectangle(0, 0, endPosition - startPosition + 1, 1);
int bytesPerPixel = Bitmap.GetPixelFormatSize(this.outputBitmap.PixelFormat) / 8;
this.pixels = new byte[this.outputRectangle.Width * bytesPerPixel];
}