Anti-Grain Geometry Tutorial
Path - Fill

AGG does most of its operations based on paths. A path object needs to have the following two functions implemented.

void rewind (int path = 0);
unsigned vertex(double* x, double* y);

See SimplePath for an example.

Additionally, two objects are needed. These two objects can be re-used.

Finally, agg::render_scanlines_aa_solid is used to render the paths using scanline algorithm.

ras.reset();
ras.add_path(path);
agg::render_scanlines_aa_solid(ras, scanline, rBase, greenColor);

The above for anti-aliased drawing. If you want to use non-anti-aliased drawing, use the following instead.

Example

tutorial_path_1.cpp generates an image containing a green square and a red star.

tutorial_path_1.png

An equivalent SVG is

tutorial_path_1.svg