org.foray.pdf.object
Class PDFColor

java.lang.Object
  extended by org.foray.pdf.object.PDFObject
      extended by org.foray.pdf.object.PDFPathPaint
          extended by org.foray.pdf.object.PDFColor
All Implemented Interfaces:
org.axsl.pdf.PdfColor, org.axsl.pdf.PdfPathPaint

public class PDFColor
extends PDFPathPaint
implements org.axsl.pdf.PdfColor

A color in a PDF document.


Field Summary
 
Fields inherited from class org.foray.pdf.object.PDFObject
EOL, MSG_EOL, XREF_EOL
 
Constructor Summary
PDFColor(Color theColor)
          Constructor.
 
Method Summary
 boolean equals(Object obj)
           
 float getBlue()
          Return the blue component of this color.
 Color getColor()
          Return the encapsulated Color.
static String getColorSpacePDFString(ColorSpace colorSpace)
          Returns the PDF string to use to describe a color space.
 float getGreen()
          Return the green component of this color.
 float getRed()
          Return the red component of this color.
 String getSetterString(boolean fillNotStroke)
           
static float intToFloat(int component)
          Converts an integral color component in the range 0 thru 255 to a float color component in the range 0 thru 1.
 boolean isBlack()
          Indicates whether this color is black.
 
Methods inherited from class org.foray.pdf.object.PDFPathPaint
getColorSpace, setColorSpace
 
Methods inherited from class org.foray.pdf.object.PDFObject
bufferToByteArray, byteArrayToStream, getCharsPerLine, getGeneration, getLogger, getNumber, getPDFDocument, output, pdfID, pdfReference, setNumber, stringToByteArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFColor

public PDFColor(Color theColor)
Constructor.

Parameters:
theColor - The encapsulated Color.
Method Detail

getSetterString

public String getSetterString(boolean fillNotStroke)
Specified by:
getSetterString in interface org.axsl.pdf.PdfPathPaint

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getColorSpacePDFString

public static String getColorSpacePDFString(ColorSpace colorSpace)
Returns the PDF string to use to describe a color space.

Parameters:
colorSpace - The color space to be described.
Returns:
The PDF string describing colorSpace.

isBlack

public boolean isBlack()
Indicates whether this color is black.

Returns:
True iff this color is black.

getColor

public Color getColor()
Return the encapsulated Color.

Returns:
The encapsulated Color.

getRed

public float getRed()
Return the red component of this color.

Returns:
The red component of this color, in the range 0 thru 1.

getGreen

public float getGreen()
Return the green component of this color.

Returns:
The green component of this color, in the range 0 thru 1.

getBlue

public float getBlue()
Return the blue component of this color.

Returns:
The blue component of this color, in the range 0 thru 1.

intToFloat

public static float intToFloat(int component)
Converts an integral color component in the range 0 thru 255 to a float color component in the range 0 thru 1. This is needed because Java stores (or at least returns) color components as integers, but PDF wants them in the 0 thru 1 range.

Parameters:
component - The integral color component to be converted.
Returns:
The converted float color component.


Copyright © 2017. All rights reserved.