1 | static BufferedImage cutOutPixelSet_scale(BufferedImage image, BufferedImage bigImg, PixelSet set) { |
2 | int scale = iround(bigImg.getWidth()/(double) image.getWidth()); |
3 | Rect r = pixelSetBounds(set); |
4 | int bw = bigImg.getWidth(), bh = bigImg.getHeight(); |
5 | BufferedImage img = transparentBufferedImage(r.w*scale, r.h*scale); |
6 | for (Pixel p : set) { |
7 | int x1 = (p.x-r.x)*scale, y1 = (p.y-r.y)*scale; |
8 | int xb = p.x*scale, yb = p.y*scale; |
9 | for (int y = 0; y < scale; y++) |
10 | for (int x = 0; x < scale; x++) |
11 | if (xb+x < bw && yb+y < bh) |
12 | img.setRGB(x1+x, y1+y, bigImg.getRGB(xb+x, yb+y)); |
13 | } |
14 | ret img; |
15 | } |
Began life as a copy of #1010155
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: | #1010173 |
Snippet name: | cutOutPixelSet_scale - make RGBImage with alpha |
Eternal ID of this version: | #1010173/4 |
Text MD5: | 5eeda7487fb184c735f6e15e2908129a |
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:06:05 |
Source code size: | 642 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 532 / 549 |
Version history: | 3 change(s) |
Referenced in: | [show references] |