Skip to content

Commit fd79d9f

Browse files
committed
Cover several layout properties with documentation
DEVSIX-6639
1 parent 30c6c9e commit fd79d9f

File tree

6 files changed

+83
-3
lines changed

6 files changed

+83
-3
lines changed

layout/src/main/java/com/itextpdf/layout/properties/BackgroundImage.java

+26
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ This file is part of the iText (R) project.
4848
import com.itextpdf.kernel.pdf.xobject.PdfXObject;
4949
import com.itextpdf.layout.properties.BackgroundRepeat.BackgroundRepeatValue;
5050

51+
/**
52+
* Class to hold background-image property.
53+
*/
5154
public class BackgroundImage {
5255

5356
private static final BlendMode DEFAULT_BLEND_MODE = BlendMode.NORMAL;
@@ -84,10 +87,20 @@ public BackgroundImage(BackgroundImage backgroundImage) {
8487
backgroundImage.getBackgroundOrigin());
8588
}
8689

90+
/**
91+
* Gets initial image if it is instanceof {@link PdfImageXObject}, otherwise returns null.
92+
*
93+
* @return {@link PdfImageXObject}
94+
*/
8795
public PdfImageXObject getImage() {
8896
return image instanceof PdfImageXObject ? (PdfImageXObject) image : null;
8997
}
9098

99+
/**
100+
* Gets initial image if it is instanceof {@link PdfFormXObject}, otherwise returns null.
101+
*
102+
* @return {@link PdfFormXObject}
103+
*/
91104
public PdfFormXObject getForm() {
92105
return image instanceof PdfFormXObject ? (PdfFormXObject) image : null;
93106
}
@@ -128,10 +141,20 @@ public BackgroundPosition getBackgroundPosition() {
128141
return position;
129142
}
130143

144+
/**
145+
* Gets linearGradientBuilder.
146+
*
147+
* @return {@link AbstractLinearGradientBuilder}
148+
*/
131149
public AbstractLinearGradientBuilder getLinearGradientBuilder() {
132150
return this.linearGradientBuilder;
133151
}
134152

153+
/**
154+
* Returns is background specified.
155+
*
156+
* @return {@code true} if background is specified, otherwise false
157+
*/
135158
public boolean isBackgroundSpecified() {
136159
return image instanceof PdfFormXObject || image instanceof PdfImageXObject || linearGradientBuilder != null;
137160
}
@@ -213,6 +236,9 @@ public static class Builder {
213236
private BackgroundBox clip = BackgroundBox.BORDER_BOX;
214237
private BackgroundBox origin = BackgroundBox.PADDING_BOX;
215238

239+
/**
240+
* Creates a new {@link Builder} instance.
241+
*/
216242
public Builder() {
217243
}
218244

layout/src/main/java/com/itextpdf/layout/properties/BackgroundPosition.java

+6
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,18 @@ private static float calculateValue(UnitValue value, float fullValue) {
239239
return value.isPercentValue() ? (value.getValue() / 100 * fullValue) : value.getValue();
240240
}
241241

242+
/**
243+
* A specialized enum containing positions in x-dimension (horizontal positions).
244+
*/
242245
public static enum PositionX {
243246
LEFT,
244247
RIGHT,
245248
CENTER
246249
}
247250

251+
/**
252+
* A specialized enum containing positions in y-dimension (vertical positions).
253+
*/
248254
public static enum PositionY {
249255
TOP,
250256
BOTTOM,

layout/src/main/java/com/itextpdf/layout/properties/BackgroundSize.java

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public class BackgroundSize {
4444
*/
4545
private boolean contain;
4646

47+
/**
48+
* Creates a new {@link BackgroundSize} instance.
49+
* The "cover" and "contain" properties are not set.
50+
*/
4751
public BackgroundSize() {
4852
cover = false;
4953
contain = false;

layout/src/main/java/com/itextpdf/layout/properties/ListSymbolPosition.java

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ This file is part of the iText (R) project.
4242
*/
4343
package com.itextpdf.layout.properties;
4444

45+
/**
46+
* A specialized enum containing position properties for list symbols.
47+
*/
4548
public enum ListSymbolPosition {
4649
DEFAULT,
4750
INSIDE,

layout/src/main/java/com/itextpdf/layout/properties/OverflowWrapPropertyValue.java

+11
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ This file is part of the iText (R) project.
2323

2424
package com.itextpdf.layout.properties;
2525

26+
/**
27+
* The possible values for the overflow wrap property.
28+
*
29+
* <p>
30+
* {@link OverflowWrapPropertyValue#ANYWHERE} and {@link OverflowWrapPropertyValue#BREAK_WORD}
31+
* mean that long words will break if they overflow the container.
32+
*
33+
* <p>
34+
* {@link OverflowWrapPropertyValue#NORMAL} means that long words will not break,
35+
* even if they overflow the container.
36+
*/
2637
public enum OverflowWrapPropertyValue {
2738
ANYWHERE,
2839
BREAK_WORD,

layout/src/main/java/com/itextpdf/layout/properties/TransparentColor.java

+33-3
Original file line numberDiff line numberDiff line change
@@ -46,33 +46,63 @@ This file is part of the iText (R) project.
4646
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
4747
import com.itextpdf.kernel.pdf.extgstate.PdfExtGState;
4848

49+
/**
50+
* Represents a color with the specified opacity.
51+
*/
4952
public class TransparentColor {
5053
private Color color;
5154
private float opacity;
52-
55+
56+
/**
57+
* Creates a new {@link TransparentColor} instance of certain fully opaque color.
58+
*
59+
* @param color the {@link Color} of the created {@link TransparentColor} object
60+
*/
5361
public TransparentColor(Color color) {
5462
this.color = color;
5563
this.opacity = 1f;
5664
}
57-
65+
66+
/**
67+
* Creates a new {@link TransparentColor}.
68+
*
69+
* @param color the {@link Color} of the created {@link TransparentColor} object
70+
* @param opacity a float defining the opacity of the color; a float between 0 and 1,
71+
* where 1 stands for fully opaque color and 0 - for fully transparent
72+
*/
5873
public TransparentColor(Color color, float opacity) {
5974
this.color = color;
6075
this.opacity = opacity;
6176
}
6277

78+
/**
79+
* Gets the color.
80+
* @return a {@link Color}
81+
*/
6382
public Color getColor() {
6483
return color;
6584
}
6685

86+
/**
87+
* Gets the opacity of color.
88+
* @return a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
89+
*/
6790
public float getOpacity() {
6891
return opacity;
6992
}
7093

94+
/**
95+
* Sets the opacity value for <b>non-stroking</b> operations in the transparent imaging model.
96+
* @param canvas the {@link PdfCanvas} to be written to
97+
*/
7198
public void applyFillTransparency(PdfCanvas canvas) {
7299
applyTransparency(canvas, false);
73-
74100
}
75101

102+
/**
103+
* Sets the opacity value for <b>stroking</b> operations in the transparent imaging model.
104+
* @param canvas the {@link PdfCanvas} to be written to
105+
*/
76106
public void applyStrokeTransparency(PdfCanvas canvas) {
77107
applyTransparency(canvas, true);
78108
}

0 commit comments

Comments
 (0)