Download freely from http://www.swig.org/. SWIG is packaged with around 200 pages of wonderful tutorial-style documentation, containing plenty of interesting examples. While you are there, please take a look at Dave's papers on applying SWIG to large-scale projects.
These two standard Perl documents provide a tutorial and a reference, respectively, for XS. You must be conversant either with Chapter 20 or the Perl internals documentation (perlguts). (The former is a slightly gentler introduction.)
The Socket, POSIX, and SDBM modules supplied with the Perl distribution make good case studies for applying XS.
These cookbooks are available from CPAN (look under the authors/Dean_Roehrich directory) and provide solutions to a number of sample problems covering all XS features. Highly recommended. You may also find it a good exercise to solve these problems using SWIG.
GD library for rendering into GIF files. Tom Boutell. Download from http://www.boutell.com/.