Skip to content

Commit 5f99fac

Browse files
committed
cleanup
1 parent 6867899 commit 5f99fac

File tree

8 files changed

+58
-80
lines changed

8 files changed

+58
-80
lines changed

PixelArtTool/BlendMode.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

PixelArtTool/CustomPoint.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

PixelArtTool/EnumBooleanConverter.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

PixelArtTool/EnumsAndStructs.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
using System.Windows;
4+
using System.Windows.Data;
5+
6+
namespace PixelArtTool
7+
{
8+
public enum ToolMode
9+
{
10+
Draw,
11+
Fill
12+
}
13+
14+
public enum BlendMode : byte
15+
{
16+
Default = 0,
17+
Additive = 1
18+
}
19+
20+
[StructLayout(LayoutKind.Sequential)]
21+
public struct CustomPoint
22+
{
23+
public int X;
24+
public int Y;
25+
public static implicit operator Point(CustomPoint point)
26+
{
27+
return new Point(point.X, point.Y);
28+
}
29+
}
30+
31+
[StructLayout(LayoutKind.Explicit)]
32+
public struct PixelColor
33+
{
34+
// 32 bit BGRA
35+
[FieldOffset(0)] public UInt32 ColorBGRA;
36+
// 8 bit components
37+
[FieldOffset(0)] public byte Blue;
38+
[FieldOffset(1)] public byte Green;
39+
[FieldOffset(2)] public byte Red;
40+
[FieldOffset(3)] public byte Alpha;
41+
}
42+
43+
// helper for converting bool<>enum for xaml linked values
44+
// https://stackoverflow.com/a/2908885/5452781
45+
public class EnumBooleanConverter : IValueConverter
46+
{
47+
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
48+
{
49+
return value?.Equals(parameter);
50+
}
51+
52+
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
53+
{
54+
return value?.Equals(true) == true ? parameter : Binding.DoNothing;
55+
}
56+
}
57+
}

PixelArtTool/MainWindow.xaml.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
using Microsoft.Win32;
22
using System;
3-
using System.Collections;
43
using System.Collections.Generic;
54
using System.ComponentModel;
65
using System.IO;
76
using System.Linq;
87
using System.Runtime.CompilerServices;
9-
using System.Runtime.InteropServices;
108
using System.Windows;
119
using System.Windows.Controls;
1210
using System.Windows.Input;
13-
using System.Windows.Interop;
1411
using System.Windows.Media;
1512
using System.Windows.Media.Imaging;
1613
using static PixelArtTool.Tools;

PixelArtTool/PixelArtTool.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,8 @@
6464
<DependentUpon>App.xaml</DependentUpon>
6565
<SubType>Code</SubType>
6666
</Compile>
67-
<Compile Include="BlendMode.cs" />
68-
<Compile Include="CustomPoint.cs" />
69-
<Compile Include="PixelColor.cs" />
70-
<Compile Include="ToolMode.cs" />
67+
<Compile Include="EnumsAndStructs.cs" />
7168
<Compile Include="Tools.cs" />
72-
<Compile Include="EnumBooleanConverter.cs" />
7369
<Compile Include="MainWindow.xaml.cs">
7470
<DependentUpon>MainWindow.xaml</DependentUpon>
7571
<SubType>Code</SubType>

PixelArtTool/PixelColor.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

PixelArtTool/ToolMode.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)