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

From: Ullrich von Bassewitz <>
Date: 2011-05-23 17:42:20

On Sun, May 22, 2011 at 11:48:33PM +0200, Oliver Schmidt wrote:
> As discussed the concept of a bgcolor seems to be used only in
> tgi_clear. What's your opinion on the discussed approach to step away
> from a bgcolor and instead add a color parameter to tgi_clear? That
> seems somewhat more straightforward to me.

I don't like the approach very much, because it requires us to pass an
additional color every time we want to "clear" anything. If we would for
example add a draw mode for bitmapped fonts that "clears" the background
behind the characters, we will have to pass the background color for this
operation somehow to the routine.

I could live with not having a background color if we remove the concept of
"clearing" something completely from TGI. Currently, tgi_clear is just a
special case of tgi_bar, which uses a predefined color and the coordinates of
the whole screen. This can be easily special cased in the tgi_bar routine, so
there's not really a big penalty.

> That's exactly the way it is. Removing that stuff from tgi_init
> altogether makes btw the TGI kernel independent from the TGI_COLOR_...
> macros so there's really no reason left for wanting them to be
> identical for all targets.

What I currently fear is that we're changing the tgi api to be more logical
and portable, but far harder to grasp. I can easily think of several people
who will have problems if you tell them that they have to allocate colors
before being able to use them. And that TGI_COLOR_RED is not meant to be
passed to tgi_setcolor, but must be fed into tgi_alloccolor first, which may
generate an error. If not, the result may then be passed to tgi_setcolor.

BTW: What happens if I call tgi_alloccolor twice using TGI_COLOR_RED as an
argument? Will the second call return an error? Will it return two different
color handles or just one? Or does this depend on the platform? And, do I need
to know this as a programmer, or not? :-)



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon May 23 17:42:28 2011

This archive was generated by hypermail 2.1.8 : 2011-05-23 17:42:32 CEST