i'm write interesting algotitm.in desctop it work fast but in device...can you help me with optimizing?
B4X:
Sub Globals
xx=""
yy=""
End Sub
Sub App_Start
Form1.Show
yy=bimg.Top+(bimg.Height/2)
xx=bimg.Left+(bimg.Width/2)
End Sub
Sub Form1_Mousedown (x,y)
bex.New1(AppPath&"\1.bmp")
angle = Abs(Round(ATan((Y - yy)/(x-xx+0.0001)) * 180/cPI))
If X < xx Then
If y>yy Then
angle=180-angle
Else
angle = angle + 180
End If
Else
If y<yy Then angle=360-angle
End If
'form1.Text=x&","&y&" :"&angle
bex.Rotate(angle,cWhite)
bimg.Image=bex.Value
DoEvents
End Sub
That is probably as fast as it can go subjectively. I think the time is being taken up by the rotate which is doing a lot of floating point ops, and as devices don't have floating point hardware I think that is where the time is going. I doesn't seem that slow anyway, a couple of hundred milliseconds I'd guess, a noticable but not a long delay.
No, you are expecting too much of a relatively low powered device without hardware floating point handling a VGA sized screen quickly without programming at native code level.