Forum Discussion

murphesi's avatar
murphesi
Newbie
12 years ago

roImageCanvas TargetRotation issue with Text being cut off

I am having an issue with rotating text -90 degrees so I can have a vertical display. When I rotate text -90 degrees it seems that the text container is not rotating with the text, thus causing the text to be cut off at around the height that the text would be if it was not rotated. I am instantiating an roImageCanvas object and setting a layer via SetLayer(1, Content-Meta) and using TargetTranslation and TargetRotation to achieve this. Note that I have successfully rotated graphics this way with no issue.

Here is a sample of the code to show the standard text and rotated.

canvas = CreateObject("roImageCanvas")
canvas.Show()

' regular text
canvas.SetLayer( 1, { Text: "My Text", TargetRect: { x:0, y:0, w:400, h:50 } } )

' rotated text
canvas.SetLayer( 3, { Text: "My Text", TargetRect: { x:0, y:0, w:400, h:50 }, TargetTranslation: { x:0, y:400 }, TargetRotation: -90.0 } )


Roku 2XS 3100X

13 Replies

  • I haven't looked at any of the updated Roku code to see if this issue still exists, but I guess from your experiments crawfishmedia that it still exists. Roku devs...anything? I've been using an external server to general an image that has the text rotated for me for the past year. It would be nice to have this working!
  • The easiest and quickest fix would probably be to switch to using the 2D API instead. Using it, you could create the text on a bitmap, then rotate it before drawing it to the roScreen. I don't know how complex your screen layout is, but figuring that out would almost certainly be a lot faster than waiting on Roku to release a firmware update to fix text rotation on the roImageCanvas. Just my opinion...
  • Boner achieved!

    screen = CreateObject("roScreen")
    port = CreateObject("roMessagePort")
    screen.SetMessagePort(port)

    fontRegistry = CreateObject("roFontRegistry")
    font = fontRegistry.GetDefaultFont()

    bitmap = CreateObject("roBitmap", {width:1280, height:720, AlphaEnable: true})
    bitmap.Clear(&h000000FF)
    bitmap.DrawText("Credit: Full Name (username)",0,0,&hCBCBCBFF,font)
    screen.DrawRotatedObject(128,70,270,bitmap)
    screen.Finish()

    Now I have to completely code my own slideshow handler instead of roCanvas or roSlideshow. Happy we resolved this but angry about the workarounds that have to be done.
    Thanks!!!