anti-aliasing algorithm
-
There anybody know anti-aliasing algorithm?? I want to make free-drawing application program. and want to adopt there anti-aliasing algorithm.. to avoid jagged How do am I??
The basic idea is this : 1) you calculate the percent coverage of each pixel when drawing the line. 2) you set the pixel color based on the percent coverage. For example, if drawing a white line RGB(255,255,255) : * if the pixel is 100 % covered, set the pixel color to RGB(255,255,255) * if the pixel is 50 % covered, set the pixel color to RGB(127,127,127) etc. The hard part is step 1. The way to see what coverage means is to take a piece of graph paper - each grid cell represents a pixel. Draw a line from a start pixel to an end pixel. But the line is really a long rectangle, in which 2 of the sides are of unit length. You will see that some pixels are nearly fully covered, others on slightly covered. Unfortunately, the details of calculating these coverage values are complex. Maybe some OLD graphics text book will have more info on how to calculate the values. What graphics package are you using ? I know that both openGL and Direct3D support antialiasing. I have not used Direct3D, but the openGL implementation is very easy to use.