Lately I have been working on half-tones generation with processing, mainly to use with my home-made printer (I am still working on vectorial drawing, but it's a little harder).
So here are two snippets of code.
The first one is pretty basic, but the point is to let you chose what shape do you want to use so I commented it in order to be very easily understandable.
The second one uses a very specific pattern that I really love. I saw it used on the sestemantics website, for the van Bergen Kolpa website. Here is a demo: