diff options
author | Sven Gothel <[email protected]> | 2012-04-07 15:28:37 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-04-07 15:28:37 +0200 |
commit | 40830196070013432bc5f453eb31cfe4c64e0510 (patch) | |
tree | ca31a1e1e27adf9996963176c4f92b84e25623e9 /src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java | |
parent | 865c0588de57c9a020a435bc3f08be0f3f6ba162 (diff) |
Merge PNGJ 0.85 into namespace
PNGJ Version 0.85 (1 April 2012)
Apache 2.0 License
http://code.google.com/p/pngj/
Merged code:
- Changed namespace ar.com.hjg.pngj -> jogamp.opengl.util.pngj
to avoid collision when using a different version of PNGJ.
- Removed test and lossy packages and helper classes
to reduce footprint.
License information is added in main LICENSE.txt file.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java new file mode 100644 index 000000000..c535fe34a --- /dev/null +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java @@ -0,0 +1,34 @@ +package jogamp.opengl.util.pngj.chunks;
+
+import jogamp.opengl.util.pngj.ImageInfo;
+import jogamp.opengl.util.pngj.PngHelper;
+
+public class PngChunkTEXT extends PngChunkTextVar {
+ public PngChunkTEXT(ImageInfo info) {
+ super(ChunkHelper.tEXt, info);
+ }
+
+ @Override
+ public ChunkRaw createChunk() {
+ if (val.isEmpty() || key.isEmpty())
+ return null;
+ byte[] b = (key + "\0" + val).getBytes(PngHelper.charsetLatin1);
+ ChunkRaw chunk = createEmptyChunk(b.length, false);
+ chunk.data = b;
+ return chunk;
+ }
+
+ @Override
+ public void parseFromChunk(ChunkRaw c) {
+ String[] k = (new String(c.data, PngHelper.charsetLatin1)).split("\0");
+ key = k[0];
+ val = k[1];
+ }
+
+ @Override
+ public void cloneDataFromRead(PngChunk other) {
+ PngChunkTEXT otherx = (PngChunkTEXT) other;
+ key = otherx.key;
+ val = otherx.val;
+ }
+}
|