Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
malort
Visitor

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 2
TheEndless
Channel Surfer

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... 😞
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
Visitor

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... 😞
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.