我正在尝试下载一些图像以用作谷歌地图的自定义图块。我正在使用以下代码将图块下载为字节 []:
using (WebClient webClient = new WebClient())
{
var response = webClient.DownloadData(new Uri(url));
return response;
}
然后我将 byte[] 直接保存到我的 SQLite 数据库中:
TileData t = new TileData();
t.X = x;
t.Y = y;
t.Zoom = zoom;
t.Data = byteData;
conn.Insert(t);
最后,在重写的 GetTile 方法中的自定义 TileProvider 类中,我使用保存在 SQLite db 中的 byte[] 创建了一个图块:
public Tile GetTile(int x, int y, int zoom)
{
byte[] bitmap = RetreiveImage(x, y, zoom);
Tile tile = new Tile(_width, _height, bitmap);
return tile;
}
我的问题是,当为叠加检索图块时,我收到错误消息:
“[skia] 无法创建带有消息‘未实现’的图像解码器”
我一直在努力找出问题所在。我假设我的 byte[] 格式无效,但我不知道为什么。
我正在下载的图像是 .jfif,尽管据我所知 .jfif 与 .jpeg 相同,所以这应该不是问题。