[
https://issues.apache.org/jira/browse/IMAGING-208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Joakim Knudsen updated IMAGING-208:
-----------------------------------
Description:
Effort has been made with Sanselan, to make an [Android compatible version of
the library (Sanselan-Android)|https://github.com/fulcrumapp/sanselan-android].
Running the library as-is (either Sanselan 0.97 or Commons Imaging) on Android
produces warnings and errors due to the lack of support of java.awt.
Exploring the code, comparing with the original Sanselan code (and Commons
Imaging), I find that Sanselan-Android essentially comments out all references
(imports etc) to {{java.awt.*}} -- typically {{java.awt.Dimension}},
{{java.awt.BufferedImage}}, and {{java.awt.color.ICC_ColorSpace}}.
As such, Sanselan-Android only supports JPEG and TIFF (snip from
{{ImageParser.java}}, note the parts commented out):
{code:java}
package org.apache.sanselan;
//import java.awt.Dimension;
//import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;
import org.apache.sanselan.common.BinaryFileParser;
import org.apache.sanselan.common.IImageMetadata;
import org.apache.sanselan.common.byteSources.ByteSource;
import org.apache.sanselan.common.byteSources.ByteSourceArray;
import org.apache.sanselan.common.byteSources.ByteSourceFile;
//import org.apache.sanselan.formats.bmp.BmpImageParser;
//import org.apache.sanselan.formats.gif.GifImageParser;
//import org.apache.sanselan.formats.ico.IcoImageParser;
import org.apache.sanselan.formats.jpeg.JpegImageParser;
//import org.apache.sanselan.formats.png.PngImageParser;
//import org.apache.sanselan.formats.pnm.PNMImageParser;
//import org.apache.sanselan.formats.psd.PsdImageParser;
import org.apache.sanselan.formats.tiff.TiffImageParser;
public abstract class ImageParser extends BinaryFileParser implements
SanselanConstants
{
public static final ImageParser[] getAllImageParsers()
{
ImageParser result[] = { new JpegImageParser(), new
TiffImageParser(),
// new PngImageParser()
// new BmpImageParser(),
// new GifImageParser(), new PsdImageParser(),
// new PNMImageParser(), new IcoImageParser(),
// new JBig2ImageParser(),
// new TgaImageParser(),
};
return result;
}
{code}
*It has been proposed to make an Android compatible version of Commons Imaging,
and I'd like to propose this work to be started :) I'd also like to contribute
as much as I can, but I'm not confident enough to be the main resource in such
a task.*
It seems to me that simply commenting out all references and usage of, say,
{{java.awt.Dimension}} is a unneccesarily crude fix, as this class appears to
me to be a simple (?) wrapper class of two dimensions (height and width)? Why
not replace this with something compatible with Android, and thus preserve
functionality? [This StackOverflow
post|https://stackoverflow.com/questions/8876130/class-dimension-for-java-on-android]
discusses writing an equivalent class, or, alternatively, using
[{{Point}}|https://developer.android.com/reference/android/graphics/Point.html].
was:
Effort has been made with Sanselan, to make an [Android compatible version of
the library (Sanselan-Android)|https://github.com/fulcrumapp/sanselan-android].
Running the library as-is (either Sanselan 0.97 or Commons Imaging) on Android
produces warnings and errors due to the lack of support of java.awt.
Exploring the code, comparing with the original Sanselan code (and Commons
Imaging), I find that Sanselan-Android essentially comments out all references
(imports etc) to {{java.awt.*}} -- typically {{java.awt.Dimension}},
{{java.awt.BufferedImage}}, and {{java.awt.color.ICC_ColorSpace}}.
As such, Sanselan-Android only supports JPEG and TIFF (snip from
{{ImageParser.java}}, note parts commented out):
{code:java}
package org.apache.sanselan;
//import java.awt.Dimension;
//import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;
import org.apache.sanselan.common.BinaryFileParser;
import org.apache.sanselan.common.IImageMetadata;
import org.apache.sanselan.common.byteSources.ByteSource;
import org.apache.sanselan.common.byteSources.ByteSourceArray;
import org.apache.sanselan.common.byteSources.ByteSourceFile;
//import org.apache.sanselan.formats.bmp.BmpImageParser;
//import org.apache.sanselan.formats.gif.GifImageParser;
//import org.apache.sanselan.formats.ico.IcoImageParser;
import org.apache.sanselan.formats.jpeg.JpegImageParser;
//import org.apache.sanselan.formats.png.PngImageParser;
//import org.apache.sanselan.formats.pnm.PNMImageParser;
//import org.apache.sanselan.formats.psd.PsdImageParser;
import org.apache.sanselan.formats.tiff.TiffImageParser;
public abstract class ImageParser extends BinaryFileParser implements
SanselanConstants
{
public static final ImageParser[] getAllImageParsers()
{
ImageParser result[] = { new JpegImageParser(), new
TiffImageParser(),
// new PngImageParser()
// new BmpImageParser(),
// new GifImageParser(), new PsdImageParser(),
// new PNMImageParser(), new IcoImageParser(),
// new JBig2ImageParser(),
// new TgaImageParser(),
};
return result;
}
{code}
*It has been proposed to make an Android compatible version of Commons Imaging,
and I'd like to propose this work to be started :) I'd also like to contribute
as much as I can, but I'm not confident enough to be the main resource in such
a task.*
It seems to me that simply commenting out all references and usage of, say,
{{java.awt.Dimension}} is a unneccesarily crude fix, as this class appears to
me to be a simple (?) wrapper class of two dimensions (height and width)? Why
not replace this with something compatible with Android, and thus preserve
functionality? [This StackOverflow
post|https://stackoverflow.com/questions/8876130/class-dimension-for-java-on-android]
discusses writing an equivalent class, or, alternatively, using
[{{Point}}|https://developer.android.com/reference/android/graphics/Point.html].
> Android version of Commons Imaging
> ----------------------------------
>
> Key: IMAGING-208
> URL: https://issues.apache.org/jira/browse/IMAGING-208
> Project: Commons Imaging
> Issue Type: New Feature
> Reporter: Joakim Knudsen
> Priority: Minor
>
> Effort has been made with Sanselan, to make an [Android compatible version of
> the library
> (Sanselan-Android)|https://github.com/fulcrumapp/sanselan-android]. Running
> the library as-is (either Sanselan 0.97 or Commons Imaging) on Android
> produces warnings and errors due to the lack of support of java.awt.
> Exploring the code, comparing with the original Sanselan code (and Commons
> Imaging), I find that Sanselan-Android essentially comments out all
> references (imports etc) to {{java.awt.*}} -- typically
> {{java.awt.Dimension}}, {{java.awt.BufferedImage}}, and
> {{java.awt.color.ICC_ColorSpace}}.
> As such, Sanselan-Android only supports JPEG and TIFF (snip from
> {{ImageParser.java}}, note the parts commented out):
> {code:java}
> package org.apache.sanselan;
> //import java.awt.Dimension;
> //import java.awt.image.BufferedImage;
> import java.io.File;
> import java.io.IOException;
> import java.io.PrintWriter;
> import java.io.StringWriter;
> import java.util.Map;
> import org.apache.sanselan.common.BinaryFileParser;
> import org.apache.sanselan.common.IImageMetadata;
> import org.apache.sanselan.common.byteSources.ByteSource;
> import org.apache.sanselan.common.byteSources.ByteSourceArray;
> import org.apache.sanselan.common.byteSources.ByteSourceFile;
> //import org.apache.sanselan.formats.bmp.BmpImageParser;
> //import org.apache.sanselan.formats.gif.GifImageParser;
> //import org.apache.sanselan.formats.ico.IcoImageParser;
> import org.apache.sanselan.formats.jpeg.JpegImageParser;
> //import org.apache.sanselan.formats.png.PngImageParser;
> //import org.apache.sanselan.formats.pnm.PNMImageParser;
> //import org.apache.sanselan.formats.psd.PsdImageParser;
> import org.apache.sanselan.formats.tiff.TiffImageParser;
> public abstract class ImageParser extends BinaryFileParser implements
> SanselanConstants
> {
> public static final ImageParser[] getAllImageParsers()
> {
> ImageParser result[] = { new JpegImageParser(), new
> TiffImageParser(),
> // new PngImageParser()
> // new BmpImageParser(),
> // new GifImageParser(), new PsdImageParser(),
> // new PNMImageParser(), new IcoImageParser(),
> // new JBig2ImageParser(),
> // new TgaImageParser(),
> };
> return result;
> }
> {code}
> *It has been proposed to make an Android compatible version of Commons
> Imaging, and I'd like to propose this work to be started :) I'd also like to
> contribute as much as I can, but I'm not confident enough to be the main
> resource in such a task.*
> It seems to me that simply commenting out all references and usage of, say,
> {{java.awt.Dimension}} is a unneccesarily crude fix, as this class appears to
> me to be a simple (?) wrapper class of two dimensions (height and width)? Why
> not replace this with something compatible with Android, and thus preserve
> functionality? [This StackOverflow
> post|https://stackoverflow.com/questions/8876130/class-dimension-for-java-on-android]
> discusses writing an equivalent class, or, alternatively, using
> [{{Point}}|https://developer.android.com/reference/android/graphics/Point.html].
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)