Class PdfLine
java.lang.Object
cloud.opencode.base.pdf.content.PdfLine
- All Implemented Interfaces:
PdfElement
PDF Line Element - Line graphic
PDF 线条元素 - 线条图形
Features | 主要功能:
- Line from point to point - 从一点到另一点的线条
- Line width and color customization - 线宽和颜色自定义
- Line style (solid, dashed, dotted) - 线条样式(实线、虚线、点线)
Usage Examples | 使用示例:
PdfLine line = PdfLine.of(50, 700, 550, 700)
.lineWidth(2f)
.color(PdfColor.RED)
.style(LineStyle.DASHED);
Security | 安全性:
- Thread-safe: No — mutable builder pattern - 线程安全: 否 — 可变构建器模式
- Null-safe: No — callers must ensure non-null values - 空值安全: 否 — 调用方需确保非空值
- Since:
- JDK 25, opencode-base-pdf V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic PdfLinebuilder()Creates a line builder 创建线条构建器from(float x, float y) getColor()floatgetStyle()floatgetX()Gets the x coordinate of this element 获取元素的 x 坐标floatgetX1()floatgetX2()floatgetY()Gets the y coordinate of this element 获取元素的 y 坐标floatgetY1()floatgetY2()lineWidth(float width) static PdfLineof(float x1, float y1, float x2, float y2) Creates a line from point to point 从一点到另一点创建线条style(PdfLine.LineStyle style) to(float x, float y)
-
Method Details
-
of
Creates a line from point to point 从一点到另一点创建线条- Parameters:
x1- start x | 起点 xy1- start y | 起点 yx2- end x | 终点 xy2- end y | 终点 y- Returns:
- PdfLine instance | PdfLine 实例
-
builder
Creates a line builder 创建线条构建器- Returns:
- new PdfLine instance | 新 PdfLine 实例
-
from
-
to
-
lineWidth
-
color
-
style
-
getX
public float getX()Description copied from interface:PdfElementGets the x coordinate of this element 获取元素的 x 坐标- Specified by:
getXin interfacePdfElement- Returns:
- x coordinate | x 坐标
-
getY
public float getY()Description copied from interface:PdfElementGets the y coordinate of this element 获取元素的 y 坐标- Specified by:
getYin interfacePdfElement- Returns:
- y coordinate | y 坐标
-
getX1
public float getX1() -
getY1
public float getY1() -
getX2
public float getX2() -
getY2
public float getY2() -
getLineWidth
public float getLineWidth() -
getColor
-
getStyle
-