Package gov.nih.mipav.model.algorithms
Class ContourPlot.ColorOperations
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.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*mstatic int
scaleColorAlpha(int color, double m)
Scales the alpha value of a specified integer packed ARGB color by a specified scaling factorm
.
-
-
-
Method Detail
-
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
-
-