summaryrefslogtreecommitdiffstats
path: root/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/create.pas
blob: 72914ddd7e4ebfa212ae098298d79212a159c5a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

PROGRAM CreateProfile;
USES lcmsdll, Windows;


VAR
        Primaries:  cmsCIExyYTRIPLE;
        WhitePoint: cmsCIExyY;
        GammaTables: ARRAY [1..3] OF LPGAMMATABLE;
        TheProfile: cmsHPROFILE;


BEGIN

        WriteLn('Creation of profile TEST.ICM...');

        {Fill in primaries (Rec709 as example) }

        Primaries.Red.x := 0.6400;
        Primaries.Red.y := 0.3300;
        Primaries.Red.YY := 1.0;

        Primaries.Green.x := 0.3000;
        Primaries.Green.y := 0.6000;
        Primaries.Green.YY := 1.0;

        Primaries.Blue.x := 0.1500;
        Primaries.Blue.y := 0.0600;
        Primaries.Blue.YY := 1.0;


        {Calculates white point from temperature}
        {That is, 6504§K = D65                  }

        cmsWhitePointFromTemp(6504, @WhitePoint);



        { Compute gamma tables of 2.2 }

        GammaTables[1] := cmsBuildGamma(256, 2.2);
        GammaTables[2] := cmsBuildGamma(256, 2.2);
        GammaTables[3] := cmsBuildGamma(256, 2.2);


        { Does create the profile }

        TheProfile := cmsCreateRGBProfile(@WhitePoint, @Primaries, GammaTables);



        _cmsAddTextTag(TheProfile, $63707274, 'copyright (c) you');
        _cmsAddTextTag(TheProfile, $646D6E64, 'Manufacturer');
        _cmsAddTextTag(TheProfile, $646D6464, 'Model');


        { Save the profile to a file }

        _cmsSaveProfile(TheProfile, 'TEST.ICM');

        WriteLn('Profile saved');

        { Free the gamma tables }

        cmsFreeGamma(GammaTables[1]);
        cmsFreeGamma(GammaTables[2]);
        cmsFreeGamma(GammaTables[3]);

        { And close the handle }

        cmsCloseProfile(TheProfile)
END.