img = CreateObject("roBitmap", "pkg:/images/logo.png")
' Scale to 254x82
logoRegion=CreateObject("roRegion", img, 61, 34, 254, 82)
screen.DrawObject(61, 34, logoRegion)
function scale(scalefactor as float,destregion as object,sourceregion as object) as object
sourceregion.setalphaenable(true)
destregion.setalphaenable(true)
destregion.setscalemode(1)
destregion.clear(&h00000000)
ww=sourceregion.getwidth()*scalefactor
w=destregion.getwidth()
hh=sourceregion.getheight()*scalefactor
h=destregion.getheight()
xOffset=(w/2)-(ww/2)
yoffset=(h/2)-(hh/2)
?"Yoffset:";yoffset;" xOffset:";xoffset
destregion.drawscaledobject(xOffset,yOffset,scalefactor,scalefactor,sourceregion)
destregion.finish()
end function
img = CreateObject("roBitmap", "pkg:/images/logo.png")
logoOrginRegion = CreateObject("roRegion", img, 61, 34, img.GetWidth(), img.GetHeight())
logoDestRegion = CreateObject("roRegion", img, 61, 34, 254, 82)
logoScaledRegion = scale(0.5, logoDestRegion, logoOrginRegion)
screen.DrawObject(61, 34, logoScaledRegion)
"coredump" wrote:
I am getting a runtime error using that function:
"psatish" wrote:
I am trying to set a background image on an roScreen from a jpg file url
First I get the file to tmp directory using Http Async get to file. Then create a bit map from the image
background = createObject("roBitmap", "tmp:/background.jpg" )
Is there any solution or work around (other than pre-scaling it at the server)