configure: when detecting linux include directory for kernel compiler use target...
[AROS.git] / test / lcms / gamma.c
blob49617e4c13c47a84e7f8939f1173fd18ab75e155
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <lcms2.h>
8 #include <stdio.h>
10 // get gamma from ICC file
12 int main(int argc, char **argv)
14 char *filename;
15 cmsHPROFILE hProfile;
16 cmsToneCurve *tc_red, *tc_green, *tc_blue;
17 int i;
19 if (argc == 2)
21 filename = argv[1];
23 else
25 filename = "SYS:Prefs/Presets/Colortables/ICC/sRGB.icc";
28 hProfile = cmsOpenProfileFromFile(filename, "r");
29 if (hProfile)
31 tc_red = cmsReadTag(hProfile, cmsSigRedTRCTag);
32 tc_green = cmsReadTag(hProfile, cmsSigGreenTRCTag);
33 tc_blue = cmsReadTag(hProfile, cmsSigBlueTRCTag);
34 if (tc_red && tc_green && tc_blue)
36 for (i=0; i < 256; i++)
38 printf("i %d red %u green %u blue %u\n", i, cmsEvalToneCurve16(tc_red, i * 256) >> 8, cmsEvalToneCurve16(tc_green, i * 256) >> 8, cmsEvalToneCurve16(tc_blue, i * 256) >> 8);
41 else
43 puts("Gamma tags missing");
45 cmsCloseProfile(hProfile);
47 else
49 puts("Couldn't open ICC file");
50 return 1;
52 return 0;