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

15
LINES

< > BotCompany Repo | #1010174 // cutOutPixelSet_scale with outline [dev.]

JavaX fragment (include)

static BufferedImage cutOutPixelSet_scale(BufferedImage image, BufferedImage bigImg, PixelSet set, int outline) {
  int scale = iround(bigImg.getWidth()/(double) image.getWidth());
  Rect r = pixelSetBounds(set);
  int bw = bigImg.getWidth(), bh = bigImg.getHeight();
  BufferedImage img = transparentBufferedImage(r.w*scale+outline*2, r.h*scale+outline*2);
  for (Pixel p : set) {
    int x1 = (p.x-r.x)*scale+outline, y1 = (p.y-r.y)*scale+outline;
    int xb = p.x*scale, yb = p.y*scale;
    for (int y = 0; y < scale; y++)
      for (int x = 0; x < scale; x++)
        if (xb+x >= 0 && xb+x < bw && yb+y >= 0 && yb+y < bh)
          img.setRGB(x1+x, y1+y, bigImg.getRGB(xb+x, yb+y));
  }
  ret img;
}

Author comment

Began life as a copy of #1010173

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: #1010174
Snippet name: cutOutPixelSet_scale with outline [dev.]
Eternal ID of this version: #1010174/1
Text MD5: 84cb778b2b9ee3e103d88cca818aacd1
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-05 20:12:00
Source code size: 717 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 438 / 468
Referenced in: [show references]