Draw a resized Image with B+?

BlitzPlus Forums/BlitzPlus Programming/Draw a resized Image with B+?

Grisu(Posted 2003) [#1]
The following Code works perfectly with B3D 1.83.
But it produces a memory leak with B+ and show a white rectangle instead of a resized image.

; Vars
Global drawresizedimage_tempimage=CreateImage(64,91)
Global drawresizedimage_tempimage_ib=ImageBuffer(drawresizedimage_tempimage)
MaskImage drawresizedimage_tempimage,255,0,255

Function DrawResizedImage(image,imgframe,x,y,width#)
; only shrinks a 64x91 image on the x-scale and draws the result on screen
SetBuffer drawresizedimage_tempimage_ib
Rect 0,0,64,91,1
SetBuffer BackBuffer()
ib=ImageBuffer(image,imgframe)
stp#=64/width#
sourx#=0
destx=0
While sourx#<width#+64
CopyRect sourx#,0,1,91,destx,0,ib,drawresizedimage_tempimage_ib
sourx#=sourx#+stp#
destx=destx+0.99
Wend
DrawImage drawresizedimage_tempimage,x,y
;Delay(200)
End Function

Does someone knows a trick how to make this work again?

All help is greatly appreciated!

*looks even more helpless*


Grisu(Posted 2003) [#2]
Took me some time, but somehow?!? I fixed the issue.

Seemed like the copyrect did not clean up the full image at all, thus the right side of the sized image got white?...

TOPIC closed! :)