16
16
from colour .utilities import domain_range_scale
17
17
18
18
from colour_analysis import (
19
- COLOURSPACE_MODEL , IMAGE_COLOURSPACE , IMAGE_DECODING_CCTF , PRIMARY_COLOURSPACE ,
20
- RGB_colourspaces , RGB_colourspace_volume_visual , SECONDARY_COLOURSPACE ,
21
- colourspace_models , decoding_cctfs , spectral_locus_visual ,
22
- RGB_image_scatter_visual , image_data )
19
+ COLOURSPACE_MODEL , IMAGE_COLOURSPACE , IMAGE_DECODING_CCTF ,
20
+ PRIMARY_COLOURSPACE , RGB_colourspaces , RGB_colourspace_volume_visual ,
21
+ RGB_image_scatter_visual , SECONDARY_COLOURSPACE , colourspace_models ,
22
+ decoding_cctfs , pointer_gamut_visual , spectral_locus_visual , image_data )
23
23
24
24
__author__ = 'Colour Developers'
25
25
__copyright__ = 'Copyright (C) 2018 - Colour Developers'
32
32
33
33
__major_version__ = '0'
34
34
__minor_version__ = '1'
35
- __change_version__ = '1 '
35
+ __change_version__ = '2 '
36
36
__version__ = '.' .join (
37
37
(__major_version__ ,
38
38
__minor_version__ ,
41
41
42
42
__all__ = [
43
43
'APP' , 'CACHE' , 'CACHE_DEFAULT_TIMEOUT' , 'IMAGES_DIRECTORY' ,
44
- 'images_response' , 'decoding_cctfs_response' ,'colourspace_models_response' ,
45
- 'RGB_colourspaces_response' , 'RGB_colourspace_volume_visual_response' ,
46
- 'spectral_locus_visual_response' , 'RGB_image_scatter_visual_response' ,
47
- 'image_data_response' , 'index' , 'after_request'
44
+ 'images_response' , 'decoding_cctfs_response' ,
45
+ 'colourspace_models_response' , 'RGB_colourspaces_response' ,
46
+ 'image_data_response' , 'RGB_colourspace_volume_visual_response' ,
47
+ 'RGB_image_scatter_visual_response' , 'spectral_locus_visual_response' ,
48
+ 'pointer_gamut_response' , 'index' , 'after_request'
48
49
]
49
50
50
51
APP = Flask (__name__ )
@@ -213,48 +214,61 @@ def RGB_colourspaces_response():
213
214
return response
214
215
215
216
216
- @APP .route ('/RGB-colourspace-volume-visual ' )
217
+ @APP .route ('/image-data/<image> ' )
217
218
@CACHE .cached (timeout = CACHE_DEFAULT_TIMEOUT , query_string = True )
218
- def RGB_colourspace_volume_visual_response ( ):
219
+ def image_data_response ( image ):
219
220
"""
220
- Returns a RGB colourspace volume visual response.
221
+ Returns an image data response.
221
222
222
223
Returns
223
224
-------
224
225
Response
225
- RGB colourspace volume visual response.
226
+ Image data response.
226
227
"""
227
228
229
+ path = os .path .join (os .getcwd (), 'static' , 'images' , image )
230
+
228
231
args = request .args
229
- json_data = RGB_colourspace_volume_visual (
230
- colourspace = args .get ('colourspace' , PRIMARY_COLOURSPACE ),
231
- colourspace_model = args .get ('colourspaceModel' , COLOURSPACE_MODEL ),
232
- segments = int (args .get ('segments' , 16 )),
233
- wireframe = _bool_to_bool (args .get ('wireframe' , False )),
234
- )
232
+ json_data = image_data (
233
+ path = path ,
234
+ primary_colourspace = args .get ('primaryColourspace' ,
235
+ PRIMARY_COLOURSPACE ),
236
+ secondary_colourspace = args .get ('secondaryColourspace' ,
237
+ SECONDARY_COLOURSPACE ),
238
+ image_colourspace = args .get ('imageColourspace' , IMAGE_COLOURSPACE ),
239
+ image_decoding_cctf = args .get ('imageDecodingCctf' , IMAGE_DECODING_CCTF ),
240
+ out_of_primary_colourspace_gamut = _bool_to_bool (
241
+ args .get ('outOfPrimaryColourspaceGamut' , False )),
242
+ out_of_secondary_colourspace_gamut = _bool_to_bool (
243
+ args .get ('outOfSecondaryColourspaceGamut' , False )),
244
+ out_of_pointer_gamut = _bool_to_bool (
245
+ args .get ('outOfPointerGamut' , False )),
246
+ saturate = _bool_to_bool (args .get ('saturate' , False )))
235
247
236
248
response = Response (json_data , status = 200 , mimetype = 'application/json' )
237
249
response .headers ['X-Content-Length' ] = len (json_data )
238
250
239
251
return response
240
252
241
253
242
- @APP .route ('/spectral-locus -visual' )
254
+ @APP .route ('/RGB-colourspace-volume -visual' )
243
255
@CACHE .cached (timeout = CACHE_DEFAULT_TIMEOUT , query_string = True )
244
- def spectral_locus_visual_response ():
256
+ def RGB_colourspace_volume_visual_response ():
245
257
"""
246
- Returns a spectral locus visual response.
258
+ Returns a RGB colourspace volume visual response.
247
259
248
260
Returns
249
261
-------
250
262
Response
251
- Spectral locus visual response.
263
+ RGB colourspace volume visual response.
252
264
"""
253
265
254
266
args = request .args
255
- json_data = spectral_locus_visual (
267
+ json_data = RGB_colourspace_volume_visual (
256
268
colourspace = args .get ('colourspace' , PRIMARY_COLOURSPACE ),
257
269
colourspace_model = args .get ('colourspaceModel' , COLOURSPACE_MODEL ),
270
+ segments = int (args .get ('segments' , 16 )),
271
+ wireframe = _bool_to_bool (args .get ('wireframe' , False )),
258
272
)
259
273
260
274
response = Response (json_data , status = 200 , mimetype = 'application/json' )
@@ -291,6 +305,8 @@ def RGB_image_scatter_visual_response(image):
291
305
args .get ('outOfPrimaryColourspaceGamut' , False )),
292
306
out_of_secondary_colourspace_gamut = _bool_to_bool (
293
307
args .get ('outOfSecondaryColourspaceGamut' , False )),
308
+ out_of_pointer_gamut = _bool_to_bool (
309
+ args .get ('outOfPointerGamut' , False )),
294
310
sub_sampling = int (args .get ('subSampling' , 25 )),
295
311
saturate = _bool_to_bool (args .get ('saturate' , False )),
296
312
)
@@ -301,34 +317,45 @@ def RGB_image_scatter_visual_response(image):
301
317
return response
302
318
303
319
304
- @APP .route ('/image-data/<image> ' )
320
+ @APP .route ('/spectral-locus-visual ' )
305
321
@CACHE .cached (timeout = CACHE_DEFAULT_TIMEOUT , query_string = True )
306
- def image_data_response ( image ):
322
+ def spectral_locus_visual_response ( ):
307
323
"""
308
- Returns an image data response.
324
+ Returns a spectral locus visual response.
309
325
310
326
Returns
311
327
-------
312
328
Response
313
- Image data response.
329
+ Spectral locus visual response.
314
330
"""
315
331
316
- path = os .path .join (os .getcwd (), 'static' , 'images' , image )
332
+ args = request .args
333
+ json_data = spectral_locus_visual (
334
+ colourspace = args .get ('colourspace' , PRIMARY_COLOURSPACE ),
335
+ colourspace_model = args .get ('colourspaceModel' , COLOURSPACE_MODEL ),
336
+ )
337
+
338
+ response = Response (json_data , status = 200 , mimetype = 'application/json' )
339
+ response .headers ['X-Content-Length' ] = len (json_data )
340
+
341
+ return response
342
+
343
+
344
+ @APP .route ('/pointer-gamut-visual' )
345
+ @CACHE .cached (timeout = CACHE_DEFAULT_TIMEOUT , query_string = True )
346
+ def pointer_gamut_response ():
347
+ """
348
+ Returns a *Pointer's Gamut* visual response.
349
+
350
+ Returns
351
+ -------
352
+ Response
353
+ *Pointer's Gamut* visual response.
354
+ """
317
355
318
356
args = request .args
319
- json_data = image_data (
320
- path = path ,
321
- primary_colourspace = args .get ('primaryColourspace' ,
322
- PRIMARY_COLOURSPACE ),
323
- secondary_colourspace = args .get ('secondaryColourspace' ,
324
- SECONDARY_COLOURSPACE ),
325
- image_colourspace = args .get ('imageColourspace' , IMAGE_COLOURSPACE ),
326
- image_decoding_cctf = args .get ('imageDecodingCctf' , IMAGE_DECODING_CCTF ),
327
- out_of_primary_colourspace_gamut = _bool_to_bool (
328
- args .get ('outOfPrimaryColourspaceGamut' , False )),
329
- out_of_secondary_colourspace_gamut = _bool_to_bool (
330
- args .get ('outOfSecondaryColourspaceGamut' , False )),
331
- saturate = _bool_to_bool (args .get ('saturate' , False )))
357
+ json_data = pointer_gamut_visual (
358
+ colourspace_model = args .get ('colourspaceModel' , COLOURSPACE_MODEL ), )
332
359
333
360
response = Response (json_data , status = 200 , mimetype = 'application/json' )
334
361
response .headers ['X-Content-Length' ] = len (json_data )
0 commit comments