From 7b731b98cc68cb4a3ea74037b16bfad6dd112663 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 10 Dec 2018 15:06:04 +0100 Subject: [PATCH] added line --- svg.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/svg.lua b/svg.lua index 51988e3..23aab1f 100644 --- a/svg.lua +++ b/svg.lua @@ -141,4 +141,24 @@ function svg:Ellipse(cx, cy, rx, ry, stroke, strokeWidth, fill, transform) fill = fill or self.fill, transform = transform or "" }) +end + +-- function ro create a line +-- c1: number => Horizontal postion for point 1 +-- y1: number => Vertical position for point 1 +-- x2: number => Horizontal position for point 2 +-- y2: number => Vertical position for point 2 +-- stroke: string => lines color +-- strokeWidth: string => lines width +-- fill: string => fill color +function svg:Line(x1, y1, x2, y2, stroke, strokeWidth, fill) + return self.Element:create("line", { + x1 = r or 15, + y1 = r or 15, + x2 = cx or 50, + y2 = cy or 45, + stroke = stroke or self.stroke, + ["stroke-width"] = strokeWidth or 1, + fill = fill or self.fill + }) end \ No newline at end of file -- 2.51.2