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

Image fitting in roscreen with passing 4 parameter

Hi,
As i have seen in your Roku forum for solution image fitting in roscreen:
viewtopic.php?p=352338

You have provided " DrawScaledObject " solution.
DrawScaledObject(x as Integer, y as Integer, scaleX as Float, scaleY as Float, src as Object) as Boolean

but i am unable to use it. i am creating it in following way under for loop.

             bm=createobject("roBitmap", my images come here) 
m.screen.DrawScaledObject(FIX(marginX), FIX(marginY), imageWidth, imageHeight, bm)


please provide me some example of using DrawScaledObject, where i can pass 4 parameter: x,y,image's width, images's height. and show it on roscreen, just like we pass in roimagecanvas under TargetRect.
I would be thankful for any help
0 Kudos
3 REPLIES 3
squirreltown
Roku Guru

Re: Image fitting in roscreen with passing 4 parameter

"cpjamloki" wrote:
m.screen.DrawScaledObject(FIX(marginX), FIX(marginY), imageWidth, imageHeight, bm)


imagewidth and imageheight need to be floats - 1.0 is no scaling, .5 would be 50%, 2.1 would be 210% etc.

so:
m.screen.DrawScaledObject(FIX(marginX), FIX(marginY), .5, .5, bm)
Kinetics Screensavers
0 Kudos
TheEndless
Channel Surfer

Re: Image fitting in roscreen with passing 4 parameter

As squirreltown noted, the third and forth parameters are the scaling factor, not the final width and height. Try this:
m.screen.DrawScaledObject(FIX(marginX), FIX(marginY), imageWidth / bm.GetWidth(), imageHeight / bm.GetHeight(), bm)
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
cpjamloki
Visitor

Re: Image fitting in roscreen with passing 4 parameter

Thanx squirreltown and TheEndless for quick reply. It's working great .
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.