-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
182 additions
and
80 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,103 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<samples:BaseSamplePage | ||
x:Class="AIDevGallery.Samples.WCRAPIs.BackgroundRemover" | ||
xmlns:samples="using:AIDevGallery.Samples" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="using:AIDevGallery.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" mc:Ignorable="d"> | ||
<Grid> | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" | ||
xmlns:samples="using:AIDevGallery.Samples" | ||
mc:Ignorable="d"> | ||
<Grid ColumnSpacing="24" RowSpacing="12"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
<StackPanel> | ||
<StackPanel Orientation="Horizontal"> | ||
<Button Click="LoadImage_Click" Margin="10" | ||
Style="{StaticResource AccentButtonStyle}">Load Image</Button> | ||
<Button Click="PasteImage_Click" Margin="10" | ||
Style="{StaticResource AccentButtonStyle}">Paste Image</Button> | ||
<Button Click="CleanSelection_Click" Margin="30,10,10,10" | ||
Style="{StaticResource AccentButtonStyle}">Clean Selection</Button> | ||
<Button Click="RemoveBackground_Click" Margin="10" | ||
Style="{StaticResource AccentButtonStyle}">Remove Background</Button> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto" /> | ||
<ColumnDefinition Width="*" /> | ||
</Grid.ColumnDefinitions> | ||
<StackPanel | ||
Grid.ColumnSpan="2" | ||
Orientation="Horizontal" | ||
Spacing="36"> | ||
<DropDownButton AutomationProperties.Name="Select image"> | ||
<StackPanel Orientation="Horizontal" Spacing="8"> | ||
<FontIcon FontSize="16" Glyph="" /> | ||
<TextBlock Text="Select image" /> | ||
</StackPanel> | ||
<DropDownButton.Flyout> | ||
<MenuFlyout Placement="Bottom"> | ||
<MenuFlyoutItem Click="PasteImage_Click" Text="From clipboard" /> | ||
<MenuFlyoutItem Click="LoadImage_Click" Text="From file" /> | ||
</MenuFlyout> | ||
</DropDownButton.Flyout> | ||
</DropDownButton> | ||
<StackPanel | ||
x:Name="ActionsButtonPanel" | ||
Orientation="Horizontal" | ||
Spacing="12" | ||
Visibility="Collapsed"> | ||
<Button | ||
Click="RemoveBackground_Click" | ||
Content="Remove background" | ||
Style="{StaticResource AccentButtonStyle}" /> | ||
<Button | ||
x:Name="CleanSelectionBtn" | ||
Click="CleanSelection_Click" | ||
Content="Clean selection" | ||
IsEnabled="False" /> | ||
</StackPanel> | ||
<TextBlock | ||
Text="Once the image is loaded, click on the parts of it that you want to keep. You can select a maximum of 32 points.
Click 'Remove Background' to remove the background.
Click on 'Clean Selection' to clean current selection." | ||
TextWrapping="Wrap" MaxWidth="600" Margin="10,0,30,0" | ||
VerticalAlignment="Center" HorizontalAlignment="Left"/> | ||
</StackPanel> | ||
<Grid Grid.Row="1"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="*" /> | ||
</Grid.ColumnDefinitions> | ||
<Image x:Name="ImageSrc" Grid.Row="1" Grid.Column="0" | ||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" | ||
Stretch="Uniform" /> | ||
<Canvas x:Name="InputImageCanvas" Grid.Row="1" Grid.Column="0" | ||
Height="{Binding Height, ElementName=ImageSrc}" | ||
Width="{Binding Width, ElementName=ImageSrc}" | ||
PointerReleased="Canvas_PointerReleased" | ||
SizeChanged="Canvas_SizeChanged" Background="Transparent" /> | ||
<Image x:Name="ImageDst" Grid.Row="1" Grid.Column="1" | ||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" | ||
Stretch="Uniform" /> | ||
|
||
<TextBlock | ||
x:Name="InstructionTxt" | ||
Grid.Row="1" | ||
Grid.ColumnSpan="2" | ||
Margin="0,0,0,24" | ||
Foreground="{ThemeResource TextFillColorSecondaryBrush}" | ||
Style="{StaticResource CaptionTextBlockStyle}" | ||
Text="Click on the parts of image that should be extracted, then click 'Remove background'. A maximum of 32 points can be selected." | ||
TextWrapping="Wrap" | ||
Visibility="Collapsed" /> | ||
|
||
<Grid | ||
Grid.Row="2" | ||
HorizontalAlignment="Left" | ||
VerticalAlignment="Top"> | ||
<Image | ||
x:Name="ImageSrc" | ||
MaxHeight="360" | ||
HorizontalAlignment="Stretch" | ||
VerticalAlignment="Stretch" | ||
Stretch="Uniform" /> | ||
<Canvas | ||
x:Name="InputImageCanvas" | ||
Width="{Binding Width, ElementName=ImageSrc}" | ||
Height="{Binding Height, ElementName=ImageSrc}" | ||
Background="Transparent" | ||
PointerReleased="Canvas_PointerReleased" | ||
SizeChanged="Canvas_SizeChanged" /> | ||
</Grid> | ||
<Image | ||
x:Name="ImageDst" | ||
Grid.Row="2" | ||
Grid.Column="1" | ||
MaxHeight="360" | ||
HorizontalAlignment="Left" | ||
VerticalAlignment="Top" | ||
Stretch="Uniform" /> | ||
<ProgressRing | ||
x:Name="Loader" | ||
Grid.Row="2" | ||
Grid.Column="1" | ||
Width="48" | ||
Height="48" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
IsActive="True" | ||
Visibility="Collapsed" /> | ||
</Grid> | ||
</samples:BaseSamplePage> |
Oops, something went wrong.