在为色彩空间转换添加限制因素时,我陷入了LAB到RGB的困境。基本上这就是我现在拥有的
//block 1
if (r > 255 || r < 0 || g > 255 || g < 0 || b > 255 || b < 0) {
if (container3.getChildAt(i) instanceof ImageView) {
(container3.getChildAt(i)).setBackgroundColor(0);
}
//block 2
} else if (i > 0 && (r == 0 && g == 0 && b == 0) || (r == 255 && g == 255 && b == 255) ) {
int cc1 = ((ColorDrawable) container3.getChildAt(i - 1).getBackground()).getColor();
int cc2 = ((ColorDrawable) container3.getChildAt(i).getBackground()).getColor();
if (Color.red(cc1) == 0 && Color.green(cc1) == 0 && Color.blue(cc1) == 0
&& Color.red(cc2) == 0 && Color.green(cc2) == 0 && Color.blue(cc2) == 0 ) {
if (container3.getChildAt(i) instanceof ImageView) {
(container3.getChildAt(i)).setBackgroundColor(0);
}
}
//block 3
} else if (container3.getChildAt(i) instanceof ImageView) {
(container3.getChildAt(i)).setBackgroundColor(Color.argb(255, r, g, b));
int cc = ((ColorDrawable) container3.getChildAt(i).getBackground()).getColor();
Log.e("LABtest ", Color.red(cc) +" "+ Color.green(cc)+" "+Color.blue(cc));
}
简要说明,我有以下限制: