【发布时间】:2013-09-30 17:32:45
【问题描述】:
所以,我学会了如何使用 dart 在画布中绘制图像,如下所示:
///create the image element with given source
ImageElement myImage = new ImageElement(src:"myImage.png");
///load the image
myImage.onLoad.listen((event){
///when the image is loaded, draw it
myContext.drawImage(myImage, 0, 0);
});
但是,您如何在以后绘制图像?
例如,假设我有一个图像列表:
List<ImageElement> myImageList;
然后我想根据它们的来源一一加载我的所有图像元素。完成后,只要我想,我就可以去:
myContext.drawImage(myImageList[i], x, y);
此代码不在 onLoad.listen 方法中。
【问题讨论】:
标签: image caching canvas dart 2d-context-api