Path: utzoo!utgpu!attcan!uunet!cs.dal.ca!aucs!850031m From: 850031m@aucs.uucp (GORDON R. MAC GREGOR) Newsgroups: comp.sys.amiga.tech Subject: IFF to X Window Bitmap (was: IFF to C util wanted) Message-ID: <1989Sep30.193751.15619@aucs.uucp> Date: 30 Sep 89 19:37:51 GMT References: <1989Sep27.013532.12517@NCoast.ORG> <125371@sun.Eng.Sun.COM> Reply-To: 850031m@aucs.UUCP (GORDON R. MAC GREGOR) Organization: School of Computer Science, Acadia Univ., Nova Scotia Lines: 76 In article <125371@sun.Eng.Sun.COM> cmcmanis@sun.UUCP (Chuck McManis) writes: >In article <1989Sep27.013532.12517@NCoast.ORG> (David Wright) writes: >> I am looking for a utility to convert IFF graphics and sound to >>C data statements... > >For graphics you have several options, on FishDisk #64 are the IFF >utilities, in particular check out zapicon and ilbmdump. The former [...] ^^^^^^^^ >The latter, will >generate a simple C declaration for the image data. Note two things, >if you don't have my fixes to bmprint.c (there in the 1.3 RKM but the Speaking of bmprintc.c, I recently modified it to produce an X Window bitmap file (the .bm ones). This was relitively easy, the only problem being you have to reverse the bit ordering for every byte. This is a a little time consuming. To get this working, replace the PrintBob function in bmprintc.c with the PrintBob function Ive included below. Then compile ILBMDump and its accociated modules (including bmprintc.c). ILBMDump will now dump the ilbm in X Window bitmap form. All of this source can be found on the IFF spec disk, Fred Fish # 64. The bitmap format stores only ONE bit plane of data. I ANDed the ILBM bit planes together to get a single bitplane output. This means multi-colored images will not turn out very good. This was OK for me, because I'm using this to print IFF Amiga screen dumps on the lazer printer connected to one of our X servers here at school. It's great for doing (non colorful) graphics assignments. [Right now Im using 'bitmap' to display it on X and 'xmag' to cut the image out of bitmap, then finally printing the xmag window. I'll be working on a direct bitmap displayer soon.] - Ross MacGregor ------------------------- cut here ------------------------------------ PrintBob(bm, fp, name) struct BitMap *bm; FILE *fp; UBYTE *name; { UBYTE *bp[8]; /* Maximum 8 bit planes :-) */ UBYTE bmbyte; int p,i,count; int nbytes = bm->BytesPerRow*bm->Rows; fprintf(fp,"#define %s_width %ld",name, bm->BytesPerRow*8); PrCRLF(fp); fprintf(fp,"#define %s_height %ld", name, bm->Rows); PrCRLF(fp); fprintf(fp, "static char %s_bits[] = { ", name); PrCRLF(fp); for (p=0; pDepth && p<8; ++p) bp[p] = (UBYTE *)bm->Planes[p]; count=12; for(i=0; iDepth && p<8; ++p) bmbyte|=*(bp[p]++); fprintf(fp," 0x%x", bmbyte); if( i!=nbytes-1 ) if( --count ) fprintf(fp,","); else { fprintf(fp,","); PrCRLF(fp); count=12; } } fprintf(fp," };"); PrCRLF(fp); PrCRLF(fp); }