diff options
author | Sven Gothel <[email protected]> | 2009-10-11 07:41:31 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-10-11 07:41:31 -0700 |
commit | 8f76db4364f66c36780e762e086a18d5cc315363 (patch) | |
tree | 6c3291b08c76018bda59ad6fe3acf8fe686d0eb4 /src/jogl/classes/com/sun/opengl/util/texture/spi | |
parent | 6f6436ab9c7345f4d3b7bf5d8ee70addc9f11ab0 (diff) |
NEWT X11 Display Lock:
Integrate Display.lock/unlock,
so the generic Window will call it.
Specialized for X11Display, the only real impl of it.
Fixes offscreen EDT usage ..
GLProfile:
Add isAWTAvailable() and isAWTJOGLAvailable()
TextureIO:
- Add NetPbmTextureWriter
- Only use IIOTexture* if !isAWTJOGLAvailable()
- Add write (TextureData, File)
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/util/texture/spi')
-rw-r--r-- | src/jogl/classes/com/sun/opengl/util/texture/spi/NetPbmTextureWriter.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/NetPbmTextureWriter.java b/src/jogl/classes/com/sun/opengl/util/texture/spi/NetPbmTextureWriter.java index f771e0a3d..18df1dc55 100644 --- a/src/jogl/classes/com/sun/opengl/util/texture/spi/NetPbmTextureWriter.java +++ b/src/jogl/classes/com/sun/opengl/util/texture/spi/NetPbmTextureWriter.java @@ -58,7 +58,7 @@ public class NetPbmTextureWriter implements TextureWriter { /** * supported magic values are:<br> * <pre> - * magic 0 - auto + * magic 0 - detect by file suffix (TextureIO compliant) * magic 6 - PPM binary RGB * magic 7 - PAM binary RGB or RGBA * </pre> @@ -77,13 +77,25 @@ public class NetPbmTextureWriter implements TextureWriter { public int getMagic() { return magic; } - public static String getPPMSuffix() { return "ppm"; } - public static String getPAMSuffix() { return "pam"; } + public static final String PPM = "ppm"; + public static final String PAM = "pam"; - public String getSuffix() { return (magic==6)?getPPMSuffix():getPAMSuffix(); } + public String getSuffix() { return (magic==6)?PPM:PAM; } public boolean write(File file, TextureData data) throws IOException { + + // file suffix selection + if (0==magic) { + if (PPM.equals(FileUtil.getFileSuffix(file))) { + magic = 6; + } else if (PAM.equals(FileUtil.getFileSuffix(file))) { + magic = 7; + } else { + return false; + } + } + int pixelFormat = data.getPixelFormat(); int pixelType = data.getPixelType(); if ((pixelFormat == GL.GL_RGB || @@ -93,10 +105,6 @@ public class NetPbmTextureWriter implements TextureWriter { int comps = ( pixelFormat == GL.GL_RGBA ) ? 4 : 3 ; - if(0==magic) { - magic = ( comps == 4 ) ? 7 : 6 ; - } - if(magic==6 && comps==4) { throw new IOException("NetPbmTextureWriter magic 6 (PPM) doesn't RGBA pixel format, use magic 7 (PAM)"); } |