Skip to content

Commit d61c228

Browse files
committed
fix undo (for previews), moving enums and helper methods to new classes, started adding current color lightness adjustment (mousewheel)
1 parent 928ca77 commit d61c228

File tree

9 files changed

+429
-276
lines changed

9 files changed

+429
-276
lines changed

PixelArtTool/BlendMode.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace PixelArtTool
2+
{
3+
public enum BlendMode : byte
4+
{
5+
Default = 0,
6+
Additive = 1
7+
}
8+
9+
} // namespace

PixelArtTool/CustomPoint.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Runtime.InteropServices;
2+
using System.Windows;
3+
4+
namespace PixelArtTool
5+
{
6+
[StructLayout(LayoutKind.Sequential)]
7+
public struct CustomPoint
8+
{
9+
public int X;
10+
public int Y;
11+
public static implicit operator Point(CustomPoint point)
12+
{
13+
return new Point(point.X, point.Y);
14+
}
15+
}
16+
} // namespace

PixelArtTool/EnumBooleanConverter.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Windows.Data;
3+
4+
namespace PixelArtTool
5+
{
6+
// https://stackoverflow.com/a/2908885/5452781
7+
public class EnumBooleanConverter : IValueConverter
8+
{
9+
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
10+
{
11+
return value?.Equals(parameter);
12+
}
13+
14+
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
15+
{
16+
return value?.Equals(true) == true ? parameter : Binding.DoNothing;
17+
}
18+
}
19+
20+
} // namespace

PixelArtTool/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
</ToolBar>
105105

106106
<ToolBar Band="1" BandIndex="1" VerticalAlignment="Top" Background="#FF9C9C9C">
107-
<RadioButton GroupName="Toolbar" Tag="Draw" ToolTip="Brush (D)" Template="{DynamicResource ToggleButtonLeft}" Style="{StaticResource {x:Type ToggleButton}}"
107+
<RadioButton GroupName="Toolbar" Tag="Draw" ToolTip="Brush (B)" Template="{DynamicResource ToggleButtonLeft}" Style="{StaticResource {x:Type ToggleButton}}"
108108
IsChecked="{Binding Path=CurrentTool, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static local:ToolMode.Draw},Mode=TwoWay}">
109109
<Image Source="/Resources/Buttons/drawmode.png" Width="24" Height="24" RenderOptions.BitmapScalingMode="NearestNeighbor" />
110110
</RadioButton>

0 commit comments

Comments
 (0)