diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2017-04-15 18:54:41 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2017-04-15 18:54:41 +0000 |
commit | 4a297519085116439c4c1970c5fa132700e01139 (patch) | |
tree | a08604c7f0184c2cccdd49723e9396b551cb3aa4 | |
parent | 60eb8ee4bf3e0878031ec10989b9c8069972e89d (diff) | |
download | netpbm-mirror-4a297519085116439c4c1970c5fa132700e01139.tar.gz netpbm-mirror-4a297519085116439c4c1970c5fa132700e01139.tar.xz netpbm-mirror-4a297519085116439c4c1970c5fa132700e01139.zip |
Release 10.78.02
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2950 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | doc/HISTORY | 10 | ||||
-rw-r--r-- | editor/pamcomp.c | 26 | ||||
-rw-r--r-- | version.mk | 2 |
3 files changed, 27 insertions, 11 deletions
diff --git a/doc/HISTORY b/doc/HISTORY index d45b2baf..707256a6 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,16 @@ Netpbm. CHANGE HISTORY -------------- +17.04.15 BJH Release 10.78.02 + + 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). + 17.04.04 BJH Release 10.78.01 pnmtojpeg: fix array bounds violation in argument list. Always diff --git a/editor/pamcomp.c b/editor/pamcomp.c index 548882e3..35117fbe 100644 --- a/editor/pamcomp.c +++ b/editor/pamcomp.c @@ -438,6 +438,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 @@ -481,23 +488,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'. @@ -508,22 +516,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)); @@ -556,8 +564,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 e0f87ef3..671c59a4 100644 --- a/version.mk +++ b/version.mk @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 78 -NETPBM_POINT_RELEASE = 1 +NETPBM_POINT_RELEASE = 2 |