public static BitmapInfo SaveToCache(SKBitmap bitmap, string fileName, bool dispose = true) { var info = new BitmapInfo { Width = bitmap.Width, Height = bitmap.Height, FileName = fileName }; using (var image = SKImage.FromBitmap(bitmap)) using (var data = image.Encode(SKEncodedImageFormat.Png, 100)) using (var stream = File.OpenWrite($"{Root}Cache/{fileName}.png")) data.SaveTo(stream); if (dispose) { bitmap.Dispose(); } return(info); }
public static SKBitmap LoadFromCache(BitmapInfo info) => LoadFromCache(info.FileName);