Class ContourPlot.ColorOperations

  • Enclosing class:
    ContourPlot

    public static class ContourPlot.ColorOperations
    extends java.lang.Object
    The ColorOperations class contains methods for manipulating 32bit ARGB color values.
    Author:
    hageldave
    • Constructor Summary

      Constructors 
      Constructor Description
      ColorOperations()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int changeSaturation​(int argb, double s)
      Changes the saturation of a color.
      static int interpolateColor​(int c1, int c2, double m)
      Linearly interpolates between the two specified colors.
      c = c1*(1-m) + c2*m
      static int scaleColorAlpha​(int color, double m)
      Scales the alpha value of a specified integer packed ARGB color by a specified scaling factor m.
      • Methods inherited from class java.lang.Object

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

      • ColorOperations

        public ColorOperations()
    • Method Detail

      • changeSaturation

        public static int changeSaturation​(int argb,
                                           double s)
        Changes the saturation of a color.
        Parameters:
        argb - int packed argb color value
        s - saturation multilpier (1 is no change, 0 is greyscale)
        Returns:
        saturation changed color
      • interpolateColor

        public static int interpolateColor​(int c1,
                                           int c2,
                                           double m)
        Linearly interpolates between the two specified colors.
        c = c1*(1-m) + c2*m
        Parameters:
        c1 - integer packed ARGB color value
        c2 - integer packed ARGB color value, e.g. 0xff00ff00 for opaque green
        m - in [0,1]
        Returns:
        interpolated color
      • scaleColorAlpha

        public static int scaleColorAlpha​(int color,
                                          double m)
        Scales the alpha value of a specified integer packed ARGB color by a specified scaling factor m. New color will be (a*m, r, g, b).
        Parameters:
        color - of which alpha will be scaled
        m - scaling factor
        Returns:
        integer packed ARGB color with scaled alpha