Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 23523DDC3 for ; Thu, 4 Oct 2012 20:07:37 +0000 (UTC) Received: (qmail 12038 invoked by uid 500); 4 Oct 2012 20:07:36 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 11948 invoked by uid 500); 4 Oct 2012 20:07:36 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 11940 invoked by uid 99); 4 Oct 2012 20:07:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Oct 2012 20:07:36 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Oct 2012 20:07:30 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 26AEE238899C for ; Thu, 4 Oct 2012 20:06:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1394234 - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/formats/pnm/ test/data/images/pbm/2/ test/java/org/apache/commons/imaging/formats/jpeg/ test/java/org/apache/commons/imaging/formats/png/ test/java/org/ap... Date: Thu, 04 Oct 2012 20:06:44 -0000 To: commits@commons.apache.org From: damjan@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121004200645.26AEE238899C@eris.apache.org> Author: damjan Date: Thu Oct 4 20:06:43 2012 New Revision: 1394234 URL: http://svn.apache.org/viewvc?rev=1394234&view=rev Log: Support the alpha channel for PAM files. Fix the alpha channel order when reading and writing. Add various tests. Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw-alpha.asm commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw-alpha.pam (with props) commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw.asm commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw.pam (with props) commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale-alpha.asm commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale-alpha.pam (with props) commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale.asm commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale.pam (with props) commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb-alpha.asm commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb-alpha.pam (with props) commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb.asm commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb.pam - copied, changed from r1393921, commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5.pam Removed: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5.pam Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java?rev=1394234&r1=1394233&r2=1394234&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java Thu Oct 4 20:06:43 2012 @@ -32,6 +32,8 @@ public abstract class FileInfo { this.RAWBITS = RAWBITS; } + public abstract boolean hasAlpha(); + public abstract int getNumComponents(); public abstract int getBitDepth(); @@ -73,7 +75,7 @@ public abstract class FileInfo { // invalid values -> black sample = 0; } - return (int)((sample * max / scale) + 0.5f); + return (int)((sample * scale / max) + 0.5f); } public void readImage(ImageBuilder imageBuilder, InputStream is) Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java?rev=1394234&r1=1394233&r2=1394234&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java Thu Oct 4 20:06:43 2012 @@ -52,9 +52,9 @@ public class PamFileInfo extends FileInf hasAlpha = tupleType.endsWith("_ALPHA"); if (tupleType.equals("BLACKANDWHITE") || tupleType.equals("BLACKANDWHITE_ALPHA")) { - tupleReader = new BlackAndWhiteTupleReader(); + tupleReader = new GrayscaleTupleReader(ImageInfo.COLOR_TYPE_BW); } else if (tupleType.equals("GRAYSCALE") || tupleType.equals("GRAYSCALE_ALPHA")) { - tupleReader = new GrayscaleTupleReader(); + tupleReader = new GrayscaleTupleReader(ImageInfo.COLOR_TYPE_GRAYSCALE); } else if (tupleType.equals("RGB") || tupleType.equals("RGB_ALPHA")) { tupleReader = new ColorTupleReader(); } else { @@ -63,6 +63,11 @@ public class PamFileInfo extends FileInf } @Override + public boolean hasAlpha() { + return hasAlpha; + } + + @Override public int getNumComponents() { return depth; } @@ -93,11 +98,6 @@ public class PamFileInfo extends FileInf } @Override - protected void newline() { - tupleReader.newline(); - } - - @Override public int getRGB(WhiteSpaceReader wsr) throws IOException { throw new UnsupportedOperationException("PAM files are only ever binary"); } @@ -110,74 +110,30 @@ public class PamFileInfo extends FileInf private abstract class TupleReader { public abstract int getColorType(); public abstract int getRGB(InputStream is) throws IOException; - public void newline() { - } } - private class BlackAndWhiteTupleReader extends TupleReader { - private int bitcache = 0; - private int bits_in_cache = 0; - - @Override - public int getColorType() { - return ImageInfo.COLOR_TYPE_BW; - } + private class GrayscaleTupleReader extends TupleReader { + private final int colorType; - @Override - public int getRGB(InputStream is) throws IOException { - if (bits_in_cache < 1) { - int bits = is.read(); - if (bits < 0) { - throw new IOException("PAM: Unexpected EOF"); - } - bitcache = 0xff & bits; - bits_in_cache += 8; - } - - int alpha = 0xff000000; - if (hasAlpha) { - int alphaBit = 0x1 & (bitcache >> 7); - bitcache <<= 1; - bits_in_cache--; - alpha = alphaBit * 0xff000000; - } - - int bit = 0x1 & (bitcache >> 7); - bitcache <<= 1; - bits_in_cache--; - - if (bit == 0) { - return alpha | 0x000000; - } - if (bit == 1) { - return alpha | 0xffffff; - } - throw new IOException("PAM: bad bit: " + bit); + public GrayscaleTupleReader(int colorType) { + this.colorType = colorType; } @Override - public void newline() { - bitcache = 0; - bits_in_cache = 0; - } - } - - private class GrayscaleTupleReader extends TupleReader { - @Override public int getColorType() { - return ImageInfo.COLOR_TYPE_GRAYSCALE; + return colorType; } @Override public int getRGB(InputStream is) throws IOException { + int sample = readSample(is, bytesPerSample); + sample = scaleSample(sample, scale, maxval); + int alpha = 0xff; if (hasAlpha) { alpha = readSample(is, bytesPerSample); alpha = scaleSample(alpha, scale, maxval); } - - int sample = readSample(is, bytesPerSample); - sample = scaleSample(sample, scale, maxval); int rgb = ((0xff & alpha) << 24) | ((0xff & sample) << 16) | ((0xff & sample) << 8) | ((0xff & sample) << 0); @@ -194,11 +150,6 @@ public class PamFileInfo extends FileInf @Override public int getRGB(InputStream is) throws IOException { - int alpha = 0xff; - if (hasAlpha) { - alpha = readSample(is, bytesPerSample); - alpha = scaleSample(alpha, scale, maxval); - } int red = readSample(is, bytesPerSample); int green = readSample(is, bytesPerSample); int blue = readSample(is, bytesPerSample); @@ -207,6 +158,12 @@ public class PamFileInfo extends FileInf green = scaleSample(green, scale, maxval); blue = scaleSample(blue, scale, maxval); + int alpha = 0xff; + if (hasAlpha) { + alpha = readSample(is, bytesPerSample); + alpha = scaleSample(alpha, scale, maxval); + } + int rgb = ((0xff & alpha) << 24) | ((0xff & red) << 16) | ((0xff & green) << 8) | ((0xff & blue) << 0); Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java?rev=1394234&r1=1394233&r2=1394234&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java Thu Oct 4 20:06:43 2012 @@ -46,7 +46,7 @@ public class PamWriter extends PnmWriter os.write(("HEIGHT " + height).getBytes("US-ASCII")); os.write(PNM_NEWLINE); - os.write(("DEPTH 3").getBytes("US-ASCII")); + os.write(("DEPTH 4").getBytes("US-ASCII")); os.write(PNM_NEWLINE); os.write(("MAXVAL 255").getBytes("US-ASCII")); @@ -66,10 +66,10 @@ public class PamWriter extends PnmWriter int green = 0xff & (argb >> 8); int blue = 0xff & (argb >> 0); - os.write((byte) alpha); os.write((byte) red); os.write((byte) green); os.write((byte) blue); + os.write((byte) alpha); } } } Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java?rev=1394234&r1=1394233&r2=1394234&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java Thu Oct 4 20:06:43 2012 @@ -26,6 +26,11 @@ public class PbmFileInfo extends FileInf public PbmFileInfo(int width, int height, boolean RAWBITS) { super(width, height, RAWBITS); } + + @Override + public boolean hasAlpha() { + return false; + } @Override public int getNumComponents() { Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java?rev=1394234&r1=1394233&r2=1394234&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java Thu Oct 4 20:06:43 2012 @@ -45,6 +45,11 @@ public class PgmFileInfo extends FileInf } this.max = max; } + + @Override + public boolean hasAlpha() { + return false; + } @Override public int getNumComponents() { Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java?rev=1394234&r1=1394233&r2=1394234&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java Thu Oct 4 20:06:43 2012 @@ -260,7 +260,7 @@ public class PnmImageParser extends Imag String FormatDetails = info.getImageTypeDescription(); - boolean isTransparent = false; + boolean isTransparent = info.hasAlpha(); boolean usesPalette = false; int ColorType = info.getColorType(); @@ -305,7 +305,7 @@ public class PnmImageParser extends Imag int width = info.width; int height = info.height; - boolean hasAlpha = false; + boolean hasAlpha = info.hasAlpha(); ImageBuilder imageBuilder = new ImageBuilder(width, height, hasAlpha); info.readImage(imageBuilder, is); Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java?rev=1394234&r1=1394233&r2=1394234&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java (original) +++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java Thu Oct 4 20:06:43 2012 @@ -45,6 +45,11 @@ public class PpmFileInfo extends FileInf } this.max = max; } + + @Override + public boolean hasAlpha() { + return false; + } @Override public int getNumComponents() { Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw-alpha.asm URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw-alpha.asm?rev=1394234&view=auto ============================================================================== --- commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw-alpha.asm (added) +++ commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw-alpha.asm Thu Oct 4 20:06:43 2012 @@ -0,0 +1,40 @@ +; Licensed to the Apache Software Foundation (ASF) under one +; or more contributor license agreements. See the NOTICE file +; distributed with this work for additional information +; regarding copyright ownership. The ASF licenses this file +; to you under the Apache License, Version 2.0 (the +; "License"); you may not use this file except in compliance +; with the License. You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, +; software distributed under the License is distributed on an +; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +; KIND, either express or implied. See the License for the +; specific language governing permissions and limitations +; under the License. + + +; Assemblers are the perfect tool for generating +; custom test images as they let us insert offsets +; to unknown locations easily and totally +; customize the file byte-by-byte. +; +; To generate the binary file from this, run: +; nasm -f bin /path/to/this/file.asm -o /path/to/file.ext + +db 'P7',10 +db 'WIDTH 5',10 +db 'HEIGHT 5',10 +db 'DEPTH 2',10 +db 'MAXVAL 1',10 +db 'TUPLTYPE BLACKANDWHITE_ALPHA',10 +db 'ENDHDR',10 + +db 0,1,1,1,0,1,1,1,0,1 +db 1,1,0,1,1,1,0,1,1,1 +db 0,1,1,1,0,1,1,1,0,1 +db 1,0,0,0,1,0,0,0,1,0 +db 0,0,1,0,0,0,1,0,0,0 + Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw-alpha.pam URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw-alpha.pam?rev=1394234&view=auto ============================================================================== Binary file - no diff available. Propchange: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw-alpha.pam ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw.asm URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw.asm?rev=1394234&view=auto ============================================================================== --- commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw.asm (added) +++ commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw.asm Thu Oct 4 20:06:43 2012 @@ -0,0 +1,38 @@ +; Licensed to the Apache Software Foundation (ASF) under one +; or more contributor license agreements. See the NOTICE file +; distributed with this work for additional information +; regarding copyright ownership. The ASF licenses this file +; to you under the Apache License, Version 2.0 (the +; "License"); you may not use this file except in compliance +; with the License. You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, +; software distributed under the License is distributed on an +; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +; KIND, either express or implied. See the License for the +; specific language governing permissions and limitations +; under the License. + + +; Assemblers are the perfect tool for generating +; custom test images as they let us insert offsets +; to unknown locations easily and totally +; customize the file byte-by-byte. +; +; To generate the binary file from this, run: +; nasm -f bin /path/to/this/file.asm -o /path/to/file.ext + +db 'P7',10 +db 'WIDTH 5',10 +db 'HEIGHT 5',10 +db 'DEPTH 1',10 +db 'MAXVAL 1',10 +db 'TUPLTYPE BLACKANDWHITE',10 +db 'ENDHDR',10 +db 0,1,0,1,0 +db 1,0,1,0,1 +db 0,1,0,1,0 +db 1,0,1,0,1 +db 0,1,0,1,0 Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw.pam URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw.pam?rev=1394234&view=auto ============================================================================== Binary file - no diff available. Propchange: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-bw.pam ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale-alpha.asm URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale-alpha.asm?rev=1394234&view=auto ============================================================================== --- commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale-alpha.asm (added) +++ commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale-alpha.asm Thu Oct 4 20:06:43 2012 @@ -0,0 +1,38 @@ +; Licensed to the Apache Software Foundation (ASF) under one +; or more contributor license agreements. See the NOTICE file +; distributed with this work for additional information +; regarding copyright ownership. The ASF licenses this file +; to you under the Apache License, Version 2.0 (the +; "License"); you may not use this file except in compliance +; with the License. You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, +; software distributed under the License is distributed on an +; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +; KIND, either express or implied. See the License for the +; specific language governing permissions and limitations +; under the License. + + +; Assemblers are the perfect tool for generating +; custom test images as they let us insert offsets +; to unknown locations easily and totally +; customize the file byte-by-byte. +; +; To generate the binary file from this, run: +; nasm -f bin /path/to/this/file.asm -o /path/to/file.ext + +db 'P7',10 +db 'WIDTH 5',10 +db 'HEIGHT 5',10 +db 'DEPTH 2',10 +db 'MAXVAL 4',10 +db 'TUPLTYPE GRAYSCALE_ALPHA',10 +db 'ENDHDR',10 +db 0,4,1,4,2,4,3,4,4,4 +db 0,3,1,3,2,3,3,3,4,3 +db 0,2,1,2,2,2,3,2,4,2 +db 0,1,1,1,2,1,3,1,4,1 +db 0,0,1,0,2,0,3,0,4,0 Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale-alpha.pam URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale-alpha.pam?rev=1394234&view=auto ============================================================================== Binary file - no diff available. Propchange: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale-alpha.pam ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale.asm URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale.asm?rev=1394234&view=auto ============================================================================== --- commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale.asm (added) +++ commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale.asm Thu Oct 4 20:06:43 2012 @@ -0,0 +1,38 @@ +; Licensed to the Apache Software Foundation (ASF) under one +; or more contributor license agreements. See the NOTICE file +; distributed with this work for additional information +; regarding copyright ownership. The ASF licenses this file +; to you under the Apache License, Version 2.0 (the +; "License"); you may not use this file except in compliance +; with the License. You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, +; software distributed under the License is distributed on an +; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +; KIND, either express or implied. See the License for the +; specific language governing permissions and limitations +; under the License. + + +; Assemblers are the perfect tool for generating +; custom test images as they let us insert offsets +; to unknown locations easily and totally +; customize the file byte-by-byte. +; +; To generate the binary file from this, run: +; nasm -f bin /path/to/this/file.asm -o /path/to/file.ext + +db 'P7',10 +db 'WIDTH 5',10 +db 'HEIGHT 5',10 +db 'DEPTH 1',10 +db 'MAXVAL 4',10 +db 'TUPLTYPE GRAYSCALE',10 +db 'ENDHDR',10 +db 0,1,2,3,4 +db 0,1,2,3,4 +db 0,1,2,3,4 +db 0,1,2,3,4 +db 0,1,2,3,4 Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale.pam URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale.pam?rev=1394234&view=auto ============================================================================== Binary file - no diff available. Propchange: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-grayscale.pam ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb-alpha.asm URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb-alpha.asm?rev=1394234&view=auto ============================================================================== --- commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb-alpha.asm (added) +++ commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb-alpha.asm Thu Oct 4 20:06:43 2012 @@ -0,0 +1,40 @@ +; Licensed to the Apache Software Foundation (ASF) under one +; or more contributor license agreements. See the NOTICE file +; distributed with this work for additional information +; regarding copyright ownership. The ASF licenses this file +; to you under the Apache License, Version 2.0 (the +; "License"); you may not use this file except in compliance +; with the License. You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, +; software distributed under the License is distributed on an +; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +; KIND, either express or implied. See the License for the +; specific language governing permissions and limitations +; under the License. + + +; Assemblers are the perfect tool for generating +; custom test images as they let us insert offsets +; to unknown locations easily and totally +; customize the file byte-by-byte. +; +; To generate the binary file from this, run: +; nasm -f bin /path/to/this/file.asm -o /path/to/file.ext + +db 'P7',10 +db 'WIDTH 5',10 +db 'HEIGHT 5',10 +db 'DEPTH 4',10 +db 'MAXVAL 255',10 +db 'TUPLTYPE RGB_ALPHA',10 +db 'ENDHDR',10 + +db 0xff,0x00,0xff,0xff, 0xff,0x00,0xff,0xff, 0xff,0x00,0xff,0xff, 0xff,0x00,0xff,0xff, 0xff,0x00,0xff,0xff +db 0xff,0x00,0xff,0xc0, 0xff,0x00,0xff,0xc0, 0xff,0x00,0xff,0xc0, 0xff,0x00,0xff,0xc0, 0xff,0x00,0xff,0xc0 +db 0xff,0x00,0xff,0x80, 0xff,0x00,0xff,0x80, 0xff,0x00,0xff,0x80, 0xff,0x00,0xff,0x80, 0xff,0x00,0xff,0x80 +db 0xff,0x00,0xff,0x40, 0xff,0x00,0xff,0x40, 0xff,0x00,0xff,0x40, 0xff,0x00,0xff,0x40, 0xff,0x00,0xff,0x40 +db 0xff,0x00,0xff,0x00, 0xff,0x00,0xff,0x00, 0xff,0x00,0xff,0x00, 0xff,0x00,0xff,0x00, 0xff,0x00,0xff,0x00 + Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb-alpha.pam URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb-alpha.pam?rev=1394234&view=auto ============================================================================== Binary file - no diff available. Propchange: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb-alpha.pam ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb.asm URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb.asm?rev=1394234&view=auto ============================================================================== --- commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb.asm (added) +++ commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb.asm Thu Oct 4 20:06:43 2012 @@ -0,0 +1,38 @@ +; Licensed to the Apache Software Foundation (ASF) under one +; or more contributor license agreements. See the NOTICE file +; distributed with this work for additional information +; regarding copyright ownership. The ASF licenses this file +; to you under the Apache License, Version 2.0 (the +; "License"); you may not use this file except in compliance +; with the License. You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, +; software distributed under the License is distributed on an +; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +; KIND, either express or implied. See the License for the +; specific language governing permissions and limitations +; under the License. + + +; Assemblers are the perfect tool for generating +; custom test images as they let us insert offsets +; to unknown locations easily and totally +; customize the file byte-by-byte. +; +; To generate the binary file from this, run: +; nasm -f bin /path/to/this/file.asm -o /path/to/file.ext + +db 'P7',10 +db 'WIDTH 5',10 +db 'HEIGHT 5',10 +db 'DEPTH 3',10 +db 'MAXVAL 255',10 +db 'TUPLTYPE RGB',10 +db 'ENDHDR',10 +db 0xff,0x00,0x00, 0xff,0x00,0x00, 0xff,0x00,0x00, 0xff,0x00,0x00, 0xff,0x00,0x00 +db 0x00,0xff,0x00, 0x00,0xff,0x00, 0x00,0xff,0x00, 0x00,0xff,0x00, 0x00,0xff,0x00 +db 0x00,0x00,0xff, 0x00,0x00,0xff, 0x00,0x00,0xff, 0x00,0x00,0xff, 0x00,0x00,0xff +db 0xff,0x00,0xff, 0xff,0x00,0xff, 0xff,0x00,0xff, 0xff,0x00,0xff, 0xff,0x00,0xff +db 0xff,0xff,0xff, 0xff,0xff,0xff, 0xff,0xff,0xff, 0xff,0xff,0xff, 0xff,0xff,0xff Copied: commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb.pam (from r1393921, commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5.pam) URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb.pam?p2=commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5-rgb.pam&p1=commons/proper/imaging/trunk/src/test/data/images/pbm/2/5x5.pam&r1=1393921&r2=1394234&rev=1394234&view=diff ============================================================================== Binary files - no diff available. Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java?rev=1394234&r1=1394233&r2=1394234&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java (original) +++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java Thu Oct 4 20:06:43 2012 @@ -48,6 +48,8 @@ public class JpegReadTest extends JpegBa IImageMetadata metadata = Imaging.getMetadata(imageFile, params); // assertNotNull(metadata); Debug.debug("metadata", metadata); + + Debug.debug("ICC profile", Imaging.getICCProfile(imageFile, params)); ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params); assertNotNull(imageInfo); Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java?rev=1394234&r1=1394233&r2=1394234&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java (original) +++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java Thu Oct 4 20:06:43 2012 @@ -63,6 +63,8 @@ public class PngReadTest extends PngBase ImageInfo imageInfo = Imaging.getImageInfo(imageFile); assertNotNull(imageInfo); + Debug.debug("ICC profile", Imaging.getICCProfile(imageFile)); + BufferedImage image = Imaging.getBufferedImage(imageFile); assertNotNull(image); } Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java?rev=1394234&r1=1394233&r2=1394234&view=diff ============================================================================== --- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java (original) +++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java Thu Oct 4 20:06:43 2012 @@ -40,6 +40,8 @@ public class TiffReadTest extends TiffBa IImageMetadata metadata = Imaging.getMetadata(imageFile); assertNotNull(metadata); + Debug.debug("ICC profile", Imaging.getICCProfile(imageFile)); + ImageInfo imageInfo = Imaging.getImageInfo(imageFile); assertNotNull(imageInfo);