/Users/lyon/j4p/src/ip/color/Xyzd65.java

1    package ip.color; 
2     
3    import ip.gui.frames.ColorFrame; 
4    import math.Mat3; 
5     
6    public class Xyzd65 extends FloatPlane { 
7     
8        double A[][] = { 
9            {0.3935, 0.3653, 0.1916}, 
10           {0.2124, 0.7011, 0.0865}, 
11           {0.0187, 0.1119, 0.9582} 
12       }; 
13    
14       float gamma = 2.2f; 
15       float oneOnGamma = 1 / gamma; 
16    
17       Mat3 rgb2xyzMat = new Mat3(A); 
18       Mat3 xyz2rgbMat = rgb2xyzMat.invert(); 
19    
20       public Xyzd65(ColorFrame _cf) { 
21           super(_cf); 
22       } 
23    
24       public void fromRgb() { 
25           scale(1 / 255f); 
26           pow(gamma); 
27           convertSpace(rgb2xyzMat); 
28           rgb2xyzMat.print(); 
29       } 
30    
31       public void toRgb() { 
32           convertSpace(xyz2rgbMat); 
33           pow(oneOnGamma); 
34           scale(255f); 
35           xyz2rgbMat.print(); 
36       } 
37    
38   } 
39    
40    
41    
42    
43    
44    
45    
46