Android Question DrawBitmap vs DrawBitmapRotated

ilan

Expert
Licensed User
Longtime User
hi

i am making some test and i noticed that using DrawBitmapRotated with b4x canvas object is much much slower than DrawBitmap but why?
what is the difference between both methods? why is drawing the image with an angle is taking more time than without angle?

i am including a project for showing the difference.

i get about 0-2ms for every timer_tick event when using DrawBitmap and about 6-9 ms when using DrawBitmapRotated (that is about 4 times slower and on ios, it is worse)

thanx
 

Attachments

  • cnv test.zip
    203.2 KB · Views: 16

ilan

Expert
Licensed User
Longtime User
Because the image data is stored and decoded in scanline order it is quicker to draw it to a bitmap in that natural order. To rotate it each pixel needs to be drawn in a non-natural place and that place needs to be calculated so takes more time.
ok i understand. is there a way to improve it? maybe bitmapcreator library?
 
Upvote 0
Top