async Task <Uri> ColorBoost(int EffectPercentage) { using (var source = new StorageFileImageSource(imageStorageFile)) using (var contrastEffect = new ContrastEffect(source) { Level = 0.6 }) using (var sharpnessEffect = new ColorBoostEffect(contrastEffect) { Gain = (EffectPercentage / 50) }) { LastEffect = sharpnessEffect; return(await SaveToImage()); } }
private async void ColorBoostThumb_Tapped(object sender, TappedRoutedEventArgs e) { FilteredImage.Width = PreviewImage.ActualWidth; FilteredImage.Height = PreviewImage.ActualHeight; PreviewImage.Visibility = Visibility.Collapsed; FilteredImage.Visibility = Visibility.Visible; using (_colorboostEffect = new ColorBoostEffect()) { _colorboostEffect.Gain = 0.75; await ApplyEffectAsync(fPhotoStream, _colorboostEffect, FilteredImage); } }
private async void OnTap(object sender, TappedRoutedEventArgs e) { ImageEncodingProperties imageProperties = ImageEncodingProperties.CreateJpeg(); mediaCapture.CapturePhotoToStreamAsync(imageProperties, fPhotoStream).AsTask().Wait(); fPhotoStream.FlushAsync().AsTask().Wait(); fPhotoStream.Seek(0); WriteableBitmap bitter = new WriteableBitmap(100, 100); bitter.SetSource(fPhotoStream); await mediaCapture.StopPreviewAsync(); captureElement.Visibility = Visibility.Collapsed; PreviewImage.Visibility = Visibility.Visible; PreviewImage.Source = bitter; NormalThumb.Source = bitter; using (_grayscaleEffect = new GrayscaleEffect()) await ApplyEffectAsync(fPhotoStream, _grayscaleEffect, GreyScaleThumb); using (_colorboostEffect = new ColorBoostEffect()) { _colorboostEffect.Gain = 0.75; await ApplyEffectAsync(fPhotoStream, _colorboostEffect, ColorBoostThumb); } using (_hueSaturationEffect = new HueSaturationEffect()) await ApplyEffectAsync(fPhotoStream, _hueSaturationEffect, HueSaturationThumb); using (_lensblurEffect = new LensBlurEffect()) await ApplyEffectAsync(fPhotoStream, _lensblurEffect, LensBlurThumb); using (_antiqueEffect = new AntiqueEffect()) await ApplyEffectAsync(fPhotoStream, _antiqueEffect, SepiaThumb); inking_initialization(); myInkCanvas.Visibility = Visibility.Visible; }