Can now apply a background colour to the exported assets

This commit is contained in:
Robin Martain
2020-01-26 15:21:06 +11:00
parent 94a4f55f32
commit 13bf6f308e
13 changed files with 248 additions and 53 deletions

View File

@@ -9,6 +9,7 @@
xmlns:muimedia="using:Microsoft.UI.Xaml.Media"
xmlns:tkcon="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations"
xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Animations.Behaviors"
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
mc:Ignorable="d"
d:DesignHeight="300"
@@ -23,8 +24,7 @@
</Grid.RowDefinitions>
<TextBlock Text="{x:Bind mainViewModel.AssetTypes.Current.Title, Mode=OneWay}"
Margin="8,12"
Style="{ThemeResource FluentSubheaderTextStyle}"/>
Margin="8,12"/>
<GridView Grid.Row="1"
ItemsSource="{x:Bind mainViewModel.AssetTypes.Current.Assets.Items, Mode=OneWay}"
@@ -51,15 +51,23 @@
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid Background="{ThemeResource SystemAccentColor}"
x:Name="grdBackgroundAccentPreview"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Grid.RowSpan="3"
Visibility="{x:Bind mainViewModel.PreviewWithAccentColour, Mode=OneWay}"
/>
>
<animations:Implicit.ShowAnimations>
<animations:OpacityAnimation Duration="0:0:1" From="0.0" To="1.0"/>
</animations:Implicit.ShowAnimations>
<animations:Implicit.HideAnimations>
<animations:OpacityAnimation Duration="0:0:1" From="1.0" To="0.0"/>
</animations:Implicit.HideAnimations>
</Grid>
<StackPanel>
<TextBlock Text="{x:Bind FileName, Mode=OneWay}"
VerticalAlignment="Top"
@@ -83,7 +91,6 @@
<tkcon:ImageEx Grid.Row="1"
Background="Transparent"
BorderThickness="1"
BorderBrush="Silver"
Margin="8"

View File

@@ -10,22 +10,16 @@
xmlns:wui="using:Windows.UI.Xaml.Controls"
mc:Ignorable="d">
<Grid>
<Grid Background="{ThemeResource SystemControlAcrylicElementBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" x:Name="ColumnOne"/>
<ColumnDefinition Width="2*" MinWidth="450" MaxWidth="600" x:Name="ColumnTwo"/>
<ColumnDefinition Width="*" x:Name="ColumnThree"/>
</Grid.ColumnDefinitions>
<Grid Grid.ColumnSpan="3" Background="{ThemeResource SystemControlAcrylicElementBrush}" Opacity="0.8"/>
<Grid Grid.Column="1" Padding="24">
<Grid Grid.Column="1" Padding="24" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="1" x:Name="contentgoeshere" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
BorderThickness="1" CornerRadius="4" BorderBrush="Silver">

View File

@@ -0,0 +1,57 @@
<UserControl
x:Class="UWP_Visual_Asset_Generator.UserControls.SetBackgroundColourUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UWP_Visual_Asset_Generator.UserControls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:wui="using:Windows.UI.Xaml.Controls"
xmlns:tk="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:mui="using:Microsoft.UI.Xaml.Controls"
>
<Grid Background="{ThemeResource SystemControlAcrylicElementBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" x:Name="ColumnOne"/>
<ColumnDefinition Width="2*" MinWidth="520" MaxWidth="700" x:Name="ColumnTwo"/>
<ColumnDefinition Width="*" x:Name="ColumnThree"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1"
VerticalAlignment="Center"
x:Name="contentgoeshere"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
BorderThickness="1"
BorderBrush="Silver">
<TextBlock Text="Select Icon Background Colour"
Margin="8"
HorizontalAlignment="Center"
/>
<ColorPicker Color="{x:Bind mainViewModel.BackgroundColour, Mode=TwoWay}"
IsAlphaTextInputVisible="True"
IsAlphaEnabled="True"
IsAlphaSliderVisible="True"
IsColorChannelTextInputVisible="True"
>
</ColorPicker>
<tk:ImageEx Width="120"
Padding="24"
Background="{x:Bind mainViewModel.BackgroundColourBrush, Mode=OneWay}"
Source="{x:Bind mainViewModel.OriginalLogoImageSource, Mode=OneWay}"
Stretch="Uniform"
x:Uid="preview"
PlaceholderStretch="Uniform"
PlaceholderSource="/Images/Logo.png"
ToolTipService.ToolTip="Preveiew"/>
<wui:Button HorizontalAlignment="Stretch"
Margin="8"
x:Name="okButton"
Click="okButton_Click"
Content="Ok"
Padding="4"/>
</StackPanel>
</Grid>
</UserControl>

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using UWP_Visual_Asset_Generator.ViewModels;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace UWP_Visual_Asset_Generator.UserControls
{
public sealed partial class SetBackgroundColourUserControl : UserControl
{
public MainViewModel mainViewModel => App.mainViewModel;
public SetBackgroundColourUserControl()
{
this.InitializeComponent();
}
private void okButton_Click(object sender, RoutedEventArgs e)
{
mainViewModel.AssetTypes.ApplyLogo();
mainViewModel.ShowBackgroundColorSelector = false;
}
}
}

View File

@@ -11,7 +11,9 @@
xmlns:tkcon="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:viewmodels="using:UWP_Visual_Asset_Generator.ViewModels"
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
xmlns:generic="using:System.Collections.Generic">
xmlns:generic="using:System.Collections.Generic"
xmlns:wui="using:Windows.UI.Xaml.Controls"
xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions">
<Grid Background="{ThemeResource SystemControlAcrylicWindowMediumHighBrush}"
Padding="12,0,12,12">
@@ -21,6 +23,7 @@
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<!-- Logo -->
@@ -75,7 +78,8 @@
PlaceholderSource="/Images/Logo.png"
Drop="Image_Original_Drop"
DragOver="Image_Original_DragOver"
ToolTipService.ToolTip="Drop a PNG image here, or click to browse"/>
ToolTipService.ToolTip="Drop a PNG image here, or click to browse"
extensions:Mouse.Cursor="Hand"/>
</Grid>
</tkcon:DropShadowPanel>
</StackPanel>
@@ -114,7 +118,15 @@
</ListView>
<!-- End of Asset Style list -->
<Grid Grid.Row="2">
<wui:Button Content="Set background colour"
Grid.Row="2"
HorizontalAlignment="Stretch"
Style="{ThemeResource ButtonRevealStyle}"
Margin="0,8"
x:Name="btnSetBackgroundColour"
Click="btnSetBackgroundColour_Click"/>
<Grid Grid.Row="3">
<ComboBox ItemsSource="{x:Bind mainViewModel.Resamplers, Mode=OneTime}"
SelectedItem="{x:Bind mainViewModel.SelectedResampler, Mode=TwoWay}"
Header="Resampling Mode"
@@ -128,10 +140,10 @@
</Grid>
<!-- Theme Setting -->
<Grid Grid.Row="3">
<Grid Grid.Row="4">
<ComboBox
x:Name="themeSelect"
Header="Theme"
Header="App Theme"
Margin="0,8"
Grid.Row="1"
HorizontalAlignment="Stretch"
@@ -145,7 +157,7 @@
<!-- End of Theme Setting -->
<!-- Output Picker -->
<Grid Grid.Row="4">
<Grid Grid.Row="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>

View File

@@ -95,5 +95,10 @@ namespace UWP_Visual_Asset_Generator.UserControls
case 2: App.mainPage.RequestedTheme = ElementTheme.Dark; ; break;
}
}
private void btnSetBackgroundColour_Click(object sender, RoutedEventArgs e)
{
mainViewModel.ShowBackgroundColorSelector = true;
}
}
}

View File

@@ -9,24 +9,15 @@
xmlns:wui="using:Windows.UI.Xaml.Controls"
mc:Ignorable="d">
<Grid>
<Grid Background="{ThemeResource SystemControlAcrylicElementBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" x:Name="ColumnOne"/>
<ColumnDefinition Width="2*" MinWidth="520" MaxWidth="700" x:Name="ColumnTwo"/>
<ColumnDefinition Width="*" x:Name="ColumnThree"/>
</Grid.ColumnDefinitions>
<Grid Grid.ColumnSpan="3"
Background="{ThemeResource SystemControlAcrylicElementBrush}"
Opacity="0.8"/>
<Grid Grid.Column="1" Padding="24" VerticalAlignment="Center">
<Grid Grid.Column="1" Padding="24">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="1"
x:Name="contentgoeshere"