pixelart.js
function (x0, y0, radius, color, c)
    {
        _c = c || _c
        if (color)
        {
            _c.fillStyle = color
        }
        x0 *= _scale
        y0 *= _scale
        radius *= _scale
        let x = radius
        let y = 0
        let decisionOver2 = 1 - x   // Decision criterion divided by 2 evaluated at x=r, y=0

        while (x >= y)
        {
            box(-x + x0, y + y0, x * 2, 1)
            box(-y + x0, x + y0, y * 2, 1)
            box(-x + x0, -y + y0, x * 2, 1)
            box(-y + x0, -x + y0, y * 2, 1)
            y++
            if (decisionOver2 <= 0)
            {
                decisionOver2 += 2 * y + 1 // Change in decision criterion for y -> y+1
            } else
            {
                x--
                decisionOver2 += 2 * (y - x) + 1 // Change for y -> y+1, x -> x-1
            }
        }
    }
function (x0, y0, radius, color, c)
    {
        _c = c || _c
        if (color)
        {
            _c.fillStyle = color
        }
        x0 *= _scale
        y0 *= _scale
        radius *= _scale
        let x = radius
        let y = 0
        let decisionOver2 = 1 - x   // Decision criterion divided by 2 evaluated at x=r, y=0

        while (x >= y)
        {
            box(-x + x0, y + y0, x * 2, 1)
            box(-y + x0, x + y0, y * 2, 1)
            box(-x + x0, -y + y0, x * 2, 1)
            box(-y + x0, -x + y0, y * 2, 1)
            y++
            if (decisionOver2 <= 0)
            {
                decisionOver2 += 2 * y + 1 // Change in decision criterion for y -> y+1
            } else
            {
                x--
                decisionOver2 += 2 * (y - x) + 1 // Change for y -> y+1, x -> x-1
            }
        }
    }
function ( x0 , y0 , radius , color , c ) { _c = c || _c if ( color ) { _c . fillStyle = color } x0 *= _scale y0 *= _scale radius *= _scale let x = radius let y = 0 let decisionOver2 = 1 - x // Decision criterion divided by 2 evaluated at x=r, y=0 while ( x >= y ) { box ( - x + x0 , y + y0 , x * 2 , 1 ) box ( - y + x0 , x + y0 , y * 2 , 1 ) box ( - x + x0 , - y + y0 , x * 2 , 1 ) box ( - y + x0 , - x + y0 , y * 2 , 1 ) y ++ if ( decisionOver2 <= 0 ) { decisionOver2 += 2 * y + 1 // Change in decision criterion for y -> y+1 } else { x -- decisionOver2 += 2 * ( y - x ) + 1 // Change for y -> y+1, x -> x-1 } } }
draw and fill circle
@param {number} x0 - x-center
@param {number} y0 - y-center
@param {number} radius - radius
@param {string} color
@param {CanvasRenderingContext2D} [c]
draw and fill circle