99sys .path .insert (0 , os .getcwd ())
1010
1111import tools .gamut_3d_diagram as plt3d
12- from coloraide .gamut import fit_raytrace as fit , clip_channels
12+ from coloraide .gamut import fit_raytrace as fit
1313from coloraide .everything import ColorAll as Color
1414from coloraide import algebra as alg
1515from coloraide .channels import ANGLE_DEG
@@ -74,8 +74,6 @@ def simulate_raytrace_gamut_mapping(args):
7474 points = []
7575 color = Color (args .gamut_color )
7676
77- orig_space = color .space ()
78-
7977 gmap = json .loads (args .gmap )
8078 gmap ['method' ] = 'raytrace'
8179
@@ -103,11 +101,12 @@ def simulate_raytrace_gamut_mapping(args):
103101 else :
104102 mx = color .new (space , [mx ] * 3 ).convert (linear , in_place = True )[0 ]
105103 space = linear
104+ mn = cs .CHANNELS [0 ].low
105+
106106 print ('Target RGB Space:' , space )
107107 print ('Perceptual Space' , pspace )
108108
109109 bmax = [mx ] * 3
110- mn = cs .CHANNELS [0 ].low
111110 bmin = [mn ] * 3
112111
113112 orig = color .space ()
@@ -126,14 +125,11 @@ def simulate_raytrace_gamut_mapping(args):
126125
127126 if adaptive :
128127 max_light = color .new ('xyz-d65' , fit .WHITE ).convert (pspace , in_place = True )[l ]
129- alight = fit .adaptive_hue_independent (
128+ achroma [ l ] = fit .adaptive_hue_independent (
130129 mapcolor [l ] / max_light ,
131130 max (mapcolor [c ] if polar else alg .rect_to_polar (mapcolor [a ], mapcolor [b ])[0 ], 0 ) / max_light ,
132131 adaptive
133132 ) * max_light
134- achroma [l ] = alight
135- else :
136- alight = mapcolor [l ]
137133
138134 anchor = cs .from_base (achroma .convert (space )[:- 1 ]) if coerced else achroma .convert (space )[:- 1 ]
139135 anchor = fit .project_onto (anchor , bmax , bmin )
0 commit comments