Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;

import android.graphics.drawable.Drawable;

public class Main {
    public static void doGray(Drawable d) {
        //Make this drawable mutable.     
        //A mutable drawable is guaranteed to not share its state with any other drawable.     
        d.mutate();
        ColorMatrix cm = new ColorMatrix();
        cm.setSaturation(0);
        ColorMatrixColorFilter cf = new ColorMatrixColorFilter(cm);
        d.setColorFilter(cf);

    }
}