Class GFXColour

java.lang.Object
com.adobe.xfa.gfx.GFXColour

public class GFXColour extends Object
The graphic colour object is a convinience class for basic colour handling.
  • Field Details

  • Constructor Details

    • 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 value
      lNewG - - Colour Green value
      lNewB - - Colour Blue value
      lNewScale - - Scale setting
    • GFXColour

      public GFXColour(int lNewR, int lNewG, int lNewB)
    • GFXColour

      public GFXColour(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 Details

    • create

      public static GFXColour create(int lNewR, int lNewG, int lNewB, int lNewScale)
    • create

      public static GFXColour create(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(Object object)
      Equality comparison operator.

      Two colour objects are considered equal if all their values compare for equality.

      Overrides:
      equals in class Object
      Parameters:
      object - the object to compare against.
      Returns:
      TRUE if all members are equal, FALSE otherwise.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class 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
    • weightedAverage

      public static GFXColour weightedAverage(GFXColour base, GFXColour weighted, double weight)