Anti-Grain Geometry Tutorial
|
Imaging drawing with AGG is a bit complicated. It works quite similar to how SVG draws image. Instead of drawing the source image at the target image buffer location with specified scaling as in most 2D graphics APIs, AGG does the reverse lookup of source image pixels needed to draw the target image pixel.
The following types are needed.
Then we need to compute the reverse lookup matrix. In the following code, matrix
would be the normal parameters needed to draw images using convention 2D graphics API. invertMatrix
would be the reverse lookup matrix.
We also need a path to specify the target region to do the reverse lookup.
Finally, hook everything up and draw the image.
tutorial_image_1.cpp first generates the following image icon.
Then it draws this image with various scaling, translation etc.
An equivalent SVG is