Solved

Combine to images

Posted on 2001-09-11
1
167 Views
Last Modified: 2010-05-18
Hi

How can I combine two Bitmaps taking into account that the first image should be used as background and I wanna point transparent color for the second one.
0
Comment
Question by:vterekh
1 Comment
 
LVL 2

Accepted Solution

by:
bugroger earned 30 total points
Comment Utility
Hi,

Try this function:

//Bitmap2 will be copied with a transparent color (TransColor) on Bitmap1 at Pos(pX, pY)
//Result is the combined bitmap
Function CombineBitmaps(Bitmap1, Bitmap2 : TBitmap; pX, pY : Integer; TransColor : TColor) : TBitmap;
VAR
 DummyBitmap : TBitmap;

Begin
 Result        := TBitmap.Create;
 Result.Width  := Bitmap1.Width;
 Result.Height := Bitmap1.Height;
 Result.Canvas.Draw(0,0, Bitmap1);

 DummyBitmap := TBitmap.Create;
 DummyBitmap.Width := Bitmap2.Width;
 DummyBitmap.Height := Bitmap2.Height;
 DummyBitmap.Canvas.Draw(0,0, Bitmap2);

 DummyBitmap.TransparentMode  := tmFIXED;
 DummyBitmap.TransparentColor     := TransColor;
 DummyBitmap.Transparent      := TRUE;

 Result.Canvas.Draw(pX, pY, DummyBitmap);
 DummyBitmap.Free;
End;


GL
 Bug
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 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

18 Experts available now in Live!

Get 1:1 Help Now