479{
480 Private::ProfileInfo
info;
482
483 cmsHPROFILE cprofile =
shared->lcmsProfile->lcmsProfile();
484 Q_ASSERT(cprofile);
485
486 cmsColorSpaceSignature color_space_sig = cmsGetColorSpace(cprofile);
487 unsigned int num_channels = cmsChannelsOf(color_space_sig);
488 unsigned int color_space_mask = _cmsLCMScolorSpace(color_space_sig);
489
490 Q_ASSERT(num_channels >= 1 && num_channels <= 4);
491 Q_ASSERT(color_space_mask);
492
493
494
495
496
497 uint16_t in_min_pixel[4] = {0, 0, 0, 0};
498 uint16_t in_max_pixel[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
499 qreal out_min_pixel[4] = {0, 0, 0, 0};
500 qreal out_max_pixel[4] = {0, 0, 0, 0};
501
502 cmsHTRANSFORM trans = cmsCreateTransform(
503 cprofile,
504 (COLORSPACE_SH(color_space_mask) | CHANNELS_SH(num_channels) | BYTES_SH(2)),
505 cprofile,
506 (COLORSPACE_SH(color_space_mask) | FLOAT_SH(1) | CHANNELS_SH(num_channels) | BYTES_SH(0)),
508
509
510 if (trans) {
511 cmsDoTransform(trans, in_min_pixel, out_min_pixel, 1);
512 cmsDoTransform(trans, in_max_pixel, out_max_pixel, 1);
513 cmsDeleteTransform(trans);
514 }
515
516
517
518
519
520
521
522
523
524
525
526
527 info.canCreateCyclicTransform = bool(trans);
528
529 ret.resize(num_channels);
530 for (unsigned int i = 0; i < num_channels; ++i) {
531 if (color_space_sig == cmsSigYCbCrData) {
532
533
534
535
536
537
538 ret[i].minVal = 0;
539 ret[i].maxVal = 1;
540 } else if (out_min_pixel[i] < out_max_pixel[i]) {
541 ret[i].minVal = out_min_pixel[i];
542 ret[i].maxVal = out_max_pixel[i];
543 } else {
544
545
546
547 ret[i].minVal = 0;
548 ret[i].maxVal = 1;
549 }
550 }
551
553}
#define INTENT_ABSOLUTE_COLORIMETRIC