Skip to content

Commit 4b4d359

Browse files
committed
add quick fill (with left button doubleclick), fix null ref when clicking empty last palette spot, cleanup Start(), remove unused var c,
1 parent 15ea3f4 commit 4b4d359

File tree

3 files changed

+146
-168
lines changed

3 files changed

+146
-168
lines changed

PixelArtTool/MainWindow.xaml

+11-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:local="clr-namespace:PixelArtTool"
77
xmlns:System="clr-namespace:System;assembly=mscorlib" x:Name="window" x:Class="PixelArtTool.MainWindow"
88
mc:Ignorable="d"
9-
Title="PixelArtTool (Test Version)" Height="412.222" Width="739.444" Background="#FF252526" KeyDown="OnKeyDown" KeyUp="OnKeyUp" Icon="Resources/Icons/appicon.ico">
9+
Title="PixelArtTool (Test Version)" Height="412.222" Width="739.444" Background="#FF252526" KeyDown="OnKeyDown" KeyUp="OnKeyUp" Icon="Resources/Icons/appicon.ico" MouseWheel="WindowMouseWheel">
1010
<Window.CommandBindings>
1111
<CommandBinding Command="ApplicationCommands.Undo" Executed="Executed_Undo" CanExecute="CanExecute_Undo"/>
1212
<CommandBinding Command="ApplicationCommands.Redo" Executed="Executed_Redo" CanExecute="CanExecute_Redo"/>
@@ -169,41 +169,41 @@
169169
</StatusBarItem>
170170
</StatusBar>
171171
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="198" Margin="10,50,0,0" VerticalAlignment="Top" Width="64">
172-
<Image x:Name="imgPalette" HorizontalAlignment="Left" Height="198" Margin="0,0,0,-30" VerticalAlignment="Top" Width="64" Stretch="Fill"/>
172+
<Image x:Name="paletteImage" HorizontalAlignment="Left" Height="198" Margin="0,0,0,-30" VerticalAlignment="Top" Width="64" Stretch="Fill" MouseLeftButtonDown="PaletteLeftButtonDown" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
173173
</Border>
174174
<Grid>
175175
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="256" Margin="89,50,0,0" VerticalAlignment="Top" Width="256">
176-
<Image x:Name="imgGrid" HorizontalAlignment="Left" Height="256" Margin="-1" VerticalAlignment="Top" Width="256" Stretch="Fill"/>
176+
<Image x:Name="gridImage" HorizontalAlignment="Left" Height="256" Margin="-1" VerticalAlignment="Top" Width="256" Stretch="Fill" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
177177
</Border>
178178
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="256" Margin="89,50,0,0" VerticalAlignment="Top" Width="256">
179-
<Image x:Name="imgCanvas" HorizontalAlignment="Left" Height="256" Margin="-1" VerticalAlignment="Top" Width="256" Stretch="Fill"/>
179+
<Image x:Name="drawingImage" HorizontalAlignment="Left" Height="256" Margin="-1" VerticalAlignment="Top" Width="256" Stretch="Fill" MouseMove="DrawingAreaMouseMoved" MouseRightButtonDown="DrawingRightButtonDown" MouseLeftButtonDown="DrawingLeftButtonDown" MouseDown="DrawingMiddleButtonDown" MouseUp="DrawingMouseUp" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
180180
</Border>
181181
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="256" Margin="89,50,0,0" VerticalAlignment="Top" Width="256">
182-
<Image x:Name="imgOutline" IsHitTestVisible="False" HorizontalAlignment="Left" Height="256" Margin="-1" VerticalAlignment="Top" Width="256" Stretch="Fill" IsEnabled="False"/>
182+
<Image x:Name="outlineImage" IsHitTestVisible="False" HorizontalAlignment="Left" Height="256" Margin="-1" VerticalAlignment="Top" Width="256" Stretch="Fill" IsEnabled="False" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
183183
</Border>
184184
<Rectangle x:Name="recPreviewBg2x" Fill="Black" HorizontalAlignment="Left" Height="32" Margin="375,50,0,0" VerticalAlignment="Top" Width="32"/>
185185
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="32" Margin="375,50,0,0" VerticalAlignment="Top" Width="32">
186-
<Image x:Name="imgPreview2x" HorizontalAlignment="Left" Height="32" Margin="-1" VerticalAlignment="Top" Width="32" Stretch="Fill"/>
186+
<Image x:Name="imgPreview2x" HorizontalAlignment="Left" Height="32" Margin="-1" VerticalAlignment="Top" Width="32" Stretch="Fill" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
187187
</Border>
188188
<Rectangle x:Name="recPreviewBg1x" Fill="Black" HorizontalAlignment="Left" Height="16" Margin="425,50,0,0" VerticalAlignment="Top" Width="16"/>
189189
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="16" Margin="425,50,0,0" VerticalAlignment="Top" Width="16">
190-
<Image x:Name="imgPreview1x" HorizontalAlignment="Left" Height="16" Margin="-1" VerticalAlignment="Top" Width="16" Stretch="Fill"/>
190+
<Image x:Name="imgPreview1x" HorizontalAlignment="Left" Height="16" Margin="-1" VerticalAlignment="Top" Width="16" Stretch="Fill" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
191191
</Border>
192192
<Rectangle x:Name="recPreviewBg2xb" Fill="Gray" HorizontalAlignment="Left" Height="32" Margin="375,100,0,0" VerticalAlignment="Top" Width="32"/>
193193
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="32" Margin="375,100,0,0" VerticalAlignment="Top" Width="32">
194-
<Image x:Name="imgPreview2xb" HorizontalAlignment="Left" Height="32" Margin="-1" VerticalAlignment="Top" Width="32" Stretch="Fill"/>
194+
<Image x:Name="imgPreview2xb" HorizontalAlignment="Left" Height="32" Margin="-1" VerticalAlignment="Top" Width="32" Stretch="Fill" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
195195
</Border>
196196
<Rectangle x:Name="recPreviewBg1xb" Fill="Gray" HorizontalAlignment="Left" Height="16" Margin="425,100,0,0" VerticalAlignment="Top" Width="16"/>
197197
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="16" Margin="425,100,0,0" VerticalAlignment="Top" Width="16">
198-
<Image x:Name="imgPreview1xb" HorizontalAlignment="Left" Height="16" Margin="-1" VerticalAlignment="Top" Width="16" Stretch="Fill"/>
198+
<Image x:Name="imgPreview1xb" HorizontalAlignment="Left" Height="16" Margin="-1" VerticalAlignment="Top" Width="16" Stretch="Fill" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
199199
</Border>
200200
<Rectangle x:Name="recPreviewBg2xc" Fill="White" HorizontalAlignment="Left" Height="32" Margin="375,150,0,0" VerticalAlignment="Top" Width="32"/>
201201
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="32" Margin="375,150,0,0" VerticalAlignment="Top" Width="32">
202-
<Image x:Name="imgPreview2xc" HorizontalAlignment="Left" Height="32" Margin="-1" VerticalAlignment="Top" Width="32" Stretch="Fill"/>
202+
<Image x:Name="imgPreview2xc" HorizontalAlignment="Left" Height="32" Margin="-1" VerticalAlignment="Top" Width="32" Stretch="Fill" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
203203
</Border>
204204
<Rectangle x:Name="recPreviewBg1xc" Fill="White" HorizontalAlignment="Left" Height="16" Margin="425,150,0,0" VerticalAlignment="Top" Width="16"/>
205205
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="16" Margin="425,150,0,0" VerticalAlignment="Top" Width="16">
206-
<Image x:Name="imgPreview1xc" HorizontalAlignment="Left" Height="16" Margin="-1" VerticalAlignment="Top" Width="16" Stretch="Fill"/>
206+
<Image x:Name="imgPreview1xc" HorizontalAlignment="Left" Height="16" Margin="-1" VerticalAlignment="Top" Width="16" Stretch="Fill" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
207207
</Border>
208208
<Button x:Name="btnScrollUp" Click="OnScrollButtonUpClicked" Content="/\" HorizontalAlignment="Left" Margin="388,252,0,0" VerticalAlignment="Top" Width="24"/>
209209
<Button x:Name="btnScrollDown" Click="OnScrollButtonDownClicked" Content="\/" HorizontalAlignment="Left" Margin="388,274,0,0" VerticalAlignment="Top" Width="24"/>

0 commit comments

Comments
 (0)