Cheng_sam
asked on
combined two bitmap
Experts:
I plot two bitmap in my program. I try to combine two bitmap into one.
one is for background and the others is foreground. How to?thanks.
I plot two bitmap in my program. I try to combine two bitmap into one.
one is for background and the others is foreground. How to?thanks.
ASKER
thanks for mokule's comment.
I plot something in image2 and image3 as follow:
image2.transparent:=true;
image3.transparent:=true;
with image2.Canvas do begin
Pen.Width :=4;
Brush.Style:= bscross;//
SetBkColor(image2.Canvas.H andle, clred); //
SetBkMode(image2.Canvas.Ha ndle, OPAQUE);
Rectangle(20,20,300,300);
MoveTo(0, 0);
LineTo(500, 500);
end;
with image3.Canvas do begin
Pen.Color :=clblue;
Pen.Width:=14;
Brush.Color := clBlack;
SetBkColor(image3.Canvas.H andle, clred);
SetBkMode(image3.Canvas.Ha ndle, OPAQUE);
Brush.Style := bsDiagCross;
Ellipse(50, 50, 150, 150);
MoveTo(200,0);
LineTo(0,200);
end;
self.Canvas.Draw(0,0,Image 3.Picture. Bitmap);
self.Canvas.CopyMode := cmSrcPaint;
self.Canvas.Draw(0,0,Image 2.Picture. Bitmap);
the result is image2 always cover the image3. But I need the image2 show with image3 simultaneously.That is
image2 is transparent and I can be seen image3's graphic .
But it seem can't do.How to improve?Thanks.
I plot something in image2 and image3 as follow:
image2.transparent:=true;
image3.transparent:=true;
with image2.Canvas do begin
Pen.Width :=4;
Brush.Style:= bscross;//
SetBkColor(image2.Canvas.H
SetBkMode(image2.Canvas.Ha
Rectangle(20,20,300,300);
MoveTo(0, 0);
LineTo(500, 500);
end;
with image3.Canvas do begin
Pen.Color :=clblue;
Pen.Width:=14;
Brush.Color := clBlack;
SetBkColor(image3.Canvas.H
SetBkMode(image3.Canvas.Ha
Brush.Style := bsDiagCross;
Ellipse(50, 50, 150, 150);
MoveTo(200,0);
LineTo(0,200);
end;
self.Canvas.Draw(0,0,Image
self.Canvas.CopyMode := cmSrcPaint;
self.Canvas.Draw(0,0,Image
the result is image2 always cover the image3. But I need the image2 show with image3 simultaneously.That is
image2 is transparent and I can be seen image3's graphic .
But it seem can't do.How to improve?Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
it's O.K.thanks for TheRealLoki and mokule .
So I can't be in an answer.
However You can combine two bitmaps like below
image3.Canvas.Draw(0,0,Ima
image3.Canvas.CopyMode := cmSrcPaint;
image3.Canvas.Draw(0,0,Ima
You can play with copymode to achieve desied results.