You might want to use a simpler approach. Paint rectangles with OR or some other combination. Something like below. You can experiment with CopyMode to get the best result. Good luck
Main Topics
Browse All TopicsHi Experts,
I have a big picture in a Tpicture object, it is a map from a game, and i need to show the dangerous zones painting a red rectangle over it, with transparency, the info in map must be visible.
I dont have a clue how to do it, alpha? rgb manipulation ? really don´t know, if u can provide a code sample , will be much apreciate.
regards
Wilson
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I think you can best create 2 bitmaps and merge them before showing to the user.
To merge them you could use the AlphaBlend funtion of microsoft, but i've seen some differences between XP and Vista, so i have assamblied my own version together. See code.
It can handle tranparancy per pixel and a global value.
If you put the map in the destination bitmap, and the overlay in the second, then you can call the method with a 128 transparancy to merge them together. Or set the transparancy per pixel in the source bitmap
I like these kinds of problems, so here's my two cents...
For simple functionality i would probably only change the CopyMode of the brush, but if I had to have real alpha blending I would create something like the following functionality.
The AlphaBlendRect uses the AlphaBlend function of the Windows API to blend a small bitmap (1x1 pixels) to the target Canvas... easy to understand and to use.
If you promptly have to paint it on to a picture object, then You can use the AlphaBlendRectToGraphic function and pass the Picture.Graphics object as a parameter, (since afaik, that's the only object you'll know always exist on the picture object).
See the examples below...
/Hypo
Business Accounts
Answer for Membership
by: ThievingSixPosted on 2009-10-10 at 19:25:21ID: 25544676
Not sure if pre-Delphi 2009 has the TBitmap.DrawTransperant but if it does then this works fine:
Select allOpen in new window