org.jfree.pixie.wmf
Class WmfFile

java.lang.Object
  |
  +--org.jfree.pixie.wmf.WmfFile
All Implemented Interfaces:
org.jfree.ui.Drawable

public class WmfFile
extends java.lang.Object
implements org.jfree.ui.Drawable

Parses and replays the WmfFile.


Field Summary
 int maxRec
           
static int QUALITY_MAYBE
           
static int QUALITY_NO
           
static int QUALITY_YES
           
 
Constructor Summary
WmfFile(java.io.InputStream in, java.lang.String inName, int imageX, int imageY)
          Initialize metafile for reading from filename.
WmfFile(java.lang.String input)
           
WmfFile(java.lang.String inName, int imageX, int imageY)
          Initialize metafile for reading from filename.
WmfFile(java.net.URL input)
           
WmfFile(java.net.URL input, int imageX, int imageY)
           
 
Method Summary
 void assertValid()
          Check class invariant.
 void deleteObject(int slot)
           
 void draw(java.awt.Graphics2D graphics, java.awt.geom.Rectangle2D bounds)
           
protected  int findFreeSlot()
          Return the next free slot from the objects table.
 MfLogBrush getBrushObject(int slot)
           
 MfDcState getCurrentState()
           
 java.awt.Graphics2D getGraphics2D()
           
 MfHeader getHeader()
          Return Placeable and Windows headers that were read earlier.
 WmfObject getObject(int slot)
           
 MfPalette getPalette()
           
 MfLogPen getPenObject(int slot)
           
 MfLogRegion getRegionObject(int slot)
           
 int getStateCount()
           
static int isMetafile(java.lang.String inName, java.io.InputStream in)
          Return true if the input is a metafile
static void main(java.lang.String[] args)
           
protected  void parseRecords()
          Read and interpret the body of the metafile.
 MfHeader readHeader()
          Read Placeable and Windows headers.
 MfRecord readNextRecord()
          Fetch a record.
 java.awt.image.BufferedImage replay()
           
 void resetStates()
           
 void restoreDCState(int state)
           
 void saveDCState()
           
 void scalePercent(float percent)
          Scale the image to a certain percentage.
 void scalePercent(float percentX, float percentY)
          Scale the width and height of an image to a certain percentage.
 void scaleToFit(float fitWidth, float fitHeight)
           
 void storeObject(WmfObject o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUALITY_NO

public static final int QUALITY_NO
See Also:
Constant Field Values

QUALITY_MAYBE

public static final int QUALITY_MAYBE
See Also:
Constant Field Values

QUALITY_YES

public static final int QUALITY_YES
See Also:
Constant Field Values

maxRec

public int maxRec
Constructor Detail

WmfFile

public WmfFile(java.net.URL input)
        throws java.io.IOException

WmfFile

public WmfFile(java.lang.String input)
        throws java.io.IOException

WmfFile

public WmfFile(java.net.URL input,
               int imageX,
               int imageY)
        throws java.io.IOException

WmfFile

public WmfFile(java.lang.String inName,
               int imageX,
               int imageY)
        throws java.io.FileNotFoundException,
               java.io.IOException
Initialize metafile for reading from filename.


WmfFile

public WmfFile(java.io.InputStream in,
               java.lang.String inName,
               int imageX,
               int imageY)
        throws java.io.FileNotFoundException,
               java.io.IOException
Initialize metafile for reading from filename.

Method Detail

resetStates

public void resetStates()

getPalette

public MfPalette getPalette()

isMetafile

public static int isMetafile(java.lang.String inName,
                             java.io.InputStream in)
Return true if the input is a metafile


getHeader

public MfHeader getHeader()
Return Placeable and Windows headers that were read earlier.


getGraphics2D

public java.awt.Graphics2D getGraphics2D()

assertValid

public void assertValid()
Check class invariant.


readHeader

public MfHeader readHeader()
                    throws java.io.IOException
Read Placeable and Windows headers.

java.io.IOException

readNextRecord

public MfRecord readNextRecord()
                        throws java.io.IOException
Fetch a record.

java.io.IOException

parseRecords

protected void parseRecords()
                     throws java.io.IOException
Read and interpret the body of the metafile.

java.io.IOException

scaleToFit

public void scaleToFit(float fitWidth,
                       float fitHeight)


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(java.lang.String[] args)
                 throws java.lang.Exception
java.lang.Exception

getCurrentState

public MfDcState getCurrentState()

saveDCState

public void saveDCState()

getStateCount

public int getStateCount()

restoreDCState

public void restoreDCState(int state)

findFreeSlot

protected int findFreeSlot()
Return the next free slot from the objects table.


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 java.awt.image.BufferedImage replay()

draw

public void draw(java.awt.Graphics2D graphics,
                 java.awt.geom.Rectangle2D bounds)
Specified by:
draw in interface org.jfree.ui.Drawable