Package com.itextpdf.kernel.pdf.canvas
Class CanvasGraphicsState
java.lang.Object
com.itextpdf.kernel.pdf.canvas.CanvasGraphicsState
- Direct Known Subclasses:
-
ParserGraphicsState
This class is designed for internal usage.
Use
Use
PdfExtGState
class and PdfCanvas#setExtGState()
method for setting extended graphics properties.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Internal empty and default constructor.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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()
.boolean
Gets 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()
.float
Gets the current Character Spacing, see ISO-320001, 9.3.2 Character Spacing,PdfCanvas.setCharacterSpacing(float)
.getCtm()
Gets line dash pattern value,D
key, see ISO-320001, 8.4.3.6 Line Dash Pattern,PdfExtGState.setDashPattern(com.itextpdf.kernel.pdf.PdfArray)
.Gets the current fill color.float
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()
.boolean
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()
.float
Gets the current Flatness Tolerance, see ISO-320001, 10.6.2 Flatness Tolerance,PdfCanvas.setFlatnessTolerance(float)
.getFont()
Gets the currentPdfFont
.float
Gets 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()
.float
Gets 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.float
Gets the current Leading, see ISO-320001, 9.3.5 Leading,PdfCanvas.setLeading(float)
.int
Gets the current line cap style, see ISO-320001, 8.4.3.3 Line Cap Style.int
Gets the current line join style, see ISO-320001, 8.4.3.4 Line Join Style.float
Gets the current line width.float
Gets the current miter limit, see ISO-320001, 8.4.3.5 Miter Limit.int
Get 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.float
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()
.boolean
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()
.boolean
Gets the current Text Knockout flag, see ISO 32000-1, 9.3.8 Text Knockout,PdfExtGState.getTextKnockoutFlag()
.int
Gets the current Text Rendering Mode, see ISO-320001, 9.3.6 Text Rendering Mode,PdfCanvas.setTextRenderingMode(int)
.float
Get 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()
.float
Gets the current Word Spacing, see ISO-320001, 9.3.3 Word Spacing,PdfCanvas.setWordSpacing(float)
void
setCharSpacing
(float characterSpacing) Sets the Character Spacing, see ISO-320001, 9.3.2 Character Spacing,PdfCanvas.setCharacterSpacing(float)
void
setDashPattern
(PdfArray dashPattern) Sets line dash pattern value,D
key, see ISO-320001, 8.4.3.6 Line Dash Pattern,PdfExtGState.setDashPattern(com.itextpdf.kernel.pdf.PdfArray)
.void
setFillColor
(Color fillColor) Sets the current fillcolor
.void
setFlatnessTolerance
(float flatnessTolerance) Sets the current Flatness Tolerance, see ISO-320001, 10.6.2 Flatness Tolerance,PdfCanvas.setFlatnessTolerance(float)
.void
Sets the currentPdfFont
.void
setFontSize
(float fontSize) Sets the font size.void
setHorizontalScaling
(float scale) Sets the Horizontal Scaling percentage for text, see ISO-320001, 9.3.4 Horizontal Scaling,PdfCanvas.setHorizontalScaling(float)
.void
setLeading
(float leading) Sets the Leading, see ISO-320001, 9.3.5 Leading,PdfCanvas.setLeading(float)
.void
setLineCapStyle
(int lineCapStyle) Sets the current line cap style, see ISO-320001, 8.4.3.3 Line Cap Style.void
setLineJoinStyle
(int lineJoinStyle) Sets the current line join style, see ISO-320001, 8.4.3.4 Line Join Style.void
setLineWidth
(float lineWidth) Sets the current line width.void
setMiterLimit
(float miterLimit) Sets the current miter limit, see ISO-320001, 8.4.3.5 Miter Limit.void
setRenderingIntent
(PdfName renderingIntent) Sets the rendering intent, seePdfExtGState.getRenderingIntent()
.void
setStrokeColor
(Color strokeColor) Sets the current strokecolor
.void
setTextRenderingMode
(int textRenderingMode) Sets the current Text Rendering Mode, see ISO-320001, 9.3.6 Text Rendering Mode,PdfCanvas.setTextRenderingMode(int)
.void
setTextRise
(float textRise) Set the current Text Rise, see ISO-320001, 9.3.7 Text RisePdfCanvas.setTextRise(float)
.void
setWordSpacing
(float wordSpacing) Sets the Word Spacing, see ISO-320001, 9.3.3 Word Spacing,PdfCanvas.setWordSpacing(float)
.void
updateCtm
(float a, float b, float c, float d, float e, float f) Updates current transformation matrix.void
Updates current transformation matrix.void
updateFromExtGState
(PdfExtGState extGState) Updates current graphic state with values from extended graphic state dictionary.void
updateFromExtGState
(PdfDictionary extGState) Updates this object with the values from a dictionary.
-
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 matrix -
b
- element at (1,2) of the transformation matrix -
c
- element at (2,1) of the transformation matrix -
d
- element at (2,2) of the transformation matrix -
e
- element at (3,1) of the transformation matrix -
f
- element at (3,2) of the transformation matrix
-
updateCtm
Updates current transformation matrix.- Parameters:
-
newCtm
- new current transformation matrix.
-
getFillColor
Gets the current fill color.- Returns:
-
The canvas graphics state fill
color
-
setFillColor
Sets the current fillcolor
.- Parameters:
-
fillColor
- The new fill color.
-
getStrokeColor
Gets the current stroke color.- Returns:
-
The canvas graphics state stroke
color
-
setStrokeColor
Sets the current strokecolor
.- Parameters:
-
strokeColor
- The new stroke color.
-
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,D
key, see ISO-320001, 8.4.3.6 Line Dash Pattern,PdfExtGState.setDashPattern(com.itextpdf.kernel.pdf.PdfArray)
.- Returns:
-
a
PdfArray
, that represents line dash pattern.
-
setDashPattern
Sets line dash pattern value,D
key, see ISO-320001, 8.4.3.6 Line Dash Pattern,PdfExtGState.setDashPattern(com.itextpdf.kernel.pdf.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
Gets the currentPdfFont
.- Returns:
-
The current
PdfFont
.
-
setFont
Sets the currentPdfFont
.- Parameters:
-
font
- The newPdfFont
.
-
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
-