Solved

transparent bitmap

Posted on 2004-09-24
3
1,255 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
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 250 total points
Comment Utility
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
Comment Utility
sorry for the delay -  thanks for the help.
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
Comment Utility
Glad to have helped you :)

F68 ;-)
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now