[comp.sys.mac.programmer] Getting thoes @#!$ 256 colors to show themselves

niko@iastate.edu (Schuessler Nikolaus E) (12/18/90)

Hey. I'm trying to get 256 colors displayed on any screen in any
format and am failing miserably. :-( Here is what I have:

   SetRect(&bnds,10,40,620,470);
    wind= NewCWindow(NULL,&bnds,"\pMy Window",1,plainDBox,NULL,1,0L);
    
    InitCursor();
    SetCursor(&arrow);
    ShowCursor();
   
    ctbhndl=GetCTable(8);             /* gets 8 bit color table from rom */
    SetWinColor(wind,ctbhndl);       /* sets the windows color table */
       
    for (i=0; i<bnds.right-20; i += 10)
      for (j=0; j<10; j++)
        { ForeColor(oldcolors[(i/10) % 8]);    /* here are the normal 
                                                   boring colors */
          MoveTo(10+i+j,20);
          LineTo(10+i+j,bnds.bottom/2);
          
          HSL2RGB(&hls,&rgb);       /* here is supposed to be neat colors */
          RGBForeColor(&rgb );
          MoveTo(10+i+j,bnds.bottom/2 +10);
          LineTo(10+i+j,bnds.bottom-5);
          hls.hue += 1235;
        }
        
      ForeColor(blackColor);
        

What it does is draw the 8 normal colors on the top of the screen, and
just white on the bottom of the screen. I hacked around in the debugger
(THINK 4.0) and found that the ctbhndl is atleast non-nil. HSL2RGB also
seems to work.  I've tried every combination of RGBForeColor,PmForeColor,
CTab2Pallette, etc. etc. and I either get the white on the bottom of
the screen or the same thing as I get on the top (I SHOULD get neat colors
on the bottom from the 256 color colortable). HEEEEELLLLLPPPP!!!!!

(thanks)






--
------------------------------------------------------------------------------
Niko Schuessler               "On a two semester mission to engineer where
niko@iastate.edu               no-one has engineered before.... :-) "
------------------------------------------------------------------------------