Message-Id: <3.0.6.32.19990211183010.007ca480@pop.netaddress.com> X-Sender: pderbysh AT pop DOT netaddress DOT com X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32) Date: Thu, 11 Feb 1999 18:30:10 -0500 To: djgpp AT delorie DOT com From: Paul Derbyshire Subject: Re: Help: Converting 24bit bitmap to seperate R,G,B files using Allegro? In-Reply-To: <35FE2CA2.5E93@ns.sympatico.ca> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Reply-To: djgpp AT delorie DOT com It must be just sending the color components separately. You need to split your 24 bit color bitmap into three 8 bit bitmaps where the pixel color number in the 8 bit bitmaps is one component for the 24 bit bitmap. Like this... (Disclaimer: Untested, quick and dirty, and no error checking. Assumes the 24 bit bitmap is in bbggrr pixel format also. And not very optimized!) typedef struct { BITMAP *r; // These should be 8 bit. BITMAP *g; BITMAP *b; } split; split split_image (BITMAP *bmp) { // Arg should be 24-bit. split sp; int x, y; unsigned int c; sp.r = create_bitmap_ex(bmp->w,bmp->h,8); sp.g = create_bitmap_ex(bmp->w,bmp->h,8); sp.b = create_bitmap_ex(bmp->w,bmp->h,8); for (x=0; xw; ++x) { for (y=0; yh; ++y) { c=getpixel(bmp,x,y); putpixel(sp.r,x,y,c&0xff); putpixel(sp.g,x,y,c&0xff00); putpixel(sp.b,x,y,c&0xff0000); } } return sp; } Send sp.r, sp.g, and sp.b to the printer in the correct order, then remember to destroy_bitmap() all three. -- .*. "Clouds are not spheres, mountains are not cones, coastlines are not -() < circles, and bark is not smooth, nor does lightning travel in a `*' straight line." ------------------------------------------------- -- B. Mandelbrot |http://surf.to/pgd.net _____________________ ____|________ Paul Derbyshire pderbysh AT usa DOT net Programmer & Humanist|ICQ: 10423848|