From 30d0735d5fb1aad813380bc1d2ebf521070c9e20 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 3 Dec 2006 16:06:15 +0000 Subject: Release 10.36.14 git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@162 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- Makefile.version | 2 +- converter/other/pnmtopng.c | 2 +- doc/HISTORY | 12 ++++++++++++ editor/pnmrotate.c | 24 ++++++++++++++++++++++-- generator/pbmtext.c | 2 +- lib/libpnm3.c | 24 +++++++++++++++++++++--- lib/pnm.h | 3 ++- other/pamx/image.c | 2 +- other/pamx/pamx.c | 2 +- 9 files changed, 62 insertions(+), 11 deletions(-) diff --git a/Makefile.version b/Makefile.version index e864d02f..e1ce83c0 100644 --- a/Makefile.version +++ b/Makefile.version @@ -1,4 +1,4 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 36 -NETPBM_POINT_RELEASE = 13 +NETPBM_POINT_RELEASE = 14 diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c index 9287d0ee..ed245b93 100644 --- a/converter/other/pnmtopng.c +++ b/converter/other/pnmtopng.c @@ -999,7 +999,7 @@ analyzeAlpha(FILE * const ifp, for (col = 0; col < cols && !foundTransparentPixel; ++col) { if (alphaMask[row][col] == 0) { foundTransparentPixel = TRUE; - transcolor = xeltopixel(xelrow[col]); + transcolor = pnm_xeltopixel(xelrow[col], format); } } } diff --git a/doc/HISTORY b/doc/HISTORY index 876d8893..aeef2818 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,18 @@ Netpbm. CHANGE HISTORY -------------- +06.12.13 BJH Release 10.36.14 + + pbmtext: Fix crash when there is only one character. + + pnmtopng: fix transparency optimization on PPM input. + + pnmrotate: fix -background option with PGM/PBM input. + + pamx: fix bug with X depth = 0. + + pamx: fix bug: incorrect display of one-plane input image. + 06.11.27 BJH Release 10.36.13 Configure: Fix incorrect .dylib suffix in shared library default. diff --git a/editor/pnmrotate.c b/editor/pnmrotate.c index fafb2f3a..d3f92342 100644 --- a/editor/pnmrotate.c +++ b/editor/pnmrotate.c @@ -159,6 +159,27 @@ computeNewFormat(bool const antialias, +static bool +isWhite(xel const color, + xelval const maxval) { + + return (PPM_GETR(color) == maxval && + PPM_GETG(color) == maxval && + PPM_GETB(color) == maxval); +} + + + +static bool +isBlack(xel const color) { + + return (PPM_GETR(color) == 0 && + PPM_GETG(color) == 0 && + PPM_GETB(color) == 0); +} + + + static xel backgroundColor(const char * const backgroundColorName, xel * const topRow, @@ -180,8 +201,7 @@ backgroundColor(const char * const backgroundColorName, break; case PBM_TYPE: - if (!PNM_EQUAL(retval, pnm_whitexel(maxval, format)) && - !PNM_EQUAL(retval, pnm_blackxel(maxval, format))) + if (!isWhite(retval, maxval) && !isBlack(retval)) pm_error("Image is PBM (black and white), " "but you specified '%s', which is neither black " "nor white, as background color", diff --git a/generator/pbmtext.c b/generator/pbmtext.c index e1d132d0..6706598f 100644 --- a/generator/pbmtext.c +++ b/generator/pbmtext.c @@ -246,8 +246,8 @@ get_line_dimensions(const char line[], const struct font * const font_p, *bwid_p += full_pixels; accumulated_ics -= full_pixels; } - lastGlyphP = glyphP; } + lastGlyphP = glyphP; *bwid_p += glyphP->xadd; } } diff --git a/lib/libpnm3.c b/lib/libpnm3.c index c9c9a1b0..f10a7fca 100644 --- a/lib/libpnm3.c +++ b/lib/libpnm3.c @@ -383,11 +383,29 @@ pnm_promoteformatrow( xelrow, cols, maxval, format, newmaxval, newformat ) pixel -xeltopixel(xel const inputxel) { +pnm_xeltopixel(xel const inputxel, + int const format) { pixel outputpixel; - PPM_ASSIGN(outputpixel, - PNM_GET1(inputxel), PNM_GET1(inputxel), PNM_GET1(inputxel)); + switch (PNM_FORMAT_TYPE(format)) { + case PPM_TYPE: + PPM_ASSIGN(outputpixel, + PPM_GETR(inputxel), + PPM_GETG(inputxel), + PPM_GETB(inputxel)); + break; + case PGM_TYPE: + case PBM_TYPE: + PPM_ASSIGN(outputpixel, + PNM_GET1(inputxel), + PNM_GET1(inputxel), + PNM_GET1(inputxel)); + break; + default: + pm_error("Invalid format code %d passed to pnm_xeltopixel()", + format); + } + return outputpixel; } diff --git a/lib/pnm.h b/lib/pnm.h index d3b6f84f..ed6983f4 100644 --- a/lib/pnm.h +++ b/lib/pnm.h @@ -124,7 +124,8 @@ pnm_promoteformatrow(xel* xelrow, int cols, xelval maxval, int format, xelval newmaxval, int newformat); pixel -xeltopixel(xel const inputxel); +pnm_xeltopixel(xel const inputxel, + int const format); #ifdef __cplusplus } diff --git a/other/pamx/image.c b/other/pamx/image.c index 3aaa8478..892a9768 100644 --- a/other/pamx/image.c +++ b/other/pamx/image.c @@ -157,7 +157,7 @@ newRGBImage(unsigned int const width, unsigned int const height, unsigned int const depth) { - unsigned int const pixlen = pixlen > 0 ? (depth + 7) / 8 : 1; + unsigned int const pixlen = depth > 0 ? (depth + 7) / 8 : 1; /* Special case for "zero" depth image, which is sometimes interpreted as "one color" */ diff --git a/other/pamx/pamx.c b/other/pamx/pamx.c index 8a64fec4..17980643 100644 --- a/other/pamx/pamx.c +++ b/other/pamx/pamx.c @@ -184,7 +184,7 @@ fillRow1(struct pam * const pamP, for (col = 0; col < pamP->width; ++col) { unsigned int plane; - for (plane = 0; plane < pamP->depth; ++plane) + for (plane = 0; plane < 3; ++plane) *(*pP)++ = pnm_scalesample(tuplerow[col][0], pamP->maxval, 255); } -- cgit 1.4.1