Solved

images Controlling !!!!!

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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