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: 

Centre an Image

Hi

If I use this code:
canvasImg = CreateObject("roAssociativeArray")
canvasImg = [
{
url:imageUrl
TargetRect:{x:0,y:0,w:cw,h:ch}
}]

Regardless of the size of the target image it is scaled up to fit the screen.

And.. If I knew the image size, I could calculate the co-ords to make the image load in the centre of the screen....
...But is there a way to just make Brightscript automatically centre the image -as is- without any scaling - IF - you don't know the size of the target image?

I was looking for HAlign and VAlign properties like you have with TEXT..?

Thanks in advance if anyone can advise.
0 Kudos
2 REPLIES 2

Re: Centre an Image

Sorry - I should add in the above code cw and ch are canvas width and height that has been calculated to be screen size.
0 Kudos
TheEndless
Channel Surfer

Re: Centre an Image

No, there are not image alignment options on the roImageCanvas. You'll need to specify the exact dimensions and location.

There's some sample code in this thread that might help: viewtopic.php?f=34&t=84194
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos