The code base for raw modules was updated to compile in current environment.

This commit is contained in:
oermolaev 2018-05-04 03:25:15 +03:00
parent 7c2423bc94
commit cdadbf7051
17 changed files with 233 additions and 94 deletions

View File

@ -58,6 +58,16 @@
<artifactId>imageio-bmp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-cr2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-dng</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-hdr</artifactId>
@ -78,6 +88,11 @@
<artifactId>imageio-jpeg</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-nef</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-pcx</artifactId>

View File

@ -33,7 +33,7 @@
<parent>
<artifactId>imageio</artifactId>
<groupId>com.twelvemonkeys.imageio</groupId>
<version>3.1-SNAPSHOT</version>
<version>3.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -32,10 +32,10 @@ import com.twelvemonkeys.imageio.ImageReaderBase;
import com.twelvemonkeys.imageio.metadata.CompoundDirectory;
import com.twelvemonkeys.imageio.metadata.Directory;
import com.twelvemonkeys.imageio.metadata.Entry;
import com.twelvemonkeys.imageio.metadata.exif.EXIFReader;
import com.twelvemonkeys.imageio.metadata.exif.TIFF;
import com.twelvemonkeys.imageio.metadata.jpeg.JPEGSegment;
import com.twelvemonkeys.imageio.metadata.jpeg.JPEGSegmentUtil;
import com.twelvemonkeys.imageio.metadata.tiff.TIFF;
import com.twelvemonkeys.imageio.metadata.tiff.TIFFReader;
import com.twelvemonkeys.imageio.stream.SubImageInputStream;
import javax.imageio.IIOException;
@ -111,7 +111,7 @@ public final class CR2ImageReader extends ImageReaderBase {
imageInput.seek(0);
IFDs = (CompoundDirectory) new EXIFReader().read(imageInput); // NOTE: Sets byte order as a side effect
IFDs = (CompoundDirectory) new TIFFReader().read(imageInput); // NOTE: Sets byte order as a side effect
if (DEBUG) {
System.err.println("Byte order: " + imageInput.getByteOrder());

View File

@ -28,12 +28,10 @@
package com.twelvemonkeys.imageio.plugins.cr2;
import com.twelvemonkeys.imageio.metadata.exif.TIFF;
import com.twelvemonkeys.imageio.spi.ProviderInfo;
import com.twelvemonkeys.imageio.util.IIOUtil;
import com.twelvemonkeys.imageio.metadata.tiff.TIFF;
import com.twelvemonkeys.imageio.spi.ImageReaderSpiBase;
import javax.imageio.ImageReader;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.stream.ImageInputStream;
import java.io.IOException;
import java.nio.ByteOrder;
@ -46,28 +44,9 @@ import java.util.Locale;
* @author last modified by $Author: haraldk$
* @version $Id: CR2ImageReaderSpi.java,v 1.0 07.04.14 21:26 haraldk Exp$
*/
public final class CR2ImageReaderSpi extends ImageReaderSpi {
public final class CR2ImageReaderSpi extends ImageReaderSpiBase {
public CR2ImageReaderSpi() {
this(IIOUtil.getProviderInfo(CR2ImageReaderSpi.class));
}
private CR2ImageReaderSpi(final ProviderInfo pProviderInfo) {
super(
pProviderInfo.getVendorName(),
pProviderInfo.getVersion(),
new String[]{"cr2", "CR2"},
new String[]{"cr2"},
new String[]{
"image/x-canon-raw", // TODO: Look up
},
"com.twelvemonkeys.imageio.plugins.cr2.CR2ImageReader",
new Class[] {ImageInputStream.class},
null,
true, null, null, null, null,
true,
null, null,
null, null
);
super(new CR2ProviderInfo());
}
public boolean canDecodeInput(final Object pSource) throws IOException {

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) 2018, Oleg Ermolaev
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name "TwelveMonkeys" nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.imageio.plugins.cr2;
import com.twelvemonkeys.imageio.spi.ReaderWriterProviderInfo;
/**
* @author Oleg Ermolaev Date: 04.05.2018 1:50
*/
class CR2ProviderInfo extends ReaderWriterProviderInfo {
protected CR2ProviderInfo() {
super(
CR2ProviderInfo.class,
new String[]{"cr2", "CR2"},
new String[]{"cr2"},
new String[]{"image/x-canon-raw", // TODO: Look up
},
"com.twelvemonkeys.imageio.plugins.cr2.CR2ImageReader",
new String[]{"com.twelvemonkeys.imageio.plugins.cr2.CR2ImageReaderSpi"},
null,
null,
true,
null,
null,
null,
null,
true,
null,
null,
null,
null
);
}
}

View File

@ -28,7 +28,7 @@
package com.twelvemonkeys.imageio.plugins.cr2;
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTest;
import org.junit.Ignore;
import org.junit.Test;
@ -47,7 +47,7 @@ import java.util.List;
* @version $Id: CR2ImageReaderTest.java,v 1.0 07.04.14 21:52 haraldk Exp$
*/
@Ignore
public class CR2ImageReaderTest extends ImageReaderAbstractTestCase {
public class CR2ImageReaderTest extends ImageReaderAbstractTest {
@Override
protected List<TestData> getTestData() {
return Arrays.asList(

View File

@ -33,7 +33,7 @@
<parent>
<artifactId>imageio</artifactId>
<groupId>com.twelvemonkeys.imageio</groupId>
<version>3.1-SNAPSHOT</version>
<version>3.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -32,8 +32,8 @@ import com.twelvemonkeys.imageio.ImageReaderBase;
import com.twelvemonkeys.imageio.metadata.CompoundDirectory;
import com.twelvemonkeys.imageio.metadata.Directory;
import com.twelvemonkeys.imageio.metadata.Entry;
import com.twelvemonkeys.imageio.metadata.exif.EXIFReader;
import com.twelvemonkeys.imageio.metadata.exif.TIFF;
import com.twelvemonkeys.imageio.metadata.tiff.TIFF;
import com.twelvemonkeys.imageio.metadata.tiff.TIFFReader;
import com.twelvemonkeys.imageio.stream.SubImageInputStream;
import com.twelvemonkeys.imageio.util.IIOUtil;
import com.twelvemonkeys.io.LittleEndianDataInputStream;
@ -101,7 +101,7 @@ public final class DNGImageReader extends ImageReaderBase {
if (IFDs == null) {
imageInput.seek(0);
IFDs = (CompoundDirectory) new EXIFReader().read(imageInput); // NOTE: Sets byte order as a side effect
IFDs = (CompoundDirectory) new TIFFReader().read(imageInput); // NOTE: Sets byte order as a side effect
// Pull up the sub-ifds now, as the DNG spec "recommends the use of SubIFD trees,
// as described in the TIFF-EP specification. SubIFD chains are not supported".

View File

@ -28,12 +28,10 @@
package com.twelvemonkeys.imageio.plugins.dng;
import com.twelvemonkeys.imageio.metadata.exif.TIFF;
import com.twelvemonkeys.imageio.spi.ProviderInfo;
import com.twelvemonkeys.imageio.util.IIOUtil;
import com.twelvemonkeys.imageio.metadata.tiff.TIFF;
import com.twelvemonkeys.imageio.spi.ImageReaderSpiBase;
import javax.imageio.ImageReader;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.stream.ImageInputStream;
import java.io.IOException;
import java.nio.ByteOrder;
@ -46,28 +44,9 @@ import java.util.Locale;
* @author last modified by $Author: haraldk$
* @version $Id: CR2ImageReaderSpi.java,v 1.0 07.04.14 21:26 haraldk Exp$
*/
public final class DNGImageReaderSpi extends ImageReaderSpi {
public final class DNGImageReaderSpi extends ImageReaderSpiBase {
public DNGImageReaderSpi() {
this(IIOUtil.getProviderInfo(DNGImageReaderSpi.class));
}
private DNGImageReaderSpi(final ProviderInfo pProviderInfo) {
super(
pProviderInfo.getVendorName(),
pProviderInfo.getVersion(),
new String[]{"dng", "NDG"},
new String[]{"dng"},
new String[]{
"image/x-adobe-dng", // TODO: Look up
},
"com.twelvemonkeys.imageio.plugins.dng.DNGImageReader",
new Class[] {ImageInputStream.class},
null,
true, null, null, null, null,
true,
null, null,
null, null
);
super(new DNGProviderInfo());
}
public boolean canDecodeInput(final Object pSource) throws IOException {

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2018, Oleg Ermolaev
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name "TwelveMonkeys" nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.imageio.plugins.dng;
import com.twelvemonkeys.imageio.spi.ReaderWriterProviderInfo;
/**
* @author Oleg Ermolaev Date: 04.05.2018 1:50
*/
class DNGProviderInfo extends ReaderWriterProviderInfo {
protected DNGProviderInfo() {
super(
DNGProviderInfo.class,
new String[]{"dng", "NDG"},
new String[]{"dng"},
new String[]{
"image/x-adobe-dng", // TODO: Look up
},
"com.twelvemonkeys.imageio.plugins.dng.DNGImageReader",
new String[]{"com.twelvemonkeys.imageio.plugins.dng.DNGImageReaderSpi"},
null,
null,
true,
null,
null,
null,
null,
true,
null,
null,
null,
null
);
}
}

View File

@ -28,7 +28,7 @@
package com.twelvemonkeys.imageio.plugins.dng;
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTest;
import org.junit.Ignore;
import org.junit.Test;
@ -47,7 +47,7 @@ import java.util.List;
* @version $Id: CR2ImageReaderTest.java,v 1.0 07.04.14 21:52 haraldk Exp$
*/
@Ignore
public class DNGImageReaderTest extends ImageReaderAbstractTestCase {
public class DNGImageReaderTest extends ImageReaderAbstractTest {
@Override
protected List<TestData> getTestData() {
return Arrays.asList(

View File

@ -33,7 +33,7 @@
<parent>
<artifactId>imageio</artifactId>
<groupId>com.twelvemonkeys.imageio</groupId>
<version>3.1-SNAPSHOT</version>
<version>3.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -32,8 +32,8 @@ import com.twelvemonkeys.imageio.ImageReaderBase;
import com.twelvemonkeys.imageio.metadata.CompoundDirectory;
import com.twelvemonkeys.imageio.metadata.Directory;
import com.twelvemonkeys.imageio.metadata.Entry;
import com.twelvemonkeys.imageio.metadata.exif.EXIFReader;
import com.twelvemonkeys.imageio.metadata.exif.TIFF;
import com.twelvemonkeys.imageio.metadata.tiff.TIFF;
import com.twelvemonkeys.imageio.metadata.tiff.TIFFReader;
import com.twelvemonkeys.imageio.stream.SubImageInputStream;
import javax.imageio.*;
@ -102,7 +102,7 @@ public final class NEFImageReader extends ImageReaderBase {
if (IFDs == null) {
imageInput.seek(0);
IFDs = (CompoundDirectory) new EXIFReader().read(imageInput); // NOTE: Sets byte order as a side effect
IFDs = (CompoundDirectory) new TIFFReader().read(imageInput); // NOTE: Sets byte order as a side effect
// Pull up the sub-ifds now
Entry subIFDEntry = IFDs.getEntryById(TIFF.TAG_SUB_IFD);

View File

@ -28,12 +28,10 @@
package com.twelvemonkeys.imageio.plugins.nef;
import com.twelvemonkeys.imageio.metadata.exif.TIFF;
import com.twelvemonkeys.imageio.spi.ProviderInfo;
import com.twelvemonkeys.imageio.util.IIOUtil;
import com.twelvemonkeys.imageio.metadata.tiff.TIFF;
import com.twelvemonkeys.imageio.spi.ImageReaderSpiBase;
import javax.imageio.ImageReader;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.stream.ImageInputStream;
import java.io.IOException;
import java.nio.ByteOrder;
@ -46,28 +44,9 @@ import java.util.Locale;
* @author last modified by $Author: haraldk$
* @version $Id: CR2ImageReaderSpi.java,v 1.0 07.04.14 21:26 haraldk Exp$
*/
public final class NEFImageReaderSpi extends ImageReaderSpi {
public final class NEFImageReaderSpi extends ImageReaderSpiBase {
public NEFImageReaderSpi() {
this(IIOUtil.getProviderInfo(NEFImageReaderSpi.class));
}
private NEFImageReaderSpi(final ProviderInfo pProviderInfo) {
super(
pProviderInfo.getVendorName(),
pProviderInfo.getVersion(),
new String[]{"nef", "NEF"},
new String[]{"nef"},
new String[]{
"image/x-nikon-nef", // TODO: Look up
},
"com.twelvemonkeys.imageio.plugins.nef.NEFImageReader",
new Class[] {ImageInputStream.class},
null,
true, null, null, null, null,
true,
null, null,
null, null
);
super(new NEFProviderInfo());
}
public boolean canDecodeInput(final Object pSource) throws IOException {

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2018, Oleg Ermolaev
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name "TwelveMonkeys" nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.imageio.plugins.nef;
import com.twelvemonkeys.imageio.spi.ReaderWriterProviderInfo;
/**
* @author Oleg Ermolaev Date: 04.05.2018 1:50
*/
class NEFProviderInfo extends ReaderWriterProviderInfo {
protected NEFProviderInfo() {
super(
NEFProviderInfo.class,
new String[]{"nef", "NEF"},
new String[]{"nef"},
new String[]{
"image/x-nikon-nef", // TODO: Look up
},
"com.twelvemonkeys.imageio.plugins.nef.NEFImageReader",
new String[]{"com.twelvemonkeys.imageio.plugins.nef.NEFImageReaderSpi"},
null,
null,
true,
null,
null,
null,
null,
true,
null,
null,
null,
null
);
}
}

View File

@ -28,7 +28,7 @@
package com.twelvemonkeys.imageio.plugins.nef;
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTest;
import org.junit.Ignore;
import org.junit.Test;
@ -47,7 +47,7 @@ import java.util.List;
* @version $Id: CR2ImageReaderTest.java,v 1.0 07.04.14 21:52 haraldk Exp$
*/
@Ignore
public class NEFImageReaderTest extends ImageReaderAbstractTestCase {
public class NEFImageReaderTest extends ImageReaderAbstractTest {
@Override
protected List<TestData> getTestData() {
return Arrays.asList(

View File

@ -32,7 +32,6 @@
<!-- Stand-alone readers/writers -->
<module>imageio-cr2</module>
<module>imageio-dng</module>
<module>imageio-ico</module>
<module>imageio-bmp</module>
<module>imageio-hdr</module>
<module>imageio-icns</module>
@ -132,6 +131,12 @@
<artifactId>imageio-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>imageio-core</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>