绘图
string file = "C:\\Users\\niexiong\\Desktop\\Snipaste_1.bmp";
SKBitmap pic = SKBitmap.Decode(file);
SKCanvas canvas = new SKCanvas(pic);
canvas.DrawCircle(100, 100, 50, new SKPaint() { Color = SKColors.Red, Style = SKPaintStyle.Fill });
using var stream = File.OpenWrite("test.png");
pic.Encode(SKEncodedImageFormat.Png, 100).SaveTo(stream);
SKBitmap 转 Bitmap
pic = SKBitmap.Decode(file);
using var stream1 = new MemoryStream();
pic.Encode(stream1, SKEncodedImageFormat.Png, 100);
Bitmap bitmap = new Bitmap(stream1);
bitmap.Save("bitmap.png", System.Drawing.Imaging.ImageFormat.Png);
Bitmap 转 SKBitmap
bitmap = new Bitmap("bitmap.png");
using var stream2 = new MemoryStream();
bitmap.Save(stream2, System.Drawing.Imaging.ImageFormat.Bmp);
stream2.Position = 0;
using var codec = SKCodec.Create(stream2);
using var surface = SKSurface.Create(new SKImageInfo(codec.Info.Width, codec.Info.Height));
using var canvas2 = surface.Canvas;
canvas2.DrawBitmap(SKBitmap.Decode(codec), new SKRect(0, 0, codec.Info.Width, codec.Info.Height));
using var image = surface.Snapshot();
SKBitmap sss = SKBitmap.FromImage(image);
using var stream3 = File.OpenWrite("bitmapToSkbitmap.png");
sss.Encode(SKEncodedImageFormat.Png, 100).SaveTo(stream3);