Link to home
Start Free TrialLog in
Avatar of Heesu
Heesu

asked on

overlay two bitmap images

Does anyone know how to overlay a bitmap image on the another one?
Thanks,
Heesu.
Avatar of geobul
geobul

Hi,

Place two TImage components on a form, load bitmaps to them and try this:

procedure TForm1.Button1Click(Sender: TObject);
begin
  Image1.Picture.Bitmap.Canvas.Draw(50,50, Image2.Picture.Bitmap);
end;

Regards, Geo
Hi there,

you can use the CopyRect function of a Canvas, and set the  Canvas.CopyMode to the desired effect (XOR, OR, etc...) :

procedure TForm1.Cut1Click(Sender: TObject);
var
  ARect: TRect;
begin
  Copy1Click(Sender); { do the same thing as the copy menu item }
  with Image.Canvas do
  begin
    CopyMode := cmWhiteness;
    ARect := Rect(0, 0, Image.Width, Image.Height);
    CopyRect(ARect, Image.Canvas, ARect);
    CopyMode := cmSrcCopy; { restore the copy mode }
  end;
end;

HTH,
Stef
Avatar of Heesu

ASKER


My BaseImage has color in it.
OverlayImage has WhiteandBlack.
I want to show black lines only of OverlayImage on the BaseImage.
Not just cover the BaseImage.

TviGep:

Sorry, I am not an expert.
Can you show me any example in detail.
about Copy1Click and etc.
Thanks,

Heesu.
ASKER CERTIFIED SOLUTION
Avatar of Member_2_248744
Member_2_248744
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Heesu

ASKER

Slick812:

Thanks a lot.
That's what I wanted to see.

Heesu.