我正在尝试使用 SkiaSharp SKDocument 类在 xamarin 中编写 PDF,但在 skCanvas.drawImage() 中使用“MyProject.Droid/Resources/Drawable”中的图像时遇到问题。我将图像存储在 ImageSource 中,我需要将其转换为 SKImage,但是如何转换?
SKDocument sKDocument =
SKDocument.CreatePdf("/storage/emulated/0/Teste5.pdf");
var canvas = sKDocument.BeginPage(2480, 3508);
canvas.Clear(SKColors.White);
Image image = new Image();
image.Source = "MyImage.png";
canvas.DrawImage();
Run Code Online (Sandbox Code Playgroud)
我需要将图像投射到 Skimage 才能绘制它