import java.awt.geom.AffineTransform; static BufferedImage scaleImage_noSmooth(BufferedImage before, double scale) { ret scaleImage_noSmooth(before, scale, scale); } static BufferedImage scaleImage_noSmooth(BufferedImage before, double scaleX, double scaleY) { if (scaleX == 1 && scaleY == 1) ret before; int w = before.getWidth(), h = before.getHeight(); int neww = max(1, iround(w*scaleX)), newh = max(1, iround(h*scaleY)); BufferedImage after = new BufferedImage(neww, newh, BufferedImage.TYPE_INT_ARGB); new AffineTransform at; at.scale(scaleX, scaleY); AffineTransformOp scaleOp = new(at, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); ret scaleOp.filter(before, after); } static BufferedImage scaleImage_noSmooth(double scale, BufferedImage before) { ret scaleImage_noSmooth(before, scale); }
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: | 335 / 382 |
Referenced in: | [show references] |