Class MfCmd

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected MfCmd()
      The default constructor, adjusts the scale to 1.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected int[] applyScaleX​(int[] n, int[] dest)
      Applies the new x-scaling to all values in the array n and places the values in the array dest.
      protected int[] applyScaleY​(int[] n, int[] dest)
      Applies the new y-scaling to all values in the array n and places the values in the array dest.
      abstract int getFunction()
      Reads the function identifier.
      abstract MfCmd getInstance()
      Creates a empty unintialized copy of this command implementation.
      abstract MfRecord getRecord()
      Creates a new record based on the data stored in the MfCommand.
      protected int getScaledHeight​(int length)
      Scales the given vertical length and makes sure that the lenght is at least 1.
      protected int getScaledWidth​(int length)
      Scales the given horizontal length and makes sure that the lenght is at least 1.
      int getScaledX​(int x)
      Return integer scaled to output units.
      int getScaledY​(int y)
      Return integer scaled to output units.
      abstract void replay​(WmfFile metafile)
      Replays the command on the given WmfFile.
      protected Rectangle scaleRect​(Rectangle r)
      Scales the given rectangle.
      protected abstract void scaleXChanged()
      A callback function to inform the object, that the x scale has changed and the internal coordinate values have to be adjusted.
      protected abstract void scaleYChanged()
      A callback function to inform the object, that the y scale has changed and the internal coordinate values have to be adjusted.
      abstract void setRecord​(MfRecord record)
      Reads the command data from the given record and adjusts the internal parameters according to the data parsed.
      void setScale​(float scaleX, float scaleY)
      Set the scale for the command.
    • Constructor Detail

      • MfCmd

        protected MfCmd()
        The default constructor, adjusts the scale to 1.
    • Method Detail

      • setRecord

        public abstract void setRecord​(MfRecord record)
        Reads the command data from the given record and adjusts the internal parameters according to the data parsed.

        After the raw record was read from the datasource, the record is parsed by the concrete implementation.

        Parameters:
        record - the raw data that makes up the record.
      • getFunction

        public abstract int getFunction()
        Reads the function identifier. Every record type is identified by a function number corresponding to one of the Windows GDI functions used.
        Returns:
        the function identifier.
      • getInstance

        public abstract MfCmd getInstance()
        Creates a empty unintialized copy of this command implementation.
        Returns:
        a new instance of the command.
      • replay

        public abstract void replay​(WmfFile metafile)
        Replays the command on the given WmfFile.
        Parameters:
        metafile - the meta file.
      • setScale

        public void setScale​(float scaleX,
                             float scaleY)
        Set the scale for the command.
        Parameters:
        scaleX - the horizontal scale
        scaleY - the vertical scale
      • scaleXChanged

        protected abstract void scaleXChanged()
        A callback function to inform the object, that the x scale has changed and the internal coordinate values have to be adjusted.
      • scaleYChanged

        protected abstract void scaleYChanged()
        A callback function to inform the object, that the y scale has changed and the internal coordinate values have to be adjusted.
      • scaleRect

        protected Rectangle scaleRect​(Rectangle r)
        Scales the given rectangle.
        Parameters:
        r - the source rectangle.
        Returns:
        a new rectangle containing the scaled values.
      • getScaledWidth

        protected int getScaledWidth​(int length)
        Scales the given horizontal length and makes sure that the lenght is at least 1.
        Parameters:
        length - the value that should be scaled.
        Returns:
        the scaled value.
      • getScaledHeight

        protected int getScaledHeight​(int length)
        Scales the given vertical length and makes sure that the lenght is at least 1.
        Parameters:
        length - the value that should be scaled.
        Returns:
        the scaled value.
      • applyScaleX

        protected int[] applyScaleX​(int[] n,
                                    int[] dest)
        Applies the new x-scaling to all values in the array n and places the values in the array dest. Additionally dest is also returned as return value.
        Parameters:
        n - the unscaled source values
        dest - the array to store the scaled values
        Returns:
        dest.
      • applyScaleY

        protected int[] applyScaleY​(int[] n,
                                    int[] dest)
        Applies the new y-scaling to all values in the array n and places the values in the array dest. Additionally dest is also returned as return value.
        Parameters:
        n - the unscaled source values
        dest - the array to store the scaled values
        Returns:
        dest.
      • getScaledY

        public int getScaledY​(int y)
        Return integer scaled to output units.
        Parameters:
        y - the unscaled y
        Returns:
        the scaled y value
      • getScaledX

        public int getScaledX​(int x)
        Return integer scaled to output units.
        Parameters:
        x - the unscaled x
        Returns:
        the scaled x value