Package org.apache.poi.hwmf.draw
Class HwmfGraphics
java.lang.Object
org.apache.poi.hwmf.draw.HwmfGraphics
-
Constructor Summary
ConstructorsConstructorDescriptionHwmfGraphics
(Graphics2D graphicsCtx, Rectangle2D bbox) Initialize a graphics context for wmf rendering -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an record of typeHwmfObjectTableEntry
to the object table.void
applyObjectTableEntry
(int index) Applies the object table entryvoid
void
drawString
(byte[] text, Rectangle2D bounds) void
drawString
(byte[] text, Rectangle2D bounds, int[] dx) void
protected Paint
getFill()
protected Paint
protected Paint
protected Paint
protected BasicStroke
void
restoreProperties
(int index) Restores the properties from the stackvoid
Saves the current properties to the stackvoid
unsetObjectTableEntry
(int index) Unsets (deletes) the object table entry for further usage When a META_DELETEOBJECT record (section 2.3.4.7) is received that specifies this object's particular index, the object's resources are released, the binding to its WMF Object Table index is ended, and the index value is returned to the pool of available indexes.void
After setting various window and viewport related properties, the underlying graphics context needs to be adapted.
-
Constructor Details
-
HwmfGraphics
Initialize a graphics context for wmf rendering- Parameters:
graphicsCtx
- the graphics context to delegate drawing callsbbox
- the bounding box of the wmf (taken from the placeable header)
-
-
Method Details
-
getProperties
-
draw
-
fill
-
getStroke
-
getFill
-
getSolidFill
-
getHatchedFill
-
getPatternPaint
-
addObjectTableEntry
Adds an record of typeHwmfObjectTableEntry
to the object table. Every object is assigned the lowest available index-that is, the smallest numerical value-in the WMF Object Table. This binding happens at object creation, not when the object is used. Moreover, each object table index uniquely refers to an object. Indexes in the WMF Object Table always start at 0.- Parameters:
entry
-
-
applyObjectTableEntry
public void applyObjectTableEntry(int index) Applies the object table entry- Parameters:
index
- the index of the object table entry (0-based)- Throws:
IndexOutOfBoundsException
- if the index is out of rangeNoSuchElementException
- if the entry was deleted before
-
unsetObjectTableEntry
public void unsetObjectTableEntry(int index) Unsets (deletes) the object table entry for further usage When a META_DELETEOBJECT record (section 2.3.4.7) is received that specifies this object's particular index, the object's resources are released, the binding to its WMF Object Table index is ended, and the index value is returned to the pool of available indexes. The index will be reused, if needed, by a subsequent object created by another Object Record Type record.- Parameters:
index
- the index (0-based)- Throws:
IndexOutOfBoundsException
- if the index is out of range
-
saveProperties
public void saveProperties()Saves the current properties to the stack -
restoreProperties
public void restoreProperties(int index) Restores the properties from the stack- Parameters:
index
- if the index is positive, the n-th element from the start is activated. If the index is negative, the n-th previous element relative to the current properties element is activated.
-
updateWindowMapMode
public void updateWindowMapMode()After setting various window and viewport related properties, the underlying graphics context needs to be adapted. This methods gathers and sets the corresponding graphics transformations. -
drawString
-
drawString
-