@@ -119,7 +119,6 @@ void Start()
119
119
outlineBitmap = new WriteableBitmap ( canvasResolutionX , canvasResolutionY , dpiX , dpiY , PixelFormats . Bgra32 , null ) ;
120
120
outlineImage . Source = outlineBitmap ;
121
121
122
-
123
122
// build drawing area
124
123
drawingImage = imgCanvas ;
125
124
RenderOptions . SetBitmapScalingMode ( drawingImage , BitmapScalingMode . NearestNeighbor ) ;
@@ -129,6 +128,12 @@ void Start()
129
128
canvasBitmap = new WriteableBitmap ( canvasResolutionX , canvasResolutionY , dpiX , dpiY , PixelFormats . Bgra32 , null ) ;
130
129
drawingImage . Source = canvasBitmap ;
131
130
131
+ // setup preview area
132
+ RenderOptions . SetBitmapScalingMode ( imgPreview1x , BitmapScalingMode . NearestNeighbor ) ;
133
+ imgPreview1x . Source = canvasBitmap ;
134
+ RenderOptions . SetBitmapScalingMode ( imgPreview2x , BitmapScalingMode . NearestNeighbor ) ;
135
+ imgPreview2x . Source = canvasBitmap ;
136
+
132
137
// drawing events
133
138
drawingImage . MouseMove += new MouseEventHandler ( DrawingAreaMouseMoved ) ;
134
139
drawingImage . MouseLeftButtonDown += new MouseButtonEventHandler ( DrawingLeftButtonDown ) ;
@@ -499,7 +504,11 @@ void DrawingLeftButtonDown(object sender, MouseButtonEventArgs e)
499
504
{
500
505
// undo test
501
506
undoBufferBitmap [ currentUndoIndex ++ ] = canvasBitmap . Clone ( ) ;
502
- //Console.WriteLine("save undo " + currentUndoIndex);
507
+
508
+ // FIXME if undobuffer enabled above, sometimes Exception thrown: 'System.IndexOutOfRangeException' in PixelArtTool.exe
509
+ // An unhandled exception of type 'System.IndexOutOfRangeException' occurred in PixelArtTool.exe
510
+ // Index was outside the bounds of the array.
511
+ // Console.WriteLine(drawingImage);
503
512
504
513
int x = ( int ) ( e . GetPosition ( drawingImage ) . X / canvasScaleX ) ;
505
514
int y = ( int ) ( e . GetPosition ( drawingImage ) . Y / canvasScaleX ) ;
0 commit comments