diff options
Diffstat (limited to 'lcms2mt/utils/linkicc')
-rw-r--r-- | lcms2mt/utils/linkicc/Makefile.in | 16 | ||||
-rw-r--r-- | lcms2mt/utils/linkicc/linkicc.c | 318 |
2 files changed, 164 insertions, 170 deletions
diff --git a/lcms2mt/utils/linkicc/Makefile.in b/lcms2mt/utils/linkicc/Makefile.in index c5cb2fc9d..4477c79aa 100644 --- a/lcms2mt/utils/linkicc/Makefile.in +++ b/lcms2mt/utils/linkicc/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -139,7 +139,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = -am__maybe_remake_depfiles = +am__depfiles_maybe = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -265,6 +265,7 @@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIB_JPEG = @LIB_JPEG@ LIB_MATH = @LIB_MATH@ +LIB_PLUGINS = @LIB_PLUGINS@ LIB_THREAD = @LIB_THREAD@ LIB_TIFF = @LIB_TIFF@ LIB_ZLIB = @LIB_ZLIB@ @@ -388,8 +389,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -576,10 +577,7 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/lcms2mt/utils/linkicc/linkicc.c b/lcms2mt/utils/linkicc/linkicc.c index 3be4323f4..389b986ec 100644 --- a/lcms2mt/utils/linkicc/linkicc.c +++ b/lcms2mt/utils/linkicc/linkicc.c @@ -47,190 +47,185 @@ static cmsFloat64Number Version = 4.3; // The manual static -int Help(int level) +int Help(cmsContext ContextID, int level) { - switch (level) { - - default: - case 0: - - fprintf(stderr, "\nlinkicc: Links profiles into a single devicelink.\n"); - - fprintf(stderr, "\n"); - fprintf(stderr, "usage: linkicc [flags] <profiles>\n\n"); - fprintf(stderr, "flags:\n\n"); - fprintf(stderr, "%co<profile> - Output devicelink profile. [defaults to 'devicelink.icc']\n", SW); - - PrintRenderingIntents(NULL); - - fprintf(stderr, "%cc<0,1,2> - Precision (0=LowRes, 1=Normal, 2=Hi-res) [defaults to 1]\n", SW); - fprintf(stderr, "%cn<gridpoints> - Alternate way to set precision, number of CLUT points\n", SW); - fprintf(stderr, "%cd<description> - description text (quotes can be used)\n", SW); - fprintf(stderr, "%cy<copyright> - copyright notice (quotes can be used)\n", SW); - - fprintf(stderr, "\n%ck<0..400> - Ink-limiting in %% (CMYK only)\n", SW); - fprintf(stderr, "%c8 - Creates 8-bit devicelink\n", SW); - fprintf(stderr, "%cx - Creatively, guess deviceclass of resulting profile.\n", SW); - fprintf(stderr, "%cb - Black point compensation\n", SW); - fprintf(stderr, "%ca<0..1> - Observer adaptation state (abs.col. only)\n\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, "\n"); - fprintf(stderr, "Colorspaces must be paired except Lab/XYZ, that can be interchanged.\n\n"); - - fprintf(stderr, "%ch<0,1,2,3> - More help\n", SW); - break; - - case 1: - PrintBuiltins(); - break; - - case 2: - - fprintf(stderr, "\nExamples:\n\n" - "To create 'devicelink.icm' from a.icc to b.icc:\n" - "\tlinkicc a.icc b.icc\n\n" - "To create 'out.icc' from sRGB to cmyk.icc:\n" - "\tlinkicc -o out.icc *sRGB cmyk.icc\n\n" - "To create a sRGB input profile working in Lab:\n" - "\tlinkicc -x -o sRGBLab.icc *sRGB *Lab\n\n" - "To create a XYZ -> sRGB output profile:\n" - "\tlinkicc -x -o sRGBLab.icc *XYZ *sRGB\n\n" - "To create a abstract profile doing softproof for cmyk.icc:\n" - "\tlinkicc -t1 -x -o softproof.icc *Lab cmyk.icc cmyk.icc *Lab\n\n" - "To create a 'grayer' sRGB input profile:\n" - "\tlinkicc -x -o grayer.icc *sRGB gray.icc gray.icc *Lab\n\n" - "To embed ink limiting into a cmyk output profile:\n" - "\tlinkicc -x -o cmyklimited.icc -k 250 cmyk.icc *Lab\n\n"); - 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" - "obtain both in source code at http://www.littlecms.com\n" - "For suggestions, comments, bug reports etc. send mail to\n" - "info@littlecms.com\n\n"); - } - - exit(0); + UTILS_UNUSED_PARAMETER(level); + + fprintf(stderr, "\nlinkicc: Links profiles into a single devicelink.\n"); + + fprintf(stderr, "\n"); + fprintf(stderr, "usage: linkicc [flags] <profiles>\n\n"); + fprintf(stderr, "flags:\n\n"); + fprintf(stderr, "-o<profile> - Output devicelink profile. [defaults to 'devicelink.icc']\n"); + + PrintRenderingIntents(ContextID); + + fprintf(stderr, "-c<0,1,2> - Precision (0=LowRes, 1=Normal, 2=Hi-res) [defaults to 1]\n"); + fprintf(stderr, "-n<gridpoints> - Alternate way to set precision, number of CLUT points\n"); + fprintf(stderr, "-d<description> - description text (quotes can be used)\n"); + fprintf(stderr, "-y<copyright> - copyright notice (quotes can be used)\n"); + + fprintf(stderr, "\n-k<0..400> - Ink-limiting in %% (CMYK only)\n"); + fprintf(stderr, "-8 - Creates 8-bit devicelink\n"); + fprintf(stderr, "-x - Creatively, guess deviceclass of resulting profile.\n"); + fprintf(stderr, "-b - Black point compensation\n"); + fprintf(stderr, "-a<0..1> - Observer adaptation state (abs.col. only)\n\n"); + fprintf(stderr, "-l - Use linearization curves (may affect accuracy)\n"); + fprintf(stderr, "-r<v.r> - Profile version. (CAUTION: may change the profile implementation)\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "Colorspaces must be paired except Lab/XYZ, that can be interchanged.\n\n"); + + PrintBuiltins(); + + fprintf(stderr, "\nExamples:\n\n" + "To create 'devicelink.icm' from a.icc to b.icc:\n" + "\tlinkicc a.icc b.icc\n\n" + "To create 'out.icc' from sRGB to cmyk.icc:\n" + "\tlinkicc -o out.icc *sRGB cmyk.icc\n\n" + "To create a sRGB input profile working in Lab:\n" + "\tlinkicc -x -o sRGBLab.icc *sRGB *Lab\n\n" + "To create a XYZ -> sRGB output profile:\n" + "\tlinkicc -x -o sRGBLab.icc *XYZ *sRGB\n\n" + "To create a abstract profile doing softproof for cmyk.icc:\n" + "\tlinkicc -t1 -x -o softproof.icc *Lab cmyk.icc cmyk.icc *Lab\n\n" + "To create a 'grayer' sRGB input profile:\n" + "\tlinkicc -x -o grayer.icc *sRGB gray.icc gray.icc *Lab\n\n" + "To embed ink limiting into a cmyk output profile:\n" + "\tlinkicc -x -o cmyklimited.icc -k 250 cmyk.icc *Lab\n\n"); + + fprintf(stderr, "This program is intended to be a demo of the Little CMS\n" + "color engine. Both lcms and this program are open source.\n" + "You can obtain both in source code at https://www.littlecms.com\n" + "For suggestions, comments, bug reports etc. send mail to\n" + "info@littlecms.com\n\n"); + + exit(0); } // The toggles stuff static -void HandleSwitches(int argc, char *argv[]) +void HandleSwitches(cmsContext ContextID, int argc, char *argv[]) { int s; - while ((s = xgetopt(argc,argv,"a:A:BbC:c:D:d:h:H:k:K:lLn:N:O:o:r:R:T:t:V:v:xX8y:Y:")) != EOF) { + while ((s = xgetopt(argc,argv,"a:A:BbC:c:D:d:h:H:k:K:lLn:N:O:o:r:R:T:t:V:v:xX8y:Y:-:")) != EOF) { switch (s) { + case '-': + if (strcmp(xoptarg, "help") == 0) + { + Help(ContextID, 0); + } + else + { + FatalError("Unknown option - run without args to see valid ones.\n"); + } + break; + + case 'a': + case 'A': + ObserverAdaptationState = atof(xoptarg); + if (ObserverAdaptationState < 0 || + ObserverAdaptationState > 1.0) + FatalError("Adaptation state should be 0..1"); + break; + + case 'b': + case 'B': + BlackPointCompensation = TRUE; + break; + + case 'c': + case 'C': + PrecalcMode = atoi(xoptarg); + if (PrecalcMode < 0 || PrecalcMode > 2) { + FatalError("Unknown precalc mode '%d'", PrecalcMode); + } + break; + + 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. + Description = xoptarg; + break; + + case 'h': + case 'H': + Help(ContextID, atoi(xoptarg)); + return; + + case 'k': + case 'K': + InkLimit = atof(xoptarg); + if (InkLimit < 0.0 || InkLimit > 400.0) { + FatalError("Ink limit must be 0%%..400%%"); + } + break; - case 'a': - case 'A': - ObserverAdaptationState = atof(xoptarg); - if (ObserverAdaptationState < 0 || - ObserverAdaptationState > 1.0) - FatalError("Adaptation state should be 0..1"); - break; - case 'b': - case 'B': - BlackPointCompensation = TRUE; - break; + case 'l': + case 'L': KeepLinearization = TRUE; + break; - case 'c': - case 'C': - PrecalcMode = atoi(xoptarg); - if (PrecalcMode < 0 || PrecalcMode > 2) { - FatalError("Unknown precalc mode '%d'", PrecalcMode); - } - break; - - 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. - Description = xoptarg; - break; - - case 'h': - case 'H': - Help(atoi(xoptarg)); - return; - - case 'k': - case 'K': - InkLimit = atof(xoptarg); - if (InkLimit < 0.0 || InkLimit > 400.0) { - FatalError("Ink limit must be 0%%..400%%"); - } - break; - - - case 'l': - case 'L': KeepLinearization = TRUE; - break; - - case 'n': - case 'N': - if (PrecalcMode != 1) { - FatalError("Precalc mode already specified"); - } - NumOfGridPoints = atoi(xoptarg); - break; - - case 'o': - case 'O': - cOutProf = xoptarg; - 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 't': - case 'T': - Intent = atoi(xoptarg); // Will be validated latter on - break; + case 'n': + case 'N': + if (PrecalcMode != 1) { + FatalError("Precalc mode already specified"); + } + NumOfGridPoints = atoi(xoptarg); + break; - case 'V': - case 'v': - Verbose = atoi(xoptarg); - if (Verbose < 0 || Verbose > 3) { - FatalError("Unknown verbosity level '%d'", Verbose); - } - break; + case 'o': + case 'O': + cOutProf = xoptarg; + break; - case '8': - lUse8bits = TRUE; - 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 't': + case 'T': + Intent = atoi(xoptarg); // Will be validated latter on + break; + + case 'V': + case 'v': + Verbose = atoi(xoptarg); + if (Verbose < 0 || Verbose > 3) { + FatalError("Unknown verbosity level '%d'", Verbose); + } + break; + + case '8': + lUse8bits = TRUE; + break; - case 'y': - case 'Y': - Copyright = xoptarg; - break; + case 'y': + case 'Y': + Copyright = xoptarg; + break; - case 'x': - case 'X': TagResult = TRUE; - break; + case 'x': + case 'X': TagResult = TRUE; + break; - default: + default: - FatalError("Unknown option - run without args to see valid ones.\n"); - } + FatalError("Unknown option - run without args to see valid ones.\n"); + } } } @@ -275,7 +270,8 @@ int main(int argc, char *argv[]) cmsContext ContextID = NULL; // Here we are - fprintf(stderr, "little cms ICC device link generator - v2.2 [LittleCMS %2.2f]\n", LCMS_VERSION / 1000.0); + fprintf(stderr, "Little CMS ICC device link generator - v3.0 [LittleCMS %2.2f]\n", LCMS_VERSION / 1000.0); + fprintf(stderr, "Copyright (c) 1998-2020 Marti Maria Saguer. See COPYING file for details.\n"); fflush(stderr); // Initialize @@ -283,12 +279,12 @@ int main(int argc, char *argv[]) rc = 0; // Get the options - HandleSwitches(argc, argv); + HandleSwitches(ContextID, argc, argv); // How many profiles to link? nargs = (argc - xoptind); if (nargs < 1) - return Help(0); + return Help(ContextID, 0); if (nargs > 255) { FatalError("Holy profile! what are you trying to do with so many profiles!?"); |