// Abstract base class for tiling an image (G22Tiling) abstract srecord noeq G22AbstractTiler(Img image) is Runnable { int w, h, runner; gettable int size; // =w*h new IntBuffer stack; // locations to be looked at as y*w+x int[] tileMatrix; // for each pixel: tile index+1 (or 0 for empty) G22Tiling tiling; // the tiling we are making int regionCounter; bool verbose; double regionStep = .1; // for rendering in regionsImage int x(int pos) { ret pos % w; } int y(int pos) { ret pos / w; } int pos(int x, int y) { ret y*w+x; } Pt pt(int pos) { ret Pt(x(pos), y(pos)); } bool validPos(int x, int y) { ret x >= 0 && y >= 0 && x < w && y < h; } abstract int getColor(int pos); run { w = image.getWidth(); h = image.getHeight(); size = w*h; regionMatrix = new int[size]; }