Record Class FixedDocument.Line
java.lang.Object
java.lang.Record
io.leandev.appfuse.pdf.FixedDocument.Line
- All Implemented Interfaces:
FixedDocument.Element
- Enclosing class:
FixedDocument
public static record FixedDocument.Line(String id, FixedDocument.Layer layer, double x1, double y1, double x2, double y2, double strokePt, int rgb, List<Double> dashPatternPt, double dashPhasePt)
extends Record
implements FixedDocument.Element
任意方向線段,可用於撕線、點線或虛線分隔。
dashPatternPt 為交替的線段與空白長度(pt,與線寬同單位);空清單為實線,奇數個元素由 PDF 重複兩次形成週期。
dashPhasePt 為週期起點偏移,實線必須為 0。整條線以單一路徑繪製,不需拆段。
- Since:
- 4.0.0
-
Field Summary
FieldsModifier and TypeFieldDescription舊版dashed=true的固定線型:3 pt 線段/3 pt 空白。 -
Constructor Summary
ConstructorsConstructorDescriptionLine(String id, FixedDocument.Layer layer, double x1, double y1, double x2, double y2, double strokePt, int rgb, boolean dashed) 保留既有建構器;dashed 為 true 時使用DEFAULT_DASH。Line(String id, FixedDocument.Layer layer, double x1, double y1, double x2, double y2, double strokePt, int rgb, List<Double> dashPatternPt, double dashPhasePt) Creates an instance of aLinerecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleandashed()Returns the value of thedashPatternPtrecord component.doubleReturns the value of thedashPhasePtrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.layer()Returns the value of thelayerrecord component.intrgb()Returns the value of thergbrecord component.doublestrokePt()Returns the value of thestrokePtrecord component.final StringtoString()Returns a string representation of this record class.doublex1()Returns the value of thex1record component.doublex2()Returns the value of thex2record component.doubley1()Returns the value of they1record component.doubley2()Returns the value of they2record component.
-
Field Details
-
DEFAULT_DASH
-
-
Constructor Details
-
Line
public Line(String id, FixedDocument.Layer layer, double x1, double y1, double x2, double y2, double strokePt, int rgb, List<Double> dashPatternPt, double dashPhasePt) Creates an instance of aLinerecord class.- Parameters:
id- the value for theidrecord componentlayer- the value for thelayerrecord componentx1- the value for thex1record componenty1- the value for they1record componentx2- the value for thex2record componenty2- the value for they2record componentstrokePt- the value for thestrokePtrecord componentrgb- the value for thergbrecord componentdashPatternPt- the value for thedashPatternPtrecord componentdashPhasePt- the value for thedashPhasePtrecord component
-
Line
public Line(String id, FixedDocument.Layer layer, double x1, double y1, double x2, double y2, double strokePt, int rgb, boolean dashed) 保留既有建構器;dashed 為 true 時使用DEFAULT_DASH。
-
-
Method Details
-
dashed
public boolean dashed()- Returns:
- 是否為非實線
-
withDash
- Parameters:
patternPt- 交替的線段/空白長度(pt);空清單為實線phasePt- 非負起點偏移(pt)- Returns:
- 只改線型的新線段
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
id
Returns the value of theidrecord component.- Specified by:
idin interfaceFixedDocument.Element- Returns:
- the value of the
idrecord component
-
layer
Returns the value of thelayerrecord component.- Specified by:
layerin interfaceFixedDocument.Element- Returns:
- the value of the
layerrecord component
-
x1
public double x1()Returns the value of thex1record component.- Returns:
- the value of the
x1record component
-
y1
public double y1()Returns the value of they1record component.- Returns:
- the value of the
y1record component
-
x2
public double x2()Returns the value of thex2record component.- Returns:
- the value of the
x2record component
-
y2
public double y2()Returns the value of they2record component.- Returns:
- the value of the
y2record component
-
strokePt
public double strokePt()Returns the value of thestrokePtrecord component.- Returns:
- the value of the
strokePtrecord component
-
rgb
public int rgb()Returns the value of thergbrecord component.- Returns:
- the value of the
rgbrecord component
-
dashPatternPt
-
dashPhasePt
public double dashPhasePt()Returns the value of thedashPhasePtrecord component.- Returns:
- the value of the
dashPhasePtrecord component
-