org.jfree.pixie.wmf

Class WmfFile

Implemented Interfaces:
Drawable

public class WmfFile
extends java.lang.Object
implements Drawable

Parses and replays the WmfFile.

Field Summary

static int
QUALITY_MAYBE
static int
QUALITY_NO
static int
QUALITY_YES

Constructor Summary

WmfFile(InputStream in, int imageX, int imageY)
Initialize metafile for reading from filename.
WmfFile(String input)
WmfFile(String inName, int imageX, int imageY)
Initialize metafile for reading from filename.
WmfFile(URL input)
WmfFile(URL input, int imageX, int imageY)

Method Summary

void
assertValid()
Check class invariant.
void
deleteObject(int slot)
void
draw(Graphics2D graphics, Rectangle2D bounds)
protected int
findFreeSlot()
Return the next free slot from the objects table.
MfLogBrush
getBrushObject(int slot)
MfDcState
getCurrentState()
Graphics2D
getGraphics2D()
MfHeader
getHeader()
Return Placeable and Windows headers that were read earlier.
Dimension
getImageSize()
WmfObject
getObject(int slot)
MfPalette
getPalette()
MfLogPen
getPenObject(int slot)
MfLogRegion
getRegionObject(int slot)
int
getStateCount()
static int
isMetafile(String inName, InputStream in)
Return true if the input is a metafile
static void
main(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.
BufferedImage
replay()
BufferedImage
replay(int imageX, int imageY)
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)
<!-- Yes, this is from iText lib -->
void
storeObject(WmfObject o)

Field Details

QUALITY_MAYBE

public static final int QUALITY_MAYBE
Field Value:
1

QUALITY_NO

public static final int QUALITY_NO
Field Value:
0

QUALITY_YES

public static final int QUALITY_YES
Field Value:
2

Constructor Details

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

Method Details

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)

getPalette

public MfPalette getPalette()

getPenObject

public MfLogPen getPenObject(int slot)

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

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 state)

saveDCState

public void saveDCState()

scalePercent

public void scalePercent(float percent)
Scale the image to a certain percentage.
Parameters:
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.
Parameters:
percentX - the scaling percentage of the width
percentY - 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)