shape: Add circle radius parameter.

This commit is contained in:
Emmanuel Lepage Vallee 2016-08-02 01:20:50 -04:00
parent 15102c1fe9
commit d03d63ecae
1 changed files with 4 additions and 3 deletions

View File

@ -328,9 +328,10 @@ end
-- @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)
-- @tparam[opt=math.min(width height) / 2)] number radius The radius
function module.circle(cr, width, height, radius)
radius = radius or math.min(width, height) / 2
cr:arc(width / 2, height / 2, radius, 0, 2*math.pi)
cr:close_path()
end