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