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_pHYs.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_pHYs
8   extends Chunk
9   {
10      Chunk_pHYs()
11      {
12          super(pHYs);
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          long pixelsPerUnitX = in_data.readUnsignedInt();
29          long pixelsPerUnitY = in_data.readUnsignedInt();
30          int unit = in_data.readUnsignedByte();
31          if (unit != PngImage.UNIT_UNKNOWN && unit != PngImage.UNIT_METER)
32              throw new PngExceptionSoft("Illegal pHYs chunk unit specifier: " + unit);
33  
34          img.data.properties.put("pixel dimensions x", new Long(pixelsPerUnitX));
35          img.data.properties.put("pixel dimensions y", new Long(pixelsPerUnitY));
36          img.data.properties.put("pixel dimensions unit", new Integer(unit));
37      }    
38  }