corrade-vassal – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 vero 1 /// <summary>**************************************************************************
2 ///
3 /// $Id: ImageHeaderBox.java,v 1.1 2002/07/25 14:50:47 grosbois Exp $
4 ///
5 /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 /// $Date $
7 /// ***************************************************************************
8 /// </summary>
9 using System;
10 using ColorSpaceException = CSJ2K.Color.ColorSpaceException;
11 using ParameterList = CSJ2K.j2k.util.ParameterList;
12 using RandomAccessIO = CSJ2K.j2k.io.RandomAccessIO;
13 using ICCProfile = CSJ2K.Icc.ICCProfile;
14 namespace CSJ2K.Color.Boxes
15 {
16  
17 /// <summary> This class models the Image Header box contained in a JP2
18 /// image. It is a stub class here since for colormapping the
19 /// knowlege of the existance of the box in the image is sufficient.
20 ///
21 /// </summary>
22 /// <version> 1.0
23 /// </version>
24 /// <author> Bruce A. Kern
25 /// </author>
26 public sealed class ImageHeaderBox:JP2Box
27 {
28  
29 internal long height;
30 internal long width;
31 internal int nc;
32 internal short bpc;
33 internal short c;
34 internal bool unk;
35 internal bool ipr;
36  
37  
38 /// <summary> Construct an ImageHeaderBox from an input image.</summary>
39 /// <param name="in">RandomAccessIO jp2 image
40 /// </param>
41 /// <param name="boxStart">offset to the start of the box in the image
42 /// </param>
43 /// <exception cref="IOException,">ColorSpaceException
44 /// </exception>
45 public ImageHeaderBox(RandomAccessIO in_Renamed, int boxStart):base(in_Renamed, boxStart)
46 {
47 readBox();
48 }
49  
50 /// <summary>Return a suitable String representation of the class instance. </summary>
51 public override System.String ToString()
52 {
53 System.Text.StringBuilder rep = new System.Text.StringBuilder("[ImageHeaderBox ").Append(eol).Append(" ");
54 rep.Append("height= ").Append(System.Convert.ToString(height)).Append(", ");
55 rep.Append("width= ").Append(System.Convert.ToString(width)).Append(eol).Append(" ");
56  
57 rep.Append("nc= ").Append(System.Convert.ToString(nc)).Append(", ");
58 rep.Append("bpc= ").Append(System.Convert.ToString(bpc)).Append(", ");
59 rep.Append("c= ").Append(System.Convert.ToString(c)).Append(eol).Append(" ");
60  
61 rep.Append("image colorspace is ").Append(new System.Text.StringBuilder(unk == true?"known":"unknown").ToString());
62 rep.Append(", the image ").Append(new System.Text.StringBuilder(ipr == true?"contains ":"does not contain ").ToString()).Append("intellectual property").Append("]");
63  
64 return rep.ToString();
65 }
66  
67 /// <summary>Analyze the box content. </summary>
68 internal void readBox()
69 {
70 byte[] bfr = new byte[14];
71 in_Renamed.seek(dataStart);
72 in_Renamed.readFully(bfr, 0, 14);
73  
74 height = ICCProfile.getInt(bfr, 0);
75 width = ICCProfile.getInt(bfr, 4);
76 nc = ICCProfile.getShort(bfr, 8);
77 bpc = (short) (bfr[10] & 0x00ff);
78 c = (short) (bfr[11] & 0x00ff);
79 unk = bfr[12] == 0?true:false;
80 ipr = bfr[13] == 1?true:false;
81 }
82  
83 /* end class ImageHeaderBox */
84 static ImageHeaderBox()
85 {
86 {
87 type = 69686472;
88 }
89 }
90 }
91 }