464{
465 Private::ProfileInfo
info;
467
468 cmsHPROFILE cprofile =
shared->lcmsProfile->lcmsProfile();
469 Q_ASSERT(cprofile);
470
471 cmsColorSpaceSignature color_space_sig = cmsGetColorSpace(cprofile);
472 unsigned int num_channels = cmsChannelsOf(color_space_sig);
473 unsigned int color_space_mask = _cmsLCMScolorSpace(color_space_sig);
474
475 Q_ASSERT(num_channels >= 1 && num_channels <= 4);
476 Q_ASSERT(color_space_mask);
477
478
479
480
481
482 uint16_t in_min_pixel[4] = {0, 0, 0, 0};
483 uint16_t in_max_pixel[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
484 qreal out_min_pixel[4] = {0, 0, 0, 0};
485 qreal out_max_pixel[4] = {0, 0, 0, 0};
486
487 cmsHTRANSFORM trans = cmsCreateTransform(
488 cprofile,
489 (COLORSPACE_SH(color_space_mask) | CHANNELS_SH(num_channels) | BYTES_SH(2)),
490 cprofile,
491 (COLORSPACE_SH(color_space_mask) | FLOAT_SH(1) | CHANNELS_SH(num_channels) | BYTES_SH(0)),
493
494
495 if (trans) {
496 cmsDoTransform(trans, in_min_pixel, out_min_pixel, 1);
497 cmsDoTransform(trans, in_max_pixel, out_max_pixel, 1);
498 cmsDeleteTransform(trans);
499 }
500
501
502
503
504
505
506
507
508
509
510
511
512 info.canCreateCyclicTransform = bool(trans);
513
514 ret.resize(num_channels);
515 for (unsigned int i = 0; i < num_channels; ++i) {
516 if (color_space_sig == cmsSigYCbCrData) {
517
518
519
520
521
522
523 ret[i].minVal = 0;
524 ret[i].maxVal = 1;
525 } else if (out_min_pixel[i] < out_max_pixel[i]) {
526 ret[i].minVal = out_min_pixel[i];
527 ret[i].maxVal = out_max_pixel[i];
528 } else {
529
530
531
532 ret[i].minVal = 0;
533 ret[i].maxVal = 1;
534 }
535 }
536
538}
#define INTENT_ABSOLUTE_COLORIMETRIC