combined two bitmap

Posted on 2006-05-01
Last Modified: 2012-06-21
      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.
Question by:Cheng_sam
    LVL 17

    Expert Comment

    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.CopyMode := cmSrcPaint;

    You can play with copymode to achieve desied results.

    Author Comment

    thanks for mokule's comment.

     I plot something in image2 and image3 as follow:
         with  image2.Canvas  do begin
               Pen.Width :=4;
               Brush.Style:= bscross;//
               SetBkColor(image2.Canvas.Handle, clred); //
               SetBkMode(image2.Canvas.Handle, OPAQUE);
               MoveTo(0, 0);
               LineTo(500, 500);
        with  image3.Canvas  do begin
              Pen.Color :=clblue;
              Brush.Color := clBlack;
              SetBkColor(image3.Canvas.Handle, clred);
              SetBkMode(image3.Canvas.Handle, OPAQUE);
              Brush.Style := bsDiagCross;  
              Ellipse(50, 50, 150, 150);    
         self.Canvas.CopyMode := cmSrcPaint;
            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.
    LVL 17

    Accepted Solution

    This link shows you how to combine images
    (background and foreground)
    There is source, and a good example

    Author Comment

    it's O.K.thanks  for TheRealLoki and mokule .

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
    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…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now