(none) imager-devel
/ help / lists / applications / search /
 

Antialiasing Drawing

From: Arnar Mar Hrafnkelsson (
02017@xyz.molar.is)
Date: Sat 26 May 2001 - 09:06:32 UTC

  • Next message: Mike Depot: "freetype version"

    Hi all,

    CVS version of Imager now has antialiased circle drawing in... It's mostly
    for experimentation at this point. I did a little web page with the
    output of the test script I am using.

    http://www.eecs.umich.edu/~addi/perl/Imager/devel/aaexamples/

    I think it looks really cool. Code that generated those is:

    #!perl

    use Imager;

    Imager::init(log=>"foo.log");

    $white = Imager::Color->new(255,255,255);
    $black = Imager::Color->new(0,0,0);

    $img = Imager->new(xsize=>200,ysize=>20);

    @i = 1..20;

    @x = map { [$_*10, $_/5] } @i;

    for $circ (@x) {
      Imager::i_circle_aa($img->{IMG}, 0.5+$circ->[0], 5.5, $circ->[1],
    $white);
      Imager::i_circle_aa($img->{IMG}, 0.5+$circ->[0], 15.0, $circ->[1],
    $white);
    }

    $img->write(file=>"aatest/test1.png");

    $img = Imager->new(xsize=>200,ysize=>200);
    Imager::i_circle_aa($img->{IMG}, 100.5, 100.5, 95, $white);
    $img->write(file=>"aatest/test2.png");

    Imager::i_circle_aa($img->{IMG}, 100.0, 100.0, 95, $black);
    $img->write(file=>"aatest/test3.png");

    $img = Imager->new(xsize=>200,ysize=>200);
    Imager::i_circle_aa($img->{IMG}, 100.5, 100.5, 95, $white);
    Imager::i_circle_aa($img->{IMG}, 100.5, 100.5, 93.5, $black);
    $img->write(file=>"aatest/test4.png");

    $img = Imager->new(xsize=>200,ysize=>200);
    for (1..255) {
      Imager::i_circle_aa($img->{IMG}, rand(200), rand(200), rand(45), Imager::Color->new(rand(255),rand(255), rand(255)) );
    }
    $img->write(file=>"aatest/test5.png");

    -- Arnar.



  •