Android Question High speed drawing on canvas gives issues in B4A

wimpie3

Well-Known Member
Licensed User
Longtime User
In B4J I'm currently using canvas.DrawImage2 to draw about 920 (small) bitmaps at the same time on the screen. This works very fast and I get a consistent frame rate of about 1ms to draw all these bitmaps.

In B4A I'm using canvas.DrawBitmap (+ an invalidate) to do exactly the same and the performance is a lot worse. I get random times between 1ms and 20ms per frame.

What I've tried:
- switching to B4XCanvas, but that means it's not possible to draw a part of a bitmap without cropping the image to be pasted first
- switching to bitmapcreator, but that only makes the performance worse (it seems that bitmapcreator is written in b4x itself)

So what I'm basically looking for is a way to speed up drawing using hardware acceleration. But that doesn't seem to be supported in B4X? What are my options?
 

emexes

Expert
Licensed User
920 (small) bitmaps at the same time on the screen.

I have a very faint recollection of having around 100 "analog" gauges on screen at once, each with its own independent animated (rotating) needle, done using panels or maybe imageviews, with Android flinger hardware doing the hardwork.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
In B4A I'm using canvas.DrawBitmap (+ an invalidate)
When do you call Invalidate ? After each DrawBitmap or only once at the end ?
I hope that you test it in Release mode.


each with its own independent animated (rotating) needle, done using panels or maybe imageviews,
With Panels as B4XView and B4XCanvas.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…