protected void paintComponent(Graphics g) {
Graphics2D gr = (Graphics2D) g.create();
// draw Original image
super.paintComponent(gr);
// draw 45 degree rotated instance
int aci=-45;
gr.transform(AffineTransform.getRotateInstance(Math.toRadians(aci)));
super.paintComponent(gr);
//translate rotated instance from origin to +10 on y axes
gr.translate(0,10);
super.paintComponent(gr);
}
但是,如果我想在原始圖像原點繪製旋轉的形狀怎麼辦?旋轉形狀java2d不失其原點
我的意思是我想旋轉它的原點而不滑動
我真的不明白你想要做什麼...... 你想通過平面軸的原點或旋轉形狀的起源?? – 2009-11-26 12:17:58