Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Ma structure
- */
- typedef struct {
- int dimx;/*!< Largeur de l'image */
- int dimy; /*!< Hauteur de l'image */
- pixel * tab; /*!< Tableau de pixels qui composent l'image */
- } image;
- /*
- Initialise la structure image et alloue la mémoire dans le tas
- */
- void imInit(image * im,int dimx, int dimy)
- {
- assert(dimx > 0 && dimy > 0);
- im->tab = (pixel *)malloc(sizeof(pixel)*dimx*dimy);
- im->dimx = dimx;
- im->dimy = dimy ;
- }
- /*
- Libère la mémoire
- */
- void imLibere(image * im)
- {
- int i,maxT;
- maxT = im->dimx*im->dimy;
- for (i=0;i<maxT;i++)
- {
- free(im->tab[i]);
- }
- im->dimx=0;
- im->dimy=0;
- }
Add Comment
Please, Sign In to add comment