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: 
jkard
Visitor

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 2
RokuMarkn
Visitor

Re: Centering An Image On roImageCanvas

TargetRect has a "t" on the end.

--Mark
0 Kudos
jkard
Visitor

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