850031m@aucs.uucp (GORDON R. MAC GREGOR) (10/01/89)
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; p<bm->Depth && p<8; ++p) bp[p] = (UBYTE *)bm->Planes[p]; count=12; for(i=0; i<nbytes; i++) { bmbyte=0; for (p=0; p<bm->Depth && 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); }
jwright@atanasoff.cs.iastate.edu (Jim Wright) (10/03/89)
In article <1989Sep30.193751.15619@aucs.uucp> 850031m@aucs.UUCP (GORDON R. MAC GREGOR) writes: | 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. Use a lookup table. A trivial amount of work at the start, and things will scream through afterward. -- Jim Wright jwright@atanasoff.cs.iastate.edu