écrire la valeur pointée par un pointeur de pointeur???
J'ai créer un tableau intitulé "image" à l'intérieur sont définis des valeurs que je veux réecrire dans "image_finale", mais avec un ordonnancement différent. Malheureusement je me perds dans les pointeurs...et pourtant j'ai fait pleins d'essais.
Si quelqu'un à des pistes?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
void ajout_bordure(unsigned char *image, unsigned char *image_finale, int *tailles)
{
int i, j;
int zone_length;
char nom[10]="titi.tiff";
int sqrt_zone_length; unsigned char *ptr1, *ptr2, *ptr3, *ptr4;
unsigned char **buf1, *buf2, *buf3, *buf4;
zone_length = (tailles[0]+tailles[1])*8 / tailles[2];
sqrt_zone_length = (int) sqrt(zone_length);
//assignation des pointeurs bufx
buf3 = image_finale + (int) sqrt (tailles[2]) * zone_length;
buf4 = buf3 + sqrt_zone_length;
//assignation des pointeurs ptrx
ptr3 = image_finale + (int) sqrt (tailles[2]) * (2*2*zone_length + 2*2) +2;
ptr4 = ptr3 + 2*sqrt_zone_length;
for(i=0;i<sqrt_zone_length;i++)
{
for(j=0;j<sqrt_zone_length;j++)
{
*(ptr3++) = *(buf3);
*(ptr3++) = *(buf3++);
*(ptr4++) = *(buf4);
*(ptr4++) = *(buf4++);
}
buf3 += sqrt_zone_length;
buf4 += sqrt_zone_length;
} |