Board index » delphi » Delphi Graphics: transparent color

Delphi Graphics: transparent color

I'm new to Delphi and I want to create an application that display a
bitmap image arround a form, but find that Delphi only provide
transparent colors in icon/cursor.

  Is there any work-arround for this situation? Can I use other language
to do the job and merge the RAD provided with Delphi?

P.S. I've been working at C++ for sometime.

 

Re:Delphi Graphics: transparent color


Tse Ming Wai,
   I've used the following successfully:

var
  IL : TImageList;
begin
    {Create an ImageList with the dimensions of the bitmap.}
  IL := TImageList.CreateSize(Image1.Picture.Bitmap.Width,
                          Image1.Picture.Bitmap.Height);
  IL.AddMasked(Image1.Picture.Bitmap, clWhite);  {will mask all white
pixels
to transparent}
  IL.Draw(Form1.Canvas, 0, 0, 0);                {draw to whatever canvas
you want}
         {draw on what, X, Y, which item in ImageList};
end;

They will be displayed with the white pixel set to transparent.  (BTW if
you want to use this in Delphi 1.0 then change TImageList.CreateSize() to
TImageList.Create().)

Hope this helps!
--

Rodney E Geraghty
GERA-Tech
Ottawa, Canada
gera...@ibm.net

Tse Ming Wai <mw...@netvigator.com> wrote in article
<33BE057F.3...@netvigator.com>...

Quote
> I'm new to Delphi and I want to create an application that display a
> bitmap image arround a form, but find that Delphi only provide
> transparent colors in icon/cursor.

>   Is there any work-arround for this situation? Can I use other language
> to do the job and merge the RAD provided with Delphi?

> P.S. I've been working at C++ for sometime.

Other Threads