Reputation: 1573
I have seen that there is EffectFactory in Android and it supports Duotone effect. But it only works on API level 14 and up.
The problem is that I need the app to work from API level 11.
So my question is if there is a way to make Duotone image effect on Android below API 14?
With my current code, I access every pixel, get its RGB and change it. But I don't know how duotone works. Here is my code:
public Bitmap doColorFilter(Bitmap src)
{
int width = src.getWidth();
int height = src.getHeight();
Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig());
int A, R, G, B;
int pixel;
for (int x = 0; x < width; ++x)
{
for (int y = 0; y < height; ++y)
{
pixel = src.getPixel(x, y);
A = Color.alpha(pixel);
R = (int) (Color.red(pixel));
G = (int) (Color.green(pixel));
B = (int) (Color.blue(pixel));
bmOut.setPixel(x, y, Color.argb(A, R, G, B));
}
}
return bmOut;
}
EDIT:
Sepia toning isn't working like I need it to. Here are three images:
1. original one.
2. one with modified sepia tone effect Der Golem linked
3.the one with duotone effect I need:
Upvotes: 0
Views: 842