coredump
11 years agoVisitor
roBitmap Scale
I have a HD image that I want to scale to fit in a given region, is there a way to do this ? Currently, it is cropped to the region. img = CreateObject("roBitmap", "pkg:/images/logo.png") ' S...
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