[comp.sys.sun] Programs for manipulating Sun icons

bowen%prg.oxford.ac.uk@nss.cs.ucl.ac.uk (Jonathan Bowen) (12/13/88)

I notice there has been some talk of manipulating Sun icons in sun-spots
recently. Here are some programs which can be used to help with this.

"editicon" uses "showicon" to convert a Sun icon into a text file
containing "#" for black pixels and " " for white pixels. This is then
edited using a standard text editor (default "vi"). The text image can be
saved using ":w file" or shifted using "s/^/    /", etc., in "vi".  On
exit from the editor, if the file has been updated, "makeicon" is used to
overwrite the Sun icon file.  Saved text images can be overlayed together
using "over", X-Y axes can be swapped using "swap", etc. Existing Unix
tools such as "rev" and "colrm" can also be used to modify text images. As
supplied, "editicon", etc assumes 64x64 bit images, but any competent Unix
hacker could change this if desired.

"ras2icon" is a slightly cleaned up version of "pic2icon", as issued
previously on sun-spots (by Jim Meritt?), together with a newly written
manual page.  I changed the name since "pic" files mean something
different at our site.

"sun2xicon" and "x2sunicon" convert between SunView and X formats as best
they can.

I am happy for all these files to be included in the sun-spots archive
(assuming the original author of "pic2icon" does not object about
"ras2icon").

The files are also available by sending a message such as:

	send prog editicon.shar

to <archive-server@uk.ac.oxford.prg> on JANET or
<archive-server@ox-prg.uucp> (...!mcvax!uck!ox-prg!archive-server).
However, I would rather US sites obtained copies from the sun-spots
archive server to reduce transatlantic traffic.  A message of "help" to
the archive server will give more information on its use.

Here is a list of the relevant files:

Name			Contents

editicon.shar		Edit a SunView icon using a text editor
			(also includes makeicon and showicon)
fill.shar		Fill text lines to a given column position *
over.shar		Overlay text files *
pos.shar		Position lines on given column *
ras2icon.shar		Convert Sun raster to icon format
sun2xicon.shar		Convert SunView icon to X bitmap
swap.shar		Swap rows and columns in a text file *
x2sunicon.shar		Convert X bitmap to SunView icon

All programs are designed for UNIX systems and are shell scripts or C
programs (if marked with a *). Some shell scripts may depend on other
programs which are not available on all UNIX systems. In particular, these
programs have only been tested on BSD4.2 based systems (on Sun-3
hardware). There is no warranty that they will work on your system, but
bug reports and updates are welcome.

Each ``shar'' file contains at least the following:

	README		Brief description
	Makefile	To make and install files
	x or x.c	Shell script or C program source
	x.1		Manual page

where ``x'' is the name of the program.

Jonathan Bowen
Oxford University Computing Laboratory
Programming Research Group
England
JANET:	bowen@uk.ac.oxford.prg
ARPA:	bowen%prg.oxford.ac.uk@nss.cs.ucl.ac.uk
UUCP:	bowen@ox-prg.uucp (...!uunet!mcvax!ukc!ox-prg!bowen)

[[ The "shar of shars" is in the archives under "sun-source" as
"icontools.shar".  It is 86068 bytes in length (if this length poses a
problem for you, drop me a line and I will split it into two shar files).
It can be retrieved via anonymous FTP from the host "titan.rice.edu" or
via the archive server.  For more information about the archive server,
send a mail message containing the word "help" to the address
"archive-server@rice.edu".  --wnl ]]

jef@rtsg.ee.lbl.gov (Jef Poskanzer) (12/22/88)

While we're on the subject, some Sun-Spots readers might not be aware of
my "Portable Bitmap" package.  This package started the same way as
Jonathan Bowen's, as just a bunch of hacks for converting between bitmap
formats, but I and others have been adding to it for a couple of years
now.

The package was recently posted to the comp.sources.misc newsgroup, so it
should be available from various archive servers.  It is also available
via anonymous FTP from expo.lcs.mit.edu (18.72.0.126) as
contrib/pbm.tar.Z.

I have appended the README, but it's pretty long...
---
Jef

             Jef Poskanzer   jef@rtsg.ee.lbl.gov   ...well!pokey

= = = = = = = = = =

                       Portable Bitmap Toolkit
                       Version of 12dec88
                    Previous distribution 31oct88


Included are a number of programs for converting various bitmap formats
to and from a portable format; plus some tools for manipulating the
portable bitmaps.

Changes since the comp.sources.misc distribution of 31oct88:

    Added pbmreduce.
    Added imgtopbm, tifftopbm, pcxtopbm, and pbmtogo.
    Minor bugfix to pbmtolj.

Changes since the X.V11R3 distribution of 31aug88:

    The cbm format has been revised to support run-length encoding.
    Pbmtops now does run-length encoding.

Major changes since the X.V11R2 distribution of 28mar88:

    The pbm format now has a "magic number".
    New conversion filters: brushtopbm, giftopbm, pbmtolj, pbmtomacp,
      pbmtoxwd, and pbmtox10wd.
    Icontopbm converter has a better parser -- it knows to skip over
      any extraneous comments at the beginning of the icon file.
    Pbmtops generates a different PostScript wrapper program -- it should
      handle huge bitmaps better.
    Xwdtopbm now handles byte-swapping correctly.
    Pbmmake takes a flag to specify the color of the new bitmap.
    Pbmpaste now implements 'or', 'and', and 'xor' operations as well
      as the default 'replace'.


Files in this distribution:

    README		this
    FORMATS		descriptions of the various bitmap formats
    Makefile		guess

    brushtopbm.c	convert from Xerox doodle brushes to portable bitmap
    cbmtopbm.c		convert from compact bitmap to portable bitmap
    giftopbm.c		convert from GIF to portable bitmap
    icontopbm.c		convert from Sun icon to portable bitmap
    imgtopbm.c		convert from GEM .img format to portable bitmap
    macptopbm.c		convert from MacPaint to portable bitmap
    pcxtopbm.c		convert from PC paintbrush format to portable bitmap
    rasttopbm.c		convert from Sun raster to portable bitmap
    tifftopbm.c		convert from TIFF format to portable bitmap
    xbmtopbm.c		convert from X10 or X11 bitmap to portable bitmap
    xwdtopbm.c		convert from X10 or X11 window dump to portable bitmap
    xxxtopbm.c		convert from UNKNOWN BITMAP to portable bitmap

    pbmtoascii.c	convert from portable bitmap to ASCII graphic form
    pbmtocbm.c		convert from portable bitmap to compact bitmap
    pbmtogo.c		convert from portable bitmap to GraphOn graphics
    pbmtoicon.c		convert from portable bitmap to Sun icon
    pbmtolj.c		convert from portable bitmap to HP LaserJet
    pbmtomacp.c		convert from portable bitmap to MacPaint
    pbmtops.c		convert from portable bitmap to PostScript
    pbmtoptx.c		convert from portable bitmap to Printronix
    pbmtorast.c		convert from portable bitmap to Sun raster
    pbmtoxbm.c		convert from portable bitmap to X11 bitmap
    pbmtox10bm.c	convert from portable bitmap to X10 bitmap
    pbmtoxwd.c		convert from portable bitmap to X11 window dump
    pbmtox10wd.c	convert from portable bitmap to X10 window dump

    pbmcatlr.c		concatenate portable bitmaps left to right
    pbmcattb.c		concatenate portable bitmaps top to bottom
    pbmcrop.c		crop a portable bitmap
    pbmcut.c		cut a rectangle out of a portable bitmap
    pbmenlarge.c	enlarge a portable bitmap N times
    pbmfliplr.c		flip a portable bitmap left for right
    pbmfliptb.c		flip a portable bitmap top for bottom
    pbminvert.c		invert a portable bitmap
    pbmmake.c		create a blank bitmap of a specified size
    pbmpaste.c		paste a rectangle into a portable bitmap
    pbmreduce.c		reduce a portable bitmap N times, using Floyd-Steinberg
    pbmtrnspos.c	transpose a portable bitmap x for y

    libpbm[1-5].c	a few utility routines
    pbm.h		header file for libpbm
    libpbm.h		internal header file for libpbm
    macp.h		definitions for MacPaint files
    tiff.h		definitions for TIFF files
    x10wd.h		definitions for X10 window dumps
    x11wd.h		definitions for X11 window dumps
    bmaliases		csh script to make aliases for converting formats
    *.1			manual entries for all of the tools
    pbm.5		manual entry for the pbm format
    bitreverse.h	useful include file

    Jef Poskanzer
    jef@rtsg.ee.lbl.gov
    {ucbvax, lll-crg, sun!pacbell, apple, hplabs}!well!pokey

jef@helios.ee.lbl.gov (Jef Poskanzer) (01/04/89)

In the referenced message, I wrote:
>                                                   It is also available
>via anonymous FTP from expo.lcs.mit.edu (18.72.0.126) as
>contrib/pbm.tar.Z.

Oops, wrong IP address.  It should be 18.72.0.212.
---
Jef

	Jef Poskanzer   jef@rtsg.ee.lbl.gov   ...well!pokey