summaryrefslogtreecommitdiffstats
path: root/src/element.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/element.js')
-rwxr-xr-xsrc/element.js11
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))