Class PaintProcessor
java.lang.Object
cz.fidentis.analyst.gui.elements.histogram.utils.PaintProcessor
Class for working with colors and paints.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateHorizontalGradient
(int startX, int endX) static Color
getColorWithAlpha
(Color color, int alpha) Creates a newColor
with the same properties as the original, but with a modified alpha value.static Color
getColorWithSaturation
(Color color, float saturation) Creates a newColor
with the same properties as the original, but with a modified saturation value.static Color[]
getGradientFrom
(Color a, Color b, int stepsCount) Creates a gradient from two colors.static LinearGradientPaint
getGradientWithAlpha
(LinearGradientPaint gradient, int alpha) Creates a newLinearGradientPaint
identical to the original, except for modified alpha values of the source colors.void
setGradientColors
(Color[] colors) Set colors that will be used to create a gradient.
-
Constructor Details
-
PaintProcessor
public PaintProcessor()
-
-
Method Details
-
getGradientFrom
Creates a gradient from two colors.- Parameters:
a
- color Ab
- color BstepsCount
- how many colors will be added between colora
andb
(must be non-negative)- Returns:
- gradient, the first element is color
a
and last element is colorb
-
getColorWithAlpha
Creates a newColor
with the same properties as the original, but with a modified alpha value.- Parameters:
color
- source coloralpha
- desired alpha value- Returns:
color
with desired alpha value
-
getGradientWithAlpha
Creates a newLinearGradientPaint
identical to the original, except for modified alpha values of the source colors.- Parameters:
gradient
- source gradientalpha
- desired alpha value- Returns:
gradient
with desired alpha value
-
getColorWithSaturation
Creates a newColor
with the same properties as the original, but with a modified saturation value.- Parameters:
color
- source colorsaturation
- desired saturation- Returns:
color
with desired saturation
-
setGradientColors
Set colors that will be used to create a gradient.- Parameters:
colors
- gradient source colors- See Also:
-
createHorizontalGradient
- Parameters:
startX
- startXendX
- endX- See Also:
-