Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Combine to images

Posted on 2001-09-11
1
Medium Priority
?
178 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

705 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