1 pv.SvgScene.image = function(scenes) {
  2   var g = this.group(scenes);
  3   for (var i = 0; i < scenes.length; i++) {
  4     var s = scenes[i];
  5 
  6     /* visible */
  7     if (!s.visible) continue;
  8 
  9     /* left, top */
 10     var gi = g;
 11     if (s.left || s.top) {
 12       gi = this.cache(s, "g", "g");
 13       gi.setAttribute("transform", "translate(" + s.left + "," + s.top + ")");
 14       g.appendChild(gi);
 15     }
 16 
 17     /* fill */
 18     var fill = pv.color(s.fillStyle);
 19     if (fill.opacity) {
 20       var rect = this.cache(s, "rect", "fill");
 21       rect.setAttribute("width", s.width);
 22       rect.setAttribute("height", s.height);
 23       rect.setAttribute("fill", fill.color);
 24       rect.setAttribute("fill-opacity", fill.opacity);
 25       gi.appendChild(rect);
 26     }
 27 
 28     /* image */
 29     var image = this.cache(s, "image", "image");
 30     image.setAttribute("preserveAspectRatio", "none");
 31     image.setAttribute("width", s.width);
 32     image.setAttribute("height", s.height);
 33     image.setAttributeNS(pv.ns.xlink, "href", s.url);
 34     this.listen(image, scenes, i);
 35     gi.appendChild(image);
 36 
 37     /* stroke */
 38     var stroke = pv.color(s.strokeStyle);
 39     if (stroke.opacity || s.cursor || s.title) {
 40       var rect = this.cache(s, "rect", "stroke");
 41       rect.setAttribute("width", s.width);
 42       rect.setAttribute("height", s.height);
 43       rect.setAttribute("fill", "none");
 44       rect.setAttribute("pointer-events", "all");
 45       rect.setAttribute("stroke", stroke.color);
 46       rect.setAttribute("stroke-opacity", stroke.opacity);
 47       rect.setAttribute("stroke-width", s.lineWidth);
 48       rect.setAttribute("cursor", s.cursor);
 49       this.listen(rect, scenes, i);
 50       gi.appendChild(this.title(rect, s));
 51     }
 52   }
 53 };
 54