TextDevice
Inheritance: java.lang.Object, com.aspose.page.Device
All Implemented Interfaces: com.aspose.page.IMultiPageDevice
public class TextDevice extends Device implements IMultiPageDevice
构造函数
| 构造函数 | 描述 |
|---|---|
| TextDevice() |
字段
| 字段 | 描述 |
|---|---|
| DEFAULT_SIZE | |
| EMIT_ERRORS | |
| EMIT_WARNINGS | |
| VERSION | 当前设备版本。 |
方法
TextDevice()
public TextDevice()
DEFAULT_SIZE
public static final Dimension DEFAULT_SIZE
EMIT_ERRORS
public static final String EMIT_ERRORS
EMIT_WARNINGS
public static final String EMIT_WARNINGS
VERSION
public static String VERSION
当前设备版本。
closePage()
public void closePage()
在页面渲染后对设备进行必要的准备。
create()
public Device create()
创建此设备的副本。
Returns: Device
dispose()
public void dispose()
释放设备。
draw(Shape path)
public void draw(Shape path)
绘制路径。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| path | java.awt.Shape | 要绘制的路径。 |
drawArc(float x, float y, float width, float height, float startAngle, float arcAngle)
public void drawArc(float x, float y, float width, float height, float startAngle, float arcAngle)
绘制弧线。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| x | float | 弧中心的 X 坐标。 |
| y | float | 弧中心的 Y 坐标。 |
| 宽度 | float | 外接矩形的宽度。 |
| 高度 | float | 外接矩形的高度。 |
| startAngle | float | 弧的起始角度。 |
| arcAngle | float | 弧的角度。 |
drawImage(BufferedImage image, AffineTransform transform, Color bkg)
public void drawImage(BufferedImage image, AffineTransform transform, Color bkg)
绘制具有指定变换和背景的图像。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| image | java.awt.image.BufferedImage | 要绘制的图像。 |
| transform | java.awt.geom.AffineTransform | 变换。 |
| bkg | java.awt.Color | 背景颜色。 |
drawLine(float x1, float y1, float x2, float y2)
public void drawLine(float x1, float y1, float x2, float y2)
绘制线段。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| x1 | float | 线段起点的 X 坐标。 |
| y1 | float | 线段起点的 Y 坐标。 |
| x2 | float | 线段终点的 X 坐标。 |
| y2 | float | 线段终点的 Y 坐标。 |
drawOval(float x, float y, float width, float height)
public void drawOval(float x, float y, float width, float height)
绘制椭圆。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| x | float | 椭圆中心的 X 坐标。 |
| y | float | 椭圆中心的 Y 坐标。 |
| 宽度 | float | 外接矩形的宽度。 |
| 高度 | float | 外接矩形的高度。 |
drawPolygon(float[] xPoints, float[] yPoints, int nPoints)
public void drawPolygon(float[] xPoints, float[] yPoints, int nPoints)
绘制多边形。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| xPoints | float[] | 点的 X 坐标。 |
| yPoints | float[] | 点的 Y 坐标。 |
| nPoints | int | 点的数量。 |
drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
绘制多边形。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| xPoints | int[] | 点的 X 坐标。 |
| yPoints | int[] | 点的 Y 坐标。 |
| nPoints | int | 点的数量。 |
drawPolyline(float[] xPoints, float[] yPoints, int nPoints)
public void drawPolyline(float[] xPoints, float[] yPoints, int nPoints)
绘制折线。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| xPoints | float[] | 点的 X 坐标。 |
| yPoints | float[] | 点的 Y 坐标。 |
| nPoints | int | 点的数量。 |
drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
绘制折线。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| xPoints | int[] | 点的 X 坐标。 |
| yPoints | int[] | 点的 Y 坐标。 |
| nPoints | int | 点的数量。 |
drawRect(float x, float y, float width, float height)
public void drawRect(float x, float y, float width, float height)
绘制矩形。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| x | float | 矩形左上角的 X 坐标。 |
| y | float | 矩形左上角的 Y 坐标。 |
| 宽度 | float | 矩形的宽度。 |
| 高度 | float | 矩形的高度。 |
drawRoundRect(float x, float y, float width, float height, float arcWidth, float arcHeight)
public void drawRoundRect(float x, float y, float width, float height, float arcWidth, float arcHeight)
绘制圆角矩形。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| x | float | 矩形左上角的 X 坐标。 |
| y | float | 矩形左上角的 Y 坐标。 |
| 宽度 | float | 矩形的宽度。 |
| 高度 | float | 矩形的高度。 |
| arcWidth | float | 圆弧所围外接矩形的宽度。 |
| arcHeight | float | 圆弧所围外接矩形的高度。 |
drawString(String str, float x, float y)
public void drawString(String str, float x, float y)
在给定点绘制字符串。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| str | java.lang.String | |
| x | float | |
| y | float |
endDocument()
public void endDocument()
在文档渲染后进行设备的必要准备。
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| arg0 | java.lang.Object |
Returns: boolean
fill(Shape path)
public void fill(Shape path)
填充路径。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| path | java.awt.Shape | 要填充的路径。 |
fillArc(float x, float y, float width, float height, float startAngle, float arcAngle)
public void fillArc(float x, float y, float width, float height, float startAngle, float arcAngle)
填充弧形。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| x | float | 弧中心的 X 坐标。 |
| y | float | 弧中心的 Y 坐标。 |
| 宽度 | float | 外接矩形的宽度。 |
| 高度 | float | 外接矩形的高度。 |
| startAngle | float | 弧的起始角度。 |
| arcAngle | float | 弧的角度。 |
fillOval(float x, float y, float width, float height)
public void fillOval(float x, float y, float width, float height)
填充椭圆。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| x | float | 椭圆中心的 X 坐标。 |
| y | float | 椭圆中心的 Y 坐标。 |
| 宽度 | float | 外接矩形的宽度。 |
| 高度 | float | 外接矩形的高度。 |
fillPolygon(float[] xPoints, float[] yPoints, int nPoints)
public void fillPolygon(float[] xPoints, float[] yPoints, int nPoints)
填充多边形。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| xPoints | float[] | 点的 X 坐标。 |
| yPoints | float[] | 点的 Y 坐标。 |
| nPoints | int | 点的数量。 |
fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
填充多边形。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| xPoints | int[] | 点的 X 坐标。 |
| yPoints | int[] | 点的 Y 坐标。 |
| nPoints | int | 点的数量。 |
fillRect(float x, float y, float width, float height)
public void fillRect(float x, float y, float width, float height)
填充矩形。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| x | float | 矩形左上角的 X 坐标。 |
| y | float | 矩形左上角的 Y 坐标。 |
| 宽度 | float | 矩形的宽度。 |
| 高度 | float | 矩形的高度。 |
fillRoundRect(float x, float y, float width, float height, float arcWidth, float arcHeight)
public void fillRoundRect(float x, float y, float width, float height, float arcWidth, float arcHeight)
绘制圆角矩形。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| x | float | 矩形左上角的 X 坐标。 |
| y | float | 矩形左上角的 Y 坐标。 |
| 宽度 | float | 矩形的宽度。 |
| 高度 | float | 矩形的高度。 |
| arcWidth | float | 圆弧所围外接矩形的宽度。 |
| arcHeight | float | 圆弧所围外接矩形的高度。 |
getBackground()
public Color getBackground()
获取页面的当前背景。
Returns: java.awt.Color - 页面当前的背景颜色
getCharTM()
public AffineTransform getCharTM()
获取当前字符变换。
Returns: java.awt.geom.AffineTransform - 当前字符的变换。
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
getCreator()
public String getCreator()
获取结果设备输出的创建者。
Returns: java.lang.String - 创建者值。
getCurrentPageNumber()
public int getCurrentPageNumber()
获取当前页码。
Returns: int
getFont()
public ITrFont getFont()
获取当前字体。
Returns: ITrFont - Current font.
getOpacity()
public float getOpacity()
获取当前不透明度。
Returns: float - 当前不透明度。
getOpacityMask()
public Paint getOpacityMask()
获取当前不透明度遮罩。
Returns: java.awt.Paint - 当前不透明度遮罩。
getPages()
public List<String> getPages()
Returns: java.util.List<java.lang.String>
getPaint()
public Paint getPaint()
获取当前绘图。
Returns: java.awt.Paint - 当前绘图。
getProperties()
public UserProperties getProperties()
获取包括元数据在内的设备属性。
Returns: UserProperties - Device properties.
getProperty(String key)
public String getProperty(String key)
获取字符串属性的值。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 键 | java.lang.String | 属性的名称。 |
Returns: java.lang.String - 属性值。
getPropertyColor(String key)
public Color getPropertyColor(String key)
获取颜色属性的值。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 键 | java.lang.String | 属性的名称。 |
Returns: java.awt.Color - 属性值。
getPropertyDouble(String key)
public double getPropertyDouble(String key)
获取双精度属性的值。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 键 | java.lang.String | 属性的名称。 |
Returns: double - 属性值。
getPropertyInt(String key)
public int getPropertyInt(String key)
获取整数属性的值。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 键 | java.lang.String | 属性的名称。 |
Returns: int - 属性值。
getPropertyMargins(String key)
public Insets getPropertyMargins(String key)
获取边距属性的值。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 键 | java.lang.String | 属性的名称。 |
Returns: java.awt.Insets - 属性值。
getPropertyMatrix(String key)
public AffineTransform getPropertyMatrix(String key)
获取矩阵属性的值。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 键 | java.lang.String | 属性的名称。 |
Returns: java.awt.geom.AffineTransform - 属性值。
getPropertyRectangle(String key)
public Rectangle getPropertyRectangle(String key)
获取矩形属性的值。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 键 | java.lang.String | 属性的名称。 |
Returns: java.awt.Rectangle - 属性值。
getPropertySize(String key)
public Dimension getPropertySize(String key)
获取大小属性的值。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 键 | java.lang.String | 属性的名称。 |
Returns: java.awt.Dimension - 属性值。
getSaveOptions()
public SaveOptions getSaveOptions()
返回保存选项。
Returns: SaveOptions - The save options.
getSize()
public Dimension getSize()
获取页面的尺寸。
Returns: java.awt.Dimension - 页面大小。
getStroke()
public Stroke getStroke()
获取当前笔触。
Returns: java.awt.Stroke - 当前描边。
getText()
public String getText()
Returns: java.lang.String
getText(int startPage, int endPage)
public String getText(int startPage, int endPage)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| startPage | int | |
| endPage | int |
Returns: java.lang.String
getTextRenderingMode()
public TextRenderingMode getTextRenderingMode()
获取当前文本渲染模式。
Returns: TextRenderingMode - Current text rendering mode.
getTextStrokeWidth()
public float getTextStrokeWidth()
获取当前文本笔画宽度。
Returns: float - 当前文本笔画宽度。
getTransform()
public AffineTransform getTransform()
获取当前变换。
Returns: java.awt.geom.AffineTransform - 当前变换。
hashCode()
public native int hashCode()
Returns: int
initClip()
public void initClip()
初始化设备的剪裁。
initPageNumbers()
public void initPageNumbers()
初始化要渲染的页数。
isDirectRGB()
public boolean isDirectRGB()
指示设备是否使用直接 RGB 模式,即 RGB。
Returns: boolean
isMainDocument()
public boolean isMainDocument()
Returns: boolean
isProperty(String key)
public boolean isProperty(String key)
获取布尔属性的值。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 键 | java.lang.String | 属性的名称。 |
Returns: boolean - 属性值。
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
openPage(float width, float height)
public boolean openPage(float width, float height)
在页面渲染之前对设备进行必要的准备。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 宽度 | float | |
| 高度 | float |
Returns: boolean
openPage(String title)
public boolean openPage(String title)
在页面渲染之前对设备进行必要的准备。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 标题 | java.lang.String |
Returns: boolean
renew()
public void renew()
将设备重置为整个文档的初始状态。用于重置输出流。
renewForMerge(boolean mainDocument)
public void renewForMerge(boolean mainDocument)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 主文档 | boolean |
reset()
public void reset()
将设备重置为页面的初始状态。
reset(boolean zeroPageNumbers)
public void reset(boolean zeroPageNumbers)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 零页码 | boolean |
rotate(double theta)
public void rotate(double theta)
旋转当前变换矩阵。调用 writeTransform(Transform)。使用正角度 theta 旋转会将点从正 x 轴方向旋转到正 y 轴方向。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| theta | double | 要旋转的弧度角度。 |
rotate(double theta, double x, double y)
public void rotate(double theta, double x, double y)
围绕一点旋转当前变换矩阵。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| theta | double | 弧度制的旋转角度。 |
| x | double | 点的 X 坐标。 |
| y | double | 点的 Y 坐标。 |
scale(double x, double y)
public void scale(double x, double y)
缩放当前的变换矩阵。调用 writeTransform(Transform)。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| x | double | X 轴的缩放。 |
| y | double | Y 轴的缩放。 |
setBackground(Color background)
public void setBackground(Color background)
指定页面的当前背景。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 背景 | java.awt.Color | 页面的背景。 |
setCharTM(AffineTransform charTM)
public void setCharTM(AffineTransform charTM)
指定字符变换。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| charTM | java.awt.geom.AffineTransform | \u0421字符变换。 |
setClip(Shape clipPath)
public void setClip(Shape clipPath)
指定设备的剪裁。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| clipPath | java.awt.Shape | 裁剪路径。 |
setCreator(String creator)
public void setCreator(String creator)
指定生成设备输出的创建者。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| creator | java.lang.String | 创建者值。 |
setFont(ITrFont font)
public void setFont(ITrFont font)
指定字体。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| font | ITrFont | 字体。 |
setOpacity(float opacity)
public void setOpacity(float opacity)
指定不透明度。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| opacity | float | 不透明度。 |
setOpacityMask(Paint opacityMask)
public void setOpacityMask(Paint opacityMask)
指定不透明度蒙版。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| opacityMask | java.awt.Paint | 一个不透明度蒙版。 |
setPaint(Paint paint)
public void setPaint(Paint paint)
指定绘画。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| paint | java.awt.Paint | 一种绘画。 |
setProperties(UserProperties props)
public void setProperties(UserProperties props)
指定包括元数据在内的设备属性。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| props | UserProperties | 设备属性。 |
setSaveOptions(SaveOptions options)
public void setSaveOptions(SaveOptions options)
指定用于管理渲染过程的选项。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| options | SaveOptions | 用于管理渲染过程的选项。 |
setSize(Dimension size)
public void setSize(Dimension size)
指定页面大小。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 大小 | java.awt.Dimension |
setStroke(Stroke stroke)
public void setStroke(Stroke stroke)
指定笔画。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| stroke | java.awt.Stroke | 一个描边。 |
setTextRenderingMode(TextRenderingMode textRenderingMode)
public void setTextRenderingMode(TextRenderingMode textRenderingMode)
指定文本渲染模式。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| textRenderingMode | TextRenderingMode | 文本渲染模式。 |
setTextStrokeWidth(float textStrokeWidth)
public void setTextStrokeWidth(float textStrokeWidth)
指定文本笔画宽度。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| textStrokeWidth | float | 文本描边宽度。 |
setTransform(AffineTransform transform)
public void setTransform(AffineTransform transform)
指定当前变换。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| transform | java.awt.geom.AffineTransform | 一个变换.. |
shear(double shx, double shy)
public void shear(double shx, double shy)
剪切当前的变换矩阵。调用 writeTransform(Transform)。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| shx | double | X 轴的剪切。 |
| shy | double | Y 轴的剪切。 |
startDocument()
public void startDocument()
在开始渲染文档之前,对设备进行必要的准备。
toString()
public String toString()
返回设备类型的名称。
Returns: java.lang.String
transform(AffineTransform transform)
public void transform(AffineTransform transform)
变换当前的变换矩阵。调用 writeTransform(Transform)。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| transform | java.awt.geom.AffineTransform | 要应用的变换。 |
translate(double x, double y)
public void translate(double x, double y)
平移当前的变换矩阵。调用 writeTransform(Transform)。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| x | double | X 轴的平移。 |
| y | double | Y 轴的平移。 |
updatePageParameters(IMultiPageDevice device)
public void updatePageParameters(IMultiPageDevice device)
从其他多页设备更新页面参数。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| device | IMultiPageDevice |
wait()
public final void wait()
wait(long arg0)
public final native void wait(long arg0)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| arg0 | long | |
| arg1 | int |
writeComment(String comment)
public void writeComment(String comment)
写入注释。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 注释 | java.lang.String | 要写入的注释。 |
writeString(ITrFont font, String str)
public void writeString(ITrFont font, String str)
使用指定字体写出字符串。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| font | ITrFont | 指定的字体。 |
| str | java.lang.String | 该字符串。 |
writeWarning(String warning)
public void writeWarning(String warning)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 警告 | java.lang.String |