Large Bitmap Drawing Performance

yttrium

Active Member
Licensed User
Longtime User
What would be the best way to go about drawing multiple high-resolution bitmaps? For example, my app needs to draw up to four 1700x900 images on top of each other. Using the standard Bitmap/Drawing library, it takes up to five seconds on my One X+ (quad core 1.7GHz, Tegra 3) to draw two of those images layered. This is simply not acceptable - I'm not looking for gaming and interactive performance, but reducing that time to around half a second would be optimal.

What library/method should I use to do this? My only requirements are that I can draw multiple bitmaps on top of each other, load bitmaps from a pre-packaged file, and be able to draw some of them at certain offsets.

Thanks,
yttrium
 

yttrium

Active Member
Licensed User
Longtime User
1. Try to use LoadBitmapSample instead of LoadBitmap.
I need to load the full resolution bitmap because it's an image preview, and can be exported at full resolution.

2. You can use GameView to load the bitmaps. GameView uses hardware acceleration for the drawings.
How would I go about performing image manipulation like this (drawing multiple images on top of each other and flattening)?
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I need to load the full resolution bitmap because it's an image preview, and can be exported at full resolution.
What can be exported?

How would I go about performing image manipulation like this (drawing multiple images on top of each other and flattening)?
See GameView tutorial. You can easily draw multiple images as you need.
 
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
What can be exported?
Perhaps I should explain my app more.

I'm working on the Android equivalent of my desktop application, Scrotter:
Scrotter by yttrium!L7tyclief.

Basically, I have say, four layers. One is gloss, one is the device, one is a background shadow, and one is a user screenshot that they import with a "load" button (using intents).

Then, Scrotter would create a bitmap with the height and width of the base device. It would first draw the background shadow (bottom layer), then the screenshot, then the phone around the screenshot (using transparencies), and then gloss on top of that.

It then flattens the bitmap and displays it. The user can preview it and if satisfied, export the full-resolution image without any additional operations.

See GameView tutorial. You can easily draw multiple images as you need.
So I would use the GameView instead of an ImageView?

EDIT: It doesn't look like I would be able to export using the GameView. If necessary, I could implement the GameView for previews, and then do a final redraw for saving.
 
Last edited:
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
Bump?
 
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
Not yet. I'll work on it once I actually have my ViewPager correctly rendering - it seems to only render a view/panel when you're two away from it, and then scroll to it, making the middle panel of 3 impossible to render.
 
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
Is there any way to add standard Android buttons (as per the designer) to a view created as a GameView?
 
Last edited:
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
Did you try the Accelerated Surface library ? It has a Bitmap property that exports the final result in a bitmap.

I've actually found that the default ImageView performs well with hardware acceleration force enabled, and my actual bottleneck is with loading the image from the sdcard. But I'll definitely take a look into this!
 
Upvote 0
Top