shape: Add circle radius parameter.
This commit is contained in:
parent
15102c1fe9
commit
d03d63ecae
|
@ -328,9 +328,10 @@ end
|
||||||
-- @param cr A cairo context
|
-- @param cr A cairo context
|
||||||
-- @tparam number width The shape width
|
-- @tparam number width The shape width
|
||||||
-- @tparam number height The shape height
|
-- @tparam number height The shape height
|
||||||
function module.circle(cr, width, height)
|
-- @tparam[opt=math.min(width height) / 2)] number radius The radius
|
||||||
local size = math.min(width, height) / 2
|
function module.circle(cr, width, height, radius)
|
||||||
cr:arc(width / 2, height / 2, size, 0, 2*math.pi)
|
radius = radius or math.min(width, height) / 2
|
||||||
|
cr:arc(width / 2, height / 2, radius, 0, 2*math.pi)
|
||||||
cr:close_path()
|
cr:close_path()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue