-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
5 changed files
with
212 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Avalonia.Media.Imaging; | ||
using ImageMagick; | ||
using PicView.Avalonia.ImageHandling; | ||
|
||
namespace PicView.Avalonia.ImageEffects; | ||
|
||
public static class ImageEffectsHelper | ||
{ | ||
public static async Task<WriteableBitmap> GetRadialBlur(string file) | ||
{ | ||
using var magick = new MagickImage(); | ||
await magick.ReadAsync(file).ConfigureAwait(false); | ||
// Apply radial blur | ||
magick.AdaptiveBlur(10); | ||
|
||
// Create a new morphology settings | ||
var morphology = new MorphologySettings | ||
{ | ||
Kernel = Kernel.DoG, | ||
Method = MorphologyMethod.Convolve | ||
}; | ||
magick.Morphology(morphology); | ||
return magick.ToWriteableBitmap(); | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
src/PicView.Avalonia/PicViewTheme/Controls/ButtonSpinner.axaml
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,101 @@ | ||
<ResourceDictionary | ||
x:ClassModifier="internal" | ||
xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
|
||
<ControlTheme | ||
BasedOn="{StaticResource {x:Type RepeatButton}}" | ||
TargetType="RepeatButton" | ||
x:Key="SimpleButtonSpinnerRepeatButton"> | ||
<Setter Property="Background" Value="Transparent" /> | ||
<Setter Property="BorderBrush" Value="Transparent" /> | ||
<Style Selector="^ /template/ RepeatButton:pointerover"> | ||
<Setter Property="Background" Value="{DynamicResource MainBackgroundColor}" /> | ||
<Setter Property="BorderBrush" Value="{DynamicResource MainBorderColor}" /> | ||
</Style> | ||
</ControlTheme> | ||
|
||
<ControlTheme TargetType="ButtonSpinner" x:Key="{x:Type ButtonSpinner}"> | ||
<Setter Property="Background" Value="Transparent" /> | ||
<Setter Property="BorderBrush" Value="{DynamicResource MainBorderColor}" /> | ||
<Setter Property="BorderThickness" Value="1" /> | ||
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> | ||
<Setter Property="VerticalContentAlignment" Value="Center" /> | ||
<Setter Property="Focusable" Value="True" /> | ||
<Setter Property="Template"> | ||
<ControlTemplate> | ||
<DataValidationErrors> | ||
<Border | ||
Background="{TemplateBinding Background}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
CornerRadius="{TemplateBinding CornerRadius}" | ||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" | ||
Margin="{TemplateBinding Padding}" | ||
Name="border" | ||
VerticalAlignment="{TemplateBinding VerticalAlignment}"> | ||
<DockPanel> | ||
<UniformGrid | ||
DockPanel.Dock="Right" | ||
IsVisible="{TemplateBinding ShowButtonSpinner}" | ||
Name="PART_SpinnerPanel" | ||
Rows="2" | ||
TabIndex="2"> | ||
<RepeatButton | ||
IsTabStop="{TemplateBinding IsTabStop}" | ||
Name="PART_IncreaseButton" | ||
Theme="{StaticResource SimpleButtonSpinnerRepeatButton}"> | ||
<Path | ||
Data="M0,5 L4.5,.5 9,5 6,5 4.5,3.5 3,5 z" | ||
Fill="{DynamicResource MainTextColor}" | ||
Height="4" | ||
HorizontalAlignment="Center" | ||
Stretch="Uniform" | ||
VerticalAlignment="Center" | ||
Width="8" /> | ||
</RepeatButton> | ||
<RepeatButton | ||
IsTabStop="{TemplateBinding IsTabStop}" | ||
Name="PART_DecreaseButton" | ||
Theme="{StaticResource SimpleButtonSpinnerRepeatButton}"> | ||
<Path | ||
Data="M0,0 L3,0 4.5,1.5 6,0 9,0 4.5,4.5 z" | ||
Fill="{DynamicResource MainTextColor}" | ||
Height="4" | ||
HorizontalAlignment="Center" | ||
Stretch="Uniform" | ||
VerticalAlignment="Center" | ||
Width="8" /> | ||
</RepeatButton> | ||
</UniformGrid> | ||
<ContentPresenter | ||
Content="{TemplateBinding Content}" | ||
ContentTemplate="{TemplateBinding ContentTemplate}" | ||
Grid.Column="1" | ||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" | ||
Name="PART_ContentPresenter" | ||
Padding="{TemplateBinding Padding}" | ||
TabIndex="1" | ||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" /> | ||
</DockPanel> | ||
</Border> | ||
</DataValidationErrors> | ||
</ControlTemplate> | ||
</Setter> | ||
<Style Selector="^:left"> | ||
<Style Selector="^ /template/ UniformGrid#PART_SpinnerPanel"> | ||
<Setter Property="DockPanel.Dock" Value="Left" /> | ||
</Style> | ||
</Style> | ||
<Style Selector="^:pointerover /template/ Border#border"> | ||
<Setter Property="BorderBrush" Value="{DynamicResource MainBorderColor}" /> | ||
</Style> | ||
<Style Selector="^:focus /template/ Border#border"> | ||
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderColor}" /> | ||
</Style> | ||
<Style Selector="^:error /template/ Border#border"> | ||
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}" /> | ||
</Style> | ||
</ControlTheme> | ||
|
||
</ResourceDictionary> |
50 changes: 50 additions & 0 deletions
50
src/PicView.Avalonia/PicViewTheme/Controls/NumericUpDown.axaml
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,50 @@ | ||
<ResourceDictionary | ||
x:ClassModifier="internal" | ||
xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
<ControlTheme TargetType="NumericUpDown" x:Key="{x:Type NumericUpDown}"> | ||
<Setter Property="Background" Value="{DynamicResource MainBackgroundColor}" /> | ||
<Setter Property="BorderBrush" Value="{DynamicResource MainBorderColor}" /> | ||
<Setter Property="BorderThickness" Value="1" /> | ||
<Setter Property="Padding" Value="4" /> | ||
<Setter Property="Template"> | ||
<ControlTemplate> | ||
<DataValidationErrors> | ||
<ButtonSpinner | ||
AllowSpin="{TemplateBinding AllowSpin}" | ||
Background="{TemplateBinding Background}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}" | ||
CornerRadius="{TemplateBinding CornerRadius}" | ||
HorizontalContentAlignment="Stretch" | ||
IsTabStop="False" | ||
MinWidth="0" | ||
Name="PART_Spinner" | ||
Padding="0" | ||
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}" | ||
VerticalContentAlignment="Stretch"> | ||
<TextBox | ||
AcceptsReturn="False" | ||
Background="{TemplateBinding Background}" | ||
BorderThickness="0" | ||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" | ||
InnerLeftContent="{Binding InnerLeftContent, RelativeSource={RelativeSource TemplatedParent}}" | ||
InnerRightContent="{Binding InnerRightContent, RelativeSource={RelativeSource TemplatedParent}}" | ||
IsReadOnly="{TemplateBinding IsReadOnly}" | ||
Margin="4" | ||
MinWidth="20" | ||
Name="PART_TextBox" | ||
Padding="{TemplateBinding Padding}" | ||
ScrollViewer.VerticalScrollBarVisibility="Disabled" | ||
Text="{TemplateBinding Text}" | ||
TextAlignment="{TemplateBinding TextAlignment}" | ||
TextWrapping="NoWrap" | ||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" | ||
Watermark="{TemplateBinding Watermark}" /> | ||
</ButtonSpinner> | ||
</DataValidationErrors> | ||
</ControlTemplate> | ||
</Setter> | ||
</ControlTheme> | ||
</ResourceDictionary> |
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