If you bug me enough I'll rewrite this document. This manpage explains how this is done in perl.
Tiles are the basic building blocks of all drawables.
First, you have to grab a GDrawable structure. Changes you make to them might not be reflected in the image until you destroy this variable. The data method returns and sets the raw pixel data. You can access single pixels, rows, columns and rectangles within these regions. First, you have to grab a GDrawable structure.