Class AbstractPaintingState

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    AFPPaintingState, PDFPaintingState

    public abstract class AbstractPaintingState
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    A base class which holds information about the current painting state.
    See Also:
    Serialized Form
    • Constructor Detail

      • AbstractPaintingState

        public AbstractPaintingState()
    • Method Detail

      • instantiate

        protected abstract AbstractPaintingState instantiate()
        Instantiates a new state object
        Returns:
        a new state object
      • setColor

        public boolean setColor​(java.awt.Color col)
        Set the current color. Check if the new color is a change and then set the current color.
        Parameters:
        col - the color to set
        Returns:
        true if the color has changed
      • getColor

        public java.awt.Color getColor()
        Get the color.
        Returns:
        the color
      • getBackColor

        public java.awt.Color getBackColor()
        Get the background color.
        Returns:
        the background color
      • setBackColor

        public boolean setBackColor​(java.awt.Color col)
        Set the current background color. Check if the new background color is a change and then set the current background color.
        Parameters:
        col - the background color to set
        Returns:
        true if the color has changed
      • setFontName

        public boolean setFontName​(java.lang.String internalFontName)
        Set the current font name
        Parameters:
        internalFontName - the internal font name
        Returns:
        true if the font name has changed
      • getFontName

        public java.lang.String getFontName()
        Gets the current font name
        Returns:
        the current font name
      • getFontSize

        public int getFontSize()
        Gets the current font size
        Returns:
        the current font size
      • setFontSize

        public boolean setFontSize​(int size)
        Set the current font size. Check if the font size is a change and then set the current font size.
        Parameters:
        size - the font size to set
        Returns:
        true if the font size has changed
      • setLineWidth

        public boolean setLineWidth​(float width)
        Set the current line width.
        Parameters:
        width - the line width in points
        Returns:
        true if the line width has changed
      • getLineWidth

        public float getLineWidth()
        Returns the current line width
        Returns:
        the current line width
      • setDashArray

        public boolean setDashArray​(float[] dash)
        Sets the dash array (line type) for the current basic stroke
        Parameters:
        dash - the line dash array
        Returns:
        true if the dash array has changed
      • getTransform

        public java.awt.geom.AffineTransform getTransform()
        Get the current transform. This gets the combination of all transforms in the current state.
        Returns:
        the calculate combined transform for the current state
      • checkTransform

        public boolean checkTransform​(java.awt.geom.AffineTransform tf)
        Check the current transform. The transform for the current state is the combination of all transforms in the current state. The parameter is compared against this current transform.
        Parameters:
        tf - the transform the check against
        Returns:
        true if the new transform is different then the current transform
      • getBaseTransform

        public java.awt.geom.AffineTransform getBaseTransform()
        Get a copy of the base transform for the page. Used to translate IPP/BPP values into X,Y positions when positioning is "fixed".
        Returns:
        the base transform, or null if the state stack is empty
      • concatenate

        public void concatenate​(java.awt.geom.AffineTransform at)
        Concatenates the given AffineTransform to the current one.
        Parameters:
        at - the transform to concatenate to the current level transform
      • resetTransform

        public void resetTransform()
        Resets the current AffineTransform to the Base AffineTransform.
      • clearTransform

        public void clearTransform()
        Clears the current AffineTransform to the Identity AffineTransform
      • save

        public void save()
        Save the current painting state. This pushes the current painting state onto the stack. This call should be used when the Q operator is used so that the state is known when popped.
      • restore

        public AbstractPaintingState.AbstractData restore()
        Restore the current painting state. This pops the painting state from the stack and sets current values to popped state.
        Returns:
        the restored state, null if the stack is empty
      • saveAll

        public void saveAll​(java.util.List<AbstractPaintingState.AbstractData> dataList)
        Save all painting state data. This pushes all painting state data in the given list to the stack
        Parameters:
        dataList - a state data list
      • restoreAll

        public java.util.List<AbstractPaintingState.AbstractData> restoreAll()
        Restore all painting state data. This pops all painting state data from the stack
        Returns:
        a list of state data popped from the stack
      • clear

        public void clear()
        Clears the state stack
      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object