Class PSState

  • All Implemented Interfaces:
    Serializable

    public class PSState
    extends Object
    implements 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 Detail

      • DEFAULT_RGB_COLOR

        public static final 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 AffineTransform getTransform()
        Returns the transform.
        Returns:
        the current transformation matrix
      • checkTransform

        public boolean checkTransform​(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​(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​(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​(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​(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 IOException
        Reestablishes the graphics state represented by this instance by issueing the necessary commands.
        Parameters:
        gen - The generator to use for output
        Throws:
        IOException - In case of an I/O problem