/*
    ####             #    #     # #
    #   #            #    #       #          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, Brian Scattergood
    Version: 1.02 (05 Nov 1995)
    Purpose: Function veneer for ColourTrans SWIs
    History: 1.00 (13 May 1994) SB
             1.01 (31 Oct 1995) BS Added Desk_ColourTrans_ReturnColourNumber and
                                         Desk_ColourTrans_ReturnGCOL
             1.02 (05 Nov 1995) JS Added macros Desk_ColourTrans_RGB, 
                                   Desk_ColourTrans_SetGCOL2, Desk_ColourTrans_SetGCOL3.
*/



#ifndef __Desk_ColourTran_h
#define __Desk_ColourTran_h

#ifdef __cplusplus
	extern "C" {
#endif


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

extern void	Desk_ColourTrans_SetGCOL( int palette, int flag, int gcolaction);
/*
palette:	A RGB word (See Desk_ColourTrans_RGB).

flag:		Bit 7 is: 0-foreground, 1-background.
		Bit 8 is: 1-use ECFs, 0-don't use ECFs  (under RISC OS 2,
		ECFs are never used.
		The remaining bits are unused.

gcolaction:	GCOL action - see Desk_gfx_action_* etc.
		To set normal overwriting colour, use
		Desk_gfx_action_OVERWRITE (which is 0).
 */


#define Desk_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	Desk_ColourTrans_SetGCOL2( palette)	\
	Desk_ColourTrans_SetGCOL( palette, 1<<8, 0)
/*
Simple macro for setting colour to a palette value
 */

#define Desk_ColourTrans_SetGCOL3( r, g, b)	\
	Desk_ColourTrans_SetGCOL2( Desk_ColourTrans_RGB( r, g, b))
/*
Simple macro for setting colour to a RGB value
 */



extern void	Desk_ColourTrans_InvalidateCache(void);

extern void	Desk_ColourTrans_SelectTable(int Desk_src_mode, int *Desk_src_pal,
                                  int Desk_dst_mode, int *Desk_dst_pal,
                                  char *table);

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

extern void	Desk_ColourTrans_ReturnFontColours(Desk_colourtrans_fontblock *fontcols);


extern int Desk_ColourTrans_ReturnColourNumberForMode(int palette, int mode,
                                                 int *pal);
/*
Returns colour number.
*/


extern int	Desk_ColourTrans_ReturnColourNumber(int entry);

extern int	Desk_ColourTrans_ReturnGCOL(int entry);



#ifdef __cplusplus
}
#endif


#endif
