Android ColorMatrixColorFilter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ColorMatrixColorFilter class.

This code example shows how to use the following methods:
        Bitmap bitmap2 = Robolectric.newInstanceOf(Bitmap.class);
        shadowOf(bitmap2).appendDescription("Bitmap Two");
 
        Canvas canvas = new Canvas(bitmap1);
        Paint paint = new Paint();
        paint.setColorFilter(new ColorMatrixColorFilter(new ColorMatrix()));
        canvas.drawBitmap(bitmap2, new Matrix(), paint);
 
        assertEquals("Bitmap One\nBitmap Two with ColorMatrixColorFilter<1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0> transformed by matrix", shadowOf(bitmap1).getDescription());
    } 
 
    @Test 
    public void visualize_shouldReturnDescription() throws Exception { 
        Bitmap bitmap = Robolectric.newInstanceOf(Bitmap.class);
        shadowOf(bitmap).appendDescription("Bitmap One");
 
        assertEquals("Bitmap One", Robolectric.visualize(bitmap));
 
    } 
     
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
		paint.setColorFilter(null);
		c.drawBitmap(bmpGrayscale, 0, 0, paint);
		ColorMatrix cm = new ColorMatrix();
		getValueBlackAndWhite(); 
		cm.set(carray);
		ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm);
		paint.setColorFilter(f);
		c.drawBitmap(bmpOriginal, 0, 0, paint);
		return bmpGrayscale;
	} 
 
	public static void getValueSaturation() 
	{ 
		// 高饱和度 
		carray[0] = 5;
		carray[1] = 0;
		carray[2] = 0;
		carray[3] = 0;
		carray[4] = -254;
		carray[5] = 0;
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        Bitmap bitmap2 = Robolectric.newInstanceOf(Bitmap.class);
        shadowOf(bitmap2).appendDescription("Bitmap Two");
 
        Canvas canvas = new Canvas(bitmap1);
        Paint paint = new Paint();
        paint.setColorFilter(new ColorMatrixColorFilter(new ColorMatrix()));
        canvas.drawBitmap(bitmap2, new Matrix(), paint);
 
        assertEquals("Bitmap One\nBitmap Two with ColorMatrixColorFilter<1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0> transformed by matrix", shadowOf(bitmap1).getDescription());
    } 
 
    @Test 
    public void visualize_shouldReturnDescription() throws Exception { 
        Bitmap bitmap = Robolectric.newInstanceOf(Bitmap.class);
        shadowOf(bitmap).appendDescription("Bitmap One");
 
        assertEquals("Bitmap One", Robolectric.visualize(bitmap));
 
    } 
     
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:
	Drawable mDrawable;
	final static int state_pressed = android.R.attr.state_pressed;
 
	/** The white color filter. */ 
	ColorMatrixColorFilter whiteColorFilter = new ColorMatrixColorFilter( new float[] {
		1, 0, 0, 0, 255, 0, 1, 0, 0, 255, 0, 0, 1, 0, 255, 0, 0, 0, 1, 0, } ); 
 
	/** 
	 * Instantiates a new tool icons drawable. 
	 *  
	 * @param res 
	 *           the res 
	 * @param resId 
	 *           the res id 
	 */ 
	public ToolIconsDrawable( Resources res, int resId ) {
		super(); 
		mDrawable = res.getDrawable( resId );
	} 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	public void setImageGrayscale(boolean greyscale) {
		this.greyscale = greyscale;
		if (greyscale) {
			ColorMatrix matrix = new ColorMatrix();
			matrix.setSaturation(0);
			imageView.setColorFilter(new ColorMatrixColorFilter(matrix));
		} else { 
			imageView.setColorFilter(null);
		} 
	} 
 
	public boolean isOpacity() { 
		return opacity;
	} 
 
	public boolean isGreyscale() { 
		return greyscale;
	} 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
		mShadowPaint.setAntiAlias( true );
 
		srcRect = new Rect( 0, 0, b.getWidth(), b.getHeight() );
		dstRect = new Rect();
 
		blackColorFilter = new ColorMatrixColorFilter( new float[] { 1, 0, 0, -255, 0, 0, 1, 0, -255, 0, 0, 0, 1, -255, 0, 0, 0, 0, 0.3f, 0, } );
 
		whiteColorFilter = new ColorMatrixColorFilter( new float[] { 1, 0, 0, 0, 255, 0, 1, 0, 0, 255, 0, 0, 1, 0, 255, 0, 0, 0, 1, 0, } );
 
		mShadowPaint.setColorFilter( blackColorFilter );
	} 
 
	private float mLeft = 0;
	private float mTop = 0;
 
	@Override 
	protected void onBoundsChange( Rect bounds ) {
		super.onBoundsChange( bounds );
 
		mLeft = Math.abs( bounds.width() - srcRect.width() ) / 2;
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:
This code example shows how to use the following methods:
 
		ColorMatrix matrix = new ColorMatrix();
		float[] src = { 0.308F, 0.609F, 0.082F, 0, 0, 0.308F, 0.609F, 0.082F,
				0, 0, 0.308F, 0.609F, 0.082F, 0, 0, 0, 0, 0, 1, 0 }; 
		matrix.set(src);
		ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
		Paint p = new Paint();
		p.setColorFilter(filter);
		Bitmap colorBmp = Bitmap.createBitmap(width, height, bmp.getConfig());
		Canvas c = new Canvas(colorBmp);
		c.drawBitmap(bmp, 0, 0, p);
		return colorBmp;
	} 
 
	public static Bitmap rotateBmp(Bitmap bmp, int angle) {
 
		int width = bmp.getWidth();
		int height = bmp.getHeight();
		Matrix matrix = new Matrix();
		matrix.postRotate(angle);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android ColorMatrixColorFilter Questions & Answers:

See Code Examples for Android ColorMatrixColorFilter Methods: