Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

43
LINES

< > BotCompany Repo | #1033952 // IImageRegion - irregular region of an image (set of pixels)

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (14050L) is out of date.

interface IImageRegion<Img extends WidthAndHeight> extends INumberOfPixels, IPixelSet {
  // REQUIRED METHODS
  
  // smallest rectangle that all of the region's pixels are contained in
  public Rect bounds();

  public ItIt<Pt> 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; }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033952
Snippet name: IImageRegion - irregular region of an image (set of pixels)
Eternal ID of this version: #1033952/37
Text MD5: 26c426d092b5ef90683a579b46ff626f
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-02-12 14:48:15
Source code size: 1303 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 290 / 589
Version history: 36 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)
#1034246 - IImageRegions - collection of regions of an image (sets of pixels)