PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Suggestion

I just spent some time implementing a fading text window, and I have a suggestion.

Have a flag in DrawText allowing the opacity of the text to be set.

I have to manually create a surface, draw the source bitmap to that surface, draw the text, then draw that whole surface, with varying opacity, to the backbuffer.

Having an opacity feature in DrawText would prevent the creation of a surface and 1 blit on each render.

Might sounds like I'm lazy, but I assume that implementing opacity in DrawText would be much more efficient that what I'm doing.

Later!
Unless you're changing the text during the fade you should only have to draw the text once to a surface and then you can use standard blits to fade that blit. There's no need to continuously draw the text during the fade.
I draw the text on a "window frame" that is animated and needs to be redrawn. The frame is alpha blended with the background which also may, or may not, be animated.

Making the frame static, I could indeed just draw the text on the frame and keep that surface in memory while I change its opacity.

Maybe I'll do that.

Thanks!
Or you can just draw the text to a surface once and when you're blitting it onto the frame you can then use standard blits for that.

My GUI engine actually does this for text. I have an internal surface for each control for text. When the text is changed I resize and redraw the text onto the surface, otherwise I just blit the surface like any other.
Hosed: Nice solution! As usual :)...

Efortier: Thanks for the suggestion, the next release will have opacity in DrawText. I will also pre-render the entire system font for performance improvements...