Package ej.widget.color
Class GradientHelper
- java.lang.Object
-
- ej.widget.color.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.
-
-
-
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 is1 - 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.
- 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)
-
-