1 | import java.awt.geom.AffineTransform; |
2 | |
3 | // angle is in our system (clockwise, 0 is north) |
4 | // rx, ry is rotation point in painted image space |
5 | static BufferedImage drawRotatedImageOnImage(BufferedImage img, BufferedImage canvas, int x, int y, double angle, double rx, double ry) { |
6 | Graphics2D g = antiAliasGraphics(canvas); |
7 | g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
8 | g.setTransform(AffineTransform.getRotateInstance(angle*pi()/180, rx, ry)); |
9 | g.drawImage(img, x, y, null); |
10 | ret canvas; |
11 | } |
Began life as a copy of #1007273
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: | #1015053 |
Snippet name: | drawRotatedImageOnImage |
Eternal ID of this version: | #1015053/5 |
Text MD5: | 38d845909a3b75498a06fdd45ee18dda |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-07 15:26:45 |
Source code size: | 557 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 478 / 503 |
Version history: | 4 change(s) |
Referenced in: | [show references] |