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

16
LINES

< > BotCompany Repo | #1035885 // pixelIterator - over Rect

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

Libraryless. Click here for Pure Java version (9142L/51K).

1  
static ItIt<Pt> pixelIterator(Rect r) {
2  
  ret new ItIt<Pt> {
3  
    int x2 = r.x2(), y2 = r.y2();
4  
    int x = r.x, y = r.y;
5  
    
6  
    public bool hasNext() {
7  
      ret y < y2 && x < x2;
8  
    }
9  
    
10  
    public Pt next() {
11  
      Pt p = pt(x, y);
12  
      if (++x >= x2) { x = r.x; ++y; }
13  
      ret p;
14  
    }
15  
  };
16  
}

Author comment

Began life as a copy of #1035716

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035885
Snippet name: pixelIterator - over Rect
Eternal ID of this version: #1035885/2
Text MD5: e4f0e76447fc31272842cfcdac85b8d0
Transpilation MD5: 48503108515e63fecc5a96b432f1ff22
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-06 23:24:25
Source code size: 318 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 152 / 186
Version history: 1 change(s)
Referenced in: [show references]