Class GFXColour
- java.lang.Object
-
- com.adobe.xfa.gfx.GFXColour
-
public class GFXColour extends java.lang.Object
The graphic colour object is a convinience class for basic colour handling.
-
-
Field Summary
Fields Modifier and Type Field Description static GFXColour
BLACK
static int
BLACK_INDEX
enumeration StandardColour: supported standard colours.static GFXColour
DARKGRAY
static int
DARKGRAY_INDEX
static GFXColour
GRAY
static int
GRAY_INDEX
static int
JF_GFXCOLOUR_DEF_SCALE
static GFXColour
LIGHTGRAY
static int
LIGHTGRAY_INDEX
static int
OTHER_INDEX
static GFXColour
WHITE
static int
WHITE_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 int
b()
Get the current setting for Blue.static GFXColour
black()
Get a Black colour object.static GFXColour
create(int lNewR, int lNewG, int lNewB, int lNewScale)
static GFXColour
create(java.lang.String sColour)
static GFXColour
darkGray()
Get a Dark gray colour object.boolean
equals(java.lang.Object object)
Equality comparison operator.boolean
equivalent(GFXColour oCompare)
Equality comparison.int
g()
Get the current setting for Green.double
getGrayRate()
Get the converted grayscale value of the RGB triplet as a percentageint
getGrayScale()
Get the converted grayscale value of the RGB tripletstatic GFXColour
getStandardColour(int colourIndex)
Get one of the predefined standard colour objects.static int
getStandardColourIndex(GFXColour oColour)
Get the defined standard colour as a StandardColour enumeration.static GFXColour
gray()
Get a Gray colour object.int
hashCode()
static boolean
isBlack(GFXColour oColour)
Check if a Colour object is set to black.static boolean
isWhite(GFXColour oColour)
Check if a Colour object is set to white.static GFXColour
lightGray()
Get a Light gray colour object.double
normalB()
Get the normalized value for Blue.double
normalG()
Get the normalized value for Green.double
normalR()
Get the normalized value for Red.boolean
notEqual(GFXColour oCompare)
Non-equality comparison operator.int
r()
Get the current setting for Red.int
scale()
Get the scale setting for this colour object.GFXColour
scale(int newScale)
static GFXColour
weightedAverage(GFXColour base, GFXColour weighted, double weight)
static GFXColour
white()
Get a White colour object.boolean
whiteMono()
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:
equals
in classjava.lang.Object
- Parameters:
object
- the object to compare against.- Returns:
- TRUE if all members are equal, FALSE otherwise.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in 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
-
-