I can't believe no one has answered this yet! A rare occurrence on SO!
1
The question doesn't quite make sense to me. But I'll give it a stab.
If you're asking about direct drawing to a canvas (polygons, shading, text etc...) vs. loading a bitmap and blitting it onto the canvas that would depend on the complexity of your drawing.
As the drawing gets more complex the CPU time required will increase accordingly.
However, blitting a bitmap onto a canvas will always be a constant time which is proportional to the size of the bitmap.
2
Without knowing what "something" is how can I show you how to do it?
You should be able to figure out #2 from the answer for #3.
3
Assumptions:
- bmp1 is larger than bmp2.
You want them both overlaid from the top left corner.
private Bitmap overlay(Bitmap bmp1, Bitmap bmp2) {
Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig());
Canvas canvas = new Canvas(bmOverlay);
canvas.drawBitmap(bmp1, new Matrix(), null);
canvas.drawBitmap(bmp2, new Matrix(), null);
return bmOverlay;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…