Parses and replays the WmfFile.
WmfFile
public WmfFile(InputStream in,
int imageX,
int imageY)
throws FileNotFoundException,
IOException
Initialize metafile for reading from filename.
WmfFile
public WmfFile(String input)
throws IOException
WmfFile
public WmfFile(String inName,
int imageX,
int imageY)
throws FileNotFoundException,
IOException
Initialize metafile for reading from filename.
WmfFile
public WmfFile(URL input)
throws IOException
WmfFile
public WmfFile(URL input,
int imageX,
int imageY)
throws IOException
assertValid
public void assertValid()
Check class invariant.
deleteObject
public void deleteObject(int slot)
draw
public void draw(Graphics2D graphics,
Rectangle2D bounds)
findFreeSlot
protected int findFreeSlot()
Return the next free slot from the objects table.
getBrushObject
public MfLogBrush getBrushObject(int slot)
getCurrentState
public MfDcState getCurrentState()
getGraphics2D
public Graphics2D getGraphics2D()
getHeader
public MfHeader getHeader()
Return Placeable and Windows headers that were read earlier.
getImageSize
public Dimension getImageSize()
getObject
public WmfObject getObject(int slot)
getPenObject
public MfLogPen getPenObject(int slot)
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.
getRegionObject
public MfLogRegion getRegionObject(int slot)
getStateCount
public int getStateCount()
isMetafile
public static int isMetafile(String inName,
InputStream in)
Return true if the input is a metafile
isPreserveAspectRatio
public boolean isPreserveAspectRatio()
Returns true, if this drawable will preserve an aspect ratio during the drawing.
- true, if an aspect ratio is preserved, false otherwise.
main
public static void main(String[] args)
throws Exception
parseRecords
protected void parseRecords()
throws IOException
Read and interpret the body of the metafile.
readHeader
public MfHeader readHeader()
throws IOException
Read Placeable and Windows headers.
readNextRecord
public MfRecord readNextRecord()
throws IOException
Fetch a record.
replay
public BufferedImage replay()
replay
public BufferedImage replay(int imageX,
int imageY)
resetStates
public void resetStates()
restoreDCState
public void restoreDCState(int stateCount)
Restores a state. The stateCount specifies the number of states to discard
to find the correct one.
stateCount
- the state count.
saveDCState
public void saveDCState()
scalePercent
public void scalePercent(float percent)
Scale the image to a certain percentage.
percent
- the scaling percentage <!-- Yes, this is from iText lib -->
scalePercent
public void scalePercent(float percentX,
float percentY)
Scale the width and height of an image to a certain percentage.
percentX
- the scaling percentage of the widthpercentY
- the scaling percentage of the height <!-- Yes, this is from iText
lib -->
scaleToFit
public void scaleToFit(float fitWidth,
float fitHeight)
<!-- Yes, this is from iText lib -->
storeObject
public void storeObject(WmfObject o)
toString
public String toString()