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

24
LINES

< > BotCompany Repo | #1006871 // rgbVisualizeRectsZoomed

JavaX fragment (include)

static RGBImage rgbVisualizeRectsZoomed(RGBImage img, Collection<Rect> rects) {
  int markColor1 = 0xFF0000, markColor2 = 0xFFFF00;
  int w = img.w(), h = img.h();
  RGBImage img2 = new RGBImage(w*2, h*2);
  for y to h: for x to w: {
    int color = img.getInt(x, y);
    img2.setPixel(x*2, y*2, color);
    img2.setPixel(x*2, y*2+1, color);
    img2.setPixel(x*2+1, y*2, color);
    img2.setPixel(x*2+1, y*2+1, color);
  }
  for (Rect r : rects) {
    int x1 = r.x*2, y1 = r.y*2, x2 = r.x2()*2, y2 = r.y2()*2;
    for (int x = x1; x <= x2; x++) {
      img2.setPixel(x, y1, odd(x) ? markColor1 : markColor2);
      img2.setPixel(x, y2, odd(x) ? markColor1 : markColor2);
    }
    for (int y = y1; y <= y2; y++) {
      img2.setPixel(x1, y, odd(y) ? markColor1 : markColor2);
      img2.setPixel(x2, y, odd(y) ? markColor1 : markColor2);
    }
  }
  ret img2;
}

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