Android Paint Color Set invertCanvasColors(Paint paint)

Here you can find the source of invertCanvasColors(Paint paint)

Description

invert Canvas Colors

License

Open Source License

Parameter

Parameter Description
paint a parameter

Declaration

public static void invertCanvasColors(Paint paint) 

Method Source Code

//package com.java2s;

import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;

import android.graphics.Paint;

public class Main {
    /**//from ww  w . ja v  a  2s .  c o  m
     * 
     * @param paint
     */
    public static void invertCanvasColors(Paint paint) {
        float mx[] = { -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f,
                1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
                1.0f, 1.0f, 0.0f };
        ColorMatrix cm = new ColorMatrix(mx);
        paint.setColorFilter(new ColorMatrixColorFilter(cm));
    }
}

Related

  1. restoreCanvasColors(Paint paint)