Package gov.nih.mipav.model.algorithms
Class ContourPlot.ColorOperations
java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.ColorOperations
- Enclosing class:
ContourPlot
The ColorOperations class contains methods for manipulating
32bit ARGB color values.
- Author:
- hageldave
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intchangeSaturation(int argb, double s) Changes the saturation of a color.static intinterpolateColor(int c1, int c2, double m) Linearly interpolates between the two specified colors.
c = c1*(1-m) + c2*mstatic intscaleColorAlpha(int color, double m) Scales the alpha value of a specified integer packed ARGB color by a specified scaling factorm.
-
Constructor Details
-
ColorOperations
public ColorOperations()
-
-
Method Details
-
changeSaturation
public static int changeSaturation(int argb, double s) Changes the saturation of a color.- Parameters:
argb- int packed argb color values- 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 valuec2- integer packed ARGB color value, e.g. 0xff00ff00 for opaque greenm- 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 factorm. New color will be(a*m, r, g, b).- Parameters:
color- of which alpha will be scaledm- scaling factor- Returns:
- integer packed ARGB color with scaled alpha
-