當前位置: 首頁>>代碼示例>>Java>>正文


Java ColorMatrix.getArray方法代碼示例

本文整理匯總了Java中android.graphics.ColorMatrix.getArray方法的典型用法代碼示例。如果您正苦於以下問題:Java ColorMatrix.getArray方法的具體用法?Java ColorMatrix.getArray怎麽用?Java ColorMatrix.getArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.ColorMatrix的用法示例。


在下文中一共展示了ColorMatrix.getArray方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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));
}
 
開發者ID:Edward-Yung,項目名稱:Mu-Retargeter-1.0,代碼行數:25,代碼來源:ColorPickerDialog.java

示例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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:UberColorPickerDialog.java

示例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));
}
 
開發者ID:iOffice1,項目名稱:iOffice,代碼行數:25,代碼來源:ColorPickerView.java

示例4: setImage

import android.graphics.ColorMatrix; //導入方法依賴的package包/類
private void setImage() {
	recycled=temp;
	ColorMatrix colorMatrix=new ColorMatrix();
	float[] colorArr = colorMatrix.getArray();
	for (int i = 0; i < colorArr.length; i++) {
		colorArr[i]=Float.parseFloat(ed[i].getText().toString());
	}
	temp = Bitmap.createBitmap(bt.getWidth(), bt.getHeight(), Config.ARGB_8888);
	Canvas canvas=new Canvas(temp);
	Paint paint =new Paint();
	paint.setAntiAlias(true);
	paint.setDither(true);
	paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
	canvas.drawBitmap(bt, 0,0, paint);
	
	imageView1.setImageBitmap(temp);
	if(recycled!=null&&recycled!=temp&&!recycled.isRecycled()){
		recycled.recycle();
	}
}
 
開發者ID:luhaoaimama1,項目名稱:zone-sdk,代碼行數:21,代碼來源:ColorMarixTry.java

示例5: 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));
      }
 
開發者ID:FAIMS,項目名稱:faims-android,代碼行數:26,代碼來源:ColorPickerDialog.java

示例6: setBrightnessMatrix

import android.graphics.ColorMatrix; //導入方法依賴的package包/類
private static void setBrightnessMatrix(ColorMatrix matrix, int brightness) {
    // Brightness: C-new = C-old*(1-amount) + amount
    float scale = 1 - brightness / 255.0f;
    matrix.setScale(scale, scale, scale, 1);
    float[] array = matrix.getArray();

    // Add the amount to RGB components of the matrix, as per the above formula.
    // Fifth elements in the array correspond to the constant being added to
    // red, blue, green, and alpha channel respectively.
    array[4] = brightness;
    array[9] = brightness;
    array[14] = brightness;
}
 
開發者ID:Mr-lin930819,項目名稱:SimplOS,代碼行數:14,代碼來源:FastBitmapDrawable.java


注:本文中的android.graphics.ColorMatrix.getArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。