[comp.sys.mac.programmer] Any bitmap editors available?

rcook@eagle.wesleyan.edu (12/12/89)

   I have written several programs that do graphics by means of bitmaps and
CopyBits.  While drawing the images is easy and fast, creating the bitmaps in
the first place is a pain.  What I usually end up doing is (if the bitmaps are
small) creating "ICON" resources with ResEdit, loading them into memory, and
then setting the baseAddr field of the bitmap record to point to the ICON
resource.  This works fine for 32 X 32 bitmaps, but I would like something more
general.

   Does anyone on the net know of a general purpose bitmap editor?  I
recall seeing a "bmap" resource in some file somewhere; is bmap a standard
resource type for bitmaps of any size?  What I would like is some kind of
editor that gives me complete control over the size of the bitmap and can
adjust the rowbytes and bounds fields accordingly.

   I know that MacPaint and SuperPaint are very powerful bitmap editors.  Is
there some way to coerce their files into a resource I could use to store
bitmaps efficiently in my programs?  If worse comes to worst, I can always
write my own bitmap editor, but I hate writing utilities.

Thanks,
Randall Cook

rcook@eagle.wesleyan.edu
rcook%eagle@wesleyan.bitnet

jackiw@cs.swarthmore.edu (Nick Jackiw) (12/15/89)

rcook@eagle.wesleyan.edu writes:
>    I know that MacPaint and SuperPaint are very powerful bitmap editors.  Is
> there some way to coerce their files into a resource I could use to store
> bitmaps efficiently in my programs?  If worse comes to worst, I can always
> write my own bitmap editor, but I hate writing utilities.
> 
> Thanks,
> Randall Cook

If you cut or copy a bitmap from either of these programs onto the Clipboard,
enter ResEdit, and Paste, you'll get a PICT resource.  Create your off-
screen bitmap to the appropriate size, SetPort(..) to it, pre-erase it,
and then DrawPicture(....).

There is minimal overhead; a single bitmap PICT is probably only 20-30
bytes longer than the bit-image of the pict.

Alternately, for my private use I've written a program called BitMap
Capture, which takes an PICT from the clipboard (whether originally
Bitmap or not), constructs a bitmap from it, and replaces the PICT
with a 'cBM1' resource ("captured-BitMap#1"--my creation) which is
the uncompressed bit image, suitably for being addressed by aBit.baseAddr.

Uncompressed bit images make applications large quickly, however. It
wouldn't be difficult to write a post-processing function which would
create a cBM2 (captured-Bitmap; compressed) from a cBM1; and an 
equivalent pre-processing cBM2->cBM1 decompressor. (I'm envisaging a
single call to PackBits() per resource, here.)

Let me [jackiw@cs.swarthmore.edu] know if you'd like to be sent a copy
of Bitmap Capture.  It has the nice feature of determining for you the
bounds and rowBytes of the image as well.

Nick
----


-- 
"'I have seen too often your filthy teeth snap with range and your august
countenance, covered with the fungus of time, blush like a flaming coal
because of some microscopic futility that man had commited, to be able
to pause longer before the signpost of that silly hypothesis.'" -Maldoror