Skip to content

Commit 2f8c16e

Browse files
committed
reset eraser colors on D, add pixelcolor White, Black, Transparent
1 parent a2efa46 commit 2f8c16e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

PixelArtTool/EnumsAndStructs.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public PixelColor(Color b)
6767
Alpha = b.A;
6868
}
6969

70-
7170
public SolidColorBrush AsSolidColorBrush()
7271
{
7372
return new SolidColorBrush(Color.FromArgb(Alpha, Red, Green, Blue));
@@ -90,6 +89,11 @@ public PixelColor Inverted(byte alphaOverride = 255)
9089
{
9190
return c1.ColorBGRA != c2.ColorBGRA;
9291
}
92+
93+
public static PixelColor White { get { return new PixelColor(255, 255, 255, 255); } }
94+
public static PixelColor Black { get { return new PixelColor(0, 0, 0, 255); } }
95+
public static PixelColor Transparent { get { return new PixelColor(0, 0, 0, 0); } }
96+
9397
} // PixelColor
9498

9599
// helper for converting bool<>enum for xaml linked values

PixelArtTool/MainWindow.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,12 @@ void OnKeyDown(object sender, KeyEventArgs e)
706706
switch (e.Key)
707707
{
708708
case Key.D: // reset to default colors (current, secondary)
709-
currentColor = new PixelColor(255, 255, 255, 255); // white
709+
currentColor = PixelColor.White;
710710
SetCurrentColorPreviewBox(rectCurrentColor, currentColor);
711-
rectSecondaryColor.Fill = new PixelColor(0, 0, 0, 255).AsSolidColorBrush();
711+
rectSecondaryColor.Fill = PixelColor.Black.AsSolidColorBrush();
712+
eraseColor = PixelColor.Transparent;
713+
rectEraserColor.Fill = eraseColor.AsSolidColorBrush();
714+
rectEraserColorSecondary.Fill = PixelColor.Black.AsSolidColorBrush();
712715
break;
713716
case Key.I: // global color picker
714717
currentColor = Win32GetScreenPixelColor();

0 commit comments

Comments
 (0)