Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
malort
Level 7

DrawText on roScreen transparent background

I have noticed that text drawn on a transparent region does not look crisp. It gets better the less transparent the background is, but it seems fonts only look crisp when they are drawn on non transparent backgrounds. Is there a trick to make this work properly?
0 Kudos
2 Replies
TheEndless
Level 7

Re: DrawText on roScreen transparent background

It's because it anti-aliases to the background color, ignoring the alpha byte. A typical transparent region is filled with transparent black, so the text anti-aliases to black. If you .Clear() the region with a fully transparent version of the same color as the text you're drawing, it should look much better. For example:

region.Clear(&HFFFFFF00)
region.DrawText("My text", 0, 0, &HFFFFFFFF, font)

The same is true when drawing a bitmap to a transparent region with AlphaEnable set to True. I consider this to be a bug, and have reported it to Roku, suggesting that if the alpha byte is zero it should ignore the rest of the color for anti-aliasing, but to date they've disagreed... Smiley Sad
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
malort
Level 7

Re: DrawText on roScreen transparent background

You have just made my day! I appreciate the quick response and workaround! If I would have just changed the background to something like &HFF000000, I would have seen they anti-alias the font with the background color. Thanks again!

"TheEndless" wrote:
It's because it anti-aliases to the background color, ignoring the alpha byte. A typical transparent region is filled with transparent black, so the text anti-aliases to black. If you .Clear() the region with a fully transparent version of the same color as the text you're drawing, it should look much better. For example:

region.Clear(&HFFFFFF00)
region.DrawText("My text", 0, 0, &HFFFFFFFF, font)

The same is true when drawing a bitmap to a transparent region with AlphaEnable set to True. I consider this to be a bug, and have reported it to Roku, suggesting that if the alpha byte is zero it should ignore the rest of the color for anti-aliasing, but to date they've disagreed... Smiley Sad
0 Kudos