From 990619db5ad9da44a32a8dab9a714fd4f1dc0921 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 9 Mar 2016 23:42:03 -0500 Subject: [PATCH] shape: Add circle shape --- lib/gears/shape.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/gears/shape.lua b/lib/gears/shape.lua index 9b6120b62..b5db76db6 100644 --- a/lib/gears/shape.lua +++ b/lib/gears/shape.lua @@ -231,6 +231,16 @@ function module.octogon(cr, width, height, corner_radius) cr:close_path() end +--- A circle shape +-- @param cr A cairo context +-- @tparam number width The shape width +-- @tparam number height The shape height +function module.circle(cr, width, height) + local size = math.min(width, height) / 2 + cr:arc(width / 2, height / 2, size, 0, 2*math.pi) + cr:close_path() +end + --- Ajust the shape using a transformation object -- -- Apply various transformations to the shape