Class MetaState


  • public class MetaState
    extends java.lang.Object
    Class to keep the state.
    • Field Detail

      • savedStates

        public java.util.Stack<MetaState> savedStates
        Stack of saved states.
      • MetaObjects

        public java.util.List<MetaObject> MetaObjects
        List of MetaObjects.
      • currentPoint

        public Point currentPoint
        Current Point.
      • currentPen

        public MetaPen currentPen
        Current Pen.
      • currentBrush

        public MetaBrush currentBrush
        Current Brush.
      • currentFont

        public MetaFont currentFont
        Current Font.
      • currentBackgroundColor

        public Color currentBackgroundColor
        The current background color. Default value is DeviceRgb#WHITE.
      • currentTextColor

        public Color currentTextColor
        Current text color. Default value is DeviceRgb#BLACK.
      • backgroundMode

        public int backgroundMode
        The current background mode. Default value is OPAQUE.
      • polyFillMode

        public int polyFillMode
        Current polygon fill mode. Default value is ALTERNATE.
      • lineJoin

        public int lineJoin
        Curent line join. Default value is 1.
      • textAlign

        public int textAlign
        Current text alignment.
      • offsetWx

        public int offsetWx
        Current offset for Wx.
      • offsetWy

        public int offsetWy
        Current offset for Wy.
      • extentWx

        public int extentWx
        Current extent for Wx.
      • extentWy

        public int extentWy
        Current extent for Wy.
      • scalingX

        public float scalingX
        Current x value for scaling.
      • scalingY

        public float scalingY
        Current y value for scaling.
    • Constructor Detail

      • MetaState

        public MetaState()
        Creates new MetaState
      • MetaState

        public MetaState​(MetaState state)
        Clones a new MetaState from the specified MetaState.
        Parameters:
        state - the state to clone
    • Method Detail

      • setMetaState

        public void setMetaState​(MetaState state)
        Sets every field of this MetaState to the values of the fields of the specified MetaState.
        Parameters:
        state - state to copy
      • addMetaObject

        public void addMetaObject​(MetaObject object)
        Add a MetaObject to the State.
        Parameters:
        object - MetaObject to be added
      • selectMetaObject

        public void selectMetaObject​(int index,
                                     PdfCanvas cb)
        Select the MetaObject at the specified index and prepare the PdfCanvas.
        Parameters:
        index - position of the MetaObject
        cb - PdfCanvas to prepare
      • deleteMetaObject

        public void deleteMetaObject​(int index)
        Deletes the MetaObject at the specified index.
        Parameters:
        index - index of the MetaObject to delete
      • saveState

        public void saveState​(PdfCanvas cb)
        Saves the state of this MetaState object.
        Parameters:
        cb - PdfCanvas object on which saveState() will be called
      • restoreState

        public void restoreState​(int index,
                                 PdfCanvas cb)
        Restores the state to the next state on the saved states stack.
        Parameters:
        index - index of the state to be restored
        cb - PdfCanvas object on which restoreState() will be called
      • cleanup

        public void cleanup​(PdfCanvas cb)
        Restres the state of the specified PdfCanvas object for as many times as there are saved states on the stack.
        Parameters:
        cb - PdfCanvas object
      • transformX

        public float transformX​(int x)
        Transform the specified value.
        Parameters:
        x - the value to transform
        Returns:
        the transformed value
      • transformY

        public float transformY​(int y)
        Transform the specified value.
        Parameters:
        y - the value to transform
        Returns:
        transformed value
      • setScalingX

        public void setScalingX​(float scalingX)
        Sets the x value for scaling.
        Parameters:
        scalingX - x value for scaling
      • setScalingY

        public void setScalingY​(float scalingY)
        Sets the y value for scaling.
        Parameters:
        scalingY - y value for scaling
      • setOffsetWx

        public void setOffsetWx​(int offsetWx)
        Sets the Wx offset value.
        Parameters:
        offsetWx - Wx offset value
      • setOffsetWy

        public void setOffsetWy​(int offsetWy)
        Sets the Wy offset value.
        Parameters:
        offsetWy - Wy offset value
      • setExtentWx

        public void setExtentWx​(int extentWx)
        Sets the Wx extent value.
        Parameters:
        extentWx - Wx extent value
      • setExtentWy

        public void setExtentWy​(int extentWy)
        Sets the Wy extent value.
        Parameters:
        extentWy - Wy extent value
      • transformAngle

        public float transformAngle​(float angle)
        Transforms the specified angle. If scalingY is less than 0, the angle is multiplied by -1. If scalingX is less than 0, the angle is subtracted from Math.PI.
        Parameters:
        angle - the angle to transform
        Returns:
        the transformed angle
      • setCurrentPoint

        public void setCurrentPoint​(Point p)
        Sets the current Point to the specified Point.
        Parameters:
        p - Point to set
      • getCurrentPoint

        public Point getCurrentPoint()
        Returns the current Point.
        Returns:
        current Point
      • getCurrentBrush

        public MetaBrush getCurrentBrush()
        Returns the current MetaBrush object.
        Returns:
        current MetaBrush
      • getCurrentPen

        public MetaPen getCurrentPen()
        Returns the current MetaPen object.
        Returns:
        current MetaPen
      • getCurrentFont

        public MetaFont getCurrentFont()
        Returns the current MetaFont object.
        Returns:
        current MetaFont
      • getCurrentBackgroundColor

        public Color getCurrentBackgroundColor()
        Getter for property currentBackgroundColor.
        Returns:
        Value of property currentBackgroundColor.
      • setCurrentBackgroundColor

        public void setCurrentBackgroundColor​(Color currentBackgroundColor)
        Setter for property currentBackgroundColor.
        Parameters:
        currentBackgroundColor - New value of property currentBackgroundColor.
      • getCurrentTextColor

        public Color getCurrentTextColor()
        Getter for property currentTextColor.
        Returns:
        Value of property currentTextColor.
      • setCurrentTextColor

        public void setCurrentTextColor​(Color currentTextColor)
        Setter for property currentTextColor.
        Parameters:
        currentTextColor - New value of property currentTextColor.
      • getBackgroundMode

        public int getBackgroundMode()
        Getter for property backgroundMode.
        Returns:
        Value of property backgroundMode.
      • setBackgroundMode

        public void setBackgroundMode​(int backgroundMode)
        Setter for property backgroundMode.
        Parameters:
        backgroundMode - New value of property backgroundMode.
      • getTextAlign

        public int getTextAlign()
        Getter for property textAlign.
        Returns:
        Value of property textAlign.
      • setTextAlign

        public void setTextAlign​(int textAlign)
        Setter for property textAlign.
        Parameters:
        textAlign - New value of property textAlign.
      • getPolyFillMode

        public int getPolyFillMode()
        Getter for property polyFillMode.
        Returns:
        Value of property polyFillMode.
      • setPolyFillMode

        public void setPolyFillMode​(int polyFillMode)
        Setter for property polyFillMode.
        Parameters:
        polyFillMode - New value of property polyFillMode.
      • getLineNeutral

        public boolean getLineNeutral()
        Returns true if lineJoin is 0.
        Returns:
        true if lineJoin is 0