I’m trying to set individual pixels on a bitmap a certain color. What’s stumping me is that I can draw lines just fine….
In the code below, I draw a line starting from 0,0 to 200,200. As expected, a line appears.
But when I attempt to set the color of an individual pixel at the end of a line, nothing appears to happen. Nothing (that I can see) is rendered. Do I need to do something special to set the colors of individual pixels?
canvas.drawBitmap(_bm, 0, 0, null);
canvas.drawLine(0, 0, 200, 200, paint);
_bm.setPixel(200,200, Color.MAGENTA);
It looks like you are changing the pixel on the bitmap after you draw it, try:
also, the bitmap has to be mutable…you can check that with _bm.isMutable()…