[as-devel] Rotating text, and other funky text effects.
Sasha_Vasko@osca.state.mo.us
Thu, 22 Apr 1999 09:27:48 -0500
Looking at all this rotating text posts on AS ML I had a most wonderfull idea,
as to how to implement this and some other stuff without too much resource
utilization.
What we can do is to employ the same approach used in GIMP when text is
created, by maksing one layer with another:
a) Preparation :
1. We create pixmap of 1bpp color depth of the size of the text in the title
bar,
2. We DrawText of the titlebar into this pixmap with white color.
3. We rotate this pixmap -90 degrees, if vertical text is desired.
We can do this only when text to be displayed changes, and then just store
this prepared Mask in some safe place.
b) Usage :
1.) We cut a piece of prepared pixmap of the size of titlebar, if it's smaller
then
pixmap.
2) We create another pixmap of the same size, and fill it with text color
3) We display text on the titlebar by masking second pixmap with our prepared
mask pixmap.
3D look can be achieved , by simply repeating this operation,
shifting Mask a few pixels, while dimming second pixmap to get Relief colors.
-90 degrees rotation is merely linear memory copy operation and should not
be a CPU hog if we employ similar techiques as in shading functions ( direct
access
to XImage storage ).
All this operations are not very resource consuming, and I bielive that it could
be
even faster then regular DrawText, even thou it will eat up some memory.
So we could possibly utilize this approach for all other displaying operations.
Another nice feature becomes possible : pixmapped, gradiented or transparent
text, as far as it does not make much difference with what we fill our pixmap to
be masked.
So ForeGradient and ForePixmap becomes possible options of MyStyle definition :)
Sasha.