Class PdfRectangle
java.lang.Object
cloud.opencode.base.pdf.content.PdfRectangle
- All Implemented Interfaces:
PdfElement
PDF Rectangle Element - Rectangle graphic
PDF 矩形元素 - 矩形图形
Features | 主要功能:
- Rectangle with position and size - 带位置和大小的矩形
- Stroke and fill color configuration - 描边和填充颜色配置
- Rounded corner support - 圆角支持
Usage Examples | 使用示例:
PdfRectangle rect = PdfRectangle.of(100, 500, 200, 100)
.fillColor(PdfColor.LIGHT_GRAY)
.strokeColor(PdfColor.BLACK)
.cornerRadius(5f);
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:
-
Method Summary
Modifier and TypeMethodDescriptionstatic PdfRectanglebuilder()Creates a rectangle builder 创建矩形构建器cornerRadius(float radius) floatfloatfloatfloatgetWidth()floatgetX()Gets the x coordinate of this element 获取元素的 x 坐标floatgetY()Gets the y coordinate of this element 获取元素的 y 坐标booleanisFilled()static PdfRectangleof(float x, float y, float width, float height) Creates a rectangle 创建矩形position(float x, float y) size(float width, float height) strokeColor(PdfColor color) strokeWidth(float width)
-
Method Details
-
of
Creates a rectangle 创建矩形- Parameters:
x- x coordinate | x 坐标y- y coordinate | y 坐标width- width | 宽度height- height | 高度- Returns:
- PdfRectangle instance | PdfRectangle 实例
-
builder
Creates a rectangle builder 创建矩形构建器- Returns:
- new PdfRectangle instance | 新 PdfRectangle 实例
-
position
-
size
-
strokeColor
-
fillColor
-
strokeWidth
-
cornerRadius
-
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 坐标
-
getWidth
public float getWidth() -
getHeight
public float getHeight() -
getStrokeColor
-
getFillColor
-
getStrokeWidth
public float getStrokeWidth() -
getCornerRadius
public float getCornerRadius() -
isFilled
public boolean isFilled()
-