persistable sclass ScanlineBitMatrix extends AbstractMatrix is BitMatrix { int bx1 = -1, by1, bx2, by2; // bounding box of positive bits new IntBuffer scanlineData; new IntBuffer scanlineStarts; *(BitMatrix matrix) { super(matrix.getWidth(), matrix.getHeight()); int ptr = 0; for y to h: { scanlineStarts.add(ptr)); } } public Bool get(int x, int y) { ret points.contains(pt(x, y)); } public void set(int x, int y, Bool a) { points.add(pt(x, y)); } Rect boundingBoxOfTrueBits() { ret bx1 < 0 ? null : rect(bx1, by1, bx2, by2); } }