Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/sixlegs/image/png/Chunk_sRGB.java


1   // Copyright (C) 1998, 1999, 2001 Chris Nokleberg
2   // Please see included LICENSE.TXT
3   
4   package com.sixlegs.image.png;
5   import java.io.IOException;
6   
7   final class Chunk_sRGB
8   extends Chunk
9   {
10      Chunk_sRGB()
11      {
12          super(sRGB);
13      }
14  
15      protected boolean multipleOK()
16      {
17          return false;
18      }
19  
20      protected boolean beforeIDAT()
21      {
22          return true;
23      }
24  
25      protected void readData()
26      throws IOException
27      {
28          if (img.data.palette != null)
29              throw new PngException("sRGB chunk must precede PLTE chunk");
30          if (length != 1) badLength(1);
31          int intent = in_data.readUnsignedByte();
32  
33          new Chunk_VcHRM(img);
34          img.data.properties.put("gamma", new Long(PngImage.DEFAULT_GAMMA));
35          img.data.properties.put("srgb rendering intent", new Integer(intent));
36      }
37  }