OK, it is good and fast but ... I was already using a fast routine that I found on blitzcoders (I think). I am using it to scale up some text smoothly (1 iteration per frame) and it is ever so slightly faster that your code when the text gets bigger. Don't know why. I am talking your code takes max 14-15ms to do my scaling and the other code takes max 10-11ms to do the same scaling. But thanx anyway. Oh yeah your function is easier to use too.
the other code is this:
the other code is this:
Global scratch%=CreateImage(640,480) ;this should be freed later Function DrawSizeImage(image,x%,y%,w%,h%) Local ih%=ImageHeight(image) Local iw%=ImageWidth(image) Local sw%=Abs(w) Local sh%=Abs(h) Local xr#=(Float(iw)/Float(sw)) Local yr#=(Float(ih)/Float(sh)) fromimg=ImageBuffer(image) toimg=ImageBuffer(scratch) Local vf=-1+((h>0)*2) Local fw=(w<0)*w Local fh=(h<0)*h If w>=0 For ix=0 To sw CopyRect ix*xr,0,1,ih,ix,0,fromimg,toimg Next Else For ix=0 To sw CopyRect ix*xr,0,1,ih,sw-ix,0,fromimg,toimg Next EndIf For iy=0 To sh CopyRect 0,iy*yr,sw,1,x+fw,y+(iy*vf),toimg Next End Function