Hi guys!
I want to know what is the best way (fastest) to achieve a ScrollImage Function.
Here is my code:
Hope it will exits a quickest method...
I want to know what is the best way (fastest) to achieve a ScrollImage Function.
Here is my code:
Function ScrollImage(image:TImage, xamount:Int, yamount:Int = 0, frm:Int = 0) Local pixmap:TPixmap, pixres:TPixmap Local p:Int Local w:Int, h:Int, i:Int, j:Int, x:Int, y:Int Local r:Int pixmap = LockImage(image, frm) w = PixmapWidth(pixmap) h = PixmapHeight(pixmap) If Abs(xamount) > w Then r = xamount / w xamount:-(r * w) End If If Abs(yamount) > h Then r = yamount / h yamount:-(r * h) End If pixres = CopyPixmap(pixmap) For j = 0 To h - 1 For i = 0 To w - 1 p = pixres.ReadPixel(i, j) x = i If xamount <> 0 Then x:+xamount If x > w - 1 Then x:-(w - 1) If x < 0 Then x:+w End If y = j If yamount <> 0 Then y:+yamount If y > h - 1 Then y:-(h - 1) If y < 0 Then y:+h End If pixmap.WritePixel(x, y, p) Next Next End Function
Hope it will exits a quickest method...