Board index » delphi » Transparent text in TextOut ?

Transparent text in TextOut ?

I looked everywhere in the online help, and in the books,
but nowhere I found a property like "Transparent" to
apply to a font. So, if I need to "draw" some text using
TextOut() on a bitmap, I am not able to write it in
transparent mode ! (this is the default mode for TextOut
from Windows API).

Actually, I have to create a bitmap (or use a free portion
of the destination bitmap), then use TextOut to draw text
on this Bitmap, and then use CopyRect() with SrcAnd copy
mode to copy the text in transparent mode. It is very long !
I can't immagine that Delphi don't give us a way to draw
transparent text.

Did anybody find this information ?

Thank you.

--
o?o?,,?o?oo?  Jean-Michel CAMBOT   ?oo?o?,,?o?o
o?o?,,?o?oo?  balic...@cge-ol.XXX.fr   ?oo?o?,,?o?o
... Please remove XXX from the address to answer ...
Site BALICIEL French : http://www.cge-ol.fr/baliciel/  ;o)
Site BALICIEL English : http://www.cge-ol.fr/baliciel/welcome1.htm  ;o)

 

Re:Transparent text in TextOut ?


"Jean-Michel CAMBOT" <balic...@cge-ol.REMOVE TO ANSWER.fr> wrote:

Quote
>I looked everywhere in the online help, and in the books,
>but nowhere I found a property like "Transparent" to
>apply to a font. So, if I need to "draw" some text using
>TextOut() on a bitmap, I am not able to write it in
>transparent mode !
>(this is the default mode for TextOut from Windows API).

BTW, I think the default value is "opaque", not transparent.

Quote
>Actually, I have to create a bitmap (or use a free portion
>of the destination bitmap), then use TextOut to draw text
>on this Bitmap, and then use CopyRect() with SrcAnd copy
>mode to copy the text in transparent mode. It is very long !
>I can't immagine that Delphi don't give us a way to draw
>transparent text.

Set the brush style to bsClear. Ie.: Bitmap1.Canvas.Brush.Style :=
bsClear. This will call SetBkMode internally.

Regards,

Jani J?rvinen
a.k.a SilverStream Software
Helsinki Finland

Tools, information, tips, reviews & bug lists
for professional Delphi, Win32 and WinHelp developers.

mailto:ja...@dystopia.fi
http://www.dystopia.fi/~janij/

Re:Transparent text in TextOut ?


Jean-Michel,
  Try chanbing the canvases brush style to bsClear before your call to
TextOut.  E.g.:

Image1.Canvas.Brush.Style := bsClear;

Hope this helps!
--
Rod Geraghty (:>)
GERA-Tech
Ottawa, Canada
gera...@ibm.net

Jean-Michel CAMBOT <balic...@cge-ol.REMOVE TO ANSWER.fr> wrote in article
<01bc2680$b8417c20$LocalH...@baliciel.cge-ol.fr>...

Quote
> I looked everywhere in the online help, and in the books,
> but nowhere I found a property like "Transparent" to
> apply to a font. So, if I need to "draw" some text using
> TextOut() on a bitmap, I am not able to write it in
> transparent mode ! (this is the default mode for TextOut
> from Windows API).

> Actually, I have to create a bitmap (or use a free portion
> of the destination bitmap), then use TextOut to draw text
> on this Bitmap, and then use CopyRect() with SrcAnd copy
> mode to copy the text in transparent mode. It is very long !
> I can't immagine that Delphi don't give us a way to draw
> transparent text.

> Did anybody find this information ?

> Thank you.

> --
> o?o?,,?o?oo?  Jean-Michel CAMBOT   ?oo?o?,,?o?o
> o?o?,,?o?oo?  balic...@cge-ol.XXX.fr   ?oo?o?,,?o?o
> ... Please remove XXX from the address to answer ...
> Site BALICIEL French : http://www.cge-ol.fr/baliciel/  ;o)
> Site BALICIEL English : http://www.cge-ol.fr/baliciel/welcome1.htm  ;o)

Other Threads