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