Salut les amis j’ai un problème avec mon code
Et j’arrive pas a comprendre pourquoi ?
Voila je doit faire tourne une image texte gif de 90° a droite, l’image tourne c’est bien mais elle change de couleur d’arrière plan en vert et je ne sait pourquoi
Voici mon code quelqu’un peut m’expliquer pourquoi j’ai ce problème incompréhensible
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;
import java.awt.geom.*;
 
 
 public class Rotation extends JComponent {
   private BufferedImage image;
    double centreDeRotation;
 
   public Rotation(BufferedImage image) throws IOException {
 
   	this.image=image;
   	BufferedImage source = image;
   	BufferedImage transfert = new BufferedImage(source.getHeight(), source.getWidth(), source.getType());
      double centreDeRotation = source.getHeight()/2;
      AffineTransform pivoter = AffineTransform.getRotateInstance(Math.toRadians(90), centreDeRotation, centreDeRotation);
      AffineTransformOp pivoterImage = new AffineTransformOp(pivoter, null);
      pivoterImage.filter(source, transfert);  
      this.image=transfert;
      this.setPreferredSize(new Dimension (image.getHeight(),image.getWidth()));
 
   }
   protected void paintComponent(Graphics g) {
      Graphics2D surface = (Graphics2D)g;
      surface.drawImage(image, 0, 0, null);
      //surface.drawImage(image, 0, 0,this.getWidth(), this.getHeight(), null);
   } 
}
en plus ce code ne marche pas pour les image Png
pourquoi a votre avie