You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by vh...@apache.org on 2014/02/11 19:33:57 UTC
svn commit: r1567277 [1/2] - in
/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics:
image/ image/codec/png/ image/codec/tiff/ image/codec/util/ image/rendered/
java2d/ util/io/
Author: vhennebert
Date: Tue Feb 11 18:33:57 2014
New Revision: 1567277
URL: http://svn.apache.org/r1567277
Log:
Fix WhitespaceAround
Modified:
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGDecodeParam.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageDecoder.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFField.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/util/SimpleRenderedImage.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/AbstractRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/Any2sRGBRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/BufferedImageCachableRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/FormatRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/java2d/AbstractGraphics2D.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/java2d/DefaultGraphics2D.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/java2d/GraphicContext.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/java2d/TransformStackElement.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/java2d/TransformType.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64DecodeStream.java
xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/util/io/Base64EncodeStream.java
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java Tue Feb 11 18:33:57 2014
@@ -232,16 +232,16 @@ public final class GraphicsUtil {
int y0 = dst.getMinY();
if (y0 < src.getMinY()) y0 = src.getMinY();
- int x1 = dst.getMinX()+dst.getWidth()-1;
- if (x1 > src.getMinX()+src.getWidth()-1)
- x1 = src.getMinX()+src.getWidth()-1;
-
- int y1 = dst.getMinY()+dst.getHeight()-1;
- if (y1 > src.getMinY()+src.getHeight()-1)
- y1 = src.getMinY()+src.getHeight()-1;
+ int x1 = dst.getMinX() + dst.getWidth() - 1;
+ if (x1 > src.getMinX() + src.getWidth() - 1)
+ x1 = src.getMinX() + src.getWidth() - 1;
+
+ int y1 = dst.getMinY() + dst.getHeight() - 1;
+ if (y1 > src.getMinY() + src.getHeight() - 1)
+ y1 = src.getMinY() + src.getHeight() - 1;
- int width = x1-x0+1;
- int height = y1-y0+1;
+ int width = x1 - x0 + 1;
+ int height = y1 - y0 + 1;
SinglePixelPackedSampleModel srcSPPSM;
srcSPPSM = (SinglePixelPackedSampleModel)src.getSampleModel();
@@ -251,8 +251,8 @@ public final class GraphicsUtil {
final int [] srcPixels = srcDB.getBankData()[0];
final int srcBase =
(srcDB.getOffset() +
- srcSPPSM.getOffset(x0-src.getSampleModelTranslateX(),
- y0-src.getSampleModelTranslateY()));
+ srcSPPSM.getOffset(x0 - src.getSampleModelTranslateX(),
+ y0 - src.getSampleModelTranslateY()));
SinglePixelPackedSampleModel dstSPPSM;
@@ -263,28 +263,28 @@ public final class GraphicsUtil {
final int [] dstPixels = dstDB.getBankData()[0];
final int dstBase =
(dstDB.getOffset() +
- dstSPPSM.getOffset(x0-dst.getSampleModelTranslateX(),
- y0-dst.getSampleModelTranslateY()));
+ dstSPPSM.getOffset(x0 - dst.getSampleModelTranslateX(),
+ y0 - dst.getSampleModelTranslateY()));
if ((srcScanStride == dstScanStride) &&
(srcScanStride == width)) {
// System.out.println("VERY Fast copyData");
System.arraycopy(srcPixels, srcBase, dstPixels, dstBase,
- width*height);
+ width * height);
} else if (width > 128) {
int srcSP = srcBase;
int dstSP = dstBase;
- for (int y=0; y<height; y++) {
+ for (int y = 0; y < height; y++) {
System.arraycopy(srcPixels, srcSP, dstPixels, dstSP, width);
srcSP += srcScanStride;
dstSP += dstScanStride;
}
} else {
- for (int y=0; y<height; y++) {
- int srcSP = srcBase+y*srcScanStride;
- int dstSP = dstBase+y*dstScanStride;
- for (int x=0; x<width; x++)
+ for (int y = 0; y < height; y++) {
+ int srcSP = srcBase + y * srcScanStride;
+ int dstSP = dstBase + y * dstScanStride;
+ for (int x = 0; x < width; x++)
dstPixels[dstSP++] = srcPixels[srcSP++];
}
}
@@ -299,15 +299,15 @@ public final class GraphicsUtil {
int y0 = dst.getMinY();
if (y0 < src.getMinY()) y0 = src.getMinY();
- int x1 = dst.getMinX()+dst.getWidth()-1;
- if (x1 > src.getMinX()+src.getWidth()-1)
- x1 = src.getMinX()+src.getWidth()-1;
-
- int y1 = dst.getMinY()+dst.getHeight()-1;
- if (y1 > src.getMinY()+src.getHeight()-1)
- y1 = src.getMinY()+src.getHeight()-1;
+ int x1 = dst.getMinX() + dst.getWidth() - 1;
+ if (x1 > src.getMinX() + src.getWidth() - 1)
+ x1 = src.getMinX() + src.getWidth() - 1;
+
+ int y1 = dst.getMinY() + dst.getHeight() - 1;
+ if (y1 > src.getMinY() + src.getHeight() - 1)
+ y1 = src.getMinY() + src.getHeight() - 1;
- int width = x1-x0+1;
+ int width = x1 - x0 + 1;
int [] data = null;
for (int y = y0; y <= y1; y++) {
@@ -375,8 +375,8 @@ public final class GraphicsUtil {
(ras.getSampleModel(),
new Point(0,0));
ret = ret.createWritableChild
- (ras.getMinX()-ras.getSampleModelTranslateX(),
- ras.getMinY()-ras.getSampleModelTranslateY(),
+ (ras.getMinX() - ras.getSampleModelTranslateX(),
+ ras.getMinY() - ras.getSampleModelTranslateY(),
ras.getWidth(), ras.getHeight(),
minX, minY, null);
@@ -390,7 +390,7 @@ public final class GraphicsUtil {
int len = srcDB.getSize();
int banks = srcDB.getNumBanks();
int [] offsets = srcDB.getOffsets();
- for (int b=0; b< banks; b++) {
+ for (int b = 0; b < banks; b++) {
switch (srcDB.getDataType()) {
case DataBuffer.TYPE_BYTE: {
DataBufferByte srcDBT = (DataBufferByte)srcDB;
@@ -482,8 +482,8 @@ public final class GraphicsUtil {
ras.getDataBuffer(),
new Point(0,0));
ret = ret.createWritableChild
- (ras.getMinX()-ras.getSampleModelTranslateX(),
- ras.getMinY()-ras.getSampleModelTranslateY(),
+ (ras.getMinX() - ras.getSampleModelTranslateX(),
+ ras.getMinY() - ras.getSampleModelTranslateY(),
ras.getWidth(), ras.getHeight(),
minX, minY, null);
return ret;
@@ -550,21 +550,21 @@ public final class GraphicsUtil {
else {
int [] pixel = null;
int bands = wr.getNumBands();
- float norm = 1f/255f;
+ float norm = 1f / 255f;
int x0, x1, y0, y1, a, b;
float alpha;
x0 = wr.getMinX();
- x1 = x0+wr.getWidth();
+ x1 = x0 + wr.getWidth();
y0 = wr.getMinY();
- y1 = y0+wr.getHeight();
- for (int y=y0; y<y1; y++)
- for (int x=x0; x<x1; x++) {
+ y1 = y0 + wr.getHeight();
+ for (int y = y0; y < y1; y++)
+ for (int x = x0; x < x1; x++) {
pixel = wr.getPixel(x,y,pixel);
- a = pixel[bands-1];
+ a = pixel[bands - 1];
if ((a >= 0) && (a < 255)) {
- alpha = a*norm;
- for (b=0; b<bands-1; b++)
- pixel[b] = (int)(pixel[b]*alpha+0.5f);
+ alpha = a * norm;
+ for (b = 0; b < bands - 1; b++)
+ pixel[b] = (int)(pixel[b] * alpha + 0.5f);
wr.setPixel(x,y,pixel);
}
}
@@ -583,17 +583,17 @@ public final class GraphicsUtil {
int [] pixel = null;
x0 = wr.getMinX();
- x1 = x0+wr.getWidth();
+ x1 = x0 + wr.getWidth();
y0 = wr.getMinY();
- y1 = y0+wr.getHeight();
- for (int y=y0; y<y1; y++)
- for (int x=x0; x<x1; x++) {
+ y1 = y0 + wr.getHeight();
+ for (int y = y0; y < y1; y++)
+ for (int x = x0; x < x1; x++) {
pixel = wr.getPixel(x,y,pixel);
- a = pixel[bands-1];
+ a = pixel[bands - 1];
if ((a > 0) && (a < 255)) {
- ialpha = 255/(float)a;
- for (b=0; b<bands-1; b++)
- pixel[b] = (int)(pixel[b]*ialpha+0.5f);
+ ialpha = 255 / (float)a;
+ for (b = 0; b < bands - 1; b++)
+ pixel[b] = (int)(pixel[b] * ialpha + 0.5f);
wr.setPixel(x,y,pixel);
}
}
@@ -658,33 +658,33 @@ public final class GraphicsUtil {
WritableRaster dstR = dst.getRaster();
int bands = dstR.getNumBands();
- int dx = destP.x-srcRect.x;
- int dy = destP.y-srcRect.y;
+ int dx = destP.x - srcRect.x;
+ int dy = destP.y - srcRect.y;
int w = srcRect.width;
int x0 = srcRect.x;
int y0 = srcRect.y;
- int y1 = y0+srcRect.height-1;
+ int y1 = y0 + srcRect.height - 1;
if (!srcAlpha) {
// Src has no alpha dest does so set alpha to 1.0 everywhere.
// System.out.println("Add Alpha");
- int [] oPix = new int[bands*w];
- int out = (w*bands)-1; // The 2 skips alpha channel
- while(out >= 0) {
+ int [] oPix = new int[bands * w];
+ int out = (w * bands) - 1; // The 2 skips alpha channel
+ while (out >= 0) {
// Fill alpha channel with 255's
oPix[out] = 255;
out -= bands;
}
int b, in;
- for (int y=y0; y<=y1; y++) {
+ for (int y = y0; y <= y1; y++) {
pixel = srcR.getPixels(x0,y,w,1,pixel);
- in = w*(bands-1)-1;
- out = (w*bands)-2; // The 2 skips alpha channel on last pix
+ in = w * (bands - 1) - 1;
+ out = (w * bands) - 2; // The 2 skips alpha channel on last pix
switch (bands) {
case 4:
- while(in >= 0) {
+ while (in >= 0) {
oPix[out--] = pixel[in--];
oPix[out--] = pixel[in--];
oPix[out--] = pixel[in--];
@@ -692,125 +692,125 @@ public final class GraphicsUtil {
}
break;
default:
- while(in >= 0) {
- for (b=0; b<bands-1; b++)
+ while (in >= 0) {
+ for (b = 0; b < bands - 1; b++)
oPix[out--] = pixel[in--];
out--;
}
}
- dstR.setPixels(x0+dx, y+dy, w, 1, oPix);
+ dstR.setPixels(x0 + dx, y + dy, w, 1, oPix);
}
} else if (dstAlpha && dst.isAlphaPremultiplied()) {
// Src and dest have Alpha but we need to multiply it for dst.
// System.out.println("Mult Case");
- int a, b, alpha, in, fpNorm = (1<<24)/255, pt5 = 1<<23;
- for (int y=y0; y<=y1; y++) {
+ int a, b, alpha, in, fpNorm = (1 << 24) / 255, pt5 = 1 << 23;
+ for (int y = y0; y <= y1; y++) {
pixel = srcR.getPixels(x0,y,w,1,pixel);
- in=bands*w-1;
+ in = bands * w - 1;
switch (bands) {
case 4:
- while(in >= 0) {
+ while (in >= 0) {
a = pixel[in];
if (a == 255)
in -= 4;
else {
in--;
- alpha = fpNorm*a;
- pixel[in] = (pixel[in]*alpha+pt5)>>>24; in--;
- pixel[in] = (pixel[in]*alpha+pt5)>>>24; in--;
- pixel[in] = (pixel[in]*alpha+pt5)>>>24; in--;
+ alpha = fpNorm * a;
+ pixel[in] = (pixel[in] * alpha + pt5) >>> 24; in--;
+ pixel[in] = (pixel[in] * alpha + pt5) >>> 24; in--;
+ pixel[in] = (pixel[in] * alpha + pt5) >>> 24; in--;
}
}
break;
default:
- while(in >= 0) {
+ while (in >= 0) {
a = pixel[in];
if (a == 255)
in -= bands;
else {
in--;
- alpha = fpNorm*a;
- for (b=0; b<bands-1; b++) {
- pixel[in] = (pixel[in]*alpha+pt5)>>>24;
+ alpha = fpNorm * a;
+ for (b = 0; b < bands - 1; b++) {
+ pixel[in] = (pixel[in] * alpha + pt5) >>> 24;
in--;
}
}
}
}
- dstR.setPixels(x0+dx, y+dy, w, 1, pixel);
+ dstR.setPixels(x0 + dx, y + dy, w, 1, pixel);
}
} else if (dstAlpha && !dst.isAlphaPremultiplied()) {
// Src and dest have Alpha but we need to divide it out for dst.
// System.out.println("Div Case");
- int a, b, ialpha, in, fpNorm = 0x00FF0000, pt5 = 1<<15;
- for (int y=y0; y<=y1; y++) {
+ int a, b, ialpha, in, fpNorm = 0x00FF0000, pt5 = 1 << 15;
+ for (int y = y0; y <= y1; y++) {
pixel = srcR.getPixels(x0,y,w,1,pixel);
- in=(bands*w)-1;
+ in = (bands * w) - 1;
switch(bands) {
case 4:
- while(in >= 0) {
+ while (in >= 0) {
a = pixel[in];
if ((a <= 0) || (a >= 255))
in -= 4;
else {
in--;
- ialpha = fpNorm/a;
- pixel[in] = (pixel[in]*ialpha+pt5)>>>16; in--;
- pixel[in] = (pixel[in]*ialpha+pt5)>>>16; in--;
- pixel[in] = (pixel[in]*ialpha+pt5)>>>16; in--;
+ ialpha = fpNorm / a;
+ pixel[in] = (pixel[in] * ialpha + pt5) >>> 16; in--;
+ pixel[in] = (pixel[in] * ialpha + pt5) >>> 16; in--;
+ pixel[in] = (pixel[in] * ialpha + pt5) >>> 16; in--;
}
}
break;
default:
- while(in >= 0) {
+ while (in >= 0) {
a = pixel[in];
if ((a <= 0) || (a >= 255))
in -= bands;
else {
in--;
- ialpha = fpNorm/a;
- for (b=0; b<bands-1; b++) {
- pixel[in] = (pixel[in]*ialpha+pt5)>>>16;
+ ialpha = fpNorm / a;
+ for (b = 0; b < bands - 1; b++) {
+ pixel[in] = (pixel[in] * ialpha + pt5) >>> 16;
in--;
}
}
}
}
- dstR.setPixels(x0+dx, y+dy, w, 1, pixel);
+ dstR.setPixels(x0 + dx, y + dy, w, 1, pixel);
}
} else if (src.isAlphaPremultiplied()) {
- int [] oPix = new int[bands*w];
+ int [] oPix = new int[bands * w];
// Src has alpha dest does not so unpremult and store...
// System.out.println("Remove Alpha, Div Case");
- int a, b, ialpha, in, out, fpNorm = 0x00FF0000, pt5 = 1<<15;
- for (int y=y0; y<=y1; y++) {
+ int a, b, ialpha, in, out, fpNorm = 0x00FF0000, pt5 = 1 << 15;
+ for (int y = y0; y <= y1; y++) {
pixel = srcR.getPixels(x0,y,w,1,pixel);
- in = (bands+1)*w -1;
- out = (bands*w)-1;
- while(in >= 0) {
+ in = (bands + 1) * w - 1;
+ out = (bands * w) - 1;
+ while (in >= 0) {
a = pixel[in]; in--;
if (a > 0) {
if (a < 255) {
- ialpha = fpNorm/a;
- for (b=0; b<bands; b++)
- oPix[out--] = (pixel[in--]*ialpha+pt5)>>>16;
+ ialpha = fpNorm / a;
+ for (b = 0; b < bands; b++)
+ oPix[out--] = (pixel[in--] * ialpha + pt5) >>> 16;
} else
- for (b=0; b<bands; b++)
+ for (b = 0; b < bands; b++)
oPix[out--] = pixel[in--];
} else {
in -= bands;
- for (b=0; b<bands; b++)
+ for (b = 0; b < bands; b++)
oPix[out--] = 255;
}
}
- dstR.setPixels(x0+dx, y+dy, w, 1, oPix);
+ dstR.setPixels(x0 + dx, y + dy, w, 1, oPix);
}
} else {
// Src has unpremult alpha, dest does not have alpha,
// just copy the color channels over.
Rectangle dstRect = new Rectangle(destP.x, destP.y,
srcRect.width, srcRect.height);
- for (int b=0; b<bands; b++)
+ for (int b = 0; b < bands; b++)
copyBand(srcR, srcRect, b,
dstR, dstRect, b);
}
@@ -828,8 +828,8 @@ public final class GraphicsUtil {
public static void copyBand(Raster src, Rectangle sR, int sBand,
WritableRaster dst, Rectangle dR, int dBand) {
- int dy = dR.y -sR.y;
- int dx = dR.x -sR.x;
+ int dy = dR.y - sR.y;
+ int dx = dR.x - sR.x;
sR = sR.intersection(src.getBounds());
dR = dR.intersection(dst.getBounds());
int width, height;
@@ -838,21 +838,21 @@ public final class GraphicsUtil {
if (dR.height < sR.height) height = dR.height;
else height = sR.height;
- int x = sR.x+dx;
+ int x = sR.x + dx;
int [] samples = null;
- for (int y=sR.y; y< sR.y+height; y++) {
+ for (int y = sR.y; y < sR.y + height; y++) {
samples = src.getSamples(sR.x, y, width, 1, sBand, samples);
- dst.setSamples(x, y+dy, width, 1, dBand, samples);
+ dst.setSamples(x, y + dy, width, 1, dBand, samples);
}
}
public static boolean is_INT_PACK_Data(SampleModel sm,
boolean requireAlpha) {
// Check ColorModel is of type DirectColorModel
- if(!(sm instanceof SinglePixelPackedSampleModel)) return false;
+ if (!(sm instanceof SinglePixelPackedSampleModel)) return false;
// Check transfer type
- if(sm.getDataType() != DataBuffer.TYPE_INT) return false;
+ if (sm.getDataType() != DataBuffer.TYPE_INT) return false;
SinglePixelPackedSampleModel sppsm;
sppsm = (SinglePixelPackedSampleModel)sm;
@@ -863,9 +863,9 @@ public final class GraphicsUtil {
} else if (masks.length != 4)
return false;
- if(masks[0] != 0x00ff0000) return false;
- if(masks[1] != 0x0000ff00) return false;
- if(masks[2] != 0x000000ff) return false;
+ if (masks[0] != 0x00ff0000) return false;
+ if (masks[1] != 0x0000ff00) return false;
+ if (masks[2] != 0x000000ff) return false;
if ((masks.length == 4) &&
(masks[3] != 0xff000000)) return false;
@@ -874,10 +874,10 @@ public final class GraphicsUtil {
public static boolean is_BYTE_COMP_Data(SampleModel sm) {
// Check ColorModel is of type DirectColorModel
- if(!(sm instanceof ComponentSampleModel)) return false;
+ if (!(sm instanceof ComponentSampleModel)) return false;
// Check transfer type
- if(sm.getDataType() != DataBuffer.TYPE_BYTE) return false;
+ if (sm.getDataType() != DataBuffer.TYPE_BYTE) return false;
return true;
}
@@ -894,26 +894,26 @@ public final class GraphicsUtil {
DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
final int base
= (db.getOffset() +
- sppsm.getOffset(wr.getMinX()-wr.getSampleModelTranslateX(),
- wr.getMinY()-wr.getSampleModelTranslateY()));
+ sppsm.getOffset(wr.getMinX() - wr.getSampleModelTranslateX(),
+ wr.getMinY() - wr.getSampleModelTranslateY()));
// Access the pixel data array
final int[] pixels = db.getBankData()[0];
- for (int y=0; y<wr.getHeight(); y++) {
- int sp = base + y*scanStride;
+ for (int y = 0; y < wr.getHeight(); y++) {
+ int sp = base + y * scanStride;
final int end = sp + width;
while (sp < end) {
int pixel = pixels[sp];
- int a = pixel>>>24;
- if (a<=0) {
+ int a = pixel >>> 24;
+ if (a <= 0) {
pixels[sp] = 0x00FFFFFF;
- } else if (a<255) {
- int aFP = (0x00FF0000/a);
+ } else if (a < 255) {
+ int aFP = (0x00FF0000 / a);
pixels[sp] =
((a << 24) |
- (((((pixel&0xFF0000)>>16)*aFP)&0xFF0000) ) |
- (((((pixel&0x00FF00)>>8) *aFP)&0xFF0000)>>8 ) |
- (((((pixel&0x0000FF)) *aFP)&0xFF0000)>>16));
+ (((((pixel & 0xFF0000) >> 16) * aFP) & 0xFF0000) ) |
+ (((((pixel & 0x00FF00) >> 8) * aFP) & 0xFF0000) >> 8 ) |
+ (((((pixel & 0x0000FF)) * aFP) & 0xFF0000) >> 16));
}
sp++;
}
@@ -932,21 +932,21 @@ public final class GraphicsUtil {
DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
final int base
= (db.getOffset() +
- sppsm.getOffset(wr.getMinX()-wr.getSampleModelTranslateX(),
- wr.getMinY()-wr.getSampleModelTranslateY()));
+ sppsm.getOffset(wr.getMinX() - wr.getSampleModelTranslateX(),
+ wr.getMinY() - wr.getSampleModelTranslateY()));
// Access the pixel data array
final int[] pixels = db.getBankData()[0];
- for (int y=0; y<wr.getHeight(); y++) {
- int sp = base + y*scanStride;
+ for (int y = 0; y < wr.getHeight(); y++) {
+ int sp = base + y * scanStride;
final int end = sp + width;
while (sp < end) {
int pixel = pixels[sp];
- int a = pixel>>>24;
- if ((a>=0) && (a<255)) { // this does NOT include a == 255 (0xff) !
+ int a = pixel >>> 24;
+ if ((a >= 0) && (a < 255)) { // this does NOT include a == 255 (0xff) !
pixels[sp] = ((a << 24) |
- ((((pixel&0xFF0000)*a)>>8)&0xFF0000) |
- ((((pixel&0x00FF00)*a)>>8)&0x00FF00) |
- ((((pixel&0x0000FF)*a)>>8)&0x0000FF));
+ ((((pixel & 0xFF0000) * a) >> 8) & 0xFF0000) |
+ ((((pixel & 0x00FF00) * a) >> 8) & 0x00FF00) |
+ ((((pixel & 0x0000FF) * a) >> 8) & 0x0000FF));
}
sp++;
}
@@ -969,30 +969,30 @@ public final class GraphicsUtil {
DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
final int base
= (db.getOffset() +
- csm.getOffset(wr.getMinX()-wr.getSampleModelTranslateX(),
- wr.getMinY()-wr.getSampleModelTranslateY()));
+ csm.getOffset(wr.getMinX() - wr.getSampleModelTranslateX(),
+ wr.getMinY() - wr.getSampleModelTranslateY()));
- int aOff = bandOff[bandOff.length-1];
- int bands = bandOff.length-1;
+ int aOff = bandOff[bandOff.length - 1];
+ int bands = bandOff.length - 1;
// Access the pixel data array
final byte[] pixels = db.getBankData()[0];
- for (int y=0; y<wr.getHeight(); y++) {
- int sp = base + y*scanStride;
- final int end = sp + width*pixStride;
+ for (int y = 0; y < wr.getHeight(); y++) {
+ int sp = base + y * scanStride;
+ final int end = sp + width * pixStride;
while (sp < end) {
- int a = pixels[sp+aOff]&0xFF;
- if (a==0) {
+ int a = pixels[sp + aOff] & 0xFF;
+ if (a == 0) {
for (int b = 0; b < bands; b++)
- pixels[sp+bandOff[b]] = (byte)0xFF;
- } else if (a<255) { // this does NOT include a == 255 (0xff) !
- int aFP = (0x00FF0000/a);
+ pixels[sp + bandOff[b]] = (byte)0xFF;
+ } else if (a < 255) { // this does NOT include a == 255 (0xff) !
+ int aFP = (0x00FF0000 / a);
for (int b = 0; b < bands; b++) {
- int i = sp+bandOff[b];
- pixels[i] = (byte)(((pixels[i]&0xFF)*aFP)>>>16);
+ int i = sp + bandOff[b];
+ pixels[i] = (byte)(((pixels[i] & 0xFF) * aFP) >>> 16);
}
}
- sp+=pixStride;
+ sp += pixStride;
}
}
}
@@ -1012,26 +1012,26 @@ public final class GraphicsUtil {
DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
final int base
= (db.getOffset() +
- csm.getOffset(wr.getMinX()-wr.getSampleModelTranslateX(),
- wr.getMinY()-wr.getSampleModelTranslateY()));
+ csm.getOffset(wr.getMinX() - wr.getSampleModelTranslateX(),
+ wr.getMinY() - wr.getSampleModelTranslateY()));
- int aOff = bandOff[bandOff.length-1];
- int bands = bandOff.length-1;
+ int aOff = bandOff[bandOff.length - 1];
+ int bands = bandOff.length - 1;
// Access the pixel data array
final byte[] pixels = db.getBankData()[0];
- for (int y=0; y<wr.getHeight(); y++) {
- int sp = base + y*scanStride;
- final int end = sp + width*pixStride;
+ for (int y = 0; y < wr.getHeight(); y++) {
+ int sp = base + y * scanStride;
+ final int end = sp + width * pixStride;
while (sp < end) {
- int a = pixels[sp+aOff]&0xFF;
- if (a!=0xFF)
+ int a = pixels[sp + aOff] & 0xFF;
+ if (a != 0xFF)
for (int b = 0; b < bands; b++) {
- int i = sp+bandOff[b];
- pixels[i] = (byte)(((pixels[i]&0xFF)*a)>>8);
+ int i = sp + bandOff[b];
+ pixels[i] = (byte)(((pixels[i] & 0xFF) * a) >> 8);
}
- sp+=pixStride;
+ sp += pixStride;
}
}
}
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGDecodeParam.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGDecodeParam.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGDecodeParam.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGDecodeParam.java Tue Feb 11 18:33:57 2014
@@ -81,7 +81,7 @@ public class PNGDecodeParam implements I
/**
* Constructs a default instance of <code>PNGDecodeParam</code>.
*/
- public PNGDecodeParam() {}
+ public PNGDecodeParam() { }
private boolean suppressAlpha = false;
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java Tue Feb 11 18:33:57 2014
@@ -111,7 +111,7 @@ public abstract class PNGEncodeParam imp
public static class Palette extends PNGEncodeParam {
/** Constructs an instance of <code>PNGEncodeParam.Palette</code>. */
- public Palette() {}
+ public Palette() { }
// bKGD chunk
@@ -162,7 +162,7 @@ public abstract class PNGEncodeParam imp
* @param rgb An array of <code>int</code>s.
*/
public void setPalette(int[] rgb) {
- if (rgb.length < 1*3 || rgb.length > 256*3) {
+ if (rgb.length < 1 * 3 || rgb.length > 256 * 3) {
throw new
IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam0"));
}
@@ -281,7 +281,7 @@ public abstract class PNGEncodeParam imp
public static class Gray extends PNGEncodeParam {
/** Constructs an instance of <code>PNGEncodeParam.Gray</code>. */
- public Gray() {}
+ public Gray() { }
// bKGD chunk
@@ -445,7 +445,7 @@ public abstract class PNGEncodeParam imp
public static class RGB extends PNGEncodeParam {
/** Constructs an instance of <code>PNGEncodeParam.RGB</code>. */
- public RGB() {}
+ public RGB() { }
// bKGD chunk
@@ -1400,17 +1400,17 @@ public abstract class PNGEncodeParam imp
// sub filter
diff = curr - left;
scratchRows[1][i] = (byte)diff;
- badness [1] += (diff>0)?diff:-diff;
+ badness [1] += (diff > 0) ? diff : -diff;
// up filter
diff = curr - up;
scratchRows[2][i] = (byte)diff;
- badness [2] += (diff>=0)?diff:-diff;
+ badness [2] += (diff >= 0) ? diff : -diff;
// average filter
- diff = curr - ((left+up)>>1);
+ diff = curr - ((left + up) >> 1);
scratchRows[3][i] = (byte)diff;
- badness [3] += (diff>=0)?diff:-diff;
+ badness [3] += (diff >= 0) ? diff : -diff;
// paeth filter
@@ -1430,65 +1430,65 @@ public abstract class PNGEncodeParam imp
/// else
/// diff = curr-upleft;
- pa = up -upleft;
- pb = left-upleft;
- if (pa<0) {
- if (pb<0) {
+ pa = up - upleft;
+ pb = left - upleft;
+ if (pa < 0) {
+ if (pb < 0) {
// both pa & pb neg so pc is always greater than or
// equal to pa or pb;
if (pa >= pb) // since pa & pb neg check sense is reversed.
- diff = curr-left;
+ diff = curr - left;
else
- diff = curr-up;
+ diff = curr - up;
} else {
// pa neg pb pos so we must compute pc...
- pc = pa+pb;
- pa=-pa;
+ pc = pa + pb;
+ pa = -pa;
if (pa <= pb) // pc is positive and less than pb
if (pa <= pc)
- diff = curr-left;
+ diff = curr - left;
else
- diff = curr-upleft;
+ diff = curr - upleft;
else
// pc is negative and less than or equal to pa,
// but since pa is greater than pb this isn't an issue...
if (pb <= -pc)
- diff = curr-up;
+ diff = curr - up;
else
- diff = curr-upleft;
+ diff = curr - upleft;
}
} else {
- if (pb<0) {
- pb =-pb; // make it positive...
+ if (pb < 0) {
+ pb = -pb; // make it positive...
if (pa <= pb) {
// pc would be negative and less than or equal to pb
- pc = pb-pa;
+ pc = pb - pa;
if (pa <= pc)
- diff = curr-left;
+ diff = curr - left;
else if (pb == pc)
// if pa is zero then pc==pb otherwise
// pc must be less than pb.
- diff = curr-up;
+ diff = curr - up;
else
- diff = curr-upleft;
+ diff = curr - upleft;
} else {
// pc would be positive and less than pa.
- pc = pa-pb;
+ pc = pa - pb;
if (pb <= pc)
- diff = curr-up;
+ diff = curr - up;
else
- diff = curr-upleft;
+ diff = curr - upleft;
}
} else {
// both pos so pa+pb is always greater than pa/pb
if (pa <= pb)
- diff = curr-left;
+ diff = curr - left;
else
- diff = curr-up;
+ diff = curr - up;
}
}
scratchRows[4][i] = (byte)diff;
- badness [4] += (diff>=0)?diff:-diff;
+ badness [4] += (diff >= 0) ? diff : -diff;
}
int filterType = 0;
int minBadness = badness[0];
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageDecoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageDecoder.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageDecoder.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageDecoder.java Tue Feb 11 18:33:57 2014
@@ -159,7 +159,7 @@ class PNGImage extends SimpleRenderedIma
private boolean emitProperties = true;
- private float fileGamma = 45455/100000.0F;
+ private float fileGamma = 45455 / 100000.0F;
private float userExponent = 1.0F;
@@ -244,15 +244,15 @@ class PNGImage extends SimpleRenderedIma
private int[] gammaLut = null;
private void initGammaLut(int bits) {
- double exp = (double)userExponent/(fileGamma*displayExponent);
+ double exp = (double)userExponent / (fileGamma * displayExponent);
int numSamples = 1 << bits;
int maxOutSample = (bits == 16) ? 65535 : 255;
gammaLut = new int[numSamples];
for (int i = 0; i < numSamples; i++) {
- double gbright = (double)i/(numSamples - 1);
+ double gbright = (double)i / (numSamples - 1);
double gamma = Math.pow(gbright, exp);
- int igamma = (int)(gamma*maxOutSample + 0.5);
+ int igamma = (int)(gamma * maxOutSample + 0.5);
if (igamma > maxOutSample) {
igamma = maxOutSample;
}
@@ -489,7 +489,7 @@ class PNGImage extends SimpleRenderedIma
if (performGammaCorrection) {
// Assume file gamma is 1/2.2 unless we get a gAMA chunk
- float gamma = (1.0F/2.2F)*(displayExponent/userExponent);
+ float gamma = (1.0F / 2.2F) * (displayExponent / userExponent);
if (encodeParam != null) {
encodeParam.setGamma(gamma);
}
@@ -614,12 +614,12 @@ class PNGImage extends SimpleRenderedIma
private void parse_IEND_chunk(PNGChunk chunk) throws Exception {
// Store text strings
int textLen = textKeys.size();
- String[] textArray = new String[2*textLen];
+ String[] textArray = new String[2 * textLen];
for (int i = 0; i < textLen; i++) {
String key = (String)textKeys.get(i);
String val = (String)textStrings.get(i);
- textArray[2*i] = key;
- textArray[2*i + 1] = val;
+ textArray[2 * i] = key;
+ textArray[2 * i + 1] = val;
if (emitProperties) {
String uniqueKey = "text_" + i + ':' + key;
properties.put(uniqueKey.toLowerCase(), val);
@@ -631,12 +631,12 @@ class PNGImage extends SimpleRenderedIma
// Store compressed text strings
int ztextLen = ztextKeys.size();
- String[] ztextArray = new String[2*ztextLen];
+ String[] ztextArray = new String[2 * ztextLen];
for (int i = 0; i < ztextLen; i++) {
String key = (String)ztextKeys.get(i);
String val = (String)ztextStrings.get(i);
- ztextArray[2*i] = key;
- ztextArray[2*i + 1] = val;
+ ztextArray[2 * i] = key;
+ ztextArray[2 * i + 1] = val;
if (emitProperties) {
String uniqueKey = "ztext_" + i + ':' + key;
properties.put(uniqueKey.toLowerCase(), val);
@@ -662,9 +662,9 @@ class PNGImage extends SimpleRenderedIma
if ((colorType == PNG_COLOR_PALETTE) && expandPalette) {
depth = 8;
}
- int bytesPerRow = (outputBands*width*depth + 7)/8;
+ int bytesPerRow = (outputBands * width * depth + 7) / 8;
int scanlineStride =
- (depth == 16) ? (bytesPerRow/2) : bytesPerRow;
+ (depth == 16) ? (bytesPerRow / 2) : bytesPerRow;
theTile = createRaster(width, height, outputBands,
scanlineStride,
@@ -860,7 +860,7 @@ class PNGImage extends SimpleRenderedIma
}
private void parse_PLTE_chunk(PNGChunk chunk) {
- paletteEntries = chunk.getLength()/3;
+ paletteEntries = chunk.getLength() / 3;
redPalette = new byte[paletteEntries];
greenPalette = new byte[paletteEntries];
bluePalette = new byte[paletteEntries];
@@ -956,14 +956,14 @@ class PNGImage extends SimpleRenderedIma
}
chromaticity = new float[8];
- chromaticity[0] = chunk.getInt4(0)/100000.0F;
- chromaticity[1] = chunk.getInt4(4)/100000.0F;
- chromaticity[2] = chunk.getInt4(8)/100000.0F;
- chromaticity[3] = chunk.getInt4(12)/100000.0F;
- chromaticity[4] = chunk.getInt4(16)/100000.0F;
- chromaticity[5] = chunk.getInt4(20)/100000.0F;
- chromaticity[6] = chunk.getInt4(24)/100000.0F;
- chromaticity[7] = chunk.getInt4(28)/100000.0F;
+ chromaticity[0] = chunk.getInt4(0) / 100000.0F;
+ chromaticity[1] = chunk.getInt4(4) / 100000.0F;
+ chromaticity[2] = chunk.getInt4(8) / 100000.0F;
+ chromaticity[3] = chunk.getInt4(12) / 100000.0F;
+ chromaticity[4] = chunk.getInt4(16) / 100000.0F;
+ chromaticity[5] = chunk.getInt4(20) / 100000.0F;
+ chromaticity[6] = chunk.getInt4(24) / 100000.0F;
+ chromaticity[7] = chunk.getInt4(28) / 100000.0F;
if (encodeParam != null) {
encodeParam.setChromaticity(chromaticity);
@@ -986,15 +986,15 @@ class PNGImage extends SimpleRenderedIma
return;
}
- fileGamma = chunk.getInt4(0)/100000.0F;
+ fileGamma = chunk.getInt4(0) / 100000.0F;
float exp =
- performGammaCorrection ? displayExponent/userExponent : 1.0F;
+ performGammaCorrection ? displayExponent / userExponent : 1.0F;
if (encodeParam != null) {
- encodeParam.setGamma(fileGamma*exp);
+ encodeParam.setGamma(fileGamma * exp);
}
if (emitProperties) {
- properties.put("gamma", new Float(fileGamma*exp));
+ properties.put("gamma", new Float(fileGamma * exp));
}
}
@@ -1007,7 +1007,7 @@ class PNGImage extends SimpleRenderedIma
int length = redPalette.length;
int[] hist = new int[length];
for (int i = 0; i < length; i++) {
- hist[i] = chunk.getInt2(2*i);
+ hist[i] = chunk.getInt2(2 * i);
}
if (encodeParam != null) {
@@ -1039,7 +1039,7 @@ class PNGImage extends SimpleRenderedIma
properties.put("x_pixels_per_unit", new Integer(xPixelsPerUnit));
properties.put("y_pixels_per_unit", new Integer(yPixelsPerUnit));
properties.put("pixel_aspect_ratio",
- new Float((float)xPixelsPerUnit/yPixelsPerUnit));
+ new Float((float)xPixelsPerUnit / yPixelsPerUnit));
if (unitSpecifier == 1) {
properties.put("pixel_units", "Meters");
} else if (unitSpecifier != 0) {
@@ -1081,21 +1081,21 @@ class PNGImage extends SimpleRenderedIma
// The presence of an sRGB chunk implies particular
// settings for gamma and chroma.
- fileGamma = 45455/100000.0F;
+ fileGamma = 45455 / 100000.0F;
chromaticity = new float[8];
- chromaticity[0] = 31270/10000.0F;
- chromaticity[1] = 32900/10000.0F;
- chromaticity[2] = 64000/10000.0F;
- chromaticity[3] = 33000/10000.0F;
- chromaticity[4] = 30000/10000.0F;
- chromaticity[5] = 60000/10000.0F;
- chromaticity[6] = 15000/10000.0F;
- chromaticity[7] = 6000/10000.0F;
+ chromaticity[0] = 31270 / 10000.0F;
+ chromaticity[1] = 32900 / 10000.0F;
+ chromaticity[2] = 64000 / 10000.0F;
+ chromaticity[3] = 33000 / 10000.0F;
+ chromaticity[4] = 30000 / 10000.0F;
+ chromaticity[5] = 60000 / 10000.0F;
+ chromaticity[6] = 15000 / 10000.0F;
+ chromaticity[7] = 6000 / 10000.0F;
if (performGammaCorrection) {
// File gamma is 1/2.2
- float gamma = fileGamma*(displayExponent/userExponent);
+ float gamma = fileGamma * (displayExponent / userExponent);
if (encodeParam != null) {
encodeParam.setGamma(gamma);
encodeParam.setChromaticity(chromaticity);
@@ -1271,13 +1271,13 @@ class PNGImage extends SimpleRenderedIma
WritableRaster ras = null;
Point origin = new Point(0, 0);
if ((bitDepth < 8) && (bands == 1)) {
- dataBuffer = new DataBufferByte(height*scanlineStride);
+ dataBuffer = new DataBufferByte(height * scanlineStride);
ras = Raster.createPackedRaster(dataBuffer,
width, height,
bitDepth,
origin);
} else if (bitDepth <= 8) {
- dataBuffer = new DataBufferByte(height*scanlineStride);
+ dataBuffer = new DataBufferByte(height * scanlineStride);
ras = Raster.createInterleavedRaster(dataBuffer,
width, height,
scanlineStride,
@@ -1285,7 +1285,7 @@ class PNGImage extends SimpleRenderedIma
bandOffsets[bands],
origin);
} else {
- dataBuffer = new DataBufferUShort(height*scanlineStride);
+ dataBuffer = new DataBufferUShort(height * scanlineStride);
ras = Raster.createInterleavedRaster(dataBuffer,
width, height,
scanlineStride,
@@ -1328,7 +1328,7 @@ class PNGImage extends SimpleRenderedIma
raw = curr[i] & 0xff;
priorRow = prev[i] & 0xff;
- curr[i] = (byte)(raw + priorRow/2);
+ curr[i] = (byte)(raw + priorRow / 2);
}
for (int i = bpp; i < count; i++) {
@@ -1336,7 +1336,7 @@ class PNGImage extends SimpleRenderedIma
priorPixel = curr[i - bpp] & 0xff;
priorRow = prev[i] & 0xff;
- curr[i] = (byte)(raw + (priorPixel + priorRow)/2);
+ curr[i] = (byte)(raw + (priorPixel + priorRow) / 2);
}
}
@@ -1629,8 +1629,8 @@ class PNGImage extends SimpleRenderedIma
return;
}
- int bytesPerRow = (inputBands*passWidth*bitDepth + 7)/8;
- int eltsPerRow = (bitDepth == 16) ? bytesPerRow/2 : bytesPerRow;
+ int bytesPerRow = (inputBands * passWidth * bitDepth + 7) / 8;
+ int eltsPerRow = (bitDepth == 16) ? bytesPerRow / 2 : bytesPerRow;
byte[] curr = new byte[bytesPerRow];
byte[] prior = new byte[bytesPerRow];
@@ -1710,13 +1710,13 @@ class PNGImage extends SimpleRenderedIma
if (!useInterlacing) {
decodePass(theTile, 0, 0, 1, 1, width, height);
} else {
- decodePass(theTile, 0, 0, 8, 8, (width + 7)/8, (height + 7)/8);
- decodePass(theTile, 4, 0, 8, 8, (width + 3)/8, (height + 7)/8);
- decodePass(theTile, 0, 4, 4, 8, (width + 3)/4, (height + 3)/8);
- decodePass(theTile, 2, 0, 4, 4, (width + 1)/4, (height + 3)/4);
- decodePass(theTile, 0, 2, 2, 4, (width + 1)/2, (height + 1)/4);
- decodePass(theTile, 1, 0, 2, 2, width/2, (height + 1)/2);
- decodePass(theTile, 0, 1, 1, 2, width, height/2);
+ decodePass(theTile, 0, 0, 8, 8, (width + 7) / 8, (height + 7) / 8);
+ decodePass(theTile, 4, 0, 8, 8, (width + 3) / 8, (height + 7) / 8);
+ decodePass(theTile, 0, 4, 4, 8, (width + 3) / 4, (height + 3) / 8);
+ decodePass(theTile, 2, 0, 4, 4, (width + 1) / 4, (height + 3) / 4);
+ decodePass(theTile, 0, 2, 2, 4, (width + 1) / 2, (height + 1) / 4);
+ decodePass(theTile, 1, 0, 2, 2, width / 2, (height + 1) / 2);
+ decodePass(theTile, 0, 1, 1, 2, width, height / 2);
}
}
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java Tue Feb 11 18:33:57 2014
@@ -366,15 +366,15 @@ public class PNGImageEncoder extends Ima
xOffset *= numBands;
xSkip *= numBands;
- int samplesPerByte = 8/bitDepth;
+ int samplesPerByte = 8 / bitDepth;
- int numSamples = width*numBands;
+ int numSamples = width * numBands;
int[] samples = new int[numSamples];
- int pixels = (numSamples - xOffset + xSkip - 1)/xSkip;
- int bytesPerRow = pixels*numBands;
+ int pixels = (numSamples - xOffset + xSkip - 1) / xSkip;
+ int bytesPerRow = pixels * numBands;
if (bitDepth < 8) {
- bytesPerRow = (bytesPerRow + samplesPerByte - 1)/samplesPerByte;
+ bytesPerRow = (bytesPerRow + samplesPerByte - 1) / samplesPerByte;
} else if (bitDepth == 16) {
bytesPerRow *= 2;
}
@@ -422,7 +422,7 @@ public class PNGImageEncoder extends Ima
// Left shift the last byte
if (pos != 0) {
- tmp <<= (samplesPerByte - pos)*bitDepth;
+ tmp <<= (samplesPerByte - pos) * bitDepth;
currRow[count++] = (byte)tmp;
}
break;
@@ -548,7 +548,7 @@ public class PNGImageEncoder extends Ima
}
for (int i = 0; i < 8; i++) {
- cs.writeInt((int)(chroma[i]*100000));
+ cs.writeInt((int)(chroma[i] * 100000));
}
cs.writeToStream(dataOutput);
cs.close();
@@ -563,11 +563,11 @@ public class PNGImageEncoder extends Ima
if (!param.isSRGBIntentSet()) {
gamma = param.getGamma();
} else {
- gamma = 1.0F/2.2F; // SRGB gamma
+ gamma = 1.0F / 2.2F; // SRGB gamma
}
// TD should include the .5 but causes regard to say
// everything is different.
- cs.writeInt((int)(gamma*100000/*+0.5*/));
+ cs.writeInt((int)(gamma * 100000/*+0.5*/));
cs.writeToStream(dataOutput);
cs.close();
}
@@ -770,9 +770,9 @@ public class PNGImageEncoder extends Ima
if (param.isTextSet()) {
String[] text = param.getText();
- for (int i = 0; i < text.length/2; i++) {
- byte[] keyword = text[2*i].getBytes();
- byte[] value = text[2*i + 1].getBytes();
+ for (int i = 0; i < text.length / 2; i++) {
+ byte[] keyword = text[2 * i].getBytes();
+ byte[] value = text[2 * i + 1].getBytes();
ChunkStream cs = new ChunkStream("tEXt");
@@ -790,9 +790,9 @@ public class PNGImageEncoder extends Ima
if (param.isCompressedTextSet()) {
String[] text = param.getCompressedText();
- for (int i = 0; i < text.length/2; i++) {
- byte[] keyword = text[2*i].getBytes();
- byte[] value = text[2*i + 1].getBytes();
+ for (int i = 0; i < text.length / 2; i++) {
+ byte[] keyword = text[2 * i].getBytes();
+ byte[] value = text[2 * i + 1].getBytes();
ChunkStream cs = new ChunkStream("zTXt");
@@ -839,11 +839,11 @@ public class PNGImageEncoder extends Ima
PNGEncodeParam.Gray param = new PNGEncodeParam.Gray();
int numTransparent = 0;
- int grayFactor = 255/((1 << bitDepth) - 1);
+ int grayFactor = 255 / ((1 << bitDepth) - 1);
int entries = 1 << bitDepth;
for (int i = 0; i < entries; i++) {
byte red = redPalette[i];
- if ((red != i*grayFactor) ||
+ if ((red != i * grayFactor) ||
(red != greenPalette[i]) ||
(red != bluePalette[i])) {
return null;
@@ -923,7 +923,7 @@ public class PNGImageEncoder extends Ima
}
this.numBands = sampleModel.getNumBands();
- this.bpp = numBands*((bitDepth == 16) ? 2 : 1);
+ this.bpp = numBands * ((bitDepth == 16) ? 2 : 1);
ColorModel colorModel = image.getColorModel();
if (colorModel instanceof IndexColorModel) {
@@ -966,7 +966,7 @@ public class PNGImageEncoder extends Ima
PNGEncodeParam.Palette parami = (PNGEncodeParam.Palette)param;
if (parami.isPaletteSet()) {
int[] palette = parami.getPalette();
- size = palette.length/3;
+ size = palette.length / 3;
int index = 0;
for (int i = 0; i < size; i++) {
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGRed.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGRed.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/png/PNGRed.java Tue Feb 11 18:33:57 2014
@@ -222,7 +222,7 @@ public class PNGRed extends AbstractRed
private boolean emitProperties = true;
- private float fileGamma = 45455/100000.0F;
+ private float fileGamma = 45455 / 100000.0F;
private float userExponent = 1.0F;
@@ -312,15 +312,15 @@ public class PNGRed extends AbstractRed
private int[] gammaLut = null;
private void initGammaLut(int bits) {
- double exp = (double)userExponent/(fileGamma*displayExponent);
+ double exp = (double)userExponent / (fileGamma * displayExponent);
int numSamples = 1 << bits;
int maxOutSample = (bits == 16) ? 65535 : 255;
gammaLut = new int[numSamples];
for (int i = 0; i < numSamples; i++) {
- double gbright = (double)i/(numSamples - 1);
+ double gbright = (double)i / (numSamples - 1);
double gamma = Math.pow(gbright, exp);
- int igamma = (int)(gamma*maxOutSample + 0.5);
+ int igamma = (int)(gamma * maxOutSample + 0.5);
if (igamma > maxOutSample) {
igamma = maxOutSample;
}
@@ -599,7 +599,7 @@ public class PNGRed extends AbstractRed
if (performGammaCorrection) {
// Assume file gamma is 1/2.2 unless we get a gAMA chunk
- float gamma = (1.0F/2.2F)*(displayExponent/userExponent);
+ float gamma = (1.0F / 2.2F) * (displayExponent / userExponent);
if (encodeParam != null) {
encodeParam.setGamma(gamma);
}
@@ -724,12 +724,12 @@ public class PNGRed extends AbstractRed
private void parse_IEND_chunk(PNGChunk chunk) throws Exception {
// Store text strings
int textLen = textKeys.size();
- String[] textArray = new String[2*textLen];
+ String[] textArray = new String[2 * textLen];
for (int i = 0; i < textLen; i++) {
String key = (String)textKeys.get(i);
String val = (String)textStrings.get(i);
- textArray[2*i] = key;
- textArray[2*i + 1] = val;
+ textArray[2 * i] = key;
+ textArray[2 * i + 1] = val;
if (emitProperties) {
String uniqueKey = "text_" + i + ':' + key;
properties.put(uniqueKey.toLowerCase(), val);
@@ -741,12 +741,12 @@ public class PNGRed extends AbstractRed
// Store compressed text strings
int ztextLen = ztextKeys.size();
- String[] ztextArray = new String[2*ztextLen];
+ String[] ztextArray = new String[2 * ztextLen];
for (int i = 0; i < ztextLen; i++) {
String key = (String)ztextKeys.get(i);
String val = (String)ztextStrings.get(i);
- ztextArray[2*i] = key;
- ztextArray[2*i + 1] = val;
+ ztextArray[2 * i] = key;
+ ztextArray[2 * i + 1] = val;
if (emitProperties) {
String uniqueKey = "ztext_" + i + ':' + key;
properties.put(uniqueKey.toLowerCase(), val);
@@ -775,9 +775,9 @@ public class PNGRed extends AbstractRed
int width = bounds.width;
int height = bounds.height;
- int bytesPerRow = (outputBands*width*depth + 7)/8;
+ int bytesPerRow = (outputBands * width * depth + 7) / 8;
int scanlineStride =
- (depth == 16) ? (bytesPerRow/2) : bytesPerRow;
+ (depth == 16) ? (bytesPerRow / 2) : bytesPerRow;
theTile = createRaster(width, height, outputBands,
scanlineStride,
@@ -983,7 +983,7 @@ public class PNGRed extends AbstractRed
}
private void parse_PLTE_chunk(PNGChunk chunk) {
- paletteEntries = chunk.getLength()/3;
+ paletteEntries = chunk.getLength() / 3;
redPalette = new byte[paletteEntries];
greenPalette = new byte[paletteEntries];
bluePalette = new byte[paletteEntries];
@@ -1079,14 +1079,14 @@ public class PNGRed extends AbstractRed
}
chromaticity = new float[8];
- chromaticity[0] = chunk.getInt4(0)/100000.0F;
- chromaticity[1] = chunk.getInt4(4)/100000.0F;
- chromaticity[2] = chunk.getInt4(8)/100000.0F;
- chromaticity[3] = chunk.getInt4(12)/100000.0F;
- chromaticity[4] = chunk.getInt4(16)/100000.0F;
- chromaticity[5] = chunk.getInt4(20)/100000.0F;
- chromaticity[6] = chunk.getInt4(24)/100000.0F;
- chromaticity[7] = chunk.getInt4(28)/100000.0F;
+ chromaticity[0] = chunk.getInt4(0) / 100000.0F;
+ chromaticity[1] = chunk.getInt4(4) / 100000.0F;
+ chromaticity[2] = chunk.getInt4(8) / 100000.0F;
+ chromaticity[3] = chunk.getInt4(12) / 100000.0F;
+ chromaticity[4] = chunk.getInt4(16) / 100000.0F;
+ chromaticity[5] = chunk.getInt4(20) / 100000.0F;
+ chromaticity[6] = chunk.getInt4(24) / 100000.0F;
+ chromaticity[7] = chunk.getInt4(28) / 100000.0F;
if (encodeParam != null) {
encodeParam.setChromaticity(chromaticity);
@@ -1109,15 +1109,15 @@ public class PNGRed extends AbstractRed
return;
}
- fileGamma = chunk.getInt4(0)/100000.0F;
+ fileGamma = chunk.getInt4(0) / 100000.0F;
// System.out.println("Gamma: " + fileGamma);
float exp =
- performGammaCorrection ? displayExponent/userExponent : 1.0F;
+ performGammaCorrection ? displayExponent / userExponent : 1.0F;
if (encodeParam != null) {
- encodeParam.setGamma(fileGamma*exp);
+ encodeParam.setGamma(fileGamma * exp);
}
if (emitProperties) {
- properties.put("gamma", new Float(fileGamma*exp));
+ properties.put("gamma", new Float(fileGamma * exp));
}
}
@@ -1130,7 +1130,7 @@ public class PNGRed extends AbstractRed
int length = redPalette.length;
int[] hist = new int[length];
for (int i = 0; i < length; i++) {
- hist[i] = chunk.getInt2(2*i);
+ hist[i] = chunk.getInt2(2 * i);
}
if (encodeParam != null) {
@@ -1162,7 +1162,7 @@ public class PNGRed extends AbstractRed
properties.put("x_pixels_per_unit", new Integer(xPixelsPerUnit));
properties.put("y_pixels_per_unit", new Integer(yPixelsPerUnit));
properties.put("pixel_aspect_ratio",
- new Float((float)xPixelsPerUnit/yPixelsPerUnit));
+ new Float((float)xPixelsPerUnit / yPixelsPerUnit));
if (unitSpecifier == 1) {
properties.put("pixel_units", "Meters");
} else if (unitSpecifier != 0) {
@@ -1204,21 +1204,21 @@ public class PNGRed extends AbstractRed
// The presence of an sRGB chunk implies particular
// settings for gamma and chroma.
- fileGamma = 45455/100000.0F;
+ fileGamma = 45455 / 100000.0F;
chromaticity = new float[8];
- chromaticity[0] = 31270/10000.0F;
- chromaticity[1] = 32900/10000.0F;
- chromaticity[2] = 64000/10000.0F;
- chromaticity[3] = 33000/10000.0F;
- chromaticity[4] = 30000/10000.0F;
- chromaticity[5] = 60000/10000.0F;
- chromaticity[6] = 15000/10000.0F;
- chromaticity[7] = 6000/10000.0F;
+ chromaticity[0] = 31270 / 10000.0F;
+ chromaticity[1] = 32900 / 10000.0F;
+ chromaticity[2] = 64000 / 10000.0F;
+ chromaticity[3] = 33000 / 10000.0F;
+ chromaticity[4] = 30000 / 10000.0F;
+ chromaticity[5] = 60000 / 10000.0F;
+ chromaticity[6] = 15000 / 10000.0F;
+ chromaticity[7] = 6000 / 10000.0F;
if (performGammaCorrection) {
// File gamma is 1/2.2
- float gamma = fileGamma*(displayExponent/userExponent);
+ float gamma = fileGamma * (displayExponent / userExponent);
if (encodeParam != null) {
encodeParam.setGamma(gamma);
encodeParam.setChromaticity(chromaticity);
@@ -1394,13 +1394,13 @@ public class PNGRed extends AbstractRed
WritableRaster ras = null;
Point origin = new Point(0, 0);
if ((bitDepth < 8) && (bands == 1)) {
- dataBuffer = new DataBufferByte(height*scanlineStride);
+ dataBuffer = new DataBufferByte(height * scanlineStride);
ras = Raster.createPackedRaster(dataBuffer,
width, height,
bitDepth,
origin);
} else if (bitDepth <= 8) {
- dataBuffer = new DataBufferByte(height*scanlineStride);
+ dataBuffer = new DataBufferByte(height * scanlineStride);
ras = Raster.createInterleavedRaster(dataBuffer,
width, height,
scanlineStride,
@@ -1408,7 +1408,7 @@ public class PNGRed extends AbstractRed
bandOffsets[bands],
origin);
} else {
- dataBuffer = new DataBufferUShort(height*scanlineStride);
+ dataBuffer = new DataBufferUShort(height * scanlineStride);
ras = Raster.createInterleavedRaster(dataBuffer,
width, height,
scanlineStride,
@@ -1449,7 +1449,7 @@ public class PNGRed extends AbstractRed
int raw = curr[i] & 0xff;
int priorRow = prev[i] & 0xff;
- curr[i] = (byte)(raw + priorRow/2);
+ curr[i] = (byte)(raw + priorRow / 2);
}
for (int i = bpp; i < count; i++) {
@@ -1457,7 +1457,7 @@ public class PNGRed extends AbstractRed
int priorPixel = curr[i - bpp] & 0xff;
int priorRow = prev[i] & 0xff;
- curr[i] = (byte)(raw + (priorPixel + priorRow)/2);
+ curr[i] = (byte)(raw + (priorPixel + priorRow) / 2);
}
}
@@ -1767,8 +1767,8 @@ public class PNGRed extends AbstractRed
return;
}
- int bytesPerRow = (inputBands*passWidth*bitDepth + 7)/8;
- int eltsPerRow = (bitDepth == 16) ? bytesPerRow/2 : bytesPerRow;
+ int bytesPerRow = (inputBands * passWidth * bitDepth + 7) / 8;
+ int eltsPerRow = (bitDepth == 16) ? bytesPerRow / 2 : bytesPerRow;
byte[] curr = new byte[bytesPerRow];
byte[] prior = new byte[bytesPerRow];
@@ -1851,13 +1851,13 @@ public class PNGRed extends AbstractRed
if (!useInterlacing) {
decodePass(theTile, 0, 0, 1, 1, width, height);
} else {
- decodePass(theTile, 0, 0, 8, 8, (width + 7)/8, (height + 7)/8);
- decodePass(theTile, 4, 0, 8, 8, (width + 3)/8, (height + 7)/8);
- decodePass(theTile, 0, 4, 4, 8, (width + 3)/4, (height + 3)/8);
- decodePass(theTile, 2, 0, 4, 4, (width + 1)/4, (height + 3)/4);
- decodePass(theTile, 0, 2, 2, 4, (width + 1)/2, (height + 1)/4);
- decodePass(theTile, 1, 0, 2, 2, width/2, (height + 1)/2);
- decodePass(theTile, 0, 1, 1, 2, width, height/2);
+ decodePass(theTile, 0, 0, 8, 8, (width + 7) / 8, (height + 7) / 8);
+ decodePass(theTile, 4, 0, 8, 8, (width + 3) / 8, (height + 7) / 8);
+ decodePass(theTile, 0, 4, 4, 8, (width + 3) / 4, (height + 3) / 8);
+ decodePass(theTile, 2, 0, 4, 4, (width + 1) / 4, (height + 3) / 4);
+ decodePass(theTile, 0, 2, 2, 4, (width + 1) / 2, (height + 1) / 4);
+ decodePass(theTile, 1, 0, 2, 2, width / 2, (height + 1) / 2);
+ decodePass(theTile, 0, 1, 1, 2, width, height / 2);
}
}
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java Tue Feb 11 18:33:57 2014
@@ -83,7 +83,7 @@ public class TIFFDirectory implements Se
long nextIFDOffset = 0;
/** The default constructor. */
- TIFFDirectory() {}
+ TIFFDirectory() { }
private static boolean isValidEndianTag(int endian) {
return ((endian == 0x4949) || (endian == 0x4d4d));
@@ -128,7 +128,7 @@ public class TIFFDirectory implements Se
stream.seek(ifd_offset);
long entries = readUnsignedShort(stream);
- stream.skip(12*entries);
+ stream.skip(12 * entries);
ifd_offset = readUnsignedInt(stream);
}
@@ -170,12 +170,12 @@ public class TIFFDirectory implements Se
// Seek to desired IFD if necessary.
int dirNum = 0;
- while(dirNum < directory) {
+ while (dirNum < directory) {
// Get the number of fields in the current IFD.
long numEntries = readUnsignedShort(stream);
// Skip to the next IFD offset value field.
- stream.seek(ifd_offset + 12*numEntries);
+ stream.seek(ifd_offset + 12 * numEntries);
// Read the offset to the next IFD beyond this one.
ifd_offset = readUnsignedInt(stream);
@@ -228,7 +228,7 @@ public class TIFFDirectory implements Se
try {
// If the tag data can't fit in 4 bytes, the next 4 bytes
// contain the starting offset of the data
- if (count*sizeOfType[type] > 4) {
+ if (count * sizeOfType[type] > 4) {
value = (int)(readUnsignedInt(stream));
stream.seek(value);
}
@@ -578,7 +578,7 @@ public class TIFFDirectory implements Se
* given TIFF file, represented by a <code>SeekableStream</code>.
*/
public static int getNumDirectories(SeekableStream stream)
- throws IOException{
+ throws IOException {
long pointer = stream.getFilePointer(); // Save stream pointer
stream.seek(0L);
@@ -601,7 +601,7 @@ public class TIFFDirectory implements Se
stream.seek(offset);
long entries = readUnsignedShort(stream, isBigEndian);
- stream.skip(12*entries);
+ stream.skip(12 * entries);
offset = readUnsignedInt(stream, isBigEndian);
}
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java Tue Feb 11 18:33:57 2014
@@ -578,7 +578,7 @@ class TIFFFaxDecoder {
this.data = compData;
int lineOffset = 0;
- int scanlineStride = (w + 7)/8;
+ int scanlineStride = (w + 7) / 8;
bitPointer = 0;
bytePointer = 0;
@@ -739,7 +739,7 @@ class TIFFFaxDecoder {
bitPointer = 0;
bytePointer = 0;
- int scanlineStride = (w + 7)/8;
+ int scanlineStride = (w + 7) / 8;
int a0, a1, b1, b2;
int[] b = new int[2];
@@ -890,7 +890,7 @@ class TIFFFaxDecoder {
bitPointer = 0;
bytePointer = 0;
- int scanlineStride = (w + 7)/8;
+ int scanlineStride = (w + 7) / 8;
int a0, a1, b1, b2;
int entry, code, bits;
@@ -1093,7 +1093,7 @@ class TIFFFaxDecoder {
private void setToBlack(byte[] buffer,
int lineOffset, int bitOffset,
int numBits) {
- int bitNum = 8*lineOffset + bitOffset;
+ int bitNum = 8 * lineOffset + bitOffset;
int lastBit = bitNum + numBits;
int byteNum = bitNum >> 3;
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFField.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFField.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFField.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFField.java Tue Feb 11 18:33:57 2014
@@ -90,7 +90,7 @@ public class TIFFField implements Compar
Object data;
/** The default constructor. */
- TIFFField() {}
+ TIFFField() { }
/**
* Constructs a TIFFField with arbitrary data. The data
@@ -353,10 +353,10 @@ public class TIFFField implements Compar
return (float)((double[])data)[index];
case TIFF_SRATIONAL:
int[] ivalue = getAsSRational(index);
- return (float)((double)ivalue[0]/ivalue[1]);
+ return (float)((double)ivalue[0] / ivalue[1]);
case TIFF_RATIONAL:
long[] lvalue = getAsRational(index);
- return (float)((double)lvalue[0]/lvalue[1]);
+ return (float)((double)lvalue[0] / lvalue[1]);
default:
throw new ClassCastException();
}
@@ -391,10 +391,10 @@ public class TIFFField implements Compar
return ((double[])data)[index];
case TIFF_SRATIONAL:
int[] ivalue = getAsSRational(index);
- return (double)ivalue[0]/ivalue[1];
+ return (double)ivalue[0] / ivalue[1];
case TIFF_RATIONAL:
long[] lvalue = getAsRational(index);
- return (double)lvalue[0]/lvalue[1];
+ return (double)lvalue[0] / lvalue[1];
default:
throw new ClassCastException();
}
@@ -444,15 +444,15 @@ public class TIFFField implements Compar
* <code>TIFFField</code>.
*/
public int compareTo(Object o) {
- if(o == null) {
+ if (o == null) {
throw new NullPointerException();
}
int oTag = ((TIFFField)o).getTag();
- if(tag < oTag) {
+ if (tag < oTag) {
return -1;
- } else if(tag > oTag) {
+ } else if (tag > oTag) {
return 1;
} else {
return 0;
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java Tue Feb 11 18:33:57 2014
@@ -307,9 +307,9 @@ public class TIFFImage extends AbstractR
} else if (sampleSize == 4 && samplesPerPixel == 1) {
imageType = TYPE_GRAY_4BIT;
} else if (sampleSize % 8 == 0) {
- if(samplesPerPixel == 1) {
+ if (samplesPerPixel == 1) {
imageType = TYPE_GRAY;
- } else if(samplesPerPixel == 2) {
+ } else if (samplesPerPixel == 2) {
imageType = TYPE_GRAY_ALPHA;
} else {
imageType = TYPE_GENERIC;
@@ -395,7 +395,7 @@ public class TIFFImage extends AbstractR
tileHeight =
dir.getField(TIFFImageDecoder.TIFF_TILE_LENGTH) != null ?
- (int)dir.getFieldAsLong(TIFFImageDecoder.TIFF_TILE_LENGTH):
+ (int)dir.getFieldAsLong(TIFFImageDecoder.TIFF_TILE_LENGTH) :
bounds.height;
} else {
long l = field.getAsLong(0);
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java Tue Feb 11 18:33:57 2014
@@ -784,7 +784,7 @@ public class TIFFImageEncoder extends Im
}
if (compression == CompressionValue.NONE) {
- output.write(bpixels, 0, size*2);
+ output.write(bpixels, 0, size * 2);
} else if (compression == CompressionValue.PACKBITS) {
int numCompressedBytes =
compressPackBits(bpixels, rows,
@@ -821,7 +821,7 @@ public class TIFFImageEncoder extends Im
}
}
if (compression == CompressionValue.NONE) {
- output.write(bpixels, 0, size*4);
+ output.write(bpixels, 0, size * 4);
} else if (compression == CompressionValue.PACKBITS) {
int numCompressedBytes =
compressPackBits(bpixels, rows,
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java Tue Feb 11 18:33:57 2014
@@ -65,7 +65,7 @@ public class TIFFLZWDecoder {
*/
public byte[] decode(byte[] data, byte[] uncompData, int h) {
- if(data[0] == (byte)0x00 && data[1] == (byte)0x01) {
+ if (data[0] == (byte)0x00 && data[1] == (byte)0x01) {
throw new UnsupportedOperationException(PropertyUtil.getString("TIFFLZWDecoder0"));
}
@@ -152,7 +152,7 @@ public class TIFFLZWDecoder {
stringTable = new byte[4096][];
- for (int i=0; i<256; i++) {
+ for (int i = 0; i < 256; i++) {
stringTable[i] = new byte[1];
stringTable[i][0] = (byte)i;
}
@@ -166,7 +166,7 @@ public class TIFFLZWDecoder {
*/
public void writeString(byte[] string) {
- for (int i=0; i<string.length; i++) {
+ for (int i = 0; i < string.length; i++) {
uncompData[dstIndex++] = string[i];
}
}
@@ -237,11 +237,11 @@ public class TIFFLZWDecoder {
}
int code =
- (nextData >> (nextBits - bitsToGet)) & andTable[bitsToGet-9];
+ (nextData >> (nextBits - bitsToGet)) & andTable[bitsToGet - 9];
nextBits -= bitsToGet;
return code;
- } catch(ArrayIndexOutOfBoundsException e) {
+ } catch (ArrayIndexOutOfBoundsException e) {
// Strip not terminated as expected: return EndOfInformation code.
return 257;
}
Modified: xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/util/SimpleRenderedImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/util/SimpleRenderedImage.java?rev=1567277&r1=1567276&r2=1567277&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/util/SimpleRenderedImage.java (original)
+++ xmlgraphics/commons/branches/Temp_Checkstyle/src/java/org/apache/xmlgraphics/image/codec/util/SimpleRenderedImage.java Tue Feb 11 18:33:57 2014
@@ -85,7 +85,7 @@ public abstract class SimpleRenderedImag
/** A Hashtable containing the image properties. */
protected Map properties = new HashMap();
- public SimpleRenderedImage() {}
+ public SimpleRenderedImage() { }
/** Returns the X coordinate of the leftmost column of the image. */
public int getMinX() {
@@ -300,7 +300,7 @@ public abstract class SimpleRenderedImag
if (x < 0) {
x += 1 - tileWidth; // Force round to -infinity
}
- return x/tileWidth;
+ return x / tileWidth;
}
/**
@@ -313,7 +313,7 @@ public abstract class SimpleRenderedImag
if (y < 0) {
y += 1 - tileHeight; // Force round to -infinity
}
- return y/tileHeight;
+ return y / tileHeight;
}
/**
@@ -346,7 +346,7 @@ public abstract class SimpleRenderedImag
* by its X offset and tile width.
*/
public static int tileXToX(int tx, int tileGridXOffset, int tileWidth) {
- return tx*tileWidth + tileGridXOffset;
+ return tx * tileWidth + tileGridXOffset;
}
/**
@@ -355,7 +355,7 @@ public abstract class SimpleRenderedImag
* specified by its Y offset and tile height.
*/
public static int tileYToY(int ty, int tileGridYOffset, int tileHeight) {
- return ty*tileHeight + tileGridYOffset;
+ return ty * tileHeight + tileGridYOffset;
}
/**
@@ -367,7 +367,7 @@ public abstract class SimpleRenderedImag
* @return the X coordinate of the tile's upper left pixel.
*/
public int tileXToX(int tx) {
- return tx*tileWidth + tileGridXOffset;
+ return tx * tileWidth + tileGridXOffset;
}
/**
@@ -379,7 +379,7 @@ public abstract class SimpleRenderedImag
* @return the Y coordinate of the tile's upper left pixel.
*/
public int tileYToY(int ty) {
- return ty*tileHeight + tileGridYOffset;
+ return ty * tileHeight + tileGridYOffset;
}
public Vector getSources() {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org