[comp.sys.amiga] Dpaint II brushes

billk@pnet01.CTS.COM (Bill Kelly) (06/26/87)

Would someone be kind enough to post some information about how to read in a
DPaint II brush?  I am interested in reading one in and converting it into an
Image structure in my program.

Source code would be nice, but rather than that (as I am not a C programmer) I
could really use some data about the structure. (I.e. "It has header so-and-so
here, and is compressed in such-and-such a way..." etc.)  This way I can just
look at what I have to do, rather than have to try to translate C...

However, I will take the help in any form I can get it... Thanks in advance,

Bill Kelly
--
Bill Kelly      {akgua, hplabs!hp-sdd, sdcsvax}!crash!pnet01!billk
                (Don't use pnet01!billk; try crash!pnet01!billk -- Thanks!)

                "When your IQ reaches 28, sell."

hatcher@INGRES.BERKELEY.EDU (Doug Merritt) (06/28/87)

[Dear LineEater, Please note my new address: ucbvax!unisoft!certes!doug]

In article <1286@crash.CTS.COM> billk@pnet01.CTS.COM (Bill Kelly) writes:

>Would someone be kind enough to post some information about how to read in a
>DPaint II brush? I am interested in reading one in and converting it into an
>Image structure in my program.

DPaint II brushes are the same thing as IFF ILBM images, which are
documented fairly thoroughly in the RKM (see for instance page B-43
of Appendix B of RKM:Exec, Addison Wesley edition, and pg B-75 for
"ilbm.h" and pg B-71 for "iff.h").

They are often smaller than the whole screen, which sometimes confuses
ilbm viewing programs, but I've sometimes been able to view them with
such programs. Hopefully Bryce's "uShow" works on them but I haven't
tried it yet.

Quick overview of ILBM (pictures *and* brushes):
	char	ID[4] = "FORM";
	ULONG	Size;
	struct	Data {
		char	ID[4] = "ILBM";
		struct properties {
			char	ID[4] = "BMHD"; /* BitMapHeaDer */
			ULONG	Size;
			struct bmhd {
				UWORD	w, h; /* pixel width/height */
				WORD	x,y;  /* pixel position */
				UBYTE nPlanes; /* # planes */
				UBYTE mask;
				UBYTE Compression;
				UBYTE pad;
				UWORD transparentColor;
				UBYTE xAspect, yAspect;
				WORD pageWidth, pageHeight;
			};
			struct ColorMap {
				char ID[4] = "CMAP";
				ULONG Size;
				struct {
					UBYTE red, green, blue;
				}
			}
			struct CommodoreAMiGa {
				char ID[4] = "CAMG";
				ULONG Size = 1;
				struct {
					LONG ViewportMode;
				}
			}
			struct ColorRange {
				char ID[4] = "CRNG";
				ULONG Size;
				struct {
					WORD pad1;
					WORD CycleRate;
					WORD active; /* cycle? */
					UBYTE low, high; /* range */
				}
			}
		}
		struct BODY {
			struct {
				char PixRow[ NPLANES ][ WIDTH ];
				char MaskPlane[ WIDTH ];
			} scanline [HEIGHT];
		}
	}

The above is not complete, nor do I guarantee it to be correct.
Compression complicates the BODY, and each chunk is padded to an
even length (so that no chunk starts on an odd address). The pad is
not included in chunk sizes.

Reading the documentation is important to get the other details (and
to discover where my deviations from reality are in the above).
	Doug Merritt
Please note my new address:
	ucbvax!unisoft!certes!doug

bryce@COGSCI.BERKELEY.EDU (Bryce Nesbitt) (06/28/87)

In article <> ucbvax!unisoft!certes!doug writes
>
> [Dpaint II brushes are simply IFF picture files]
>
> They are often smaller than the whole screen, which sometimes confuses
> ilbm viewing programs, but I've sometimes been able to view them with
> such programs. Hopefully Bryce's "uShow" works on them but I haven't
> tried it yet.

I'm happy to take credit where credit is due, but not in this case.
I am not the author of "uShow".  I'm not even the author's agent.  I
don't even know the guy!  Sorry that was not more clear.
The uShow topic came up because it was the only IFF viewer I had ever
found the did not hog the processor while displaing the picture.  This
includes Dpaint II.  At 996 bytes it's also the smallest, bar none.

uShow handles anything from a tiny brush up to an overscan picture.
If you wanted to add to uShow you could put in support for color
cycling chunks,  scrolling a larger-than-overscan picture, and (of
course) add a user interface.

uShow is available from the comp.binaries.amiga group.  Congrats to
The "Doc" for getting this working again.

Tip-of-the-day:  Dpaint II often hogs the processor even when inactive (at
least my version does).  To temprarily eliminate this, open a disk requester,
that part of Dpaint II works properly.


|\ /|  . Ack! (NAK, EOT, SOH)
{O o} . 
( " )	bryce@cogsci.berkeley.EDU -or- ucbvax!cogsci!bryce
  U	Single tasking?  Just stare at them for a moment, then start to laugh.