?
Solved

combined two bitmap

Posted on 2006-05-01
4
Medium Priority
?
440 Views
Last Modified: 2012-06-21
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.
0
Comment
Question by:Cheng_sam
  • 2
4 Comments
 
LVL 17

Expert Comment

by:mokule
ID: 16582326
You are not precise in Your question.
So I can't be in an answer.

However You can combine two bitmaps like below

  image3.Canvas.Draw(0,0,Image1.Picture.Bitmap);
  image3.Canvas.CopyMode := cmSrcPaint;
  image3.Canvas.Draw(0,0,Image2.Picture.Bitmap);

You can play with copymode to achieve desied results.
0
 

Author Comment

by:Cheng_sam
ID: 16584025
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.Handle, clred); //
           SetBkMode(image2.Canvas.Handle, 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.Handle, clred);
          SetBkMode(image3.Canvas.Handle, OPAQUE);
          Brush.Style := bsDiagCross;  
          Ellipse(50, 50, 150, 150);    
          MoveTo(200,0);
          LineTo(0,200);
     end;
     self.Canvas.Draw(0,0,Image3.Picture.Bitmap);
     self.Canvas.CopyMode := cmSrcPaint;
     self.Canvas.Draw(0,0,Image2.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.
0
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 375 total points
ID: 16591707
This link shows you how to combine images
(background and foreground)
There is source, and a good example
http://www.delphiforfun.org/Programs/Delphi_Techniques/maskdrawing.htm
0
 

Author Comment

by:Cheng_sam
ID: 16604561
it's O.K.thanks  for TheRealLoki and mokule .
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

862 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