--- /dev/null
+Raphael.el.isAbsolute = true;
+Raphael.el.absolutely = function () {
+ if (this.type != "path") {
+ return this;
+ }
+ this.isAbsolute = true;
+ return this;
+};
+Raphael.el.relatively = function () {
+ if (this.type != "path") {
+ return this;
+ }
+ this.isAbsolute = false;
+ return this;
+};
+Raphael.el.moveTo = function (x, y) {
+ if (this.type != "path") {
+ return this;
+ }
+ var d = this.isAbsolute ? "M" : "m";
+ d += +parseFloat(x).toFixed(3) + " " + (+parseFloat(y).toFixed(3)) + " ";
+ this.attr({path: this.attrs.path + d});
+ return this;
+};
+Raphael.el.lineTo = function (x, y) {
+ if (this.type != "path") {
+ return this;
+ }
+ var d = this.isAbsolute ? "L" : "l";
+ d += +parseFloat(x).toFixed(3) + " " + (+parseFloat(y).toFixed(3)) + " ";
+ this.attr({path: this.attrs.path + d});
+ return this;
+};
+Raphael.el.arcTo = function (rx, ry, large_arc_flag, sweep_flag, x, y) {
+ if (this.type != "path") {
+ return this;
+ }
+ var d = this.isAbsolute ? "A" : "a";
+ d += [+parseFloat(rx).toFixed(3), +parseFloat(ry).toFixed(3), 0, large_arc_flag, sweep_flag, +parseFloat(x).toFixed(3), +parseFloat(y).toFixed(3)].join(" ");
+ this.attr({path: this.attrs.path + d});
+ return this;
+};
+Raphael.el.curveTo = function () {
+ if (this.type != "path") {
+ return this;
+ }
+ var args = Array.prototype.splice.call(arguments, 0, arguments.length),
+ d = [0, 0, 0, 0, "s", 0, "c"][args.length] || "";
+ if (this.isAbsolute) {
+ d = d.toUpperCase();
+ }
+ this.attr({path: this.attrs.path + d + args});
+ return this;
+};
+Raphael.el.qcurveTo = function () {
+ if (this.type != "path") {
+ return this;
+ }
+ var d = [0, 1, "t", 3, "q"][arguments.length],
+ args = Array.prototype.splice.call(arguments, 0, arguments.length);
+ if (this.isAbsolute) {
+ d = d.toUpperCase();
+ }
+ this.attr({path: this.attrs.path + d + args});
+ return this;
+};
+Raphael.el.addRoundedCorner = function (r, dir) {
+ if (this.type != "path") {
+ return this;
+ }
+ var rollback = this.isAbsolute,
+ o = this;
+ if (rollback) {
+ this.relatively();
+ rollback = function () {
+ o.absolutely();
+ };
+ } else {
+ rollback = function () {};
+ }
+ this.arcTo(r, r, 0, {"lu": 1, "rd": 1, "ur": 1, "dl": 1}[dir] || 0, r * (!!(dir.indexOf("r") + 1) * 2 - 1), r * (!!(dir.indexOf("d") + 1) * 2 - 1));
+ rollback();
+ return this;
+};
+Raphael.el.andClose = function () {
+ if (this.type != "path") {
+ return this;
+ }
+ this.attr({path: this.attrs.path + "z"});
+ return this;
+};
\ No newline at end of file
--- /dev/null
+Raphael.fn.star = function (cx, cy, rout, rin, n) {
+ rin = rin || rout * .5;
+ n = +n < 3 || !n ? 5 : n;
+ var points = ["M", cx, cy + rin, "L"],
+ R;
+ for (var i = 1; i < n * 2; i++) {
+ R = i % 2 ? rout : rin;
+ points = points.concat([+(cx + R * Math.sin(i * Math.PI / n)).toFixed(3), +(cy + R * Math.cos(i * Math.PI / n)).toFixed(3)]);
+ }
+ points.push("z");
+ return this.path(points);
+};
+Raphael.fn.flower = function (cx, cy, rout, rin, n) {
+ rin = rin || rout * .5;
+ n = +n < 3 || !n ? 5 : n;
+ var points = ["M", cx, cy + rin, "Q"],
+ R;
+ for (var i = 1; i < n * 2 + 1; i++) {
+ R = i % 2 ? rout : rin;
+ points = points.concat([+(cx + R * Math.sin(i * Math.PI / n)).toFixed(3), +(cy + R * Math.cos(i * Math.PI / n)).toFixed(3)]);
+ }
+ points.push("z");
+ return this.path(points);
+};
+Raphael.fn.spike = function (cx, cy, rout, rin, n) {
+ rin = rin || rout * .5;
+ n = +n < 3 || !n ? 5 : n;
+ var points = ["M", cx, cy - rout, "Q"],
+ R;
+ for (var i = 1; i < n * 2 + 1; i++) {
+ R = i % 2 ? rin : rout;
+ points = points.concat([cx + R * Math.sin(i * Math.PI / n - Math.PI), cy + R * Math.cos(i * Math.PI / n - Math.PI)]);
+ }
+ points.push("z");
+ return this.path(points);
+};
+Raphael.fn.polygon = function (cx, cy, r, n) {
+ n = +n < 3 || !n ? 5 : n;
+ var points = ["M", cx, cy - r, "L"],
+ R;
+ for (var i = 1; i < n; i++) {
+ points = points.concat([cx + r * Math.sin(i * Math.PI * 2 / n - Math.PI), cy + r * Math.cos(i * Math.PI * 2 / n - Math.PI)]);
+ }
+ points.push("z");
+ return this.path(points);
+};
+Raphael.fn.line = function (x1, y1, x2, y2) {
+ return this.path(["M", x1, y1, "L", x2, y2]);
+};
\ No newline at end of file