Board index » delphi » Transparent Image on Image

Transparent Image on Image

Hi friends,

I think i need some help. I spent a lot of hours an couldn't solve the
following problem:
What I want to do is a small bitmap animation. I have 2 Images and 1 Timer.

First Image contains a bitmap with some transparent regions in it.
Therefor I set TransparentColor := clNavy and it works.

Second Image is underneath of Image1 and should fill the transparent regions
of Image1.
In the OnTimer event I draw a spectrum of rainbow colors (0..255) into a
Bitmap object.
Afterwards I have put the Bitmap on Image2.Picture.Bitmap.Canvas using the
API function BitBlt
This does work but only after a Refresh. But this means flickering.
I thought I do not need to refresh if using BitBlt.

Perhaps my way is a wrong way.
I really hope someone can help.

Thanks for listening


Re:Transparent Image on Image

Your trouble its more difficult to understand than to solve, but let see:
You have 2 bitmaps,  and 1  TPicture where you are drawing the bitmap.
Well you want to build some bitmap with the 2 bitmaps and put into de
TPicture.bitmap, but you use bitBlt windows function because if you assing
TPicture.bitmap it flicks.
Well then don't use TPicture ,use one TPaintBox and do what you are doing.
May be you have to have to set :
       PaintBox1.controlStyle:=PaintBox1.controlStyle+[csOpaque];; //*I am not sure of this.

And one last thing when you draw a Bitmap in a canvas on the screen and it
has transparent:=true it always flicks so you must build your bitmap all in
memory, and set Bitmap.transparent:=false and then paint it.

I hope it can help you.

Other Threads