Skip to content

Commit 250f1f4

Browse files
Rename io.Image to ImageData
DEVSIX-581
1 parent 7508a84 commit 250f1f4

File tree

37 files changed

+268
-276
lines changed

37 files changed

+268
-276
lines changed

forms/src/main/java/com/itextpdf/forms/fields/PdfFormField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ This file is part of the iText (R) project.
7373
import com.itextpdf.io.codec.Base64;
7474
import com.itextpdf.io.font.FontConstants;
7575
import com.itextpdf.io.font.PdfEncodings;
76-
import com.itextpdf.io.image.Image;
76+
import com.itextpdf.io.image.ImageData;
7777
import com.itextpdf.io.image.ImageFactory;
7878
import com.itextpdf.io.source.PdfTokenizer;
7979
import com.itextpdf.io.source.RandomAccessFileOrArray;
@@ -158,7 +158,7 @@ public class PdfFormField extends PdfObjectWrapper<PdfDictionary> {
158158
protected static String[] typeChars = {"4", "l", "8", "u", "n", "H"};
159159

160160
protected String text;
161-
protected Image img;
161+
protected ImageData img;
162162
protected PdfFont font;
163163
protected int fontSize;
164164
protected Color color;

io/src/main/java/com/itextpdf/io/image/AwtImageFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class AwtImageFactory {
5555
* @param color if different from <CODE>null</CODE> the transparency pixels are replaced by this color
5656
* @return RawImage
5757
*/
58-
public static Image getImage(java.awt.Image image, java.awt.Color color) throws java.io.IOException {
58+
public static ImageData getImage(java.awt.Image image, java.awt.Color color) throws java.io.IOException {
5959
return AwtImageFactory.getImage(image, color, false);
6060
}
6161

@@ -66,7 +66,7 @@ public static Image getImage(java.awt.Image image, java.awt.Color color) throws
6666
* @param forceBW if <CODE>true</CODE> the image is treated as black and white
6767
* @return RawImage
6868
*/
69-
public static Image getImage(java.awt.Image image, java.awt.Color color, boolean forceBW) throws java.io.IOException {
69+
public static ImageData getImage(java.awt.Image image, java.awt.Color color, boolean forceBW) throws java.io.IOException {
7070
if (image instanceof BufferedImage) {
7171
BufferedImage bi = (BufferedImage) image;
7272
if (bi.getType() == BufferedImage.TYPE_BYTE_BINARY && bi.getColorModel().getPixelSize() == 1) {
@@ -204,9 +204,9 @@ public static Image getImage(java.awt.Image image, java.awt.Color color, boolean
204204
else
205205
smask = null;
206206
}
207-
Image img = ImageFactory.getImage(w, h, 3, 8, pixelsByte, transparency);
207+
ImageData img = ImageFactory.getImage(w, h, 3, 8, pixelsByte, transparency);
208208
if (smask != null) {
209-
Image sm = ImageFactory.getImage(w, h, 1, 8, smask, null);
209+
ImageData sm = ImageFactory.getImage(w, h, 1, 8, smask, null);
210210
sm.makeMask();
211211
img.setImageMask(sm);
212212
}

io/src/main/java/com/itextpdf/io/image/BmpImage.java renamed to io/src/main/java/com/itextpdf/io/image/BmpImageData.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ This file is part of the iText (R) project.
4646

4747
import java.net.URL;
4848

49-
public class BmpImage extends RawImage {
49+
public class BmpImageData extends RawImageData {
5050

5151
private int size;
5252
private boolean noHeader;
5353

54-
protected BmpImage(URL url, boolean noHeader, int size) {
54+
protected BmpImageData(URL url, boolean noHeader, int size) {
5555
super(url, ImageType.BMP);
5656
this.noHeader = noHeader;
5757
this.size = size;
5858
}
5959

60-
protected BmpImage(byte[] bytes, boolean noHeader, int size) {
60+
protected BmpImageData(byte[] bytes, boolean noHeader, int size) {
6161
super(bytes, ImageType.BMP);
6262
this.noHeader = noHeader;
6363
this.size = size;

io/src/main/java/com/itextpdf/io/image/BmpImageHelper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ This file is part of the iText (R) project.
5555
final class BmpImageHelper {
5656

5757
private static class BmpParameters {
58-
public BmpParameters(BmpImage image) {
58+
public BmpParameters(BmpImageData image) {
5959
this.image = image;
6060
}
6161

62-
BmpImage image;
62+
BmpImageData image;
6363
int width;
6464
int height;
6565
Map<String, Object> additional;
@@ -113,7 +113,7 @@ public BmpParameters(BmpImage image) {
113113
private static final int BI_RLE4 = 2;
114114
private static final int BI_BITFIELDS = 3;
115115

116-
public static void processImage(Image image) {
116+
public static void processImage(ImageData image) {
117117
if (image.getOriginalType() != ImageType.BMP)
118118
throw new IllegalArgumentException("BMP image expected");
119119
BmpParameters bmp;
@@ -124,7 +124,7 @@ public static void processImage(Image image) {
124124
}
125125
bmpStream = new ByteArrayInputStream(image.getData());
126126
image.imageSize = image.getData().length;
127-
bmp = new BmpParameters((BmpImage)image);
127+
bmp = new BmpParameters((BmpImageData)image);
128128
process(bmp, bmpStream);
129129
if (getImage(bmp)) {
130130
image.setWidth(bmp.width);

io/src/main/java/com/itextpdf/io/image/GifImage.java renamed to io/src/main/java/com/itextpdf/io/image/GifImageData.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@ This file is part of the iText (R) project.
5353
import java.util.ArrayList;
5454
import java.util.List;
5555

56-
public class GifImage {
56+
public class GifImageData {
5757

5858
private float logicalHeight;
5959
private float logicalWidth;
60-
private List<Image> frames = new ArrayList<>();
60+
private List<ImageData> frames = new ArrayList<>();
6161
private byte[] data;
6262
private URL url;
6363

64-
protected GifImage(URL url) {
64+
protected GifImageData(URL url) {
6565
this.url = url;
6666
}
6767

68-
protected GifImage(byte[] data) {
68+
protected GifImageData(byte[] data) {
6969
this.data = data;
7070
}
7171

@@ -85,7 +85,7 @@ public void setLogicalWidth(float logicalWidth) {
8585
this.logicalWidth = logicalWidth;
8686
}
8787

88-
public List<Image> getFrames() {
88+
public List<ImageData> getFrames() {
8989
return frames;
9090
}
9191

@@ -97,7 +97,7 @@ protected URL getUrl() {
9797
return url;
9898
}
9999

100-
protected void addFrame(Image frame) {
100+
protected void addFrame(ImageData frame) {
101101
frames.add(frame);
102102
}
103103

io/src/main/java/com/itextpdf/io/image/GifImageHelper.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public final class GifImageHelper {
6060

6161
private static class GifParameters {
6262

63-
public GifParameters(GifImage image) {
63+
public GifParameters(GifImageData image) {
6464
this.image = image;
6565
}
6666

@@ -103,14 +103,14 @@ public GifParameters(GifImage image) {
103103
URL fromUrl;
104104
int currentFrame;
105105

106-
GifImage image;
106+
GifImageData image;
107107
}
108108

109109
/**
110110
* Reads image source and fills GifImage object with parameters (frames, width, height)
111111
* @param image GifImage
112112
*/
113-
public static void processImage(GifImage image) {
113+
public static void processImage(GifImageData image) {
114114
processImage(image, -1);
115115
}
116116

@@ -119,7 +119,7 @@ public static void processImage(GifImage image) {
119119
* @param image GifImage
120120
* @param lastFrameNumber the last frame of the gif image should be read
121121
*/
122-
public static void processImage(GifImage image, int lastFrameNumber) {
122+
public static void processImage(GifImageData image, int lastFrameNumber) {
123123
GifParameters gif = new GifParameters(image);
124124
InputStream gifStream;
125125
try {
@@ -304,7 +304,7 @@ private static void readFrame(GifParameters gif) throws java.io.IOException {
304304
colorspace[3] = PdfEncodings.convertToString(gif.m_curr_table, null);
305305
Map<String, Object> ad = new HashMap<>();
306306
ad.put("ColorSpace", colorspace);
307-
RawImage img = new RawImage(gif.m_out, ImageType.NONE);
307+
RawImageData img = new RawImageData(gif.m_out, ImageType.NONE);
308308
RawImageHelper.updateRawImageParameters(img, gif.iw, gif.ih, 1, gif.m_bpc, gif.m_out);
309309
RawImageHelper.updateImageAttributes(img, ad);
310310
gif.image.addFrame(img);

io/src/main/java/com/itextpdf/io/image/Image.java renamed to io/src/main/java/com/itextpdf/io/image/ImageData.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,17 @@ This file is part of the iText (R) project.
4747
import com.itextpdf.io.IOException;
4848
import com.itextpdf.io.LogMessageConstant;
4949
import com.itextpdf.io.color.IccProfile;
50-
51-
import java.net.URL;
52-
import java.util.Map;
53-
5450
import com.itextpdf.io.source.ByteArrayOutputStream;
5551
import com.itextpdf.io.source.RandomAccessFileOrArray;
5652
import com.itextpdf.io.source.RandomAccessSourceFactory;
5753
import com.itextpdf.io.util.StreamUtil;
5854
import org.slf4j.Logger;
5955
import org.slf4j.LoggerFactory;
6056

61-
public abstract class Image {
57+
import java.net.URL;
58+
import java.util.Map;
59+
60+
public abstract class ImageData {
6261

6362
protected URL url;
6463

@@ -98,7 +97,7 @@ public abstract class Image {
9897

9998
protected boolean mask = false;
10099

101-
protected Image imageMask;
100+
protected ImageData imageMask;
102101

103102
protected boolean interpolation;
104103

@@ -110,12 +109,12 @@ public abstract class Image {
110109

111110
protected Long mySerialId = getSerialId();
112111

113-
protected Image(URL url, ImageType type) {
112+
protected ImageData(URL url, ImageType type) {
114113
this.url = url;
115114
this.originalType = type;
116115
}
117116

118-
protected Image(byte[] bytes, ImageType type) {
117+
protected ImageData(byte[] bytes, ImageType type) {
119118
this.data = bytes;
120119
this.originalType = type;
121120
}
@@ -221,11 +220,11 @@ public boolean isMask() {
221220
return mask;
222221
}
223222

224-
public Image getImageMask() {
223+
public ImageData getImageMask() {
225224
return imageMask;
226225
}
227226

228-
public void setImageMask(Image imageMask) {
227+
public void setImageMask(ImageData imageMask) {
229228
if (this.mask)
230229
throw new IOException(IOException.ImageMaskCannotContainAnotherImageMask);
231230
if (!imageMask.mask)
@@ -316,7 +315,7 @@ public void setDecode(float[] decode) {
316315
* @return if the image can be inline
317316
*/
318317
public boolean canImageBeInline() {
319-
Logger logger = LoggerFactory.getLogger(Image.class);
318+
Logger logger = LoggerFactory.getLogger(ImageData.class);
320319
if (imageSize > 4096) {
321320
logger.warn(LogMessageConstant.IMAGE_SIZE_CANNOT_BE_MORE_4KB);
322321
return false;

0 commit comments

Comments
 (0)