antialiased edges despite initial call to noSmooth

With code below, I am somehow unable to draw crisp shapes despite a call to noSmooth. Something's afoot...

Thanks for any advice. Alex

    function setup()
    {
        var canvas, buf, img, col;

        canvas = createCanvas(100,100);

        // Draw initial ellipse in buffer
        buf = createGraphics(100,100);
        buf.noSmooth().fill(color(0,0,0)).ellipseMode(CORNER).ellipse(0,0,100,100);

        // Get image representation and filter out black pixels
        col = [0,0,0,255];
        img = b.get();
        for (var x=0; x<100; x++){
            for (var y=0; y<100; y++){
                var a = img.get(x,y);
                if (a[0] == c[0] && a[1] == c[1] && a[2] == c[2] && a[3] == c[3]) {
                    img.set(x,y,[0,0,0,0]);
                }
            }
        }
        img.updatePixels();

        // Render and observe antialiased edge despite the call to noSmooth
        image(img,0,0);
    }

Answers

Sign In or Register to comment.