public abstract class AbstractWMFReader
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
bottom |
protected boolean |
bReading |
protected int |
height |
protected int |
inch |
protected boolean |
isAldus |
protected boolean |
isotropic |
int |
lastObjectIdx |
protected int |
left |
static float |
MM_PER_PIXEL |
protected int |
mtHeaderSize |
protected int |
mtMaxRecord |
protected int |
mtNoObjects |
protected int |
mtNoParameters |
protected int |
mtSize |
protected int |
mtType |
protected int |
mtVersion |
protected int |
numObjects |
protected java.util.List |
objectVector |
static float |
PIXEL_PER_INCH |
protected int |
right |
protected float |
scaleX |
protected float |
scaleXY |
protected float |
scaleY |
protected int |
top |
protected int |
vpH |
protected int |
vpW |
protected int |
vpX |
protected int |
vpY |
protected int |
width |
protected int |
windowHeight |
protected int |
windowWidth |
protected int |
xSign |
protected int |
ySign |
Constructor and Description |
---|
AbstractWMFReader() |
AbstractWMFReader(int width,
int height) |
Modifier and Type | Method and Description |
---|---|
int |
addObject(int type,
java.lang.Object obj) |
int |
addObjectAt(int type,
java.lang.Object obj,
int idx)
Adds a GdiObject to the internal handle table.
|
int |
getBottomUnits()
get the bottom units in the WMF Metafile.
|
int |
getHeightPixels()
get the height of the WMF Metafile, in pixels.
|
int |
getHeightUnits()
get the height units in the WMF Metafile.
|
int |
getLeftUnits()
get the left units in the WMF Metafile.
|
int |
getMetaFileUnitsPerInch()
get the number of Metafile units per inch in the WMF Metafile.
|
int |
getNumObjects()
Returns the number of GdiObjects in the handle table
|
GdiObject |
getObject(int idx)
Returns a GdiObject from the handle table
|
float |
getPixelsPerUnit()
Return the number of pixels per unit.
|
java.awt.geom.Rectangle2D |
getRectangleInch()
get the Rectangle defining the viewport of the WMF Metafile, in inchs.
|
java.awt.geom.Rectangle2D |
getRectanglePixel()
get the Rectangle defining the viewport of the WMF Metafile, in pixels.
|
java.awt.Rectangle |
getRectangleUnits()
get the Rectangle defining the viewport of the WMF Metafile, in Metafile units.
|
int |
getRightUnits()
get the right units in the WMF Metafile.
|
int |
getTopUnits()
get the top units in the WMF Metafile.
|
float |
getUnitsToPixels()
get the factor to transform Metafile dimensions in pixels
|
float |
getViewportHeightInch()
Returns the viewport height, in inches.
|
float |
getViewportHeightUnits()
Returns the viewport height, in Metafile Units
|
float |
getViewportWidthInch()
Returns the viewport width, in inches.
|
float |
getViewportWidthUnits()
Returns the viewport width, in Metafile Units
|
int |
getVpH()
Returns the viewport height, in pixels.
|
float |
getVpHFactor()
get the factor to transform logical units height in pixels
|
int |
getVpW()
Returns the viewport width, in pixels.
|
float |
getVpWFactor()
get the factor to transform logical units width in pixels
|
int |
getWidthPixels()
get the width of the WMF Metafile, in pixels.
|
int |
getWidthUnits()
get the width units in the WMF Metafile.
|
int |
getXSign()
Return the sign of X coordinates.
|
int |
getYSign()
Return the sign of Y coordinates.
|
boolean |
isReading() |
void |
read(java.io.DataInputStream is)
Reads the WMF file from the specified Stream, read it and set the following
properties:
mtType : File type (0 : memory, 1 : disk)
mtHeaderSize : Size of header in WORDS (always 9)
mtVersion : Version of Microsoft Windows used
mtSize : Total size of the metafile in WORDs
mtNoObjects : Number of objects in the file
mtMaxRecord : The size of largest record in WORDs
mtNoParameters : Not Used (always 0)
If the file contains an APM
(aldus placeable header), this method read these additionnal properties :
left : Left coordinate in metafile units
right : Right coordinate in metafile units
top : Top coordinate in metafile units
bottom : Bottom coordinate in metafile units
inch : Number of metafile units per inch
|
protected int |
readInt(java.io.DataInputStream is)
Read the next int (4 bytes) value in the DataInputStream.
|
protected abstract boolean |
readRecords(java.io.DataInputStream is)
Read this InputStream records.
|
protected short |
readShort(java.io.DataInputStream is)
Read the next short (2 bytes) value in the DataInputStream.
|
abstract void |
reset()
resets this WMFReader.
|
protected void |
setReading(boolean state) |
public static final float PIXEL_PER_INCH
public static final float MM_PER_PIXEL
protected int left
protected int right
protected int top
protected int bottom
protected int width
protected int height
protected int inch
protected float scaleX
protected float scaleY
protected float scaleXY
protected int vpW
protected int vpH
protected int vpX
protected int vpY
protected int xSign
protected int ySign
protected volatile boolean bReading
protected boolean isAldus
protected boolean isotropic
protected int mtType
protected int mtHeaderSize
protected int mtVersion
protected int mtSize
protected int mtNoObjects
protected int mtMaxRecord
protected int mtNoParameters
protected int windowWidth
protected int windowHeight
protected int numObjects
protected java.util.List objectVector
public int lastObjectIdx
public AbstractWMFReader()
public AbstractWMFReader(int width, int height)
protected short readShort(java.io.DataInputStream is) throws java.io.IOException
java.io.IOException
protected int readInt(java.io.DataInputStream is) throws java.io.IOException
java.io.IOException
public float getViewportWidthUnits()
public float getViewportHeightUnits()
public float getViewportWidthInch()
public float getViewportHeightInch()
public float getPixelsPerUnit()
public int getVpW()
public int getVpH()
public int getLeftUnits()
public int getRightUnits()
public int getTopUnits()
public int getWidthUnits()
public int getHeightUnits()
public int getBottomUnits()
public int getMetaFileUnitsPerInch()
public java.awt.Rectangle getRectangleUnits()
getRightUnits()
,
getLeftUnits()
,
getTopUnits()
,
getBottomUnits()
public java.awt.geom.Rectangle2D getRectanglePixel()
public java.awt.geom.Rectangle2D getRectangleInch()
public int getWidthPixels()
public float getUnitsToPixels()
public float getVpWFactor()
public float getVpHFactor()
public int getHeightPixels()
public int getXSign()
public int getYSign()
protected void setReading(boolean state)
public boolean isReading()
public abstract void reset()
protected abstract boolean readRecords(java.io.DataInputStream is) throws java.io.IOException
read(DataInputStream)
). The behavior of this method is left
to the subclass.
Each Metafile record is composed of :
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;
java.io.IOException
WMFConstants
public void read(java.io.DataInputStream is) throws java.io.IOException
mtType
: File type (0 : memory, 1 : disk)mtHeaderSize
: Size of header in WORDS (always 9)mtVersion
: Version of Microsoft Windows usedmtSize
: Total size of the metafile in WORDsmtNoObjects
: Number of objects in the filemtMaxRecord
: The size of largest record in WORDsmtNoParameters
: Not Used (always 0)left
: Left coordinate in metafile unitsright
: Right coordinate in metafile unitstop
: Top coordinate in metafile unitsbottom
: Bottom coordinate in metafile unitsinch
: Number of metafile units per inchThen it calls the readRecords(DataInputStream)
abstract method,
whose behavior is left to the subclass
java.io.IOException
public int addObject(int type, java.lang.Object obj)
public int addObjectAt(int type, java.lang.Object obj, int idx)
public GdiObject getObject(int idx)
public int getNumObjects()
Copyright © 2022 Apache Software Foundation. All Rights Reserved.