corrade-vassal – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 vero 1 /// <summary>**************************************************************************
2 ///
3 /// $Id: LookUpTable16LinearSRGBtoSRGB.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> A Linear 16 bit SRGB to SRGB lut
15 ///
16 /// </summary>
17 /// <version> 1.0
18 /// </version>
19 /// <author> Bruce A. Kern
20 /// </author>
21 public class LookUpTable16LinearSRGBtoSRGB:LookUpTable16
22 {
23  
24 /// <summary> Factory method for creating the lut.</summary>
25 /// <param name="wShadowCutoff">size of shadow region
26 /// </param>
27 /// <param name="dfShadowSlope">shadow region parameter
28 /// </param>
29 /// <param name="ksRGBLinearMaxValue">size of lut
30 /// </param>
31 /// <param name="ksRGB8ScaleAfterExp">post shadow region parameter
32 /// </param>
33 /// <param name="ksRGBExponent">post shadow region parameter
34 /// </param>
35 /// <param name="ksRGB8ReduceAfterEx">post shadow region parameter
36 /// </param>
37 /// <returns> the lut
38 /// </returns>
39 public static LookUpTable16LinearSRGBtoSRGB createInstance(int wShadowCutoff, double dfShadowSlope, int ksRGBLinearMaxValue, double ksRGB8ScaleAfterExp, double ksRGBExponent, double ksRGB8ReduceAfterEx)
40 {
41 return new LookUpTable16LinearSRGBtoSRGB(wShadowCutoff, dfShadowSlope, ksRGBLinearMaxValue, ksRGB8ScaleAfterExp, ksRGBExponent, ksRGB8ReduceAfterEx);
42 }
43  
44 /// <summary> Construct the lut</summary>
45 /// <param name="wShadowCutoff">size of shadow region
46 /// </param>
47 /// <param name="dfShadowSlope">shadow region parameter
48 /// </param>
49 /// <param name="ksRGBLinearMaxValue">size of lut
50 /// </param>
51 /// <param name="ksRGB8ScaleAfterExp">post shadow region parameter
52 /// </param>
53 /// <param name="ksRGBExponent">post shadow region parameter
54 /// </param>
55 /// <param name="ksRGB8ReduceAfterExp">post shadow region parameter
56 /// </param>
57 protected internal LookUpTable16LinearSRGBtoSRGB(int wShadowCutoff, double dfShadowSlope, int ksRGBLinearMaxValue, double ksRGB8ScaleAfterExp, double ksRGBExponent, double ksRGB8ReduceAfterExp):base(ksRGBLinearMaxValue + 1, (short) 0)
58 {
59  
60 int i = - 1;
61 //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
62 double dfNormalize = 1.0 / (float) ksRGBLinearMaxValue;
63  
64 // Generate the final linear-sRGB to non-linear sRGB LUT
65 for (i = 0; i <= wShadowCutoff; i++)
66 {
67 //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
68 lut[i] = (byte) System.Math.Floor(dfShadowSlope * (double) i + 0.5);
69 }
70  
71 // Now calculate the rest
72 for (; i <= ksRGBLinearMaxValue; i++)
73 {
74 //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
75 lut[i] = (byte) System.Math.Floor(ksRGB8ScaleAfterExp * System.Math.Pow((double) i * dfNormalize, ksRGBExponent) - ksRGB8ReduceAfterExp + 0.5);
76 }
77 }
78  
79 /* end class LookUpTable16LinearSRGBtoSRGB */
80 }
81 }