本文整理汇总了Java中android.graphics.ColorMatrix.setRGB2YUV方法的典型用法代码示例。如果您正苦于以下问题:Java ColorMatrix.setRGB2YUV方法的具体用法?Java ColorMatrix.setRGB2YUV怎么用?Java ColorMatrix.setRGB2YUV使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.ColorMatrix
的用法示例。
在下文中一共展示了ColorMatrix.setRGB2YUV方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rotateColor
import android.graphics.ColorMatrix; //导入方法依赖的package包/类
private int rotateColor(int color, float rad) {
float deg = rad * 180 / 3.1415927f;
int r = Color.red(color);
int g = Color.green(color);
int b = Color.blue(color);
ColorMatrix cm = new ColorMatrix();
ColorMatrix tmp = new ColorMatrix();
cm.setRGB2YUV();
tmp.setRotate(0, deg);
cm.postConcat(tmp);
tmp.setYUV2RGB();
cm.postConcat(tmp);
final float[] a = cm.getArray();
int ir = floatToByte(a[0] * r + a[1] * g + a[2] * b);
int ig = floatToByte(a[5] * r + a[6] * g + a[7] * b);
int ib = floatToByte(a[10] * r + a[11] * g + a[12] * b);
return Color.argb(Color.alpha(color), pinToByte(ir),
pinToByte(ig), pinToByte(ib));
}
示例2: updateYUVfromRGB
import android.graphics.ColorMatrix; //导入方法依赖的package包/类
/**
* Keep all colorspace representations in sync.
*/
private void updateYUVfromRGB() {
float r = mRGB[0] / 255.0f;
float g = mRGB[1] / 255.0f;
float b = mRGB[2] / 255.0f;
ColorMatrix cm = new ColorMatrix();
cm.setRGB2YUV();
final float[] a = cm.getArray();
mYUV[0] = a[0] * r + a[1] * g + a[2] * b;
mYUV[0] = pinToUnit(mYUV[0]);
mYUV[1] = a[5] * r + a[6] * g + a[7] * b;
mYUV[1] = pin(mYUV[1], -.5f, .5f);
mYUV[2] = a[10] * r + a[11] * g + a[12] * b;
mYUV[2] = pin(mYUV[2], -.5f, .5f);
}
示例3: rotateColor
import android.graphics.ColorMatrix; //导入方法依赖的package包/类
private int rotateColor(int color, float rad) {
float deg = rad * 180 / 3.1415927f;
int r = Color.red(color);
int g = Color.green(color);
int b = Color.blue(color);
ColorMatrix cm = new ColorMatrix();
ColorMatrix tmp = new ColorMatrix();
cm.setRGB2YUV();
tmp.setRotate(0, deg);
cm.postConcat(tmp);
tmp.setYUV2RGB();
cm.postConcat(tmp);
final float[] a = cm.getArray();
int ir = floatToByte(a[0] * r + a[1] * g + a[2] * b);
int ig = floatToByte(a[5] * r + a[6] * g + a[7] * b);
int ib = floatToByte(a[10] * r + a[11] * g + a[12] * b);
return Color.argb(Color.alpha(color), pinToByte(ir), pinToByte(ig),
pinToByte(ib));
}
示例4: rotateColor
import android.graphics.ColorMatrix; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private int rotateColor(int color, float rad) {
float deg = rad * 180 / 3.1415927f;
int r = Color.red(color);
int g = Color.green(color);
int b = Color.blue(color);
ColorMatrix cm = new ColorMatrix();
ColorMatrix tmp = new ColorMatrix();
cm.setRGB2YUV();
tmp.setRotate(0, deg);
cm.postConcat(tmp);
tmp.setYUV2RGB();
cm.postConcat(tmp);
final float[] a = cm.getArray();
int ir = floatToByte(a[0] * r + a[1] * g + a[2] * b);
int ig = floatToByte(a[5] * r + a[6] * g + a[7] * b);
int ib = floatToByte(a[10] * r + a[11] * g + a[12] * b);
return Color.argb(alpha, pinToByte(ir),
pinToByte(ig), pinToByte(ib));
}