java.lang.Object
org.pentaho.reporting.libraries.pixie.wmf.WmfFile

public class WmfFile extends Object
Parses and replays the WmfFile.
  • Field Details

  • Constructor Details

    • WmfFile

      public WmfFile(URL input) throws IOException
      Initialize metafile for reading from an URL. Width and height will be computed automatically.
      Parameters:
      input - the URL from where to read.
      Throws:
      IOException - if any other error occured.
    • WmfFile

      public WmfFile(String input) throws IOException
      Initialize metafile for reading from file. Width and height will be computed automatically.
      Parameters:
      input - the name of the file from where to read.
      Throws:
      IOException - if any other error occured.
    • WmfFile

      public WmfFile(URL input, int imageWidth, int imageHeight) throws IOException
      Initialize metafile for reading from an URL.
      Parameters:
      imageWidth - the target width of the image or -1 for automatic mode.
      imageHeight - the target height of the image or -1 for automatic mode.
      input - the URL from where to read.
      Throws:
      IOException - if any other error occured.
    • WmfFile

      public WmfFile(String inName, int imageWidth, int imageHeight) throws FileNotFoundException, IOException
      Initialize metafile for reading from filename.
      Parameters:
      imageWidth - the target width of the image or -1 for automatic mode.
      imageHeight - the target height of the image or -1 for automatic mode.
      inName - the file name from where to read.
      Throws:
      FileNotFoundException - if the file was not found.
      IOException - if any other error occured.
    • WmfFile

      public WmfFile(InputStream in, int imageWidth, int imageHeight) throws IOException
      Initialize metafile for reading from the given input stream.
      Parameters:
      imageWidth - the target width of the image or -1 for automatic mode.
      imageHeight - the target height of the image or -1 for automatic mode.
      in - the stream from where to read.
      Throws:
      IOException - if any other error occured.
  • Method Details

    • getImageSize

      public Dimension getImageSize()
    • getPalette

      public MfPalette getPalette()
    • getHeader

      public MfHeader getHeader()
      Return Placeable and Windows headers that were read earlier.
      Returns:
      the meta-file header.
    • getGraphics2D

      public Graphics2D getGraphics2D()
    • scaleToFit

      public void scaleToFit(float fitWidth, float fitHeight)
      Scales the WMF-image to the given width and height while preserving the aspect ration.
      Parameters:
      fitWidth - the target width.
      fitHeight - the target height.
    • scalePercent

      public void scalePercent(float percent)
      Scale the image to a certain percentage.
      Parameters:
      percent - the scaling percentage
    • scalePercent

      public void scalePercent(float percentX, float percentY)
      Scale the width and height of an image to a certain percentage.
      Parameters:
      percentX - the scaling percentage of the width
      percentY - the scaling percentage of the height
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception
    • getCurrentState

      public MfDcState getCurrentState()
    • saveDCState

      public void saveDCState()
    • getStateCount

      public int getStateCount()
    • restoreDCState

      public void restoreDCState(int stateCount)
      Restores a state. The stateCount specifies the number of states to discard to find the correct one.
      Parameters:
      stateCount - the state count.
    • findFreeSlot

      protected int findFreeSlot()
      Return the next free slot from the objects table.
      Returns:
      the next new free slot in the objects-registry
    • storeObject

      public void storeObject(WmfObject o)
    • deleteObject

      public void deleteObject(int slot)
    • getObject

      public WmfObject getObject(int slot)
    • getBrushObject

      public MfLogBrush getBrushObject(int slot)
    • getPenObject

      public MfLogPen getPenObject(int slot)
    • getRegionObject

      public MfLogRegion getRegionObject(int slot)
    • replay

      public BufferedImage replay()
    • replay

      public BufferedImage replay(int imageX, int imageY)
    • draw

      public void draw(Graphics2D graphics, Rectangle2D bounds)
    • getPreferredSize

      public Dimension getPreferredSize()
      Returns the preferred size of the drawable. If the drawable is aspect ratio aware, these bounds should be used to compute the preferred aspect ratio for this drawable.
      Returns:
      the preferred size.
    • isPreserveAspectRatio

      public boolean isPreserveAspectRatio()
      Returns true, if this drawable will preserve an aspect ratio during the drawing.
      Returns:
      true, if an aspect ratio is preserved, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object