Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

10
LINES

< > BotCompany Repo | #1015055 // drawRotatedImageOnImage v1 (no bilinear interpolation)

JavaX fragment (include)

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 = createGraphics(canvas);
7  
  g.setTransform(AffineTransform.getRotateInstance(angle*pi()/180, rx, ry));
8  
  g.drawImage(img, x, y, null);
9  
  ret canvas;
10  
}

Author comment

Began life as a copy of #1015053

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: #1015055
Snippet name: drawRotatedImageOnImage v1 (no bilinear interpolation)
Eternal ID of this version: #1015055/1
Text MD5: ccd1f9cc60d130a3099fda177ca76983
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:21:38
Source code size: 452 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 345 / 384
Referenced in: [show references]