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

24
LINES

< > BotCompany Repo | #1006871 // rgbVisualizeRectsZoomed

JavaX fragment (include)

1  
static RGBImage rgbVisualizeRectsZoomed(RGBImage img, Collection<Rect> rects) {
2  
  int markColor1 = 0xFF0000, markColor2 = 0xFFFF00;
3  
  int w = img.w(), h = img.h();
4  
  RGBImage img2 = new RGBImage(w*2, h*2);
5  
  for y to h: for x to w: {
6  
    int color = img.getInt(x, y);
7  
    img2.setPixel(x*2, y*2, color);
8  
    img2.setPixel(x*2, y*2+1, color);
9  
    img2.setPixel(x*2+1, y*2, color);
10  
    img2.setPixel(x*2+1, y*2+1, color);
11  
  }
12  
  for (Rect r : rects) {
13  
    int x1 = r.x*2, y1 = r.y*2, x2 = r.x2()*2, y2 = r.y2()*2;
14  
    for (int x = x1; x <= x2; x++) {
15  
      img2.setPixel(x, y1, odd(x) ? markColor1 : markColor2);
16  
      img2.setPixel(x, y2, odd(x) ? markColor1 : markColor2);
17  
    }
18  
    for (int y = y1; y <= y2; y++) {
19  
      img2.setPixel(x1, y, odd(y) ? markColor1 : markColor2);
20  
      img2.setPixel(x2, y, odd(y) ? markColor1 : markColor2);
21  
    }
22  
  }
23  
  ret img2;
24  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006871
Snippet name: rgbVisualizeRectsZoomed
Eternal ID of this version: #1006871/8
Text MD5: 3b3db5818568eb701b28adea9cdfbe2f
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-12 23:23:06
Source code size: 885 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 484 / 502
Version history: 7 change(s)
Referenced in: [show references]