diff options
author | wout <wout@impinc.co.uk> | 2014-02-05 00:06:36 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-02-05 00:06:36 +0100 |
commit | 9995944cb253ba93441e2d65cef415daa3541a52 (patch) | |
tree | 9d69d943841bec9a25039ee417d58a3125249723 /src/element.js | |
parent | 43fd91ccce8f9bce60ed7c566e32152be42f9774 (diff) | |
download | svg.js-9995944cb253ba93441e2d65cef415daa3541a52.tar.gz svg.js-9995944cb253ba93441e2d65cef415daa3541a52.zip |
Added loader on SVG.Image and included svg.pattern.js to the core
Diffstat (limited to 'src/element.js')
-rwxr-xr-x | src/element.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/element.js b/src/element.js index 01146ab..9ae2cd3 100755 --- a/src/element.js +++ b/src/element.js @@ -179,6 +179,17 @@ SVG.Element = SVG.invent({ this.attr('stroke', parseFloat(v) > 0 ? this._stroke : null) else if (a == 'stroke') this._stroke = v + + /* convert image fill and stroke to patterns */ + if (a == 'fill' || a == 'stroke') { + if (SVG.regex.isImage.test(v)) + v = this.doc().defs().image(v, 0, 0) + + if (v instanceof SVG.Image) + v = this.doc().defs().pattern(0, 0, function() { + this.add(v) + }) + } /* ensure full hex color */ if (SVG.Color.test(v) || SVG.Color.isRgb(v)) |