[Home] [Puzzles & Projects] [Delphi Techniques] [Math topics] [Library] [Utilities]
|
|
Mask drawing is the technique for placing a non-rectangular image on top of another image. Here is an example and the Delphi code to accomplish the trick. The complication is that Windows only knows how to draw rectangles. So what to we do with the dark gray area around the balloon? We get rid of it a 4 step process likes this:
If you have access to Delphi source code, you can browse the TransparentStretchBlt function in the Graphics unit to find Delphi's implementation of this. TBitmap's Draw method calls it when Transparent property is True. The BrushCopy method of TCanvas uses it if BrushStyle is bsClear; TImageList uses the Windows API function ImageList_DrawEx to accomplish the same thing, (I assume in the same manner. Download Delphi source for MaskDraw demo, just to prove that it really works.
|
[Feedback] [Newsletters (subscribe/view)] [About me]Copyright © 2000-2018, Gary Darby All rights reserved. |