Skip to content

Commit 89184f3

Browse files
committed
Javadoc
1 parent 500c799 commit 89184f3

19 files changed

+351
-5
lines changed

src/main/java/org/apache/commons/imaging/common/RationalNumber.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public String toString() {
5151

5252
// int-precision tolerance
5353
private static final double TOLERANCE = 1E-8;
54+
55+
/** Shallow size constant. */
5456
public static final int SHALLOW_SIZE = 32;
5557

5658
static RationalNumber factoryMethod(long n, long d) {
@@ -170,17 +172,21 @@ public static RationalNumber valueOf(double value) {
170172
// of 32 bit unsigned integers. Since Java does not have an
171173
// unsigned type, this class widens the type to long in order
172174
// to avoid unintended negative numbers.
175+
176+
/** The numerator value. */
173177
public final long numerator;
174178

179+
/** The divisor value. */
175180
public final long divisor;
176181

182+
/** Whether this is an unsigned type. */
177183
public final boolean unsignedType;
178184

179185
/**
180-
* Constructs an instance based on signed integers
186+
* Constructs an instance based on signed integers.
181187
*
182-
* @param numerator a 32-bit signed integer
183-
* @param divisor a non-zero 32-bit signed integer
188+
* @param numerator a 32-bit signed integer.
189+
* @param divisor a non-zero 32-bit signed integer.
184190
*/
185191
public RationalNumber(final int numerator, final int divisor) {
186192
this.numerator = numerator;
@@ -278,6 +284,11 @@ public RationalNumber negate() {
278284
return new RationalNumber(-n, d, false);
279285
}
280286

287+
/**
288+
* Converts to display string.
289+
*
290+
* @return the display string.
291+
*/
281292
public String toDisplayString() {
282293
if (numerator % divisor == 0) {
283294
return Long.toString(numerator / divisor);

src/main/java/org/apache/commons/imaging/common/RgbBufferedImageFactory.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,18 @@
1919

2020
import java.awt.image.BufferedImage;
2121

22+
/**
23+
* Factory for creating RGB buffered images.
24+
*/
2225
public class RgbBufferedImageFactory implements BufferedImageFactory {
26+
27+
/**
28+
* Constructs a new instance.
29+
*/
30+
public RgbBufferedImageFactory() {
31+
// Default constructor
32+
}
33+
2334
@Override
2435
public BufferedImage getColorBufferedImage(final int width, final int height, final boolean hasAlpha) {
2536
if (hasAlpha) {

src/main/java/org/apache/commons/imaging/common/SimpleBufferedImageFactory.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,18 @@
1919

2020
import java.awt.image.BufferedImage;
2121

22+
/**
23+
* Simple factory for creating buffered images.
24+
*/
2225
public class SimpleBufferedImageFactory implements BufferedImageFactory {
26+
27+
/**
28+
* Constructs a new instance.
29+
*/
30+
public SimpleBufferedImageFactory() {
31+
// Default constructor
32+
}
33+
2334
@Override
2435
public BufferedImage getColorBufferedImage(final int width, final int height, final boolean hasAlpha) {
2536
if (hasAlpha) {

src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,34 @@
3131

3232
public final class SofnSegment extends AbstractSegment {
3333

34+
/**
35+
* JPEG component information.
36+
*/
3437
public static class Component {
38+
39+
/** Shallow size constant. */
3540
static final int SHALLOW_SIZE = 32;
41+
42+
/** Component identifier. */
3643
public final int componentIdentifier;
44+
45+
/** Horizontal sampling factor. */
3746
public final int horizontalSamplingFactor;
47+
48+
/** Vertical sampling factor. */
3849
public final int verticalSamplingFactor;
50+
51+
/** Quantization table destination selector. */
3952
public final int quantTabDestSelector;
4053

54+
/**
55+
* Constructs a component.
56+
*
57+
* @param componentIdentifier the component identifier.
58+
* @param horizontalSamplingFactor the horizontal sampling factor.
59+
* @param veritcalSamplingFactor the vertical sampling factor.
60+
* @param quantTabDestSelector the quantization table destination selector.
61+
*/
4162
public Component(final int componentIdentifier, final int horizontalSamplingFactor, final int veritcalSamplingFactor, final int quantTabDestSelector) {
4263
this.componentIdentifier = componentIdentifier;
4364
this.horizontalSamplingFactor = horizontalSamplingFactor;
@@ -47,13 +68,29 @@ public Component(final int componentIdentifier, final int horizontalSamplingFact
4768
}
4869

4970
private static final Logger LOGGER = Logger.getLogger(SofnSegment.class.getName());
71+
72+
/** Image width. */
5073
public final int width;
74+
75+
/** Image height. */
5176
public final int height;
77+
78+
/** Number of components. */
5279
public final int numberOfComponents;
80+
81+
/** Precision. */
5382
public final int precision;
5483

5584
private final Component[] components;
5685

86+
/**
87+
* Constructs a SOFn segment.
88+
*
89+
* @param marker the marker.
90+
* @param segmentData the segment data.
91+
* @throws IOException if an I/O error occurs.
92+
* @throws ImagingException if an imaging error occurs.
93+
*/
5794
public SofnSegment(final int marker, final byte[] segmentData) throws IOException, ImagingException {
5895
this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
5996
}

src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,30 @@
2828

2929
public final class SosSegment extends AbstractSegment {
3030

31+
/**
32+
* JPEG SOS component information.
33+
*/
3134
public static class Component {
35+
36+
/** Shallow size constant. */
3237
static final int SHALLOW_SIZE = 24;
38+
39+
/** Scan component selector. */
3340
public final int scanComponentSelector;
41+
42+
/** DC coding table selector. */
3443
public final int dcCodingTableSelector;
44+
45+
/** AC coding table selector. */
3546
public final int acCodingTableSelector;
3647

48+
/**
49+
* Constructs a component.
50+
*
51+
* @param scanComponentSelector the scan component selector.
52+
* @param dcCodingTableSelector the DC coding table selector.
53+
* @param acCodingTableSelector the AC coding table selector.
54+
*/
3755
public Component(final int scanComponentSelector, final int dcCodingTableSelector, final int acCodingTableSelector) {
3856
this.scanComponentSelector = scanComponentSelector;
3957
this.dcCodingTableSelector = dcCodingTableSelector;
@@ -42,14 +60,31 @@ public Component(final int scanComponentSelector, final int dcCodingTableSelecto
4260
}
4361

4462
private static final Logger LOGGER = Logger.getLogger(SosSegment.class.getName());
63+
64+
/** Number of components. */
4565
public final int numberOfComponents;
66+
4667
private final Component[] components;
68+
69+
/** Start of spectral selection. */
4770
public final int startOfSpectralSelection;
71+
72+
/** End of spectral selection. */
4873
public final int endOfSpectralSelection;
74+
75+
/** Successive approximation bit high. */
4976
public final int successiveApproximationBitHigh;
5077

78+
/** Successive approximation bit low. */
5179
public final int successiveApproximationBitLow;
5280

81+
/**
82+
* Constructs a SOS segment.
83+
*
84+
* @param marker the marker.
85+
* @param segmentData the segment data.
86+
* @throws IOException if an I/O error occurs.
87+
*/
5388
public SosSegment(final int marker, final byte[] segmentData) throws IOException {
5489
this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
5590
}

src/main/java/org/apache/commons/imaging/formats/png/PngImagingParameters.java

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828
public class PngImagingParameters extends XmpImagingParameters<PngImagingParameters> {
2929

30+
/** Default bit depth value. */
3031
public static final byte DEFAULT_BIT_DEPTH = 8;
3132

3233
/**
@@ -62,22 +63,54 @@ public class PngImagingParameters extends XmpImagingParameters<PngImagingParamet
6263
*/
6364
private List<? extends AbstractPngText> textChunks;
6465

66+
/**
67+
* Constructs a new instance.
68+
*/
69+
public PngImagingParameters() {
70+
// Default constructor
71+
}
72+
73+
/**
74+
* Gets the bit depth.
75+
*
76+
* @return the bit depth.
77+
*/
6578
public byte getBitDepth() {
6679
return bitDepth;
6780
}
6881

82+
/**
83+
* Gets the physical scale.
84+
*
85+
* @return the physical scale.
86+
*/
6987
public PhysicalScale getPhysicalScale() {
7088
return physicalScale;
7189
}
7290

91+
/**
92+
* Gets the text chunks.
93+
*
94+
* @return the text chunks.
95+
*/
7396
public List<? extends AbstractPngText> getTextChunks() {
7497
return textChunks != null ? Collections.unmodifiableList(textChunks) : null;
7598
}
7699

100+
/**
101+
* Checks if forcing indexed color.
102+
*
103+
* @return true if forcing indexed color, false otherwise.
104+
*/
77105
public boolean isForceIndexedColor() {
78106
return forceIndexedColor;
79107
}
80108

109+
/**
110+
* Checks if forcing true color.
111+
*
112+
* @return true if forcing true color, false otherwise.
113+
*/
81114
public boolean isForceTrueColor() {
82115
return forceTrueColor;
83116
}
@@ -91,21 +124,45 @@ public boolean isPredictorEnabled() {
91124
return predictorEnabled;
92125
}
93126

127+
/**
128+
* Sets the bit depth.
129+
*
130+
* @param bitDepth the bit depth.
131+
* @return this instance.
132+
*/
94133
public PngImagingParameters setBitDepth(final byte bitDepth) {
95134
this.bitDepth = bitDepth;
96135
return asThis();
97136
}
98137

138+
/**
139+
* Sets whether to force indexed color.
140+
*
141+
* @param forceIndexedColor whether to force indexed color.
142+
* @return this instance.
143+
*/
99144
public PngImagingParameters setForceIndexedColor(final boolean forceIndexedColor) {
100145
this.forceIndexedColor = forceIndexedColor;
101146
return asThis();
102147
}
103148

149+
/**
150+
* Sets whether to force true color.
151+
*
152+
* @param forceTrueColor whether to force true color.
153+
* @return this instance.
154+
*/
104155
public PngImagingParameters setForceTrueColor(final boolean forceTrueColor) {
105156
this.forceTrueColor = forceTrueColor;
106157
return asThis();
107158
}
108159

160+
/**
161+
* Sets the physical scale.
162+
*
163+
* @param physicalScale the physical scale.
164+
* @return this instance.
165+
*/
109166
public PngImagingParameters setPhysicalScale(final PhysicalScale physicalScale) {
110167
this.physicalScale = physicalScale;
111168
return asThis();
@@ -124,6 +181,12 @@ public PngImagingParameters setPredictorEnabled(final boolean predictorEnabled)
124181
return asThis();
125182
}
126183

184+
/**
185+
* Sets the text chunks.
186+
*
187+
* @param textChunks the text chunks.
188+
* @return this instance.
189+
*/
127190
public PngImagingParameters setTextChunks(final List<? extends AbstractPngText> textChunks) {
128191
this.textChunks = Collections.unmodifiableList(textChunks);
129192
return asThis();

src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilter.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,20 @@
2020

2121
import org.apache.commons.imaging.ImagingException;
2222

23+
/**
24+
* Interface for PNG scanline filtering.
25+
*/
2326
public interface ScanlineFilter {
2427

28+
/**
29+
* Unfilters a scanline.
30+
*
31+
* @param src the source bytes.
32+
* @param dst the destination bytes.
33+
* @param up the previous scanline bytes.
34+
* @throws ImagingException if an imaging error occurs.
35+
* @throws IOException if an I/O error occurs.
36+
*/
2537
void unfilter(byte[] src, byte[] dst, byte[] up) throws ImagingException, IOException;
2638

2739
}

src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterAverage.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@
2020

2121
import org.apache.commons.imaging.ImagingException;
2222

23+
/**
24+
* PNG scanline filter using average of left and up pixels.
25+
*/
2326
public class ScanlineFilterAverage implements ScanlineFilter {
27+
2428
private final int bytesPerPixel;
2529

30+
/**
31+
* Constructs a new instance.
32+
*
33+
* @param bytesPerPixel the number of bytes per pixel.
34+
*/
2635
public ScanlineFilterAverage(final int bytesPerPixel) {
2736
this.bytesPerPixel = bytesPerPixel;
2837
}

src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterNone.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,18 @@
2020

2121
import org.apache.commons.imaging.ImagingException;
2222

23+
/**
24+
* PNG scanline filter with no filtering (direct copy).
25+
*/
2326
public class ScanlineFilterNone implements ScanlineFilter {
2427

28+
/**
29+
* Constructs a new instance.
30+
*/
31+
public ScanlineFilterNone() {
32+
// Default constructor
33+
}
34+
2535
@Override
2636
public void unfilter(final byte[] src, final byte[] dst, final byte[] up) throws ImagingException, IOException {
2737
System.arraycopy(src, 0, dst, 0, src.length);

0 commit comments

Comments
 (0)