Example #1
0
 public void Execute(object parameter)
 {
     _simplePaintViewModel.ImageSave.Clear();
     _simplePaintViewModel.GetFirstImage().CopyPixels(_simplePaintViewModel.GetImageData(), _simplePaintViewModel.GetStride(), 0);
     _simplePaintViewModel.Imagesource = _simplePaintViewModel.GetFirstImage();
     _simplePaintViewModel.ImageSave.Push(new TempImage(_simplePaintViewModel.Imagesource, _simplePaintViewModel.GetStride()));
     _simplePaintViewModel.Imagesource = BitmapSource.Create(_simplePaintViewModel.Imagesource.PixelWidth, _simplePaintViewModel.Imagesource.PixelHeight, _simplePaintViewModel.Imagesource.DpiX,
                                                             _simplePaintViewModel.Imagesource.DpiY, _simplePaintViewModel.Imagesource.Format, _simplePaintViewModel.Imagesource.Palette, _simplePaintViewModel.GetImageData(), _simplePaintViewModel.Imagesource.PixelWidth * (_simplePaintViewModel.Imagesource.Format.BitsPerPixel / 8));
 }
Example #2
0
 public void Execute(object parameter)
 {
     if (_simplePaintViewModel.ImageSave.Count - 1 >= 0)
     {
         if (_simplePaintViewModel.ImageSave.Count - 1 == 0)
         {
             _simplePaintViewModel.ImageSave.Clear();
             _simplePaintViewModel.GetFirstImage().CopyPixels(_simplePaintViewModel.GetImageData(), _simplePaintViewModel.GetStride(), 0);
             _simplePaintViewModel.Imagesource = _simplePaintViewModel.GetFirstImage();
             _simplePaintViewModel.ImageSave.Push(new TempImage(_simplePaintViewModel.Imagesource, _simplePaintViewModel.GetStride()));
             return;
         }
         _simplePaintViewModel.ImageSave.Pop();
         var tempImage = _simplePaintViewModel.ImageSave.Peek();
         _simplePaintViewModel.SetImageData(tempImage.TempPixelData);
         _simplePaintViewModel.Imagesource = BitmapSource.Create(tempImage.Tempbmp.PixelWidth, tempImage.Tempbmp.PixelHeight, tempImage.Tempbmp.DpiX, tempImage.Tempbmp.DpiY, tempImage.Tempbmp.Format, tempImage.Tempbmp.Palette, _simplePaintViewModel.GetImageData(), _simplePaintViewModel.GetStride());
     }
 }