Class WMFHeaderProperties
java.lang.Object
org.apache.batik.transcoder.wmf.tosvg.AbstractWMFReader
org.apache.batik.transcoder.wmf.tosvg.WMFHeaderProperties
This class holds simple properties about a WMF Metafile. It can be used
whenever general information must be retrieved about this file.
- Version:
- $Id: WMFHeaderProperties.java 1831630 2018-05-15 12:56:55Z ssteiner $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private int
private int
private int
private int
private int
private int
private int
private int
private int
static final int
private int
private int
private boolean
static final int
private static final FontRenderContext
private static final Integer
static final int
static final int
static final int
static final int
static final int
static final int
private float
private int
private int
protected DataInputStream
private WMFFont
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
ConstructorsConstructorDescriptionCreates a new WMFHeaderProperties, with no associated file.WMFHeaderProperties
(File wmffile) Creates a new WMFHeaderProperties, and sets the associated WMF File. -
Method Summary
Modifier and TypeMethodDescriptionvoid
private Color
getColorFromObject
(int brushObject) get the Color corresponding with the Object (pen or brush object).int
int
Get the associated stream.private float
getVerticalAlignmentValue
(TextLayout layout, int vertAlign) get the vertical Alignment value for the text.int
int
int
int
private void
Resize the bounds of the WMF image according with the bounds of the geometric Shape.private void
paintWithPen
(int penObject, Shape shape) Resize the bounds of the WMF image according with the bounds of the geometric Shape.protected boolean
Read this InputStream records.void
reset()
Resets the internal storage and viewport coordinates.private void
private void
resizeBounds
(int x, int y) resize Bounds for each primitive encountered.private void
resizeImageBounds
(int x, int y) resize Bounds for each image primitive encountered.void
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 Details
-
INTEGER_0
-
stream
-
_bleft
private int _bleft -
_bright
private int _bright -
_btop
private int _btop -
_bbottom
private int _bbottom -
_bwidth
private int _bwidth -
_bheight
private int _bheight -
_ileft
private int _ileft -
_iright
private int _iright -
_itop
private int _itop -
_ibottom
private int _ibottom -
scale
private float scale -
startX
private int startX -
startY
private int startY -
currentHorizAlign
private int currentHorizAlign -
currentVertAlign
private int currentVertAlign -
wf
-
fontCtx
-
firstEffectivePaint
private transient boolean firstEffectivePaint -
PEN
public static final int PEN- See Also:
-
BRUSH
public static final int BRUSH- See Also:
-
FONT
public static final int FONT- See Also:
-
NULL_PEN
public static final int NULL_PEN- See Also:
-
NULL_BRUSH
public static final int NULL_BRUSH- See Also:
-
PALETTE
public static final int PALETTE- See Also:
-
OBJ_BITMAP
public static final int OBJ_BITMAP- See Also:
-
OBJ_REGION
public static final int OBJ_REGION- See Also:
-
-
Constructor Details
-
WMFHeaderProperties
Creates a new WMFHeaderProperties, and sets the associated WMF File.- Parameters:
wmffile
- the WMF Metafile- Throws:
IOException
-
WMFHeaderProperties
public WMFHeaderProperties()Creates a new WMFHeaderProperties, with no associated file.
-
-
Method Details
-
closeResource
public void closeResource() -
setFile
Creates the properties associated file.- Throws:
IOException
-
reset
public void reset()Resets the internal storage and viewport coordinates.- Specified by:
reset
in classAbstractWMFReader
-
getStream
Get the associated stream. -
readRecords
Description copied from class:AbstractWMFReader
Read 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:
readRecords
in classAbstractWMFReader
- Throws:
IOException
- See Also:
-
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.
-
resetBounds
private void resetBounds() -
resizeBounds
private void resizeBounds(int x, int y) resize Bounds for each primitive encountered. Only elements that are in the overall width and height of the Metafile are kept. -
resizeImageBounds
private void resizeImageBounds(int x, int y) resize Bounds for each image primitive encountered. Only elements that are in the overall width and height of the Metafile are kept. -
getColorFromObject
get the Color corresponding with the Object (pen or brush object). -
paint
Resize the bounds of the WMF image according with the bounds of the geometric Shape. There will be no resizing if one of the following properties is true :- the brush and the pen objects are < 0 (null objects)
- the color of the geometric Shape is white, and no other Shapes has occured
-
paintWithPen
Resize the bounds of the WMF image according with the bounds of the geometric Shape. There will be no resizing if one of the following properties is true :- the pen objects is < 0 (null object)
- the color of the geometric Shape is white, and no other Shapes has occured
-
getVerticalAlignmentValue
get the vertical Alignment value for the text.
-