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

11
LINES

< > BotCompany Repo | #1015053 // drawRotatedImageOnImage

JavaX fragment (include)

import java.awt.geom.AffineTransform;

// angle is in our system (clockwise, 0 is north)
// rx, ry is rotation point in painted image space
static BufferedImage drawRotatedImageOnImage(BufferedImage img, BufferedImage canvas, int x, int y, double angle, double rx, double ry) {
  Graphics2D g = antiAliasGraphics(canvas);
  g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
  g.setTransform(AffineTransform.getRotateInstance(angle*pi()/180, rx, ry));
  g.drawImage(img, x, y, null);
  ret canvas;
}

Author comment

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: 477 / 502
Version history: 4 change(s)
Referenced in: [show references]