Class Color

java.lang.Object
com.datalogics.PDFL.Color

public class Color extends Object
A color specified by values appropriate for its color space. The values that are offered range from 0 to 1.0 for red, green, and blue (RGB) or cyan, magenta, yellow, and black (CYMK).

  • Constructor Summary

    Constructors
    Constructor
    Description
    Color(double grey)
    Create a new color in the DeviceGray colorspace with the specified value.
    Color(double r, double g, double b)
    Create a new color in the DeviceRGB colorspace with the specified value.
    Color(double c, double m, double y, double k)
    Create a new color in the DeviceCMYK colorspace with the specified value.
    Color(ColorSpace colorSpace, List<Double> values)
    Create a new color in an arbitrary color space.
    Color(Pattern pattern)
    Create a new color in the pattern color space.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Color
    Create a Color from a standard java.awt.Color object.
    void
     
    boolean
     
    The pattern of the color
    The color space of the color
    The values of the color.
    a string representing the color.

    Methods inherited from class java.lang.Object

    getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Color

      public Color(double grey)
      Create a new color in the DeviceGray colorspace with the specified value.
      Parameters:
      grey - the grayscale color value for the new color (0.0 - 1.0)
    • Color

      public Color(double r, double g, double b)
      Create a new color in the DeviceRGB colorspace with the specified value.
      Parameters:
      r - the red color value for the new color (0.0 - 1.0)
      g - the green color value for the new color (0.0 - 1.0)
      b - the blue color value for the new color (0.0 - 1.0)
    • Color

      public Color(double c, double m, double y, double k)
      Create a new color in the DeviceCMYK colorspace with the specified value.
      Parameters:
      c - the cyan color value for the new color (0.0 - 1.0)
      m - the magenta color value for the new color (0.0 - 1.0)
      y - the yellow color value for the new color (0.0 - 1.0)
      k - the black color value for the new color (0.0 - 1.0)
    • Color

      public Color(ColorSpace colorSpace, List<Double> values)
      Create a new color in an arbitrary color space. The number of values passed must match the number of values in the color space.

      Parameters:
      colorSpace - the color space in which to create the color
      values - the values to place into the color
    • Color

      public Color(Pattern pattern)
      Create a new color in the pattern color space.

      Parameters:
      pattern - The pattern to turn into a color
  • Method Details

    • delete

      public void delete()
    • colorFromAWTColor

      public static Color colorFromAWTColor(Color c)
      Create a Color from a standard java.awt.Color object.
      Parameters:
      c - the java.awt.Color object to use as a source
    • equals

      public boolean equals(Object rhs)
      Overrides:
      equals in class Object
    • getValue

      public List<Double> getValue()
      The values of the color. Not valid for pattern-based colors.

    • getSpace

      public ColorSpace getSpace()
      The color space of the color

    • toString

      public String toString()
      a string representing the color.
      Overrides:
      toString in class Object
    • getPattern

      public Pattern getPattern()
      The pattern of the color