From 4a44b0dc8146e79169139f26c1221a9e2e4fde9e Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Tue, 26 Jan 2016 02:36:42 -0500 Subject: [PATCH] gears.shape: Add hexagon shape --- lib/gears/shape.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/gears/shape.lua b/lib/gears/shape.lua index 3858c0f4e..453e9753e 100644 --- a/lib/gears/shape.lua +++ b/lib/gears/shape.lua @@ -125,6 +125,21 @@ function module.arrow(cr, width, height, head_width, shaft_width, shaft_length) cr:close_path() end +--- A squeezed hexagon filling the rectangle +-- @param cr A cairo context +-- @tparam number width The shape with +-- @tparam number height The shape height +function module.hexagon(cr, width, height) + cr:move_to(height/2,0) + cr:line_to(width-height/2,0) + cr:line_to(width,height/2) + cr:line_to(width-height/2,height) + cr:line_to(height/2,height) + cr:line_to(0,height/2) + cr:line_to(height/2,0) + cr:close_path() +end + --- Ajust the shape using a transformation object -- -- Apply various transformations to the shape