[comp.sources.misc] v09i035: PBMPLUS part 19 of 19: pnm.shar2 of 2

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (11/27/89)

Posting-number: Volume 9, Issue 35
Submitted-by: jef@helios.ee.lbl.gov (Jef Poskanzer)
Archive-name: pbmplus/part19

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	pnm/pnmflip.c
#	pnm/pnmflip.1
#	pnm/pnminvert.c
#	pnm/pnminvert.1
#	pnm/pnmpaste.c
#	pnm/pnmpaste.1
#	pnm/pnmtile.c
#	pnm/pnmtile.1
#	pnm/pnmenlarge.c
#	pnm/pnmenlarge.1
# This archive created: Wed Nov 22 21:14:16 1989
# By:	Jef Poskanzer (Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal)
export PATH; PATH=/bin:$PATH
if test ! -d 'pnm'
then
	echo shar: creating directory "'pnm'"
	mkdir 'pnm'
fi
echo shar: extracting "'pnm/pnmflip.c'" '(5664 characters)'
if test -f 'pnm/pnmflip.c'
then
	echo shar: will not over-write existing file "'pnm/pnmflip.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pnm/pnmflip.c'
X/* pnmflip.c - perform one or more flip operations on a portable anymap
X**
X** Copyright (C) 1989 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#include "pnm.h"
X#ifdef SYSV
X#include <string.h>
X#else /*SYSV*/
X#include <strings.h>
X#endif /*SYSV*/
X
X#define max(a,b) ((a) > (b) ? (a) : (b))
X
Xmain( argc, argv )
Xint argc;
Xchar *argv[];
X    {
X    FILE *ifd;
X    xel *xelrow, **newxels;
X    register xel *xP;
X    int argn, cols, rows, format, newrows, newcols;
X    int a, b, c, d, e, f;
X    register int row, col, newrow, newcol;
X    xelval maxval;
X    void leftright(), topbottom(), transpose();
X    char *usage = "[-leftright|-lr] [-topbottom|-tb] [-transpose|-xy]\n            [-rotate90|-r90|-ccw] [-rotate270|r270|-cw]\n            [-rotate180|-r180] [pnmfile]";
X
X    pm_progname = argv[0];
X
X    argn = 1;
X
X    /* Just check the validity of arguments here. */
X    while ( argn < argc && argv[argn][0] == '-' )
X	{
X	if ( strncmp(argv[argn],"-lr",max(strlen(argv[argn]),2)) == 0 ||
X	     strncmp(argv[argn],"-leftright",max(strlen(argv[argn]),2)) == 0 )
X	    { }
X	else if ( strncmp(argv[argn],"-tb",max(strlen(argv[argn]),3)) == 0 ||
X	     strncmp(argv[argn],"-topbottom",max(strlen(argv[argn]),3)) == 0 )
X	    { }
X	else if ( strncmp(argv[argn],"-xy",max(strlen(argv[argn]),2)) == 0 ||
X	     strncmp(argv[argn],"-transpose",max(strlen(argv[argn]),3)) == 0 )
X	    { }
X	else if ( strncmp(argv[argn],"-r90",max(strlen(argv[argn]),3)) == 0 ||
X	     strncmp(argv[argn],"-rotate90",max(strlen(argv[argn]),8)) == 0 ||
X	     strncmp(argv[argn],"-ccw",max(strlen(argv[argn]),3)) == 0 )
X	    { }
X	else if ( strncmp(argv[argn],"-r270",max(strlen(argv[argn]),3)) == 0 ||
X	     strncmp(argv[argn],"-rotate270",max(strlen(argv[argn]),8)) == 0 ||
X	     strncmp(argv[argn],"-cw",max(strlen(argv[argn]),3)) == 0 )
X	    { }
X	else if ( strncmp(argv[argn],"-r180",max(strlen(argv[argn]),3)) == 0 ||
X	     strncmp(argv[argn],"-rotate180",max(strlen(argv[argn]),8)) == 0 )
X	    { }
X	else
X	    pm_usage( usage );
X	argn++;
X	}
X
X    if ( argn != argc )
X	{
X	ifd = pm_openr( argv[argn] );
X	argn++;
X	}
X    else
X	ifd = stdin;
X
X    if ( argn != argc )
X	pm_usage( usage );
X
X    pnm_readpnminit( ifd, &cols, &rows, &maxval, &format );
X    xelrow = pnm_allocrow( cols );
X
X    /* Now go through the flags again, this time accumulating transforms. */
X    a = 1; b = 0;
X    c = 0; d = 1;
X    e = 0; f = 0;
X    argn = 1;
X    while ( argn < argc && argv[argn][0] == '-' )
X	{
X	if ( strncmp(argv[argn],"-lr",max(strlen(argv[argn]),2)) == 0 ||
X	     strncmp(argv[argn],"-leftright",max(strlen(argv[argn]),2)) == 0 )
X	    leftright( &a, &b, &c, &d, &e, &f );
X	else if ( strncmp(argv[argn],"-tb",max(strlen(argv[argn]),3)) == 0 ||
X	     strncmp(argv[argn],"-topbottom",max(strlen(argv[argn]),3)) == 0 )
X	    topbottom( &a, &b, &c, &d, &e, &f );
X	else if ( strncmp(argv[argn],"-xy",max(strlen(argv[argn]),2)) == 0 ||
X	     strncmp(argv[argn],"-transpose",max(strlen(argv[argn]),3)) == 0 )
X	    transpose( &a, &b, &c, &d, &e, &f );
X	else if ( strncmp(argv[argn],"-r90",max(strlen(argv[argn]),3)) == 0 ||
X	     strncmp(argv[argn],"-rotate90",max(strlen(argv[argn]),8)) == 0 ||
X	     strncmp(argv[argn],"-ccw",max(strlen(argv[argn]),3)) == 0 )
X	    {
X	    transpose( &a, &b, &c, &d, &e, &f );
X	    topbottom( &a, &b, &c, &d, &e, &f );
X	    }
X	else if ( strncmp(argv[argn],"-r270",max(strlen(argv[argn]),3)) == 0 ||
X	     strncmp(argv[argn],"-rotate270",max(strlen(argv[argn]),8)) == 0 ||
X	     strncmp(argv[argn],"-cw",max(strlen(argv[argn]),3)) == 0 )
X	    {
X	    transpose( &a, &b, &c, &d, &e, &f );
X	    leftright( &a, &b, &c, &d, &e, &f );
X	    }
X	else if ( strncmp(argv[argn],"-r180",max(strlen(argv[argn]),3)) == 0 ||
X	     strncmp(argv[argn],"-rotate180",max(strlen(argv[argn]),8)) == 0 )
X	    {
X	    leftright( &a, &b, &c, &d, &e, &f );
X	    topbottom( &a, &b, &c, &d, &e, &f );
X	    }
X	else
X	    pm_error( "shouldn't happen!", 0,0,0,0,0 );
X	argn++;
X	}
X
X    /* Okay, we've got a matrix.  Now read in the anymap a line at a time
X    ** and transform it into an in-memory array.
X    */
X
X    newcols = abs( a ) * cols + abs( c ) * rows;
X    newrows = abs( b ) * cols + abs( d ) * rows;
X    newxels = pnm_allocarray( newcols, newrows );
X
X    for ( row = 0; row < rows; ++row )
X	{
X	pnm_readpnmrow( ifd, xelrow, cols, maxval, format );
X	for ( col = 0, xP = xelrow; col < cols; ++col, ++xP )
X	    {
X	    /* Transform a point:
X	    **
X	    **            [ a b 0 ]
X	    **  [ x y 1 ] [ c d 0 ] = [ x2 y2 1 ]
X	    **            [ e f 1 ]
X	    */
X	    newcol = a * col + c * row + e * ( newcols - 1 );
X	    newrow = b * col + d * row + f * ( newrows - 1 );
X	    newxels[newrow][newcol] = *xP;
X	    }
X	}
X
X    pm_close( ifd );
X
X    pnm_writepnm( stdout, newxels, newcols, newrows, maxval, format );
X
X    exit( 0 );
X    }
X
Xvoid
Xleftright( aP, bP, cP, dP, eP, fP )
Xint *aP, *bP, *cP, *dP, *eP, *fP;
X    {
X    *aP = - *aP;
X    *cP = - *cP;
X    *eP = - *eP + 1;
X    }
X
Xvoid
Xtopbottom( aP, bP, cP, dP, eP, fP )
Xint *aP, *bP, *cP, *dP, *eP, *fP;
X    {
X    *bP = - *bP;
X    *dP = - *dP;
X    *fP = - *fP + 1;
X    }
X
Xvoid
Xtranspose( aP, bP, cP, dP, eP, fP )
Xint *aP, *bP, *cP, *dP, *eP, *fP;
X    {
X    register int t;
X
X    t = *aP;
X    *aP = *bP;
X    *bP = t;
X    t = *cP;
X    *cP = *dP;
X    *dP = t;
X    t = *eP;
X    *eP = *fP;
X    *fP = t;
X    }
SHAR_EOF
if test 5664 -ne "`wc -c < 'pnm/pnmflip.c'`"
then
	echo shar: error transmitting "'pnm/pnmflip.c'" '(should have been 5664 characters)'
fi
fi # end of overwriting check
if test ! -d 'pnm'
then
	echo shar: creating directory "'pnm'"
	mkdir 'pnm'
fi
echo shar: extracting "'pnm/pnmflip.1'" '(1300 characters)'
if test -f 'pnm/pnmflip.1'
then
	echo shar: will not over-write existing file "'pnm/pnmflip.1'"
else
sed 's/^X//' << \SHAR_EOF > 'pnm/pnmflip.1'
X.TH pnmflip 1 "25 July 1989"
X.SH NAME
Xpnmflip - perform one or more flip operations on a portable anymap
X.SH SYNOPSIS
Xpnmflip [-leftright|-lr] [-topbottom|-tb] [-transpose|-xy]
X    [-rotate90|-r90|-ccw] [-rotate270|-r270|-cw]
X    [-rotate180|-r180] [pnmfile]
X.SH DESCRIPTION
XReads a portable anymap as input.
XPerforms one or more flip operations, in the order specified, and
Xwrites out a portable anymap.
X.PP
XThe flip operations available are: left for right (-leftright or -lr);
Xtop for bottom (-topbottom or -tb); and transposition (-transpose or -xy).
XIn addition, some canned concatenations are available: -rotate90 or -ccw
Xis equivalent to -transpose -topbottom; -rotate270 or -cw is equivalent
Xto -transpose -leftright; and -rotate180 is equivalent to -leftright -topbottom.
X.PP
XAll flags can be abbreviated to their shortest unique prefix.
X.SH "SEE ALSO"
Xpnm(5), ppmrotate(1)
X.SH AUTHOR
XCopyright (C) 1989 by Jef Poskanzer.
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted, provided
Xthat the above copyright notice appear in all copies and that both that
Xcopyright notice and this permission notice appear in supporting
Xdocumentation.  This software is provided "as is" without express or
Ximplied warranty.
SHAR_EOF
if test 1300 -ne "`wc -c < 'pnm/pnmflip.1'`"
then
	echo shar: error transmitting "'pnm/pnmflip.1'" '(should have been 1300 characters)'
fi
fi # end of overwriting check
if test ! -d 'pnm'
then
	echo shar: creating directory "'pnm'"
	mkdir 'pnm'
fi
echo shar: extracting "'pnm/pnminvert.c'" '(1297 characters)'
if test -f 'pnm/pnminvert.c'
then
	echo shar: will not over-write existing file "'pnm/pnminvert.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pnm/pnminvert.c'
X/* pnminvert.c - read a portable anymap and invert it
X**
X** Copyright (C) 1989 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#include "pnm.h"
X
Xmain( argc, argv )
Xint argc;
Xchar *argv[];
X    {
X    FILE *ifd;
X    xelval maxval;
X    register xel *xelrow, *xP;
X    int rows, cols, format, row, col;
X
X    pm_progname = argv[0];
X
X    if ( argc > 2 )
X	pm_usage( "[pnmfile]" );
X
X    if ( argc == 2 )
X	ifd = pm_openr( argv[1] );
X    else
X	ifd = stdin;
X
X    pnm_readpnminit( ifd, &cols, &rows, &maxval, &format );
X    pnm_writepnminit( stdout, cols, rows, maxval, format );
X    xelrow = pnm_allocrow( cols );
X
X    for ( row = 0; row < rows; row++ )
X	{
X	pnm_readpnmrow( ifd, xelrow, cols, maxval, format );
X        for ( col = 0, xP = xelrow; col < cols; col++, xP++ )
X	    *xP = pnm_invertxel( *xP, maxval, format );
X
X	pnm_writepnmrow( stdout, xelrow, cols, maxval, format );
X	}
X
X    pm_close( ifd );
X
X    exit( 0 );
X    }
SHAR_EOF
if test 1297 -ne "`wc -c < 'pnm/pnminvert.c'`"
then
	echo shar: error transmitting "'pnm/pnminvert.c'" '(should have been 1297 characters)'
fi
fi # end of overwriting check
if test ! -d 'pnm'
then
	echo shar: creating directory "'pnm'"
	mkdir 'pnm'
fi
echo shar: extracting "'pnm/pnminvert.1'" '(670 characters)'
if test -f 'pnm/pnminvert.1'
then
	echo shar: will not over-write existing file "'pnm/pnminvert.1'"
else
sed 's/^X//' << \SHAR_EOF > 'pnm/pnminvert.1'
X.TH pnminvert 1 "08 August 1989"
X.SH NAME
Xpnminvert - invert a portable anymap
X.SH SYNOPSIS
Xpnminvert [pnmfile]
X.SH DESCRIPTION
XReads a portable anymap as input.
XInverts it black for white and produces a portable anymap as output.
X.SH "SEE ALSO"
Xpnm(5)
X.SH AUTHOR
XCopyright (C) 1989 by Jef Poskanzer.
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted, provided
Xthat the above copyright notice appear in all copies and that both that
Xcopyright notice and this permission notice appear in supporting
Xdocumentation.  This software is provided "as is" without express or
Ximplied warranty.
SHAR_EOF
if test 670 -ne "`wc -c < 'pnm/pnminvert.1'`"
then
	echo shar: error transmitting "'pnm/pnminvert.1'" '(should have been 670 characters)'
fi
fi # end of overwriting check
if test ! -d 'pnm'
then
	echo shar: creating directory "'pnm'"
	mkdir 'pnm'
fi
echo shar: extracting "'pnm/pnmpaste.c'" '(2914 characters)'
if test -f 'pnm/pnmpaste.c'
then
	echo shar: will not over-write existing file "'pnm/pnmpaste.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pnm/pnmpaste.c'
X/* pnmpaste.c - paste a rectangle into a portable anymap
X**
X** Copyright (C) 1989 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#include "pnm.h"
X
Xmain( argc, argv )
Xint argc;
Xchar *argv[];
X    {
X    FILE *ifd1, *ifd2;
X    register xel **xels1, **xels2, *x1P, *x2P;
X    xelval maxval1, maxval2, newmaxval;
X    int argn, rows1, cols1, format1, x, y;
X    int rows2, cols2, format2, newformat, row;
X    register int col;
X    char *usage = "frompnmfile x y [intopnmfile]";
X
X    pm_progname = argv[0];
X
X    argn = 1;
X
X    if ( argn == argc )
X	pm_usage( usage );
X    ifd1 = pm_openr( argv[argn] );
X    argn++;
X
X    if ( argn == argc )
X	pm_usage( usage );
X    if ( sscanf( argv[argn], "%d", &x ) != 1 )
X	pm_usage( usage );
X    argn++;
X    if ( argn == argc )
X	pm_usage( usage );
X    if ( sscanf( argv[argn], "%d", &y ) != 1 )
X	pm_usage( usage );
X    argn++;
X
X    if ( argn != argc )
X	{
X	ifd2 = pm_openr( argv[argn] );
X	argn++;
X	}
X    else
X	ifd2 = stdin;
X
X    if ( argn != argc )
X	pm_usage( usage );
X
X    xels1 = pnm_readpnm( ifd1, &cols1, &rows1, &maxval1, &format1 );
X    pm_close( ifd1 );
X
X    xels2 = pnm_readpnm( ifd2, &cols2, &rows2, &maxval2, &format2 );
X    pm_close( ifd2 );
X
X    if ( format1 > format2 )
X	{
X	newformat = format1;
X	newmaxval = maxval1;
X	}
X    else
X	{
X	newformat = format2;
X	newmaxval = maxval2;
X	}
X    pnm_promoteformat( xels1, cols2, rows1, maxval1, format1, newmaxval, newformat );
X    pnm_promoteformat( xels2, cols2, rows2, maxval2, format2, newmaxval, newformat );
X
X    if ( x <= -cols2 )
X	pm_error(
X	    "x is too negative -- the second anymap has only %d cols",
X	    cols2, 0,0,0,0 );
X    if ( y <= -rows2 )
X	pm_error(
X	    "y is too negative -- the second anymap has only %d rows",
X	    rows2, 0,0,0,0 );
X    
X    if ( x < 0 )
X	x = cols2 - x;
X    if ( y < 0 )
X	y = rows2 - y;
X
X    if ( x >= cols2 )
X	pm_error(
X	    "x is too large -- the second anymap has only %d cols",
X	    cols2, 0,0,0,0 );
X    if ( y >= rows2 )
X	pm_error(
X	    "y is too large -- the second anymap has only %d rows",
X	    rows2, 0,0,0,0 );
X    if ( x + cols1 > cols2 )
X	pm_error(
X	    "x + width is too large by %d pixels", x + cols1 - cols2, 0,0,0,0 );
X    if ( y + rows1 > rows2 )
X	pm_error(
X	    "y + height is too large by %d pixels", y + rows1 - rows2,
X	    0,0,0,0 );
X
X    for ( row = 0; row < rows1; row++ )
X	{
X        for ( col = 0, x1P = xels1[row], x2P = &(xels2[row+y][x]); col < cols1; col++, x1P++, x2P++ )
X	    *x2P = *x1P;
X	}
X
X    pnm_writepnm( stdout, xels2, cols2, rows2, newmaxval, newformat );
X
X    exit( 0 );
X    }
SHAR_EOF
if test 2914 -ne "`wc -c < 'pnm/pnmpaste.c'`"
then
	echo shar: error transmitting "'pnm/pnmpaste.c'" '(should have been 2914 characters)'
fi
fi # end of overwriting check
if test ! -d 'pnm'
then
	echo shar: creating directory "'pnm'"
	mkdir 'pnm'
fi
echo shar: extracting "'pnm/pnmpaste.1'" '(1407 characters)'
if test -f 'pnm/pnmpaste.1'
then
	echo shar: will not over-write existing file "'pnm/pnmpaste.1'"
else
sed 's/^X//' << \SHAR_EOF > 'pnm/pnmpaste.1'
X.TH pnmpaste 1 "07 April 1989"
X.SH NAME
Xpnmpaste - paste a rectangle into a portable anymap
X.SH SYNOPSIS
Xpnmpaste frompnmfile x y [intopnmfile]
X.SH DESCRIPTION
XReads two portable anymaps as input.
XInserts the first anymap into the second at the specified location,
Xand produces a portable anymap the same size as the second as output.
XIf the second anymap is not specified, it is read from stdin.
XThe x and y can be negative, in which case they are interpreted
Xrelative to the right and bottom of the anymap, respectively.
X.PP
XThis tool is most useful in combination with pnmcut(1).
XFor instance, if you want to edit a small segment of a large
Xanymap, and your anymap editor is TOO STUPID to edit the
Xlarge anymap, you can cut out the segment you are interested in,
Xedit it, and then paste it back in.
X.PP
XThe pbmpaste(1) tool is like this one, except that since it only has to work
Xwith bitmaps, it implements bitblt-style logical operations.
X.SH "SEE ALSO"
Xpbmpaste(1), pnmcut(1), pnm(5)
X.SH AUTHOR
XCopyright (C) 1989 by Jef Poskanzer.
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted, provided
Xthat the above copyright notice appear in all copies and that both that
Xcopyright notice and this permission notice appear in supporting
Xdocumentation.  This software is provided "as is" without express or
Ximplied warranty.
SHAR_EOF
if test 1407 -ne "`wc -c < 'pnm/pnmpaste.1'`"
then
	echo shar: error transmitting "'pnm/pnmpaste.1'" '(should have been 1407 characters)'
fi
fi # end of overwriting check
if test ! -d 'pnm'
then
	echo shar: creating directory "'pnm'"
	mkdir 'pnm'
fi
echo shar: extracting "'pnm/pnmtile.c'" '(1585 characters)'
if test -f 'pnm/pnmtile.c'
then
	echo shar: will not over-write existing file "'pnm/pnmtile.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pnm/pnmtile.c'
X/* pnmtile.c - replicate a portable anymap into a specified size
X**
X** Copyright (C) 1989 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#include "pnm.h"
X
Xmain( argc, argv )
Xint argc;
Xchar *argv[];
X    {
X    FILE *ifd;
X    register xel **xels, *xelrow;
X    xelval maxval;
X    int rows, cols, format, width, height, row, col;
X    char *usage = "width height [pnmfile]";
X
X    pm_progname = argv[0];
X
X    if ( argc < 3 || argc > 4 )
X	pm_usage( usage );
X
X    if ( sscanf( argv[1], "%d", &width ) != 1 )
X	pm_usage( usage );
X    if ( sscanf( argv[2], "%d", &height ) != 1 )
X	pm_usage( usage );
X
X    if ( width < 1 )
X	pm_error( "width is less than 1", 0,0,0,0,0 );
X    if ( height < 1 )
X	pm_error( "height is less than 1", 0,0,0,0,0 );
X
X    if ( argc == 4 )
X	ifd = pm_openr( argv[3] );
X    else
X	ifd = stdin;
X
X    xels = pnm_readpnm( ifd, &cols, &rows, &maxval, &format );
X    pm_close( ifd );
X
X    xelrow = pnm_allocrow( width );
X
X    pnm_writepnminit( stdout, width, height, maxval, format );
X    for ( row = 0; row < height; row++ )
X	{
X	for ( col = 0; col < width; col++ )
X	    xelrow[col] = xels[row % rows][col % cols];
X	pnm_writepnmrow( stdout, xelrow, width, maxval, format );
X	}
X
X    exit( 0 );
X    }
SHAR_EOF
if test 1585 -ne "`wc -c < 'pnm/pnmtile.c'`"
then
	echo shar: error transmitting "'pnm/pnmtile.c'" '(should have been 1585 characters)'
fi
fi # end of overwriting check
if test ! -d 'pnm'
then
	echo shar: creating directory "'pnm'"
	mkdir 'pnm'
fi
echo shar: extracting "'pnm/pnmtile.1'" '(718 characters)'
if test -f 'pnm/pnmtile.1'
then
	echo shar: will not over-write existing file "'pnm/pnmtile.1'"
else
sed 's/^X//' << \SHAR_EOF > 'pnm/pnmtile.1'
X.TH pnmtile 1 "13 May 1989"
X.SH NAME
Xpnmtile - replicate a portable anymap into a specified size
X.SH SYNOPSIS
Xpnmtile width height [pnmfile]
X.SH DESCRIPTION
XReads a portable anymap as input.
XReplicates it until it is the specified size,
Xand produces a portable anymap as output.
X.SH "SEE ALSO"
Xpnm(5)
X.SH AUTHOR
XCopyright (C) 1989 by Jef Poskanzer.
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted, provided
Xthat the above copyright notice appear in all copies and that both that
Xcopyright notice and this permission notice appear in supporting
Xdocumentation.  This software is provided "as is" without express or
Ximplied warranty.
SHAR_EOF
if test 718 -ne "`wc -c < 'pnm/pnmtile.1'`"
then
	echo shar: error transmitting "'pnm/pnmtile.1'" '(should have been 718 characters)'
fi
fi # end of overwriting check
if test ! -d 'pnm'
then
	echo shar: creating directory "'pnm'"
	mkdir 'pnm'
fi
echo shar: extracting "'pnm/pnmenlarge.c'" '(1760 characters)'
if test -f 'pnm/pnmenlarge.c'
then
	echo shar: will not over-write existing file "'pnm/pnmenlarge.c'"
else
sed 's/^X//' << \SHAR_EOF > 'pnm/pnmenlarge.c'
X/* pnmenlarge.c - read a portable anymap and enlarge it N times
X**
X** Copyright (C) 1989 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#include <stdio.h>
X#include "pnm.h"
X
Xmain( argc, argv )
Xint argc;
Xchar *argv[];
X    {
X    FILE *ifd;
X    register xel *xelrow, *newxelrow, *xP;
X    int argn, n, rows, cols, format, row, col, subrow, subcol;
X    xelval maxval;
X    char *usage = "N [pnmfile]";
X
X    pm_progname = argv[0];
X
X    argn = 1;
X
X    if ( argn == argc )
X	pm_usage( usage );
X    if ( sscanf( argv[argn], "%d", &n ) != 1 )
X	pm_usage( usage );
X    if ( n < 2 )
X	pm_error( "N must be greater than 1", 0,0,0,0,0 );
X    argn++;
X
X    if ( argn != argc )
X	{
X	ifd = pm_openr( argv[argn] );
X	argn++;
X	}
X    else
X	ifd = stdin;
X
X    if ( argn != argc )
X	pm_usage( usage );
X
X    pnm_readpnminit( ifd, &cols, &rows, &maxval, &format );
X    xelrow = pnm_allocrow( cols );
X    pnm_writepnminit( stdout, cols * n, rows * n, maxval, format );
X    newxelrow = pnm_allocrow( cols * n );
X
X    for ( row = 0; row < rows; row++ )
X	{
X	pnm_readpnmrow( ifd, xelrow, cols, maxval, format );
X	for ( subrow = 0; subrow < n; subrow++ )
X	    {
X	    for ( col = 0, xP = xelrow; col < cols; col++, xP++ )
X		{
X		for ( subcol = 0; subcol < n; subcol++ )
X		    newxelrow[col * n + subcol] = *xP;
X		}
X	    pnm_writepnmrow( stdout, newxelrow, cols * n, maxval, format );
X	    }
X	}
X
X    pm_close( ifd );
X
X    exit( 0 );
X    }
SHAR_EOF
if test 1760 -ne "`wc -c < 'pnm/pnmenlarge.c'`"
then
	echo shar: error transmitting "'pnm/pnmenlarge.c'" '(should have been 1760 characters)'
fi
fi # end of overwriting check
if test ! -d 'pnm'
then
	echo shar: creating directory "'pnm'"
	mkdir 'pnm'
fi
echo shar: extracting "'pnm/pnmenlarge.1'" '(929 characters)'
if test -f 'pnm/pnmenlarge.1'
then
	echo shar: will not over-write existing file "'pnm/pnmenlarge.1'"
else
sed 's/^X//' << \SHAR_EOF > 'pnm/pnmenlarge.1'
X.TH pnmenlarge 1 "26 February 1989"
X.SH NAME
Xpnmenlarge - read a portable anymap and enlarge it N times
X.SH SYNOPSIS
Xpnmenlarge N [pnmfile]
X.SH DESCRIPTION
XReads a portable anymap as input.
XReplicates its pixels N times, and produces a portable anymap as output.
X.PP
Xpnmenlarge can only enlarge by integer factors.
XThe slower but more general ppmscale can enlarge or reduce by arbitrary
Xfactors, and pbmreduce can reduce by integer factors, but only for
Xbitmaps.
X.SH "SEE ALSO"
Xpbmreduce(1), ppmscale(1), pnm(5)
X.SH AUTHOR
XCopyright (C) 1989 by Jef Poskanzer.
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted, provided
Xthat the above copyright notice appear in all copies and that both that
Xcopyright notice and this permission notice appear in supporting
Xdocumentation.  This software is provided "as is" without express or
Ximplied warranty.
SHAR_EOF
if test 929 -ne "`wc -c < 'pnm/pnmenlarge.1'`"
then
	echo shar: error transmitting "'pnm/pnmenlarge.1'" '(should have been 929 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0