Class PDGraphicsState
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.graphics.state.PDGraphicsState
-
- All Implemented Interfaces:
java.lang.Cloneable
public class PDGraphicsState extends java.lang.Object implements java.lang.Cloneable
The current state of the graphics parameters when executing a content stream.
-
-
Field Summary
Fields Modifier and Type Field Description private double
alphaConstant
private boolean
alphaSource
private BlendMode
blendMode
private java.awt.geom.Area
clippingPath
private Matrix
currentTransformationMatrix
private double
flatness
private boolean
isClippingPathDirty
private int
lineCap
private PDLineDashPattern
lineDashPattern
private int
lineJoin
private float
lineWidth
private float
miterLimit
private double
nonStrokingAlphaConstant
private PDColor
nonStrokingColor
private PDColorSpace
nonStrokingColorSpace
private boolean
nonStrokingOverprint
private boolean
overprint
private double
overprintMode
private RenderingIntent
renderingIntent
private double
smoothness
private PDSoftMask
softMask
private boolean
strokeAdjustment
private PDColor
strokingColor
private PDColorSpace
strokingColorSpace
private PDTextState
textState
private COSBase
transfer
-
Constructor Summary
Constructors Constructor Description PDGraphicsState(PDRectangle page)
Constructor with a given page size to initialize the clipping path.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PDGraphicsState
clone()
double
getAlphaConstant()
Get the value of the stroke alpha constant property.BlendMode
getBlendMode()
Returns the current blend modejava.awt.geom.Area
getCurrentClippingPath()
This will get the current clipping path.Matrix
getCurrentTransformationMatrix()
Get the value of the CTM.double
getFlatness()
get the value of the flatness property.int
getLineCap()
Get the value of the line cap.PDLineDashPattern
getLineDashPattern()
This will get the current line dash pattern.int
getLineJoin()
Get the value of the line join.float
getLineWidth()
Get the value of the line width.float
getMiterLimit()
Get the value of the miter limit.double
getNonStrokeAlphaConstant()
Get the value of the non-stroke alpha constant property.double
getNonStrokeAlphaConstants()
Deprecated.PDColor
getNonStrokingColor()
Returns the non-stroking color.PDColorSpace
getNonStrokingColorSpace()
Returns the non-stroking color space.java.awt.Composite
getNonStrokingJavaComposite()
double
getOverprintMode()
get the value of the overprint mode property.RenderingIntent
getRenderingIntent()
This will get the rendering intent.double
getSmoothness()
get the value of the smoothness property.PDSoftMask
getSoftMask()
returns the current softmaskPDColor
getStrokingColor()
Returns the stroking color.PDColorSpace
getStrokingColorSpace()
Returns the stroking color space.java.awt.Composite
getStrokingJavaComposite()
PDTextState
getTextState()
This will get the graphics text state.COSBase
getTransfer()
This will get the transfer function.void
intersectClippingPath(java.awt.geom.Area area)
Modify the current clipping path by intersecting it with the given path.void
intersectClippingPath(java.awt.geom.GeneralPath path)
Modify the current clipping path by intersecting it with the given path.boolean
isAlphaSource()
get the value of the stroke alpha source property.boolean
isNonStrokingOverprint()
get the value of the non stroking overprint property.boolean
isOverprint()
get the value of the overprint property.boolean
isStrokeAdjustment()
Get the value of the stroke adjustment parameter.void
setAlphaConstant(double value)
set the value of the stroke alpha constant property.void
setAlphaSource(boolean value)
set the value of the alpha source property.void
setBlendMode(BlendMode blendMode)
Sets the blend mode in the current graphics statevoid
setCurrentTransformationMatrix(Matrix value)
Set the value of the CTM.void
setFlatness(double value)
set the value of the flatness property.void
setLineCap(int value)
set the value of the line cap.void
setLineDashPattern(PDLineDashPattern value)
This will set the current line dash pattern.void
setLineJoin(int value)
Get the value of the line join.void
setLineWidth(float value)
set the value of the line width.void
setMiterLimit(float value)
set the value of the miter limit.void
setNonStrokeAlphaConstant(double value)
set the value of the non-stroke alpha constant property.void
setNonStrokeAlphaConstants(double value)
Deprecated.void
setNonStrokingColor(PDColor color)
Sets the non-stroking color.void
setNonStrokingColorSpace(PDColorSpace colorSpace)
Sets the non-stroking color space.void
setNonStrokingOverprint(boolean value)
set the value of the non stroking overprint property.void
setOverprint(boolean value)
set the value of the overprint property.void
setOverprintMode(double value)
set the value of the overprint mode property.void
setRenderingIntent(RenderingIntent value)
This will set the rendering intent.void
setSmoothness(double value)
set the value of the smoothness property.void
setSoftMask(PDSoftMask softMask)
Sets the current soft maskvoid
setStrokeAdjustment(boolean value)
set the value of the stroke adjustment.void
setStrokingColor(PDColor color)
Sets the stroking color.void
setStrokingColorSpace(PDColorSpace colorSpace)
Sets the stroking color space.void
setTextState(PDTextState value)
This will set the graphics text state.void
setTransfer(COSBase transfer)
This will set the transfer function.
-
-
-
Field Detail
-
isClippingPathDirty
private boolean isClippingPathDirty
-
clippingPath
private java.awt.geom.Area clippingPath
-
currentTransformationMatrix
private Matrix currentTransformationMatrix
-
strokingColor
private PDColor strokingColor
-
nonStrokingColor
private PDColor nonStrokingColor
-
strokingColorSpace
private PDColorSpace strokingColorSpace
-
nonStrokingColorSpace
private PDColorSpace nonStrokingColorSpace
-
textState
private PDTextState textState
-
lineWidth
private float lineWidth
-
lineCap
private int lineCap
-
lineJoin
private int lineJoin
-
miterLimit
private float miterLimit
-
lineDashPattern
private PDLineDashPattern lineDashPattern
-
renderingIntent
private RenderingIntent renderingIntent
-
strokeAdjustment
private boolean strokeAdjustment
-
blendMode
private BlendMode blendMode
-
softMask
private PDSoftMask softMask
-
alphaConstant
private double alphaConstant
-
nonStrokingAlphaConstant
private double nonStrokingAlphaConstant
-
alphaSource
private boolean alphaSource
-
overprint
private boolean overprint
-
nonStrokingOverprint
private boolean nonStrokingOverprint
-
overprintMode
private double overprintMode
-
transfer
private COSBase transfer
-
flatness
private double flatness
-
smoothness
private double smoothness
-
-
Constructor Detail
-
PDGraphicsState
public PDGraphicsState(PDRectangle page)
Constructor with a given page size to initialize the clipping path.- Parameters:
page
- the size of the page
-
-
Method Detail
-
getCurrentTransformationMatrix
public Matrix getCurrentTransformationMatrix()
Get the value of the CTM.- Returns:
- The current transformation matrix.
-
setCurrentTransformationMatrix
public void setCurrentTransformationMatrix(Matrix value)
Set the value of the CTM.- Parameters:
value
- The current transformation matrix.
-
getLineWidth
public float getLineWidth()
Get the value of the line width.- Returns:
- The current line width.
-
setLineWidth
public void setLineWidth(float value)
set the value of the line width.- Parameters:
value
- The current line width.
-
getLineCap
public int getLineCap()
Get the value of the line cap.- Returns:
- The current line cap.
-
setLineCap
public void setLineCap(int value)
set the value of the line cap.- Parameters:
value
- The current line cap.
-
getLineJoin
public int getLineJoin()
Get the value of the line join.- Returns:
- The current line join value.
-
setLineJoin
public void setLineJoin(int value)
Get the value of the line join.- Parameters:
value
- The current line join
-
getMiterLimit
public float getMiterLimit()
Get the value of the miter limit.- Returns:
- The current miter limit.
-
setMiterLimit
public void setMiterLimit(float value)
set the value of the miter limit.- Parameters:
value
- The current miter limit.
-
isStrokeAdjustment
public boolean isStrokeAdjustment()
Get the value of the stroke adjustment parameter.- Returns:
- The current stroke adjustment.
-
setStrokeAdjustment
public void setStrokeAdjustment(boolean value)
set the value of the stroke adjustment.- Parameters:
value
- The value of the stroke adjustment parameter.
-
getAlphaConstant
public double getAlphaConstant()
Get the value of the stroke alpha constant property.- Returns:
- The value of the stroke alpha constant parameter.
-
setAlphaConstant
public void setAlphaConstant(double value)
set the value of the stroke alpha constant property.- Parameters:
value
- The value of the stroke alpha constant parameter.
-
getNonStrokeAlphaConstants
@Deprecated public double getNonStrokeAlphaConstants()
Deprecated.Get the value of the non-stroke alpha constant property.- Returns:
- The value of the non-stroke alpha constant parameter.
-
setNonStrokeAlphaConstants
@Deprecated public void setNonStrokeAlphaConstants(double value)
Deprecated.set the value of the non-stroke alpha constant property.- Parameters:
value
- The value of the non-stroke alpha constant parameter.
-
getNonStrokeAlphaConstant
public double getNonStrokeAlphaConstant()
Get the value of the non-stroke alpha constant property.- Returns:
- The value of the non-stroke alpha constant parameter.
-
setNonStrokeAlphaConstant
public void setNonStrokeAlphaConstant(double value)
set the value of the non-stroke alpha constant property.- Parameters:
value
- The value of the non-stroke alpha constant parameter.
-
isAlphaSource
public boolean isAlphaSource()
get the value of the stroke alpha source property.- Returns:
- The value of the stroke alpha source parameter.
-
setAlphaSource
public void setAlphaSource(boolean value)
set the value of the alpha source property.- Parameters:
value
- The value of the alpha source parameter.
-
getSoftMask
public PDSoftMask getSoftMask()
returns the current softmask- Returns:
- softMask
-
setSoftMask
public void setSoftMask(PDSoftMask softMask)
Sets the current soft mask- Parameters:
softMask
-
-
getBlendMode
public BlendMode getBlendMode()
Returns the current blend mode- Returns:
- the current blend mode
-
setBlendMode
public void setBlendMode(BlendMode blendMode)
Sets the blend mode in the current graphics state- Parameters:
blendMode
-
-
isOverprint
public boolean isOverprint()
get the value of the overprint property.- Returns:
- The value of the overprint parameter.
-
setOverprint
public void setOverprint(boolean value)
set the value of the overprint property.- Parameters:
value
- The value of the overprint parameter.
-
isNonStrokingOverprint
public boolean isNonStrokingOverprint()
get the value of the non stroking overprint property.- Returns:
- The value of the non stroking overprint parameter.
-
setNonStrokingOverprint
public void setNonStrokingOverprint(boolean value)
set the value of the non stroking overprint property.- Parameters:
value
- The value of the non stroking overprint parameter.
-
getOverprintMode
public double getOverprintMode()
get the value of the overprint mode property.- Returns:
- The value of the overprint mode parameter.
-
setOverprintMode
public void setOverprintMode(double value)
set the value of the overprint mode property.- Parameters:
value
- The value of the overprint mode parameter.
-
getFlatness
public double getFlatness()
get the value of the flatness property.- Returns:
- The value of the flatness parameter.
-
setFlatness
public void setFlatness(double value)
set the value of the flatness property.- Parameters:
value
- The value of the flatness parameter.
-
getSmoothness
public double getSmoothness()
get the value of the smoothness property.- Returns:
- The value of the smoothness parameter.
-
setSmoothness
public void setSmoothness(double value)
set the value of the smoothness property.- Parameters:
value
- The value of the smoothness parameter.
-
getTextState
public PDTextState getTextState()
This will get the graphics text state.- Returns:
- The graphics text state.
-
setTextState
public void setTextState(PDTextState value)
This will set the graphics text state.- Parameters:
value
- The graphics text state.
-
getLineDashPattern
public PDLineDashPattern getLineDashPattern()
This will get the current line dash pattern.- Returns:
- The line dash pattern.
-
setLineDashPattern
public void setLineDashPattern(PDLineDashPattern value)
This will set the current line dash pattern.- Parameters:
value
- The new line dash pattern.
-
getRenderingIntent
public RenderingIntent getRenderingIntent()
This will get the rendering intent.- Returns:
- The rendering intent
- See Also:
PDExtendedGraphicsState
-
setRenderingIntent
public void setRenderingIntent(RenderingIntent value)
This will set the rendering intent.- Parameters:
value
- The new rendering intent.
-
clone
public PDGraphicsState clone()
- Overrides:
clone
in classjava.lang.Object
-
getStrokingColor
public PDColor getStrokingColor()
Returns the stroking color.- Returns:
- stroking color
-
setStrokingColor
public void setStrokingColor(PDColor color)
Sets the stroking color.- Parameters:
color
- The new stroking color
-
getNonStrokingColor
public PDColor getNonStrokingColor()
Returns the non-stroking color.- Returns:
- The non-stroking color
-
setNonStrokingColor
public void setNonStrokingColor(PDColor color)
Sets the non-stroking color.- Parameters:
color
- The new non-stroking color
-
getStrokingColorSpace
public PDColorSpace getStrokingColorSpace()
Returns the stroking color space.- Returns:
- The stroking color space.
-
setStrokingColorSpace
public void setStrokingColorSpace(PDColorSpace colorSpace)
Sets the stroking color space.- Parameters:
colorSpace
- The new stroking color space.
-
getNonStrokingColorSpace
public PDColorSpace getNonStrokingColorSpace()
Returns the non-stroking color space.- Returns:
- The non-stroking color space.
-
setNonStrokingColorSpace
public void setNonStrokingColorSpace(PDColorSpace colorSpace)
Sets the non-stroking color space.- Parameters:
colorSpace
- The new non-stroking color space.
-
intersectClippingPath
public void intersectClippingPath(java.awt.geom.GeneralPath path)
Modify the current clipping path by intersecting it with the given path.- Parameters:
path
- path to intersect with the clipping path
-
intersectClippingPath
public void intersectClippingPath(java.awt.geom.Area area)
Modify the current clipping path by intersecting it with the given path.- Parameters:
area
- area to intersect with the clipping path
-
getCurrentClippingPath
public java.awt.geom.Area getCurrentClippingPath()
This will get the current clipping path. Do not modify this Area object!- Returns:
- The current clipping path.
-
getStrokingJavaComposite
public java.awt.Composite getStrokingJavaComposite()
-
getNonStrokingJavaComposite
public java.awt.Composite getNonStrokingJavaComposite()
-
getTransfer
public COSBase getTransfer()
This will get the transfer function.- 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.
-
setTransfer
public void setTransfer(COSBase transfer)
This will set the transfer function.- 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, and the name Default denotes the transfer function that was in effect at the start of the page.
-
-