I must be missing something. I started with the FingerPainting part of the TouchTrackingEffectDemos. After drawing something, I want to save it so I added a Save Button (just like there is a Clear Button). The Save button is supposed to save the drawing to my device but all I get is a blank white jpg. I am using Snapshot to capture the image. I suspect that it is not working the way I expect.
Here is my code for the Save. Any insight into how to save the drawing to a file is much appreciated!
`
void OnSaveButtonClicked(object sender, EventArgs args)
{
int width = (int)canvasView.CanvasSize.Width;
int height = (int)canvasView.CanvasSize.Height;
var info = new SKImageInfo(width, height);
var item = (FingerPaintPage)((Button)sender).BindingContext; using (var surface = SKSurface.Create(width, height, SKImageInfo.PlatformColorType, SKAlphaType.Premul)) { SKData skData = surface.Snapshot().Encode(); IFolder folder = FileSystem.Current.LocalStorage; string path = folder.Path; string fileout = path + "/outfile.jpg"; string fileout2 = path + "/outfile2.jpg"; // Plan A) using (Stream stream2 = File.OpenWrite(fileout)) { skData.SaveTo(stream2); } // Plan B) SKBitmap bitmap = new SKBitmap(width, height); // create an image and then get the PNG (or any other) encoded data using (var image = SKImage.FromBitmap(bitmap)) using (var data = image.Encode(SKEncodedImageFormat.Jpeg, 100)) { // save the data to a stream using (var stream = File.OpenWrite(fileout2)) { data.SaveTo(stream); } } } }`