Before I made this topic I've read books, guides and tutorial. Right
now I'm porting a game engine to the Android platform.
I got a problem. I'll describe it in steps:
1. Drawing a bitmap on Canvas
bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
canvas = new Canvas(bitmap);
canvas.drawColor(color, PorterDuff.Mode.CLEAR);
2. Remove the trace that is left behind by the Canvas
canvas.clearBitmap(); --> seems not working.
public void clearBitmap()
{
canvas.drawColor(0x00000000, PorterDuff.Mode.CLEAR);
}
3. Putting the drawColor in a other method seems working
public void copyPixels(BitmapData sourceBitmapData, Rectangle
sourceRect, Point destPoint, BitmapData alphaBitmapData, Point
alphaPoint, boolean mergeAlpha)
{
Rect source = new Rect((int) sourceRect.left, (int) sourceRect.top,
(int) sourceRect.right, (int) sourceRect.bottom);
Rect dest = new Rect((int) destPoint.x, (int) destPoint.y, (int)
destPoint.x + (int) sourceRect.getWidth(), (int) destPoint.y + (int)
sourceRect.getHeight());
Paint paint = null;
canvas.drawColor(Color.BLUE, PorterDuff.Mode.CLEAR);
canvas.drawBitmap(sourceBitmapData.getBitmap(), source, dest, paint);
}
It clears the traces, but the canvas (which is blue) is over the whole
screen. Multiple bitmaps got overlapped by the top Canvas.
Please help me. If you need better code just say it.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en