Solved

images Controlling !!!!!

Posted on 2000-03-16
4
147 Views
Last Modified: 2010-04-04
Hi,

I have a "FirstImage" as Bitmap, it contains flowers and heart shape at the center, I have also, "FirstImageMask" as Bitmap, it contains a Black and white image for the heart shape at the "FirstImage" .. Finally I have "LastImage" contains my baby pcture :).

I want the code wich inserts my "LastImage" into the heart shape in "FirstImage" using the mask "FirstImageMask".


Please, DONT USE Components, use code only ..

Regards,
Hamid
0
Comment
Question by:HamidHossain
[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
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
TheNeil earned 100 total points
ID: 2623188
VAR
  TempImage : TBitmap;
BEGIN
  TempImage := TBitmap.Create;
  TempImage.PixelFormat := pf24bit;
  TempImage.Width := FirstImage.Width;
  TempImage.Height := FirstImage.Height;

  FirstImageMask.Transparent := TRUE;
  FirstImageMask.TransparentColor := clWhite;

  TempImage.Canvas.Draw(0, 0, FirstImage);
  TempImage.Canvas.Draw(0, 0, FirstImageMask);


  LastImage.PixelFormat := pf24bit;
  LastImage.Width := FirstImage.Width;
  LastImage.Height := FirstImage.Height;

  TempImage.Transparent := TRUE;
  TempImage.TransparentColor := clBlack;

  LastImage.Canvas.Draw(0, 0, TempImage);
  TempImage.Free;
END;

That should do what you need it to do.

The Neil
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2623195
Of course it might work even better if I'd set the colours the right way round.

Just change the above code so that the transparent colours are set as follows:

FirstImageMask.TransparentColor := clBlack;
TempImage.TransparentColor := clWhite;

Oops

The Neil =:)
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2625867
Listening
0
 

Author Comment

by:HamidHossain
ID: 2626938
Exactly what I need.

I gave you Excellent TheNiel.

Thanks
Hamid
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

615 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