diff --git a/openpdf-core/src/main/java/org/openpdf/text/Jpeg2000.java b/openpdf-core/src/main/java/org/openpdf/text/Jpeg2000.java index f4e44a8f1..cb2f52ab4 100644 --- a/openpdf-core/src/main/java/org/openpdf/text/Jpeg2000.java +++ b/openpdf-core/src/main/java/org/openpdf/text/Jpeg2000.java @@ -163,13 +163,10 @@ private void processParameters() throws IOException { originalType = ORIGINAL_JPEG2000; inp = null; try { - String errorID; if (rawData == null) { inp = url.openStream(); - errorID = url.toString(); } else { inp = new java.io.ByteArrayInputStream(rawData); - errorID = "Byte array"; } boxLength = cio_read(4); if (boxLength == 0x0000000c) { diff --git a/openpdf-core/src/main/java/org/openpdf/text/pdf/BidiLine.java b/openpdf-core/src/main/java/org/openpdf/text/pdf/BidiLine.java index 6b5e0ca1e..9eee7bba9 100644 --- a/openpdf-core/src/main/java/org/openpdf/text/pdf/BidiLine.java +++ b/openpdf-core/src/main/java/org/openpdf/text/pdf/BidiLine.java @@ -813,7 +813,6 @@ public PdfLine processLine(float leftX, float width, int alignment, int runDirec */ public float getWidth(int startIdx, int lastIdx) { char c = 0; - char uniC; PdfChunk ck = null; float width = 0; for (; startIdx <= lastIdx; ++startIdx) { diff --git a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfBatchUtils.java b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfBatchUtils.java index ff7dabfac..6564d7bb5 100644 --- a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfBatchUtils.java +++ b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfBatchUtils.java @@ -234,7 +234,4 @@ public static int perms(boolean print, boolean modify, boolean copy, boolean ann public static int aes128() { return PdfWriter.ENCRYPTION_AES_128; } public static int aes256() { return PdfWriter.ENCRYPTION_AES_256_V3; } - /** Small utility for closing Closeables, ignoring exceptions. */ - private static void closeQuietly(Closeable c) { try { if (c != null) c.close(); } catch (Exception ignored) {} } - } diff --git a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfCell.java b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfCell.java index 91463879e..166d20423 100644 --- a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfCell.java +++ b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfCell.java @@ -694,7 +694,6 @@ private float remainingLinesHeight() { return 0; } float result = 0; - int size = lines.size(); PdfLine line; for (Object line1 : lines) { line = (PdfLine) line1; diff --git a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfChunk.java b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfChunk.java index 50844107b..31db1c8b0 100644 --- a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfChunk.java +++ b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfChunk.java @@ -514,7 +514,6 @@ PdfChunk truncate(float width) { // or until the totalWidth is reached int length = value.length(); boolean surrogate = false; - char character; while (currentPosition < length) { // the width of every character is added to the currentWidth surrogate = Utilities.isSurrogatePair(value, currentPosition); diff --git a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfEncodings.java b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfEncodings.java index df580b4f6..2344e34ac 100644 --- a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfEncodings.java +++ b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfEncodings.java @@ -204,7 +204,6 @@ public static final byte[] convertToBytes(String text, String encoding) { if (encoding.equals(PdfObject.TEXT_UNICODE)) { // workaround for jdk 1.2.2 bug char[] cc = text.toCharArray(); - int len = cc.length; byte[] b = new byte[cc.length * 2 + 2]; b[0] = -2; b[1] = -1; diff --git a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfGraphics2D.java b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfGraphics2D.java index 184904bec..5992ded07 100644 --- a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfGraphics2D.java +++ b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfGraphics2D.java @@ -745,7 +745,6 @@ private void setStrokeDiff(Stroke newStroke, Stroke oldStroke) { cb.setLiteral("[]0 d\n"); } else { cb.setLiteral('['); - int lim = dash.length; for (float dash1 : dash) { cb.setLiteral(dash1); cb.setLiteral(' '); diff --git a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfString.java b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfString.java index 4b7b9bde5..257510307 100644 --- a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfString.java +++ b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfString.java @@ -153,7 +153,6 @@ public void toPdf(PdfWriter writer, OutputStream os) throws IOException { if (hexWriting) { ByteBuffer buf = new ByteBuffer(); buf.append('<'); - int len = b.length; for (byte b1 : b) { buf.appendHex(b1); } diff --git a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfTable.java b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfTable.java index a04b356bf..bd749d74c 100644 --- a/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfTable.java +++ b/openpdf-core/src/main/java/org/openpdf/text/pdf/PdfTable.java @@ -206,7 +206,6 @@ private void updateRowAdditionsInternal() { } // loop over all the cells - int n = newCells.size(); for (Object newCell : newCells) { currentCell = (PdfCell) newCell; try { diff --git a/openpdf-core/src/main/java/org/openpdf/text/pdf/TSAClientBouncyCastle.java b/openpdf-core/src/main/java/org/openpdf/text/pdf/TSAClientBouncyCastle.java index f29774777..e17f78365 100644 --- a/openpdf-core/src/main/java/org/openpdf/text/pdf/TSAClientBouncyCastle.java +++ b/openpdf-core/src/main/java/org/openpdf/text/pdf/TSAClientBouncyCastle.java @@ -229,10 +229,8 @@ protected byte[] getTimeStampToken(byte[] imprint) throws Exception { "tsa.1.failed.to.return.time.stamp.token.2", tsaURL, response.getStatusString())); } - TimeStampTokenInfo info = tsToken.getTimeStampInfo(); // to view // details byte[] encoded = tsToken.getEncoded(); - long stop = System.currentTimeMillis(); // Update our token size estimate for the next call (padded to be // safe) diff --git a/openpdf-core/src/main/java/org/openpdf/text/xml/XMLUtil.java b/openpdf-core/src/main/java/org/openpdf/text/xml/XMLUtil.java index 822b29d76..42cf7dc05 100644 --- a/openpdf-core/src/main/java/org/openpdf/text/xml/XMLUtil.java +++ b/openpdf-core/src/main/java/org/openpdf/text/xml/XMLUtil.java @@ -54,7 +54,6 @@ public class XMLUtil { */ public static String escapeXML(String s, boolean onlyASCII) { char[] cc = s.toCharArray(); - int len = cc.length; StringBuilder sb = new StringBuilder(); for (int c : cc) { switch (c) { diff --git a/openpdf-core/src/test/java/org/openpdf/text/Pdf20ComplianceTest.java b/openpdf-core/src/test/java/org/openpdf/text/Pdf20ComplianceTest.java index c1d44b381..213c5ed7f 100644 --- a/openpdf-core/src/test/java/org/openpdf/text/Pdf20ComplianceTest.java +++ b/openpdf-core/src/test/java/org/openpdf/text/Pdf20ComplianceTest.java @@ -107,38 +107,4 @@ private static String escapeXml(String s) { return s.replace("&", "&").replace("<", "<").replace(">", ">"); } - /** Extracts "x.y" from "%PDF-x.y" at file start. */ - private static String extractHeaderVersion(byte[] pdfBytes) { - int len = Math.min(pdfBytes.length, 4096); - String header = new String(pdfBytes, 0, len, StandardCharsets.ISO_8859_1); - int idx = header.indexOf("%PDF-"); - if (idx < 0) throw new IllegalStateException("PDF header not found"); - int start = idx + 5, end = start; - while (end < header.length()) { - char c = header.charAt(end); - if (!Character.isDigit(c) && c != '.') break; - end++; - } - return header.substring(start, end); - } - - /** Normalizes PdfReader#getPdfVersion(): '4' -> "1.4", "2.0" -> "2.0". May return null if not available. */ - private static String getVersionFromReaderNormalized(PdfReader reader) { - try { - Method m = reader.getClass().getMethod("getPdfVersion"); - Object v = m.invoke(reader); - if (v == null) return null; - if (v instanceof Character) { - char c = (Character) v; - if (Character.isDigit(c)) return "1." + c; - return String.valueOf(c); - } - if (v instanceof String) return (String) v; - } catch (NoSuchMethodException ignored) { - // Older/newer forks may differ; ignore gracefully. - } catch (Exception e) { - System.out.println("getPdfVersion() reflection error: " + e); - } - return null; - } } diff --git a/openpdf-core/src/test/java/org/openpdf/text/Pdf20ExamplesConformanceTest.java b/openpdf-core/src/test/java/org/openpdf/text/Pdf20ExamplesConformanceTest.java index a8ecc96fa..8fb4167d8 100644 --- a/openpdf-core/src/test/java/org/openpdf/text/Pdf20ExamplesConformanceTest.java +++ b/openpdf-core/src/test/java/org/openpdf/text/Pdf20ExamplesConformanceTest.java @@ -171,16 +171,6 @@ private static String parseHeaderVersion(byte[] bytes, int headerIdx) { return new String(bytes, start, end - start, StandardCharsets.ISO_8859_1); } - private static int countAscii(byte[] bytes, String token) { - int count = 0, idx = 0; - byte[] pat = token.getBytes(StandardCharsets.ISO_8859_1); - while ((idx = indexOf(bytes, pat, idx)) >= 0) { - count++; - idx += pat.length; - } - return count; - } - private static int indexOfAscii(byte[] bytes, String token) { return indexOf(bytes, token.getBytes(StandardCharsets.ISO_8859_1), 0); } diff --git a/openpdf-core/src/test/java/org/openpdf/text/pdf/ColumnTextSeparator.java b/openpdf-core/src/test/java/org/openpdf/text/pdf/ColumnTextSeparator.java index 7fe56962c..b05fd96f1 100644 --- a/openpdf-core/src/test/java/org/openpdf/text/pdf/ColumnTextSeparator.java +++ b/openpdf-core/src/test/java/org/openpdf/text/pdf/ColumnTextSeparator.java @@ -48,14 +48,12 @@ public void test_columnTextSeparator() throws Exception { ct.setExtraParagraphSpace(6); ct.setLeading(0, 1.2f); ct.setFollowingIndent(27); - int linesWritten = 0; int column = 0; int status = ColumnText.START_COLUMN; while (ColumnText.hasMoreText(status)) { ct.setSimpleColumn(COLUMNS[column][0], COLUMNS[column][1], COLUMNS[column][2], COLUMNS[column][3]); ct.setYLine(COLUMNS[column][3]); status = ct.go(); - linesWritten += ct.getLinesWritten(); column = Math.abs(column - 1); if (column == 0) { document.newPage(); diff --git a/openpdf-html/src/test/java/org/openpdf/css/parser/ParserTest.java b/openpdf-html/src/test/java/org/openpdf/css/parser/ParserTest.java index 4c702c3f5..dba824e16 100644 --- a/openpdf-html/src/test/java/org/openpdf/css/parser/ParserTest.java +++ b/openpdf-html/src/test/java/org/openpdf/css/parser/ParserTest.java @@ -41,32 +41,27 @@ public void cssParsingPerformance() throws IOException { String longTest = test.repeat(count); assertThat(longTest.length()).as("Long enough input").isEqualTo(test.length() * count); - long total = 0; for (int i = 0; i < 40; i++) { long start = System.currentTimeMillis(); CSSParser p = new CSSParser(errorHandler); Stylesheet stylesheet = p.parseStylesheet(null, USER_AGENT, new StringReader(longTest)); long end = System.currentTimeMillis(); - total += (end-start); assertThat(stylesheet.getContents()).hasSize(count); } - total = 0; for (int i = 0; i < 10; i++) { long start = System.currentTimeMillis(); CSSParser p = new CSSParser(errorHandler); Stylesheet stylesheet = p.parseStylesheet(null, USER_AGENT, new StringReader(longTest)); long end = System.currentTimeMillis(); // System.out.println("Took " + (end-start) + " ms"); - total += (end-start); assertThat(stylesheet.getContents()).hasSize(count); } CSSParser p = new CSSParser(errorHandler); - total = 0; for (int i = 0; i < 10; i++) { long start = System.currentTimeMillis(); for (int j = 0; j < 10000; j++) { @@ -77,7 +72,6 @@ public void cssParsingPerformance() throws IOException { } long end = System.currentTimeMillis(); // System.out.println("Took " + (end-start) + " ms"); - total += (end-start); } } diff --git a/openpdf-renderer/src/main/java/org/openpdf/renderer/PDFFile.java b/openpdf-renderer/src/main/java/org/openpdf/renderer/PDFFile.java index 517def048..2f0a199b0 100644 --- a/openpdf-renderer/src/main/java/org/openpdf/renderer/PDFFile.java +++ b/openpdf-renderer/src/main/java/org/openpdf/renderer/PDFFile.java @@ -111,11 +111,11 @@ public class PDFFile { * protected and requires a password */ public PDFFile(ByteBuffer buf) throws IOException { - this(buf, null); + this(buf, null); } public PDFFile(ByteBuffer buf, boolean doNotParse) throws IOException { - this.buf = buf; + this.buf = buf; } /** @@ -247,48 +247,48 @@ public synchronized PDFObject dereference(PDFXref ref, PDFDecrypter decrypter) boolean compressed = this.objIdx[id].getCompressed(); if (!compressed) { - int loc = this.objIdx[id].getFilePos(); - if (loc < 0) { - return PDFObject.nullObj; - } - - // move to where this object is - this.buf.position(loc); - - // read the object and cache the reference - obj= readObject(ref.getID(), ref.getGeneration(), decrypter); + int loc = this.objIdx[id].getFilePos(); + if (loc < 0) { + return PDFObject.nullObj; + } + + // move to where this object is + this.buf.position(loc); + + // read the object and cache the reference + obj= readObject(ref.getID(), ref.getGeneration(), decrypter); } else { // compressed - int compId = this.objIdx[id].getID(); - int idx = this.objIdx[id].getIndex(); - if (idx < 0) - return PDFObject.nullObj; - PDFXref compRef = new PDFXref(compId, 0); - PDFObject compObj = dereference(compRef, decrypter); - int first = compObj.getDictionary().get("First").getIntValue(); - int length = compObj.getDictionary().get("Length").getIntValue(); - int n = compObj.getDictionary().get("N").getIntValue(); - if (idx >= n) - return PDFObject.nullObj; - ByteBuffer strm = compObj.getStreamBuffer(); - - ByteBuffer oldBuf = this.buf; - this.buf = strm; - // skip other nums - for (int i=0; i= n) + return PDFObject.nullObj; + ByteBuffer strm = compObj.getStreamBuffer(); + + ByteBuffer oldBuf = this.buf; + this.buf = strm; + // skip other nums + for (int i=0; i hm = new HashMap(); // we've already read the <<. Now get /Name obj pairs until >> PDFObject name; - while ((name= readObject(objNum, objGen, decrypter))!=null) { + while ((name= readObject(objNum, objGen, decrypter))!=null) { // make sure first item is a NAME if (name.getType() != PDFObject.NAME) { throw new PDFParseException("First item in dictionary must be a /Name. (Was " + name + ")"); } - PDFObject value= readObject(objNum, objGen, decrypter); + PDFObject value= readObject(objNum, objGen, decrypter); if (value != null) { hm.put(name.getStringValue(), value); } @@ -844,7 +834,7 @@ private PDFObject readArray( // we've already read the [. Now read objects until ] ArrayList ary = new ArrayList(); PDFObject obj; - while((obj= readObject(objNum, objGen, decrypter))!=null) { + while((obj= readObject(objNum, objGen, decrypter))!=null) { ary.add(obj); } if (this.buf.hasRemaining() && this.buf.get() != ']') { @@ -1038,16 +1028,16 @@ private void readTrailer(PDFPassword password) while (true) { // make sure we are looking at an xref table if (!nextItemIs("xref")) { - this.buf.position(pos); - readTrailer15(password); - return; + this.buf.position(pos); + readTrailer15(password); + return; // throw new PDFParseException("Expected 'xref' at start of table"); } // read a bunch of linked tabled while (true) { // read until the word "trailer" - PDFObject obj=readObject(-1, -1, IdentityDecrypter.getInstance()); + PDFObject obj=readObject(-1, -1, IdentityDecrypter.getInstance()); if (obj.getType() == PDFObject.KEYWORD && obj.getStringValue().equals("trailer")) { break; @@ -1113,7 +1103,7 @@ private void readTrailer(PDFPassword password) } // at this point, the "trailer" word (not EOL) has been read. - PDFObject trailerdict = readObject(-1, -1, IdentityDecrypter.getInstance()); + PDFObject trailerdict = readObject(-1, -1, IdentityDecrypter.getInstance()); if (trailerdict.getType() != PDFObject.DICTIONARY) { throw new IOException("Expected dictionary after \"trailer\""); } @@ -1160,7 +1150,7 @@ private void readTrailer(PDFPassword password) if (xrefstmPos != null) { int pos14 = this.buf.position(); this.buf.position(xrefstmPos.getIntValue()); - readTrailer15(password); + readTrailer15(password); this.buf.position(pos14); } @@ -1216,90 +1206,90 @@ private void readTrailer15(PDFPassword password) PDFAuthenticationFailureException, EncryptionUnsupportedByProductException, EncryptionUnsupportedByPlatformException { - + // the table of xrefs // objIdx is initialized from readTrailer(), do not overwrite here data from hybrid PDFs // objIdx = new PDFXref[50]; PDFDecrypter newDefaultDecrypter = null; while (true) { - PDFObject xrefObj = readObject(-1, -1, IdentityDecrypter.getInstance()); - if (xrefObj == null) { - break; - } - HashMap trailerdict = xrefObj.getDictionary(); - if (trailerdict == null) { - break; - } - PDFObject pdfObject = trailerdict.get("W"); - if (pdfObject == null) { - break; - } - PDFObject[] wNums = pdfObject.getArray(); - int l1 = wNums[0].getIntValue(); - int l2 = wNums[1].getIntValue(); - int l3 = wNums[2].getIntValue(); - - int size = trailerdict.get("Size").getIntValue(); - - byte[] strmbuf = xrefObj.getStream(); - int strmPos = 0; - - PDFObject idxNums = trailerdict.get("Index"); - int[] idxArray; - if (idxNums == null) { - idxArray = new int[]{0, size}; - } - else { - PDFObject[] idxNumArr = idxNums.getArray(); - idxArray = new int[idxNumArr.length]; - for (int i = 0; i < idxNumArr.length; i++) { - idxArray[i] = idxNumArr[i].getIntValue(); - } - } - int idxLen = idxArray.length; - int idxPos = 0; - - - while (idxPos= this.objIdx.length) { - PDFXref nobjIdx[] = new PDFXref[refstart + reflen]; - System.arraycopy(this.objIdx, 0, nobjIdx, 0, this.objIdx.length); - this.objIdx = nobjIdx; - } - - // read reference lines - for (int refID = refstart; refID < refstart + reflen; refID++) { - - int type = readNum(strmbuf, strmPos, l1); - strmPos += l1; - int id = readNum(strmbuf, strmPos, l2); - strmPos += l2; - int gen = readNum(strmbuf, strmPos, l3); - strmPos += l3; - - // ignore this line if the object ID is already defined - if (this.objIdx[refID] != null) { - continue; - } - - // see if it's an active object - if (type == 0) { // inactive - this.objIdx[refID] = new PDFXref(null); - } else if (type == 1) { // active uncompressed - this.objIdx[refID] = new PDFXref(id, gen); - } else { // active compressed - this.objIdx[refID] = new PDFXref(id, gen, true); - } - - } - } - - // read the root object location + PDFObject xrefObj = readObject(-1, -1, IdentityDecrypter.getInstance()); + if (xrefObj == null) { + break; + } + HashMap trailerdict = xrefObj.getDictionary(); + if (trailerdict == null) { + break; + } + PDFObject pdfObject = trailerdict.get("W"); + if (pdfObject == null) { + break; + } + PDFObject[] wNums = pdfObject.getArray(); + int l1 = wNums[0].getIntValue(); + int l2 = wNums[1].getIntValue(); + int l3 = wNums[2].getIntValue(); + + int size = trailerdict.get("Size").getIntValue(); + + byte[] strmbuf = xrefObj.getStream(); + int strmPos = 0; + + PDFObject idxNums = trailerdict.get("Index"); + int[] idxArray; + if (idxNums == null) { + idxArray = new int[]{0, size}; + } + else { + PDFObject[] idxNumArr = idxNums.getArray(); + idxArray = new int[idxNumArr.length]; + for (int i = 0; i < idxNumArr.length; i++) { + idxArray[i] = idxNumArr[i].getIntValue(); + } + } + int idxLen = idxArray.length; + int idxPos = 0; + + + while (idxPos= this.objIdx.length) { + PDFXref nobjIdx[] = new PDFXref[refstart + reflen]; + System.arraycopy(this.objIdx, 0, nobjIdx, 0, this.objIdx.length); + this.objIdx = nobjIdx; + } + + // read reference lines + for (int refID = refstart; refID < refstart + reflen; refID++) { + + int type = readNum(strmbuf, strmPos, l1); + strmPos += l1; + int id = readNum(strmbuf, strmPos, l2); + strmPos += l2; + int gen = readNum(strmbuf, strmPos, l3); + strmPos += l3; + + // ignore this line if the object ID is already defined + if (this.objIdx[refID] != null) { + continue; + } + + // see if it's an active object + if (type == 0) { // inactive + this.objIdx[refID] = new PDFXref(null); + } else if (type == 1) { // active uncompressed + this.objIdx[refID] = new PDFXref(id, gen); + } else { // active compressed + this.objIdx[refID] = new PDFXref(id, gen, true); + } + + } + } + + // read the root object location if (this.root == null) { this.root = trailerdict.get("Root"); if (this.root != null) { @@ -1375,13 +1365,13 @@ private void readTrailer15(PDFPassword password) } private int readNum(byte[] sbuf, int pos, int numBytes) { - int result = 0; - for (int i=0; i= 0 && xp <= 1) t = getMinT() + (dt1t0 * xp); - else if (xp < 0 && extendStart) t = getMinT(); - else if (xp > 1 && extendEnd) t = getMaxT(); - else render = false; + if (xp >= 0 && xp <= 1) t = getMinT() + (dt1t0 * xp); + else if (xp < 0 && extendStart) t = getMinT(); + else if (xp > 1 && extendEnd) t = getMaxT(); + else render = false; - if (render) { - // calculate the pixel values at t - inputs[0] = t; - if (functions.length == 1) { - functions[0].calculate(inputs, 0, outputs, 0); - } else { - for (int c = 0; c < functions.length; c++) { - functions[c].calculate(inputs, 0, outputs, c); - } - } - if (functions[0].getNumOutputs() != numComponents) { - //CMYK - outputRBG = shadeCSpace.getColorSpace().toRGB(outputs); - } - else outputRBG = outputs; + if (render) { + // calculate the pixel values at t + inputs[0] = t; + if (functions.length == 1) { + functions[0].calculate(inputs, 0, outputs, 0); + } else { + for (int c = 0; c < functions.length; c++) { + functions[c].calculate(inputs, 0, outputs, c); + } + } + if (functions[0].getNumOutputs() != numComponents) { + //CMYK + outputRBG = shadeCSpace.getColorSpace().toRGB(outputs); + } + else outputRBG = outputs; - int base = (j * w + i) * (numComponents + 1); - for (int c = 0; c < numComponents; c++) { - data[base + c] = (int) (outputRBG[c] * 255); - } - data[base + numComponents] = 255; - } - } - } + int base = (j * w + i) * (numComponents + 1); + for (int c = 0; c < numComponents; c++) { + data[base + c] = (int) (outputRBG[c] * 255); + } + data[base + numComponents] = 255; + } + } + } WritableRaster raster = getColorModel().createCompatibleWritableRaster(w, h); @@ -379,18 +379,5 @@ private float getXPrime(float x, float y, float x0, float y0) { return (float) tp; } - /** - * t = t0 + (t1 - t0) x x' - */ - private float getT(float xp) { - - if (xp < 0) { - return getMinT(); - } else if (xp > 1) { - return getMaxT(); - } else { - return getMinT() + (dt1t0 * xp); - } - } } } \ No newline at end of file