Package org.pepsoft.util
Class ColourUtils
java.lang.Object
org.pepsoft.util.ColourUtils
Utility methods for working with
int 0xrrggbb encoded colour values.-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisGreyScale(int colour) static intmix(int colour1, int colour2) Mix two colours by mixing their red, green and blue components exactly equally.static intmix(int colour1, int colour2, int alpha) Mix two colours by mixing their red, green and blue components according to an alpha value between 0 and 256 (inclusive), where an alpha of 0 results in justcolour1and 256 in justcolour2.static intmultiply(int colour, int amount) Multiplies each of component ofcolourwithamountand divides the result by 256.
-
Method Details
-
mix
public static int mix(int colour1, int colour2) Mix two colours by mixing their red, green and blue components exactly equally. This is a convenience method for callingmix(colour1, colour2, 128). -
mix
public static int mix(int colour1, int colour2, int alpha) Mix two colours by mixing their red, green and blue components according to an alpha value between 0 and 256 (inclusive), where an alpha of 0 results in justcolour1and 256 in justcolour2. -
multiply
public static int multiply(int colour, int amount) Multiplies each of component ofcolourwithamountand divides the result by 256.- Parameters:
colour- The RGB colour to multiply.amount- The amount to multiply each colour band with, where 256 leaves the colour unchanged.- Returns:
- The multiplied colour.
-
isGreyScale
public static boolean isGreyScale(int colour)
-