Reputation: 401
Good Morning,
I have an ImageView
that I initialized with #99aaaaaa
color (it corresponds to 153,170, 170,170). after that I draw some lines with different colors. and Now I want to Fill my Canvas with the original color (#99aaaaaa)
.
The method myCanvas.drawColor(OriginalColor)
fills the canvas with OriginalColor, but the lines still visible
myPaint.setColor(OriginalColor);
myPaint.setStyle(Paint.Style.FILL);
myCanvas.drawRect(0, 0, 170, 170, myPaint); // my ImageView is 170X170
Also let lines visible.
Any help please, Thank You
Upvotes: 2
Views: 3403
Reputation: 81
Set the transfer mode as follows, before calling drawRec():
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
Reset the painter afterwards, for further drawing:
paint.setXfermode(null);
paint.setColor(0xFFFFFFFF);
Upvotes: 1
Reputation: 1364
as the canvas original color is semi transparent, then you draw something on it and draw another layer of semi transparent stuff, then its pretty obvious youll see the level-down-layer through the top transparent layer isnt it? another words, if you place a half transparent glass on your knees, ull still see the knees through it
Upvotes: 1