So, what I am trying to do is if I click the button, it will tint a image that is on the same screen with orange color (70%).
Button OrangeButton= (Button) findViewById(R.id.OButton);
OrangeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
imageCapture = (ImageView) findViewById(R.id.imageCapture);
BitmapDrawable drawable = (BitmapDrawable) imageCapture
.getDrawable();
final Bitmap imgbitmap = drawable.getBitmap();
// convert bitmap to hokie tint
Bitmap imgnew;
imgnew = toOrange(imgbitmap);
// convert bitmap to imageview
imageCapture.setImageBitmap(imgnew);
}
});
}
Here is my orange method.
public Bitmap toOrange(Bitmap bmpOriginal) {
int width, height;
height = bmpOriginal.getHeight();
width = bmpOriginal.getWidth();
int orangeFilter = new Color().rgb(255, 165, 0);
int maroonFilter = new Color().rgb(115, 24, 44);
for (int j = 0; j < height - 1; j++) {
for (int i = 0; i < width - 1; i++) {
I am pretty sure that I have a problem, here.
int newColor = (int) (bmpOriginal.getPixel(i, j) * 0.7 + orangeFilter
* 0.3);
bmpOriginal.setPixel(i, j, newColor);
}
}
return bmpOriginal;
}
I tried bmpOriginal.setPixel(5, 5, Color.Red) outside of this loob, and it made an error too. So I know that the setPixel is not working. How can I fix this problem?