static ItIt pixelsInImageIterator(BufferedImage image) { ret pixelsInImageIterator(image.getWidth(), image.getHeight()); } static ItIt pixelsInImageIterator(WidthAndHeight etc size) { int h = size.h(), w = size.w(); ret new ItIt { int x, y; public bool hasNext() { ret y < h && x < w; } public Pt next() { Pt p = pt(x, y); if (++x >= w) { x = 0; ++y; } ret p; } }; }