Class PSState

  • All Implemented Interfaces:
    java.io.Serializable

    public class PSState
    extends java.lang.Object
    implements java.io.Serializable
    This class holds the current state of the PostScript interpreter.
    Version:
    $Id: PSState.java 1804124 2017-08-04 14:13:54Z ssteiner $
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_DASH
      Default for setdash
      static java.awt.Color DEFAULT_RGB_COLOR
      Default color in PostScript
    • Constructor Summary

      Constructors 
      Constructor Description
      PSState()
      Default constructor
      PSState​(PSState org, boolean copyTransforms)
      Copy constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean checkTransform​(java.awt.geom.AffineTransform tf)
      Check the current transform.
      void concatMatrix​(java.awt.geom.AffineTransform transform)
      Concats the given transformation matrix with the current one.
      java.awt.geom.AffineTransform getTransform()
      Returns the transform.
      void reestablish​(PSGenerator gen)
      Reestablishes the graphics state represented by this instance by issueing the necessary commands.
      boolean useColor​(java.awt.Color value)
      Establishes the specified color (RGB).
      boolean useDash​(java.lang.String pattern)
      Establishes the specified dash.
      boolean useFont​(java.lang.String name, float size)
      Establishes the specified font and size.
      boolean useLineCap​(int value)
      Establishes the specified line cap.
      boolean useLineJoin​(int value)
      Establishes the specified line join.
      boolean useLineWidth​(double value)
      Establishes the specified line width.
      boolean useMiterLimit​(float value)
      Establishes the specified miter limit.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_DASH

        public static final java.lang.String DEFAULT_DASH
        Default for setdash
        See Also:
        Constant Field Values
      • DEFAULT_RGB_COLOR

        public static final java.awt.Color DEFAULT_RGB_COLOR
        Default color in PostScript
    • Constructor Detail

      • PSState

        public PSState()
        Default constructor
      • PSState

        public PSState​(PSState org,
                       boolean copyTransforms)
        Copy constructor
        Parameters:
        org - the original to copy from
        copyTransforms - true if the list of matrix concats should be cloned, too
    • Method Detail

      • getTransform

        public java.awt.geom.AffineTransform getTransform()
        Returns the transform.
        Returns:
        the current transformation matrix
      • 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
      • concatMatrix

        public void concatMatrix​(java.awt.geom.AffineTransform transform)
        Concats the given transformation matrix with the current one.
        Parameters:
        transform - The new transformation matrix
      • useLineCap

        public boolean useLineCap​(int value)
        Establishes the specified line cap.
        Parameters:
        value - line cap (0, 1 or 2) as defined by the setlinecap command
        Returns:
        true if the line cap changed compared to the previous setting
      • useLineJoin

        public boolean useLineJoin​(int value)
        Establishes the specified line join.
        Parameters:
        value - line join (0, 1 or 2) as defined by the setlinejoin command
        Returns:
        true if the line join changed compared to the previous setting
      • useMiterLimit

        public boolean useMiterLimit​(float value)
        Establishes the specified miter limit.
        Parameters:
        value - the miter limit as defined by the setmiterlimit command
        Returns:
        true if the miter limit changed compared to the previous setting
      • useLineWidth

        public boolean useLineWidth​(double value)
        Establishes the specified line width.
        Parameters:
        value - line width as defined by the setlinewidth command
        Returns:
        true if the line width changed compared to the previous setting
      • useDash

        public boolean useDash​(java.lang.String pattern)
        Establishes the specified dash.
        Parameters:
        pattern - dash pattern as defined by the setdash command
        Returns:
        true if the dash pattern changed compared to the previous setting
      • useColor

        public boolean useColor​(java.awt.Color value)
        Establishes the specified color (RGB).
        Parameters:
        value - color as defined by the setrgbcolor command
        Returns:
        true if the color changed compared to the previous setting
      • useFont

        public boolean useFont​(java.lang.String name,
                               float size)
        Establishes the specified font and size.
        Parameters:
        name - name of the font for the "F" command (see FOP Std Proc Set)
        size - size of the font
        Returns:
        true if the font changed compared to the previous setting
      • reestablish

        public void reestablish​(PSGenerator gen)
                         throws java.io.IOException
        Reestablishes the graphics state represented by this instance by issueing the necessary commands.
        Parameters:
        gen - The generator to use for output
        Throws:
        java.io.IOException - In case of an I/O problem