#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;
}

