Class GFXColour
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GFXColourstatic final intenumeration StandardColour: supported standard colours.static final GFXColourstatic final intstatic final GFXColourstatic final intstatic final intstatic final GFXColourstatic final intstatic final intstatic final GFXColourstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintb()Get the current setting for Blue.static GFXColourblack()Get a Black colour object.static GFXColourcreate(int lNewR, int lNewG, int lNewB, int lNewScale) static GFXColourstatic GFXColourdarkGray()Get a Dark gray colour object.booleanEquality comparison operator.booleanequivalent(GFXColour oCompare) Equality comparison.intg()Get the current setting for Green.doubleGet the converted grayscale value of the RGB triplet as a percentageintGet the converted grayscale value of the RGB tripletstatic GFXColourgetStandardColour(int colourIndex) Get one of the predefined standard colour objects.static intgetStandardColourIndex(GFXColour oColour) Get the defined standard colour as a StandardColour enumeration.static GFXColourgray()Get a Gray colour object.inthashCode()static booleanCheck if a Colour object is set to black.static booleanCheck if a Colour object is set to white.static GFXColourGet a Light gray colour object.doublenormalB()Get the normalized value for Blue.doublenormalG()Get the normalized value for Green.doublenormalR()Get the normalized value for Red.booleanNon-equality comparison operator.intr()Get the current setting for Red.intscale()Get the scale setting for this colour object.scale(int newScale) static GFXColourweightedAverage(GFXColour base, GFXColour weighted, double weight) static GFXColourwhite()Get a White colour object.booleanChecks if this colour maps to white in a black and white scheme.
-
Field Details
-
JF_GFXCOLOUR_DEF_SCALE
public static final int JF_GFXCOLOUR_DEF_SCALE- See Also:
-
BLACK_INDEX
public static final int BLACK_INDEXenumeration StandardColour: supported standard colours.- See Also:
-
WHITE_INDEX
public static final int WHITE_INDEX- See Also:
-
LIGHTGRAY_INDEX
public static final int LIGHTGRAY_INDEX- See Also:
-
GRAY_INDEX
public static final int GRAY_INDEX- See Also:
-
DARKGRAY_INDEX
public static final int DARKGRAY_INDEX- See Also:
-
OTHER_INDEX
public static final int OTHER_INDEX- See Also:
-
BLACK
-
WHITE
-
LIGHTGRAY
-
GRAY
-
DARKGRAY
-
-
Constructor Details
-
GFXColour
public GFXColour()Default constructor.Assigns the colour object with the following values:
Red = 0 Green = 0 Blue = 0 Scale = 255 -
GFXColour
Copy consturctor.- Parameters:
oSource- - Source attribute object to copy
-
GFXColour
public GFXColour(int lNewR, int lNewG, int lNewB, int lNewScale) Constructor.Creates a Colour object with the values as specified by the input values.
- Parameters:
lNewR- - Colour Red valuelNewG- - Colour Green valuelNewB- - Colour Blue valuelNewScale- - Scale setting
-
GFXColour
public GFXColour(int lNewR, int lNewG, int lNewB) -
GFXColour
Constructor.Set the all the colour values based on a text string.
- Parameters:
sColour- - A string containing three integer values representing red, green and blue.
-
-
Method Details
-
create
-
create
-
black
Get a Black colour object.This will return a Colour object with the following settings:
Red = 0 Green = 0 Blue = 0 Scale = 255- Returns:
- A Colour object with black settings
-
white
Get a White colour object.This will return a Colour object with the following settings:
Red = 255 Green = 255 Blue = 255 Scale = 255- Returns:
- A Colour object with white settings
-
lightGray
Get a Light gray colour object.This will return a Colour object with the following settings:
Red = 192 Green = 192 Blue = 192 Scale = 255- Returns:
- A Colour object with light gray settings
-
gray
Get a Gray colour object.This will return a Colour object with the following settings:
Red = 128 Green = 128 Blue = 128 Scale = 255- Returns:
- A Colour object with gray settings
-
darkGray
Get a Dark gray colour object.This will return a Colour object with the following settings:
Red = 64 Green = 64 Blue = 64 Scale = 255- Returns:
- A Colour object with dark gray settings
-
getStandardColour
Get one of the predefined standard colour objects.- Parameters:
colourIndex- - the requested colour as a StandardColour enumeration.- Returns:
- The requested standard colour object.
-
getStandardColourIndex
Get the defined standard colour as a StandardColour enumeration.- Parameters:
oColour- - the colour object- Returns:
- The standard colour enumeration value
-
isBlack
Check if a Colour object is set to black.- Parameters:
oColour- - the colour object- Returns:
- TRUE if colour object is set to black; otherwise FALSE
-
isWhite
Check if a Colour object is set to white.- Parameters:
oColour- - the colour object- Returns:
- TRUE if colour object is set to white; otherwise FALSE
-
r
public int r()Get the current setting for Red.- Returns:
- The Red value
-
g
public int g()Get the current setting for Green.- Returns:
- The Green value
-
b
public int b()Get the current setting for Blue.- Returns:
- The Blue value
-
whiteMono
public boolean whiteMono()Checks if this colour maps to white in a black and white scheme.- Returns:
- TRUE if this colour maps to white in a black and white scheme, FALSE if it maps to black.
-
normalR
public double normalR()Get the normalized value for Red.- Returns:
- The normalized value for Red
-
normalG
public double normalG()Get the normalized value for Green.- Returns:
- The normalized value for Green
-
normalB
public double normalB()Get the normalized value for Blue.- Returns:
- The normalized value for Blue
-
scale
public int scale()Get the scale setting for this colour object.- Returns:
- The scale setting
-
scale
-
equivalent
Equality comparison.Two colour objects are considered equal if all their values compare for equality.
- Parameters:
oCompare- - Colour object to compare against.- Returns:
- TRUE if all members are equal, FALSE otherwise.
-
equals
Equality comparison operator.Two colour objects are considered equal if all their values compare for equality.
-
hashCode
public int hashCode() -
notEqual
Non-equality comparison operator.Two colour objects are considered equal if all their values compare for equality.
- Parameters:
oCompare- - Colour object to compare against.- Returns:
- TRUE if any members are different, FALSE otherwise.
-
getGrayScale
public int getGrayScale()Get the converted grayscale value of the RGB triplet- Returns:
- converted grayscale value of the RGB triplet
-
getGrayRate
public double getGrayRate()Get the converted grayscale value of the RGB triplet as a percentage- Returns:
- converted grayscale value of the RGB triplet as a percentage
-
weightedAverage
-