corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | /* |
2 | * CVS Identifier: |
||
3 | * |
||
4 | * $Id: DataBlkInt.java,v 1.7 2001/10/09 12:51:54 grosbois Exp $ |
||
5 | * |
||
6 | * Interface: DataBlkInt |
||
7 | * |
||
8 | * Description: A signed int implementation of DataBlk |
||
9 | * |
||
10 | * |
||
11 | * |
||
12 | * COPYRIGHT: |
||
13 | * |
||
14 | * This software module was originally developed by Raphaël Grosbois and |
||
15 | * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel |
||
16 | * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David |
||
17 | * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research |
||
18 | * Centre France S.A) in the course of development of the JPEG2000 |
||
19 | * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This |
||
20 | * software module is an implementation of a part of the JPEG 2000 |
||
21 | * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio |
||
22 | * Systems AB and Canon Research Centre France S.A (collectively JJ2000 |
||
23 | * Partners) agree not to assert against ISO/IEC and users of the JPEG |
||
24 | * 2000 Standard (Users) any of their rights under the copyright, not |
||
25 | * including other intellectual property rights, for this software module |
||
26 | * with respect to the usage by ISO/IEC and Users of this software module |
||
27 | * or modifications thereof for use in hardware or software products |
||
28 | * claiming conformance to the JPEG 2000 Standard. Those intending to use |
||
29 | * this software module in hardware or software products are advised that |
||
30 | * their use may infringe existing patents. The original developers of |
||
31 | * this software module, JJ2000 Partners and ISO/IEC assume no liability |
||
32 | * for use of this software module or modifications thereof. No license |
||
33 | * or right to this software module is granted for non JPEG 2000 Standard |
||
34 | * conforming products. JJ2000 Partners have full right to use this |
||
35 | * software module for his/her own purpose, assign or donate this |
||
36 | * software module to any third party and to inhibit third parties from |
||
37 | * using this software module for non JPEG 2000 Standard conforming |
||
38 | * products. This copyright notice must be included in all copies or |
||
39 | * derivative works of this software module. |
||
40 | * |
||
41 | * Copyright (c) 1999/2000 JJ2000 Partners. |
||
42 | * */ |
||
43 | using System; |
||
44 | namespace CSJ2K.j2k.image |
||
45 | { |
||
46 | |||
47 | /// <summary> This is an implementation of the <tt>DataBlk</tt> interface for signed 32 |
||
48 | /// bit integral data. |
||
49 | /// |
||
50 | /// <p>The methods in this class are declared final, so that they can be |
||
51 | /// inlined by inlining compilers.</p> |
||
52 | /// |
||
53 | /// </summary> |
||
54 | /// <seealso cref="DataBlk"> |
||
55 | /// |
||
56 | /// </seealso> |
||
57 | public class DataBlkInt:DataBlk |
||
58 | { |
||
59 | /// <summary> Returns the identifier of this data type, <tt>TYPE_INT</tt>, as defined |
||
60 | /// in <tt>DataBlk</tt>. |
||
61 | /// |
||
62 | /// </summary> |
||
63 | /// <returns> The type of data stored. Always <tt>DataBlk.TYPE_INT</tt> |
||
64 | /// |
||
65 | /// </returns> |
||
66 | /// <seealso cref="DataBlk.TYPE_INT"> |
||
67 | /// |
||
68 | /// </seealso> |
||
69 | override public int DataType |
||
70 | { |
||
71 | get |
||
72 | { |
||
73 | return TYPE_INT; |
||
74 | } |
||
75 | |||
76 | } |
||
77 | //UPGRADE_NOTE: Respective javadoc comments were merged. It should be changed in order to comply with .NET documentation conventions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1199'" |
||
78 | /// <summary> Returns the array containing the data, or null if there is no data |
||
79 | /// array. The returned array is a int array. |
||
80 | /// |
||
81 | /// </summary> |
||
82 | /// <returns> The array of data (a int[]) or null if there is no data. |
||
83 | /// |
||
84 | /// </returns> |
||
85 | /// <summary> Sets the data array to the specified one. The provided array must be a |
||
86 | /// int array, otherwise a ClassCastException is thrown. The size of the |
||
87 | /// array is not checked for consistency with the block's dimensions. |
||
88 | /// |
||
89 | /// </summary> |
||
90 | /// <param name="arr">The data array to use. Must be a int array. |
||
91 | /// |
||
92 | /// </param> |
||
93 | override public System.Object Data |
||
94 | { |
||
95 | get |
||
96 | { |
||
97 | return data_array; |
||
98 | } |
||
99 | |||
100 | set |
||
101 | { |
||
102 | data_array = (int[]) value; |
||
103 | } |
||
104 | |||
105 | } |
||
106 | //UPGRADE_NOTE: Respective javadoc comments were merged. It should be changed in order to comply with .NET documentation conventions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1199'" |
||
107 | /// <summary> Returns the array containing the data, or null if there is no data |
||
108 | /// array. |
||
109 | /// |
||
110 | /// </summary> |
||
111 | /// <returns> The array of data or null if there is no data. |
||
112 | /// |
||
113 | /// </returns> |
||
114 | /// <summary> Sets the data array to the specified one. The size of the array is not |
||
115 | /// checked for consistency with the block's dimensions. This method is |
||
116 | /// more efficient than setData |
||
117 | /// |
||
118 | /// </summary> |
||
119 | /// <param name="arr">The data array to use. |
||
120 | /// |
||
121 | /// </param> |
||
122 | virtual public int[] DataInt |
||
123 | { |
||
124 | get |
||
125 | { |
||
126 | return data_array; |
||
127 | } |
||
128 | |||
129 | set |
||
130 | { |
||
131 | data_array = value; |
||
132 | } |
||
133 | |||
134 | } |
||
135 | /// <summary>The array where the data is stored </summary> |
||
136 | public int[] data_array; |
||
137 | |||
138 | /// <summary> Creates a DataBlkInt with 0 dimensions and no data array (i.e. data is |
||
139 | /// null). |
||
140 | /// |
||
141 | /// </summary> |
||
142 | public DataBlkInt() |
||
143 | { |
||
144 | } |
||
145 | |||
146 | /// <summary> Creates a DataBlkInt with the specified dimensions and position. The |
||
147 | /// data array is initialized to an array of size w*h. |
||
148 | /// |
||
149 | /// </summary> |
||
150 | /// <param name="ulx">The horizontal coordinate of the upper-left corner of the |
||
151 | /// block |
||
152 | /// |
||
153 | /// </param> |
||
154 | /// <param name="uly">The vertical coordinate of the upper-left corner of the |
||
155 | /// block |
||
156 | /// |
||
157 | /// </param> |
||
158 | /// <param name="w">The width of the block (in pixels) |
||
159 | /// |
||
160 | /// </param> |
||
161 | /// <param name="h">The height of the block (in pixels) |
||
162 | /// |
||
163 | /// </param> |
||
164 | public DataBlkInt(int ulx, int uly, int w, int h) |
||
165 | { |
||
166 | this.ulx = ulx; |
||
167 | this.uly = uly; |
||
168 | this.w = w; |
||
169 | this.h = h; |
||
170 | offset = 0; |
||
171 | scanw = w; |
||
172 | data_array = new int[w * h]; |
||
173 | } |
||
174 | |||
175 | /// <summary> Copy constructor. Creates a DataBlkInt which is the copy of the |
||
176 | /// DataBlkInt given as paramter. |
||
177 | /// |
||
178 | /// </summary> |
||
179 | /// <param name="DataBlkInt">the object to be copied. |
||
180 | /// |
||
181 | /// </param> |
||
182 | public DataBlkInt(DataBlkInt src) |
||
183 | { |
||
184 | this.ulx = src.ulx; |
||
185 | this.uly = src.uly; |
||
186 | this.w = src.w; |
||
187 | this.h = src.h; |
||
188 | this.offset = 0; |
||
189 | this.scanw = this.w; |
||
190 | this.data_array = new int[this.w * this.h]; |
||
191 | for (int i = 0; i < this.h; i++) |
||
192 | Array.Copy(src.data_array, i * src.scanw, this.data_array, i * this.scanw, this.w); |
||
193 | } |
||
194 | |||
195 | /// <summary> Returns a string of informations about the DataBlkInt. |
||
196 | /// |
||
197 | /// </summary> |
||
198 | public override System.String ToString() |
||
199 | { |
||
200 | System.String str = base.ToString(); |
||
201 | if (data_array != null) |
||
202 | { |
||
203 | str += (",data=" + data_array.Length + " bytes"); |
||
204 | } |
||
205 | return str; |
||
206 | } |
||
207 | } |
||
208 | } |