Re: [cc65] TGI palettes (was: TGI colors revisited)

From: Oliver Schmidt <>
Date: 2011-05-13 16:38:12
Hi Uz,

>> There is another option, the one used by earlier X windows functions. In those,
>> you can "allocate" a new color, and the driver returns the best approximation
>> of that color.

> I have to admit that I didn't like this idea in the first place. But after
> thinking about it for a while, it looks like it has some advantages over the
> palette approach.

Exactly the same experience here.

As pointed out I especially like the idea of the application not
needing to distinguish between "direct colors" and palettes. This is a
significant step towards TGI application portability.

And the implementation in non-palette drivers causes so little
overhead that it is well justified by the portability opportunies.
After all the major overhead seems to stem from the fact that
tgi_setcolor() parameters can't be constants anymore but rather have
to be always variables.

> We can also pass larger values than a byte to tgi_alloccolor, so the argument
> could actually contain RGB values on platforms that support it. So an
> application for the Lynx could either use the TGI_COLOR_XXX macros or pass
> encoded R/G/B values to the tgi_alloccolor function. It won't be portable any
> more, but can fully support all colors.

Yes, I thought that too. Designing the tgi_alloccolor() parameter
carefully allows for a "smooth transition" from the "very portable"
macros to the "less portable" RGB values. I say less portable because
I understand that certain Atari modes allow to choose from 128 colors.
This sounds more like RGB values than named colors...

> One drawback is that existing programs need additional code and must be
> converted, since the TGI_COLOR_XXX macros may no longer be passed to
> tgi_setcolor.

I volunteer to adjust the TGI demo.

The TGI programs in the user contribution area don't use any colors at
all (anymore) - in other words they never call tgi_setcolor(). Why?
Because today color usage is so inconsistent accross TGI drivers that
only black&white TGI programs are portable. With the color allocation
approach it would become feasable to add some color (again) to the
programs - which I volunteer to do.

> I would refrain from adding things like tgi_darken/lightencolor, because color
> effects won't look good when made portable anyway.

Full ACK.

Again my perspective may be (too) narrow, but today any TGI
application that wants to go beyond black&white on the C64 _NEEDS_ to
use palettes! And without any additional precautions this palette
usage makes the application not work as intended anymore on most other
TGI drivers. I believe that the color allocation approach helps to
improve this situation.

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri May 13 16:38:20 2011

This archive was generated by hypermail 2.1.8 : 2011-05-13 16:38:23 CEST