is Bright color among two Color value - Java 2D Graphics

Java examples for 2D Graphics:Color Light

Description

is Bright color among two Color value

Demo Code


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

public class Main {
    public static boolean isBright(Color interestColor, Color comparedColor) {
        return getNorm(interestColor) > getNorm(comparedColor);
    }/*from w  w w .ja va  2 s  .  co  m*/

    public static double getNorm(Color c) {
        return (c.getRed() * c.getRed() + c.getGreen() * c.getGreen() + c
                .getBlue() * c.getBlue());
    }
}

Related Tutorials