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

Binary file not shown.

View File

@@ -0,0 +1,81 @@
import java.awt.*;
import java.io.*;
public class EcritureFichier {
private byte r;
private byte g;
private byte b;
private byte r2;
private byte g2;
private byte b2;
public EcritureFichier(byte r, byte g, byte b) {
this.r = r;
this.g = g;
this.b = b;
try {
FileOutputStream fichier = new FileOutputStream("couleur.bin");
try {
for (int i = 0; i != 768; i++) {
for (int j = 0; j != 1024; j++) {
fichier.write(r);
fichier.write(g);
fichier.write(b);
}
}
} catch (IOException e2) {
System.out.println("Erreur d'écriture");
}
try {
fichier.close();
} catch (IOException e3) {
System.out.println("Erreur de fermeture");
}
} catch (IOException e) {
System.out.println("Erreur d'ouverture");
}
}
public EcritureFichier(byte r, byte g, byte b, byte r2, byte g2, byte b2) {
this.r = r;
this.g = g;
this.b = b;
this.r2 = r2;
this.g2 = g2;
this.b2 = b2;
try {
FileOutputStream fichier = new FileOutputStream("couleur.bin");
try {
for (int i = 0; i != 768; i++) {
for (int j = 0; j != 1024; j++) {
fichier.write(r);
fichier.write(g);
fichier.write(b);
}
}
} catch (IOException e2) {
System.out.println("Erreur d'écriture");
}
try {
fichier.close();
} catch (IOException e3) {
System.out.println("Erreur de fermeture");
}
} catch (IOException e) {
System.out.println("Erreur d'ouverture");
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,11 @@
public class Main {
public static void main(String[] args) {
if (args.length == 1) {
String chaineCouleur = args[0].replaceAll("#", "");
Integer r = Integer.valueOf(Integer.parseInt(chaineCouleur.substring(0, 2), 16));
Integer g = Integer.valueOf(Integer.parseInt(chaineCouleur.substring(2, 4), 16));
Integer b = Integer.valueOf(Integer.parseInt(chaineCouleur.substring(4, 6), 16));
EcritureFichier ecriture = new EcritureFichier(r.byteValue(), g.byteValue(), b.byteValue());
}
}
}

File diff suppressed because one or more lines are too long