Forum Discussion
MazeWizzard
14 years agoVisitor
IDK if I could be doing something wrong, but DrawScaledObject() isn't behaving as expected, even when it does draw.
For example, I'm scaling a bitmap up by 2x in each direction. This is done so that I only need 1/4 of the space to store the bitmap. The bitmap is wider than the screen/viewport. I use an roRegion object to scroll through it. regionStart% represents the x-offset into that source bitmap. The ViewBM is the destination bitmap that receives the scaled object.
There is an extra line of testing code as noted by the arrow. It shows an unscaled version of the source in the upper left of the viewport.
The issue: the unscaled bitmap works fine and scrolls as expected as regionStart% is incremented. bw% and bh% are set to the correct sub-section of the source bitmap. The scaled result is moving diagonally even though the source region's Y value is 0. The scaled map at source-region 0,0 looks fine (hard to tell with overscan).
Thus, there seems to be an issue with a source region not at 0,0. This could be remedied by blitting it to a temp bitmap 1st, then scaling that, but I thought I should mention it since it is supposed to work on an roRegion. Or did I miss something/mess up my code and/or not understand the function?
Anyone else have an issue with a scaling bitmap using roRegion/DrawScaledObject at non 0,0 source?
P.S. Software version 3.0 - build 2227
For example, I'm scaling a bitmap up by 2x in each direction. This is done so that I only need 1/4 of the space to store the bitmap. The bitmap is wider than the screen/viewport. I use an roRegion object to scroll through it. regionStart% represents the x-offset into that source bitmap. The ViewBM is the destination bitmap that receives the scaled object.
<snip>
backgroundRegion = CreateObject("roRegion", BackgroundBM, regionStart%, 0, bw%, bh%)
ViewBM.DrawScaledObject(0, 0, 2.0, 2.0, backgroundRegion)
ViewBM.DrawObject(0,0, backgroundRegion) ' <--- DEBUGGING test window - unscaled in u/l corner
BackgroundSprite.SetRegion(viewRegion)
<snip>
There is an extra line of testing code as noted by the arrow. It shows an unscaled version of the source in the upper left of the viewport.
The issue: the unscaled bitmap works fine and scrolls as expected as regionStart% is incremented. bw% and bh% are set to the correct sub-section of the source bitmap. The scaled result is moving diagonally even though the source region's Y value is 0. The scaled map at source-region 0,0 looks fine (hard to tell with overscan).
Thus, there seems to be an issue with a source region not at 0,0. This could be remedied by blitting it to a temp bitmap 1st, then scaling that, but I thought I should mention it since it is supposed to work on an roRegion. Or did I miss something/mess up my code and/or not understand the function?
Anyone else have an issue with a scaling bitmap using roRegion/DrawScaledObject at non 0,0 source?
P.S. Software version 3.0 - build 2227