Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Combine to images

Posted on 2001-09-11
1
Medium Priority
?
180 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 120 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

Technology Partners: 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

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…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

963 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