corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | /// <summary>************************************************************************** |
2 | /// |
||
3 | /// $Id: EnumeratedColorSpaceMapper.java,v 1.1 2002/07/25 14:52:01 grosbois Exp $ |
||
4 | /// |
||
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650 |
||
6 | /// $Date $ |
||
7 | /// *************************************************************************** |
||
8 | /// </summary> |
||
9 | using System; |
||
10 | using ParameterList = CSJ2K.j2k.util.ParameterList; |
||
11 | using BlkImgDataSrc = CSJ2K.j2k.image.BlkImgDataSrc; |
||
12 | using DataBlk = CSJ2K.j2k.image.DataBlk; |
||
13 | using DataBlkInt = CSJ2K.j2k.image.DataBlkInt; |
||
14 | using DataBlkFloat = CSJ2K.j2k.image.DataBlkFloat; |
||
15 | using ImgDataAdapter = CSJ2K.j2k.image.ImgDataAdapter; |
||
16 | using FacilityManager = CSJ2K.j2k.util.FacilityManager; |
||
17 | using MsgLogger = CSJ2K.j2k.util.MsgLogger; |
||
18 | namespace CSJ2K.Color |
||
19 | { |
||
20 | |||
21 | /// <summary> This class provides Enumerated ColorSpace API for the jj2000.j2k imaging chain |
||
22 | /// by implementing the BlkImgDataSrc interface, in particular the getCompData |
||
23 | /// and getInternCompData methods. |
||
24 | /// |
||
25 | /// </summary> |
||
26 | /// <seealso cref="jj2000.j2k.colorspace.ColorSpace"> |
||
27 | /// </seealso> |
||
28 | /// <version> 1.0 |
||
29 | /// </version> |
||
30 | /// <author> Bruce A. Kern |
||
31 | /// </author> |
||
32 | public class EnumeratedColorSpaceMapper:ColorSpaceMapper |
||
33 | { |
||
34 | /// <summary> Factory method for creating instances of this class.</summary> |
||
35 | /// <param name="src">-- source of image data |
||
36 | /// </param> |
||
37 | /// <param name="csMap">-- provides colorspace info |
||
38 | /// </param> |
||
39 | /// <returns> EnumeratedColorSpaceMapper instance |
||
40 | /// </returns> |
||
41 | public static new BlkImgDataSrc createInstance(BlkImgDataSrc src, ColorSpace csMap) |
||
42 | { |
||
43 | return new EnumeratedColorSpaceMapper(src, csMap); |
||
44 | } |
||
45 | |||
46 | /// <summary> Ctor which creates an ICCProfile for the image and initializes |
||
47 | /// all data objects (input, working, and output). |
||
48 | /// |
||
49 | /// </summary> |
||
50 | /// <param name="src">-- Source of image data |
||
51 | /// </param> |
||
52 | /// <param name="csm">-- provides colorspace info |
||
53 | /// </param> |
||
54 | protected internal EnumeratedColorSpaceMapper(BlkImgDataSrc src, ColorSpace csMap):base(src, csMap) |
||
55 | { |
||
56 | /* end EnumeratedColorSpaceMapper ctor */ |
||
57 | } |
||
58 | |||
59 | |||
60 | /// <summary> Returns, in the blk argument, a block of image data containing the |
||
61 | /// specifed rectangular area, in the specified component. The data is |
||
62 | /// returned, as a copy of the internal data, therefore the returned data |
||
63 | /// can be modified "in place". |
||
64 | /// |
||
65 | /// <P>The rectangular area to return is specified by the 'ulx', 'uly', 'w' |
||
66 | /// and 'h' members of the 'blk' argument, relative to the current |
||
67 | /// tile. These members are not modified by this method. The 'offset' of |
||
68 | /// the returned data is 0, and the 'scanw' is the same as the block's |
||
69 | /// width. See the 'DataBlk' class. |
||
70 | /// |
||
71 | /// <P>If the data array in 'blk' is 'null', then a new one is created. If |
||
72 | /// the data array is not 'null' then it is reused, and it must be large |
||
73 | /// enough to contain the block's data. Otherwise an 'ArrayStoreException' |
||
74 | /// or an 'IndexOutOfBoundsException' is thrown by the Java system. |
||
75 | /// |
||
76 | /// <P>The returned data has its 'progressive' attribute set to that of the |
||
77 | /// input data. |
||
78 | /// |
||
79 | /// </summary> |
||
80 | /// <param name="blk">Its coordinates and dimensions specify the area to |
||
81 | /// return. If it contains a non-null data array, then it must have the |
||
82 | /// correct dimensions. If it contains a null data array a new one is |
||
83 | /// created. The fields in this object are modified to return the data. |
||
84 | /// |
||
85 | /// </param> |
||
86 | /// <param name="c">The index of the component from which to get the data. Only 0 |
||
87 | /// and 3 are valid. |
||
88 | /// |
||
89 | /// </param> |
||
90 | /// <returns> The requested DataBlk |
||
91 | /// |
||
92 | /// </returns> |
||
93 | /// <seealso cref="getInternCompData"> |
||
94 | /// |
||
95 | /// </seealso> |
||
96 | public override DataBlk getCompData(DataBlk out_Renamed, int c) |
||
97 | { |
||
98 | return src.getCompData(out_Renamed, c); |
||
99 | } |
||
100 | |||
101 | /// <summary> Returns, in the blk argument, a block of image data containing the |
||
102 | /// specifed rectangular area, in the specified component. The data is |
||
103 | /// returned, as a reference to the internal data, if any, instead of as a |
||
104 | /// copy, therefore the returned data should not be modified. |
||
105 | /// |
||
106 | /// <P>The rectangular area to return is specified by the 'ulx', 'uly', 'w' |
||
107 | /// and 'h' members of the 'blk' argument, relative to the current |
||
108 | /// tile. These members are not modified by this method. The 'offset' and |
||
109 | /// 'scanw' of the returned data can be arbitrary. See the 'DataBlk' class. |
||
110 | /// |
||
111 | /// <P>This method, in general, is more efficient than the 'getCompData()' |
||
112 | /// method since it may not copy the data. However if the array of returned |
||
113 | /// data is to be modified by the caller then the other method is probably |
||
114 | /// preferable. |
||
115 | /// |
||
116 | /// <P>If possible, the data in the returned 'DataBlk' should be the |
||
117 | /// internal data itself, instead of a copy, in order to increase the data |
||
118 | /// transfer efficiency. However, this depends on the particular |
||
119 | /// implementation (it may be more convenient to just return a copy of the |
||
120 | /// data). This is the reason why the returned data should not be modified. |
||
121 | /// |
||
122 | /// <P>If the data array in <tt>blk</tt> is <tt>null</tt>, then a new one |
||
123 | /// is created if necessary. The implementation of this interface may |
||
124 | /// choose to return the same array or a new one, depending on what is more |
||
125 | /// efficient. Therefore, the data array in <tt>blk</tt> prior to the |
||
126 | /// method call should not be considered to contain the returned data, a |
||
127 | /// new array may have been created. Instead, get the array from |
||
128 | /// <tt>blk</tt> after the method has returned. |
||
129 | /// |
||
130 | /// <P>The returned data may have its 'progressive' attribute set. In this |
||
131 | /// case the returned data is only an approximation of the "final" data. |
||
132 | /// |
||
133 | /// </summary> |
||
134 | /// <param name="blk">Its coordinates and dimensions specify the area to return, |
||
135 | /// relative to the current tile. Some fields in this object are modified |
||
136 | /// to return the data. |
||
137 | /// |
||
138 | /// </param> |
||
139 | /// <param name="c">The index of the component from which to get the data. |
||
140 | /// |
||
141 | /// </param> |
||
142 | /// <returns> The requested DataBlk |
||
143 | /// |
||
144 | /// </returns> |
||
145 | /// <seealso cref="getCompData"> |
||
146 | /// |
||
147 | /// </seealso> |
||
148 | public override DataBlk getInternCompData(DataBlk out_Renamed, int c) |
||
149 | { |
||
150 | return src.getInternCompData(out_Renamed, c); |
||
151 | } |
||
152 | |||
153 | |||
154 | |||
155 | public override System.String ToString() |
||
156 | { |
||
157 | int i; |
||
158 | System.Text.StringBuilder rep_nComps = new System.Text.StringBuilder("ncomps= ").Append(System.Convert.ToString(ncomps)); |
||
159 | |||
160 | System.Text.StringBuilder rep_fixedValue = new System.Text.StringBuilder("fixedPointBits= ("); |
||
161 | System.Text.StringBuilder rep_shiftValue = new System.Text.StringBuilder("shiftValue= ("); |
||
162 | System.Text.StringBuilder rep_maxValue = new System.Text.StringBuilder("maxValue= ("); |
||
163 | |||
164 | for (i = 0; i < ncomps; ++i) |
||
165 | { |
||
166 | if (i != 0) |
||
167 | { |
||
168 | rep_shiftValue.Append(", "); |
||
169 | rep_maxValue.Append(", "); |
||
170 | rep_fixedValue.Append(", "); |
||
171 | } |
||
172 | rep_shiftValue.Append(System.Convert.ToString(shiftValueArray[i])); |
||
173 | rep_maxValue.Append(System.Convert.ToString(maxValueArray[i])); |
||
174 | rep_fixedValue.Append(System.Convert.ToString(fixedPtBitsArray[i])); |
||
175 | } |
||
176 | |||
177 | rep_shiftValue.Append(")"); |
||
178 | rep_maxValue.Append(")"); |
||
179 | rep_fixedValue.Append(")"); |
||
180 | |||
181 | System.Text.StringBuilder rep = new System.Text.StringBuilder("[EnumeratedColorSpaceMapper "); |
||
182 | rep.Append(rep_nComps); |
||
183 | rep.Append(eol).Append(" ").Append(rep_shiftValue); |
||
184 | rep.Append(eol).Append(" ").Append(rep_maxValue); |
||
185 | rep.Append(eol).Append(" ").Append(rep_fixedValue); |
||
186 | |||
187 | return rep.Append("]").ToString(); |
||
188 | } |
||
189 | |||
190 | /* end class EnumeratedColorSpaceMapper */ |
||
191 | } |
||
192 | } |