private async void SepiaThumb_Tapped(object sender, TappedRoutedEventArgs e) { FilteredImage.Width = PreviewImage.ActualWidth; FilteredImage.Height = PreviewImage.ActualHeight; PreviewImage.Visibility = Visibility.Collapsed; FilteredImage.Visibility = Visibility.Visible; using (_antiqueEffect = new AntiqueEffect()) await ApplyEffectAsync(fPhotoStream, _antiqueEffect, FilteredImage); }
private ObservableCollection<VideoEffectsViewModel> CreateNonEditableEffects() { var effects = new ObservableCollection<VideoEffectsViewModel>(); m_antiqueEffect = new AntiqueEffect(); effects.Add(new VideoEffectsViewModel(m_antiqueEffect, "antique_thumbnail.jpg") { Name = "Antique" }); m_sepiaEffect = new SepiaEffect(); effects.Add(new VideoEffectsViewModel(m_sepiaEffect, "sepia_thumbnail.jpg") { Name = "Sepia" }); m_blendEffect = new BlendEffect() { GlobalAlpha = 0.5 }; effects.Add(new VideoEffectsViewModel(m_blendEffect, "blend_brokenglass_thumbnail.jpg", "BrokenGlas.png") { Name = "Blend 1" }); var effect = new BlendEffect() { BlendFunction = BlendFunction.Overlay, GlobalAlpha = 0.5 }; effects.Add(new VideoEffectsViewModel(effect, "blend_raindrops_thumbnail.jpg", "raindrops.jpg") { Name = "Blend 2" }); m_mirrorEffect = new MirrorEffect(); effects.Add(new VideoEffectsViewModel(m_mirrorEffect, "mirror_thumbnail.jpg") { Name = "Mirror" }); m_grayscaleEffect = new GrayscaleEffect(); effects.Add(new VideoEffectsViewModel(m_grayscaleEffect, "grayscale_thumbnail.jpg") { Name = "Grayscale" }); m_binaryEffect = new BinaryEffect(); effects.Add(new VideoEffectsViewModel(m_binaryEffect, "grayscale_thumbnail.jpg") { Name = "Binary" }); m_medianFilter = new MedianFilter(); effects.Add(new VideoEffectsViewModel(m_medianFilter, "grayscale_thumbnail.jpg") { Name = "Median" }); return effects; }
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; }