blob: e4d77d40aef354e27c740f175f1adb5d47ff30e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
package jogamp.opengl.util.pngj.chunks;
import jogamp.opengl.util.pngj.ImageInfo;
import jogamp.opengl.util.pngj.PngHelperInternal;
import jogamp.opengl.util.pngj.PngjException;
/**
* sRGB chunk.
* <p>
* see http://www.w3.org/TR/PNG/#11sRGB
*/
public class PngChunkSRGB extends PngChunkSingle {
public final static String ID = ChunkHelper.sRGB;
// 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(ID, info);
}
@Override
public ChunkOrderingConstraint getOrderingConstraint() {
return ChunkOrderingConstraint.BEFORE_PLTE_AND_IDAT;
}
@Override
public void parseFromRaw(ChunkRaw c) {
if (c.len != 1)
throw new PngjException("bad chunk length " + c);
intent = PngHelperInternal.readInt1fromByte(c.data, 0);
}
@Override
public ChunkRaw createRawChunk() {
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;
}
}
|