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 (13050L) 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() { 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/36
Text MD5: 2961f1427bc8e2a9cdf9d63ea88fa290
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-05 00:22:31
Source code size: 1291 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 133 / 379
Version history: 35 change(s)
Referenced in: [show references]