1 | import java.awt.geom.AffineTransform; |
2 | |
3 | static BufferedImage scaleImage_noSmooth(BufferedImage before, double scale) { |
4 | ret scaleImage_noSmooth(before, scale, scale); |
5 | } |
6 | |
7 | static BufferedImage scaleImage_noSmooth(BufferedImage before, double scaleX, double scaleY) { |
8 | if (scaleX == 1 && scaleY == 1) ret before; |
9 | int w = before.getWidth(), h = before.getHeight(); |
10 | int neww = max(1, iround(w*scaleX)), newh = max(1, iround(h*scaleY)); |
11 | BufferedImage after = new BufferedImage(neww, newh, BufferedImage.TYPE_INT_ARGB); |
12 | new AffineTransform at; |
13 | at.scale(scaleX, scaleY); |
14 | AffineTransformOp scaleOp = new(at, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); |
15 | ret scaleOp.filter(before, after); |
16 | } |
17 | |
18 | static BufferedImage scaleImage_noSmooth(double scale, BufferedImage before) { |
19 | ret scaleImage_noSmooth(before, scale); |
20 | } |
Began life as a copy of #1003737
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019191 |
Snippet name: | scaleImage_noSmooth |
Eternal ID of this version: | #1019191/1 |
Text MD5: | f1634a86fa9e68aca36cce82c03c8d93 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-27 14:29:42 |
Source code size: | 835 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 336 / 383 |
Referenced in: | [show references] |