diff options
author | Marti Maria <info@littlecms.com> | 2010-03-22 14:59:11 +0300 |
---|---|---|
committer | Marti Maria <info@littlecms.com> | 2010-03-22 14:59:11 +0300 |
commit | 2474573db56ab3c6d4589a7c741bbd93b9ba9b05 (patch) | |
tree | 518ec187fbe67b8637a0a088983623526b933777 /utils | |
parent | c3934910e193c76237850b5a904d47d5a3946c0f (diff) |
Updates to beta2
Diffstat (limited to 'utils')
-rw-r--r-- | utils/common/utils.h | 5 | ||||
-rw-r--r-- | utils/common/vprf.c | 26 | ||||
-rw-r--r-- | utils/linkicc/linkicc.c | 39 | ||||
-rwxr-xr-x | utils/matlab/icctrans.c | 2 | ||||
-rw-r--r-- | utils/tificc/tificc.c | 42 |
5 files changed, 62 insertions, 52 deletions
diff --git a/utils/common/utils.h b/utils/common/utils.h index 5278587..1f4bd82 100644 --- a/utils/common/utils.h +++ b/utils/common/utils.h @@ -24,7 +24,7 @@ // //--------------------------------------------------------------------------------- -#ifndef __lcms_utils_h +#ifndef _lcms_utils_h // Deal with Microsoft's attempt at deprecating C standard runtime functions #ifdef _MSC_VER @@ -78,6 +78,7 @@ void PrintProfileInformation(cmsHPROFILE h); // --------------------------------------------------------------------------------- void PrintRenderingIntents(void); +void PrintBuiltins(void); // --------------------------------------------------------------------------------- @@ -93,5 +94,5 @@ int PixelTypeFromChanCount(int ColorChannels); // Return number of channels of pixel type int ChanCountFromPixelType(int ColorChannels); -#define __lcms_utils_h +#define _lcms_utils_h #endif diff --git a/utils/common/vprf.c b/utils/common/vprf.c index e901662..deb494a 100644 --- a/utils/common/vprf.c +++ b/utils/common/vprf.c @@ -69,7 +69,7 @@ cmsHPROFILE OpenStockProfile(cmsContext ContextID, const char* File) if (cmsstrcasecmp(File, "*Lab2") == 0) return cmsCreateLab2ProfileTHR(ContextID, NULL); - if (cmsstrcasecmp(File, "*Lab4") == 0) + if (cmsstrcasecmp(File, "*Lab4") == 0) return cmsCreateLab4ProfileTHR(ContextID, NULL); if (cmsstrcasecmp(File, "*Lab") == 0) @@ -94,6 +94,14 @@ cmsHPROFILE OpenStockProfile(cmsContext ContextID, const char* File) return hProfile; } + if (cmsstrcasecmp(File, "*Gray30") == 0) { + + cmsToneCurve* Curve = cmsBuildGamma(ContextID, 3.0); + cmsHPROFILE hProfile = cmsCreateGrayProfileTHR(ContextID, cmsD50_xyY(), Curve); + cmsFreeToneCurve(Curve); + return hProfile; + } + if (cmsstrcasecmp(File, "*srgb") == 0) return cmsCreate_sRGBProfileTHR(ContextID); @@ -117,6 +125,20 @@ cmsHPROFILE OpenStockProfile(cmsContext ContextID, const char* File) return cmsOpenProfileFromFileTHR(ContextID, File, "r"); } +// Help on available built-ins +void PrintBuiltins(void) +{ + fprintf(stderr, "\nBuilt-in profiles:\n\n"); + fprintf(stderr, "\t*Lab2 -- D50-based v2 CIEL*a*b\n" + "\t*Lab4 -- D50-based v4 CIEL*a*b\n" + "\t*Lab -- D50-based v4 CIEL*a*b\n" + "\t*XYZ -- CIE XYZ (PCS)\n" + "\t*sRGB -- sRGB color space\n" + "\t*Gray22 - Monochrome of Gamma 2.2\n" + "\t*Gray30 - Monochrome of Gamma 3.0\n" + "\t*null - Monochrome black for all input\n" + "\t*Lin2222- CMYK linearization of gamma 2.2 on each channel\n"); +} // Auxiliar for printing information on profile @@ -182,7 +204,7 @@ void PrintProfileInformation(cmsHPROFILE hInput) PrintInfo(hInput, cmsInfoCopyright); if (Verbose > 2) { - + PrintColorantTable(hInput, cmsSigColorantTableTag, "Input colorant table"); PrintColorantTable(hInput, cmsSigColorantTableOutTag, "Input colorant out table"); } diff --git a/utils/linkicc/linkicc.c b/utils/linkicc/linkicc.c index a6964d5..f887272 100644 --- a/utils/linkicc/linkicc.c +++ b/utils/linkicc/linkicc.c @@ -71,7 +71,7 @@ int Help(int level) fprintf(stderr, "%cx - Creatively, guess deviceclass of resulting profile.\n", SW); fprintf(stderr, "%cb - Black point compensation\n", SW); fprintf(stderr, "%cl - Use linearization curves (may affect accuracy)\n", SW); - fprintf(stderr, "%cr<v.r> - Profile version. (CAUTION: may change the profile implementation)\n", SW); + fprintf(stderr, "%cr<v.r> - Profile version. (CAUTION: may change the profile implementation)\n", SW); fprintf(stderr, "\n"); fprintf(stderr, "Colorspaces must be paired except Lab/XYZ, that can be interchanged.\n\n"); @@ -79,13 +79,7 @@ int Help(int level) break; case 1: - - fprintf(stderr, "\nBuilt-in profiles:\n\n"); - fprintf(stderr, "\t*Lab -- D50-based CIEL*a*b (PCS)\n" - "\t*XYZ -- CIE XYZ (PCS)\n" - "\t*sRGB -- sRGB color space\n" - "\t*Gray22- Monochrome of Gamma 2.2\n" - "\t*Lin2222- CMYK linearization of gamma 2.2 on each channel\n"); + PrintBuiltins(); break; case 2: @@ -116,8 +110,7 @@ int Help(int level) "info@littlecms.com\n\n"); } - return 0; - + exit(0); } // The toggles stuff @@ -126,7 +119,7 @@ void HandleSwitches(int argc, char *argv[]) { int s; - while ((s = xgetopt(argc,argv,"V:v:xXH:h:8k:K:BbO:o:T:t:D:d:C:c:n:N:f:F:lLy:Y:r:R:")) != EOF) { + while ((s = xgetopt(argc,argv,"V:v:xXH:h:8k:K:BbO:o:T:t:D:d:C:c:n:N:f:F:lLy:Y:r:R:")) != EOF) { switch (s) { @@ -144,8 +137,8 @@ void HandleSwitches(int argc, char *argv[]) case 'd': case 'D': - // Doing that is correct and safe: Description points to memory allocated in the command line. - // same for Copyright and output devicelink. + // Doing that is correct and safe: Description points to memory allocated in the command line. + // same for Copyright and output devicelink. Description = xoptarg; break; @@ -196,13 +189,13 @@ void HandleSwitches(int argc, char *argv[]) } break; - case 'r': - case 'R': - Version = atof(xoptarg); - if (Version < 2.0 || Version > 4.3) { - fprintf(stderr, "WARNING: lcms was not aware of this version, tag types may be wrong!\n"); - } - break; + case 'r': + case 'R': + Version = atof(xoptarg); + if (Version < 2.0 || Version > 4.3) { + fprintf(stderr, "WARNING: lcms was not aware of this version, tag types may be wrong!\n"); + } + break; case 'x': @@ -212,7 +205,7 @@ void HandleSwitches(int argc, char *argv[]) case 'h': case 'H': Help(atoi(xoptarg)); - return; + return; case 'l': @@ -271,7 +264,7 @@ int main(int argc, char *argv[]) fflush(stderr); // Initialize - InitUtils("linkicc"); + InitUtils("linkicc"); rc = 0; // Get the options @@ -334,7 +327,7 @@ int main(int argc, char *argv[]) if (lUse8bits) dwFlags |= cmsFLAGS_8BITS_DEVICELINK; // Create the color transform. Specify 0 for the format is safe as the transform - // is intended to be used only for the devicelink. + // is intended to be used only for the devicelink. hTransform = cmsCreateMultiprofileTransform(Profiles, nargs, 0, 0, Intent, dwFlags); if (hTransform == NULL) { FatalError("Transform creation failed"); diff --git a/utils/matlab/icctrans.c b/utils/matlab/icctrans.c index d7cd7d8..2e617f0 100755 --- a/utils/matlab/icctrans.c +++ b/utils/matlab/icctrans.c @@ -426,8 +426,6 @@ void OpenTransforms(int argc, char *argv[]) ProofingIntent, dwFlags); - - } diff --git a/utils/tificc/tificc.c b/utils/tificc/tificc.c index 6dd9ea4..cce3871 100644 --- a/utils/tificc/tificc.c +++ b/utils/tificc/tificc.c @@ -95,7 +95,7 @@ void Warning(const char *frm, ...) va_list args; va_start(args, frm); - ConsoleWarningHandler("[tifficc]", frm, args); + ConsoleWarningHandler("[tificc]", frm, args); va_end(args); } @@ -105,7 +105,7 @@ void Warning(const char *frm, ...) static void OutOfMem(cmsUInt32Number size) { - FatalError("Out of memory on allocating %d bytes.", size); + FatalError("Out of memory on allocating %d bytes.", size); } @@ -519,7 +519,7 @@ void WriteOutputTags(TIFF *out, int Colorspace, int BytesPerSample) } if (Width == 32) - TIFFSetField(out, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP); + TIFFSetField(out, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP); } @@ -550,7 +550,7 @@ void CopyOtherTags(TIFF* in, TIFF* out) CopyField(TIFFTAG_COMPRESSION, shortv); if (Width != 32) - CopyField(TIFFTAG_PREDICTOR, shortv); + CopyField(TIFFTAG_PREDICTOR, shortv); CopyField(TIFFTAG_THRESHHOLDING, shortv); CopyField(TIFFTAG_FILLORDER, shortv); @@ -596,10 +596,10 @@ void DoEmbedProfile(TIFF* Out, const char* ProfileFile) size = cmsfilelength(f); EmbedBuffer = (cmsUInt8Number*) malloc(size + 1); - if (EmbedBuffer == NULL) { + if (EmbedBuffer == NULL) { OutOfMem(size+1); - return; - } + return; + } EmbedLen = fread(EmbedBuffer, 1, size, f); @@ -887,16 +887,11 @@ void Help(int level) fprintf(stderr, "%ck<0..400> - Ink-limiting in %% (CMYK only)\n", SW); fprintf(stderr, "\n"); - fprintf(stderr, "%ch<0,1,2> - More help\n", SW); - fprintf(stderr, "\n"); - fprintf(stderr, "You can also use '*Lab' and '*XYZ' as predefined, built-in\n"); - fprintf(stderr, "profiles for CIE L*a*b* and XYZ color spaces.\n"); - + fprintf(stderr, "%ch<0,1,2,3> - More help\n", SW); break; case 1: - fprintf(stderr, "Examples:\n\n" "To color correct from scanner to sRGB:\n" "\ttifficc %ciscanner.icm in.tif out.tif\n" @@ -912,7 +907,10 @@ void Help(int level) break; case 2: + PrintBuiltins(); + break; + case 3: fprintf(stderr, "This program is intended to be a demo of the little cms\n" "engine. Both lcms and this program are freeware. You can\n" @@ -935,10 +933,9 @@ void HandleSwitches(int argc, char *argv[]) { int s; - while ((s=xgetopt(argc,argv,"aAeEbBw:W:nNvVGgh:H:i:I:o:O:P:p:t:T:c:C:l:L:M:m:K:k:S:s:D:d:")) != EOF) { + while ((s=xgetopt(argc,argv,"aAeEbBw:W:nNvVGgh:H:i:I:o:O:P:p:t:T:c:C:l:L:M:m:K:k:S:s:D:d:")) != EOF) { - switch (s) - { + switch (s) { case 'a': case 'A': @@ -996,8 +993,8 @@ void HandleSwitches(int argc, char *argv[]) case 'l': case 'L': - if (cInpProf != NULL || cOutProf != NULL) - FatalError("input/output profiles already specified"); + if (cInpProf != NULL || cOutProf != NULL) + FatalError("input/output profiles already specified"); cInpProf = xoptarg; lIsDeviceLink = TRUE; @@ -1026,11 +1023,10 @@ void HandleSwitches(int argc, char *argv[]) case 'W': case 'w': Width = atoi(xoptarg); - if (Width != 8 && Width != 16 && Width != 32) - FatalError("Only 8, 16 and 32 bps are supported"); + if (Width != 8 && Width != 16 && Width != 32) + FatalError("Only 8, 16 and 32 bps are supported"); break; - case 'k': case 'K': InkLimit = atof(xoptarg); @@ -1048,8 +1044,8 @@ void HandleSwitches(int argc, char *argv[]) int a = atoi(xoptarg); Help(a); - } - break; + } + break; default: |