private void InitializeUI() { HistogramControl.Init(Histogram.ColorType.White, 800); HistogramCreator = null; HistogramCreator = new HistogramCreator(HistogramCreator.HistogramResolution.Resolution_256); HistogramCreator.OnHistogramCreated += async(r, g, b) => { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { HistogramControl.SetHistogramValue(r, g, b); }); }; }
public static async Task SetAsBitmap(byte[] data, ImageDataSource target, HistogramCreator Histogram, CoreDispatcher Dispatcher = null) { using (var stream = new InMemoryRandomAccessStream()) { await stream.WriteAsync(data.AsBuffer()); stream.Seek(0); if (Dispatcher == null) { Dispatcher = SystemUtil.GetCurrentDispatcher(); } if (Dispatcher == null) { return; } await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { var image = new BitmapImage(); image.SetSource(stream); target.Image = image; }); if (Histogram == null) { return; } if (ApplicationSettings.GetInstance().IsHistogramDisplayed&& !Histogram.IsRunning) { await Dispatcher.RunAsync(CoreDispatcherPriority.Low, () => { Histogram.IsRunning = true; stream.Seek(0); var image = new BitmapImage(); image.SetSource(stream); var writableImage = new WriteableBitmap(image.PixelWidth, image.PixelHeight); stream.Seek(0); writableImage.SetSource(stream); Histogram.CreateHistogram(writableImage); }); } else if (Histogram.IsRunning) { DebugUtil.Log("Histogram creating. skip."); } } }
private void InitializeUI() { HistogramControl.Init(Histogram.ColorType.White, 800); HistogramCreator = new HistogramCreator(HistogramCreator.HistogramResolution.Resolution_128); HistogramCreator.PixelSkipRate = 10; HistogramCreator.OnHistogramCreated += async(r, g, b) => { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { HistogramControl.SetHistogramValue(r, g, b); }); }; _CommandBarManager.Clear() .DeviceDependent(AppBarItem.Zoom) .DeviceDependent(AppBarItem.FNumberSlider) .DeviceDependent(AppBarItem.ShutterSpeedSlider) .DeviceDependent(AppBarItem.EvSlider) .DeviceDependent(AppBarItem.IsoSlider) .DeviceDependent(AppBarItem.ProgramShiftSlider); }
public LiveviewContext(TargetDevice target, HistogramCreator histogram = null) { Target = target; HistogramCreator = histogram; }