Class PDColorState
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.graphics.color.PDColorState
-
- All Implemented Interfaces:
java.lang.Cloneable
public class PDColorState extends java.lang.Object implements java.lang.CloneableThis class represents a color space and the color value for that colorspace.- Author:
- Ben Litchfield
-
-
Constructor Summary
Constructors Constructor Description PDColorState()Default constructor.PDColorState(COSArray csValues)Constructor with an existing color set.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()PDColorSpacegetColorSpace()This will get the current colorspace.float[]getColorSpaceValue()This will get the color space values.COSArraygetCOSColorSpaceValue()This will get the color space values.java.awt.ColorgetJavaColor()Returns the Java AWT color based on the current color space and value.java.awt.PaintgetPaint(int pageHeight)Returns the Java AWT paint based on the current pattern.PDPatternResourcesgetPattern()This will get the current pattern.voidsetColorSpace(PDColorSpace value)This will set the current colorspace.voidsetColorSpaceValue(float[] value)This will update the colorspace values.static voidsetIccOverrideColor(java.awt.Color color)Sets the default color to replace all colors inICC color spaces.voidsetPattern(PDPatternResources patternValue)This will update the current pattern.
-
-
-
Constructor Detail
-
PDColorState
public PDColorState()
Default constructor.
-
PDColorState
public PDColorState(COSArray csValues)
Constructor with an existing color set. Default colorspace is PDDeviceGray.- Parameters:
csValues- The color space values.
-
-
Method Detail
-
setIccOverrideColor
public static void setIccOverrideColor(java.awt.Color color)
Sets the default color to replace all colors inICC color spaces. This will work around a potential JVM crash caused by broken native ICC color manipulation code in the Sun class libraries.The default override can be specified by setting the color code in
org.apache.pdfbox.ICC_override_colorsystem property (seeColor.getColor(String). If this system property is not specified, then the override is not enabled unless this method is explicitly called.- Parameters:
color- ICC override color, ornullto disable the override- Since:
- Apache PDFBox 0.8.1
- See Also:
- PDFBOX-511
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.lang.Object
-
getJavaColor
public java.awt.Color getJavaColor() throws java.io.IOExceptionReturns the Java AWT color based on the current color space and value.- Returns:
- current Java AWT color
- Throws:
java.io.IOException- if the current color can not be created
-
getPaint
public java.awt.Paint getPaint(int pageHeight) throws java.io.IOExceptionReturns the Java AWT paint based on the current pattern.- Parameters:
pageHeight- the height of the current page- Returns:
- current Java AWT paint
- Throws:
java.io.IOException- if the current color can not be created
-
getColorSpace
public PDColorSpace getColorSpace()
This will get the current colorspace.- Returns:
- The current colorspace.
-
setColorSpace
public void setColorSpace(PDColorSpace value)
This will set the current colorspace.- Parameters:
value- The new colorspace.
-
getColorSpaceValue
public float[] getColorSpaceValue()
This will get the color space values. Either 1 for gray or 3 for RGB.- Returns:
- The colorspace values.
-
getCOSColorSpaceValue
public COSArray getCOSColorSpaceValue()
This will get the color space values. Either 1 for gray or 3 for RGB.- Returns:
- The colorspace values.
-
setColorSpaceValue
public void setColorSpaceValue(float[] value)
This will update the colorspace values.- Parameters:
value- The new colorspace values.
-
getPattern
public PDPatternResources getPattern()
This will get the current pattern.- Returns:
- The current pattern.
-
setPattern
public void setPattern(PDPatternResources patternValue)
This will update the current pattern.- Parameters:
patternValue- The new pattern.
-
-