Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <math.h>
- #include "IHM.h"
- // position de l'histogramme dans l'interface
- #define HISTO_L 525
- #define HISTO_B 580
- void Set_Pixel ( int c, int L, int coul, unsigned char*Im);
- //void Get_Pixel ( int c, int L, unsigned char *Im[512*512] );
- int main ( int argc, char** argv )
- {
- // mes variables
- char c;
- int i,coul;
- // tableau contenant l'image
- unsigned char mimage[HAUTEUR_IMAGE * LARGEUR_IMAGE];
- // ma position
- int x;
- int y;
- // initialisation de la fenêtre
- IHM_init();
- // initialisation du tableau à partir du fichier image
- IHM_charge_BMP(mimage, "lena_gray.bmp");
- // copie du tableau dans l'affichage IHM_set_image(mimage);
- IHM_set_image(mimage);
- // boucle principale de l'IHM
- while (!IHM_quitter())
- {
- // on commence par effacer
- IHM_efface();
- x = IHM_souris_x();
- y = IHM_souris_y();
- c = IHM_getChar();
- // les traitements en fonction des caractères tapés
- switch(c)
- {
- case 'b':
- // faire la binarisation
- break;
- case 'l':
- IHM_charge_BMP(mimage, "lena_gray.bmp");
- IHM_set_image(mimage);
- break;
- case 'a':
- IHM_charge_BMP(mimage, "archives.bmp");
- IHM_set_image(mimage);
- break;
- case 'h':
- // re-calculer l'histogramme
- break;
- }
- // ajouter l'image :
- IHM_affiche_image(10,10);
- // position du zoom
- IHM_rectangle(550,10,8*11,8*11,IHM_couleur(255,255,255));
- // position de l'histogramme
- IHM_rectangle(HISTO_L,(HISTO_B - 110),110,256+10,IHM_couleur(255,255,255));
- // on met à jour l'affichage
- IHM_affiche();
- for (i = 0; i < 512; i++)
- {
- Set_Pixel(i, 255, 255, mimage);
- Set_Pixel(255, i, 255, mimage);
- Set_Pixel(511 - i, i, 0, mimage);
- Set_Pixel(i + 1, i, 0, mimage);
- }
- IHM_set_image(mimage);
- }
- // fin de la boucle principale
- return 0;
- }
- void Set_Pixel ( int c, int L, int coul, unsigned char * im)
- {
- int i ;
- i= L*512+c;
- im[i]=coul;
- }
- int Get_Pixel(int c, int L, unsigned char * im[512*512])
- {
- int i;
- L[i]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement