Class WmfFile
java.lang.Object
org.pentaho.reporting.libraries.pixie.wmf.WmfFile
Parses and replays the WmfFile.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
-
Constructor Summary
ConstructorDescriptionWmfFile
(InputStream in, int imageWidth, int imageHeight) Initialize metafile for reading from the given input stream.Initialize metafile for reading from file.Initialize metafile for reading from filename.Initialize metafile for reading from an URL.Initialize metafile for reading from an URL. -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteObject
(int slot) void
draw
(Graphics2D graphics, Rectangle2D bounds) protected int
Return the next free slot from the objects table.getBrushObject
(int slot) Return Placeable and Windows headers that were read earlier.getObject
(int slot) getPenObject
(int slot) Returns the preferred size of the drawable.getRegionObject
(int slot) int
boolean
Returns true, if this drawable will preserve an aspect ratio during the drawing.static void
replay()
replay
(int imageX, int imageY) void
restoreDCState
(int stateCount) Restores a state.void
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
toString()
-
Field Details
-
QUALITY_NO
public static final int QUALITY_NO- See Also:
-
QUALITY_MAYBE
public static final int QUALITY_MAYBE- See Also:
-
QUALITY_YES
public static final int QUALITY_YES- See Also:
-
-
Constructor Details
-
WmfFile
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
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
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
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
-
getPalette
-
getHeader
Return Placeable and Windows headers that were read earlier.- Returns:
- the meta-file header.
-
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 widthpercentY
- the scaling percentage of the height
-
main
- Throws:
Exception
-
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
-
deleteObject
public void deleteObject(int slot) -
getObject
-
getBrushObject
-
getPenObject
-
getRegionObject
-
replay
-
replay
-
draw
-
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
-