public class WmfFile extends Object
Modifier and Type | Field and Description |
---|---|
static int |
QUALITY_MAYBE |
static int |
QUALITY_NO |
static int |
QUALITY_YES |
Constructor and Description |
---|
WmfFile(InputStream in,
int imageWidth,
int imageHeight)
Initialize metafile for reading from the given input stream.
|
WmfFile(String input)
Initialize metafile for reading from file.
|
WmfFile(String inName,
int imageWidth,
int imageHeight)
Initialize metafile for reading from filename.
|
WmfFile(URL input)
Initialize metafile for reading from an URL.
|
WmfFile(URL input,
int imageWidth,
int imageHeight)
Initialize metafile for reading from an URL.
|
Modifier and Type | Method and Description |
---|---|
void |
deleteObject(int slot) |
void |
draw(Graphics2D graphics,
Rectangle2D bounds) |
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) |
Dimension |
getPreferredSize()
Returns the preferred size of the drawable.
|
MfLogRegion |
getRegionObject(int slot) |
int |
getStateCount() |
boolean |
isPreserveAspectRatio()
Returns true, if this drawable will preserve an aspect ratio during the drawing.
|
static void |
main(String[] args) |
BufferedImage |
replay() |
BufferedImage |
replay(int imageX,
int imageY) |
void |
restoreDCState(int stateCount)
Restores a 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)
Scales the WMF-image to the given width and height while preserving the aspect ration.
|
void |
storeObject(WmfObject o) |
String |
toString() |
public static final int QUALITY_NO
public static final int QUALITY_MAYBE
public static final int QUALITY_YES
public WmfFile(URL input) throws IOException
input
- the URL from where to read.IOException
- if any other error occured.public WmfFile(String input) throws IOException
input
- the name of the file from where to read.IOException
- if any other error occured.public WmfFile(URL input, int imageWidth, int imageHeight) throws IOException
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.IOException
- if any other error occured.public WmfFile(String inName, int imageWidth, int imageHeight) throws FileNotFoundException, IOException
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.FileNotFoundException
- if the file was not found.IOException
- if any other error occured.public WmfFile(InputStream in, int imageWidth, int imageHeight) throws IOException
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.IOException
- if any other error occured.public Dimension getImageSize()
public MfPalette getPalette()
public MfHeader getHeader()
public Graphics2D getGraphics2D()
public void scaleToFit(float fitWidth, float fitHeight)
fitWidth
- the target width.fitHeight
- the target height.public void scalePercent(float percent)
percent
- the scaling percentage public void scalePercent(float percentX, float percentY)
percentX
- the scaling percentage of the widthpercentY
- the scaling percentage of the height public MfDcState getCurrentState()
public void saveDCState()
public int getStateCount()
public void restoreDCState(int stateCount)
stateCount
- the state count.public void storeObject(WmfObject o)
public void deleteObject(int slot)
public WmfObject getObject(int slot)
public MfLogBrush getBrushObject(int slot)
public MfLogPen getPenObject(int slot)
public MfLogRegion getRegionObject(int slot)
public BufferedImage replay()
public BufferedImage replay(int imageX, int imageY)
public void draw(Graphics2D graphics, Rectangle2D bounds)
public Dimension getPreferredSize()
public boolean isPreserveAspectRatio()