Class ColorStop

  • All Implemented Interfaces:
    Comparable<ColorStop>

    public final class ColorStop
    extends Object
    implements Comparable<ColorStop>
    A container for color (in every color space) and the percentage position that it occurs within a gradient. Gradients comprise multiple color stops.
    Author:
    Michael Carleton
    • Constructor Detail

      • ColorStop

        public ColorStop​(int clr,
                         float fraction)
        Parameters:
        clr - color int (32bit ARGB)
        fraction - decimal fraction between 0...1 (otherwise constrained) that defines how far along the gradient the color defined by this stop is at.
    • Method Detail

      • getColor

        public double[] getColor​(ColorSpace colorSpace)
        Return the value of the colorstop in a given colorspace
        Parameters:
        colorSpace -
        Returns:
        double[a, b, c] representing color in given colorspace
      • mutate

        protected void mutate​(float amt)
      • compareTo

        public int compareTo​(ColorStop other)
        Enables color stops to be sorted by Collections.sort via pairwise comparison on the percent of each stop.
        Specified by:
        compareTo in interface Comparable<ColorStop>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object