Message-ID: <19971017150215.21713.qmail@hotmail.com> From: "John Patton" To: djgpp AT delorie DOT com Subject: Re: ALLEGRO - 256 shades of grey?? How? Content-Type: text/plain Date: Fri, 17 Oct 1997 08:02:13 PDT Precedence: bulk >From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot) >Subject: Re: ALLEGRO - 256 shades of grey?? How? >Date: 16 Oct 1997 23:53:59 GMT >To: djgpp AT delorie DOT com > >On Thu, 16 Oct 1997 22:35:35 GMT in comp.os.msdos.djgpp Peter Scargill >(pscargill AT cix DOT compulink DOT co DOT uk) wrote: > >: In 800*600*256 mode, GRX20 lets you set up 256 shades of gray. ALLEGRO in >: the same mode only lets you set up 64 (then you get them repeated 3 times >: as the routine uses 6 bits per colour). > >: How do I get the full 256 shades of grey. HELP!!! > >I expect GRX is lying; the 6 bit limit is imposed by the VGA hardware, not by >Allegro. What GRX does is probably to map strengths 0-3 to strength 0, >strengths 4-7 to strength 1, ...., strngths 252-255 to strength 63. Simply >put, dividing the [0,255] strengths by four to give [0,63]. For example: > >PALETTE grey_pal; >int i; > >for (i = 0; i < 256; i++) > grey_pal[i].r = grey_pal[i].g = grey_pal[i].b = i/4; > >If you really need 256 distinct colours, you'll have to sacrifice some hue >accuracy and use slightly off-grey colours. If you don't mind this, try >something like: > >for (i = 0; i < 256; i++) { > grey_pal[i].r = grey_pal[i].g = grey_pal[i].b = i/4; > if (i&1) grey_pal[i].r++; > if (i&2) grey_pal[i].g++; >} > >The hue inaccuracy will be most noticeable on dark colours. > >-- >george DOT foot AT merton DOT ox DOT ac DOT uk > So, what you're saying is, I'm limited to 64 shades of gray by the way Allegro handles the color hardware? I thought it was possible to have 256 different colors by updating the color DACs with the appropriate color values? I also thought you could choose between a total of 262,000+ (IOW 2^18) different colors in 256-color mode, you were only able to use 256 distinct colors because the 8-bit value is an offset into the VGA palette array, of which I thought held a value corresponding to the desired color. I may be wrong, however, I know I've loaded a 256-color palatte of the same color (i.e. red or something...) and it appeared to have all of those colors -- not with allegro, but when I was doing asm in BC++ a while ago. Shawn, any answers on this with your library? I'll experiment with this, I guess... One last thought: Does this mean Allegro loads a palette into the DACs that connot be changed? -John ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com