Canvas:fillcircle(x, y, radius, [ brush ] ) method


Draws a filled circle on the Canvas

Parameters

x

A number representing the x coordinate of the upper left corner (zero means the left side of the Canvas)

y

A number representing the y coordinate of the upper left corner (zero means the top side of the Canvas)

radius

A number representing the radius of the fillcircle

[ brush ]

An optional value that can represent any of the following values :

  • A RGBA color, as an integer value
  • LinearGradient : The line will be drawn with a colored linear gradient
  • RadialGradient : The line will be drawn with a colored radial gradient
  • Image : The line will be drawn with a picture pattern.
When this parameter is omitted, the rectangle is drawn using the current Canvas.color

Return value

This function returns no value.

Example

local ui = require "ui" require "canvas" -- create a simple Window local win = ui.Window("Canvas.fillcircle() sample", "fixed", 500, 400) -- create a Canvas local canvas = ui.Canvas(win) canvas.align = "all" canvas.bgcolor = 0x000000FF local w = canvas.width local h = canvas.height function canvas:onPaint() local radial = canvas:RadialGradient { [0] = math.random(0xFFFFFFFF), [1] = math.random(0xFFFFFFFF) } radial.radius = { 400, 400 } self:fillcircle(math.random(w), math.random(h), math.random(150), radial) end win:show() -- update user interface repeat ui.update() until not win.visible