Java examples for 2D Graphics:Color
distance between two color
//package com.java2s; import java.awt.Color; public class Main { public static double distance(final Color a, final Color b) { final int dr = a.getRed() - b.getRed(); final int dg = a.getGreen() - b.getGreen(); final int db = a.getBlue() - b.getBlue(); final int da = a.getAlpha() - b.getAlpha(); return Math.sqrt(dr * dr + dg * dg + db * db + da * da); }// ww w.j ava2s. c o m }