Java Color Invert invert(Color color)

Here you can find the source of invert(Color color)

Description

Inverts a color channel by channel.

License

Open Source License

Parameter

Parameter Description
color The color to invert.

Return

The inverted color.

Declaration

public static Color invert(Color color) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.Color;

public class Main {
    /**/*from ww w .  ja  v  a  2s.c  o  m*/
     * Inverts a color channel by channel.
     * @param color The color to invert.
     * @return The inverted color.
     */
    public static Color invert(Color color) {
        return new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue());
    }
}

Related

  1. invert(Color c)
  2. invert(Color color)
  3. invert(Color color)
  4. invert(Color colour)
  5. invertColor(Color c)
  6. invertColor(Color cColor)
  7. invertColor(int color)