diff options
Diffstat (limited to 'debian/lcms/lcms-1.19.dfsg2/Delphi/Samples')
7 files changed, 433 insertions, 0 deletions
diff --git a/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/MAKETEST.BAT b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/MAKETEST.BAT new file mode 100755 index 00000000..5a8fc9d1 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/MAKETEST.BAT @@ -0,0 +1,3 @@ +dcc32 -CC test
+if errorlevel 0 dcc32 -CC testwp
+
\ No newline at end of file diff --git a/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/TEST.PAS b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/TEST.PAS new file mode 100755 index 00000000..5530c1a6 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/TEST.PAS @@ -0,0 +1,71 @@ +
+
+
+PROGRAM LcmsTest;
+USES lcmsdll, Windows;
+
+TYPE
+ ScanLineType = Array[0..255] OF PACKED RECORD
+ b, g, r: Byte;
+ END;
+
+VAR
+ hInProfile, hOutProfile: cmsHPROFILE;
+ hTransform: cmsHTRANSFORM;
+
+ ScanLine, ScanLineTranslated: ScanLineType;
+ r, g, b: Integer;
+
+
+BEGIN
+
+
+ hInProfile := cmsOpenProfileFromFile('HPSJTW.ICM', 'r');
+ hOutProfile := cmsOpenProfileFromFile('sRGB Color Space Profile.ICM', 'r');
+
+
+ WriteLn('Input profile : ', cmsTakeProductName(hInProfile));
+ WriteLn('Output profile : ', cmsTakeProductName(hOutProfile));
+
+
+ hTransform := cmsCreateTransform(hInProfile,
+ TYPE_BGR_8,
+ hOutProfile,
+ TYPE_BGR_8,
+ INTENT_PERCEPTUAL, 0);
+
+ WriteLn('As speed test, I will transform all spectrum...');
+ WriteLn('This implies an image of 255x255x255x3 = 47 MB!!!');
+ WriteLn('Each number represents a chunk 255x255x3 = 190.5 Kb! processed');
+
+ FOR r := 0 TO 255 DO
+ BEGIN
+ FOR g := 0 TO 255 DO
+ BEGIN
+ FOR b := 0 TO 255 DO
+ BEGIN
+
+ ScanLine[b].r := r;
+ ScanLine[b].g := g;
+ ScanLine[b].b := b;
+ END;
+
+ cmsDoTransform(hTransform,
+ @ScanLine,
+ @ScanLineTranslated,
+ 255)
+
+ END;
+
+ Write(r:4, #$0d)
+ END;
+ WriteLn; WriteLn('Done!!!');
+
+
+
+ cmsDeleteTransform(hTransform);
+ cmsCloseProfile(hInProfile);
+ cmsCloseProfile(hOutProfile);
+
+END.
+
diff --git a/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/create.pas b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/create.pas new file mode 100755 index 00000000..72914ddd --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/create.pas @@ -0,0 +1,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.
+
diff --git a/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/gamutchk.pas b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/gamutchk.pas new file mode 100755 index 00000000..e2975bfa --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/gamutchk.pas @@ -0,0 +1,51 @@ +PROGRAM GamutChk;
+
+USES lcmsdll, Windows;
+
+
+VAR
+ hLabProfile, hDisplayProfile, hProof: cmsHPROFILE;
+ ProofTransform : cmsHTRANSFORM;
+ Lab: cmsCIELab;
+ wRGB: ARRAY [0..2] OF Byte;
+
+BEGIN
+ WriteLn('Gamut check test');
+
+ hLabProfile := cmsCreateLabProfile(NIL);
+ hDisplayProfile := cmsCreate_sRGBProfile();
+ hProof := cmsOpenProfileFromFile('test.icm', 'r');
+
+
+ ProofTransform:=cmsCreateProofingTransform(hLabProfile,
+ TYPE_Lab_DBL,
+ hDisplayProfile,
+ TYPE_RGB_8,
+ hProof,
+ INTENT_RELATIVE_COLORIMETRIC,
+ INTENT_ABSOLUTE_COLORIMETRIC,
+ cmsFLAGS_SOFTPROOFING OR cmsFLAGS_GAMUTCHECK OR cmsFLAGS_NOTPRECALC);
+
+
+ cmsSetAlarmCodes(255,255,255);
+
+
+ Write('L=?'); ReadLn(Lab.L);
+ Write('a=?'); ReadLn(Lab.a);
+ Write('b=?'); ReadLn(Lab.b);
+
+
+ cmsDoTransform(ProofTransform, @Lab, @wRGB, 1);
+
+ WriteLn('R=', wRGB[0], ' G=', wRGB[1], ' B=', wRGB[2]);
+
+ cmsCloseProfile(hLabProfile);
+ cmsCloseProfile(hDisplayProfile);
+ cmsCloseProfile(hProof);
+ cmsDeleteTransform(ProofTransform);
+
+END.
+
+
+
+
\ No newline at end of file diff --git a/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/getxyz.pas b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/getxyz.pas new file mode 100755 index 00000000..f8eeffe5 --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/getxyz.pas @@ -0,0 +1,62 @@ +program TestXYZ;
+uses lcmsdll;
+
+
+type
+ TRGB8 = Packed record
+ r, g, b : Byte
+ END;
+
+var
+
+ InputProfile, OutputProfile : cmsHPROFILE;
+ Transform: cmsHTRANSFORM;
+ RGB8: TRGB8;
+ XYZ: cmsCIEXYZ;
+
+begin
+ InputProfile := cmsOpenProfileFromFile('profile.icm','r');
+ OutputProfile := cmsCreateXYZProfile();
+
+ Transform := cmsCreateTransform(InputProfile,
+ TYPE_RGB_8,
+ OutputProfile,
+ TYPE_XYZ_DBL,
+ INTENT_ABSOLUTE_COLORIMETRIC, cmsFLAGS_NOTPRECALC);
+
+ WriteLn('Enter RGB (0-255) or all 0 to end');
+ REPEAT
+
+ Write('R?'); ReadLn(RGB8.r);
+ Write('G?'); ReadLn(RGB8.g);
+ Write('B?'); ReadLn(RGB8.b);
+
+
+ cmsDoTransform(Transform,
+ @RGB8,
+ @XYZ,
+ 1);
+
+
+ {Transport to radiance}
+
+ XYZ.X := XYZ.X * 100.;
+ XYZ.Y := XYZ.Y * 100.;
+ XYZ.Z := XYZ.Z * 100.;
+
+
+ WriteLn; WriteLn('XYZ (as viewed on D50 box)');
+
+ Write('X='); WriteLn(XYZ.X:3:2);
+ Write('Y='); WriteLn(XYZ.Y:3:2);
+ Write('Z='); WriteLn(XYZ.Z:3:2);
+
+ UNTIL ((RGB8.r = 0) and (RGB8.g = 0) and (RGB8.b = 0));
+
+
+ cmsDeleteTransform(Transform);
+ cmsCloseProfile(InputProfile);
+ cmsCloseProfile(OutputProfile)
+
+END.
+
diff --git a/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/testfrm.pas b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/testfrm.pas new file mode 100755 index 00000000..b0311e2a --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/testfrm.pas @@ -0,0 +1,95 @@ +program TestFormatting;
+uses lcmsdll;
+
+type
+ RGB16 = Packed record
+ r, g, b : Word
+ END;
+
+var
+ InputProfile, OutputProfile : cmsHPROFILE;
+ Transform1, Transform2: cmsHTRANSFORM;
+ InRGB16, OutRGB16: RGB16;
+ OutLab: cmsCIELab;
+
+
+procedure Mult257(var n: Word);
+ begin
+ n := n * 257
+ end;
+
+
+function Div257(n: Word) : Real;
+begin
+ Div257 := n / 257.
+end;
+
+
+begin
+
+ InputProfile := cmsCreate_sRGBProfile();
+ OutputProfile := cmsCreateLabProfile(NIL);
+
+
+ Transform1 := cmsCreateTransform(InputProfile,
+ TYPE_RGB_16,
+ OutputProfile,
+ TYPE_Lab_DBL,
+ INTENT_PERCEPTUAL, cmsFLAGS_NOTPRECALC);
+
+ Transform2 := cmsCreateTransform(OutputProfile,
+ TYPE_Lab_DBL,
+ InputProfile,
+ TYPE_RGB_16,
+ INTENT_PERCEPTUAL, cmsFLAGS_NOTPRECALC);
+
+ REPEAT
+
+ Write('R?'); ReadLn(InRGB16.r);
+ Write('G?'); ReadLn(InRGB16.g);
+ Write('B?'); ReadLn(InRGB16.b);
+
+
+ { Expand to 16 bits }
+
+ Mult257(InRGB16.r);
+ Mult257(InRGB16.g);
+ Mult257(InRGB16.b);
+
+
+ { Forward }
+
+ cmsDoTransform(Transform1,
+ @InRGB16,
+ @OutLab,
+ 1);
+
+
+ Write('L*='); WriteLn(OutLab.L:3:2);
+ Write('a*='); WriteLn(OutLab.a:3:2);
+ Write('b*='); WriteLn(OutLab.b:3:2);
+
+
+ { Backwards }
+
+
+ cmsDoTransform(Transform2,
+ @OutLab,
+ @OutRGB16,
+ 1);
+
+ Write('R='); WriteLn(Div257(OutRGB16.R) :3:2);
+ Write('G='); WriteLn(Div257(OutRGB16.G) :3:2);
+ Write('B='); WriteLn(Div257(OutRGB16.B) :3:2);
+
+
+
+ UNTIL ((InRGB16.r = 0) and (InRGB16.g = 0) and (InRGB16.b = 0));
+
+
+ cmsDeleteTransform(Transform1);
+ cmsDeleteTransform(Transform2);
+ cmsCloseProfile(InputProfile);
+ cmsCloseProfile(OutputProfile)
+END.
+
diff --git a/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/testwp.pas b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/testwp.pas new file mode 100755 index 00000000..3804033e --- /dev/null +++ b/debian/lcms/lcms-1.19.dfsg2/Delphi/Samples/testwp.pas @@ -0,0 +1,78 @@ +program TestWhitePoint;
+uses lcmsdll;
+
+type
+ RGB8 = Packed record
+ r, g, b : Byte
+ END;
+
+ CMYK8 = Packed record
+ c, m, y, k: Byte
+ end;
+var
+ WhitePoint: cmsCIExyY;
+ Primaries: cmsCIExyYTRIPLE;
+ Gamma: Array [1..3] OF LPGAMMATABLE;
+ InputProfile, OutputProfile : cmsHPROFILE;
+ Transform: cmsHTRANSFORM;
+ InRGB8: RGB8;
+ OutCMYK8: CMYK8;
+
+
+begin
+
+ cmsWhitePointFromTemp(9300, @WhitePoint);
+
+ Primaries.Red.x := 0.67;
+ Primaries.Red.y := 0.33;
+ Primaries.Red.YY := 1.0;
+ Primaries.Green.x := 0.21;
+ Primaries.Green.y := 0.71;
+ Primaries.Green.YY := 1.0;
+ Primaries.Blue.x := 0.14;
+ Primaries.Blue.y := 0.08;
+ Primaries.Blue.YY := 1.0;
+
+
+
+ Gamma[1] := cmsBuildGamma(256, 2.0);
+ Gamma[2] := cmsBuildGamma(256, 2.0);
+ Gamma[3] := cmsBuildGamma(256, 2.0);
+
+ InputProfile := cmsCreateRGBProfile(@WhitePoint, @Primaries, Gamma);
+ OutputProfile := cmsOpenProfileFromFile('CMYK.icm', 'r');
+
+
+ WriteLn('Input profile : ', cmsTakeProductName(InputProfile));
+ WriteLn('Output profile : ', cmsTakeProductName(OutputProfile));
+
+ Transform := cmsCreateTransform(InputProfile,
+ TYPE_RGB_8,
+ OutputProfile,
+ TYPE_CMYK_8,
+ INTENT_PERCEPTUAL, 0);
+
+ REPEAT
+
+ Write('R?'); ReadLn(InRGB8.r);
+ Write('G?'); ReadLn(InRGB8.g);
+ Write('B?'); ReadLn(InRGB8.b);
+
+ cmsDoTransform(Transform,
+ @InRGB8,
+ @OutCMYK8,
+ 1);
+
+ Write('C='); WriteLn(OutCMYK8.c);
+ Write('M='); WriteLn(OutCMYK8.m);
+ Write('Y='); WriteLn(OutCMYK8.y);
+ Write('K='); WriteLn(OutCMYK8.k);
+
+ UNTIL ((InRGB8.r = 0) and (InRGB8.g = 0) and (InRGB8.b = 0));
+
+
+ cmsDeleteTransform(Transform);
+ cmsCloseProfile(InputProfile);
+ cmsCloseProfile(OutputProfile)
+END.
+
|