diff options
author | Sven Gothel <[email protected]> | 2015-08-19 05:55:09 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-08-19 05:55:09 +0200 |
commit | c4ed57f617117e3e38319f1a44a0d066f1a332b3 (patch) | |
tree | b4fcf17f9c1f8d51c7afdab28ec477ccbc51b220 /src/jogl/classes/com/jogamp/opengl/util/texture/spi | |
parent | 3e8ef0ae4305fede0f1ddac2fee476c76c5a25a3 (diff) |
Bug 1042: ImageIOUtil -> ImageType + ImageType.Util ; Fix implementation and test.
- ImageIOUtil -> ImageType + ImageType.Util
- ImageType.Util.getFileSuffix(..):
- Fix byte type conversion, i.e. 'b == (byte)0x89',
cast is required to avoid byte -> int conversion.
Note: signed byte -128 - +128
- Parse in O(1), i.e. lexicographical parsing
- FIXME: We seem to have at least three type collisions, validate!
- ImageType:
- Complete T_* w/ API doc -> FIXME/TODO missing type references!
- ImageType instancing via InputStream or manual type definition.
- TextureData
- Contains optional source ImageType
- TextureProvider:
- Deprecate newTextureData(..) variants other than InputStream
simplifying TextureIO.
- TextureProvider.SupportsImageTypes:
- Added interface, allowing mapping ImageType -> provider
- Tested standalone ImageType (TestImageTypeNEWT) and
via TextureIO (TestTextureIONEWT) utilizing list of all
test data (ImageTstFiles), i.e. PNG, JPG, TGA and DDS.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/texture/spi')
4 files changed, 18 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java index 36c44a409..6ad9f7cf1 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java @@ -53,8 +53,7 @@ import java.nio.channels.FileChannel; import com.jogamp.opengl.GL; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; -import com.jogamp.opengl.util.GLBuffers; -import com.jogamp.opengl.util.texture.ImageIOUtil; +import com.jogamp.opengl.util.texture.ImageType; /** A reader and writer for DirectDraw Surface (.dds) files, which are used to describe textures. These files can contain multiple mipmap @@ -246,7 +245,7 @@ public class DDSImage { @param in Stream to check @return true if input stream is DDS image or false otherwise @throws java.io.IOException if an I/O exception occurred - @deprecated rather call {@link ImageIOUtil#getFileSuffix(InputStream)} + @deprecated rather call {@link ImageType#getFileSuffix(InputStream)} */ @Deprecated public static boolean isDDSImage(InputStream in) throws IOException { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java index ff8167bb0..1330696d1 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java @@ -42,7 +42,7 @@ package com.jogamp.opengl.util.texture.spi; import java.io.*; import com.jogamp.opengl.*; -import com.jogamp.opengl.util.texture.ImageIOUtil; +import com.jogamp.opengl.util.texture.ImageType; import com.jogamp.common.util.IOUtil; /** <p> Reads and writes SGI RGB/RGBA images. </p> @@ -196,7 +196,7 @@ public class SGIImage { * an SGI RGB image. The given InputStream must return true from * markSupported() and support a minimum of two bytes of read-ahead. * - * @deprecated rather call {@link ImageIOUtil#getFileSuffix(InputStream)} + * @deprecated rather call {@link ImageType#getFileSuffix(InputStream)} */ @Deprecated public static boolean isSGIImage(InputStream in) throws IOException { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java index e84f300e2..5b316a975 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java @@ -54,6 +54,18 @@ import com.jogamp.opengl.util.texture.*; public interface TextureProvider { /** + * Optional additional interface for {@link TextureProvider} implementation + * exposing the supported {@link ImageType}s. + * <p> + * Use case: Mapping of {@link ImageType}s to {@link TextureProvider}. + * </p> + */ + public static interface SupportsImageTypes { + /** Returns the supported {@link ImageType}s. */ + ImageType[] getImageTypes(); + } + + /** * Produces a TextureData object from a file, or returns null if the * file format was not supported by this TextureProvider. Does not * do any OpenGL-related work. The resulting TextureData can be @@ -85,6 +97,7 @@ public interface TextureProvider { * file's contents * * @throws IOException if an error occurred while reading the file + * @deprecated Use {@link #newTextureData(GLProfile, InputStream, int, int, boolean, String) */ public TextureData newTextureData(GLProfile glp, File file, int internalFormat, @@ -163,6 +176,7 @@ public interface TextureProvider { * file's contents * * @throws IOException if an error occurred while reading the URL + * @deprecated Use {@link #newTextureData(GLProfile, InputStream, int, int, boolean, String) */ public TextureData newTextureData(GLProfile glp, URL url, int internalFormat, diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java index ba762baf3..5072c8c8f 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java @@ -39,7 +39,6 @@ package com.jogamp.opengl.util.texture.spi.awt; -import java.awt.Graphics; import java.awt.image.*; import java.io.*; import java.net.*; |