RAD Studio VCL Reference
|
Determines whether the TransparentColor property's value is automatically calculated or stored with the bitmap object.
property TransparentMode: TTransparentMode;
__property TTransparentMode TransparentMode;
When TransparentMode is set to tmAuto (the default), the TransparentColor property returns the color of the bottom-leftmost pixel of the bitmap image. When TransparentMode is set to tmFixed, the TransparentColor property refers to the color stored in the bitmap object.
C++ Examples:
/* An examples of TBitmap Color, TGraphic Transparent, TBitmap TransparentMode, TBitmap TransparentColor and TCanvas Draw. */ #include <memory> //for STL auto_ptr class void __fastcall TForm1::Button1Click(TObject *Sender) { std::auto_ptr<Graphics::TBitmap> bitmap(new Graphics::TBitmap); try { bitmap->LoadFromFile("..\\FACTORY.BMP "); bitmap->Transparent = true; bitmap->TransparentColor = bitmap->Canvas->Pixels[50][50]; Form1->Canvas->Draw( 0, 0, bitmap.get()); bitmap->TransparentMode = tmAuto; Form1->Canvas->Draw(50, 50, bitmap.get()); } catch (...) { ShowMessage("Could not load or display bitmap"); } }
Delphi Examples:
procedure TForm1.Button1Click(Sender: TObject); var Bitmap : TBitMap; begin Bitmap := TBitmap.Create; try with Bitmap do begin LoadFromFile('factory.bmp'); Transparent := True; TransParentColor := BitMap.canvas.pixels[50,50]; Form1.Canvas.Draw(0,0,BitMap); TransparentMode := tmAuto; Form1.Canvas.Draw(50,50,BitMap); end; finally Bitmap.Free; end; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|