Roku Developer Program

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

Centering An Image On roImageCanvas

I'm working with the roImageCanvas for the first time today, and am using it as a "Screen Facade" as recommended in the Developer Guidelines handbook. I'd like to center an image on the roImageCanvas, but am having issues getting it to do this.

    screenFacade = CreateObject("roImageCanvas")
screenFacade.SetLayer(0,{Color:"#FF000000", CompositionMode:"Source"})
canvasItems = [
{
url:"pkg:/images/Splash/Splash.png"
TargetRec:{x:390, y:357, w:400, h:200}
}
{
Text:"Loading..."
TextAttrs:{
Color:"#FF0000",
Font:"Medium",
HAlign:"HCenter",
VAlign:"VCenter",
Direction:"LeftToRight"
}
}
]

screenFacade.SetRequireAllImagesToDraw(true)
screenFacade.SetLayer(1,canvasItems)
screenFacade.Show()


No matter what I set in the "TargetRec" for my image, it is always displaying in the upper left corner of the monitor. What am I doing wrong and how do I center it?

Thanks all!!
Jay
0 Kudos
2 Replies
Highlighted
Level 7

Re: Centering An Image On roImageCanvas

TargetRect has a "t" on the end.

--Mark
0 Kudos
Highlighted
Level 7

Re: Centering An Image On roImageCanvas

Ahh!! Great, silly mistake on my part. I was thinking wrong on how the "TargetRect" was used, thanks for the great catch Mark!

Best
Jay
0 Kudos