diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2011-09-25 18:51:44 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2011-09-25 18:51:44 +0000 |
commit | 7923b359409c0a156ccaaa0789dbe949959f695f (patch) | |
tree | 4a02299d9bba9eb5933409ffef61837c99032e4e | |
parent | 2c56eee205115a1bae88c6598dea64d867dd28b5 (diff) | |
download | netpbm-mirror-7923b359409c0a156ccaaa0789dbe949959f695f.tar.gz netpbm-mirror-7923b359409c0a156ccaaa0789dbe949959f695f.tar.xz netpbm-mirror-7923b359409c0a156ccaaa0789dbe949959f695f.zip |
Release 10.35.82
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@1575 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | Makefile.version | 2 | ||||
-rw-r--r-- | converter/other/pnmtopng.c | 67 | ||||
-rw-r--r-- | converter/other/pnmtops.c | 2 | ||||
-rw-r--r-- | doc/HISTORY | 11 | ||||
-rw-r--r-- | editor/pamcomp.c | 2 | ||||
-rwxr-xr-x | editor/pnmquant | 4 |
6 files changed, 59 insertions, 29 deletions
diff --git a/Makefile.version b/Makefile.version index f69ad793..ed7dddee 100644 --- a/Makefile.version +++ b/Makefile.version @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 35 -NETPBM_POINT_RELEASE = 81 +NETPBM_POINT_RELEASE = 82 diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c index 065f5195..92c38a2a 100644 --- a/converter/other/pnmtopng.c +++ b/converter/other/pnmtopng.c @@ -959,17 +959,17 @@ tryTransparentColor(FILE * const ifp, static void -analyzeAlpha(FILE * const ifp, - pm_filepos const rasterPos, - int const cols, - int const rows, - xelval const maxval, - int const format, - gray ** const alphaMask, - gray const alphaMaxval, - bool * const allOpaqueP, - bool * const singleColorIsTransP, - pixel* const alphaTranscolorP) { +analyzeAlpha(FILE * const ifP, + pm_filepos const rasterPos, + unsigned int const cols, + unsigned int const rows, + xelval const maxval, + int const format, + gray ** const alphaMask, + gray const alphaMaxval, + bool * const allOpaqueP, + bool * const singleColorIsTransP, + pixel * const alphaTranscolorP) { /*---------------------------------------------------------------------------- Get information about the alpha mask, in combination with the masked image, that Caller can use to choose the most efficient way to @@ -990,19 +990,38 @@ analyzeAlpha(FILE * const ifp, */ pixel transcolor; /* Color of the transparent pixel mentioned above. */ + bool foundNonOpaquePixel; + /* We found a pixel in the image where the alpha mask says it is + not fully opaque. + */ xelrow = pnm_allocrow(cols); { - int row; + unsigned int row; + /* See if the mask says every pixel is opaque. */ + foundNonOpaquePixel = false; /* initial assumption */ + pm_seek2(ifP, &rasterPos, sizeof(rasterPos)); + for (row = 0; row < rows && !foundNonOpaquePixel; ++row) { + unsigned int col; + pnm_readpnmrow(ifP, xelrow, cols, maxval, format); + for (col = 0; col < cols && !foundNonOpaquePixel; ++col) { + if (alphaMask[row][col] != maxval) + foundNonOpaquePixel = true; + } + } + } + + if (foundNonOpaquePixel) { + unsigned int row; /* Find a candidate transparent color -- the color of any pixel in the image that the alpha mask says should be transparent. */ - foundTransparentPixel = FALSE; /* initial assumption */ - pm_seek2(ifp, &rasterPos, sizeof(rasterPos)); - for (row = 0 ; row < rows && !foundTransparentPixel ; ++row) { - int col; - pnm_readpnmrow(ifp, xelrow, cols, maxval, format); + foundTransparentPixel = false; /* initial assumption */ + pm_seek2(ifP, &rasterPos, sizeof(rasterPos)); + for (row = 0; row < rows && !foundTransparentPixel; ++row) { + unsigned int col; + pnm_readpnmrow(ifP, xelrow, cols, maxval, format); for (col = 0; col < cols && !foundTransparentPixel; ++col) { if (alphaMask[row][col] == 0) { foundTransparentPixel = TRUE; @@ -1010,20 +1029,20 @@ analyzeAlpha(FILE * const ifp, } } } - } + } else + foundTransparentPixel = false; pnm_freerow(xelrow); + *allOpaqueP = !foundNonOpaquePixel; + if (foundTransparentPixel) { - *allOpaqueP = FALSE; - tryTransparentColor(ifp, rasterPos, cols, rows, maxval, format, + tryTransparentColor(ifP, rasterPos, cols, rows, maxval, format, alphaMask, alphaMaxval, transcolor, singleColorIsTransP); *alphaTranscolorP = transcolor; - } else { - *allOpaqueP = TRUE; - *singleColorIsTransP = FALSE; - } + } else + *singleColorIsTransP = false; } diff --git a/converter/other/pnmtops.c b/converter/other/pnmtops.c index eb9cbf6f..d2280557 100644 --- a/converter/other/pnmtops.c +++ b/converter/other/pnmtops.c @@ -645,7 +645,7 @@ computeImagePosition(int const dpiX, if (verbose) pm_message("Image will be %3.2f points wide by %3.2f points high, " "left edge %3.2f points from left edge of page, " - "bottom edge %3.2f points from top of page; " + "bottom edge %3.2f points from bottom of page; " "%sturned to landscape orientation", *scolsP, *srowsP, *llxP, *llyP, *turnedP ? "" : "NOT "); } diff --git a/doc/HISTORY b/doc/HISTORY index 48ac75a1..83907ba3 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,17 @@ Netpbm. CHANGE HISTORY -------------- +11.09.25 BJH Release 10.35.82 + + pnmtopng: fix bug: with -alpha specifying a mask which contains + no fully transparent area, output PNG is fully opaque. + Introduced in 10.29. + + pnmquant: work with older Perl that doesn't have 3-argument open. + + pnmtops: fix message: says "from top edge" where it means + "from bottom edge." + 11.07.10 BJH Release 10.35.81 pgmtexture: fix wrong sum variance result. Wrong since the diff --git a/editor/pamcomp.c b/editor/pamcomp.c index fc43d9c5..c9c389b7 100644 --- a/editor/pamcomp.c +++ b/editor/pamcomp.c @@ -599,7 +599,7 @@ main(int argc, char *argv[]) { PAM_STRUCT_SIZE(allocation_depth)); if (overlayPam.width != alphaPam.width || - overlayPam.height != overlayPam.height) + overlayPam.height != alphaPam.height) pm_error("Opacity map and overlay image are not the same size"); } else alphaFileP = NULL; diff --git a/editor/pnmquant b/editor/pnmquant index 175f6906..5edbe85e 100755 --- a/editor/pnmquant +++ b/editor/pnmquant @@ -149,7 +149,7 @@ sub openSeekableAsStdin($) { tell(INFH); # Avoids bogus "INFH is not referenced" warning } } else { - open(STDIN, "<", $infile) + open(STDIN, "<$infile") or die("Unable to open input file '$infile'. Errno=$ERRNO"); } } @@ -194,7 +194,7 @@ sub makeColormap($$$$$) { push(@options, '-quiet'); } - open(STDOUT, ">", $mapfileSpec); + open(STDOUT, ">$mapfileSpec"); my $maprc = system("pnmcolormap", $ncolors, @options); |