Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted

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
Highlighted

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

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
Highlighted

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

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