@@ -17,9 +17,9 @@ type rgb struct {
17
17
// cieXYZ returns a CIE XYZ color representation of the receiver.
18
18
func (c rgb ) cieXYZ () cieXYZ {
19
19
return cieXYZ {
20
- X : 0.4124 * c .R + 0.3576 * c .G + 0 .1805* c .B ,
21
- Y : 0.2126 * c .R + 0.7152 * c .G + 0 .0722* c .B ,
22
- Z : 0.0193 * c .R + 0.1192 * c .G + 0 .9505* c .B ,
20
+ X : float64 ( 0.4124 * c .R ) + float64 ( 0.3576 * c .G ) + float64 ( .1805 * c .B ) ,
21
+ Y : float64 ( 0.2126 * c .R ) + float64 ( 0.7152 * c .G ) + float64 ( .0722 * c .B ) ,
22
+ Z : float64 ( 0.0193 * c .R ) + float64 ( 0.1192 * c .G ) + float64 ( .9505 * c .B ) ,
23
23
}
24
24
}
25
25
@@ -29,7 +29,7 @@ func (c rgb) sRGBA(alpha float64) sRGBA {
29
29
// f converts from a linear RGB component to an sRGB component.
30
30
f := func (v float64 ) float64 {
31
31
if v > 0.0031308 {
32
- return 1.055 * math .Pow (v , 1 / 2.4 ) - 0.055
32
+ return float64 ( 1.055 * math .Pow (v , 1 / 2.4 ) ) - 0.055
33
33
}
34
34
return 12.92 * v
35
35
}
@@ -51,9 +51,9 @@ type cieXYZ struct {
51
51
// rgb returns a linear RGB representation of the receiver.
52
52
func (c cieXYZ ) rgb () rgb {
53
53
return rgb {
54
- R : c .X * 3.2406 + c .Y * - 1.5372 + c .Z * - 0.4986 ,
55
- G : c .X * - 0.9689 + c .Y * 1.8758 + c .Z * 0.0415 ,
56
- B : c .X * 0.0557 + c .Y * - 0.204 + c .Z * 1.057 ,
54
+ R : float64 ( c .X * 3.2406 ) + float64 ( c .Y * - 1.5372 ) + float64 ( c .Z * - 0.4986 ) ,
55
+ G : float64 ( c .X * - 0.9689 ) + float64 ( c .Y * 1.8758 ) + float64 ( c .Z * 0.0415 ) ,
56
+ B : float64 ( c .X * 0.0557 ) + float64 ( c .Y * - 0.204 ) + float64 ( c .Z * 1.057 ) ,
57
57
}
58
58
}
59
59
@@ -64,14 +64,14 @@ func (c cieXYZ) cieLAB() cieLAB {
64
64
if v > 0.008856 {
65
65
return math .Pow (v , 1.0 / 3.0 )
66
66
}
67
- return 7.787 * v + 16.0 / 116.0
67
+ return float64 ( 7.787 * v ) + float64 ( 16.0 / 116.0 )
68
68
}
69
69
70
70
tempX := f (c .X / 0.9505 )
71
71
tempY := f (c .Y )
72
72
tempZ := f (c .Z / 1.089 )
73
73
return cieLAB {
74
- L : (116.0 * tempY ) - 16.0 ,
74
+ L : float64 (116.0 * tempY ) - 16.0 ,
75
75
A : 500.0 * (tempX - tempY ),
76
76
B : 200 * (tempY - tempZ ),
77
77
}
0 commit comments