Paint.circle
From codeTank
Contents |
Description
paint.circle will draw a circle in a window. It must be used on a paint object, which is passed to the onpaint event when a window needs to be redrawn.
Arguments
pnt:circle(centerx, centery, radius) pnt:circle(centerx, centery, radius, color) pnt:circle(centerx, centery, radius, color, fill) pnt:circle(centerx, centery, radius, color, fill, thickness)
centerx, centery, and radius all define the properties of the circle. Please note that these are different coordinates than what's used for paint.ellipse - for an ellipse, it's treated like a rectangle. But a circle's coordinates are based on the center - not the upper-left point.
color is the border color, which defaults to black if none is specified. You may either choose a border color using rgb, or set it to false to not draw any border.
fill is the fill color, which defaults to transparent. If set to a color (using rgb), it will define what the circle is filled with.
thickness sets the thickness of the border, in pixels. If the border is transparent, then this parameter doesn't matter. The default value is 0, which means it will draw a border exactly 1 pixel thick.
Returns
paint.circle doesn't return anything.
Example
wnd = window.create{ width = 300, height = 300, onpaint = function(wnd, pnt) -- draws a black circle pnt:circle(100, 100, 90) -- draws a solid red circle with no border pnt:circle(150, 150, 20, false, rgb(255, 0, 0)) -- draws a solid green circle, with a gray thick border pnt:circle(100, 200, 60, rgb(120, 120, 120), rgb(0, 255, 0), 5) end, } while window.getcount() > 0 do window.pumpmessages() end

