aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java
new file mode 100644
index 000000000..774558785
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java
@@ -0,0 +1,61 @@
+package jogamp.opengl.util.pngj.chunks;
+
+import jogamp.opengl.util.pngj.ImageInfo;
+import jogamp.opengl.util.pngj.PngHelper;
+import jogamp.opengl.util.pngj.PngjException;
+
+/*
+ */
+public class PngChunkSRGB extends PngChunk {
+ // http://www.w3.org/TR/PNG/#11sRGB
+
+ public static final int RENDER_INTENT_Perceptual = 0;
+ public static final int RENDER_INTENT_Relative_colorimetric = 1;
+ public static final int RENDER_INTENT_Saturation = 2;
+ public static final int RENDER_INTENT_Absolute_colorimetric = 3;
+
+ private int intent;
+
+ public PngChunkSRGB(ImageInfo info) {
+ super(ChunkHelper.sRGB, info);
+ }
+
+ @Override
+ public boolean mustGoBeforeIDAT() {
+ return true;
+ }
+
+ @Override
+ public boolean mustGoBeforePLTE() {
+ return true;
+ }
+
+ @Override
+ public void parseFromChunk(ChunkRaw c) {
+ if (c.len != 1)
+ throw new PngjException("bad chunk length " + c);
+ intent = PngHelper.readInt1fromByte(c.data, 0);
+ }
+
+ @Override
+ public ChunkRaw createChunk() {
+ ChunkRaw c = null;
+ c = createEmptyChunk(1, true);
+ c.data[0] = (byte) intent;
+ return c;
+ }
+
+ @Override
+ public void cloneDataFromRead(PngChunk other) {
+ PngChunkSRGB otherx = (PngChunkSRGB) other;
+ intent = otherx.intent;
+ }
+
+ public int getIntent() {
+ return intent;
+ }
+
+ public void setIntent(int intent) {
+ this.intent = intent;
+ }
+}