2 * Raphael Blur Plugin 0.1
4 * Copyright (c) 2009 Dmitry Baranovskiy (http://raphaeljs.com)
5 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
10 var reg = / progid:\S+Blur\([^\)]+\)/g;
11 Raphael.el.blur = function (size) {
12 var s = this.node.style,
14 f = f.replace(reg, "");
16 s.filter = f + " progid:DXImageTransform.Microsoft.Blur(pixelradius=" + (+size || 1.5) + ")";
17 s.margin = Raphael.format("-{0}px 0 0 -{0}px", Math.round(+size || 1.5));
24 var $ = function (el, attr) {
26 for (var key in attr) if (attr.hasOwnProperty(key)) {
27 el.setAttribute(key, attr[key]);
30 return doc.createElementNS("http://www.w3.org/2000/svg", el);
33 Raphael.el.blur = function (size) {
34 // Experimental. No WebKit support.
36 var fltr = $("filter"),
37 blur = $("feGaussianBlur");
38 fltr.id = "r" + (Raphael.idGenerator++).toString(36);
39 $(blur, {stdDeviation: +size || 1.5});
40 fltr.appendChild(blur);
41 this.paper.defs.appendChild(fltr);
43 $(this.node, {filter: "url(#" + fltr.id + ")"});
46 this._blur.parentNode.removeChild(this._blur);
49 this.node.removeAttribute("filter");