I am using the following code to flip each pixel in a bitmap to black
or white:
for(int x = 0; x < newBitmap.getWidth(); x++) {
for(int y = 0; y < newBitmap.getHeight(); y++) {
int point = newBitmap.getPixel(x, y);
if(point < Color.GRAY) {
paint.setColor(Color.BLACK);
c.drawPoint(x, y, paint);
} else {
paint.setColor(Color.WHITE);
c.drawPoint(x, y, paint);
}
}
}
It works, but it is extraordinarily slow for the size image I'm using
(half the resolution of the camera, 1296x972). I have also tried
setPixel, and I'm getting about the same performance. Anyone out there
know of a faster way to do this?
--
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
To unsubscribe, reply using "remove me" as the subject.