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
Solved

images Controlling !!!!!

Posted on 2000-03-16
4
138 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

839 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