diff options
Diffstat (limited to 'apps/plugins/lua/include_lua/draw_poly.lua')
-rw-r--r-- | apps/plugins/lua/include_lua/draw_poly.lua | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/plugins/lua/include_lua/draw_poly.lua b/apps/plugins/lua/include_lua/draw_poly.lua index 23e02d0955..d5bc83ae39 100644 --- a/apps/plugins/lua/include_lua/draw_poly.lua +++ b/apps/plugins/lua/include_lua/draw_poly.lua | |||
@@ -46,7 +46,9 @@ local _poly = {} do | |||
46 | local flood_fill | 46 | local flood_fill |
47 | 47 | ||
48 | -- draws a non-filled figure based on points in t-points | 48 | -- draws a non-filled figure based on points in t-points |
49 | local function polyline(img, x, y, t_pts, color, bClosed, bClip, scale_x, scale_y) | 49 | local function polyline(img, x, y, t_pts, color, bClosed, bClip, scale_x, scale_y, b_size_only) |
50 | local draw_fn = _line | ||
51 | if b_size_only == true then draw_fn = function() end end | ||
50 | scale_x = scale_x or 1 | 52 | scale_x = scale_x or 1 |
51 | scale_y = scale_y or 1 | 53 | scale_y = scale_y or 1 |
52 | 54 | ||
@@ -69,8 +71,7 @@ local _poly = {} do | |||
69 | else | 71 | else |
70 | pt2 = {t_pts[i] * scale_x, t_pts[i + 1] * scale_y} | 72 | pt2 = {t_pts[i] * scale_x, t_pts[i + 1] * scale_y} |
71 | end-- first and last point | 73 | end-- first and last point |
72 | 74 | draw_fn(img, pt1[1] + x, pt1[2] + y, pt2[1] + x, pt2[2] + y, color, bClip) | |
73 | _line(img, pt1[1] + x, pt1[2] + y, pt2[1] + x, pt2[2] + y, color, bClip) | ||
74 | if pt1[1] > max_x then max_x = pt1[1] end | 75 | if pt1[1] > max_x then max_x = pt1[1] end |
75 | if pt1[2] > max_y then max_y = pt1[2] end | 76 | if pt1[2] > max_y then max_y = pt1[2] end |
76 | end | 77 | end |
@@ -80,12 +81,12 @@ local _poly = {} do | |||
80 | end | 81 | end |
81 | 82 | ||
82 | -- draws a closed figure based on points in t_pts | 83 | -- draws a closed figure based on points in t_pts |
83 | _poly.polygon = function(img, x, y, t_pts, color, fillcolor, bClip, scale_x, scale_y) | 84 | _poly.polygon = function(img, x, y, t_pts, color, fillcolor, bClip, scale_x, scale_y, b_size_only) |
84 | scale_x = scale_x or 1 | 85 | scale_x = scale_x or 1 |
85 | scale_y = scale_y or 1 | 86 | scale_y = scale_y or 1 |
86 | if #t_pts < 2 then error("not enough points", 3) end | 87 | if #t_pts < 2 then error("not enough points", 3) end |
87 | 88 | ||
88 | if fillcolor then | 89 | if fillcolor and b_size_only ~= true then |
89 | flood_fill = flood_fill or require("draw_floodfill") | 90 | flood_fill = flood_fill or require("draw_floodfill") |
90 | local x_min, x_max = 0, 0 | 91 | local x_min, x_max = 0, 0 |
91 | local y_min, y_max = 0, 0 | 92 | local y_min, y_max = 0, 0 |
@@ -119,7 +120,7 @@ local _poly = {} do | |||
119 | _NIL, _NIL, _NIL, _NIL, bClip, BSAND, fillcolor) | 120 | _NIL, _NIL, _NIL, _NIL, bClip, BSAND, fillcolor) |
120 | end | 121 | end |
121 | 122 | ||
122 | polyline(img, x, y, t_pts, color, true, bClip, scale_x, scale_y) | 123 | return polyline(img, x, y, t_pts, color, true, bClip, scale_x, scale_y, b_size_only) |
123 | end | 124 | end |
124 | 125 | ||
125 | -- expose internal functions to the outside through _poly table | 126 | -- expose internal functions to the outside through _poly table |