corrade-vassal – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 vero 1 /// <summary>**************************************************************************
2 ///
3 /// $Id: ICCXYZType.java,v 1.1 2002/07/25 14:56:37 grosbois Exp $
4 ///
5 /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 /// $Date $
7 /// ***************************************************************************
8 /// </summary>
9 using System;
10 using ICCProfile = CSJ2K.Icc.ICCProfile;
11 using XYZNumber = CSJ2K.Icc.Types.XYZNumber;
12 namespace CSJ2K.Icc.Tags
13 {
14  
15 /// <summary> A tag containing a triplet.
16 ///
17 /// </summary>
18 /// <seealso cref="jj2000.j2k.icc.tags.ICCXYZTypeReverse">
19 /// </seealso>
20 /// <seealso cref="jj2000.j2k.icc.types.XYZNumber">
21 /// </seealso>
22 /// <version> 1.0
23 /// </version>
24 /// <author> Bruce A. Kern
25 /// </author>
26 public class ICCXYZType:ICCTag
27 {
28  
29 /// <summary>x component </summary>
30 //UPGRADE_NOTE: Final was removed from the declaration of 'x '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
31 public long x;
32 /// <summary>y component </summary>
33 //UPGRADE_NOTE: Final was removed from the declaration of 'y '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
34 public long y;
35 /// <summary>z component </summary>
36 //UPGRADE_NOTE: Final was removed from the declaration of 'z '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
37 public long z;
38  
39 /// <summary>Normalization utility </summary>
40 public static long DoubleToXYZ(double x)
41 {
42 //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'"
43 return (long) System.Math.Floor(x * 65536.0 + 0.5);
44 }
45  
46 /// <summary>Normalization utility </summary>
47 public static double XYZToDouble(long x)
48 {
49 return x / 65536.0;
50 }
51  
52 /// <summary> Construct this tag from its constituant parts</summary>
53 /// <param name="signature">tag id
54 /// </param>
55 /// <param name="data">array of bytes
56 /// </param>
57 /// <param name="offset">to data in the data array
58 /// </param>
59 /// <param name="length">of data in the data array
60 /// </param>
61 protected internal ICCXYZType(int signature, byte[] data, int offset, int length):base(signature, data, offset, length)
62 {
63 x = ICCProfile.getInt(data, offset + 2 * ICCProfile.int_size);
64 y = ICCProfile.getInt(data, offset + 3 * ICCProfile.int_size);
65 z = ICCProfile.getInt(data, offset + 4 * ICCProfile.int_size);
66 }
67  
68  
69 /// <summary>Return the string rep of this tag. </summary>
70 public override System.String ToString()
71 {
72 return "[" + base.ToString() + "(" + x + ", " + y + ", " + z + ")]";
73 }
74  
75  
76 /// <summary>Write to a file. </summary>
77 //UPGRADE_TODO: Class 'java.io.RandomAccessFile' was converted to 'System.IO.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioRandomAccessFile'"
78 public virtual void write(System.IO.FileStream raf)
79 {
80 byte[] xb = ICCProfile.setLong(x);
81 byte[] yb = ICCProfile.setLong(y);
82 byte[] zb = ICCProfile.setLong(z);
83  
84 // CONVERSION PROBLEM?
85 raf.Write(xb, ICCProfile.int_size, 0);
86 raf.Write(yb, ICCProfile.int_size, 0);
87 raf.Write(zb, ICCProfile.int_size, 0);
88 }
89  
90  
91 /* end class ICCXYZType */
92 }
93 }