public ImageCapture BuildImageCapture(Box dimensions, byte[] data, bool highQuality) { ImageCapture returnValue = null; if (data != null && dimensions != null && data.Length == dimensions.Area * (_outputPixelFormat.BitsPerPixel / 8)) { BitmapSource output = BitmapSource.Create(dimensions.Width, dimensions.Height, 96, 96, _outputPixelFormat, null, data, dimensions.Width * _outputPixelFormat.BitsPerPixel / 8); output.Freeze(); returnValue = ImageCapture.Build(output, highQuality ? CaptureType.PRINT : CaptureType.PREVIEW); } return(returnValue); }
private TestImageProducer() { _timer = new DispatcherTimer(); _timer.Interval = new TimeSpan(0, 0, 0, 0, 5); _timer.Tick += (sender, e) => _queue.Enqueue(ImageCapture.Build(_images[_curIndex = (_curIndex + 1) % _images.Count], CaptureType.PREVIEW)); }