2011 02 22Distance field
In image editing, how do you stroke a shape ? By using a distance transform to compute a distance field, which gives the distance to the shape in pixels. Then, painting every distance field value below a stroke width will draw a border.
This picture is computed using the Meijster algorithm, which works in linear time and computes several kinds of distance functions. Plus, it's simple enough to be implemented in html !
See the canvas implementation or get the code on Github.