Im porting an app from Flex to Android and wondering about how to build a composite image and display it.
Specifically I have a map (PNG or JPG) of a house and Im placing different markers in various locations. I've implemented this in HTML using DIV and in Flex using a canvas. Each marker has an X,Y pair based on the original size of the image. Ideally I'd like to display the image, place the markers and then support resize, drag (of the image, not the markers), etc.
There is info about 'multi-touch' available here though its a bit dated.
Suggestions on where to start?
You have to watch out for non-mutable bitmaps. When you load your bitmap, you have to create a copy which will be mutable. Then just apply your overlay using a Canvas.
Bitmap tempBitmap = BitmapFactory.decodeResource(getResources(), R.id.background, options);
Bitmap overlay = BitmapFactory.decodeResource(getResources(), R.id.overlay, options);
Bitmap finalBitmap = Bitmap.createBitmap(tempBitmap.getWidth(), tempBitmap.getHeight(), tempBitmap.getConfig());
Canvas canvas = new Canvas(finalBitmap);
canvas.drawBitmap(tempBitmap, new Matrix(), null);
canvas.drawBitmap(badge, new Matrix(), null);
// finalBitmap will contain your background and its overlay
-I_Artist
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With