Controle machine

This commit is contained in:
Simoes Lukas
2025-03-19 10:18:41 +01:00
parent 42cc204dea
commit 376861b608
86 changed files with 803 additions and 179 deletions

View File

@@ -0,0 +1,52 @@
import java.awt.*;
import java.io.*;
import java.awt.image.BufferedImage;
public class LectureFichier {
private BufferedImage image;
public LectureFichier() {
this.image = new BufferedImage(768, 1024, BufferedImage.TYPE_3BYTE_BGR);
int r;
int g;
int b;
int i = 0;
int j = 0;
Color couleur;
try {
FileInputStream fichier = new FileInputStream("image.bin");
while(fichier.available() >= 3) {
try {
r = fichier.read();
g = fichier.read();
b = fichier.read();
couleur = new Color(r, g, b);
this.image.setRGB(i, j, couleur.getRGB());
i++;
if (i >= 768) {
j++;
i = 0;
}
} catch (IOException e2) {
System.out.println("Erreur d'accès");
}
}
try {
fichier.close();
} catch (IOException e3) {
System.out.println("Erreur de fermeture");
}
} catch (IOException e1) {
System.out.println("Erreur d'ouverture");
}
}
public BufferedImage getImage() {
return this.image;
}
}