| OLD | NEW |
| 1 // qcms | 1 // qcms |
| 2 // Copyright (C) 2009 Mozilla Foundation | 2 // Copyright (C) 2009 Mozilla Foundation |
| 3 // | 3 // |
| 4 // Permission is hereby granted, free of charge, to any person obtaining | 4 // Permission is hereby granted, free of charge, to any person obtaining |
| 5 // a copy of this software and associated documentation files (the "Software"), | 5 // a copy of this software and associated documentation files (the "Software"), |
| 6 // to deal in the Software without restriction, including without limitation | 6 // to deal in the Software without restriction, including without limitation |
| 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, | 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e | 8 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e |
| 9 // is furnished to do so, subject to the following conditions: | 9 // is furnished to do so, subject to the following conditions: |
| 10 // | 10 // |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 // measurement or data, however it is what lcms uses
. | 630 // measurement or data, however it is what lcms uses
. |
| 631 *output_gamma_lut_length = trc->count; | 631 *output_gamma_lut_length = trc->count; |
| 632 if (*output_gamma_lut_length < 256) | 632 if (*output_gamma_lut_length < 256) |
| 633 *output_gamma_lut_length = 256; | 633 *output_gamma_lut_length = 256; |
| 634 | 634 |
| 635 *output_gamma_lut = invert_lut(trc->data, trc->count, *o
utput_gamma_lut_length); | 635 *output_gamma_lut = invert_lut(trc->data, trc->count, *o
utput_gamma_lut_length); |
| 636 } | 636 } |
| 637 } | 637 } |
| 638 | 638 |
| 639 } | 639 } |
| 640 |
| 641 size_t qcms_profile_get_parametric_curve(qcms_profile *profile, qcms_trc_channel
channel, float data[7]) |
| 642 { |
| 643 static const uint32_t COUNT_TO_LENGTH[5] = {1, 3, 4, 5, 7}; |
| 644 struct curveType *curve = NULL; |
| 645 size_t size; |
| 646 |
| 647 if (profile->color_space != RGB_SIGNATURE) |
| 648 return 0; |
| 649 |
| 650 switch(channel) { |
| 651 case QCMS_TRC_RED: |
| 652 curve = profile->redTRC; |
| 653 break; |
| 654 case QCMS_TRC_GREEN: |
| 655 curve = profile->greenTRC; |
| 656 break; |
| 657 case QCMS_TRC_BLUE: |
| 658 curve = profile->blueTRC; |
| 659 break; |
| 660 default: |
| 661 return 0; |
| 662 } |
| 663 |
| 664 if (!curve || curve->type != PARAMETRIC_CURVE_TYPE) |
| 665 return 0; |
| 666 |
| 667 size = COUNT_TO_LENGTH[curve->count]; |
| 668 |
| 669 if (data) |
| 670 memcpy(data, curve->parameter, size * sizeof(float)); |
| 671 |
| 672 return size; |
| 673 } |
| OLD | NEW |