Skip to content

Commit f89665b

Browse files
committed
Add javadoc for color classes in kernel
DEVSIX-8138
1 parent d293b69 commit f89665b

File tree

8 files changed

+188
-8
lines changed

8 files changed

+188
-8
lines changed

kernel/src/main/java/com/itextpdf/kernel/colors/CalGray.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,49 @@ This file is part of the iText (R) project.
2424

2525
import com.itextpdf.kernel.pdf.colorspace.PdfCieBasedCs;
2626

27+
/**
28+
* Representation of a CalGray color space.
29+
*/
2730
public class CalGray extends Color {
2831

2932

33+
/**
34+
* Creates a new CalGray color space using the given {@link PdfCieBasedCs} color space.
35+
*
36+
* @param cs Color space
37+
*/
3038
public CalGray(PdfCieBasedCs.CalGray cs) {
3139
this(cs, 0f);
3240
}
3341

42+
/**
43+
* Creates a new CalGray color space using the given {@link PdfCieBasedCs} color space and color value.
44+
*
45+
* @param cs Color space
46+
* @param value Gray color value
47+
*/
3448
public CalGray(PdfCieBasedCs.CalGray cs, float value) {
3549
super(cs, new float[]{value});
3650
}
3751

52+
/**
53+
* Creates a new CalGray color space using the given white point and color value.
54+
*
55+
* @param whitePoint Color values for defining the white point
56+
* @param value Gray color value
57+
*/
3858
public CalGray(float[] whitePoint, float value) {
3959
super(new PdfCieBasedCs.CalGray(whitePoint), new float[]{value});
4060
}
4161

62+
/**
63+
* Creates a new CalGray color space using the given white point, black point, gamma and color value.
64+
*
65+
* @param whitePoint Color values for defining the white point
66+
* @param blackPoint Color values for defining the black point
67+
* @param gamma Gamma correction
68+
* @param value Gray color value
69+
*/
4270
public CalGray(float[] whitePoint, float[] blackPoint, float gamma, float value) {
4371
this(new PdfCieBasedCs.CalGray(whitePoint, blackPoint, gamma), value);
4472
}

kernel/src/main/java/com/itextpdf/kernel/colors/CalRgb.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,50 @@ This file is part of the iText (R) project.
2424

2525
import com.itextpdf.kernel.pdf.colorspace.PdfCieBasedCs;
2626

27+
/**
28+
* Representation of a CalRgb color space.
29+
*/
2730
public class CalRgb extends Color {
2831

2932

33+
/**
34+
* Creates a new CalRgb color using the given {@link PdfCieBasedCs} color space.
35+
*
36+
* @param cs Color space
37+
*/
3038
public CalRgb(PdfCieBasedCs.CalRgb cs) {
3139
this(cs, new float[cs.getNumberOfComponents()]);
3240
}
3341

42+
/**
43+
* Creates a new CalRgb color using the given {@link PdfCieBasedCs} color space and RGB color values.
44+
*
45+
* @param cs Color space
46+
* @param value RGB color values
47+
*/
3448
public CalRgb(PdfCieBasedCs.CalRgb cs, float[] value) {
3549
super(cs, value);
3650
}
3751

52+
/**
53+
* Creates a new CalRgb color using the given white point and RGB color values.
54+
*
55+
* @param whitePoint Color values for defining the white point
56+
* @param value RGB color values
57+
*/
3858
public CalRgb(float[] whitePoint, float[] value) {
3959
super(new PdfCieBasedCs.CalRgb(whitePoint), value);
4060
}
4161

62+
/**
63+
* Creates a new CalRgb color using the given white point, black point, gamma, matrix and RGB color values.
64+
*
65+
* @param whitePoint Color values for defining the white point
66+
* @param blackPoint Color values for defining the black point
67+
* @param gamma Gamma correction
68+
* @param matrix Matrix correction
69+
* @param value RGB color value
70+
*/
4271
public CalRgb(float[] whitePoint, float[] blackPoint, float[] gamma, float[] matrix, float[] value) {
4372
this(new PdfCieBasedCs.CalRgb(whitePoint, blackPoint, gamma, matrix), value);
4473
}

kernel/src/main/java/com/itextpdf/kernel/colors/DeviceN.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,38 @@ This file is part of the iText (R) project.
2929
import java.util.Arrays;
3030
import java.util.List;
3131

32+
/**
33+
* Representation of a DeviceN color space.
34+
*/
3235
public class DeviceN extends Color {
3336

3437

38+
/**
39+
* Creates a DeviceN color using the given {@link PdfSpecialCs} color space.
40+
*
41+
* @param cs Color space
42+
*/
3543
public DeviceN(PdfSpecialCs.DeviceN cs) {
3644
this(cs, getDefaultColorants(cs.getNumberOfComponents()));
3745
}
3846

47+
/**
48+
* Creates a DeviceN color using the given {@link PdfSpecialCs} color space and color values.
49+
*
50+
* @param cs Color space
51+
* @param value Color component values
52+
*/
3953
public DeviceN(PdfSpecialCs.DeviceN cs, float[] value) {
4054
super(cs, value);
4155
}
4256

4357
/**
4458
* Creates a color in a new DeviceN color space.
4559
*
46-
* @param names the names oif the components
47-
* @param alternateCs the alternate color space
60+
* @param names the names oif the components
61+
* @param alternateCs the alternate color space
4862
* @param tintTransform the function to transform color to the alternate color space
49-
* @param value the values for the components of this color
63+
* @param value the values for the components of this color
5064
*/
5165
public DeviceN(List<String> names, PdfColorSpace alternateCs, IPdfFunction tintTransform, float[] value) {
5266
this(new PdfSpecialCs.DeviceN(names, alternateCs, tintTransform), value);

kernel/src/main/java/com/itextpdf/kernel/colors/IccBased.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,27 @@ This file is part of the iText (R) project.
2828

2929
import java.io.InputStream;
3030

31+
/**
32+
* Representation on an ICC Based color space.
33+
*/
3134
public class IccBased extends Color {
3235

3336

37+
/**
38+
* Creates an ICC Based color using the given {@link PdfCieBasedCs} color space.
39+
*
40+
* @param cs Color space
41+
*/
3442
public IccBased(PdfCieBasedCs.IccBased cs) {
3543
this(cs, new float[cs.getNumberOfComponents()]);
3644
}
3745

46+
/**
47+
* Creates an ICC Based color using the given {@link PdfCieBasedCs} color space and color values.
48+
*
49+
* @param cs Color space
50+
* @param value Color values
51+
*/
3852
public IccBased(PdfCieBasedCs.IccBased cs, float[] value) {
3953
super(cs, value);
4054
}
@@ -61,6 +75,13 @@ public IccBased(InputStream iccStream, float[] value) {
6175
this(new PdfCieBasedCs.IccBased(iccStream), value);
6276
}
6377

78+
/**
79+
* Creates an ICC Based color using the given ICC profile stream, range and color values.
80+
*
81+
* @param iccStream ICC profile stream. User is responsible for closing the stream.
82+
* @param range Range for color
83+
* @param value Color values
84+
*/
6485
public IccBased(InputStream iccStream, float[] range, float[] value) {
6586
this(new PdfCieBasedCs.IccBased(iccStream, range), value);
6687
if (getNumberOfComponents() * 2 != range.length)

kernel/src/main/java/com/itextpdf/kernel/colors/Indexed.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,26 @@ This file is part of the iText (R) project.
2424

2525
import com.itextpdf.kernel.pdf.colorspace.PdfColorSpace;
2626

27+
/**
28+
* Representation of an indexed color space.
29+
*/
2730
public class Indexed extends Color {
2831

29-
32+
/**
33+
* Creates an indexed color using the given {@link PdfColorSpace}.
34+
*
35+
* @param colorSpace Object containing the most common properties of color spaces
36+
*/
3037
public Indexed(PdfColorSpace colorSpace) {
3138
this(colorSpace, 0);
3239
}
3340

41+
/**
42+
* Creates an indexed color using the given {@link PdfColorSpace} and color values.
43+
*
44+
* @param colorSpace Object containing the most common properties of color spaces
45+
* @param colorValue Color values
46+
*/
3447
public Indexed(PdfColorSpace colorSpace, int colorValue) {
3548
super(colorSpace, new float[] {colorValue});
3649
}

kernel/src/main/java/com/itextpdf/kernel/colors/Lab.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,49 @@ This file is part of the iText (R) project.
2424

2525
import com.itextpdf.kernel.pdf.colorspace.PdfCieBasedCs;
2626

27+
/**
28+
* Representation of a lab color space.
29+
*/
2730
public class Lab extends Color {
2831

2932

33+
/**
34+
* Creates a lab color using the given {@link PdfCieBasedCs} color space.
35+
*
36+
* @param cs Color space
37+
*/
3038
public Lab(PdfCieBasedCs.Lab cs) {
3139
this(cs, new float[cs.getNumberOfComponents()]);
3240
}
3341

42+
/**
43+
* Creates a lab color using the given {@link PdfCieBasedCs} color space and color values.
44+
*
45+
* @param cs Color space
46+
* @param value Color values
47+
*/
3448
public Lab(PdfCieBasedCs.Lab cs, float[] value) {
3549
super(cs, value);
3650
}
3751

52+
/**
53+
* Creates a lab color using the given white point and color values.
54+
*
55+
* @param whitePoint Color values for defining the white point
56+
* @param value Color values
57+
*/
3858
public Lab(float[] whitePoint, float[] value) {
3959
super(new PdfCieBasedCs.Lab(whitePoint), value);
4060
}
4161

62+
/**
63+
* Creates a lab color using the given white point, black point and color values.
64+
*
65+
* @param whitePoint Color values for defining the white point
66+
* @param blackPoint Color values for defining the black point
67+
* @param range Range for color
68+
* @param value Color values
69+
*/
4270
public Lab(float[] whitePoint, float[] blackPoint, float[] range, float[] value) {
4371
this(new PdfCieBasedCs.Lab(whitePoint, blackPoint, range), value);
4472
}

kernel/src/main/java/com/itextpdf/kernel/colors/PatternColor.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,64 @@ This file is part of the iText (R) project.
2626
import com.itextpdf.kernel.pdf.colorspace.PdfPattern;
2727
import com.itextpdf.kernel.pdf.colorspace.PdfSpecialCs;
2828

29+
/**
30+
* Representation of a Pattern Color.
31+
*/
2932
public class PatternColor extends Color {
3033

3134
private PdfPattern pattern;
3235
// The underlying color for uncolored patterns. Will be null for colored ones.
3336
private Color underlyingColor;
3437

38+
/**
39+
* Creates a pattern color using the given color pattern object.
40+
*
41+
* @param coloredPattern Color space that uses pattern objects
42+
*/
3543
public PatternColor(PdfPattern coloredPattern) {
3644
super(new PdfSpecialCs.Pattern(), null);
3745
this.pattern = coloredPattern;
3846
}
3947

48+
/**
49+
* Creates a pattern color using the given uncolored pattern object and color.
50+
*
51+
* @param uncoloredPattern Tiling pattern object of the color space
52+
* @param color Color object
53+
*/
4054
public PatternColor(PdfPattern.Tiling uncoloredPattern, Color color) {
4155
this(uncoloredPattern, color.getColorSpace(), color.getColorValue());
4256
}
4357

58+
/**
59+
* Creates a pattern color using the given uncolored pattern object, an underlying color space and color values.
60+
*
61+
* @param uncoloredPattern Tiling pattern object of the color space
62+
* @param underlyingCS Underlying color space object
63+
* @param colorValue Color values
64+
*/
4465
public PatternColor(PdfPattern.Tiling uncoloredPattern, PdfColorSpace underlyingCS, float[] colorValue) {
4566
this(uncoloredPattern, new PdfSpecialCs.UncoloredTilingPattern(ensureNotPatternCs(underlyingCS)), colorValue);
4667
}
4768

69+
/**
70+
* Creates a pattern color using the given uncolored pattern object, uncolored tiling pattern and color values.
71+
*
72+
* @param uncoloredPattern Tiling pattern object of the color space
73+
* @param uncoloredTilingCS Tiling pattern color space
74+
* @param colorValue Color values
75+
*/
4876
public PatternColor(PdfPattern.Tiling uncoloredPattern, PdfSpecialCs.UncoloredTilingPattern uncoloredTilingCS, float[] colorValue) {
4977
super(uncoloredTilingCS, colorValue);
5078
this.pattern = uncoloredPattern;
5179
this.underlyingColor = makeColor(uncoloredTilingCS.getUnderlyingColorSpace(), colorValue);
5280
}
5381

82+
/**
83+
* Returns the pattern of the color space.
84+
*
85+
* @return PdfPattern object
86+
*/
5487
public PdfPattern getPattern() {
5588
return pattern;
5689
}

kernel/src/main/java/com/itextpdf/kernel/colors/Separation.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,38 @@ This file is part of the iText (R) project.
2626
import com.itextpdf.kernel.pdf.colorspace.PdfSpecialCs;
2727
import com.itextpdf.kernel.pdf.function.IPdfFunction;
2828

29+
/**
30+
* Representation of a separation color space.
31+
*/
2932
public class Separation extends Color {
3033

3134

35+
/**
36+
* Creates a separation color using the given {@link PdfSpecialCs} color space.
37+
*
38+
* @param cs Color space
39+
*/
3240
public Separation(PdfSpecialCs.Separation cs) {
3341
this(cs, 1f);
3442
}
3543

44+
/**
45+
* Creates a separation color using the given {@link PdfSpecialCs} color space and color value.
46+
*
47+
* @param cs Color space
48+
* @param value Color value
49+
*/
3650
public Separation(PdfSpecialCs.Separation cs, float value) {
3751
super(cs, new float[]{value});
3852
}
3953

4054
/**
4155
* Creates a color in a new separation color space.
4256
*
43-
* @param name the name for the separation color
44-
* @param alternateCs the alternative color space
45-
* @param tintTransform the function to transform color to the alternate colorspace
46-
* @param value the color value
57+
* @param name the name for the separation color
58+
* @param alternateCs the alternative color space
59+
* @param tintTransform the function to transform color to the alternate color space
60+
* @param value the color value
4761
*/
4862
public Separation(String name, PdfColorSpace alternateCs, IPdfFunction tintTransform, float value) {
4963
this(new PdfSpecialCs.Separation(name, alternateCs, tintTransform), value);

0 commit comments

Comments
 (0)