public class HwmfGraphics extends java.lang.Object implements HwmfCharsetAware
Modifier and Type | Class and Description |
---|---|
static class |
HwmfGraphics.FillDrawStyle |
Modifier and Type | Field and Description |
---|---|
protected java.awt.Graphics2D |
graphicsCtx |
protected java.util.BitSet |
objectIndexes |
protected java.util.TreeMap<java.lang.Integer,HwmfObjectTableEntry> |
objectTable |
protected HwmfDrawProperties |
prop |
Constructor and Description |
---|
HwmfGraphics(java.awt.Graphics2D graphicsCtx,
java.awt.geom.Rectangle2D bbox)
Initialize a graphics context for wmf rendering
|
Modifier and Type | Method and Description |
---|---|
void |
addObjectTableEntry(HwmfObjectTableEntry entry)
Adds an record of type
HwmfObjectTableEntry to the object table. |
void |
applyObjectTableEntry(int index)
Applies the object table entry
|
void |
draw(java.awt.Shape shape) |
void |
drawImage(java.awt.image.BufferedImage img,
java.awt.geom.Rectangle2D srcBounds,
java.awt.geom.Rectangle2D dstBounds) |
void |
drawImage(ImageRenderer img,
java.awt.geom.Rectangle2D srcBounds,
java.awt.geom.Rectangle2D dstBounds) |
void |
drawString(byte[] text,
int length,
java.awt.geom.Point2D reference) |
void |
drawString(byte[] text,
int length,
java.awt.geom.Point2D reference,
java.awt.geom.Dimension2D scale,
java.awt.geom.Rectangle2D clip,
HwmfText.WmfExtTextOutOptions opts,
java.util.List<java.lang.Integer> dx,
boolean isUnicode) |
void |
fill(java.awt.Shape shape) |
protected java.awt.Paint |
getFill() |
protected java.awt.Paint |
getHatchedFill() |
ImageRenderer |
getImageRenderer(java.lang.String contentType) |
java.awt.geom.AffineTransform |
getInitTransform() |
protected java.awt.Paint |
getLinearGradient() |
static java.awt.image.BufferedImage |
getPatternFromLong(long patternLng,
java.awt.Color background,
java.awt.Color foreground,
boolean hasAlpha) |
protected java.awt.Paint |
getPatternPaint() |
HwmfDrawProperties |
getProperties() |
protected java.awt.Paint |
getSolidFill() |
protected java.awt.BasicStroke |
getStroke() |
java.awt.geom.AffineTransform |
getTransform() |
protected HwmfDrawProperties |
newProperties(HwmfDrawProperties oldProps) |
void |
restoreProperties(int index)
Restores the properties from the stack
|
void |
saveProperties()
Saves the current properties to the stack
|
void |
setCharsetProvider(java.util.function.Supplier<java.nio.charset.Charset> provider) |
void |
setClip(java.awt.Shape clip,
HwmfRegionMode regionMode,
boolean useInitialAT)
Set the new clipping region
|
void |
setTransform(java.awt.geom.AffineTransform tx)
Set the current AffineTransform
|
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.
|
void |
updateWindowMapMode()
After setting various window and viewport related properties,
the underlying graphics context needs to be adapted.
|
protected HwmfDrawProperties prop
protected final java.awt.Graphics2D graphicsCtx
protected final java.util.BitSet objectIndexes
protected final java.util.TreeMap<java.lang.Integer,HwmfObjectTableEntry> objectTable
public HwmfGraphics(java.awt.Graphics2D graphicsCtx, java.awt.geom.Rectangle2D bbox)
graphicsCtx
- the graphics context to delegate drawing callsbbox
- the bounding box of the wmf (taken from the placeable header)public HwmfDrawProperties getProperties()
protected HwmfDrawProperties newProperties(HwmfDrawProperties oldProps)
public void draw(java.awt.Shape shape)
public void fill(java.awt.Shape shape)
protected java.awt.BasicStroke getStroke()
protected java.awt.Paint getFill()
protected java.awt.Paint getLinearGradient()
protected java.awt.Paint getSolidFill()
protected java.awt.Paint getHatchedFill()
public static java.awt.image.BufferedImage getPatternFromLong(long patternLng, java.awt.Color background, java.awt.Color foreground, boolean hasAlpha)
protected java.awt.Paint getPatternPaint()
public void addObjectTableEntry(HwmfObjectTableEntry entry)
HwmfObjectTableEntry
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.entry
- the object table entrypublic void applyObjectTableEntry(int index)
index
- the index of the object table entry (0-based)java.lang.IndexOutOfBoundsException
- if the index is out of rangejava.util.NoSuchElementException
- if the entry was deleted beforepublic void unsetObjectTableEntry(int index)
index
- the index (0-based)java.lang.IndexOutOfBoundsException
- if the index is out of rangepublic void saveProperties()
public void restoreProperties(int index)
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.public void updateWindowMapMode()
public void drawString(byte[] text, int length, java.awt.geom.Point2D reference)
public void drawString(byte[] text, int length, java.awt.geom.Point2D reference, java.awt.geom.Dimension2D scale, java.awt.geom.Rectangle2D clip, HwmfText.WmfExtTextOutOptions opts, java.util.List<java.lang.Integer> dx, boolean isUnicode)
public void setCharsetProvider(java.util.function.Supplier<java.nio.charset.Charset> provider)
setCharsetProvider
in interface HwmfCharsetAware
public void drawImage(java.awt.image.BufferedImage img, java.awt.geom.Rectangle2D srcBounds, java.awt.geom.Rectangle2D dstBounds)
public void drawImage(ImageRenderer img, java.awt.geom.Rectangle2D srcBounds, java.awt.geom.Rectangle2D dstBounds)
public java.awt.geom.AffineTransform getInitTransform()
public java.awt.geom.AffineTransform getTransform()
public void setTransform(java.awt.geom.AffineTransform tx)
tx
- the current AffineTransformpublic void setClip(java.awt.Shape clip, HwmfRegionMode regionMode, boolean useInitialAT)
clip
- the next clipping region to be processedregionMode
- the mode and operation of how to apply the next clipping regionuseInitialAT
- if true, the clipping is applied on the initial (world) coordinate systempublic ImageRenderer getImageRenderer(java.lang.String contentType)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.