Class GradientHelper


  • public class GradientHelper
    extends java.lang.Object
    Gradient utilities.
    Since:
    2.3.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int blendColors​(int color1, int color2, float ratio)
      Computes the color resulting by blending two colors with a ratio.
      static int[] createGradient​(ej.microui.display.Display display, int startColor, int endColor)
      Creates a gradient between two colors on a display.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • blendColors

        public static int blendColors​(int color1,
                                      int color2,
                                      float ratio)
        Computes the color resulting by blending two colors with a ratio.
        Parameters:
        color1 - the first color.
        color2 - the second color.
        ratio - the ratio of the second color which means the ratio of the first color is 1 - ratio. This value is clamped between 0 and 1.
        Returns:
        the blended color.
      • createGradient

        public static int[] createGradient​(ej.microui.display.Display display,
                                           int startColor,
                                           int endColor)
        Creates a gradient between two colors on a display.

        The result is an array of colors where:

        • the first one is the given start color,
        • the last one is the given end color,
        • all colors are different.
        Beware that if the given colors are identical, the result contains only one element.
        Parameters:
        display - the display where the gradient will be used.
        startColor - the start color of the gradient.
        endColor - the end color of the gradient.
        Returns:
        the gradient.
        See Also:
        Display.getDisplayColor(int)