Class GFXColour
- java.lang.Object
-
- com.adobe.xfa.gfx.GFXColour
-
public class GFXColour extends java.lang.ObjectThe graphic colour object is a convinience class for basic colour handling.
-
-
Field Summary
Fields Modifier and Type Field Description static GFXColourBLACKstatic intBLACK_INDEXenumeration StandardColour: supported standard colours.static GFXColourDARKGRAYstatic intDARKGRAY_INDEXstatic GFXColourGRAYstatic intGRAY_INDEXstatic intJF_GFXCOLOUR_DEF_SCALEstatic GFXColourLIGHTGRAYstatic intLIGHTGRAY_INDEXstatic intOTHER_INDEXstatic GFXColourWHITEstatic intWHITE_INDEX
-
Constructor Summary
Constructors Constructor Description GFXColour()Default constructor.GFXColour(int lNewR, int lNewG, int lNewB)GFXColour(int lNewR, int lNewG, int lNewB, int lNewScale)Constructor.GFXColour(GFXColour oSource)Copy consturctor.GFXColour(java.lang.String sColour)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intb()Get the current setting for Blue.static GFXColourblack()Get a Black colour object.static GFXColourcreate(int lNewR, int lNewG, int lNewB, int lNewScale)static GFXColourcreate(java.lang.String sColour)static GFXColourdarkGray()Get a Dark gray colour object.booleanequals(java.lang.Object object)Equality comparison operator.booleanequivalent(GFXColour oCompare)Equality comparison.intg()Get the current setting for Green.doublegetGrayRate()Get the converted grayscale value of the RGB triplet as a percentageintgetGrayScale()Get 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 booleanisBlack(GFXColour oColour)Check if a Colour object is set to black.static booleanisWhite(GFXColour oColour)Check if a Colour object is set to white.static GFXColourlightGray()Get 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.booleannotEqual(GFXColour oCompare)Non-equality comparison operator.intr()Get the current setting for Red.intscale()Get the scale setting for this colour object.GFXColourscale(int newScale)static GFXColourweightedAverage(GFXColour base, GFXColour weighted, double weight)static GFXColourwhite()Get a White colour object.booleanwhiteMono()Checks if this colour maps to white in a black and white scheme.
-
-
-
Field Detail
-
JF_GFXCOLOUR_DEF_SCALE
public static final int JF_GFXCOLOUR_DEF_SCALE
- See Also:
- Constant Field Values
-
BLACK_INDEX
public static final int BLACK_INDEX
enumeration StandardColour: supported standard colours.- See Also:
- Constant Field Values
-
WHITE_INDEX
public static final int WHITE_INDEX
- See Also:
- Constant Field Values
-
LIGHTGRAY_INDEX
public static final int LIGHTGRAY_INDEX
- See Also:
- Constant Field Values
-
GRAY_INDEX
public static final int GRAY_INDEX
- See Also:
- Constant Field Values
-
DARKGRAY_INDEX
public static final int DARKGRAY_INDEX
- See Also:
- Constant Field Values
-
OTHER_INDEX
public static final int OTHER_INDEX
- See Also:
- Constant Field Values
-
BLACK
public static final GFXColour BLACK
-
WHITE
public static final GFXColour WHITE
-
LIGHTGRAY
public static final GFXColour LIGHTGRAY
-
GRAY
public static final GFXColour GRAY
-
DARKGRAY
public static final GFXColour DARKGRAY
-
-
Constructor Detail
-
GFXColour
public GFXColour()
Default constructor.Assigns the colour object with the following values:
Red = 0 Green = 0 Blue = 0 Scale = 255
-
GFXColour
public GFXColour(GFXColour oSource)
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
public GFXColour(java.lang.String sColour)
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 Detail
-
create
public static GFXColour create(int lNewR, int lNewG, int lNewB, int lNewScale)
-
create
public static GFXColour create(java.lang.String sColour)
-
black
public static GFXColour 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
public static GFXColour 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
public static GFXColour 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
public static GFXColour 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
public static GFXColour 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
public static GFXColour getStandardColour(int colourIndex)
Get one of the predefined standard colour objects.- Parameters:
colourIndex- - the requested colour as a StandardColour enumeration.- Returns:
- The requested standard colour object.
-
getStandardColourIndex
public static int getStandardColourIndex(GFXColour oColour)
Get the defined standard colour as a StandardColour enumeration.- Parameters:
oColour- - the colour object- Returns:
- The standard colour enumeration value
-
isBlack
public static boolean isBlack(GFXColour oColour)
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
public static boolean isWhite(GFXColour oColour)
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
public GFXColour scale(int newScale)
-
equivalent
public boolean equivalent(GFXColour oCompare)
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
public boolean equals(java.lang.Object object)
Equality comparison operator.Two colour objects are considered equal if all their values compare for equality.
- Overrides:
equalsin classjava.lang.Object- Parameters:
object- the object to compare against.- Returns:
- TRUE if all members are equal, FALSE otherwise.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
notEqual
public boolean notEqual(GFXColour oCompare)
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
-
-