[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Palette setting?



On Mon, 8 Jun 1998, Tamminen Eero wrote:

> Btw.  I just checked my old 'ST Internals' to see how I could set colors
> on ST.  Following seems to work under STonX emulation, but I would like
> to know how generic this is?  Does it work also on all TT/Falcon/whatever
> resolutions having either ST style interleaved bitmaps or 8-bit chunky
> bitmaps?
> 
>         #include <osbind.h>
>         /* ST palette entries use only 3 bits per color component */
>         rgb  = (int)(colTab->red[index]   >> 5) << 8;
>         rgb |= (int)(colTab->green[index] >> 5) << 4;
>         rgb |= (int)(colTab->blue[index]  >> 5);
>         Setcolor(index, rgb);
> 
> where 'index' is in range of 0 -> (1 << screen_planes).

No, this only works in ST-compatible screen-modes. Since you're bypassing
the VDI, you must write separate code for different hardware.


/*
** Jo Even Skarstein   http://www.stud.ntnu.no/~josk/
**
**   beer - maria mckee - atari falcon - babylon 5
*/