0
我需要一种方法来调整位图的色调/坐标。到目前为止,我发现这个如何调整位图的色调/饱和度?
public static Bitmap colorize(Bitmap src, float hue, float saturationDelta, float valueDelta) {
Bitmap b = src.copy(Bitmap.Config.ARGB_8888, true);
for (int x = 0; x < b.getWidth(); x++) {
for (int y = 0; y < b.getHeight(); y++) {
int color = b.getPixel(x, y);
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[0] = hue;
hsv[1] += saturationDelta;
hsv[2] += valueDelta;
int newColor = Color.HSVToColor(Color.alpha(color), hsv);
b.setPixel(x, y, newColor);
}
}
return b;
}
但它需要10秒钟来处理400x500位图。有没有更快的方法?
谢谢! :)
相关:http://stackoverflow.com/q/4354939/321697 :) – kcoppock