Skip to content

Commit

Permalink
Update image effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Jan 7, 2025
1 parent 7b6718f commit 13a0f1f
Show file tree
Hide file tree
Showing 7 changed files with 339 additions and 11 deletions.
6 changes: 6 additions & 0 deletions src/PicView.Avalonia.MacOS/Views/EffectsWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Media;
using PicView.Avalonia.WindowBehavior;
using PicView.Core.Config;
using PicView.Core.Localization;

Expand All @@ -19,6 +20,11 @@ public EffectsWindow()
{
MinWidth = MaxWidth = Width;
Title = $"{TranslationHelper.Translation.Effects} - PicView";

ClientSizeProperty.Changed.Subscribe(size =>
{
WindowResizing.HandleWindowResize(this, size);
});
};
KeyDown += (_, e) =>
{
Expand Down
6 changes: 6 additions & 0 deletions src/PicView.Avalonia.Win32/Views/EffectsWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media;
using PicView.Avalonia.WindowBehavior;
using PicView.Core.Config;
using PicView.Core.Localization;

Expand Down Expand Up @@ -47,6 +48,11 @@ public EffectsWindow()
{
MinWidth = MaxWidth = Width;
Title = $"{TranslationHelper.Translation.Effects} - PicView";

ClientSizeProperty.Changed.Subscribe(size =>
{
WindowResizing.HandleWindowResize(this, size);
});
};
KeyDown += (_, e) =>
{
Expand Down
73 changes: 71 additions & 2 deletions src/PicView.Avalonia/PicViewTheme/Controls/Slider.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Setter Property="Height" Value="12" />
<Setter Property="Template">
<ControlTemplate>
<Border Name="DecreaseThemeBorder" Background="{DynamicResource AccentColor}" />
<Border Background="{DynamicResource AccentColor}" Name="DecreaseThemeBorder" />
</ControlTemplate>
</Setter>
</ControlTheme>
Expand All @@ -16,7 +16,10 @@
<Setter Property="Height" Value="12" />
<Setter Property="Template">
<ControlTemplate>
<Border Name="IncreaseThemeBorder" Background="{DynamicResource AccentColor}" Opacity="0.2" />
<Border
Background="{DynamicResource AccentColor}"
Name="IncreaseThemeBorder"
Opacity="0.2" />
</ControlTemplate>
</Setter>
</ControlTheme>
Expand Down Expand Up @@ -75,4 +78,70 @@
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style>
</ControlTheme>

<ControlTheme TargetType="Slider" x:Key="SetBg">
<Style Selector="^:horizontal">
<Setter Property="MinWidth" Value="40" />
<Setter Property="MinHeight" Value="20" />
<Setter Property="Template">
<ControlTemplate>
<Grid Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" MinHeight="20" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border
Background="{TemplateBinding Background}"
Grid.Row="1"
Height="12"
VerticalAlignment="Center" />
<Track
Grid.Row="1"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Name="PART_Track"
Orientation="Horizontal">
<Track.DecreaseButton>
<RepeatButton
Background="Transparent"
Height="12"
Name="PART_DecreaseButton" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton
Background="Transparent"
Height="12"
Name="PART_IncreaseButton" />
</Track.IncreaseButton>
<Thumb Height="22" Width="22">
<Thumb.Template>
<ControlTemplate>
<Rectangle
Fill="{DynamicResource SecondaryButtonBackgroundColor}"
Name="thumb"
Stroke="{DynamicResource MainBorderColor}"
StrokeThickness="1.5" />
</ControlTemplate>
</Thumb.Template>
<Thumb.Styles>
<Style Selector="Rectangle:pointerover">
<Setter Property="Fill" Value="{DynamicResource AccentColor}" />
</Style>
</Thumb.Styles>
</Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter>
</Style>

<Style Selector="^ /template/ Track#PART_Track">
<Setter Property="Minimum" Value="{TemplateBinding Minimum}" />
<Setter Property="Maximum" Value="{TemplateBinding Maximum}" />
<Setter Property="Value" Value="{TemplateBinding Value, Mode=TwoWay}" />
</Style>
<Style Selector="^:disabled /template/ Grid#grid">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style>
</ControlTheme>
</ResourceDictionary>
24 changes: 24 additions & 0 deletions src/PicView.Avalonia/PicViewTheme/Icons.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -1076,4 +1076,28 @@
</GeometryDrawing>
</DrawingGroup>
</DrawingImage>
<DrawingImage x:Key="UndoImage">
<DrawingGroup>
<GeometryDrawing Geometry="F1 M3 7L3 13L9 13">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<GeometryDrawing Geometry="F1 M21 17Q21 16.7791 20.9892 16.5584Q20.9783 16.3377 20.9567 16.1178Q20.935 15.898 20.9026 15.6794Q20.8702 15.4609 20.8271 15.2442Q20.784 15.0275 20.7303 14.8132Q20.6766 14.5989 20.6125 14.3874Q20.5483 14.176 20.4739 13.968Q20.3995 13.76 20.3149 13.5558Q20.2304 13.3517 20.1359 13.152Q20.0414 12.9523 19.9373 12.7574Q19.8331 12.5626 19.7196 12.3731Q19.606 12.1836 19.4832 11.9999Q19.3605 11.8162 19.2289 11.6387Q19.0973 11.4612 18.9571 11.2905Q18.8169 11.1197 18.6686 10.956Q18.5202 10.7923 18.364 10.636Q18.2077 10.4798 18.044 10.3314Q17.8803 10.1831 17.7095 10.0429Q17.5388 9.90274 17.3613 9.77113Q17.1838 9.63952 17.0001 9.51677Q16.8164 9.39403 16.6269 9.28044Q16.4374 9.16686 16.2426 9.06271Q16.0477 8.95856 15.848 8.8641Q15.6483 8.76963 15.4441 8.68508Q15.24 8.60054 15.032 8.5261Q14.824 8.45167 14.6126 8.38754Q14.4011 8.3234 14.1868 8.26972Q13.9725 8.21603 13.7558 8.17293Q13.5391 8.12983 13.3206 8.09741Q13.102 8.06499 12.8822 8.04334Q12.6623 8.02168 12.4416 8.01084Q12.2209 8 12 8Q11.589 8.00042 11.1798 8.03829Q10.7706 8.07615 10.3666 8.15116Q9.96253 8.22616 9.567 8.33767Q9.17147 8.44919 8.78774 8.59628Q8.40401 8.74337 8.03529 8.92483Q7.66657 9.10628 7.31591 9.32058Q6.96526 9.53488 6.6356 9.78025Q6.30593 10.0256 6 10.3L3 13">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage>
</ResourceDictionary>
16 changes: 15 additions & 1 deletion src/PicView.Avalonia/ViewModels/ViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,27 @@ public void UpdateLanguage()
ImageAliasing = TranslationHelper.Translation.ImageAliasing;
HighQuality = TranslationHelper.Translation.HighQuality;
Lighting = TranslationHelper.Translation.Lighting;
Emboss = TranslationHelper.Translation.Embossed; // Should change to Emboss
Emboss = TranslationHelper.Translation.Embossed;
BlackAndWhite = TranslationHelper.Translation.BlackAndWhite;
NegativeColors = TranslationHelper.Translation.NegativeColors;
Blur = TranslationHelper.Translation.Blur;
DirectionalBlur = TranslationHelper.Translation.DirectionalBlur;
}

#region Strings

public string? DirectionalBlur
{
get;
set => this.RaiseAndSetIfChanged(ref field, value);
}

public string? Blur
{
get;
set => this.RaiseAndSetIfChanged(ref field, value);
}

public string? NegativeColors
{
get;
Expand Down
Loading

0 comments on commit 13a0f1f

Please sign in to comment.