corrade-vassal – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 vero 1 /// <summary>**************************************************************************
2 ///
3 /// $Id: LookUpTable16.java,v 1.1 2002/07/25 14:56: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 ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 namespace CSJ2K.Icc.Lut
12 {
13  
14 /// <summary> Toplevel class for a short [] lut.
15 ///
16 /// </summary>
17 /// <version> 1.0
18 /// </version>
19 /// <author> Bruce A. Kern
20 /// </author>
21 public abstract class LookUpTable16:LookUpTable
22 {
23  
24 /// <summary>Maximum output value of the LUT </summary>
25 //UPGRADE_NOTE: Final was removed from the declaration of 'dwMaxOutput '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
26 protected internal int dwMaxOutput;
27 /// <summary>The lut values. </summary>
28 //UPGRADE_NOTE: Final was removed from the declaration of 'lut '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
29 protected internal short[] lut;
30  
31 /// <summary> Create an abbreviated string representation of a 16 bit lut.</summary>
32 /// <returns> the lut as a String
33 /// </returns>
34 public override System.String ToString()
35 {
36 System.Text.StringBuilder rep = new System.Text.StringBuilder("[LookUpTable16 ");
37 //int row, col;
38 rep.Append("max= " + dwMaxOutput);
39 rep.Append(", nentries= " + dwMaxOutput);
40 return rep.Append("]").ToString();
41 }
42  
43 /// <summary> Create a full string representation of a 16 bit lut.</summary>
44 /// <returns> the lut as a String
45 /// </returns>
46 public virtual System.String toStringWholeLut()
47 {
48 System.Text.StringBuilder rep = new System.Text.StringBuilder("[LookUpTable16" + eol);
49 int row, col;
50  
51 rep.Append("max output = " + dwMaxOutput + eol);
52 for (row = 0; row < dwNumInput / 10; ++row)
53 {
54 rep.Append("lut[" + 10 * row + "] : ");
55 for (col = 0; col < 10; ++col)
56 {
57 rep.Append(lut[10 * row + col]).Append(" ");
58 }
59 rep.Append(eol);
60 }
61 // Partial row.
62 rep.Append("lut[" + 10 * row + "] : ");
63 for (col = 0; col < dwNumInput % 10; ++col)
64 rep.Append(lut[10 * row + col] + " ");
65 rep.Append(eol + eol);
66 return rep.ToString();
67 }
68  
69 /// <summary> Factory method for getting a 16 bit lut from a given curve.</summary>
70 /// <param name="curve"> the data
71 /// </param>
72 /// <param name="dwNumInput">the size of the lut
73 /// </param>
74 /// <param name="dwMaxOutput">max output value of the lut
75 /// </param>
76 /// <returns> the lookup table
77 /// </returns>
78 public static LookUpTable16 createInstance(ICCCurveType curve, int dwNumInput, int dwMaxOutput)
79 {
80  
81 if (curve.count == 1)
82 return new LookUpTable16Gamma(curve, dwNumInput, dwMaxOutput);
83 else
84 return new LookUpTable16Interp(curve, dwNumInput, dwMaxOutput);
85 }
86  
87 /// <summary> Construct an empty 16 bit lut</summary>
88 /// <param name="dwNumInput">the size of the lut t lut.
89 /// </param>
90 /// <param name="dwMaxOutput">max output value of the lut
91 /// </param>
92 protected internal LookUpTable16(int dwNumInput, int dwMaxOutput):base(null, dwNumInput)
93 {
94 lut = new short[dwNumInput];
95 this.dwMaxOutput = dwMaxOutput;
96 }
97  
98 /// <summary> Construct a 16 bit lut from a given curve.</summary>
99 /// <param name="curve">the data
100 /// </param>
101 /// <param name="dwNumInput">the size of the lut t lut.
102 /// </param>
103 /// <param name="dwMaxOutput">max output value of the lut
104 /// </param>
105 protected internal LookUpTable16(ICCCurveType curve, int dwNumInput, int dwMaxOutput):base(curve, dwNumInput)
106 {
107 this.dwMaxOutput = dwMaxOutput;
108 lut = new short[dwNumInput];
109 }
110  
111 /// <summary> lut accessor</summary>
112 /// <param name="index">of the element
113 /// </param>
114 /// <returns> the lut [index]
115 /// </returns>
116 public short elementAt(int index)
117 {
118 return lut[index];
119 }
120  
121 /* end class LookUpTable16 */
122 }
123 }