Here you can find the source of getBrightness(Color c)
Parameter | Description |
---|---|
c | a parameter |
public static int getBrightness(Color c)
//package com.java2s; /*//from ww w .j a v a 2s . c o m * BioJava development code * * This code may be freely distributed and modified under the * terms of the GNU Lesser General Public Licence. This should * be distributed with the code. If you do not have a copy, * see: * * http://www.gnu.org/copyleft/lesser.html * * Copyright for this code is held jointly by the individual * authors. These should be listed in @author doc comments. * * For more information on the BioJava project and its aims, * or to join the biojava-l mailing list, visit the home page * at: * * http://www.biojava.org/ * * Created on May 20, 2010 * Author: Andreas Prlic * */ import java.awt.Color; public class Main { /** * Returns a value between 0 and 255 where 0 is darkest and 255 is brightest * * @param c * @return */ public static int getBrightness(Color c) { return (int) Math.sqrt(c.getRed() * c.getRed() * .241 + c.getGreen() * c.getGreen() * .691 + c.getBlue() * c.getBlue() * .068); } }