!7 import java.awt.geom.*; p { BufferedImage img = loadBufferedImage(#1006973); BWImage bw = getAlphaChannel(img); Image2B alpha = new Image2B(bw); int w = alpha.w(), h = alpha.h(); Path2D.Float path = new Path2D.Float(); int x = w/2; int y = -1; while (y < h && !alpha.getPixel(x, y+1)) ++y; int x1 = x, y1 = y; path.moveTo(x, y); new HashSet seen; while (!seen.add(new Pt(x, y))) { int q = getQuadrant(alpha, x, y); if (q == 0x0011) --x; else if (q == 0x1100) ++x; if (q == 0x0101) ++y; else if (q == 0x1010) --y; else if (q == 0x0111) { --x; ++y; } else if (q == 0x1011) { --x; --y; } else fail(q); // TODO path.lineTo(x, y); } // while (x != x1 || y != y1); showImage(alpha); showImage(renderShape(path, w, h)); }