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.
(将 HwmfObjectTableEntry 类型的记录添加到对象表中。)
|
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
(设置当前的 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.
(取消设置(删除)对象表条目以供进一步使用 当接收到指定此对象的特定索引的 META_DELETEOBJECT 记录(第 2.3.4.7 节)时,释放对象的资源,结束与其 WMF 对象表索引的绑定,并且索引值返回到可用索引池。)
|
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 calls
(graphicsCtx - 委托绘图调用的图形上下文)
bbox
- the bounding box of the wmf (taken from the placeable header)
(bbox - wmf 的边界框(取自可放置的标题))
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.
(将 HwmfObjectTableEntry 类型的记录添加到对象表中。每个对象都被分配了 WMF 对象表中最低的可用索引,即最小的数值。此绑定发生在对象创建时,而不是在使用对象时。此外,每个对象表索引唯一地引用一个对象。 WMF 对象表中的索引始终从 0 开始。)
entry
- the object table entry
(entry - 对象表项)
public void applyObjectTableEntry(int index)
index
- the index of the object table entry (0-based)
(index - 对象表条目的索引(从 0 开始))
java.lang.IndexOutOfBoundsException
- if the index is out of range
(java.lang.IndexOutOfBoundsException - 如果索引超出范围)
java.util.NoSuchElementException
- if the entry was deleted before
(java.util.NoSuchElementException - 如果条目之前被删除)
public void unsetObjectTableEntry(int index)
index
- the index (0-based)
(index - 索引(从 0 开始))
java.lang.IndexOutOfBoundsException
- if the index is out of range
(java.lang.IndexOutOfBoundsException - 如果索引超出范围)
public 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.
(index - 如果索引为正,则激活从开始的第 n 个元素。如果索引为负数,则激活相对于当前属性元素的第 n 个先前元素。)
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
(接口 HwmfCharsetAware 中的 setCharsetProvider)
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 AffineTransform
(tx - 当前的 AffineTransform)
public void setClip(java.awt.Shape clip, HwmfRegionMode regionMode, boolean useInitialAT)
clip
- the next clipping region to be processed
(clip - 下一个要处理的剪辑区域)
regionMode
- the mode and operation of how to apply the next clipping region
(regionMode - 如何应用下一个剪辑区域的模式和操作)
useInitialAT
- if true, the clipping is applied on the initial (world) coordinate system
(useInitialAT - 如果为 true,则在初始(世界)坐标系上应用剪裁)
public ImageRenderer getImageRenderer(java.lang.String contentType)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.