I would suggest "Processing, a programming handbook for visual designers and artists" by Reas, Fry. It is a lovely book for visual designers with lots of (mostly short) snippets side by side to graphic outputs doing cool stuff, all organized by themes