1 define([ 'util/ensureCallback' ], function (ensureCallback) {
2 var IMAGE_SRC = 'assets/html5-logo.png';
4 function ImageSource(img) {
17 ImageSource.prototype.getImage = function getImage(frameIndex) {
21 ImageSource.prototype.drawToCanvas = function drawToCanvas(context, dx, dy, frameIndex) {
22 context.drawImage(this.img, dx, dy);
25 ImageSource.prototype.getFrameInfo = function getFrameInfo(frameIndex) {
26 return this.frameInfo;
29 return function image(callback) {
30 callback = ensureCallback(callback);
32 var img = new window.Image();
33 img.onload = function () {
34 var imageSource = new ImageSource(img);
35 callback(null, imageSource);