Bonjour,

Je souhaiterais créer une fonction qui modifie un TBitmap...

Le main :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
Graphics::TBitmap *test  = new Graphics::TBitmap();
test->Width=10;
test->Height=10;
test->Canvas->Brush->Color=clBlack;
test->Canvas->Rectangle(0,0,10,10);
 
Form1->Image1->Picture->Bitmap = test;
 
maFonction(test);
Form1->Image2->Picture->Bitmap = test;
 
delete test;

La fonction:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
void maFonction(Graphics::TBitmap *img)
{
Graphics::TBitmap *temp  = new Graphics::TBitmap();
temp->Width=img->Width+10;
temp->Height=img->Height+10;
temp->Canvas->Brush->Color=clGreen;
temp->Canvas->Rectangle(0,0,img->Width+10,img->Height+10);
 
img=temp;
delete temp;
}

Malheureusement pour moi, Form1->Image1 et Form1->Image2 sont identiques, ma fonction n'a apportée aucune modification !!! (du moins les modifications n'ont pas été conservées)

J'ai presque tout tenté, des passages par adresse, des void maFonction(Graphics::TBitmap **img) avec des (*img)->Width mais je ne suis pas parvenu à conserver mes modifications !

Auriez-vous des solutions ? Merci beaucoup !!