// ppt = 0.0 to 1.0 static bool rgbImageSectionsIdentical_ppt(RGBImage a, Rect r1, RGBImage b, Rect r2, float ppt) { assertEquals(r1.w, r2.w); assertEquals(r1.h, r2.h); int w = r1.w, h = r1.h; for (int yy = 0; yy < h; yy++) for (int xx = 0; xx < w; xx++) if (rgbDiff(a.getInt(r1.x+xx, r1.y+yy), b.getInt(r2.x+xx, r2.y+yy)) > ppt) false; true; }