Skip to content

Commit

Permalink
Image effect updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Jan 14, 2025
1 parent 854711c commit 244b6e6
Show file tree
Hide file tree
Showing 4 changed files with 215 additions and 178 deletions.
4 changes: 3 additions & 1 deletion src/PicView.Avalonia/ImageEffects/ImageEffectConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

namespace PicView.Avalonia.ImageEffects;

public struct ImageEffectConfig(Percentage brightness, Percentage contrast, double sketchStrokeWidth, int posterizeLevel, bool negative, bool blackAndWhite, bool oldMovie)
public struct ImageEffectConfig(Percentage brightness, Percentage contrast, double sketchStrokeWidth, double blurRadius, int posterizeLevel, bool negative, bool blackAndWhite, bool oldMovie)
{
public Percentage Brightness = brightness;
public Percentage Contrast = contrast;

public double SketchStrokeWidth = sketchStrokeWidth;

public int PosterizeLevel = posterizeLevel;

public bool Negative = negative;
public bool BlackAndWhite = blackAndWhite;
public bool OldMovie = oldMovie;
public double BlurRadius = blurRadius;
}
44 changes: 44 additions & 0 deletions src/PicView.Avalonia/PicViewTheme/Icons.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -1100,4 +1100,48 @@
</GeometryDrawing>
</DrawingGroup>
</DrawingImage>
<DrawingImage x:Key="CloseImage">
<DrawingGroup>
<GeometryDrawing Geometry="F1 M21 9L21 19Q21 19.0983 20.9904 19.196Q20.9807 19.2938 20.9616 19.3902Q20.9424 19.4865 20.9139 19.5806Q20.8854 19.6746 20.8478 19.7654Q20.8102 19.8561 20.7638 19.9428Q20.7175 20.0294 20.6629 20.1111Q20.6084 20.1928 20.546 20.2688Q20.4837 20.3447 20.4142 20.4142Q20.3447 20.4837 20.2688 20.546Q20.1928 20.6084 20.1111 20.6629Q20.0294 20.7175 19.9428 20.7638Q19.8561 20.8102 19.7654 20.8478Q19.6746 20.8854 19.5806 20.9139Q19.4865 20.9424 19.3902 20.9616Q19.2938 20.9807 19.196 20.9904Q19.0983 21 19 21L5 21Q4.90175 21 4.80397 20.9904Q4.70618 20.9807 4.60982 20.9616Q4.51345 20.9424 4.41943 20.9139Q4.32541 20.8854 4.23463 20.8478Q4.14386 20.8102 4.05721 20.7638Q3.97055 20.7175 3.88886 20.6629Q3.80716 20.6084 3.73121 20.546Q3.65526 20.4837 3.58579 20.4142Q3.51631 20.3447 3.45398 20.2688Q3.39165 20.1928 3.33706 20.1111Q3.28247 20.0294 3.23616 19.9428Q3.18984 19.8561 3.15224 19.7654Q3.11464 19.6746 3.08612 19.5806Q3.0576 19.4865 3.03843 19.3902Q3.01926 19.2938 3.00963 19.196Q3 19.0983 3 19L3 5Q3 4.90175 3.00963 4.80397Q3.01926 4.70619 3.03843 4.60982Q3.0576 4.51345 3.08612 4.41943Q3.11464 4.32541 3.15224 4.23463Q3.18984 4.14386 3.23616 4.05721Q3.28247 3.97055 3.33706 3.88886Q3.39165 3.80716 3.45398 3.73121Q3.51631 3.65526 3.58579 3.58579Q3.65526 3.51631 3.73121 3.45398Q3.80716 3.39165 3.88886 3.33706Q3.97055 3.28247 4.05721 3.23616Q4.14386 3.18984 4.23463 3.15224Q4.32541 3.11464 4.41943 3.08612Q4.51345 3.0576 4.60982 3.03843Q4.70619 3.01926 4.80397 3.00963Q4.90175 3 5 3L12 3">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<GeometryDrawing Geometry="F1 M16 5L22 5">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<GeometryDrawing Geometry="F1 M11 9Q11 9.09825 10.9904 9.19603Q10.9807 9.29382 10.9616 9.39018Q10.9424 9.48655 10.9139 9.58057Q10.8854 9.67459 10.8478 9.76537Q10.8102 9.85614 10.7638 9.94279Q10.7175 10.0294 10.6629 10.1111Q10.6084 10.1928 10.546 10.2688Q10.4837 10.3447 10.4142 10.4142Q10.3447 10.4837 10.2688 10.546Q10.1928 10.6084 10.1111 10.6629Q10.0294 10.7175 9.94279 10.7638Q9.85614 10.8102 9.76537 10.8478Q9.67459 10.8854 9.58057 10.9139Q9.48655 10.9424 9.39018 10.9616Q9.29382 10.9807 9.19603 10.9904Q9.09825 11 9 11Q8.90175 11 8.80397 10.9904Q8.70619 10.9807 8.60982 10.9616Q8.51345 10.9424 8.41943 10.9139Q8.32541 10.8854 8.23463 10.8478Q8.14386 10.8102 8.05721 10.7638Q7.97055 10.7175 7.88886 10.6629Q7.80716 10.6084 7.73121 10.546Q7.65526 10.4837 7.58579 10.4142Q7.51631 10.3447 7.45398 10.2688Q7.39165 10.1928 7.33706 10.1111Q7.28247 10.0294 7.23616 9.94279Q7.18984 9.85614 7.15224 9.76537Q7.11464 9.67459 7.08612 9.58057Q7.0576 9.48655 7.03843 9.39018Q7.01926 9.29382 7.00963 9.19603Q7 9.09825 7 9Q7 8.90175 7.00963 8.80397Q7.01926 8.70619 7.03843 8.60982Q7.0576 8.51345 7.08612 8.41943Q7.11464 8.32541 7.15224 8.23463Q7.18984 8.14386 7.23616 8.05721Q7.28247 7.97055 7.33706 7.88886Q7.39165 7.80716 7.45398 7.73121Q7.51631 7.65526 7.58579 7.58579Q7.65526 7.51631 7.73121 7.45398Q7.80716 7.39165 7.88886 7.33706Q7.97055 7.28247 8.05721 7.23616Q8.14386 7.18984 8.23463 7.15224Q8.32541 7.11464 8.41943 7.08612Q8.51345 7.0576 8.60982 7.03843Q8.70619 7.01926 8.80397 7.00963Q8.90175 7 9 7Q9.09825 7 9.19603 7.00963Q9.29382 7.01926 9.39018 7.03843Q9.48655 7.0576 9.58057 7.08612Q9.67459 7.11464 9.76537 7.15224Q9.85614 7.18984 9.94279 7.23616Q10.0294 7.28247 10.1111 7.33706Q10.1928 7.39165 10.2688 7.45398Q10.3447 7.51631 10.4142 7.58579Q10.4837 7.65526 10.546 7.73121Q10.6084 7.80716 10.6629 7.88886Q10.7175 7.97055 10.7638 8.05721Q10.8102 8.14386 10.8478 8.23463Q10.8854 8.32541 10.9139 8.41943Q10.9424 8.51345 10.9616 8.60982Q10.9807 8.70619 10.9904 8.80397Q11 8.90175 11 9Z">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<GeometryDrawing Geometry="F1 M21 15L17.914 11.914Q17.8445 11.8445 17.7686 11.7822Q17.6926 11.7199 17.611 11.6654Q17.5293 11.6108 17.4426 11.5645Q17.356 11.5182 17.2652 11.4806Q17.1745 11.443 17.0805 11.4145Q16.9865 11.386 16.8901 11.3668Q16.7938 11.3477 16.696 11.3381Q16.5982 11.3284 16.5 11.3284Q16.4018 11.3284 16.304 11.3381Q16.2062 11.3477 16.1099 11.3668Q16.0135 11.386 15.9195 11.4145Q15.8255 11.443 15.7348 11.4806Q15.644 11.5182 15.5574 11.5645Q15.4707 11.6108 15.389 11.6654Q15.3074 11.7199 15.2314 11.7822Q15.1555 11.8445 15.086 11.914L6 21">
<GeometryDrawing.Pen>
<Pen
Brush="{StaticResource SecondaryTextColor}"
LineCap="Round"
LineJoin="Round"
MiterLimit="4"
Thickness="2" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage>
</ResourceDictionary>
136 changes: 46 additions & 90 deletions src/PicView.Avalonia/Views/EffectsView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,53 @@
<Style Selector="NumericUpDown">
<Setter Property="Width" Value="56" />
<Setter Property="FormatString" Value="N0" />
<Setter Property="Background" Value="{DynamicResource MainBackgroundColor}" />
<Setter Property="BorderBrush" Value="{DynamicResource MainBorderColor}" />
<Setter Property="Foreground" Value="{DynamicResource MainTextColor}" />
</Style>
</Styles>
</UserControl.Styles>
<UserControl.ContextMenu>
<ContextMenu x:Name="ContextMenu">
<MenuItem Command="{CompiledBinding SaveFileCommand}" Header="{CompiledBinding Save, Mode=OneWay}">
<MenuItem.Icon>
<Path
Data="{StaticResource SaveGeometry}"
Fill="{DynamicResource MainTextColor}"
Height="12"
Stretch="Fill"
Width="12" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{CompiledBinding SaveFileAsCommand}" Header="{CompiledBinding SaveAs}">
<MenuItem.Icon>
<Path
Data="{StaticResource SaveGeometry}"
Fill="{DynamicResource MainTextColor}"
Height="12"
Stretch="Fill"
Width="12" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{CompiledBinding CopyImageCommand}" Header="{CompiledBinding CopyImage, Mode=OneWay}">
<MenuItem.Icon>
<Path
Data="{StaticResource CopyGeometry}"
Fill="{DynamicResource MainTextColor}"
Height="12"
Stretch="Fill"
Width="12" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="{CompiledBinding ClearEffects}" x:Name="ClearEffectsItem">
<MenuItem.Icon>
<Image
Height="12"
Source="{StaticResource CloseImage}"
Width="12" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</UserControl.ContextMenu>

<StackPanel Width="500">
<Expander IsExpanded="True" Margin="0,15,0,10">
Expand Down Expand Up @@ -47,8 +88,6 @@
Width="2" />
</Panel>



<StackPanel Orientation="Horizontal">

<customControls:CustomSlider
Expand Down Expand Up @@ -107,8 +146,6 @@
Width="2" />
</Panel>



<StackPanel Orientation="Horizontal">

<customControls:CustomSlider
Expand Down Expand Up @@ -159,14 +196,14 @@

</Expander>

<Expander Margin="0,0,0,10">
<Expander IsExpanded="True" Margin="0,0,0,10">
<Expander.Header>
<TextBlock
Classes="txt"
FontFamily="/Assets/Fonts/Roboto-Bold.ttf#Roboto"
FontSize="14"
Padding="10,5"
Text="{CompiledBinding Blur}" />
Text="{CompiledBinding Effects}" />
</Expander.Header>
<StackPanel Margin="15,0">

Expand All @@ -177,15 +214,6 @@
HorizontalAlignment="Left"
Text="{CompiledBinding Blur}"
VerticalAlignment="Center" />

<Rectangle
Fill="{DynamicResource MainButtonBackgroundColor}"
Height="20"
HorizontalAlignment="Center"
Margin="0,0,122,-10"
Stroke="{DynamicResource MainBorderColor}"
StrokeThickness="1.5"
Width="2" />
</Panel>

<StackPanel Orientation="Horizontal">
Expand All @@ -196,10 +224,9 @@
BorderThickness="1"
Height="30"
IsSnapToTickEnabled="True"
LargeChange="5"
Margin="0,1,10,1"
Maximum="100"
Minimum="-85"
Minimum="0"
SmallChange="1"
Theme="{StaticResource SetBg}"
TickFrequency="1"
Expand All @@ -224,77 +251,6 @@
x:Name="ResetBlurBtn" />
</StackPanel>

<!-- MotionBlur -->
<Panel Margin="0,10,0,5">
<TextBlock
Classes="txt"
HorizontalAlignment="Left"
Text="{CompiledBinding Blur}"
VerticalAlignment="Center" />

<Rectangle
Fill="{DynamicResource MainButtonBackgroundColor}"
Height="20"
HorizontalAlignment="Center"
Margin="0,0,122,-10"
Stroke="{DynamicResource MainBorderColor}"
StrokeThickness="1.5"
Width="2" />
</Panel>

<StackPanel Orientation="Horizontal">

<customControls:CustomSlider
Background="{DynamicResource MainButtonBackgroundColor}"
BorderBrush="{DynamicResource MainBorderColor}"
BorderThickness="1"
Height="30"
IsSnapToTickEnabled="True"
LargeChange="5"
Margin="0,1,10,1"
Maximum="100"
Minimum="-85"
SmallChange="1"
Theme="{StaticResource SetBg}"
TickFrequency="1"
Value="0"
Width="376"
x:Name="MotionBlurSlider" />
<NumericUpDown
Maximum="{Binding Path=Maximum, ElementName=MotionBlurSlider}"
Minimum="{Binding Path=Minimum, ElementName=MotionBlurSlider}"
Value="{Binding Path=Value, ElementName=MotionBlurSlider}" />
<customControls:IconButton
Background="{DynamicResource MainButtonBackgroundColor}"
BorderBrush="{DynamicResource MainBorderColor}"
BorderThickness="1"
Classes="hover"
Foreground="{DynamicResource MainTextColor}"
Icon="{StaticResource UndoImage}"
IconHeight="12"
IconWidth="12"
Margin="5,0,0,0"
Width="30"
x:Name="ResetMotionBlurBtn" />
</StackPanel>



</StackPanel>

</Expander>

<Expander IsExpanded="True" Margin="0,0,0,10">
<Expander.Header>
<TextBlock
Classes="txt"
FontFamily="/Assets/Fonts/Roboto-Bold.ttf#Roboto"
FontSize="14"
Padding="10,5"
Text="{CompiledBinding Effects}" />
</Expander.Header>
<StackPanel Margin="15,0">

<!-- Pencil Sketch -->
<Panel Margin="0,10,0,5">
<TextBlock
Expand Down
Loading

0 comments on commit 244b6e6

Please sign in to comment.