Class CanvasGraphicsState

java.lang.Object
com.itextpdf.kernel.pdf.canvas.CanvasGraphicsState
Direct Known Subclasses:
ParserGraphicsState

public class CanvasGraphicsState extends Object
This class is designed for internal usage.
Use PdfExtGState class and PdfCanvas#setExtGState() method for setting extended graphics properties.
  • Constructor Details

    • CanvasGraphicsState

      protected CanvasGraphicsState()
      Internal empty and default constructor.
    • CanvasGraphicsState

      public CanvasGraphicsState (CanvasGraphicsState source)
      Copy constructor.
      Parameters:
      source - the Graphics State to copy from
  • Method Details

    • updateFromExtGState

      public void updateFromExtGState (PdfDictionary extGState)
      Updates this object with the values from a dictionary.
      Parameters:
      extGState - the dictionary containing source parameters
    • getCtm

      public Matrix 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

      public void updateCtm (Matrix newCtm)
      Updates current transformation matrix.
      Parameters:
      newCtm - new current transformation matrix.
    • getFillColor

      public Color getFillColor()
      Gets the current fill color.
      Returns:
      The canvas graphics state fill color
    • setFillColor

      public void setFillColor (Color fillColor)
      Sets the current fill color.
      Parameters:
      fillColor - The new fill color.
    • getStrokeColor

      public Color getStrokeColor()
      Gets the current stroke color.
      Returns:
      The canvas graphics state stroke color
    • setStrokeColor

      public void setStrokeColor (Color strokeColor)
      Sets the current stroke color.
      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

      public PdfArray 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

      public 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).
      Parameters:
      dashPattern - a PdfArray, that represents line dash pattern.
    • getRenderingIntent

      public PdfName getRenderingIntent()
      Gets the rendering intent, see PdfExtGState.getRenderingIntent().
      Returns:
      the rendering intent name.
    • setRenderingIntent

      public void setRenderingIntent (PdfName renderingIntent)
      Sets the rendering intent, see PdfExtGState.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

      public PdfFont getFont()
      Gets the current PdfFont.
      Returns:
      The current PdfFont.
    • setFont

      public void setFont (PdfFont font)
      Sets the current PdfFont.
      Parameters:
      font - The new PdfFont.
    • 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 Rise PdfCanvas.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

      public PdfObject 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

      public PdfObject 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

      public PdfObject 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 Dictionary PdfExtGState.getUndercolorRemovalFunction().
      Returns:
      the current black-generation function.
    • getUnderColorRemovalFunction2

      public PdfObject 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

      public PdfObject 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

      public PdfObject 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

      public PdfObject 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

      public Float 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

      public PdfObject 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

      public PdfObject 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

      public PdfObject 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

      public void updateFromExtGState (PdfExtGState extGState)
      Updates current graphic state with values from extended graphic state dictionary.
      Parameters:
      extGState - the wrapper around the extended graphic state dictionary