[Kde-games-devel] Colour fonts

Johnny Andersson kde-games-devel@mail.kde.org
Mon, 20 Jan 2003 14:55:20 +0100


On Thursday 16 January 2003 12.30, Troy Corbin Jr. wrote:

> > Would it be considered OK practise to render the characters that's go=
ing
> > to be used to an offscreen bitmap, (using regular QT text output
> > functions), manipulate it, and then use custom text routines to show =
it?
>
> Are you talking about using that QPixmap strictly for the fonts only, a=
nd
> then using a QPainter or bitblt to copy the text onto your widget? This=
 is

Exactly.

> possible, but I think it would only be useful if your font effects are =
so
> complicated that they can't be rendered in real time. Something simple,
> like a color font with a dropshadow, could easily be done in real time.

Yes, many simple effects could be done in real time, assuming=20
double-buffering.

> The method you mentioned is perfect for animated effects. For example,
> start with a transparent pixmap. Draw your text onto it, but draw it cl=
ose
> to the bottom. Display it. Now apply an effect on the pixmap, like
> KIconEffect::semiTransparent( QPixmap ). Draw your text again, but a li=
ttle
> higher. Rinse, repeat. You'll get a nice moving bit of text with a fadi=
ng
> tail. This would be perfect for score-up displays.

True. Actually, the real-time method works for my needs, but it'd be nice=
 if=20
KDE had some fancy-text-output classes.

> > Is there another way? Also, perhaps this could be adressed in a more
> > general way since I'm sure many games and entertainment apps could
> > benefit from "happier" fonts.
>
> I hope you're starting to think of some other nifty ways to display tha=
t
> text. Perhaps we should compile a list of text effect and the ways to
> display them using Qt and KDE? :-)

Hmmm, yeah.. If we get a lot of good ideas to make it worth the trouble.