From c018d0cb8f74951c4e6926df3a65e7bf9695a22d Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 6 Oct 2019 03:44:47 +0000 Subject: Check for incompatible options git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3704 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- editor/pnmquant | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'editor') diff --git a/editor/pnmquant b/editor/pnmquant index 80d8e09f..827d6fde 100755 --- a/editor/pnmquant +++ b/editor/pnmquant @@ -199,10 +199,10 @@ sub openSeekableAsStdin($) { -sub makeColormap($$$$$$) { +sub makeColormap($$$$$$$) { my ($ncolors, $opt_center, $opt_meanpixel, $opt_meancolor, - $opt_spreadluminosity, $opt_quiet) = @_; + $opt_spreadbrightness, $opt_spreadluminosity, $opt_quiet) = @_; # Make a colormap of $ncolors colors from the image on Standard Input. # Put it in a temporary file and return its name. @@ -235,6 +235,16 @@ sub makeColormap($$$$$$) { $averageOpt = "-center"; } + my $spreadOptCt = + (defined($opt_spreadluminosity) ? 1 : 0) + + (defined($opt_spreadbrightness) ? 1 : 0); + + if ($spreadOptCt > 1) { + print(STDERR "You can specify only one of " . + "-spreadluminosity and -spreadbrightness\n"); + exit(1); + } + my $spreadOpt; if (defined($opt_spreadluminosity)) { $spreadOpt = "-spreadluminosity"; @@ -276,6 +286,10 @@ sub remap($$$$$$) { push(@options, "-floyd"); } if ($opt_norandom) { + if (defined($opt_randomseed)) { + print(STDERR "You cannot specify -randomseed with -norandom\n"); + exit(1); + } push(@options, "-norandom"); } if (defined($opt_randomseed)) { @@ -322,6 +336,7 @@ my $mapfileSpec = makeColormap($cmdlineR->{ncolors}, $cmdlineR->{center}, $cmdlineR->{meanpixel}, $cmdlineR->{meancolor}, + $cmdlineR->{spreadbrightness}, $cmdlineR->{spreadluminosity}, $cmdlineR->{quiet}); -- cgit 1.4.1