@@ -380,6 +380,17 @@ void ErasePixel(MouseEventArgs e)
380
380
canvasBitmap . WritePixels ( rect , ColorData , 4 , 0 ) ;
381
381
}
382
382
383
+ void ErasePixel ( int x , int y )
384
+ {
385
+ byte [ ] ColorData = { 0 , 0 , 0 , 0 } ; // B G R
386
+
387
+ if ( x < 0 || x > canvasResolutionX - 1 ) return ;
388
+ if ( y < 0 || y > canvasResolutionY - 1 ) return ;
389
+
390
+ Int32Rect rect = new Int32Rect ( x , y , 1 , 1 ) ;
391
+ canvasBitmap . WritePixels ( rect , ColorData , 4 , 0 ) ;
392
+ }
393
+
383
394
void PickPalette ( MouseEventArgs e )
384
395
{
385
396
byte [ ] ColorData = { 0 , 0 , 0 , 0 } ; // B G R !
@@ -474,6 +485,12 @@ void DrawingLeftButtonDown(object sender, MouseButtonEventArgs e)
474
485
{
475
486
UpdateOutline ( ) ;
476
487
}
488
+
489
+ // mirror
490
+ if ( chkMirrorX . IsChecked == true )
491
+ {
492
+ DrawPixel ( canvasResolutionX - x - 1 , y ) ;
493
+ }
477
494
}
478
495
479
496
void DrawingMouseUp ( object sender , MouseButtonEventArgs e )
@@ -490,10 +507,20 @@ void DrawingAreaMouseMoved(object sender, MouseEventArgs e)
490
507
if ( e . LeftButton == MouseButtonState . Pressed )
491
508
{
492
509
DrawPixel ( x , y ) ;
510
+ // mirror
511
+ if ( chkMirrorX . IsChecked == true )
512
+ {
513
+ DrawPixel ( canvasResolutionX - x - 1 , y ) ;
514
+ }
493
515
}
494
516
else if ( e . RightButton == MouseButtonState . Pressed )
495
517
{
496
- ErasePixel ( e ) ;
518
+ ErasePixel ( x , y ) ;
519
+ // mirror
520
+ if ( chkMirrorX . IsChecked == true )
521
+ {
522
+ ErasePixel ( canvasResolutionX - x - 1 , y ) ;
523
+ }
497
524
}
498
525
else if ( e . MiddleButton == MouseButtonState . Pressed )
499
526
{
@@ -502,10 +529,12 @@ void DrawingAreaMouseMoved(object sender, MouseEventArgs e)
502
529
503
530
ShowMousePos ( x , y ) ;
504
531
ShowMousePixelColor ( x , y ) ;
532
+ // outline
505
533
if ( chkOutline . IsChecked == true )
506
534
{
507
535
UpdateOutline ( ) ;
508
536
}
537
+
509
538
}
510
539
511
540
void ShowMousePos ( int x , int y )
0 commit comments