I have a Canvas
object at start. I need to change color of some pixels depending on their current color. How can I do that in a proper way?
Details:
I have my own class extended from ImageView
. In onDraw(Canvas canvas)
method I draw something with third party class and have only Canvas
object with result. I need after that change color of some pixels depending on their current color.
Assuming that you have android.graphics.Canvas
object called canvas
and X
& Y
are points where you want to change pixel, so here you go
Call :
canvas.drawPoint(X, Y, paint);
Here is how you initalize Object of class android.graphics.Paint
i.e paint
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.WHITE);
Search more on this Link to change multiple pixels at different positions, there are lot many functions that will help you achieve what you want. Best luck :-)
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