Get complement Color - Android Graphics

Android examples for Graphics:Color RGB Value

Description

Get complement Color

Demo Code


//package com.java2s;

import android.graphics.Color;

public class Main {
    public static int complementColor(int color) {
        int alpha = Color.alpha(color);
        int red = Color.red(color);
        int blue = Color.blue(color);
        int green = Color.green(color);

        red = (~red) & 0xff;//from  w w w  . ja  v a  2s .  c om
        blue = (~blue) & 0xff;
        green = (~green) & 0xff;

        return Color.argb(alpha, red, green, blue);
    }
}

Related Tutorials