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
@@ -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".
@@ -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 {
@@ -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
);
}
}
@@ -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(