Forum Discussion

rbenditt's avatar
rbenditt
Streaming Star
2 years ago

DrawText not working on Roku OS 13

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.

7 Replies

  • renojim's avatar
    renojim
    Community Streaming Expert

    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.

    • rbenditt's avatar
      rbenditt
      Streaming Star

      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.

      • renojim's avatar
        renojim
        Community Streaming Expert

        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.