Libraryless. Click here for Pure Java version (3852L/22K).
1 | import java.awt.geom.*; |
2 | |
3 | static BufferedImage scaleImageWithOp(BufferedImage before, double scaleX, double scaleY default scaleX, int affineTransformOpType) { |
4 | if (scaleX == 1 && scaleY == 1) ret before; |
5 | int w = before.getWidth(); |
6 | int h = before.getHeight(); |
7 | int neww = max(1, iround(w*scaleX)), newh = max(1, iround(h*scaleY)); |
8 | BufferedImage after = new BufferedImage(neww, newh, BufferedImage.TYPE_INT_ARGB); |
9 | AffineTransform at = new AffineTransform(); |
10 | at.scale(scaleX, scaleY); |
11 | AffineTransformOp scaleOp = new(at, affineTransformOpType); |
12 | ret scaleOp.filter(before, after); |
13 | } |
Began life as a copy of #1003737
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033311 |
Snippet name: | scaleImageWithOp |
Eternal ID of this version: | #1033311/1 |
Text MD5: | fda2e4e6a1ce38022f57c477d99520b1 |
Transpilation MD5: | 774cbec8fa43489d4bea6cd2c22e62bf |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-22 20:56:59 |
Source code size: | 606 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 155 / 229 |
Referenced in: | [show references] |