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).

static ItIt<Pt> pixelIterator(Rect r) {
  ret new ItIt<Pt> {
    int x2 = r.x2(), y2 = r.y2();
    int x = r.x, y = r.y;
    
    public bool hasNext() {
      ret y < y2 && x < x2;
    }
    
    public Pt next() {
      Pt p = pt(x, y);
      if (++x >= x2) { x = r.x; ++y; }
      ret p;
    }
  };
}

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: 151 / 183
Version history: 1 change(s)
Referenced in: [show references]