[SDL] drawing of an anti aliased circular arc

SamuraiCrow samuraileumas at yahoo.com
Mon Mar 12 13:03:18 PDT 2007


Armin Steinhoff <A-Steinhoff <at> web.de> writes:

> I'm looking for an algorithm for drawing an anti aliased circular arc.
> 
> Are there any pointers or sources of it ?

The basic idea for 4 to 1 antialiasing is that you draw an image at 4 times the
resolution and then you merge them together by adding the reds, greens, and
blues from each of the 4 adjacent pixels and then shift the result right by 2
bits (to divide the result by four).

Say for example these are your surface pixels:

abcdefg
hijklmn

You would calculuate the color of the first destination pixel by doing
(a+b+h+i)>>2 for the red, green, and blue pixel components individually (or,
better still, use autovectoring in your compiler to do these operations in an
SIMD configuration).  Likewise the second pixel in the destination surface would
be (c+d+j+k)>>2 .



More information about the SDL mailing list