APL/APL1.2/TP04/image.c
2021-11-30 15:06:27 +01:00

31 lines
585 B
C

#include<stdio.h>
#include<stdlib.h>
#include<graph.h>
int main(int argc, char * argv[]) {
int width, height;
couleur color;
FILE* flux = fopen("image.bin", "r");
if (flux) {
fread(&width, 4, 1, flux);
fread(&height, 4, 1, flux);
InitialiserGraphique();
CreerFenetre(100, 100, width, height);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
fread(&color, sizeof(couleur), 1, flux);
ChoisirCouleurDessin(color);
DessinerPixel(x, y);
}
}
Touche();
FermerGraphique();
return EXIT_SUCCESS;
} else return EXIT_FAILURE;
}