public MainPage(Rect imageBounds) { _instance = this; // Get hardware capabilities and register changed event listener #if SDKVERSION_INSIDER _capabilities = CompositionCapabilities.GetForCurrentView(); _capabilities.Changed += HandleCapabilitiesChangedAsync; _areEffectsSupported = _capabilities.AreEffectsSupported(); _areEffectsFast = _capabilities.AreEffectsFast(); #else _areEffectsSupported = true; _areEffectsFast = true; #endif _runtimeCapabilities = new RuntimeSupportedSDKs(); this.InitializeComponent(); // Initialize the image loader ImageLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor); // Show the custome splash screen ShowCustomSplashScreen(imageBounds); SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested; }
/// <summary> /// Initializes the Composition Brush. /// </summary> protected override void OnConnected() { base.OnConnected(); // Delay creating composition resources until they're required. if (CompositionBrush == null) { // Abort if effects aren't supported. if (!CompositionCapabilities.GetForCurrentView().AreEffectsSupported()) { return; } var size = new Vector2(SurfaceWidth, SurfaceHeight); var device = CanvasDevice.GetSharedDevice(); var graphics = CanvasComposition.CreateCompositionGraphicsDevice(Window.Current.Compositor, device); var surface = graphics.CreateDrawingSurface(size.ToSize(), DirectXPixelFormat.B8G8R8A8UIntNormalized, DirectXAlphaMode.Premultiplied); using (var session = CanvasComposition.CreateDrawingSession(surface)) { // Call Implementor to draw on session. if (!OnDraw(device, session, size)) { return; } } _surfaceBrush = Window.Current.Compositor.CreateSurfaceBrush(surface); _surfaceBrush.Stretch = CompositionStretch.Fill; CompositionBrush = _surfaceBrush; } }
/// <summary> /// Initializes the Composition Brush. /// </summary> protected override void OnConnected() { // Delay creating composition resources until they're required. if (CompositionBrush == null) { // Abort if effects aren't supported. if (!CompositionCapabilities.GetForCurrentView().AreEffectsSupported()) { return; } var backdrop = Window.Current.Compositor.CreateBackdropBrush(); // Use a Win2D blur affect applied to a CompositionBackdropBrush. var graphicsEffect = new GaussianBlurEffect { Name = "Blur", BlurAmount = (float)Amount, Source = new CompositionEffectSourceParameter("backdrop") }; var effectFactory = Window.Current.Compositor.CreateEffectFactory(graphicsEffect, new[] { "Blur.BlurAmount" }); var effectBrush = effectFactory.CreateBrush(); effectBrush.SetSourceParameter("backdrop", backdrop); CompositionBrush = effectBrush; } }
protected override void OnConnected() { // return if Uri String is null or empty if (String.IsNullOrEmpty(ImageUriString)) { return; } Compositor compositor = Window.Current.Compositor; // Use LoadedImageSurface API to get ICompositionSurface from image uri provided _surface = LoadedImageSurface.StartLoadFromUri(new Uri(ImageUriString)); // Load Surface onto SurfaceBrush _surfaceBrush = compositor.CreateSurfaceBrush(_surface); _surfaceBrush.Stretch = CompositionStretch.UniformToFill; // CompositionCapabilities: Are Tint+Temperature and Saturation supported? bool usingFallback = !CompositionCapabilities.GetForCurrentView().AreEffectsSupported(); if (usingFallback) { // If Effects are not supported, Fallback to image without effects CompositionBrush = _surfaceBrush; return; } // Define Effect graph IGraphicsEffect graphicsEffect = new SaturationEffect { Name = "Saturation", Saturation = 0.3f, Source = new TemperatureAndTintEffect { Name = "TempAndTint", Temperature = 0, Source = new CompositionEffectSourceParameter("Surface"), } }; // Create EffectFactory and EffectBrush CompositionEffectFactory effectFactory = compositor.CreateEffectFactory(graphicsEffect, new[] { "TempAndTint.Temperature" }); CompositionEffectBrush effectBrush = effectFactory.CreateBrush(); effectBrush.SetSourceParameter("Surface", _surfaceBrush); // Set EffectBrush to paint Xaml UIElement CompositionBrush = effectBrush; // Trivial looping animation to demonstrate animated effect ScalarKeyFrameAnimation tempAnim = compositor.CreateScalarKeyFrameAnimation(); tempAnim.InsertKeyFrame(0, 0); tempAnim.InsertKeyFrame(0.5f, 1f); tempAnim.InsertKeyFrame(1, 0); tempAnim.Duration = TimeSpan.FromSeconds(5); tempAnim.IterationBehavior = Windows.UI.Composition.AnimationIterationBehavior.Forever; effectBrush.Properties.StartAnimation("TempAndTint.Temperature", tempAnim); }
private void CompositionCapabilities_Changed(CompositionCapabilities sender, object args) { DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Normal, () => { _fastEffects = CompositionCapabilities.GetForCurrentView().AreEffectsFast(); UpdateBrush(); }); }
/// <summary> /// Initializes the Composition Brush. /// </summary> protected override void OnConnected() { // Delay creating composition resources until they're required. if (CompositionBrush == null) { // Abort if effects aren't supported. if (!CompositionCapabilities.GetForCurrentView().AreEffectsSupported()) { return; } var backdrop = Window.Current.Compositor.CreateBackdropBrush(); // Use a Win2D blur affect applied to a CompositionBackdropBrush. var graphicsEffect = new GammaTransferEffect { Name = "GammaTransfer", AlphaAmplitude = (float)AlphaAmplitude, AlphaDisable = AlphaDisable, AlphaExponent = (float)AlphaExponent, AlphaOffset = (float)AlphaOffset, RedAmplitude = (float)RedAmplitude, RedDisable = RedDisable, RedExponent = (float)RedExponent, RedOffset = (float)RedOffset, GreenAmplitude = (float)GreenAmplitude, GreenDisable = GreenDisable, GreenExponent = (float)GreenExponent, GreenOffset = (float)GreenOffset, BlueAmplitude = (float)BlueAmplitude, BlueDisable = BlueDisable, BlueExponent = (float)BlueExponent, BlueOffset = (float)BlueOffset, Source = new CompositionEffectSourceParameter("backdrop") }; var effectFactory = Window.Current.Compositor.CreateEffectFactory(graphicsEffect, new[] { "GammaTransfer.AlphaAmplitude", "GammaTransfer.AlphaExponent", "GammaTransfer.AlphaOffset", "GammaTransfer.RedAmplitude", "GammaTransfer.RedExponent", "GammaTransfer.RedOffset", "GammaTransfer.GreenAmplitude", "GammaTransfer.GreenExponent", "GammaTransfer.GreenOffset", "GammaTransfer.BlueAmplitude", "GammaTransfer.BlueExponent", "GammaTransfer.BlueOffset", }); var effectBrush = effectFactory.CreateBrush(); effectBrush.SetSourceParameter("backdrop", backdrop); CompositionBrush = effectBrush; } }
public CompCapabilities() { this.InitializeComponent(); _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor; // Get hardware capabilities and register changed event listener _capabilities = CompositionCapabilities.GetForCurrentView(); }
protected override void OnConnected() { Compositor compositor = Window.Current.Compositor; // CompositionCapabilities: Are Effects supported? bool usingFallback = !CompositionCapabilities.GetForCurrentView().AreEffectsSupported(); if (usingFallback) { // If Effects are not supported, use Fallback Solid Color CompositionBrush = compositor.CreateColorBrush(FallbackColor); return; } // Define Effect graph var graphicsEffect = new BlendEffect { Mode = BlendEffectMode.LinearBurn, Background = new ColorSourceEffect() { Name = "Tint", Color = Windows.UI.Colors.Silver, }, Foreground = new GaussianBlurEffect() { Name = "Blur", Source = new CompositionEffectSourceParameter("Backdrop"), BlurAmount = 0, BorderMode = EffectBorderMode.Hard, } }; // Create EffectFactory and EffectBrush CompositionEffectFactory effectFactory = compositor.CreateEffectFactory(graphicsEffect, new[] { "Blur.BlurAmount" }); CompositionEffectBrush effectBrush = effectFactory.CreateBrush(); // Create BackdropBrush CompositionBackdropBrush backdrop = compositor.CreateBackdropBrush(); effectBrush.SetSourceParameter("backdrop", backdrop); // Trivial looping animation to demonstrate animated effects TimeSpan _duration = TimeSpan.FromSeconds(5); ScalarKeyFrameAnimation blurAnimation = compositor.CreateScalarKeyFrameAnimation(); blurAnimation.InsertKeyFrame(0, 0); blurAnimation.InsertKeyFrame(0.5f, 10f); blurAnimation.InsertKeyFrame(1, 0); blurAnimation.IterationBehavior = AnimationIterationBehavior.Forever; blurAnimation.Duration = _duration; effectBrush.Properties.StartAnimation("Blur.BlurAmount", blurAnimation); // Set EffectBrush to paint Xaml UIElement CompositionBrush = effectBrush; }
public MainPage(Rect imageBounds) { _instance = this; _runtimeCapabilities = new RuntimeSupportedSDKs(); _currentFrame = null; // Get hardware capabilities and register changed event listener only when targeting the // appropriate SDK version and the runtime supports this version if (_runtimeCapabilities.IsSdkVersionRuntimeSupported(RuntimeSupportedSDKs.SDKVERSION._15063)) { #if SDKVERSION_15063 _capabilities = CompositionCapabilities.GetForCurrentView(); _capabilities.Changed += HandleCapabilitiesChangedAsync; _areEffectsSupported = _capabilities.AreEffectsSupported(); _areEffectsFast = _capabilities.AreEffectsFast(); #endif } else { _areEffectsSupported = true; _areEffectsFast = true; } this.InitializeComponent(); _mainNavigation = new MainNavigationViewModel(); // Initialize the image loader ImageLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor); // Show the custome splash screen ShowCustomSplashScreen(imageBounds); CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false; #if SDKVERSION_16299 // Apply acrylic styling to the navigation and caption if (_runtimeCapabilities.IsSdkVersionRuntimeSupported(RuntimeSupportedSDKs.SDKVERSION._16299)) { // Extend the app into the titlebar so that we can apply acrylic CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar; titleBar.ButtonBackgroundColor = Colors.Transparent; titleBar.ButtonInactiveBackgroundColor = Colors.Transparent; titleBar.ButtonForegroundColor = Colors.Black; // Apply a customized control template to the pivot MainPivot.Template = (ControlTemplate)Application.Current.Resources["PivotControlTemplate"]; // Apply acrylic to the main navigation TitleBarRow.Height = new GridLength(31); TitleBarGrid.Background = (Brush)Application.Current.Resources["SystemControlChromeMediumLowAcrylicWindowMediumBrush"]; } #endif }
protected override void OnConnected() { Compositor compositor = Window.Current.Compositor; // CompositionCapabilities: Are Effects supported? bool usingFallback = !CompositionCapabilities.GetForCurrentView().AreEffectsSupported(); FallbackColor = Color.FromArgb(100, 100, 100, 100); if (usingFallback) { // If Effects are not supported, use Fallback Solid Color CompositionBrush = compositor.CreateColorBrush(FallbackColor); return; } // Define Effect graph var graphicsEffect = new BlendEffect { Mode = BlendEffectMode.SoftLight, Background = new ColorSourceEffect() { Name = "Tint", //Color = Color.FromArgb(180, 255, 255, 255), Color = Color.FromArgb(150, 255, 255, 255), }, Foreground = new GaussianBlurEffect() { Name = "Blur", Source = new CompositionEffectSourceParameter("Backdrop"), BlurAmount = 20, BorderMode = EffectBorderMode.Hard, } }; // Create EffectFactory and EffectBrush CompositionEffectFactory effectFactory = compositor.CreateEffectFactory(graphicsEffect); CompositionEffectBrush effectBrush = effectFactory.CreateBrush(); // Create BackdropBrush CompositionBackdropBrush backdrop = compositor.CreateBackdropBrush(); effectBrush.SetSourceParameter("Backdrop", backdrop); // Set EffectBrush as the brush that XamlCompBrushBase paints onto Xaml UIElement CompositionBrush = effectBrush; }
override protected void OnConnected() { Compositor compositor = Window.Current.Compositor; // CompositionCapabilities: Are HostBackdrop Effects supported? bool usingFallback = !CompositionCapabilities.GetForCurrentView().AreEffectsFast(); if (usingFallback) { // If Effects are not supported, use Fallback Solid Color CompositionBrush = compositor.CreateColorBrush(FallbackColor); return; } // Define Effect graph var graphicsEffect = new BlendEffect { Mode = BlendEffectMode.Overlay, Background = new CompositionEffectSourceParameter("Backdrop"), Foreground = new ColorSourceEffect() { Name = "OverlayColor", Color = OverlayColor, }, }; // Create EffectFactory and EffectBrush CompositionEffectFactory effectFactory = compositor.CreateEffectFactory(graphicsEffect, new[] { "OverlayColor.Color" }); CompositionEffectBrush effectBrush = effectFactory.CreateBrush(); // Create HostBackdropBrush, a kind of BackdropBrush that provides blurred backdrop content CompositionBackdropBrush hostBrush = compositor.CreateHostBackdropBrush(); effectBrush.SetSourceParameter("Backdrop", hostBrush); // Set EffectBrush as the brush that XamlCompBrushBase paints onto Xaml UIElement CompositionBrush = effectBrush; // When the Window loses focus, animate HostBackdrop to FallbackColor Window.Current.CoreWindow.Activated += CoreWindow_Activated; // Configure color animation to for state change _stateChangeAnimation = compositor.CreateColorKeyFrameAnimation(); _stateChangeAnimation.InsertKeyFrame(0, OverlayColor); _stateChangeAnimation.InsertKeyFrame(1, FallbackColor); _stateChangeAnimation.Duration = TimeSpan.FromSeconds(1); }
protected override void OnConnected() { bool usingFallback; if (BackgroundSource == CustomAcrylicBackgroundSource.Hostbackdrop) { usingFallback = !CompositionCapabilities.GetForCurrentView().AreEffectsSupported(); } else { usingFallback = !CompositionCapabilities.GetForCurrentView().AreEffectsFast(); } ConnectAcrylicBrush(usingFallback); CoreWindow.GetForCurrentThread().Activated += UCAcrylicBrush_Activated; CoreWindow.GetForCurrentThread().VisibilityChanged += UCAcrylicBrush_VisibilityChanged; }
public CompCapabilities() { this.InitializeComponent(); _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor; // Get hardware capabilities and register changed event listener _liveCapabilities = CompositionCapabilities.GetForCurrentView(); var fastEffectsCapabilitySimulatedOption = new CapabilityWrapper("EffectsFast", true, true); capabilityDropdownOptions.Add(fastEffectsCapabilitySimulatedOption); capabilityDropdownOptions.Add(new CapabilityWrapper("EffectsSupported", true, false)); capabilityDropdownOptions.Add(new CapabilityWrapper("None", false, false)); SimulatorDropdown.SelectedItem = fastEffectsCapabilitySimulatedOption; _activeCapabilityWrapper = fastEffectsCapabilitySimulatedOption; }
protected override void OnConnected() { base.OnConnected(); if (DesignMode.DesignModeEnabled) { return; } if (_settings == null) { _settings = new UISettings(); } if (_accessibilitySettings == null) { _accessibilitySettings = new AccessibilitySettings(); } if (_fastEffects == null) { _fastEffects = CompositionCapabilities.GetForCurrentView().AreEffectsFast(); } if (_energySaver == null) { _energySaver = PowerManager.EnergySaverStatus == EnergySaverStatus.On; } UpdateBrush(); // Trigger event on color changes (themes). Is also triggered for advanced effects changes. _settings.ColorValuesChanged -= ColorValuesChanged; _settings.ColorValuesChanged += ColorValuesChanged; _accessibilitySettings.HighContrastChanged -= AccessibilitySettings_HighContrastChanged; _accessibilitySettings.HighContrastChanged += AccessibilitySettings_HighContrastChanged; PowerManager.EnergySaverStatusChanged -= PowerManager_EnergySaverStatusChanged; PowerManager.EnergySaverStatusChanged += PowerManager_EnergySaverStatusChanged; CompositionCapabilities.GetForCurrentView().Changed -= CompositionCapabilities_Changed; CompositionCapabilities.GetForCurrentView().Changed += CompositionCapabilities_Changed; }
public static void SetThemeShadow(UIElement target, float depth, params UIElement[] recievers) { try { if (!Supports1903 || !CompositionCapabilities.GetForCurrentView().AreEffectsFast()) { return; } target.Translation = new Vector3(0, 0, depth); var shadow = new ThemeShadow(); target.Shadow = shadow; foreach (var r in recievers) { shadow.Receivers.Add(r); } } catch { } }
/// <summary> /// Initializes the Composition Brush. /// </summary> protected override void OnConnected() { // Delay creating composition resources until they're required. if (CompositionBrush == null && Source != null && Source is BitmapImage bitmap) { // Use LoadedImageSurface API to get ICompositionSurface from image uri provided // If UriSource is invalid, StartLoadFromUri will return a blank texture. _surface = LoadedImageSurface.StartLoadFromUri(bitmap.UriSource); // Load Surface onto SurfaceBrush _surfaceBrush = Window.Current.Compositor.CreateSurfaceBrush(_surface); _surfaceBrush.Stretch = CompositionStretchFromStretch(Stretch); // Abort if effects aren't supported. if (!CompositionCapabilities.GetForCurrentView().AreEffectsSupported()) { // Just use image straight-up, if we don't support effects. CompositionBrush = _surfaceBrush; return; } var backdrop = Window.Current.Compositor.CreateBackdropBrush(); // Use a Win2D invert affect applied to a CompositionBackdropBrush. var graphicsEffect = new BlendEffect { Name = "Invert", Mode = (BlendEffectMode)(int)Mode, Background = new CompositionEffectSourceParameter("backdrop"), Foreground = new CompositionEffectSourceParameter("image") }; var effectFactory = Window.Current.Compositor.CreateEffectFactory(graphicsEffect); var effectBrush = effectFactory.CreateBrush(); effectBrush.SetSourceParameter("backdrop", backdrop); effectBrush.SetSourceParameter("image", _surfaceBrush); CompositionBrush = effectBrush; } }
public SolidGaussianBrush() { try { PowerManager.EnergySaverStatusChanged += PowerManager_EnergySaverStatusChanged; m_energySaverStatusChangedRevokerValid = true; } catch { } m_compositionCapabilities = CompositionCapabilities.GetForCurrentView(); m_compositionCapabilities.Changed += CompositionCapabilities_Changed; m_uiSettings = new UISettings(); m_uiSettings.AdvancedEffectsEnabledChanged += UISettings_AdvancedEffectsEnabledChanged; m_dispatcher = DispatcherQueue.GetForCurrentThread(); UpdatePolicy(); }
private BuildInfo() { if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5)) { Build = Build.FallCreators; } else if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4)) { Build = Build.Creators; } else if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3)) { Build = Build.Anniversary; } else if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 2)) { Build = Build.Threshold2; } else if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 1)) { Build = Build.Threshold1; } else { Build = Build.Unknown; } if (!BeforeCreatorsUpdate) { var capabilities = CompositionCapabilities.GetForCurrentView(); capabilities.Changed += (s, e) => UpdateCapabilities(capabilities); UpdateCapabilities(capabilities); } void UpdateCapabilities(CompositionCapabilities capabilities) { AreEffectsSupported = capabilities.AreEffectsSupported(); AreEffectsFast = capabilities.AreEffectsFast(); } }
protected override void OnDisconnected() { base.OnDisconnected(); if (_window != null) { _window.Changed -= AppWindow_Changed; } if (_appWindowActivationListener != null) { _appWindowActivationListener.InputActivationChanged -= AppWindow_InputActivationChanged; _appWindowActivationListener.Dispose(); } if (_settings != null) { _settings.ColorValuesChanged -= ColorValuesChanged; _settings = null; } if (_accessibilitySettings != null) { _accessibilitySettings.HighContrastChanged -= AccessibilitySettings_HighContrastChanged; _accessibilitySettings = null; } PowerManager.EnergySaverStatusChanged -= PowerManager_EnergySaverStatusChanged; CompositionCapabilities.GetForCurrentView().Changed -= CompositionCapabilities_Changed; if (CompositionBrush != null) { CompositionBrush.Dispose(); CompositionBrush = null; } }
protected override void OnConnected() { Compositor compositor = Window.Current.Compositor; // CompositionCapabilities: Are Effects supported? bool usingFallback = !CompositionCapabilities.GetForCurrentView().AreEffectsSupported(); FallbackColor = Color.FromArgb(100, 60, 60, 60); if (usingFallback) { // If Effects are not supported, use Fallback Solid Color CompositionBrush = compositor.CreateColorBrush(FallbackColor); return; } // Load NormalMap onto an ICompositionSurface using LoadedImageSurface _surface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///Assets/Damaged_NormalMap.jpg"), new Size(400, 400)); // Load Surface onto SurfaceBrush CompositionSurfaceBrush normalMap = compositor.CreateSurfaceBrush(_surface); normalMap.Stretch = CompositionStretch.Uniform; // Define Effect graph const float glassLightAmount = 0.5f; const float glassBlurAmount = 0.95f; Color tintColor = Color.FromArgb(255, 128, 128, 128); var graphicsEffect = new ArithmeticCompositeEffect() { Name = "LightComposite", Source1Amount = 1, Source2Amount = glassLightAmount, MultiplyAmount = 0, Source1 = new ArithmeticCompositeEffect() { Name = "BlurComposite", Source1Amount = 1 - glassBlurAmount, Source2Amount = glassBlurAmount, MultiplyAmount = 0, Source1 = new ColorSourceEffect() { Name = "Tint", Color = tintColor, }, Source2 = new GaussianBlurEffect() { BlurAmount = 20, Source = new CompositionEffectSourceParameter("Backdrop"), Optimization = EffectOptimization.Balanced, BorderMode = EffectBorderMode.Hard, }, }, Source2 = new SceneLightingEffect() { AmbientAmount = 0.15f, DiffuseAmount = 1, SpecularAmount = 0.1f, NormalMapSource = new CompositionEffectSourceParameter("NormalMap") }, }; // Create EffectFactory and EffectBrush CompositionEffectFactory effectFactory = compositor.CreateEffectFactory(graphicsEffect); CompositionEffectBrush effectBrush = effectFactory.CreateBrush(); // Create BackdropBrush CompositionBackdropBrush backdrop = compositor.CreateBackdropBrush(); // Set Sources to Effect effectBrush.SetSourceParameter("NormalMap", normalMap); effectBrush.SetSourceParameter("Backdrop", backdrop); // Set EffectBrush as the brush that XamlCompBrushBase paints onto Xaml UIElement CompositionBrush = effectBrush; }
public LottieView() : this(CompositionCapabilities.GetForCurrentView().AreEffectsFast()) { }
public LottieView() : this(Services.SettingsService.Current.Diagnostics.FastAnimationsEnabled && CompositionCapabilities.GetForCurrentView().AreEffectsFast()) { }
protected override void OnConnected() { Compositor compositor = Window.Current.Compositor; // CompositionCapabilities: Are Effects supported? bool usingFallback = !CompositionCapabilities.GetForCurrentView().AreEffectsSupported(); FallbackColor = Color.FromArgb(100, 100, 100, 100); if (usingFallback) { // If Effects are not supported, use Fallback Solid Color CompositionBrush = compositor.CreateColorBrush(FallbackColor); return; } // Define Effect graph // COLOR SWAP Matrix5x4 mat = new Matrix5x4() { M11 = 0, M12 = 0f, M13 = 1f, M14 = 0, M21 = 0f, M22 = 1f, M23 = 0f, M24 = 0, M31 = 1f, M32 = 0f, M33 = 0f, M34 = 0, M41 = 0f, M42 = 0f, M43 = 0f, M44 = 1, M51 = 0, M52 = 0, M53 = 0, M54 = 0 }; //// COLOR MASK (DOESNT WORK ???) // Matrix5x4 mat = new Matrix5x4() // { // M11 = 1, M12 = 0f, M13 = 0f, M14 = 2, // M21 = 0f, M22 = 1f, M23 = 0f, M24 = -1, // M31 = 0f, M32 = 0f, M33 = 1f, M34 = -1, // M41 = 0f, M42 = 0f, M43 = 0f, M44 = 0, // M51 = 0, M52 = 0, M53 = 0, M54 = 0 // }; //// REDFILTER //Matrix5x4 mat = new Matrix5x4() // { // M11 = 1, M12 = 0f, M13 = 0f, M14 = 0, // M21 = 0f, M22 = 0f, M23 = 0f, M24 = 0, // M31 = 0f, M32 = 0f, M33 = 0f, M34 = 0, // M41 = 0f, M42 = 0f, M43 = 0f, M44 = 1, // M51 = 0, M52 = 0, M53 = 0, M54 = 0 // }; IGraphicsEffect graphicsEffect = new ColorMatrixEffect() { ColorMatrix = mat, Source = new CompositionEffectSourceParameter("ImageSource") }; //// COLORHIGHLIGHT //IGraphicsEffect graphicsEffect = new ArithmeticCompositeEffect() //{ // MultiplyAmount = 0, // Source1Amount = 1, // Source2Amount = 1, // Source1 = new GammaTransferEffect() // { // RedExponent = 7, // BlueExponent = 7, // GreenExponent = 7, // RedAmplitude = 3, // GreenAmplitude = 3, // BlueAmplitude = 3, // Source = new CompositionEffectSourceParameter("ImageSource") // }, // Source2 = new SaturationEffect() // { // Saturation = 0, // Source = new CompositionEffectSourceParameter("ImageSource") // } //}; // Create the effect factory and instantiate a brush CompositionEffectFactory _effectFactory = compositor.CreateEffectFactory(graphicsEffect, null); CompositionEffectBrush effectBrush = _effectFactory.CreateBrush(); // Create BackdropBrush CompositionBackdropBrush backdrop = compositor.CreateHostBackdropBrush(); effectBrush.SetSourceParameter("ImageSource", backdrop); // Set EffectBrush as the brush that XamlCompBrushBase paints onto Xaml UIElement CompositionBrush = effectBrush; }