vashkiry | voici une petite fonction rotate ki marche
Code :
- public void rotate(double scale)
- {
- double sinA = Math.sin(scale);
- AffineTransform tx = new AffineTransform();
- tx.rotate(scale, this.image.getWidth() / 2, this.image.getHeight() / 2);
- AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
- Rectangle rect = op.getBounds2D(this.image).getBounds();
- tx.translate(sinA * rect.getX(), -sinA * rect.getY());
- op = new AffineTransformOp(tx,AffineTransformOp.TYPE_BILINEAR);
- this.image = op.filter(this.image, op.createCompatibleDestImage(this.image, null) );
- //putin guigui tu es trop fort
- this.setBounds( getX(), getY(), image.getWidth(), image.getHeight() );
- this.w = image.getWidth();
- this.h = image.getHeight();
- }
|
|