public class Line extends CanvasBase
若需要绘制复杂图形,请使用 Canvas 对象,并提供 Drawer实现,在Drawer中使用绘制上下文绘制。
若绘制简单矩形,可以使用 Div 对象设置边框 实现。
| 构造器和说明 |
|---|
Line(Double width,
Double height)
线对象
|
Line(double x,
double y,
double w,
double h)
线对象
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
draw(DrawContext ctx)
线条绘制器
|
double[] |
getBeginPoint()
获取线的起始点
|
double[] |
getEndPoint()
获取线的结束点
|
String |
getLineColor()
获取线的颜色
|
double |
getLineOpacity()
获取线的透明度
|
double |
getLineWidth()
获取线的宽度
|
Line |
setBeginPoint(double[] beginPoint)
设置线的起始点
|
Line |
setBeginPoint(double beginX,
double beginY)
设置线的起始点
|
Line |
setEndPoint(double[] endPoint)
设置线的结束点
|
Line |
setEndPoint(double endX,
double endY)
设置线的结束点
|
Line |
setLineColor(String lineColor)
设置线的颜色
|
Line |
setLineOpacity(double lineOpacity)
设置线的透明度
|
Line |
setLineWidth(double lineWidth)
设置线的宽度
|
doPrepare, elementType, getDrawer, getPreferBlock, setDrawer, setPreferBlockbox, clone, contentSplitAdjust, copyTo, getBackgroundColor, getBorder, getBorderBottom, getBorderColor, getBorderDash, getBorderLeft, getBorderRight, getBorderTop, getClear, getDisplay, getFloat, getHeight, getLayer, getLeft, getMargin, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getOnRenderFinish, getOpacity, getPadding, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getPosition, getRight, getTop, getWidth, getX, getY, heightPlus, isBlockElement, isIntegrity, isNoBorder, isPlaceholder, onRenderFinish, placeholder, placeholder, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBorder, setBorderBottom, setBorderColor, setBorderColor, setBorderColor, setBorderDash, setBorderLeft, setBorderRight, setBorderTop, setBox, setClear, setDisplay, setFloat, setHeight, setIntegrity, setLayer, setLeft, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setOpacity, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPlaceholder, setPosition, setRight, setTop, setWidth, setX, setXY, setY, split, toString, widthPluspublic Line(Double width, Double height)
width - 画线区域的宽度,单位:毫米mmheight - 画线区域高度,单位:毫米mmpublic Line(double x,
double y,
double w,
double h)
x - 画线区域左上角的x坐标,单位:毫米mmy - 画线区域左上角的y坐标,单位:毫米mmw - 画线区域的宽度,单位:毫米mmh - 画线区域高度,单位:毫米mmpublic double[] getBeginPoint()
public Line setBeginPoint(double[] beginPoint)
beginPoint - 线的起始点在画布上的坐标 [x, y]public Line setBeginPoint(double beginX, double beginY)
beginX - 线的起始点在画布上的x坐标,单位:毫米mmbeginY - 线的起始点在画布上的y坐标,单位:毫米mmpublic double[] getEndPoint()
public Line setEndPoint(double[] endPoint)
endPoint - 线的结束点在画布上的坐标 [x, y]public Line setEndPoint(double endX, double endY)
endX - 线的结束点在画布上的x坐标,单位:毫米mmendY - 线的结束点在画布上的y坐标,单位:毫米mmpublic String getLineColor()
public Line setLineColor(String lineColor)
lineColor - 线的颜色,格式:#000000、rgb(0,0,0)、rgba(0,0,0,1)、blackpublic double getLineWidth()
public Line setLineWidth(double lineWidth)
lineWidth - 线的宽度,单位 毫米mmpublic double getLineOpacity()
public Line setLineOpacity(double lineOpacity)
lineOpacity - 线的透明度,范围 [0,1]public void draw(DrawContext ctx) throws IOException
ctx - 绘制上下文IOException - 绘制异常Copyright © 2024. All rights reserved.