Solved

Combine to images

Posted on 2001-09-11
1
168 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 139
Delphi XE10 Round Image 2 79
Delphi 2 51
FMX and jaudiotracker playing memory stream 29 67
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

16 Experts available now in Live!

Get 1:1 Help Now