im doing a simple paint program.
I'm drawing to a custom Bitmap and then draw this bitmap to the canvas in the onDraw method.
custom bitmap and canvas creation:
bitmap = Bitmap.createBitmap(w - 150,h,Bitmap.Config.ALPHA_8);
canvasa = new Canvas(bitmap);
when someone touches the screen a circle gets drawn:
canvasa.drawCircle(x, y, 10, paint);
which works fine, but every time the bitmap gets drawn on Screen, every circle has the same color (the paints current color):
@Override
protected void onDraw(Canvas canvas) {
canvas.drawBitmap(bitmap,0,0, paint);
super.onDraw(canvas);
}
So if i have a red circle, change the color to blue and draw another circle, both circles in the bitmap are blue. Why is that? And how do I fix this?
Bitmap.Config.ALPHA_8
– pskink