package flib.fcolor;

/*
 *
 * SaturationComparator.java
 *
 * color sorting methods/classes
 * http://processing.org/discourse/yabb2/YaBB.pl?num=1272458371
 *
 */


// -----------------------------------------------------------------------------
// Libaries
// -----------------------------------------------------------------------------
import java.util.Comparator;



public class SaturationComparator implements Comparator<Integer> {
    public int compare(Integer _col1, Integer _col2) {
        int col1 = _col1.intValue();
        int col2 = _col2.intValue();
        if( FColor.saturation(col1) != FColor.saturation(col2) ) {
            return (int) (FColor.saturation(col1) - FColor.saturation(col2));
        }
        return (int) (FColor.hue(col1) - FColor.hue(col2));
    }
}


