org.apache.fop.pdf

## Class PDFPaintingState

- java.lang.Object
- - org.apache.fop.util.AbstractPaintingState
  - - org.apache.fop.pdf.PDFPaintingState

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

      public class PDFPaintingState
      extends AbstractPaintingState

  This keeps information about the current painting state when writing to pdf. It allows for creating new graphics states with the q operator. This class is only used to store the information about the state the caller needs to handle the actual pdf operators. When setting the state for pdf there are three possible ways of handling the situation. The values can be set to override previous or default values. A new state can be added and then the values set. The current state can be popped and values will return to a previous state then the necessary values can be overridden. The current transform behaves differently to other values as the matrix is combined with the current resolved value.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.fop.util.AbstractPaintingState

      `AbstractPaintingState.AbstractData, AbstractPaintingState.StateStack<E>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFPaintingState()` PDF State for storing graphics state.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `checkClip(java.awt.Shape cl)` Check if the clip will change the current state.
    `float` | `getCharacterSpacing()` Returns the current character spacing (Tc) value.
    `PDFGState` | `getGState()` Get the graphics state.
    `java.lang.String` | `getLayer()`
    `boolean` | `getLayerChanged()`
    `int` | `getStackLevel()` Get the current stack level.
    `protected AbstractPaintingState` | `instantiate()` Instantiates a new state object
    `protected AbstractPaintingState.AbstractData` | `instantiateData()` Instantiates a new state data object
    `void` | `save()` Push the current state onto the stack.
    `boolean` | `setCharacterSpacing(float value)` Sets the character spacing (Tc).
    `void` | `setClip(java.awt.Shape cl)` Set the current clip.
    `void` | `setLayer(java.lang.String layer)`
    `boolean` | `setPaint(java.awt.Paint p)` Set the current paint.

    - ### Methods inherited from class org.apache.fop.util.AbstractPaintingState

      `checkTransform, clear, clearTransform, clone, concatenate, getBackColor, getBaseTransform, getColor, getData, getFontName, getFontSize, getLineWidth, getStateStack, getTransform, resetTransform, restore, restoreAll, saveAll, setBackColor, setColor, setDashArray, setData, setFontName, setFontSize, setLineWidth, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PDFPaintingState

          public PDFPaintingState()

      PDF State for storing graphics state.

  - ### Method Detail

    - #### setPaint

          public boolean setPaint(java.awt.Paint p)

      Set the current paint. This checks if the paint will change and then sets the current paint.
      Parameters:
        `p` - the new paint
      Returns:
        true if the new paint changes the current paint

    - #### checkClip

          public boolean checkClip(java.awt.Shape cl)

      Check if the clip will change the current state. A clip is assumed to be used in a situation where it will add to any clip in the current or parent states. A clip cannot be cleared, this can only be achieved by going to a parent level with the correct clip. If the clip is different then it may start a new state so that it can return to the previous clip.
      Parameters:
        `cl` - the clip shape to check
      Returns:
        true if the clip will change the current clip.

    - #### setClip

          public void setClip(java.awt.Shape cl)

      Set the current clip. This either sets a new clip or sets the clip to the intersect of the old clip and the new clip.
      Parameters:
        `cl` - the new clip in the current state

    - #### setCharacterSpacing

          public boolean setCharacterSpacing(float value)

      Sets the character spacing (Tc).
      Parameters:
        `value` - the new value
      Returns:
        true if the value was changed with respect to the previous value

    - #### getCharacterSpacing

          public float getCharacterSpacing()

      Returns the current character spacing (Tc) value.
      Returns:
        the Tc value

    - #### getStackLevel

          public int getStackLevel()

      Get the current stack level.
      Returns:
        the current stack level

    - #### getGState

          public PDFGState getGState()

      Get the graphics state. This gets the combination of all graphic states for the current context. This is the graphic state set with the gs operator not the other graphic state changes.
      Returns:
        the calculated ExtGState in the current context

    - #### setLayer

          public void setLayer(java.lang.String layer)

    - #### getLayer

          public java.lang.String getLayer()

    - #### getLayerChanged

          public boolean getLayerChanged()

    - #### instantiateData

          protected AbstractPaintingState.AbstractData instantiateData()

      Instantiates a new state data object
      Specified by:
        `instantiateData` in class `AbstractPaintingState`
      Returns:
        a new state data object

    - #### instantiate

          protected AbstractPaintingState instantiate()

      Instantiates a new state object
      Specified by:
        `instantiate` in class `AbstractPaintingState`
      Returns:
        a new state object

    - #### save

          public void save()

      Push the current state onto the stack. This call should be used when the q operator is used so that the state is known when popped.
      Overrides:
        `save` in class `AbstractPaintingState`

Copyright 1999-2015 The Apache Software Foundation. All Rights Reserved.