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

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2011-05-13 17:22:16
Hi!

On Fri, May 13, 2011 at 04:42:40PM +0200, Oliver Schmidt wrote:
> By now I believe that the tgi_alloccolor() approach is the way to go.
> However I'm wondering about the momentum we can gain in transforming
> the various TGI drivers...
          
 - First step is to exactly define the API.

 - Second step is to make sure that the API defined in step one will work with
   all platforms, is an improvement for at least a few and won't harm the
   others.

 - Next step is to change the kernal and define the new driver entry
   points.

 - Fourth step is to change one driver and test it to make sure the
   changes work as expected.

 - Least step is to change the other drivers.


First steps first. How about this as a first take:

---------------------------------------------------------------------------
#define TGI_COLOR_INVALID       0xFFFFU

unsigned __fastcall__ tgi_alloccolor (unsigned long color);
/* Allocate and return one color. The function takes a color using one of
 * the TGI_COLOR_XXX constants, or (non-portable) some other value that
 * depends on the platform and driver. It returns an opaque,  driver 
 * dependent index that can be used in a call to tgi_setcolor, or
 * TGI_COLOR_INVALID if the given color cannot be allocated. In case
 * the given color is unavailable, the driver will allocate a similar
 * color and return its index.
 */
---------------------------------------------------------------------------

If we're sure that there will never be a platform with more than 256 color
entries, above function can return an unsigned char.

In addition,

  * we have to decide if we want to leave the TGI colors platform depdendent
    or not,

  * tgi_setpalette, tgi_getpalette, tgi_getdefpalette and tgi_getmaxcolor
    will get deleted,

  * tgi_setcolor/tgi_getcolor might have to be changed to use and unsigned
    instead of unsigned char, and

  * the description of tgi_getmaxcolor must be changed, but how?

Anything else?

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri May 13 17:22:24 2011

This archive was generated by hypermail 2.1.8 : 2011-05-13 17:22:27 CEST