1 pv.SvgScene.image = function(scenes) {
  2   var e = scenes.$g.firstChild;
  3   for (var i = 0; i < scenes.length; i++) {
  4     var s = scenes[i];
  5 
  6     /* visible */
  7     if (!s.visible) continue;
  8 
  9     /* fill */
 10     e = this.fill(e, scenes, i);
 11 
 12     /* image */
 13     if (s.image) {
 14       e = this.expect(e, "foreignObject", {
 15           "cursor": s.cursor,
 16           "x": s.left,
 17           "y": s.top,
 18           "width": s.width,
 19           "height": s.height
 20         });
 21       var c = e.firstChild || e.appendChild(document.createElementNS(this.xhtml, "canvas"));
 22       c.$scene = {scenes:scenes, index:i};
 23       c.style.width = s.width;
 24       c.style.height = s.height;
 25       c.width = s.imageWidth;
 26       c.height = s.imageHeight;
 27       c.getContext("2d").putImageData(s.image, 0, 0);
 28     } else {
 29       e = this.expect(e, "image", {
 30           "preserveAspectRatio": "none",
 31           "cursor": s.cursor,
 32           "x": s.left,
 33           "y": s.top,
 34           "width": s.width,
 35           "height": s.height
 36         });
 37       e.setAttributeNS(this.xlink, "href", s.url);
 38     }
 39     e = this.append(e, scenes, i);
 40 
 41     /* stroke */
 42     e = this.stroke(e, scenes, i);
 43   }
 44   return e;
 45 };
 46