Solved

Combine to images

Posted on 2001-09-11
1
170 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
ID: 6474787
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

790 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