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.

1  
interface IImageRegion<Img extends WidthAndHeight> extends INumberOfPixels, IPixelSet {
2  
  // REQUIRED METHODS
3  
  
4  
  // smallest rectangle that all of the region's pixels are contained in
5  
  public Rect bounds();
6  
7  
  public ItIt<Pt> pixelIterator();
8  
  public bool contains(int x, int y);
9  
  
10  
  // OPTIONAL METHODS
11  
  
12  
  // get whole image that the region refers to
13  
  public default Img image() { null; }
14  
  
15  
  // which object made this
16  
  public default O creator() { null; }
17  
  
18  
  public default int indexInCreator() { ret 0; }
19  
  
20  
  // was diagonal walking enabled?
21  
  public default Bool createdWithDiagonals() { null; }
22  
  
23  
  public default int numberOfPixels aka nPixels() { ret l(pixelIterator()); }
24  
  public default Pt firstPixel() { ret first(pixelIterator()); }
25  
  
26  
  // gets the region's color (what exactly this means is defined
27  
  // by the creator of this object)
28  
  public default Color color() { null; }
29  
  
30  
  public default int brightness() { ret -1; }
31  
  
32  
  public default OnePathWithOrigin outline() {
33  
    ret g22_regionOutline(this);
34  
  }
35  
  
36  
  default Image2B toImage2B() { ret new RegionToImage2B(this)!; }
37  
  
38  
  default int[] pixelsAsIntArray() { throw unimplemented(); }
39  
  
40  
  // CONVENIENCE/ORTHOGONALITY METHODS
41  
  
42  
  default IPixelSet pixelSet() { this; }
43  
}

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: 291 / 590
Version history: 36 change(s)
Referenced in: [show references]