get Inverted Color - Java 2D Graphics

Java examples for 2D Graphics:Color Invert

Description

get Inverted Color

Demo Code


//package com.java2s;
import java.awt.*;

public class Main {
    public static Color getInvertedColor(Color color) {
        return new Color(0xFFFFFF - color.getRGB());
    }/*from www. j  a v a 2s  .  co  m*/

    public static Color getInvertedColor(int colorCode) {
        return getInvertedColor(new Color(colorCode));
    }
}

Related Tutorials