【发布时间】:2017-07-28 11:01:20
【问题描述】:
我正在尝试使用我的 xamarin 表单解决方案中的skia 图形库加载和渲染图像。当我尝试渲染图像(运行 android 项目)时,出现以下错误:
Value cannot be null. Parameter name: codec
代码如下:
void OnPainting(object sender, SKPaintSurfaceEventArgs e)
{
var surface = e.Surface;
var canvas = surface.Canvas;
canvas.Clear(SKColors.White);
var filename = "test.jpg";
using (var stream = new SKFileStream(filename))
using (var bitmap = SKBitmap.Decode(stream)) // the error occurs on this line
using (var paint = new SKPaint())
{
canvas.DrawBitmap(bitmap, SKRect.Create(200, 200), paint);
}
}
我在网上找不到任何适用于 xamarin 的示例代码。任何示例代码或链接将不胜感激。
提前致谢
【问题讨论】:
标签: xamarin xamarin.android xamarin.forms skia skiasharp