I have an app where I'm drawing bitmaps using the draw2d interface. When my Roku devices were updated to the latest Roku OS 13, calls to the DrawText function no longer produce output. Everything else on the bitmap still looks good, such as DrawLine.
I have another old test device running Roku OS 11 and I can see that the same code still works as expected on it.
Here's some simplified code that illustrates the problem:
m.theBitmap = CreateObject("roBitmap", {width: 200, height: 200, AlphaEnable: true})
font_registry = CreateObject("roFontRegistry")
font = font_registry.GetDefaultFont()
theColor = &hFF0000FF ' Red
'theColor = &hFF000000 ' Red - transparent
'theColor = &h00FF00FF ' Green
'theColor = &h00FF0000 ' Green transparent
i = m.theBitmap.drawText("HELLO", 50, 50 , theColor, font)
m.theBitmap.Finish()
As you can see, I've experimented with different colors to test for a possible bug with transparency, but nothing shows up no matter what color is set. Hopefully there's a workaround or bug-fix coming so that I don't need to refactor to pure SceneGraph elements.
I make extensive use of DrawText on bitmaps in my games and you had me worried, but I just tried them and they still seem to work. @RokuBen mentioned here that Roku OS 13.0 "has a major internal change in how roScreen applications are drawn compared to 12.5". I had an issue with one of my apps where it worked on 12.5.5, but not 13.0. It turned out that what I was doing probably should have never worked.
The only difference I see with your code and mine is that I always specify parameters to GetDefaultFont:
font = CreateObject("roFontRegistry").GetDefaultFont(28,true,false)
I also make use of GetOneLineHeight and GetOneLineWidth to size the bitmap when necessary.
Good to know that it's not completely broken then if it still works in your app. I just tried your line of code to define a font with all the parameters specified and I still get nothing drawn. It appears that the font is not nil (invalid) because I can see proper results with the GetOneLineHeight and GetOneLineWidth calls. Just no text ever gets drawn to the bitmap for some reason.
Do you have a complete example you can share? The one nice thing about not using Scene Graph is that you pretty much only need one BRS file.
I've constructed a simple example app with hopes of illustrating the problem. Of course, the simple example renders text just fine.
I've tweaked the simple example project to call DrawText prior to a long loop of random line drawing. It all worked up to 36,000 lines then the app just became unresponsive. I don't think this was my problem as I've only been drawing a couple hundred items at most, not many thousand.
I've had some degree of success in my real app by moving the DrawText calls from the beginning of the bitmap creation to after all of the lines are drawn, just prior to the bitmap.finish() call. This certainly feels like a klugey workaround, but it does illustrate that DrawText is working to some degree. The text rendering is still inconsistent, usually working completely but occasionally it misses some of the text on some app launches.
Roku Resource Monitor shows a huge spike to over 22MB in texture memory while drawing the bitmap items, then it seems to settle out at around 7MB. I suspect that my issue has to do with changes in how Roku OS 13 manages texture RAM and it's less tolerant of how my app is doing things. App optimization of my drawing functions is one path forward.
One thing worth pointing out is that my app is very non-standard. It is a SceneGraph app where I'm constructing bitmaps in a taskNode, saving the bitmaps to the file system, then loading them into SceneGraph poster elements. Combining bitmaps with SceneGraph is probably just looking for trouble, but up until Roku OS 13, it was working pretty well. I'm getting the feeling that I'd be better off abandoning bitmaps and doing the entire drawing with SceneGraph rectangles instead.
try building a MWE (Minimal Working Example) that demonstrates yours issue - the way your app faces it (creating `roBitmap` in RSG task thread) and then email partnersuccess at roku.com with that. It is a good time to report bugs while rOS 13 is fresh
Sounds like a good plan. Thanks guys!
Do you have a published channel showing this problem? Does it still happen with 13.1.4?