Class PDExtendedGraphicsState
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.graphics.state.PDExtendedGraphicsState
-
- All Implemented Interfaces:
COSObjectable
public class PDExtendedGraphicsState extends java.lang.Object implements COSObjectable
An extended graphics state dictionary.
-
-
Field Summary
Fields Modifier and Type Field Description private COSDictionary
dict
-
Constructor Summary
Constructors Constructor Description PDExtendedGraphicsState()
Default constructor, creates blank graphics state.PDExtendedGraphicsState(COSDictionary dictionary)
Create a graphics state from an existing dictionary.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyIntoGraphicsState(PDGraphicsState gs)
This will implement the gs operator.private float
defaultIfNull(java.lang.Float standardValue, float defaultValue)
Returns the provided default value in case 'standard' value isnull
.boolean
getAlphaSourceFlag()
This will get the alpha source flag (“alpha is shape”), that specifies whether the current soft mask and alpha constant shall be interpreted as shape values (true) or opacity values (false).boolean
getAutomaticStrokeAdjustment()
This will get the automatic stroke adjustment flag.BlendMode
getBlendMode()
Returns the blending mode stored in the COS dictionaryCOSDictionary
getCOSObject()
This will get the underlying dictionary that this class acts on.java.lang.Float
getFlatnessTolerance()
This will get the flatness tolerance.private java.lang.Float
getFloatItem(COSName key)
This will get a float item from the dictionary.PDFontSetting
getFontSetting()
This will get the font setting of the graphics state.int
getLineCapStyle()
This will get the line cap style.PDLineDashPattern
getLineDashPattern()
This will get the dash pattern.int
getLineJoinStyle()
This will get the line join style.java.lang.Float
getLineWidth()
This will get the line width.java.lang.Float
getMiterLimit()
This will get the miter limit.java.lang.Float
getNonStrokingAlphaConstant()
This will get the non stroking alpha constant.boolean
getNonStrokingOverprintControl()
This will get the overprint control for non stroking operations.java.lang.Float
getOverprintMode()
This will get the overprint control mode.RenderingIntent
getRenderingIntent()
This will get the rendering intent.java.lang.Float
getSmoothnessTolerance()
This will get the smothness tolerance.PDSoftMask
getSoftMask()
Returns the soft mask stored in the COS dictionaryjava.lang.Float
getStrokingAlphaConstant()
This will get the stroking alpha constant.boolean
getStrokingOverprintControl()
This will get the overprint control.boolean
getTextKnockoutFlag()
/** This will get the text knockout flag.COSBase
getTransfer()
This will get the transfer function of the /TR dictionary.COSBase
getTransfer2()
This will get the transfer function of the /TR2 dictionary.void
setAlphaSourceFlag(boolean alpha)
This will get the alpha source flag (“alpha is shape”), that specifies whether the current soft mask and alpha constant shall be interpreted as shape values (true) or opacity values (false).void
setAutomaticStrokeAdjustment(boolean sa)
This will get the automatic stroke adjustment flag.void
setBlendMode(BlendMode bm)
Set the blending mode.void
setFlatnessTolerance(java.lang.Float flatness)
This will get the flatness tolerance.private void
setFloatItem(COSName key, java.lang.Float value)
This will set a float object.void
setFontSetting(PDFontSetting fs)
This will set the font setting for this graphics state.void
setLineCapStyle(int style)
This will set the line cap style for the graphics state.void
setLineDashPattern(PDLineDashPattern dashPattern)
This will set the dash pattern for the graphics state.void
setLineJoinStyle(int style)
This will set the line join style.void
setLineWidth(java.lang.Float width)
This will set the line width.void
setMiterLimit(java.lang.Float miterLimit)
This will set the miter limit for the graphics state.void
setNonStrokingAlphaConstant(java.lang.Float alpha)
This will get the non stroking alpha constant.void
setNonStrokingOverprintControl(boolean op)
This will get the overprint control(OP).void
setOverprintMode(java.lang.Float overprintMode)
This will get the overprint mode(OPM).void
setRenderingIntent(java.lang.String ri)
This will set the rendering intent for the graphics state.void
setSmoothnessTolerance(java.lang.Float smoothness)
This will get the smoothness tolerance.void
setStrokingAlphaConstant(java.lang.Float alpha)
This will get the stroking alpha constant.void
setStrokingOverprintControl(boolean op)
This will get the overprint control(OP).void
setTextKnockoutFlag(boolean tk)
This will get the text knockout flag.void
setTransfer(COSBase transfer)
This will set the transfer function of the /TR dictionary.void
setTransfer2(COSBase transfer2)
This will set the transfer function of the /TR2 dictionary.
-
-
-
Field Detail
-
dict
private final COSDictionary dict
-
-
Constructor Detail
-
PDExtendedGraphicsState
public PDExtendedGraphicsState()
Default constructor, creates blank graphics state.
-
PDExtendedGraphicsState
public PDExtendedGraphicsState(COSDictionary dictionary)
Create a graphics state from an existing dictionary.- Parameters:
dictionary
- The existing graphics state.
-
-
Method Detail
-
copyIntoGraphicsState
public void copyIntoGraphicsState(PDGraphicsState gs) throws java.io.IOException
This will implement the gs operator.- Parameters:
gs
- The state to copy this dictionaries values into.- Throws:
java.io.IOException
- If there is an error copying font information.
-
defaultIfNull
private float defaultIfNull(java.lang.Float standardValue, float defaultValue)
Returns the provided default value in case 'standard' value isnull
. To be used in cases unboxing may lead to a NPE.- Parameters:
standardValue
- 'standard' valuedefaultValue
- default value- Returns:
- 'standard' value if not
null
otherwise default value
-
getCOSObject
public COSDictionary getCOSObject()
This will get the underlying dictionary that this class acts on.- Specified by:
getCOSObject
in interfaceCOSObjectable
- Returns:
- The underlying dictionary for this class.
-
getLineWidth
public java.lang.Float getLineWidth()
This will get the line width. This will return null if there is no line width- Returns:
- null or the LW value of the dictionary.
-
setLineWidth
public void setLineWidth(java.lang.Float width)
This will set the line width.- Parameters:
width
- The line width for the object.
-
getLineCapStyle
public int getLineCapStyle()
This will get the line cap style.- Returns:
- null or the LC value of the dictionary.
-
setLineCapStyle
public void setLineCapStyle(int style)
This will set the line cap style for the graphics state.- Parameters:
style
- The new line cap style to set.
-
getLineJoinStyle
public int getLineJoinStyle()
This will get the line join style.- Returns:
- null or the LJ value in the dictionary.
-
setLineJoinStyle
public void setLineJoinStyle(int style)
This will set the line join style.- Parameters:
style
- The new line join style.
-
getMiterLimit
public java.lang.Float getMiterLimit()
This will get the miter limit.- Returns:
- null or the ML value in the dictionary.
-
setMiterLimit
public void setMiterLimit(java.lang.Float miterLimit)
This will set the miter limit for the graphics state.- Parameters:
miterLimit
- The new miter limit value
-
getLineDashPattern
public PDLineDashPattern getLineDashPattern()
This will get the dash pattern.- Returns:
- null or the D value in the dictionary.
-
setLineDashPattern
public void setLineDashPattern(PDLineDashPattern dashPattern)
This will set the dash pattern for the graphics state.- Parameters:
dashPattern
- The dash pattern
-
getRenderingIntent
public RenderingIntent getRenderingIntent()
This will get the rendering intent.- Returns:
- null or the RI value in the dictionary.
-
setRenderingIntent
public void setRenderingIntent(java.lang.String ri)
This will set the rendering intent for the graphics state.- Parameters:
ri
- The new rendering intent
-
getStrokingOverprintControl
public boolean getStrokingOverprintControl()
This will get the overprint control.- Returns:
- The overprint control or null if one has not been set.
-
setStrokingOverprintControl
public void setStrokingOverprintControl(boolean op)
This will get the overprint control(OP).- Parameters:
op
- The overprint control.
-
getNonStrokingOverprintControl
public boolean getNonStrokingOverprintControl()
This will get the overprint control for non stroking operations. If this value is null then the regular overprint control value will be returned.- Returns:
- The overprint control or null if one has not been set.
-
setNonStrokingOverprintControl
public void setNonStrokingOverprintControl(boolean op)
This will get the overprint control(OP).- Parameters:
op
- The overprint control.
-
getOverprintMode
public java.lang.Float getOverprintMode()
This will get the overprint control mode.- Returns:
- The overprint control mode or null if one has not been set.
-
setOverprintMode
public void setOverprintMode(java.lang.Float overprintMode)
This will get the overprint mode(OPM).- Parameters:
overprintMode
- The overprint mode
-
getFontSetting
public PDFontSetting getFontSetting()
This will get the font setting of the graphics state.- Returns:
- The font setting.
-
setFontSetting
public void setFontSetting(PDFontSetting fs)
This will set the font setting for this graphics state.- Parameters:
fs
- The new font setting.
-
getFlatnessTolerance
public java.lang.Float getFlatnessTolerance()
This will get the flatness tolerance.- Returns:
- The flatness tolerance or null if one has not been set.
-
setFlatnessTolerance
public void setFlatnessTolerance(java.lang.Float flatness)
This will get the flatness tolerance.- Parameters:
flatness
- The new flatness tolerance
-
getSmoothnessTolerance
public java.lang.Float getSmoothnessTolerance()
This will get the smothness tolerance.- Returns:
- The smothness tolerance or null if one has not been set.
-
setSmoothnessTolerance
public void setSmoothnessTolerance(java.lang.Float smoothness)
This will get the smoothness tolerance.- Parameters:
smoothness
- The new smoothness tolerance
-
getAutomaticStrokeAdjustment
public boolean getAutomaticStrokeAdjustment()
This will get the automatic stroke adjustment flag.- Returns:
- The automatic stroke adjustment flag or null if one has not been set.
-
setAutomaticStrokeAdjustment
public void setAutomaticStrokeAdjustment(boolean sa)
This will get the automatic stroke adjustment flag.- Parameters:
sa
- The new automatic stroke adjustment flag.
-
getStrokingAlphaConstant
public java.lang.Float getStrokingAlphaConstant()
This will get the stroking alpha constant.- Returns:
- The stroking alpha constant or null if one has not been set.
-
setStrokingAlphaConstant
public void setStrokingAlphaConstant(java.lang.Float alpha)
This will get the stroking alpha constant.- Parameters:
alpha
- The new stroking alpha constant.
-
getNonStrokingAlphaConstant
public java.lang.Float getNonStrokingAlphaConstant()
This will get the non stroking alpha constant.- Returns:
- The non stroking alpha constant or null if one has not been set.
-
setNonStrokingAlphaConstant
public void setNonStrokingAlphaConstant(java.lang.Float alpha)
This will get the non stroking alpha constant.- Parameters:
alpha
- The new non stroking alpha constant.
-
getAlphaSourceFlag
public boolean getAlphaSourceFlag()
This will get the alpha source flag (“alpha is shape”), that specifies whether the current soft mask and alpha constant shall be interpreted as shape values (true) or opacity values (false).- Returns:
- The alpha source flag.
-
setAlphaSourceFlag
public void setAlphaSourceFlag(boolean alpha)
This will get the alpha source flag (“alpha is shape”), that specifies whether the current soft mask and alpha constant shall be interpreted as shape values (true) or opacity values (false).- Parameters:
alpha
- The alpha source flag.
-
getBlendMode
public BlendMode getBlendMode()
Returns the blending mode stored in the COS dictionary- Returns:
- the blending mode
-
setBlendMode
public void setBlendMode(BlendMode bm)
Set the blending mode.- Parameters:
bm
-
-
getSoftMask
public PDSoftMask getSoftMask()
Returns the soft mask stored in the COS dictionary- Returns:
- the soft mask or null if there isn't any.
-
getTextKnockoutFlag
public boolean getTextKnockoutFlag()
/** This will get the text knockout flag.- Returns:
- The text knockout flag.
-
setTextKnockoutFlag
public void setTextKnockoutFlag(boolean tk)
This will get the text knockout flag.- Parameters:
tk
- The text knockout flag.
-
getFloatItem
private java.lang.Float getFloatItem(COSName key)
This will get a float item from the dictionary.- Parameters:
key
- The key to the item.- Returns:
- The value for that item.
-
setFloatItem
private void setFloatItem(COSName key, java.lang.Float value)
This will set a float object.- Parameters:
key
- The key to the data that we are setting.value
- The value that we are setting.
-
getTransfer
public COSBase getTransfer()
This will get the transfer function of the /TR dictionary.- Returns:
- The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function.
-
setTransfer
public void setTransfer(COSBase transfer)
This will set the transfer function of the /TR dictionary.- Parameters:
transfer
- The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function.
-
getTransfer2
public COSBase getTransfer2()
This will get the transfer function of the /TR2 dictionary.- Returns:
- The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function, and the name Default denotes the transfer function that was in effect at the start of the page.
-
setTransfer2
public void setTransfer2(COSBase transfer2)
This will set the transfer function of the /TR2 dictionary.- Parameters:
transfer2
- The transfer function. According to the PDF specification, this is either a single function (which applies to all process colorants) or an array of four functions (which apply to the process colorants individually). The name Identity may be used to represent the identity function, and the name Default denotes the transfer function that was in effect at the start of the page.
-
-