sclass FloodFillBWImage extends FloodFill { IBWImage img; settable double tolerance = 1/8.0; // color tolerance pixel-to-pixel as fraction of 1 *(IBWImage *img) { super(img.getWidth(), img.getHeight()); } bool isConnectable(Pt a, Pt b) { float brightnessA = img.getFloatPixel(a); float brightnessB = img.getFloatPixel(b); ret abs(brightnessA-brightnessB) <= tolerance; } }