private void initRendering(int mode) { Paint paint = new Paint(); switch (mode) { case 0: { // Default paint.setColorFilter(null); break; } case 1: { // Grayscale ColorMatrix matrix = new ColorMatrix(); matrix.setSaturation(0); ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix); paint.setColorFilter(filter); break; } case 2: { // Inverted ColorMatrixColorFilter filter = new ColorMatrixColorFilter(NEGATIVE_COLOR); paint.setColorFilter(filter); break; } case 3: { // Inverted grayscale ColorMatrix matrix = new ColorMatrix(); matrix.set(NEGATIVE_COLOR); ColorMatrix gcm = new ColorMatrix(); gcm.setSaturation(0); ColorMatrix concat = new ColorMatrix(); concat.setConcat(matrix, gcm); ColorMatrixColorFilter filter = new ColorMatrixColorFilter(concat); paint.setColorFilter(filter); break; } default: { paint.setColorFilter(null); break; } } // maybe sometime LAYER_TYPE_NONE would better? setLayerType(View.LAYER_TYPE_HARDWARE, paint); }