-
Notifications
You must be signed in to change notification settings - Fork 705
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove automatic value change when specifying luminosity opacity on A…
…crylicBrush (#2017) * Add test page * Update test page to be better to use * Remove clamping of values with luminosity opacity set, update test page * Move code to else case * CR feedback
- Loading branch information
Showing
6 changed files
with
125 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
dev/Materials/Acrylic/TestUI/AcrylicBrushLuminosityTestPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<local:TestPage | ||
x:Class="MUXControlsTestApp.AcrylicBrushLuminosityTestPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:MUXControlsTestApp" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Media" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
||
<local:TestPage.Resources> | ||
<muxc:AcrylicBrush x:Key="AcrylicBlackNoLuminosityOpacity" BackgroundSource="Backdrop" | ||
TintOpacity="0.2" TintColor="#000000" FallbackColor="#FF008000" /> | ||
<muxc:AcrylicBrush x:Key="AcrylicDarkGreyNoLuminosityOpacity" BackgroundSource="Backdrop" | ||
TintOpacity="0.2" TintColor="#1F1F1F" FallbackColor="#FF008000" /> | ||
|
||
<muxc:AcrylicBrush x:Key="AcrylicBlackWithLuminosityOpacity" BackgroundSource="Backdrop" | ||
TintOpacity="0.2" TintColor="#000000" FallbackColor="#FF008000" /> | ||
<muxc:AcrylicBrush x:Key="AcrylicDarkGreyWithLuminosityOpacity" BackgroundSource="Backdrop" | ||
TintOpacity="0.2" TintColor="#1F1F1F" FallbackColor="#FF008000" /> | ||
</local:TestPage.Resources> | ||
|
||
<Grid MaxWidth="600" MaxHeight="600"> | ||
<Image x:Name="BackgroundPanel" Source="ms-appx:///Assets/SMPTE_WallpaperHD.png" | ||
Stretch="Fill"/> | ||
|
||
<StackPanel Orientation="Horizontal"> | ||
<StackPanel Margin="10,0,10,10"> | ||
<TextBlock Text="LuminosityOpacity not set | ||
(should look the same)" | ||
TextWrapping="WrapWholeWords" Foreground="Black" MaxWidth="170"/> | ||
|
||
<TextBlock Text="Black" Foreground="Black" Margin="0,5,0,0"/> | ||
<Rectangle x:Name="Rectangle1" Width="150" Height="150" | ||
Fill="{ThemeResource AcrylicBlackNoLuminosityOpacity}" HorizontalAlignment="Left" VerticalAlignment="Center"> | ||
</Rectangle> | ||
<Rectangle x:Name="Rectangle2" Width="150" Height="150" | ||
Fill="{ThemeResource AcrylicDarkGreyNoLuminosityOpacity}" HorizontalAlignment="Left" VerticalAlignment="Center"> | ||
</Rectangle> | ||
<TextBlock Text="Grey" Foreground="Black"/> | ||
</StackPanel> | ||
|
||
<StackPanel Margin="0,0,10,10"> | ||
<TextBlock Text="LuminosityOpacity set | ||
(should look different)" | ||
TextWrapping="WrapWholeWords" Foreground="Black" MaxWidth="150"/> | ||
|
||
<TextBlock Text="Black" Foreground="Black" Margin="0,5,0,0"/> | ||
<Rectangle x:Name="Rectangle3" Width="150" Height="150" | ||
Fill="{ThemeResource AcrylicBlackWithLuminosityOpacity}" HorizontalAlignment="Center" VerticalAlignment="Center"> | ||
</Rectangle> | ||
|
||
<Rectangle x:Name="Rectangle4" Width="150" Height="150" | ||
Fill="{ThemeResource AcrylicDarkGreyWithLuminosityOpacity}" HorizontalAlignment="Center" VerticalAlignment="Center"> | ||
</Rectangle> | ||
<TextBlock Text="Grey" Foreground="Black"/> | ||
</StackPanel> | ||
</StackPanel> | ||
|
||
</Grid> | ||
</local:TestPage> |
25 changes: 25 additions & 0 deletions
25
dev/Materials/Acrylic/TestUI/AcrylicBrushLuminosityTestPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Microsoft.UI.Xaml.Media; | ||
using Windows.Foundation.Metadata; | ||
|
||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 | ||
|
||
namespace MUXControlsTestApp | ||
{ | ||
/// <summary> | ||
/// An empty page that can be used on its own or navigated to within a Frame. | ||
/// </summary> | ||
public sealed partial class AcrylicBrushLuminosityTestPage : TestPage | ||
{ | ||
public AcrylicBrushLuminosityTestPage() | ||
{ | ||
this.InitializeComponent(); | ||
|
||
// Tint luminosity opacity is only available in contract 8 and above | ||
if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) | ||
{ | ||
((AcrylicBrush)Resources["AcrylicBlackWithLuminosityOpacity"]).TintLuminosityOpacity = 0.2; | ||
((AcrylicBrush)Resources["AcrylicDarkGreyWithLuminosityOpacity"]).TintLuminosityOpacity = 0.2; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters