delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/13/04:32:52

From: gautam AT interlog DOT com (Gautam N. Lad)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Can I use 256 grayscale colors?
Date: Thu, 12 Jun 97 10:54:28 GMT
Organization: InterLog Internet Services
Lines: 40
Message-ID: <5npuh2$j61@news.interlog.com>
References: <5npo2o$k8v$1 AT jaist-news DOT jaist DOT ac DOT jp>
NNTP-Posting-Host: ip220-54.cc.interlog.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,
>I would like to use 256 grayscale colors with djgpp.
Hi,
>e.g.
>set_gfx_mode(GFX_ET4000,640,480,0,0);
>for(c=0;c<256;c++){
>  pallete[c].r=c;
>  pallete[c].g=c;
>  pallete[c].b=c;
>}

This is 'cause the .r .g .b number can only be from 0 to 63.  To get a 
greyscale, do this:

for(x=0;x<256;x+=64)
  for(c=0;c<63;c++)
    {
    palette[c].r = c+x;
    palette[c].g = c+x;
    palette[c].b = c+x;
   }

What these loops do is make the colours go from 0-63, and then 
from 64-127, and then 128-191, and then 191-254.  This the only way I can
think of, 'cause I've not done this yet. If this doesn't work, opp!

Hope this helps / works! ;)
Bye!

****************************************************
* Gautam N. Lad                                    *
*--------------------------------------------------*
*                                                  *
* E-Mail    : gautam AT interlog DOT com                  *
* Website   : http://www.interlog.com/~gautam      *
*                                                  *
* OS/2, DOS/Windows, Graphics Gallery, Software,   *
* Links, Rayzor Editor/2, POV-Ray, TexturEyes,     *
* POV-PAK and lots lots lots more!!!!!!!           *
****************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019