summaryrefslogtreecommitdiff
path: root/graphics/netpbm
diff options
context:
space:
mode:
authorSteve Price <steve@FreeBSD.org>1999-11-01 01:14:38 +0000
committerSteve Price <steve@FreeBSD.org>1999-11-01 01:14:38 +0000
commit5a49259902e0aa5b34ede0abd6a6e75bf7cba1d9 (patch)
tree4833aa4cd5b072e2fb486f4d84fa894fead6877b /graphics/netpbm
parentUpdate to version 1.1. (diff)
Update to version 8.0.
PR: 14403 Submitted by: KATO Tsuguru <tkato@prontomail.ne.jp>
Notes
Notes: svn path=/head/; revision=22769
Diffstat (limited to 'graphics/netpbm')
-rw-r--r--graphics/netpbm/Makefile18
-rw-r--r--graphics/netpbm/distinfo2
-rw-r--r--graphics/netpbm/files/patch-ap15
-rw-r--r--graphics/netpbm/files/patch-au312
4 files changed, 339 insertions, 8 deletions
diff --git a/graphics/netpbm/Makefile b/graphics/netpbm/Makefile
index 3fe7b8db2f61..d56f26852f46 100644
--- a/graphics/netpbm/Makefile
+++ b/graphics/netpbm/Makefile
@@ -1,23 +1,24 @@
# New ports collection makefile for: netpbm
-# Version required: 1mar1994
+# Version required: 8.0
# Date created: ?
# Whom: jmz (original)
#
# $FreeBSD$
#
-DISTNAME= netpbm
-PKGNAME= netpbm-94.3.1
+DISTNAME= netpbm-8.0
CATEGORIES= graphics
-MASTER_SITES= ftp://ftp.x.org/R5contrib/
-DISTFILES= netpbm-1mar1994.tar.gz
+MASTER_SITES= ${MASTER_SITE_SUNSITE}
+MASTER_SITE_SUBDIR= apps/graphics/convert
MAINTAINER= ports@FreeBSD.org
-LIB_DEPENDS+= tiff.4:${PORTSDIR}/graphics/tiff
-LIB_DEPENDS+= jpeg.9:${PORTSDIR}/graphics/jpeg
+LIB_DEPENDS= tiff.4:${PORTSDIR}/graphics/tiff \
+ jpeg.9:${PORTSDIR}/graphics/jpeg
+WRKSRC= ${WRKDIR}/netpbm
USE_IMAKE= yes
+
MAN1= anytopnm.1 asciitopgm.1 atktopbm.1 bioradtopgm.1 bmptoppm.1 \
brushtopbm.1 cmuwmtopbm.1 fitstopnm.1 fstopgm.1 g3topbm.1 gemtopbm.1 \
giftopnm.1 gouldtoppm.1 hipstopgm.1 hpcdtoppm.1 icontopbm.1 \
@@ -51,4 +52,7 @@ MAN1= anytopnm.1 asciitopgm.1 atktopbm.1 bioradtopgm.1 bmptoppm.1 \
MAN3= libpbm.3 libpgm.3 libpnm.3 libppm.3
MAN5= pbm.5 pgm.5 pnm.5 ppm.5
+post-patch:
+ @${PERL} -pi -e 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/Pbmplus.tmpl
+
.include <bsd.port.mk>
diff --git a/graphics/netpbm/distinfo b/graphics/netpbm/distinfo
index 23f74891d91f..f2eea10a5718 100644
--- a/graphics/netpbm/distinfo
+++ b/graphics/netpbm/distinfo
@@ -1 +1 @@
-MD5 (netpbm-1mar1994.tar.gz) = 55f505b09e69a5db8f08844435282dfb
+MD5 (netpbm-8.0.tar.gz) = 1aa88eb0d1f86b5793fde0317c95ed68
diff --git a/graphics/netpbm/files/patch-ap b/graphics/netpbm/files/patch-ap
new file mode 100644
index 000000000000..cac0ce0bf026
--- /dev/null
+++ b/graphics/netpbm/files/patch-ap
@@ -0,0 +1,15 @@
+--- pnm/pnmarith.c.orig Sun Aug 13 13:08:04 1995
++++ pnm/pnmarith.c Sat Oct 16 02:39:24 1999
+@@ -147,9 +147,9 @@
+ break;
+
+ case '*':
+- r1 = r1 * r2 / maxval3;
+- g1 = g1 * g2 / maxval3;
+- b1 = b1 * b2 / maxval3;
++ r1 = (unsigned) r1 * r2 / maxval3;
++ g1 = (unsigned) g1 * g2 / maxval3;
++ b1 = (unsigned) b1 * b2 / maxval3;
+ break;
+
+ case 'D':
diff --git a/graphics/netpbm/files/patch-au b/graphics/netpbm/files/patch-au
new file mode 100644
index 000000000000..2b4a3c967dfb
--- /dev/null
+++ b/graphics/netpbm/files/patch-au
@@ -0,0 +1,312 @@
+--- ppm/ppmtobmp.c.orig Mon Oct 4 18:12:36 1993
++++ ppm/ppmtobmp.c Sat Oct 16 02:53:18 1999
+@@ -75,7 +75,7 @@
+ unsigned short cBitCount, pixel **pixels, colorhash_table cht));
+ static int colorstobpp ARGS((int colors));
+ static void BMPEncode ARGS((FILE *fp, int class, int x, int y, pixel **pixels,
+- int colors, colorhash_table cht, pixval *R, pixval *G, pixval *B));
++ int bpp, int colors, colorhash_table cht, pixval *R, pixval *G, pixval *B));
+ static void
+ PutByte(fp, v)
+ FILE *fp;
+@@ -253,19 +253,23 @@
+ int i;
+ long ncolors;
+
+- for (i = 0; i < colors; i++)
+- {
+- nbyte += BMPwritergb(fp,class,R[i],G[i],B[i]);
+- }
+-
+- ncolors = (1 << bpp);
++ if (bpp != 24)
++ {
+
+- for (; i < ncolors; i++)
+- {
+- nbyte += BMPwritergb(fp,class,0,0,0);
+- }
++ for (i = 0; i < colors; i++)
++ {
++ nbyte += BMPwritergb(fp,class,R[i],G[i],B[i]);
++ }
++
++ ncolors = (1 << bpp);
++
++ for (; i < ncolors; i++)
++ {
++ nbyte += BMPwritergb(fp,class,0,0,0);
++ }
++ }
+
+- return nbyte;
++ return nbyte;
+ }
+
+ /*
+@@ -284,26 +288,38 @@
+ int rc;
+ unsigned x;
+
+- if ((b = pm_bitinit(fp, "w")) == (BITSTREAM) 0)
+- {
+- return -1;
+- }
+-
+- for (x = 0; x < cx; x++, row++)
+- {
+- if ((rc = pm_bitwrite(b, bpp, ppm_lookupcolor(cht, row))) == -1)
+- {
+- return -1;
+- }
+- nbyte += rc;
+- }
+-
+- if ((rc = pm_bitfini(b)) == -1)
+- {
+- return -1;
+- }
+- nbyte += rc;
+-
++ if (bpp != 24)
++ {
++ if ((b = pm_bitinit(fp, "w")) == (BITSTREAM) 0)
++ {
++ return -1;
++ }
++
++ for (x = 0; x < cx; x++, row++)
++ {
++ if ((rc = pm_bitwrite(b, bpp, ppm_lookupcolor(cht, row))) == -1)
++ {
++ return -1;
++ }
++ nbyte += rc;
++ }
++
++ if ((rc = pm_bitfini(b)) == -1)
++ {
++ return -1;
++ }
++ nbyte += rc;
++ }
++ else
++ {
++ for (x = 0; x < cx; x++, row++)
++ {
++ PutByte(fp, PPM_GETB(*row));
++ PutByte(fp, PPM_GETG(*row));
++ PutByte(fp, PPM_GETR(*row));
++ nbyte += 3;
++ }
++ }
+ /*
+ * Make sure we write a multiple of 4 bytes.
+ */
+@@ -394,48 +410,21 @@
+ * arrays are undefined.
+ */
+ static void
+-BMPEncode(fp, class, x, y, pixels, colors, cht, R, G, B)
++BMPEncode(fp, class, x, y, pixels, bpp, colors, cht, R, G, B)
+ FILE *fp;
+ int class;
+ int x;
+ int y;
+ pixel **pixels;
++ int bpp; /* bits per pixel */
+ int colors; /* number of valid entries in R,G,B */
+ colorhash_table cht;
+ pixval *R;
+ pixval *G;
+ pixval *B;
+ {
+- int bpp; /* bits per pixel */
+ unsigned long nbyte = 0;
+
+- bpp = colorstobpp(colors);
+-
+- /*
+- * I have found empirically at least one BMP-displaying program
+- * that can't deal with (for instance) using 3 bits per pixel.
+- * I have seen no programs that can deal with using 3 bits per
+- * pixel. I have seen programs which can deal with 1, 4, and
+- * 8 bits per pixel.
+- *
+- * Based on this, I adjust actual the number of bits per pixel
+- * as follows. If anyone knows better, PLEASE tell me!
+- */
+- switch(bpp)
+- {
+- case 2:
+- case 3:
+- bpp = 4;
+- break;
+- case 5:
+- case 6:
+- case 7:
+- bpp = 8;
+- break;
+- }
+-
+- pm_message("Using %d bits per pixel", bpp);
+-
+ nbyte += BMPwritefileheader(fp, class, bpp, x, y);
+ nbyte += BMPwriteinfoheader(fp, class, bpp, x, y);
+ nbyte += BMPwritergbtable(fp, class, bpp, colors, R, G, B);
+@@ -517,13 +506,15 @@
+ char **argv;
+ {
+ FILE *ifp = stdin;
+- char *usage = "[-windows] [-os2] [ppmfile]";
++ char *usage = "[-windows] [-os2] [-1/4/8/24bits] [ppmfile]";
+ int class = C_OS2;
+
+ int argn;
+ int rows;
+ int cols;
+ int colors;
++ int maxcolors = MAXCOLORS;
++ int bpp = 0;
+ int i;
+ pixval maxval;
+ colorhist_vector chv;
+@@ -545,6 +536,14 @@
+ class = C_WIN;
+ else if (pm_keymatch(argv[argn], "-os2", 2))
+ class = C_OS2;
++ else if (pm_keymatch(argv[argn], "-24bits", 3))
++ bpp = 24, maxcolors = 256;
++ else if (pm_keymatch(argv[argn], "-8bits", 2))
++ bpp = 8, maxcolors = 256;
++ else if (pm_keymatch(argv[argn], "-4bits", 2))
++ bpp = 4, maxcolors = 16;
++ else if (pm_keymatch(argv[argn], "-1bit", 2))
++ bpp = 1, maxcolors = 2;
+ else
+ pm_usage(usage);
+ ++argn;
+@@ -585,44 +584,90 @@
+ #endif
+
+ /* Figure out the colormap. */
+- pm_message("computing colormap...");
+- chv = ppm_computecolorhist(pixels, cols, rows, MAXCOLORS, &colors);
++ chv = (colorhist_vector) 0;
++ if(bpp != 24)
++ {
++ pm_message("computing colormap...");
++ chv = ppm_computecolorhist(pixels, cols, rows, maxcolors, &colors);
++ }
+ if (chv == (colorhist_vector) 0)
+- pm_error("too many colors - try doing a 'ppmquant %d'"
+- , MAXCOLORS);
+- pm_message("%d colors found", colors);
+-
+- /*
+- * Now turn the ppm colormap into the appropriate GIF
+- * colormap.
+- */
+- if (maxval > 255)
+- {
+- pm_message("maxval is not 255 - automatically rescaling colors");
+- }
+- for (i = 0; i < colors; ++i)
+- {
+- if (maxval == 255)
+- {
+- Red[i] = PPM_GETR(chv[i].color);
+- Green[i] = PPM_GETG(chv[i].color);
+- Blue[i] = PPM_GETB(chv[i].color);
+- }
+- else
+- {
+- Red[i] = (pixval) PPM_GETR(chv[i].color) * 255 / maxval;
+- Green[i] = (pixval) PPM_GETG(chv[i].color) * 255 / maxval;
+- Blue[i] = (pixval) PPM_GETB(chv[i].color) * 255 / maxval;
+- }
+- }
++ {
++ if (bpp == 0)
++ {
++ pm_message("over 256 colors found");
++ bpp = 24;
++ }
++ else if (bpp != 24)
++ pm_error("too many colors - try doing a 'ppmquant %d'"
++ , maxcolors);
++ }
++ else
++ {
++ pm_message("%d colors found", colors);
++
++ /*
++ * I have found empirically at least one BMP-displaying program
++ * that can't deal with (for instance) using 3 bits per pixel.
++ * I have seen no programs that can deal with using 3 bits per
++ * pixel. I have seen programs which can deal with 1, 4, and
++ * 8 bits per pixel.
++ *
++ * Based on this, I adjust actual the number of bits per pixel
++ * as follows. If anyone knows better, PLEASE tell me!
++ */
++
++ if (!bpp)
++ {
++ bpp = colorstobpp(colors);
++
++ switch(bpp)
++ {
++ case 2:
++ case 3:
++ bpp = 4;
++ break;
++ case 5:
++ case 6:
++ case 7:
++ bpp = 8;
++ break;
++ }
++ }
++
++ /*
++ * Now turn the ppm colormap into the appropriate GIF
++ * colormap.
++ */
++ if (maxval > 255)
++ {
++ pm_message("maxval is not 255 - automatically rescaling colors");
++ }
++ for (i = 0; i < colors; ++i)
++ {
++ if (maxval == 255)
++ {
++ Red[i] = PPM_GETR(chv[i].color);
++ Green[i] = PPM_GETG(chv[i].color);
++ Blue[i] = PPM_GETB(chv[i].color);
++ }
++ else
++ {
++ Red[i] = (pixval) PPM_GETR(chv[i].color) * 255 / maxval;
++ Green[i] = (pixval) PPM_GETG(chv[i].color) * 255 / maxval;
++ Blue[i] = (pixval) PPM_GETB(chv[i].color) * 255 / maxval;
++ }
++ }
++
++ /* And make a hash table for fast lookup. */
++ cht = ppm_colorhisttocolorhash(chv, colors);
++ ppm_freecolorhist(chv);
++ }
+
+- /* And make a hash table for fast lookup. */
+- cht = ppm_colorhisttocolorhash(chv, colors);
+- ppm_freecolorhist(chv);
++ pm_message("Using %d bits per pixel", bpp);
+
+ /* All set, let's do it. */
+ BMPEncode(stdout, class
+- , cols, rows, pixels, colors, cht
++ , cols, rows, pixels, bpp, colors, cht
+ ,Red, Green, Blue);
+
+ pm_close(stdout);