Bitmap handling question

sorex

Expert
Licensed User
Longtime User
Hello,

I've been doing some test to have random cuts from bitmaps by using a not so elegant method of panels and imageviews which are getting moved around to get some kind of masking.

All seemed to work fine till some point that my app crashes when creating larger amounts of let them call it tiles.

I get out of memory errors due to the multiple bitmap loading (each 'tile' has the full picture in it, altho it's not that big (360x360px) it causes issues)

Are there really no other ways to get this done with a more elegant way?

In flash you have bitmap copy commands but I seem to mis that here, only noticed rectangular fills for canvases but no copy.

Any advice would be appreciated.
 

COBRASoft

Active Member
Licensed User
Longtime User
Make 1 global variable holding the bitmap and paint the 'tiles' yourself onto the panels. Be sure to paint only the visible parts, no need to paint the whole bitmap each time. This will make it faster and use less memory. It will also give you full control.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
I get out of memory errors due to the multiple bitmap loading (each 'tile' has the full picture in it, altho it's not that big (360x360px) it causes issues)
In addition to what COBRASoft said, do you also need to scale your bitmaps down if you are not displaying them full size.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
Make 1 global variable holding the bitmap and paint the 'tiles' yourself onto the panels.

That was the actual plan, but I didn't find any rectangular bitmap copy function.

You want to do this with getpixel and canvas drawpoint?
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
ok got it working.

I focussed too much on the "copy" word.

It's DrawBitmap that I need to copy a part of the bitmap to the canvas.
 
Upvote 0
Top