Class CanvasGraphicsState
java.lang.Object
com.itextpdf.kernel.pdf.canvas.CanvasGraphicsState
- Direct Known Subclasses:
ParserGraphicsState, PdfA2Checker.UpdateCanvasGraphicsState
This class is designed for internal usage.
Use
Use
PdfExtGState class and PdfCanvas#setExtGState() method for setting extended graphics properties.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanprivate PdfObjectprivate PdfObjectprivate PdfObjectprivate floatprivate MatrixThe current transformation matrix, which maps positions from user coordinates to device coordinates.private PdfArrayA description of the dash pattern to be used when paths are stroked.private floatprivate Colorprivate booleanprivate floatprivate PdfFontprivate floatprivate PdfObjectprivate PdfObjectprivate floatprivate intprivate intprivate floatprivate floatprivate intprivate PdfNameprivate floatprivate Floatprivate PdfObjectprivate floatprivate Colorprivate booleanprivate booleanprivate intprivate floatprivate PdfObjectprivate PdfObjectprivate PdfObjectprivate PdfObjectprivate float -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInternal empty and default constructor.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcopyFrom(CanvasGraphicsState source) booleanGets the current Alpha is shape flag, see ISO 32000-1, 11.3.7.2 Source Shape and Opacity and 11.6.4.3 Mask Shape and Opacity,PdfExtGState.getAlphaSourceFlag().booleanGets the current Apply Automatic Stroke Adjustment flag, see ISO 32000-1, 10.6.5 Automatic Stroke Adjustment,PdfExtGState.getAutomaticStrokeAdjustmentFlag().Gets the current Black-generation function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getBlackGenerationFunction().Gets the current overruling Black-generation function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getBlackGenerationFunction2().Gets the current Blend Mode, see ISO 32000-1, 11.3.5 Blend Mode and 11.6.3 Specifying Blending Colour Space and Blend Mode,PdfExtGState.getBlendMode().floatGets the current Character Spacing, see ISO-320001, 9.3.2 Character Spacing,PdfCanvas.setCharacterSpacing(float).getCtm()Gets line dash pattern value,Dkey, see ISO-320001, 8.4.3.6 Line Dash Pattern,PdfExtGState.setDashPattern(PdfArray).Gets the current fill color.floatGets the current Fill Opacity value, see ISO 32000-1, 11.3.7.2 Source Shape and Opacity and 11.6.4.4 Constant Shape and Opacity,PdfExtGState.getFillOpacity().booleanGet the Fill Overprint flag, see ISO 32000-1, 8.6.7 Overprint Control and 11.7.4.5 Summary of Overprinting Behaviour,PdfExtGState.getFillOverprintFlag().floatGets the current Flatness Tolerance, see ISO-320001, 10.6.2 Flatness Tolerance,PdfCanvas.setFlatnessTolerance(float).getFont()Gets the currentPdfFont.floatGets the font size.Gets the current halftone , see ISO32000-1, 10.5 Halftones and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getHalftone().floatGets the current Horizontal Scaling percentage, see ISO-320001, 9.3.4 Horizontal Scaling.getHTP()Gets the current Halftone Phase, see Portable Document Format Reference Manual Version 1.2, 7.12 Extended graphics states and PostScript Language Reference Manual, Second Edition, 7.3.3, Halftone Phase.floatGets the current Leading, see ISO-320001, 9.3.5 Leading,PdfCanvas.setLeading(float).intGets the current line cap style, see ISO-320001, 8.4.3.3 Line Cap Style.intGets the current line join style, see ISO-320001, 8.4.3.4 Line Join Style.floatGets the current line width.floatGets the current miter limit, see ISO-320001, 8.4.3.5 Miter Limit.intGet the Overprint Mode, see ISO 32000-1, 8.6.7 Overprint Control and 11.7.4.5 Summary of Overprinting Behaviour,PdfExtGState.getOverprintMode().Gets the rendering intent, seePdfExtGState.getRenderingIntent().Gets the current Smoothness Tolerance, see ISO32000-1, 10.6.3 Smoothness Tolerance and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getSmothnessTolerance().Gets the current Soft Mask, see ISO 32000-1, 11.3.7.2 Source Shape and Opacity, 11.6.4.3 Mask Shape and Opacity and 11.6.5.2 Soft-Mask Dictionaries,PdfExtGState.getSoftMask().Gets the current stroke color.floatGets the current Stroke Opacity value, see ISO 32000-1, 11.3.7.2 Source Shape and Opacity and 11.6.4.4 Constant Shape and Opacity,PdfExtGState.getStrokeOpacity().booleanGet the Stroke Overprint flag, see ISO 32000-1, 8.6.7 Overprint Control and 11.7.4.5 Summary of Overprinting Behaviour,PdfExtGState.getStrokeOverprintFlag().booleanGets the current Text Knockout flag, see ISO 32000-1, 9.3.8 Text Knockout,PdfExtGState.getTextKnockoutFlag().intGets the current Text Rendering Mode, see ISO-320001, 9.3.6 Text Rendering Mode,PdfCanvas.setTextRenderingMode(int).floatGet the current Text Rise, see ISO-320001, 9.3.7 Text Rise,PdfCanvas.setTextRise(float).Gets the current Transfer function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getTransferFunction().Gets the current overruling transer function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getTransferFunction2().Gets the current Undercolor-removal function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter DictionaryPdfExtGState.getUndercolorRemovalFunction().Gets the current overruling Undercolor-removal function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getUndercolorRemovalFunction2().floatGets the current Word Spacing, see ISO-320001, 9.3.3 Word Spacing,PdfCanvas.setWordSpacing(float)voidsetCharSpacing(float characterSpacing) Sets the Character Spacing, see ISO-320001, 9.3.2 Character Spacing,PdfCanvas.setCharacterSpacing(float)voidsetDashPattern(PdfArray dashPattern) Sets line dash pattern value,Dkey, see ISO-320001, 8.4.3.6 Line Dash Pattern,PdfExtGState.setDashPattern(PdfArray).voidsetFillColor(Color fillColor) Sets the current fillcolor.voidsetFlatnessTolerance(float flatnessTolerance) Sets the current Flatness Tolerance, see ISO-320001, 10.6.2 Flatness Tolerance,PdfCanvas.setFlatnessTolerance(float).voidSets the currentPdfFont.voidsetFontSize(float fontSize) Sets the font size.voidsetHorizontalScaling(float scale) Sets the Horizontal Scaling percentage for text, see ISO-320001, 9.3.4 Horizontal Scaling,PdfCanvas.setHorizontalScaling(float).voidsetLeading(float leading) Sets the Leading, see ISO-320001, 9.3.5 Leading,PdfCanvas.setLeading(float).voidsetLineCapStyle(int lineCapStyle) Sets the current line cap style, see ISO-320001, 8.4.3.3 Line Cap Style.voidsetLineJoinStyle(int lineJoinStyle) Sets the current line join style, see ISO-320001, 8.4.3.4 Line Join Style.voidsetLineWidth(float lineWidth) Sets the current line width.voidsetMiterLimit(float miterLimit) Sets the current miter limit, see ISO-320001, 8.4.3.5 Miter Limit.voidsetRenderingIntent(PdfName renderingIntent) Sets the rendering intent, seePdfExtGState.getRenderingIntent().voidsetStrokeColor(Color strokeColor) Sets the current strokecolor.voidsetTextRenderingMode(int textRenderingMode) Sets the current Text Rendering Mode, see ISO-320001, 9.3.6 Text Rendering Mode,PdfCanvas.setTextRenderingMode(int).voidsetTextRise(float textRise) Set the current Text Rise, see ISO-320001, 9.3.7 Text RisePdfCanvas.setTextRise(float).voidsetWordSpacing(float wordSpacing) Sets the Word Spacing, see ISO-320001, 9.3.3 Word Spacing,PdfCanvas.setWordSpacing(float).voidupdateCtm(float a, float b, float c, float d, float e, float f) Updates current transformation matrix.voidUpdates current transformation matrix.voidupdateFromExtGState(PdfExtGState extGState) Updates current graphic state with values from extended graphic state dictionary.(package private) voidupdateFromExtGState(PdfExtGState extGState, PdfDocument pdfDocument) Updates current graphic state with values from extended graphic state dictionary.voidupdateFromExtGState(PdfDictionary extGState) Updates this object with the values from a dictionary.
-
Field Details
-
ctm
The current transformation matrix, which maps positions from user coordinates to device coordinates.We use an identity matrix as a default value, but in spec a default value is: "a matrix that transforms default user coordinates to device coordinates".
-
strokeColor
-
fillColor
-
charSpacing
private float charSpacing -
wordSpacing
private float wordSpacing -
scale
private float scale -
leading
private float leading -
font
-
fontSize
private float fontSize -
textRenderingMode
private int textRenderingMode -
textRise
private float textRise -
textKnockout
private boolean textKnockout -
lineWidth
private float lineWidth -
lineCapStyle
private int lineCapStyle -
lineJoinStyle
private int lineJoinStyle -
miterLimit
private float miterLimit -
dashPattern
A description of the dash pattern to be used when paths are stroked. Default value is solid line.The line dash pattern is expressed as an array of the form [ dashArray dashPhase ], where dashArray is itself an array and dashPhase is an integer.
An empty dash array (first element in the array) and zero phase (second element in the array) can be used to restore the dash pattern to a solid line.
-
renderingIntent
-
automaticStrokeAdjustment
private boolean automaticStrokeAdjustment -
blendMode
-
softMask
-
strokeAlpha
private float strokeAlpha -
fillAlpha
private float fillAlpha -
alphaIsShape
private boolean alphaIsShape -
strokeOverprint
private boolean strokeOverprint -
fillOverprint
private boolean fillOverprint -
overprintMode
private int overprintMode -
blackGenerationFunction
-
blackGenerationFunction2
-
underColorRemovalFunction
-
underColorRemovalFunction2
-
transferFunction
-
transferFunction2
-
halftone
-
flatnessTolerance
private float flatnessTolerance -
smoothnessTolerance
-
htp
-
-
Constructor Details
-
CanvasGraphicsState
protected CanvasGraphicsState()Internal empty and default constructor. -
CanvasGraphicsState
Copy constructor.- Parameters:
source- the Graphics State to copy from
-
-
Method Details
-
updateFromExtGState
Updates this object with the values from a dictionary.- Parameters:
extGState- the dictionary containing source parameters
-
getCtm
- Returns:
- current transformation matrix.
-
updateCtm
public void updateCtm(float a, float b, float c, float d, float e, float f) Updates current transformation matrix. The third column will always be [0 0 1]- Parameters:
a- element at (1,1) of the transformation matrixb- element at (1,2) of the transformation matrixc- element at (2,1) of the transformation matrixd- element at (2,2) of the transformation matrixe- element at (3,1) of the transformation matrixf- element at (3,2) of the transformation matrix
-
updateCtm
Updates current transformation matrix.- Parameters:
newCtm- new current transformation matrix.
-
getFillColor
-
setFillColor
-
getStrokeColor
-
setStrokeColor
-
getLineWidth
public float getLineWidth()Gets the current line width.- Returns:
- The canvas graphics state line width.
-
setLineWidth
public void setLineWidth(float lineWidth) Sets the current line width.- Parameters:
lineWidth- The new line width.
-
getLineCapStyle
public int getLineCapStyle()Gets the current line cap style, see ISO-320001, 8.4.3.3 Line Cap Style.- Returns:
- The current cap style.
- See Also:
-
setLineCapStyle
public void setLineCapStyle(int lineCapStyle) Sets the current line cap style, see ISO-320001, 8.4.3.3 Line Cap Style.- Parameters:
lineCapStyle- The new cap style value.- See Also:
-
getLineJoinStyle
public int getLineJoinStyle()Gets the current line join style, see ISO-320001, 8.4.3.4 Line Join Style.- Returns:
- The current line join style.
- See Also:
-
setLineJoinStyle
public void setLineJoinStyle(int lineJoinStyle) Sets the current line join style, see ISO-320001, 8.4.3.4 Line Join Style.- Parameters:
lineJoinStyle- The new line join style value.- See Also:
-
getMiterLimit
public float getMiterLimit()Gets the current miter limit, see ISO-320001, 8.4.3.5 Miter Limit.- Returns:
- The current miter limit.
- See Also:
-
setMiterLimit
public void setMiterLimit(float miterLimit) Sets the current miter limit, see ISO-320001, 8.4.3.5 Miter Limit.- Parameters:
miterLimit- The new miter limit value.- See Also:
-
getDashPattern
Gets line dash pattern value,Dkey, see ISO-320001, 8.4.3.6 Line Dash Pattern,PdfExtGState.setDashPattern(PdfArray).- Returns:
- a
PdfArray, that represents line dash pattern.
-
setDashPattern
Sets line dash pattern value,Dkey, see ISO-320001, 8.4.3.6 Line Dash Pattern,PdfExtGState.setDashPattern(PdfArray).- Parameters:
dashPattern- aPdfArray, that represents line dash pattern.
-
getRenderingIntent
Gets the rendering intent, seePdfExtGState.getRenderingIntent().- Returns:
- the rendering intent name.
-
setRenderingIntent
Sets the rendering intent, seePdfExtGState.getRenderingIntent().- Parameters:
renderingIntent- the rendering intent name.
-
getFontSize
public float getFontSize()Gets the font size.- Returns:
- The current font size.
-
setFontSize
public void setFontSize(float fontSize) Sets the font size.- Parameters:
fontSize- The new font size.
-
getFont
-
setFont
-
getTextRenderingMode
public int getTextRenderingMode()Gets the current Text Rendering Mode, see ISO-320001, 9.3.6 Text Rendering Mode,PdfCanvas.setTextRenderingMode(int).- Returns:
- The current text rendering mode.
-
setTextRenderingMode
public void setTextRenderingMode(int textRenderingMode) Sets the current Text Rendering Mode, see ISO-320001, 9.3.6 Text Rendering Mode,PdfCanvas.setTextRenderingMode(int).- Parameters:
textRenderingMode- The new text rendering mode.
-
getTextRise
public float getTextRise()Get the current Text Rise, see ISO-320001, 9.3.7 Text Rise,PdfCanvas.setTextRise(float).- Returns:
- The current text rise.
-
setTextRise
public void setTextRise(float textRise) Set the current Text Rise, see ISO-320001, 9.3.7 Text RisePdfCanvas.setTextRise(float).- Parameters:
textRise- The new text rise value.
-
getFlatnessTolerance
public float getFlatnessTolerance()Gets the current Flatness Tolerance, see ISO-320001, 10.6.2 Flatness Tolerance,PdfCanvas.setFlatnessTolerance(float).- Returns:
- The current flatness tolerance.
-
setFlatnessTolerance
public void setFlatnessTolerance(float flatnessTolerance) Sets the current Flatness Tolerance, see ISO-320001, 10.6.2 Flatness Tolerance,PdfCanvas.setFlatnessTolerance(float).- Parameters:
flatnessTolerance- The new flatness tolerance value.
-
setWordSpacing
public void setWordSpacing(float wordSpacing) Sets the Word Spacing, see ISO-320001, 9.3.3 Word Spacing,PdfCanvas.setWordSpacing(float).- Parameters:
wordSpacing- The new word spacing value.
-
getWordSpacing
public float getWordSpacing()Gets the current Word Spacing, see ISO-320001, 9.3.3 Word Spacing,PdfCanvas.setWordSpacing(float)- Returns:
- The current word spacing
-
setCharSpacing
public void setCharSpacing(float characterSpacing) Sets the Character Spacing, see ISO-320001, 9.3.2 Character Spacing,PdfCanvas.setCharacterSpacing(float)- Parameters:
characterSpacing- The new character spacing value.
-
getCharSpacing
public float getCharSpacing()Gets the current Character Spacing, see ISO-320001, 9.3.2 Character Spacing,PdfCanvas.setCharacterSpacing(float).- Returns:
- The current character spacing value.
-
getLeading
public float getLeading()Gets the current Leading, see ISO-320001, 9.3.5 Leading,PdfCanvas.setLeading(float).- Returns:
- The current leading value.
-
setLeading
public void setLeading(float leading) Sets the Leading, see ISO-320001, 9.3.5 Leading,PdfCanvas.setLeading(float).- Parameters:
leading- The new leading value.
-
getHorizontalScaling
public float getHorizontalScaling()Gets the current Horizontal Scaling percentage, see ISO-320001, 9.3.4 Horizontal Scaling.PdfCanvas.setHorizontalScaling(float).- Returns:
- The current horizontal scaling factor.
-
setHorizontalScaling
public void setHorizontalScaling(float scale) Sets the Horizontal Scaling percentage for text, see ISO-320001, 9.3.4 Horizontal Scaling,PdfCanvas.setHorizontalScaling(float).- Parameters:
scale- The new horizontal scaling factor.
-
getStrokeOverprint
public boolean getStrokeOverprint()Get the Stroke Overprint flag, see ISO 32000-1, 8.6.7 Overprint Control and 11.7.4.5 Summary of Overprinting Behaviour,PdfExtGState.getStrokeOverprintFlag().- Returns:
- The current stroke overprint flag.
-
getFillOverprint
public boolean getFillOverprint()Get the Fill Overprint flag, see ISO 32000-1, 8.6.7 Overprint Control and 11.7.4.5 Summary of Overprinting Behaviour,PdfExtGState.getFillOverprintFlag().- Returns:
- The current stroke overprint flag.
-
getOverprintMode
public int getOverprintMode()Get the Overprint Mode, see ISO 32000-1, 8.6.7 Overprint Control and 11.7.4.5 Summary of Overprinting Behaviour,PdfExtGState.getOverprintMode().- Returns:
- The current overprint mode.
-
getBlackGenerationFunction
Gets the current Black-generation function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getBlackGenerationFunction().- Returns:
- the current black-generation function.
-
getBlackGenerationFunction2
Gets the current overruling Black-generation function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getBlackGenerationFunction2().- Returns:
- the current overruling black-generation function.
-
getUnderColorRemovalFunction
Gets the current Undercolor-removal function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter DictionaryPdfExtGState.getUndercolorRemovalFunction().- Returns:
- the current black-generation function.
-
getUnderColorRemovalFunction2
Gets the current overruling Undercolor-removal function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getUndercolorRemovalFunction2().- Returns:
- the current undercolor-removal function.
-
getTransferFunction
Gets the current Transfer function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getTransferFunction().- Returns:
- the current transfer function.
-
getTransferFunction2
Gets the current overruling transer function, see ISO32000-1, 11.7.5.3 Rendering Intent and Colour Conversions and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getTransferFunction2().- Returns:
- the current overruling transer function.
-
getHalftone
Gets the current halftone , see ISO32000-1, 10.5 Halftones and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getHalftone().- Returns:
- the current halftone.
-
getSmoothnessTolerance
Gets the current Smoothness Tolerance, see ISO32000-1, 10.6.3 Smoothness Tolerance and Table 58 – Entries in a Graphics State Parameter Dictionary,PdfExtGState.getSmothnessTolerance().- Returns:
- the current smoothness tolerance function.
-
getAutomaticStrokeAdjustment
public boolean getAutomaticStrokeAdjustment()Gets the current Apply Automatic Stroke Adjustment flag, see ISO 32000-1, 10.6.5 Automatic Stroke Adjustment,PdfExtGState.getAutomaticStrokeAdjustmentFlag().- Returns:
- The current automatic stroke adjustment flag.
-
getBlendMode
Gets the current Blend Mode, see ISO 32000-1, 11.3.5 Blend Mode and 11.6.3 Specifying Blending Colour Space and Blend Mode,PdfExtGState.getBlendMode().- Returns:
- The current blend mode.
-
getSoftMask
Gets the current Soft Mask, see ISO 32000-1, 11.3.7.2 Source Shape and Opacity, 11.6.4.3 Mask Shape and Opacity and 11.6.5.2 Soft-Mask Dictionaries,PdfExtGState.getSoftMask().- Returns:
- The current soft mask.
-
getStrokeOpacity
public float getStrokeOpacity()Gets the current Stroke Opacity value, see ISO 32000-1, 11.3.7.2 Source Shape and Opacity and 11.6.4.4 Constant Shape and Opacity,PdfExtGState.getStrokeOpacity().- Returns:
- the current stroke opacity value.
-
getFillOpacity
public float getFillOpacity()Gets the current Fill Opacity value, see ISO 32000-1, 11.3.7.2 Source Shape and Opacity and 11.6.4.4 Constant Shape and Opacity,PdfExtGState.getFillOpacity().- Returns:
- the current fill opacity value.
-
getAlphaIsShape
public boolean getAlphaIsShape()Gets the current Alpha is shape flag, see ISO 32000-1, 11.3.7.2 Source Shape and Opacity and 11.6.4.3 Mask Shape and Opacity,PdfExtGState.getAlphaSourceFlag().- Returns:
- The current alpha is shape flag.
-
getTextKnockout
public boolean getTextKnockout()Gets the current Text Knockout flag, see ISO 32000-1, 9.3.8 Text Knockout,PdfExtGState.getTextKnockoutFlag().- Returns:
- The current text knockout flag.
-
getHTP
Gets the current Halftone Phase, see Portable Document Format Reference Manual Version 1.2, 7.12 Extended graphics states and PostScript Language Reference Manual, Second Edition, 7.3.3, Halftone Phase.- Returns:
- the current halftone phase.
-
updateFromExtGState
Updates current graphic state with values from extended graphic state dictionary.- Parameters:
extGState- the wrapper around the extended graphic state dictionary
-
updateFromExtGState
Updates current graphic state with values from extended graphic state dictionary.- Parameters:
extGState- the wrapper around the extended graphic state dictionarypdfDocument- the document to retrieve fonts from. Needed when the newly created fonts are used
-
copyFrom
-