transparency - Delphi 6 : How to create a Bitmap with TextOut that has an Alpha channel? -
i'll describe overall goal in case question asked isn't in best form answer i'm looking for. have sphere of words or "word ball" spins around x axis. words spin (z coordinate goes -1 1, front back), intend change size , opacity of each word words in "front" 100% opaque , full-sized , words in smaller , transparent. prefer straight delphi code , avoid things direct3d, etc. have rotation code working fine. need implement z coordinate based perceptual shading idea.
when create word ball dynamically create timage component each word. "print" word timage bitmap using tcanvas.textout() method in centered manner. intend use bitblt copy bitmap correct location in main canvas holds word ball, because bitblt fast , can resize bitmaps on-the-fly, meeting 1 of requirements perceptual shading operation.
but don't know best way facilitate alpha blending. know windows has alphablend() call , seems straightforward use. need know how create bitmap copy of per-word timage component has alpha channel. note, in case entire bitmap have uniform value alpha channel since want opacity applied uniformly entire word, based on it's z coordinate.
does dynamically created timage component bitmap made using tcanvas.textout() have alpha channel? if not, how create one, or create copy of timage bitmap in real time have alpha channel passed alphablend() call? if there's better way let me know.
the documentation says:
the sourceconstantaalpha member of blendfunction specifies alpha transparency value used on entire source bitmap. sourceconstantaalpha value combined per-pixel alpha values. if sourceconstantaalpha 0, assumed image transparent. set sourceconstantaalpha value 255 (which indicates image opaque) when want use per-pixel alpha values.
so guess image doesn't have in special format if want whole image constant transparency.
on other hand, don't think that's want. imagine 1 rectangular area text overlapping another: although parts of rectangle might not have text, they'll still drawn in semi-transparent white, or whatever 1 have background, color.
Comments
Post a Comment