Sur C++Builder XE
Bonjour,
Je reviens pour un autre petit problème...
Dans l'image 2 et 3 la couleur "transparente" et la couleur de "fond" sont inversées,
L'image 1 non transparente et les 2 autres "devraient être transparentes", je passe certainement à coté, mais je ne trouve pas?
Merci si quelqu'un pouvait me dire ou est j'ai fait erreur, ou si il manque quelque chose....
luiso
exemple:
Voici une partie de mon code:
Personne n'a répondu !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
36
37
38
39
40
41
42
43 //...... TForm1 *Form1; //Pour 10 images TImage *Img0[10]; int W[10], H[10], L[10], SB, MaxImg, J; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { J = 2; SB = 0; int EdLoop; int IC = 0; OpenPictureDialog1->FilterIndex = 1; if (OpenPictureDialog1->Execute()) //charge tous les formats { TGIFImage *GIF = new TGIFImage(); GIF->LoadFromFile(OpenPictureDialog1->FileName); GIF->OptimizeColorMap(); GIF->Optimize((TGIFOptimizeOptions)ooCrop, rmNone, dmNearest, 0); // Vérifie que la dernière image soit valide (ca arrive!) if(GIF->Images->Frames[GIF->Images->Count-1]->Empty) IC = 1; else IC = 0; W[0] = GIF->Width; H[0] = GIF->Height; //Les ScrollBars if( (W[0] + 4) * (GIF->Images->Count-IC) > ScrollBox1->Width) SB = H[0] + 29; else SB = H[0]+12; // Dénombre les images for(int i = 0; i < (GIF->Images->Count-IC); i++) { Graphics::TBitmap *BMP = new Graphics::TBitmap; BMP->Width = GIF->Width; BMP->Height = GIF->Height;
Je ne sais pas si c'est cela, mais j'ai rajouté ceci, et ca à l'air de fonctionner!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 BMP->Canvas->Brush->Color = clBlack; BMP->Canvas->FloodFill(0,0,clBackground ,fsBorder);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 BMP->TransparentColor = GIF->Images->Frames[i]->GraphicControlExtension->TransparentColor; BMP->Transparent = int(GIF->Images->Frames[i]->GraphicControlExtension->Transparent); // transparent oui ou non BMP->Canvas->Draw(GIF->Images->Frames[i]->Left, GIF->Images->Frames[i]->Top, GIF->Images->Frames[i]->Bitmap); //fabrication des images MaxImg++; Img0[MaxImg] = NULL; Img0[MaxImg] = new TImage(this); Img0[MaxImg]->Parent = ScrollBox1; Img0[MaxImg]->Width = W[0]; Img0[MaxImg]->Height = H[0]; Img0[MaxImg]->Canvas->Draw(0, 0, BMP); Img0[MaxImg]->Transparent= GIF->Images->Frames[i]->Transparent; Img0[MaxImg]->Left = J; Img0[MaxImg]->Top = 2; L[MaxImg] = J; J = J + Img0[MaxImg]->Width + 2; delete BMP; } ScrollBox1->Height = SB; ScrollBox1->Visible = true; delete GIF; } }
Partager