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: 

Re: roBitmap Scale

"squirreltown" wrote:

If you use Texture Manager to grab the bitmap you can specify a size in pixels, but not percentage unfortunately. Otherwise, you'll need to create a blank bitmap at the desired size and draw the background into that using scaling.

I don't think so even roTextureManager can handle images larger than 2048x2048. Will have to pre-scale larger images server side.
0 Kudos

Re: roBitmap Scale

"psatish" wrote:
Hi

I assume you mean using
DrawScaledObject(x as Integer, y as Integer, scaleX as Float, scaleY as Float, src as Object) as Boolean
But this function takes either a roBitmap or roRegion and source, it doesn' t take a file as source. In order to use this we need to get the file into bitmap first. So this wont work

Yes, that way, you can scale it, to avoid doing it again and again you can write a method to do it.

function GetScaledImage(path, w, h)
bitmap = CreateObject("roBitmap", path)
if bitmap <> invalid
scaledBitmap = CreateObject("roBitmap", {width: w, height: h, AlphaEnable: true})
if scaledBitmap <> invalid
if scaledBitmap.DrawScaledObject(0, 0, w/bitmap.GetWidth(), h/bitmap.GetHeight(), bitmap) = true
return scaledBitmap
end if
end if
end if
return invalid
end function
0 Kudos
squirreltown
Roku Guru

Re: roBitmap Scale

"scorpiontahir02" wrote:
"squirreltown" wrote:

If you use Texture Manager to grab the bitmap you can specify a size in pixels, but not percentage unfortunately. Otherwise, you'll need to create a blank bitmap at the desired size and draw the background into that using scaling.

I don't think so even roTextureManager can handle images larger than 2048x2048. Will have to pre-scale larger images server side.


I've done it, so I'm pretty sure it can.
Kinetics Screensavers
0 Kudos

Re: roBitmap Scale

"squirreltown" wrote:

I've done it, so I'm pretty sure it can.

Then I would agree roTextureManager is better way to get and scale images.
0 Kudos
squirreltown
Roku Guru

Re: roBitmap Scale

"psatish" wrote:
Hi

I assume you mean using
DrawScaledObject(x as Integer, y as Integer, scaleX as Float, scaleY as Float, src as Object) as Boolean
But this function takes either a roBitmap or roRegion and source, it doesn' t take a file as source. In order to use this we need to get the file into bitmap first. So this wont work


Yes, you are correct, that only applies to things less than 2048 which you had figured out already, I should have paid a little more attention.
Kinetics Screensavers
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.