1
votes

I'm currently using the WriteableBitmapEx extension for my writeable Bitmap class. So far everything works now I'm doing this in a WinRT project. I run this code to merge the bitmaps together.

 Windows.Storage.Pickers.FileSavePicker save = new Windows.Storage.Pickers.FileSavePicker();
 save.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop;
 save.DefaultFileExtension = ".png";
 save.FileTypeChoices.Add("PNG", new string[] { ".png" });
 StorageFile filesave = await save.PickSaveFileAsync();
 IOutputStream ab = await filesave.OpenAsync(FileAccessMode.ReadWrite);

 if (ab != null)
 {
      //   await _inkManager.SaveAsync(ab);

      var imageUri = new Uri("http://i.imgur.com/rbiLg5Z.gif");
      var fullSizeBitmap = new Windows.UI.Xaml.Media.Imaging.BitmapImage(imageUri);
      // image.Source = fullSizeBitmap;

      var file = await WebFile.SaveAsync(imageUri);
      WriteableBitmap myTempImage = await new WriteableBitmap(1, 1).LoadAsync(file);

      // error!
      myImage.Blit(new Rect(0, 0, 20, 28), myTempImage, new Rect(0, 0, 20, 38));

Now on the line of myImage.Blit I get an unhandled exception for access violation. I really truly don't understand what's going on or what I'm doing wrong. So an help would be appreciated.

1
Isn't there some code missing above? Add all of it and we might get this sorted :) - Iris Classon

1 Answers

2
votes

Most likely either the size of the source or target WriteableBitmap is smaller than the rectangle you pass. Alternatively there might be a bug in one of the methods you are using. Verify the PixelWidth/PixelHeight of the bitmaps you are processing.