aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util/pngj/chunks
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-07-02 22:25:23 +0200
committerSven Gothel <[email protected]>2013-07-02 22:25:23 +0200
commit51427b92a2d9cd3fc619854e26536c9c6adad947 (patch)
tree83b15620b717c1186771ed21ee1a5c6ab5a2f02b /src/jogl/classes/jogamp/opengl/util/pngj/chunks
parent35fcf49d1cb49e3844e7cee44f34d827d8a102ce (diff)
PNGJ: Bump to git sha1 a0b1101ba2d37de39428ed55c8189502e24a3125 of https://code.google.com/p/pngj/
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/pngj/chunks')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java9
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java23
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java17
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java11
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java53
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java31
9 files changed, 94 insertions, 59 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java
index 03d50c2c4..82ab3bcf9 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java
@@ -1,7 +1,8 @@
package jogamp.opengl.util.pngj.chunks;
/**
- * Defines gral strategy about what to do with ancillary (non-critical) chunks when reading
+ * Defines gral strategy about what to do with ancillary (non-critical) chunks
+ * when reading
*/
public enum ChunkLoadBehaviour {
/**
@@ -9,7 +10,8 @@ public enum ChunkLoadBehaviour {
*/
LOAD_CHUNK_NEVER,
/**
- * Ancillary chunks are loaded only if 'known' (registered with the factory).
+ * Ancillary chunks are loaded only if 'known' (registered with the
+ * factory).
*/
LOAD_CHUNK_KNOWN,
/**
@@ -19,7 +21,8 @@ public enum ChunkLoadBehaviour {
LOAD_CHUNK_IF_SAFE,
/**
* Load all chunks. <br>
- * Notice that other restrictions might apply, see PngReader.skipChunkMaxSize PngReader.skipChunkIds
+ * Notice that other restrictions might apply, see
+ * PngReader.skipChunkMaxSize PngReader.skipChunkIds
*/
LOAD_CHUNK_ALWAYS;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
index 8dd0ef476..3aba26cca 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
@@ -13,13 +13,15 @@ import jogamp.opengl.util.pngj.PngjOutputException;
/**
* Raw (physical) chunk.
* <p>
- * Short lived object, to be created while serialing/deserializing Do not reuse it for different chunks. <br>
+ * Short lived object, to be created while serialing/deserializing Do not reuse
+ * it for different chunks. <br>
* See http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html
*/
public class ChunkRaw {
/**
- * The length counts only the data field, not itself, the chunk type code, or the CRC. Zero is a valid length.
- * Although encoders and decoders should treat the length as unsigned, its value must not exceed 231-1 bytes.
+ * The length counts only the data field, not itself, the chunk type code,
+ * or the CRC. Zero is a valid length. Although encoders and decoders should
+ * treat the length as unsigned, its value must not exceed 231-1 bytes.
*/
public final int len;
@@ -29,12 +31,14 @@ public class ChunkRaw {
public final byte[] idbytes = new byte[4];
/**
- * The data bytes appropriate to the chunk type, if any. This field can be of zero length. Does not include crc
+ * The data bytes appropriate to the chunk type, if any. This field can be
+ * of zero length. Does not include crc
*/
public byte[] data = null;
/**
- * A 4-byte CRC (Cyclic Redundancy Check) calculated on the preceding bytes in the chunk, including the chunk type
- * code and chunk data fields, but not including the length field.
+ * A 4-byte CRC (Cyclic Redundancy Check) calculated on the preceding bytes
+ * in the chunk, including the chunk type code and chunk data fields, but
+ * not including the length field.
*/
private int crcval = 0;
@@ -71,7 +75,8 @@ public class ChunkRaw {
}
/**
- * Computes the CRC and writes to the stream. If error, a PngjOutputException is thrown
+ * Computes the CRC and writes to the stream. If error, a
+ * PngjOutputException is thrown
*/
public void writeChunk(OutputStream os) {
if (idbytes.length != 4)
@@ -85,8 +90,8 @@ public class ChunkRaw {
}
/**
- * position before: just after chunk id. positon after: after crc Data should be already allocated. Checks CRC
- * Return number of byte read.
+ * position before: just after chunk id. positon after: after crc Data
+ * should be already allocated. Checks CRC Return number of byte read.
*/
public int readChunkData(InputStream is, boolean checkCrc) {
PngHelperInternal.readBytes(is, data, 0, len);
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
index ad788f154..5ce94ff9f 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
@@ -49,8 +49,8 @@ public class ChunksList {
}
/**
- * Returns a copy of the list (but the chunks are not copied) <b> This should not be used for general metadata
- * handling
+ * Returns a copy of the list (but the chunks are not copied) <b> This
+ * should not be used for general metadata handling
*/
public ArrayList<PngChunk> getChunks() {
return new ArrayList<PngChunk>(chunks);
@@ -96,7 +96,8 @@ public class ChunksList {
}
/**
- * If innerid!=null and the chunk is PngChunkTextVar or PngChunkSPLT, it's filtered by that id
+ * If innerid!=null and the chunk is PngChunkTextVar or PngChunkSPLT, it's
+ * filtered by that id
*
* @param id
* @return innerid Only used for text and SPLT chunks
@@ -119,8 +120,9 @@ public class ChunksList {
/**
* Returns only one chunk or null if nothing found - does not include queued
* <p>
- * If more than one chunk is found, then an exception is thrown (failifMultiple=true or chunk is single) or the last
- * one is returned (failifMultiple=false)
+ * If more than one chunk is found, then an exception is thrown
+ * (failifMultiple=true or chunk is single) or the last one is returned
+ * (failifMultiple=false)
**/
public PngChunk getById1(final String id, final boolean failIfMultiple) {
return getById1(id, null, failIfMultiple);
@@ -129,8 +131,9 @@ public class ChunksList {
/**
* Returns only one chunk or null if nothing found - does not include queued
* <p>
- * If more than one chunk (after filtering by inner id) is found, then an exception is thrown (failifMultiple=true
- * or chunk is single) or the last one is returned (failifMultiple=false)
+ * If more than one chunk (after filtering by inner id) is found, then an
+ * exception is thrown (failifMultiple=true or chunk is single) or the last
+ * one is returned (failifMultiple=false)
**/
public PngChunk getById1(final String id, final String innerid, final boolean failIfMultiple) {
List<? extends PngChunk> list = getById(id, innerid);
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
index 204c4c2a5..e76456ad4 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
@@ -13,7 +13,8 @@ import jogamp.opengl.util.pngj.PngjOutputException;
public class ChunksListForWrite extends ChunksList {
/**
- * chunks not yet writen - does not include IHDR, IDAT, END, perhaps yes PLTE
+ * chunks not yet writen - does not include IHDR, IDAT, END, perhaps yes
+ * PLTE
*/
private final List<PngChunk> queuedChunks = new ArrayList<PngChunk>();
@@ -67,8 +68,9 @@ public class ChunksListForWrite extends ChunksList {
/**
* Remove Chunk: only from queued
*
- * WARNING: this depends on c.equals() implementation, which is straightforward for SingleChunks. For
- * MultipleChunks, it will normally check for reference equality!
+ * WARNING: this depends on c.equals() implementation, which is
+ * straightforward for SingleChunks. For MultipleChunks, it will normally
+ * check for reference equality!
*/
public boolean removeChunk(PngChunk c) {
return queuedChunks.remove(c);
@@ -87,7 +89,8 @@ public class ChunksListForWrite extends ChunksList {
}
/**
- * this should be called only for ancillary chunks and PLTE (groups 1 - 3 - 5)
+ * this should be called only for ancillary chunks and PLTE (groups 1 - 3 -
+ * 5)
**/
private static boolean shouldWrite(PngChunk c, int currentGroup) {
if (currentGroup == CHUNK_GROUP_2_PLTE)
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
index 1d630591e..a45979ec2 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
@@ -12,13 +12,16 @@ import jogamp.opengl.util.pngj.PngjExceptionInternal;
* Represents a instance of a PNG chunk.
* <p>
* See <a
- * href="http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html">http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks
- * .html</a> </a>
+ * href="http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html">http://www
+ * .libpng.org/pub/png/spec/1.2/PNG-Chunks .html</a> </a>
* <p>
- * Concrete classes should extend {@link PngChunkSingle} or {@link PngChunkMultiple}
+ * Concrete classes should extend {@link PngChunkSingle} or
+ * {@link PngChunkMultiple}
* <p>
- * Note that some methods/fields are type-specific (getOrderingConstraint(), allowsMultiple()),<br>
- * some are 'almost' type-specific (id,crit,pub,safe; the exception is PngUKNOWN), <br>
+ * Note that some methods/fields are type-specific (getOrderingConstraint(),
+ * allowsMultiple()),<br>
+ * some are 'almost' type-specific (id,crit,pub,safe; the exception is
+ * PngUKNOWN), <br>
* and the rest are instance-specific
*/
public abstract class PngChunk {
@@ -35,8 +38,9 @@ public abstract class PngChunk {
protected final ImageInfo imgInfo;
/**
- * Possible ordering constraint for a PngChunk type -only relevant for ancillary chunks. Theoretically, there could
- * be more general constraints, but these cover the constraints for standard chunks.
+ * Possible ordering constraint for a PngChunk type -only relevant for
+ * ancillary chunks. Theoretically, there could be more general constraints,
+ * but these cover the constraints for standard chunks.
*/
public enum ChunkOrderingConstraint {
/**
@@ -83,8 +87,8 @@ public abstract class PngChunk {
/**
* This static map defines which PngChunk class correspond to which ChunkID
* <p>
- * The client can add other chunks to this map statically, before reading an image, calling
- * PngChunk.factoryRegister(id,class)
+ * The client can add other chunks to this map statically, before reading an
+ * image, calling PngChunk.factoryRegister(id,class)
*/
private final static Map<String, Class<? extends PngChunk>> factoryMap = new HashMap<String, Class<? extends PngChunk>>();
static {
@@ -114,8 +118,9 @@ public abstract class PngChunk {
/**
* Registers a chunk-id (4 letters) to be associated with a PngChunk class
* <p>
- * This method should be called by user code that wants to add some chunks (not implmemented in this library) to the
- * factory, so that the PngReader knows about it.
+ * This method should be called by user code that wants to add some chunks
+ * (not implmemented in this library) to the factory, so that the PngReader
+ * knows about it.
*/
public static void factoryRegister(String chunkId, Class<? extends PngChunk> chunkClass) {
factoryMap.put(chunkId, chunkClass);
@@ -124,9 +129,11 @@ public abstract class PngChunk {
/**
* True if the chunk-id type is known.
* <p>
- * A chunk is known if we recognize its class, according with <code>factoryMap</code>
+ * A chunk is known if we recognize its class, according with
+ * <code>factoryMap</code>
* <p>
- * This is not necessarily the same as being "STANDARD", or being implemented in this library
+ * This is not necessarily the same as being "STANDARD", or being
+ * implemented in this library
* <p>
* Unknown chunks will be parsed as instances of {@link PngChunkUNKNOWN}
*/
@@ -143,7 +150,8 @@ public abstract class PngChunk {
}
/**
- * This factory creates the corresponding chunk and parses the raw chunk. This is used when reading.
+ * This factory creates the corresponding chunk and parses the raw chunk.
+ * This is used when reading.
*/
public static PngChunk factory(ChunkRaw chunk, ImageInfo info) {
PngChunk c = factoryFromId(ChunkHelper.toString(chunk.idbytes), info);
@@ -153,7 +161,8 @@ public abstract class PngChunk {
}
/**
- * Creates one new blank chunk of the corresponding type, according to factoryMap (PngChunkUNKNOWN if not known)
+ * Creates one new blank chunk of the corresponding type, according to
+ * factoryMap (PngChunkUNKNOWN if not known)
*/
public static PngChunk factoryFromId(String cid, ImageInfo info) {
PngChunk chunk = null;
@@ -189,7 +198,8 @@ public abstract class PngChunk {
}
/**
- * In which "chunkGroup" (see {@link ChunksList}for definition) this chunks instance was read or written.
+ * In which "chunkGroup" (see {@link ChunksList}for definition) this chunks
+ * instance was read or written.
* <p>
* -1 if not read or written (eg, queued)
*/
@@ -236,16 +246,16 @@ public abstract class PngChunk {
}
/**
- * Creates the physical chunk. This is used when writing (serialization). Each particular chunk class implements its
- * own logic.
+ * Creates the physical chunk. This is used when writing (serialization).
+ * Each particular chunk class implements its own logic.
*
* @return A newly allocated and filled raw chunk
*/
public abstract ChunkRaw createRawChunk();
/**
- * Parses raw chunk and fill inside data. This is used when reading (deserialization). Each particular chunk class
- * implements its own logic.
+ * Parses raw chunk and fill inside data. This is used when reading
+ * (deserialization). Each particular chunk class implements its own logic.
*/
public abstract void parseFromRaw(ChunkRaw c);
@@ -254,7 +264,8 @@ public abstract class PngChunk {
* <p>
* This is used when copying chunks from a reader to a writer
* <p>
- * It should normally be a deep copy, and after the cloning this.equals(other) should return true
+ * It should normally be a deep copy, and after the cloning
+ * this.equals(other) should return true
*/
public abstract void cloneDataFromRead(PngChunk other);
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java
index b816db205..911513c0d 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java
@@ -7,7 +7,8 @@ import jogamp.opengl.util.pngj.ImageInfo;
* <p>
* see http://www.w3.org/TR/PNG/#11IDAT
* <p>
- * This is dummy placeholder - we write/read this chunk (actually several) by special code.
+ * This is dummy placeholder - we write/read this chunk (actually several) by
+ * special code.
*/
public class PngChunkIDAT extends PngChunkMultiple {
public final static String ID = ChunkHelper.IDAT;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
index 696edd431..d44250a2f 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
@@ -17,7 +17,8 @@ public abstract class PngChunkMultiple extends PngChunk {
}
/**
- * NOTE: this chunk uses the default Object's equals() hashCode() implementation.
+ * NOTE: this chunk uses the default Object's equals() hashCode()
+ * implementation.
*
* This is the right thing to do, normally.
*
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
index 286f39db0..5247169e0 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
@@ -3,7 +3,8 @@ package jogamp.opengl.util.pngj.chunks;
import jogamp.opengl.util.pngj.ImageInfo;
/**
- * PNG chunk type (abstract) that does not allow multiple instances in same image.
+ * PNG chunk type (abstract) that does not allow multiple instances in same
+ * image.
*/
public abstract class PngChunkSingle extends PngChunk {
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
index 52d1b22c1..ecf8b98c3 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
@@ -7,13 +7,13 @@ import jogamp.opengl.util.pngj.PngHelperInternal;
import jogamp.opengl.util.pngj.PngjException;
/**
- * We consider "image metadata" every info inside the image except for the most basic image info (IHDR chunk - ImageInfo
- * class) and the pixels values.
+ * We consider "image metadata" every info inside the image except for the most
+ * basic image info (IHDR chunk - ImageInfo class) and the pixels values.
* <p>
* This includes the palette (if present) and all the ancillary chunks
* <p>
- * This class provides a wrapper over the collection of chunks of a image (read or to write) and provides some high
- * level methods to access them
+ * This class provides a wrapper over the collection of chunks of a image (read
+ * or to write) and provides some high level methods to access them
*/
public class PngMetadata {
private final ChunksList chunkList;
@@ -31,8 +31,9 @@ public class PngMetadata {
/**
* Queues the chunk at the writer
* <p>
- * lazyOverwrite: if true, checks if there is a queued "equivalent" chunk and if so, overwrites it. However if that
- * not check for already written chunks.
+ * lazyOverwrite: if true, checks if there is a queued "equivalent" chunk
+ * and if so, overwrites it. However if that not check for already written
+ * chunks.
*/
public void queueChunk(final PngChunk c, boolean lazyOverwrite) {
ChunksListForWrite cl = getChunkListW();
@@ -87,7 +88,8 @@ public class PngMetadata {
* Creates a time chunk with current time, less secsAgo seconds
* <p>
*
- * @return Returns the created-queued chunk, just in case you want to examine or modify it
+ * @return Returns the created-queued chunk, just in case you want to
+ * examine or modify it
*/
public PngChunkTIME setTimeNow(int secsAgo) {
PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo);
@@ -104,7 +106,8 @@ public class PngMetadata {
* Creates a time chunk with diven date-time
* <p>
*
- * @return Returns the created-queued chunk, just in case you want to examine or modify it
+ * @return Returns the created-queued chunk, just in case you want to
+ * examine or modify it
*/
public PngChunkTIME setTimeYMDHMS(int yearx, int monx, int dayx, int hourx, int minx, int secx) {
PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo);
@@ -137,7 +140,8 @@ public class PngMetadata {
* (arbitrary, should be latin1 if useLatin1)
* @param useLatin1
* @param compress
- * @return Returns the created-queued chunks, just in case you want to examine, touch it
+ * @return Returns the created-queued chunks, just in case you want to
+ * examine, touch it
*/
public PngChunkTextVar setText(String k, String val, boolean useLatin1, boolean compress) {
if (compress && !useLatin1)
@@ -180,7 +184,8 @@ public class PngMetadata {
}
/**
- * Returns empty if not found, concatenated (with newlines) if multiple! - and trimmed
+ * Returns empty if not found, concatenated (with newlines) if multiple! -
+ * and trimmed
* <p>
* Use getTxtsForKey() if you don't want this behaviour
*/
@@ -204,7 +209,8 @@ public class PngMetadata {
}
/**
- * Creates a new empty palette chunk, queues it for write and return it to the caller, who should fill its entries
+ * Creates a new empty palette chunk, queues it for write and return it to
+ * the caller, who should fill its entries
*/
public PngChunkPLTE createPLTEChunk() {
PngChunkPLTE plte = new PngChunkPLTE(chunkList.imageInfo);
@@ -222,7 +228,8 @@ public class PngMetadata {
}
/**
- * Creates a new empty TRNS chunk, queues it for write and return it to the caller, who should fill its entries
+ * Creates a new empty TRNS chunk, queues it for write and return it to the
+ * caller, who should fill its entries
*/
public PngChunkTRNS createTRNSChunk() {
PngChunkTRNS trns = new PngChunkTRNS(chunkList.imageInfo);