interface IImageRegion extends INumberOfPixels, IPixelSet { // 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); // 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 aka nPixels() { ret l(pixelIterator()); } public default Pt firstPixel() { ret first(pixelIterator()); } // gets the region's color (what exactly this means is defined // by the creator of this object) public default Color color() { null; } public default int brightness() { ret -1; } public default OnePathWithOrigin outline() { ret g22_regionOutline(this); } default Image2B toImage2B() { ret new RegionToImage2B(this)!; } default int[] pixelsAsIntArray() { throw unimplemented(); } // CONVENIENCE/ORTHOGONALITY METHODS default IPixelSet pixelSet() { this; } }