Anti-Grain Geometry Tutorial
|
AGG provides plenty of way of generating color gradients. There are two components in drawing a color gradient:
For this tutorial, we will play around with various gradient functions. However, for the color function, we will use a simple agg::gradient_linear_color object.
You will need the following types. There are a number of gradient function classes. In this example, we use agg::gradient_x.
Now we create objects for each type and hook everything up.
Note that for the matrix used for the linear interpolator, it is the inverted matrix for reverse lookup. This is quite similar to how images are drawn (Image - Basics).
tutorial_gradient_1.cpp generates 3 rows of gradient functions. The first row have a bunch of squares that are generated using the following gradient functions.
The second row combines agg::gradient_repeat_adaptor with the gradient functions in the first row.
The third row combines agg::gradient_reflect_adaptor with the gradient functions in the first row.