Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.graphics.state

public Class PDGraphicsState

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
java.awt.BasicStroke, .Composite, java.awt.geom.Area, .GeneralPath, .Path2D, .Rectangle2D, java.util.ArrayList, .List, org.apache.pdfbox.cos.COSBase, org.apache.pdfbox.pdmodel.common.PDRectangle, org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern, org.apache.pdfbox.pdmodel.graphics.blend.BlendComposite, .BlendMode, org.apache.pdfbox.pdmodel.graphics.color.PDColor, .PDColorSpace, .PDDeviceGray, org.apache.pdfbox.util.Matrix

The current state of the graphics parameters when executing a content stream.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private double
private boolean
private BlendMode
private Area
private List<Path2D>
private Matrix
private double
private boolean
private int
private PDLineDashPattern
private int
private float
private float
private double
private PDColor
private PDColorSpace
private boolean
private boolean
private int
private RenderingIntent
private double
private PDSoftMask
private boolean
private PDColor
private PDColorSpace
private Matrix
private Matrix
private PDTextState
private COSBase

Constructor Summary

AccessConstructor and Description
public
PDGraphicsState(PDRectangle
the size of the page
page
)

Constructor with a given page size to initialize the clipping path.

Method Summary

Modifier and TypeMethod and Description
public PDGraphicsState
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.

public double

Returns:

The value of the stroke alpha constant parameter.
getAlphaConstant
()

Get the value of the stroke alpha constant property.

public BlendMode

Returns:

the current blend mode
getBlendMode
()

Returns the current blend mode

public Area

Returns:

The current clipping path.
getCurrentClippingPath
()

This will get the current clipping path.

public List<Path2D>

Returns:

The current clipping paths.
getCurrentClippingPaths
()

This will get the current clipping path, as one or more individual paths.

public Matrix

Returns:

The current transformation matrix.
getCurrentTransformationMatrix
()

Get the value of the CTM.

public double

Returns:

The value of the flatness parameter.
getFlatness
()

get the value of the flatness property.

public int

Returns:

The current line cap.
getLineCap
()

Get the value of the line cap.

public PDLineDashPattern

Returns:

The line dash pattern.
getLineDashPattern
()

This will get the current line dash pattern.

public int

Returns:

The current line join value.
getLineJoin
()

Get the value of the line join.

public float

Returns:

The current line width.
getLineWidth
()

Get the value of the line width.

public float

Returns:

The current miter limit.
getMiterLimit
()

Get the value of the miter limit.

public double

Returns:

The value of the non-stroke alpha constant parameter.
getNonStrokeAlphaConstant
()

Get the value of the non-stroke alpha constant property.

public PDColor

Returns:

The non-stroking color
getNonStrokingColor
()

Returns the non-stroking color.

public PDColorSpace

Returns:

The non-stroking color space.
getNonStrokingColorSpace
()

Returns the non-stroking color space.

public Composite
public int

Returns:

The value of the overprint mode parameter.
getOverprintMode
()

get the value of the overprint mode property.

public RenderingIntent

Returns:

The rendering intent
getRenderingIntent
()

This will get the rendering intent.

public double

Returns:

The value of the smoothness parameter.
getSmoothness
()

get the value of the smoothness property.

public PDSoftMask

Returns:

softMask
getSoftMask
()

returns the current softmask

public PDColor

Returns:

stroking color
getStrokingColor
()

Returns the stroking color.

public PDColorSpace

Returns:

The stroking color space.
getStrokingColorSpace
()

Returns the stroking color space.

public Composite
public Matrix

Returns:

Returns the textLineMatrix.
getTextLineMatrix
()

public Matrix

Returns:

Returns the textMatrix.
getTextMatrix
()

public PDTextState

Returns:

The graphics text state.
getTextState
()

This will get the graphics text state.

public COSBase

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.
getTransfer
()

This will get the transfer function.

public void
intersectClippingPath(GeneralPath
path to intersect with the clipping path
path
)

Modify the current clipping path by intersecting it with the given path.

private void
intersectClippingPath(Path2D path, boolean clonePath)

public void
intersectClippingPath(Area
area to intersect with the clipping path
area
)

Modify the current clipping path by intersecting it with the given path.

public boolean

Returns:

The value of the stroke alpha source parameter.
isAlphaSource
()

get the value of the stroke alpha source property.

public boolean

Returns:

The value of the non stroking overprint parameter.
isNonStrokingOverprint
()

get the value of the non stroking overprint property.

public boolean

Returns:

The value of the overprint parameter.
isOverprint
()

get the value of the overprint property.

public boolean

Returns:

The current stroke adjustment.
isStrokeAdjustment
()

Get the value of the stroke adjustment parameter.

public void
setAlphaConstant(double
The value of the stroke alpha constant parameter.
value
)

set the value of the stroke alpha constant property.

public void
setAlphaSource(boolean
The value of the alpha source parameter.
value
)

set the value of the alpha source property.

public void
setBlendMode(BlendMode
blend mode
blendMode
)

Sets the blend mode in the current graphics state

public void
setCurrentTransformationMatrix(Matrix
The current transformation matrix.
value
)

Set the value of the CTM.

public void
setFlatness(double
The value of the flatness parameter.
value
)

set the value of the flatness property.

public void
setLineCap(int
The current line cap.
value
)

set the value of the line cap.

public void
setLineDashPattern(PDLineDashPattern
The new line dash pattern.
value
)

This will set the current line dash pattern.

public void
setLineJoin(int
The current line join
value
)

Get the value of the line join.

public void
setLineWidth(float
The current line width.
value
)

set the value of the line width.

public void
setMiterLimit(float
The current miter limit.
value
)

set the value of the miter limit.

public void
setNonStrokeAlphaConstant(double
The value of the non-stroke alpha constant parameter.
value
)

set the value of the non-stroke alpha constant property.

public void
setNonStrokingColor(PDColor
The new non-stroking color
color
)

Sets the non-stroking color.

public void
setNonStrokingColorSpace(PDColorSpace
The new non-stroking color space.
colorSpace
)

Sets the non-stroking color space.

public void
setNonStrokingOverprint(boolean
The value of the non stroking overprint parameter.
value
)

set the value of the non stroking overprint property.

public void
setOverprint(boolean
The value of the overprint parameter.
value
)

set the value of the overprint property.

public void
setOverprintMode(int
The value of the overprint mode parameter.
value
)

set the value of the overprint mode property.

public void
setRenderingIntent(RenderingIntent
The new rendering intent.
value
)

This will set the rendering intent.

public void
setSmoothness(double
The value of the smoothness parameter.
value
)

set the value of the smoothness property.

public void
setSoftMask(PDSoftMask
soft mask
softMask
)

Sets the current soft mask

public void
setStrokeAdjustment(boolean
The value of the stroke adjustment parameter.
value
)

set the value of the stroke adjustment.

public void
setStrokingColor(PDColor
The new stroking color
color
)

Sets the stroking color.

public void
setStrokingColorSpace(PDColorSpace
The new stroking color space.
colorSpace
)

Sets the stroking color space.

public void
setTextLineMatrix(Matrix
The textLineMatrix to set.
value
)

public void
setTextMatrix(Matrix
The textMatrix to set.
value
)

public void
setTextState(PDTextState
The graphics text state.
value
)

This will set the graphics text state.

public void
setTransfer(COSBase
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.
transfer
)

This will set the transfer function.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

alphaConstantback to summary
private double alphaConstant
alphaSourceback to summary
private boolean alphaSource
blendModeback to summary
private BlendMode blendMode
clippingPathCacheback to summary
private Area clippingPathCache
clippingPathsback to summary
private List<Path2D> clippingPaths
currentTransformationMatrixback to summary
private Matrix currentTransformationMatrix
flatnessback to summary
private double flatness
isClippingPathDirtyback to summary
private boolean isClippingPathDirty
lineCapback to summary
private int lineCap
lineDashPatternback to summary
private PDLineDashPattern lineDashPattern
lineJoinback to summary
private int lineJoin
lineWidthback to summary
private float lineWidth
miterLimitback to summary
private float miterLimit
nonStrokingAlphaConstantback to summary
private double nonStrokingAlphaConstant
nonStrokingColorback to summary
private PDColor nonStrokingColor
nonStrokingColorSpaceback to summary
private PDColorSpace nonStrokingColorSpace
nonStrokingOverprintback to summary
private boolean nonStrokingOverprint
overprintback to summary
private boolean overprint
overprintModeback to summary
private int overprintMode
renderingIntentback to summary
private RenderingIntent renderingIntent
smoothnessback to summary
private double smoothness
softMaskback to summary
private PDSoftMask softMask
strokeAdjustmentback to summary
private boolean strokeAdjustment
strokingColorback to summary
private PDColor strokingColor
strokingColorSpaceback to summary
private PDColorSpace strokingColorSpace
textLineMatrixback to summary
private Matrix textLineMatrix
textMatrixback to summary
private Matrix textMatrix
textStateback to summary
private PDTextState textState
transferback to summary
private COSBase transfer

Constructor Detail

PDGraphicsStateback to summary
public PDGraphicsState(PDRectangle page)

Constructor with a given page size to initialize the clipping path.

Parameters
page:PDRectangle

the size of the page

Method Detail

cloneback to summary
public PDGraphicsState clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:PDGraphicsState

a clone of this instance.

Annotations
@Override
getAlphaConstantback to summary
public double getAlphaConstant()

Get the value of the stroke alpha constant property.

Returns:double

The value of the stroke alpha constant parameter.

getBlendModeback to summary
public BlendMode getBlendMode()

Returns the current blend mode

Returns:BlendMode

the current blend mode

getCurrentClippingPathback to summary
public Area getCurrentClippingPath()

This will get the current clipping path. Do not modify this Area object!

Returns:Area

The current clipping path.

getCurrentClippingPathsback to summary
public List<Path2D> getCurrentClippingPaths()

This will get the current clipping path, as one or more individual paths. Do not modify the list or the paths!

Returns:List<Path2D>

The current clipping paths.

getCurrentTransformationMatrixback to summary
public Matrix getCurrentTransformationMatrix()

Get the value of the CTM.

Returns:Matrix

The current transformation matrix.

getFlatnessback to summary
public double getFlatness()

get the value of the flatness property.

Returns:double

The value of the flatness parameter.

getLineCapback to summary
public int getLineCap()

Get the value of the line cap.

Returns:int

The current line cap.

getLineDashPatternback to summary
public PDLineDashPattern getLineDashPattern()

This will get the current line dash pattern.

Returns:PDLineDashPattern

The line dash pattern.

getLineJoinback to summary
public int getLineJoin()

Get the value of the line join.

Returns:int

The current line join value.

getLineWidthback to summary
public float getLineWidth()

Get the value of the line width.

Returns:float

The current line width.

getMiterLimitback to summary
public float getMiterLimit()

Get the value of the miter limit.

Returns:float

The current miter limit.

getNonStrokeAlphaConstantback to summary
public double getNonStrokeAlphaConstant()

Get the value of the non-stroke alpha constant property.

Returns:double

The value of the non-stroke alpha constant parameter.

getNonStrokingColorback to summary
public PDColor getNonStrokingColor()

Returns the non-stroking color.

Returns:PDColor

The non-stroking color

getNonStrokingColorSpaceback to summary
public PDColorSpace getNonStrokingColorSpace()

Returns the non-stroking color space.

Returns:PDColorSpace

The non-stroking color space.

getNonStrokingJavaCompositeback to summary
public Composite getNonStrokingJavaComposite()
getOverprintModeback to summary
public int getOverprintMode()

get the value of the overprint mode property.

Returns:int

The value of the overprint mode parameter.

getRenderingIntentback to summary
public RenderingIntent getRenderingIntent()

This will get the rendering intent.

Returns:RenderingIntent

The rendering intent

See Also
PDExtendedGraphicsState
getSmoothnessback to summary
public double getSmoothness()

get the value of the smoothness property.

Returns:double

The value of the smoothness parameter.

getSoftMaskback to summary
public PDSoftMask getSoftMask()

returns the current softmask

Returns:PDSoftMask

softMask

getStrokingColorback to summary
public PDColor getStrokingColor()

Returns the stroking color.

Returns:PDColor

stroking color

getStrokingColorSpaceback to summary
public PDColorSpace getStrokingColorSpace()

Returns the stroking color space.

Returns:PDColorSpace

The stroking color space.

getStrokingJavaCompositeback to summary
public Composite getStrokingJavaComposite()
getTextLineMatrixback to summary
public Matrix getTextLineMatrix()
Returns:Matrix

Returns the textLineMatrix.

getTextMatrixback to summary
public Matrix getTextMatrix()
Returns:Matrix

Returns the textMatrix.

getTextStateback to summary
public PDTextState getTextState()

This will get the graphics text state.

Returns:PDTextState

The graphics text state.

getTransferback to summary
public COSBase getTransfer()

This will get the transfer function.

Returns:COSBase

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.

intersectClippingPathback to summary
public void intersectClippingPath(GeneralPath path)

Modify the current clipping path by intersecting it with the given path.

Parameters
path:GeneralPath

path to intersect with the clipping path

intersectClippingPathback to summary
private void intersectClippingPath(Path2D path, boolean clonePath)
intersectClippingPathback to summary
public void intersectClippingPath(Area area)

Modify the current clipping path by intersecting it with the given path.

Parameters
area:Area

area to intersect with the clipping path

isAlphaSourceback to summary
public boolean isAlphaSource()

get the value of the stroke alpha source property.

Returns:boolean

The value of the stroke alpha source parameter.

isNonStrokingOverprintback to summary
public boolean isNonStrokingOverprint()

get the value of the non stroking overprint property.

Returns:boolean

The value of the non stroking overprint parameter.

isOverprintback to summary
public boolean isOverprint()

get the value of the overprint property.

Returns:boolean

The value of the overprint parameter.

isStrokeAdjustmentback to summary
public boolean isStrokeAdjustment()

Get the value of the stroke adjustment parameter.

Returns:boolean

The current stroke adjustment.

setAlphaConstantback to summary
public void setAlphaConstant(double value)

set the value of the stroke alpha constant property.

Parameters
value:double

The value of the stroke alpha constant parameter.

setAlphaSourceback to summary
public void setAlphaSource(boolean value)

set the value of the alpha source property.

Parameters
value:boolean

The value of the alpha source parameter.

setBlendModeback to summary
public void setBlendMode(BlendMode blendMode)

Sets the blend mode in the current graphics state

Parameters
blendMode:BlendMode

blend mode

Exceptions
IllegalArgumentException:
if blendMode is null.
setCurrentTransformationMatrixback to summary
public void setCurrentTransformationMatrix(Matrix value)

Set the value of the CTM.

Parameters
value:Matrix

The current transformation matrix.

setFlatnessback to summary
public void setFlatness(double value)

set the value of the flatness property.

Parameters
value:double

The value of the flatness parameter.

setLineCapback to summary
public void setLineCap(int value)

set the value of the line cap.

Parameters
value:int

The current line cap.

setLineDashPatternback to summary
public void setLineDashPattern(PDLineDashPattern value)

This will set the current line dash pattern.

Parameters
value:PDLineDashPattern

The new line dash pattern.

setLineJoinback to summary
public void setLineJoin(int value)

Get the value of the line join.

Parameters
value:int

The current line join

setLineWidthback to summary
public void setLineWidth(float value)

set the value of the line width.

Parameters
value:float

The current line width.

setMiterLimitback to summary
public void setMiterLimit(float value)

set the value of the miter limit.

Parameters
value:float

The current miter limit.

setNonStrokeAlphaConstantback to summary
public void setNonStrokeAlphaConstant(double value)

set the value of the non-stroke alpha constant property.

Parameters
value:double

The value of the non-stroke alpha constant parameter.

setNonStrokingColorback to summary
public void setNonStrokingColor(PDColor color)

Sets the non-stroking color.

Parameters
color:PDColor

The new non-stroking color

setNonStrokingColorSpaceback to summary
public void setNonStrokingColorSpace(PDColorSpace colorSpace)

Sets the non-stroking color space.

Parameters
colorSpace:PDColorSpace

The new non-stroking color space.

setNonStrokingOverprintback to summary
public void setNonStrokingOverprint(boolean value)

set the value of the non stroking overprint property.

Parameters
value:boolean

The value of the non stroking overprint parameter.

setOverprintback to summary
public void setOverprint(boolean value)

set the value of the overprint property.

Parameters
value:boolean

The value of the overprint parameter.

setOverprintModeback to summary
public void setOverprintMode(int value)

set the value of the overprint mode property.

Parameters
value:int

The value of the overprint mode parameter.

setRenderingIntentback to summary
public void setRenderingIntent(RenderingIntent value)

This will set the rendering intent.

Parameters
value:RenderingIntent

The new rendering intent.

setSmoothnessback to summary
public void setSmoothness(double value)

set the value of the smoothness property.

Parameters
value:double

The value of the smoothness parameter.

setSoftMaskback to summary
public void setSoftMask(PDSoftMask softMask)

Sets the current soft mask

Parameters
softMask:PDSoftMask

soft mask

setStrokeAdjustmentback to summary
public void setStrokeAdjustment(boolean value)

set the value of the stroke adjustment.

Parameters
value:boolean

The value of the stroke adjustment parameter.

setStrokingColorback to summary
public void setStrokingColor(PDColor color)

Sets the stroking color.

Parameters
color:PDColor

The new stroking color

setStrokingColorSpaceback to summary
public void setStrokingColorSpace(PDColorSpace colorSpace)

Sets the stroking color space.

Parameters
colorSpace:PDColorSpace

The new stroking color space.

setTextLineMatrixback to summary
public void setTextLineMatrix(Matrix value)
Parameters
value:Matrix

The textLineMatrix to set.

setTextMatrixback to summary
public void setTextMatrix(Matrix value)
Parameters
value:Matrix

The textMatrix to set.

setTextStateback to summary
public void setTextState(PDTextState value)

This will set the graphics text state.

Parameters
value:PDTextState

The graphics text state.

setTransferback to summary
public void setTransfer(COSBase transfer)

This will set the transfer function.

Parameters
transfer:COSBase

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.