interface IImageRegion
{
// REQUIRED METHODS
// smallest rectangle that all of the region's pixels are contained in
public Rect bounds();
public ItIt pixelIterator();
public bool contains(int x, int y);
// convenience methods
public default bool contains(Pt p) { ret contains(p.x, p.y); }
// OPTIONAL METHODS
// get whole image that the region refers to
public default Img image() { null; }
// which object made this
public default O creator() { null; }
public default int indexInCreator() { ret 0; }
// was diagonal walking enabled?
public default Bool createdWithDiagonals() { null; }
public default int numberOfPixels() { ret l(pixelIterator()); }
public default Pt firstPixel() { ret first(pixelIterator()); }
// gets the region's color (what exactly this means is defined
// by the creator)
public default RGB color() { null; }
public default int brightness() { ret -1; }
public default OnePathWithOrigin outline() {
ret g22_regionOutline(this);
}
}