Android Question Best method to draw scaled bitmaps?

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
I've searched and not found a recent example with B4XBitmap/BitmapCreator/DrawTask so I figured I'd ask for a recent "best practices" example.

I've got a large map/picture that is supplied ad hoc by the user (which can be quite large, say 2500x2500), and I need to zoom in out similar to a viewport function on .NET GDI. I don't want a user control or library, since I'll need to apply markings/text to the image along the way before final rendering.

I'm confused between B4XBitmaps, BitmapCreator and just plain old InitializeMutable. So, assuming you have a large random bitmap (as opposed to a Tiled map or asset image) that gets marked up and you need to zoom in/out on it what would be the best (i.e. least memory intensive, fastest rendering, etc.) methodology to adopt using B4A 8.8?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
I did see that Don, thanks! The users will be clicking the image and adding annotations (e.g. "excessive wear" or "fracture", etc.) which will need to be rendered at a specific font size on top of the image with a line drawn to where they clicked, regardless of the zoom factor, so the zoom will be more like a spinner with pre-set percentages. Due to this specification I didn't think that library would be adequate.
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
B4XCanvas = cross platform wrapper of Canvas.
One last follow-up question then, as I am a little fuzzy on Android garbage collection/resource allocation: I will have the canvas drawing routines in classes, is it better to create a canvas and use it in each routine as needed or to create it once in the "main" class and keep a reference to it, passing it to the various modules as needed?
 
Upvote 0
Top