/*
    ####             #    #     # #
    #   #            #    #       #          The FreeWare C library for
    #   #  ##   ###  #  # #     # ###             RISC OS machines
    #   # #  # #     # #  #     # #  #   ___________________________________
    #   # ####  ###  ##   #     # #  #
    #   # #        # # #  #     # #  #    Please refer to the accompanying
    ####   ### ####  #  # ##### # ###    documentation for conditions of use
    ________________________________________________________________________

    File:    ColourTran.h
    Author:  Copyright  1993 Shaun Blackmore
    Version: 1.00 (13 May 1994)
    Purpose: Function veneer for ColourTrans SWIs
*/



#ifndef __dl_colourtran_h
#define __dl_colourtran_h

#ifdef __cplusplus
extern "C" {
#endif


#ifndef __dl_core_h
#include "Core.h"
#endif

extern os_error *ColourTrans_SetGCOL(int palette, int flag, int gcol);

extern os_error *ColourTrans_InvalidateCache(void);

extern os_error *ColourTrans_SelectTable(int src_mode, int *src_pal,
                                  int dst_mode, int *dst_pal,
                                  char *table);

typedef struct
{
  int font;
  int back;
  int fore;
  int max;
} colourtrans_fontblock;

extern os_error *ColourTrans_ReturnFontColours(colourtrans_fontblock *fontcols);
/* Note that this cannot work for modes with >256 colours. In this case, the colours
   returned will be 0 and 0; and the font will be set to the colours requested.
   [potential bug in RISC OS - shouldn't *Set*FontColours do this?] */

extern int ColourTrans_SetFontColours(int handle, int backcol, int forecol, int maxoffset);
extern int ColourTrans_ReturnColourNumberForMode(int palette, int mode,
                                                 int *pal);
extern int ColourTrans_ReturnColourNumber(int entry);
extern int ColourTrans_ReturnGCOL(int entry);
/*
Returns -1 to indicate an error.
*/

extern int ColourTrans_SetTextColour(int entry);
/* Returns GCOL chosen */

/* ColourTrans_SetFontColours(), ColourTrans_ReturnColourNumber() and ColourTrans_ReturnGCOL()
   and ColourTrans_SetTextColour() were added for the DeskLib 2.30 [RM/32] release.
   They are NOT present in the original version of DeskLib...
*/

#define ColourTrans_RGB( r, g, b)	\
	( ( (unsigned)(r)<<8 | (unsigned)(g)<<16 | (unsigned)(b)<<24))
/*
This generates a RGB word for use with ColourTrans calls, from three
0-255 values.
 */

#define	ColourTrans_SetGCOL2( palette)	\
	ColourTrans_SetGCOL( palette, 1<<8, 0)
/*
Simple macro for setting colour to a palette value
 */

#define ColourTrans_SetGCOL3( r, g, b)	\
	ColourTrans_SetGCOL2( ColourTrans_RGB( r, g, b))
/*
Simple macro for setting colour to a RGB value
 */

#ifdef __cplusplus
}
#endif


#endif
