corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | /// <summary>************************************************************************** |
2 | /// |
||
3 | /// $Id: JP2Box.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 FileFormatBoxes = CSJ2K.j2k.fileformat.FileFormatBoxes; |
||
12 | using ICCProfile = CSJ2K.Icc.ICCProfile; |
||
13 | using ParameterList = CSJ2K.j2k.util.ParameterList; |
||
14 | using RandomAccessIO = CSJ2K.j2k.io.RandomAccessIO; |
||
15 | namespace CSJ2K.Color.Boxes |
||
16 | { |
||
17 | |||
18 | /// <summary> The abstract super class modeling the aspects of |
||
19 | /// a JP2 box common to all such boxes. |
||
20 | /// |
||
21 | /// </summary> |
||
22 | /// <version> 1.0 |
||
23 | /// </version> |
||
24 | /// <author> Bruce A. Kern |
||
25 | /// </author> |
||
26 | public abstract class JP2Box |
||
27 | { |
||
28 | /// <summary>Platform dependant line terminator </summary> |
||
29 | //UPGRADE_NOTE: Final was removed from the declaration of 'eol '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'" |
||
30 | public static readonly System.String eol = System.Environment.NewLine; |
||
31 | /// <summary>Box type </summary> |
||
32 | public static int type; |
||
33 | |||
34 | /// <summary>Return a String representation of the Box type. </summary> |
||
35 | public static System.String getTypeString(int t) |
||
36 | { |
||
37 | return BoxType.get_Renamed(t); |
||
38 | } |
||
39 | |||
40 | /// <summary>Length of the box. </summary> |
||
41 | public int length; |
||
42 | /// <summary>input file </summary> |
||
43 | protected internal RandomAccessIO in_Renamed; |
||
44 | /// <summary>offset to start of box </summary> |
||
45 | protected internal int boxStart; |
||
46 | /// <summary>offset to end of box </summary> |
||
47 | protected internal int boxEnd; |
||
48 | /// <summary>offset to start of data in box </summary> |
||
49 | protected internal int dataStart; |
||
50 | |||
51 | public JP2Box() |
||
52 | { |
||
53 | try |
||
54 | { |
||
55 | throw new ColorSpaceException("JP2Box empty ctor called!!"); |
||
56 | } |
||
57 | catch (ColorSpaceException e) |
||
58 | { |
||
59 | SupportClass.WriteStackTrace(e, Console.Error); throw e; |
||
60 | } |
||
61 | } |
||
62 | |||
63 | /// <summary> Construct a JP2Box from an input image.</summary> |
||
64 | /// <param name="in">RandomAccessIO jp2 image |
||
65 | /// </param> |
||
66 | /// <param name="boxStart">offset to the start of the box in the image |
||
67 | /// </param> |
||
68 | /// <exception cref="IOException,">ColorSpaceException |
||
69 | /// </exception> |
||
70 | public JP2Box(RandomAccessIO in_Renamed, int boxStart) |
||
71 | { |
||
72 | byte[] boxHeader = new byte[16]; |
||
73 | |||
74 | this.in_Renamed = in_Renamed; |
||
75 | this.boxStart = boxStart; |
||
76 | |||
77 | this.in_Renamed.seek(this.boxStart); |
||
78 | this.in_Renamed.readFully(boxHeader, 0, 8); |
||
79 | |||
80 | this.dataStart = boxStart + 8; |
||
81 | this.length = ICCProfile.getInt(boxHeader, 0); |
||
82 | this.boxEnd = boxStart + length; |
||
83 | if (length == 1) |
||
84 | throw new ColorSpaceException("extended length boxes not supported"); |
||
85 | } |
||
86 | |||
87 | |||
88 | /// <summary>Return the box type as a String. </summary> |
||
89 | public virtual System.String getTypeString() |
||
90 | { |
||
91 | return BoxType.get_Renamed(JP2Box.type); |
||
92 | } |
||
93 | |||
94 | |||
95 | /// <summary>JP2 Box structure analysis help </summary> |
||
96 | [Serializable] |
||
97 | protected internal class BoxType:System.Collections.Hashtable |
||
98 | { |
||
99 | |||
100 | private static System.Collections.Hashtable map = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable()); |
||
101 | |||
102 | private static void put(int type, System.String desc) |
||
103 | { |
||
104 | map[(System.Int32) type] = desc; |
||
105 | } |
||
106 | |||
107 | public static System.String get_Renamed(int type) |
||
108 | { |
||
109 | return (System.String) map[(System.Int32) type]; |
||
110 | } |
||
111 | |||
112 | /* end class BoxType */ |
||
113 | static BoxType() |
||
114 | { |
||
115 | { |
||
116 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.BITS_PER_COMPONENT_BOX, "BITS_PER_COMPONENT_BOX"); |
||
117 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.CAPTURE_RESOLUTION_BOX, "CAPTURE_RESOLUTION_BOX"); |
||
118 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.CHANNEL_DEFINITION_BOX, "CHANNEL_DEFINITION_BOX"); |
||
119 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.COLOUR_SPECIFICATION_BOX, "COLOUR_SPECIFICATION_BOX"); |
||
120 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.COMPONENT_MAPPING_BOX, "COMPONENT_MAPPING_BOX"); |
||
121 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.CONTIGUOUS_CODESTREAM_BOX, "CONTIGUOUS_CODESTREAM_BOX"); |
||
122 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.DEFAULT_DISPLAY_RESOLUTION_BOX, "DEFAULT_DISPLAY_RESOLUTION_BOX"); |
||
123 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.FILE_TYPE_BOX, "FILE_TYPE_BOX"); |
||
124 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.IMAGE_HEADER_BOX, "IMAGE_HEADER_BOX"); |
||
125 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.INTELLECTUAL_PROPERTY_BOX, "INTELLECTUAL_PROPERTY_BOX"); |
||
126 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.JP2_HEADER_BOX, "JP2_HEADER_BOX"); |
||
127 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.JP2_SIGNATURE_BOX, "JP2_SIGNATURE_BOX"); |
||
128 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.PALETTE_BOX, "PALETTE_BOX"); |
||
129 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.RESOLUTION_BOX, "RESOLUTION_BOX"); |
||
130 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.URL_BOX, "URL_BOX"); |
||
131 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.UUID_BOX, "UUID_BOX"); |
||
132 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.UUID_INFO_BOX, "UUID_INFO_BOX"); |
||
133 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.UUID_LIST_BOX, "UUID_LIST_BOX"); |
||
134 | put(CSJ2K.j2k.fileformat.FileFormatBoxes.XML_BOX, "XML_BOX"); |
||
135 | } |
||
136 | } |
||
137 | } |
||
138 | |||
139 | /* end class JP2Box */ |
||
140 | } |
||
141 | } |