Skip to content

Commit 3325d8e

Browse files
committed
show invert color outline for mouse pixel position
1 parent d9e9ea2 commit 3325d8e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

PixelArtTool/EnumsAndStructs.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ public SolidColorBrush AsSolidColorBrush()
5454
return new SolidColorBrush(Color.FromArgb(Alpha, Red, Green, Blue));
5555
}
5656

57+
public PixelColor Inverted(byte alphaOverride=255)
58+
{
59+
var pc = new PixelColor();
60+
pc.ColorBGRA = ColorBGRA ^ 0xffffffff;
61+
pc.Alpha = alphaOverride;
62+
return pc;
63+
}
5764
}
5865

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

PixelArtTool/MainWindow.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,9 @@ void DrawingAreaMouseMoved(object sender, MouseEventArgs e)
566566
var left = x * canvasScaleX + ((x * (16 / canvasResolutionX)) * (off > 0 ? 1 : 0));
567567
var top = y * canvasScaleX + ((y * (16 / canvasResolutionY)) * (off > 0 ? 1 : 0));
568568

569-
// NOTE: this causes palette pixels to distort/move?
570569
rectPixelPos.Margin = new Thickness(89 + left, 50 + top, 0, 0);
570+
var pc = GetPixelColor(x, y, canvasBitmap).Inverted(128);
571+
rectPixelPos.Stroke = pc.AsSolidColorBrush();
571572
} // drawingareamousemoved
572573

573574
void ShowMousePos(int x, int y)

0 commit comments

Comments
 (0)