Java Utililty Methods Color Invert

List of utility methods to do Color Invert

Description

The list of methods to do Color Invert are organized into topic(s).

Method

Colorinvert(Color c)
invert
int a = c.getAlpha();
int r = MAX_RGB_VALUE - c.getRed();
int g = MAX_RGB_VALUE - c.getGreen();
int b = MAX_RGB_VALUE - c.getBlue();
if ((r + g + b > 740) || (r + g + b < 20)) {
    return new Color(MAX_RGB_VALUE, MAX_RGB_VALUE, 40, a);
} else {
    return new Color(r, g, b, a);
...
Colorinvert(Color color)
Inverts a color channel by channel.
return new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue());
Colorinvert(Color color)
invert
float[] rgb = color.getRGBComponents(null);
return new Color(1.0f - rgb[0], 1.0f - rgb[1], 1.0f - rgb[2]);
Colorinvert(Color color)
invert
return new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue());
Colorinvert(Color colour)
invert
return new Color(MAX_RGB_COMPONENT_VALUE - colour.getRed(), MAX_RGB_COMPONENT_VALUE - colour.getGreen(),
        MAX_RGB_COMPONENT_VALUE - colour.getBlue());
ColorinvertColor(Color c)
invert Color
return new Color(255 - c.getRed(), 255 - c.getGreen(), 255 - c.getBlue());
ColorinvertColor(Color cColor)
invert Color
return invertColor(cColor, 255);
intinvertColor(int color)
Invert the color
int a = (color >> 24) & 0xff;
int r = (color >> 16) & 0xff;
int g = (color >> 8) & 0xff;
int b = color & 0xff;
r = 255 - r;
g = 255 - g;
b = 255 - b;
return toRGB(r, g, b, a);
...
intinvertColor(int color)
invert Color
int red = getRed(color);
int green = getGreen(color);
int blue = getBlue(color);
red = 0xff - red;
green = 0xff - green;
blue = 0xff - blue;
return getColor(red, green, blue);
intinvertColor(int color)
Inverts color parsed as integer
Color origColor = new Color(color);
int invertedRed = ((255 - origColor.getRed()) * 65536);
int invertedGreen = ((255 - origColor.getGreen()) * 256);
int invertedBlue = ((255 - origColor.getBlue()));
return invertedRed + invertedGreen + invertedBlue;