From 3432de82ed8357a1e653919c74f1293dfb6c8e07 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 15 Apr 2017 18:54:17 +0000 Subject: Release 10.73.09 git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@2949 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/pnmtojpeg.c | 4 ++-- doc/HISTORY | 13 +++++++++++++ editor/pamcomp.c | 26 ++++++++++++++++---------- version.mk | 2 +- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/converter/other/pnmtojpeg.c b/converter/other/pnmtojpeg.c index ce231c94..7e7272a0 100644 --- a/converter/other/pnmtojpeg.c +++ b/converter/other/pnmtojpeg.c @@ -230,7 +230,7 @@ parseCommandLine(const int argc, char ** argv, char ** argv_parse; /* argv, except we modify it as we parse */ - MALLOCARRAY(argv_parse, argc); + MALLOCARRAY(argv_parse, argc + 1); /* +1 for the terminating null ptr */ option_def_index = 0; /* incremented by OPTENTRY */ OPTENT3(0, "verbose", OPT_FLAG, NULL, &cmdlineP->verbose, 0); @@ -273,7 +273,7 @@ parseCommandLine(const int argc, char ** argv, /* Make private copy of arguments for pm_optParseOptions to corrupt */ argc_parse = argc; - for (i=0; i < argc; i++) argv_parse[i] = argv[i]; + for (i=0; i < argc+1; i++) argv_parse[i] = argv[i]; opt.opt_table = option_def; opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ diff --git a/doc/HISTORY b/doc/HISTORY index 8d08fea7..8828a93e 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,19 @@ Netpbm. CHANGE HISTORY -------------- +17.04.15 BJH Release 10.73.09 + + pamcomp: fix incorrect output with -mixtransparency. + Always broken. (-mixtransparency was new in Netpbm 10.56, + September 2011). + + pamcomp: remove debug trace message with -mixtransparency. + Always broken. (-mixtransparency was new in Netpbm 10.56, + September 2011). + + pnmtojpeg: fix array bounds violation in argument list. Always + broken (pnmtojpeg was new to Netpbm in Netpbm 8.2 (March 2000). + 17.03.28 BJH Release 10.73.08 tifftonm: Fix incorrect PBM output with two-color paletted TIFF diff --git a/editor/pamcomp.c b/editor/pamcomp.c index 9855e173..b76eb8c7 100644 --- a/editor/pamcomp.c +++ b/editor/pamcomp.c @@ -437,6 +437,13 @@ computeOverlayPosition(int const underCols, overlaying images are plastic slides and we taped them together to make a composed plastic slide, the calculations go as follows. + U means color of underlay pixel + O means color of overlay pixel + C means color of composed pixel + X is a variable, standing for U, O, or C + X_T means transparency of the X pixel + X_O means opacity of the X pixel + Opacity and transparency are fractions in [0,1] and are complements: X_T = 1 - X_O @@ -480,23 +487,24 @@ static sample composeComponents(sample const compA, sample const compB, float const distrib, - float const aFactor, + float const bFactor, float const composedFactor, sample const maxval, enum sampleScale const sampleScale) { /*---------------------------------------------------------------------------- Compose a single color component of each of two pixels, with 'distrib' being the fraction of 'compA' in the result, 1-distrib the fraction of 'compB'. - Note that this does not apply to an opacity component. + + Note that this function is not useful for an opacity component. 'sampleScale' tells in what domain the 'distrib' fraction applies: brightness or light intensity (gamma-adjusted or not). - 'aFactor' is a factor in [0,1] to apply to 'compA' first. + 'bFactor' is a factor in [0,1] to apply to 'compB' first. 'composedFactor' is a factor to apply to the result. - See above for explanation of why 'aFactor' and 'composedFactor' are + See above for explanation of why 'bFactor' and 'composedFactor' are useful. The inputs and result are based on a maxval of 'maxval'. @@ -507,22 +515,22 @@ composeComponents(sample const compA, -----------------------------------------------------------------------------*/ sample retval; - if (fabs(distrib) > .999 && aFactor > .999 && composedFactor > .999) + if (fabs(distrib) > .999 && bFactor > .999 && composedFactor > .999) /* Fast path for common case */ retval = compA; else { if (sampleScale == INTENSITY_SAMPLE) { sample const mix = - ROUNDU(compA * aFactor * distrib + compB * (1.0 - distrib)); + ROUNDU(compA * distrib + compB * bFactor *(1.0 - distrib)); retval = MIN(maxval, MAX(0, mix)); } else { float const compANormalized = (float)compA/maxval; float const compBNormalized = (float)compB/maxval; float const compALinear = pm_ungamma709(compANormalized); float const compBLinear = pm_ungamma709(compBNormalized); - float const compALinearAdj = compALinear * aFactor; + float const compBLinearAdj = compBLinear * bFactor; float const mix = - compALinearAdj * distrib + compBLinear * (1.0 - distrib) + compALinear * distrib + compBLinearAdj * (1.0 - distrib) * composedFactor; sample const sampleValue = ROUNDU(pm_gamma709(mix) * maxval); retval = MIN(maxval, MAX(0, sampleValue)); @@ -555,8 +563,6 @@ composedOpacity(tuple const uTuple, float const composedTrans = underlayTrans * overlayTrans; sample const sampleValue = (1.0 - composedTrans) * cPamP->maxval; retval = MIN(cPamP->maxval, MAX(0, sampleValue)); - pm_message("underlay = %lu/%f, overlay = %f, composed = %f", - uTuple[uPamP->opacity_plane],underlayTrans, overlayTrans, composedTrans); } break; case AM_KEEPUNDER: retval = uTuple[uPamP->opacity_plane]; diff --git a/version.mk b/version.mk index ced16c99..691d5bc9 100644 --- a/version.mk +++ b/version.mk @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 73 -NETPBM_POINT_RELEASE = 8 +NETPBM_POINT_RELEASE = 9 -- cgit 1.4.1