Roku Developer Program

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

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
squirreltown
Level 8

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

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

Re: Image fitting in roscreen with passing 4 parameter

Thanx squirreltown and TheEndless for quick reply. It's working great .
0 Kudos