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