Class PdfLine

java.lang.Object
cloud.opencode.base.pdf.content.PdfLine
All Implemented Interfaces:
PdfElement

public final class PdfLine extends Object implements 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:
  • Method Details

    • of

      public static PdfLine of(float x1, float y1, float x2, float y2)
      Creates a line from point to point 从一点到另一点创建线条
      Parameters:
      x1 - start x | 起点 x
      y1 - start y | 起点 y
      x2 - end x | 终点 x
      y2 - end y | 终点 y
      Returns:
      PdfLine instance | PdfLine 实例
    • builder

      public static PdfLine builder()
      Creates a line builder 创建线条构建器
      Returns:
      new PdfLine instance | 新 PdfLine 实例
    • from

      public PdfLine from(float x, float y)
    • to

      public PdfLine to(float x, float y)
    • lineWidth

      public PdfLine lineWidth(float width)
    • color

      public PdfLine color(PdfColor color)
    • style

      public PdfLine style(PdfLine.LineStyle style)
    • getX

      public float getX()
      Description copied from interface: PdfElement
      Gets the x coordinate of this element 获取元素的 x 坐标
      Specified by:
      getX in interface PdfElement
      Returns:
      x coordinate | x 坐标
    • getY

      public float getY()
      Description copied from interface: PdfElement
      Gets the y coordinate of this element 获取元素的 y 坐标
      Specified by:
      getY in interface PdfElement
      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

      public PdfColor getColor()
    • getStyle

      public PdfLine.LineStyle getStyle()