Class Blend


  • public class Blend
    extends java.lang.Object
    Functions for blending in HCT and CAM16.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Blend()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int cam16Ucs​(int from, int to, double amount)
      Blend in CAM16-UCS space.
      static int harmonize​(int designColor, int sourceColor)
      Blend the design color's HCT hue towards the key color's HCT hue, in a way that leaves the original color recognizable and recognizably shifted towards the key color.
      static int harmonize​(int designColor, int sourceColor, double amount)  
      static int harmonizeAll​(int designColor, int sourceColor, double amount)  
      static int hctHue​(int from, int to, double amount)
      Blends hue from one color into another.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Blend

        private Blend()
    • Method Detail

      • harmonize

        public static int harmonize​(int designColor,
                                    int sourceColor)
        Blend the design color's HCT hue towards the key color's HCT hue, in a way that leaves the original color recognizable and recognizably shifted towards the key color.
        Parameters:
        designColor - ARGB representation of an arbitrary color.
        sourceColor - ARGB representation of the main theme color.
        Returns:
        The design color with a hue shifted towards the system's color, a slightly warmer/cooler variant of the design color's hue.
      • harmonize

        public static int harmonize​(int designColor,
                                    int sourceColor,
                                    double amount)
      • harmonizeAll

        public static int harmonizeAll​(int designColor,
                                       int sourceColor,
                                       double amount)
      • hctHue

        public static int hctHue​(int from,
                                 int to,
                                 double amount)
        Blends hue from one color into another. The chroma and tone of the original color are maintained.
        Parameters:
        from - ARGB representation of color
        to - ARGB representation of color
        amount - how much blending to perform; 0.0 >= and <= 1.0
        Returns:
        from, with a hue blended towards to. Chroma and tone are constant.
      • cam16Ucs

        public static int cam16Ucs​(int from,
                                   int to,
                                   double amount)
        Blend in CAM16-UCS space.
        Parameters:
        from - ARGB representation of color
        to - ARGB representation of color
        amount - how much blending to perform; 0.0 >= and <= 1.0
        Returns:
        from, blended towards to. Hue, chroma, and tone will change.