I would like to share my idea. If you are planning to iterate textview pixels and match color, you first need to get bitmap from textview.
TextView textview = (TextView) findViewById(R.id.text_title);
textview.setDrawingCacheEnabled(true);
textview.buildDrawingCache();
Bitmap bitmap = textview.getDrawingCache();
After that, you can simply check the pixel color by following method:
for(int x = 1; x <= width; x++)
for(int y = 1; y <= height; y++) {
int pixel = bitmap.getPixel(x,y);
int redValue = Color.red(pixel);
int blueValue = Color.blue(pixel);
int greenValue = Color.green(pixel);
//now check if black or white color
if(Color.argb(1,redValue, greenValue , blueValue) == Color.BLACK) {
//do work for black pixel
}
else {
//white pixel
}
}
Hope it helps.