Solved

transparent bitmap

Posted on 2004-09-24
3
1,264 Views
Last Modified: 2008-01-09
I have a graphic in an imagelist.  Anyone know how i can transfer it to a TBitmap WITHOUT loosing the transparent background that the imagelist gives me? (ie: i have the transparent color of the imagelist set to clFuchsia)

OR

How can i make the bitmap transparent on the canvas with the transparent color being clFuchsia in the bitmap?
0
Comment
Question by:patera2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 250 total points
ID: 12149751
You can use transparent and transparentMode properties of TBitmap

Transparent := True means of course that it will be Transparent

TransparentMode is how it will be transparent.
from Help:
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.


Look how is differently drawed your bitmap with this example

procedure TForm1.Button1Click(Sender: TObject);
var
  Bitmap : TBitMap;
begin
  Bitmap := TBitmap.Create;
  ImageList1.GetBitmap(0,Bitmap);
  try
    with Bitmap do begin
      Transparent := True;
      TransParentColor := clblack;
      Form1.Canvas.Draw(0,0,BitMap);
      TransParentColor := clfuchsia;
      Form1.Canvas.Draw(30,30,BitMap);
      TransparentMode := tmAuto; //this automatically get as TransparentColor the the color of the bottom-leftmost pixel
      Form1.Canvas.Draw(60,60,BitMap);
    end;
  finally
    Bitmap.Free;
  end;
end;

F68 ;-)
0
 

Author Comment

by:patera2
ID: 12297018
sorry for the delay -  thanks for the help.
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12297089
Glad to have helped you :)

F68 ;-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question