Sha256: b71b6ab474759495ca3d1d2148417992ce1f4e523f1ac33c70162baa3ba7ca88

Contents?: true

Size: 1.15 KB

Versions: 23

Compression:

Stored size: 1.15 KB

Contents

pv.SvgScene.image = function(scenes) {
  var e = scenes.$g.firstChild;
  for (var i = 0; i < scenes.length; i++) {
    var s = scenes[i];

    /* visible */
    if (!s.visible) continue;

    /* fill */
    e = this.fill(e, scenes, i);

    /* image */
    if (s.image) {
      e = this.expect(e, "foreignObject", {
          "cursor": s.cursor,
          "x": s.left,
          "y": s.top,
          "width": s.width,
          "height": s.height
        });
      var c = e.firstChild || e.appendChild(document.createElementNS(this.xhtml, "canvas"));
      c.$scene = {scenes:scenes, index:i};
      c.style.width = s.width;
      c.style.height = s.height;
      c.width = s.imageWidth;
      c.height = s.imageHeight;
      c.getContext("2d").putImageData(s.image, 0, 0);
    } else {
      e = this.expect(e, "image", {
          "preserveAspectRatio": "none",
          "cursor": s.cursor,
          "x": s.left,
          "y": s.top,
          "width": s.width,
          "height": s.height
        });
      e.setAttributeNS(this.xlink, "href", s.url);
    }
    e = this.append(e, scenes, i);

    /* stroke */
    e = this.stroke(e, scenes, i);
  }
  return e;
};

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rubyvis-0.6.0 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.5.2 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.5.1 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.5.0 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.4.1 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.4.0 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.3.6 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.3.5 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.3.4 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.3.3 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.3.2 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.3.1 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.3.0 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.2.2 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.2.1 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.2.0 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.1.7 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.1.6 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.1.5 vendor/protovis/src/scene/SvgImage.js
rubyvis-0.1.4 vendor/protovis/src/scene/SvgImage.js