528{
529 Private::ProfileInfo
info;
531
532 cmsHPROFILE cprofile =
shared->lcmsProfile->lcmsProfile();
533 Q_ASSERT(cprofile);
534
535 cmsColorSpaceSignature color_space_sig = cmsGetColorSpace(cprofile);
536 unsigned int num_channels = cmsChannelsOf(color_space_sig);
537 unsigned int color_space_mask = _cmsLCMScolorSpace(color_space_sig);
538
539 Q_ASSERT(num_channels >= 1 && num_channels <= 4);
540 Q_ASSERT(color_space_mask);
541
542
543
544
545
546 uint16_t in_min_pixel[4] = {0, 0, 0, 0};
547 uint16_t in_max_pixel[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
548 qreal out_min_pixel[4] = {0, 0, 0, 0};
549 qreal out_max_pixel[4] = {0, 0, 0, 0};
550
551 cmsHTRANSFORM trans = cmsCreateTransform(
552 cprofile,
553 (COLORSPACE_SH(color_space_mask) | CHANNELS_SH(num_channels) | BYTES_SH(2)),
554 cprofile,
555 (COLORSPACE_SH(color_space_mask) | FLOAT_SH(1) | CHANNELS_SH(num_channels) | BYTES_SH(0)),
557
558
559 if (trans) {
560 cmsDoTransform(trans, in_min_pixel, out_min_pixel, 1);
561 cmsDoTransform(trans, in_max_pixel, out_max_pixel, 1);
562 cmsDeleteTransform(trans);
563 }
564
565
566
567
568
569
570
571
572
573
574
575
576 info.canCreateCyclicTransform = bool(trans);
577
578 ret.resize(num_channels);
579 for (unsigned int i = 0; i < num_channels; ++i) {
580 if (color_space_sig == cmsSigYCbCrData) {
581
582
583
584
585
586
587 ret[i].minVal = 0;
588 ret[i].maxVal = 1;
589 } else if (out_min_pixel[i] < out_max_pixel[i]) {
590 ret[i].minVal = out_min_pixel[i];
591 ret[i].maxVal = out_max_pixel[i];
592 } else {
593
594
595
596 ret[i].minVal = 0;
597 ret[i].maxVal = 1;
598 }
599 }
600
602}
#define INTENT_ABSOLUTE_COLORIMETRIC