Class WMFHeaderProperties
- java.lang.Object
-
- org.apache.batik.transcoder.wmf.tosvg.AbstractWMFReader
-
- org.apache.batik.transcoder.wmf.tosvg.WMFHeaderProperties
-
public class WMFHeaderProperties extends AbstractWMFReader
This class holds simple properties about a WMF Metafile. It can be used whenever general information must be retrieved about this file.
-
-
Field Summary
Fields Modifier and Type Field Description static intBRUSHstatic intFONTstatic intNULL_BRUSHstatic intNULL_PENstatic intOBJ_BITMAPstatic intOBJ_REGIONstatic intPALETTEstatic intPENprotected java.io.DataInputStreamstream-
Fields inherited from class org.apache.batik.transcoder.wmf.tosvg.AbstractWMFReader
bottom, bReading, height, inch, isAldus, isotropic, lastObjectIdx, left, MM_PER_PIXEL, mtHeaderSize, mtMaxRecord, mtNoObjects, mtNoParameters, mtSize, mtType, mtVersion, numObjects, objectVector, PIXEL_PER_INCH, right, scaleX, scaleXY, scaleY, top, vpH, vpW, vpX, vpY, width, windowHeight, windowWidth, xSign, ySign
-
-
Constructor Summary
Constructors Constructor Description WMFHeaderProperties()Creates a new WMFHeaderProperties, with no associated file.WMFHeaderProperties(java.io.File wmffile)Creates a new WMFHeaderProperties, and sets the associated WMF File.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseResource()intgetHeightBoundsPixels()intgetHeightBoundsUnits()java.io.DataInputStreamgetStream()Get the associated stream.intgetWidthBoundsPixels()intgetWidthBoundsUnits()intgetXOffset()intgetYOffset()protected booleanreadRecords(java.io.DataInputStream is)Read this InputStream records.voidreset()Resets the internal storage and viewport coordinates.voidsetFile(java.io.File wmffile)Creates the properties associated file.-
Methods inherited from class org.apache.batik.transcoder.wmf.tosvg.AbstractWMFReader
addObject, addObjectAt, getBottomUnits, getHeightPixels, getHeightUnits, getLeftUnits, getMetaFileUnitsPerInch, getNumObjects, getObject, getPixelsPerUnit, getRectangleInch, getRectanglePixel, getRectangleUnits, getRightUnits, getTopUnits, getUnitsToPixels, getViewportHeightInch, getViewportHeightUnits, getViewportWidthInch, getViewportWidthUnits, getVpH, getVpHFactor, getVpW, getVpWFactor, getWidthPixels, getWidthUnits, getXSign, getYSign, isReading, read, readInt, readShort, setReading
-
-
-
-
Field Detail
-
stream
protected java.io.DataInputStream stream
-
PEN
public static final int PEN
- See Also:
- Constant Field Values
-
BRUSH
public static final int BRUSH
- See Also:
- Constant Field Values
-
FONT
public static final int FONT
- See Also:
- Constant Field Values
-
NULL_PEN
public static final int NULL_PEN
- See Also:
- Constant Field Values
-
NULL_BRUSH
public static final int NULL_BRUSH
- See Also:
- Constant Field Values
-
PALETTE
public static final int PALETTE
- See Also:
- Constant Field Values
-
OBJ_BITMAP
public static final int OBJ_BITMAP
- See Also:
- Constant Field Values
-
OBJ_REGION
public static final int OBJ_REGION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WMFHeaderProperties
public WMFHeaderProperties(java.io.File wmffile) throws java.io.IOExceptionCreates a new WMFHeaderProperties, and sets the associated WMF File.- Parameters:
wmffile- the WMF Metafile- Throws:
java.io.IOException
-
WMFHeaderProperties
public WMFHeaderProperties()
Creates a new WMFHeaderProperties, with no associated file.
-
-
Method Detail
-
closeResource
public void closeResource()
-
setFile
public void setFile(java.io.File wmffile) throws java.io.IOExceptionCreates the properties associated file.- Throws:
java.io.IOException
-
reset
public void reset()
Resets the internal storage and viewport coordinates.- Specified by:
resetin classAbstractWMFReader
-
getStream
public java.io.DataInputStream getStream()
Get the associated stream.
-
readRecords
protected boolean readRecords(java.io.DataInputStream is) throws java.io.IOExceptionDescription copied from class:AbstractWMFReaderRead this InputStream records. The aldus placeable header have already been read (seeAbstractWMFReader.read(DataInputStream)). The behavior of this method is left to the subclass. Each Metafile record is composed of :- the size of the Record in int (32 bits)
- the function ID for the Record on a short word (16 bits)
- the function parameters, according to the WMF Metafile specification. the remaining size in short words (16 bits) for the parameters is equal to the total size for the record minus 3 short words (= 16 + 32 bits)
Example :
while (functionId > 0) { recSize = readInt( is ); // Subtract size in 16-bit words of recSize and functionId; recSize -= 3; functionId = readShort( is ); if ( functionId <= 0 ) break; switch ( functionId ) { case WMFConstants.<a WMF function ID> { do something when this function is encountered } break; default: for ( int j = 0; j < recSize; j++ ) readShort(is); break;- Specified by:
readRecordsin classAbstractWMFReader- Throws:
java.io.IOException- See Also:
WMFConstants
-
getWidthBoundsPixels
public int getWidthBoundsPixels()
- Returns:
- the width of the Rectangle bounding the figures enclosed in the Metafile, in pixels
-
getHeightBoundsPixels
public int getHeightBoundsPixels()
- Returns:
- the height of the Rectangle bounding the figures enclosed in the Metafile, in pixels.
-
getWidthBoundsUnits
public int getWidthBoundsUnits()
- Returns:
- the width of the Rectangle bounding the figures enclosed in the Metafile, in Metafile Units.
-
getHeightBoundsUnits
public int getHeightBoundsUnits()
- Returns:
- the height of the Rectangle bounding the figures enclosed in the Metafile in Metafile Units.
-
getXOffset
public int getXOffset()
- Returns:
- the X offset of the Rectangle bounding the figures enclosed in the Metafile.
-
getYOffset
public int getYOffset()
- Returns:
- the Y offset of the Rectangle bounding the figures enclosed in the Metafile.
-
-