/*
   C clearing and converter routines for the HERMES library
   Copyright (c) 1998 Christian Nentwich (brn@eleet.mcb.at)
   This source code is licensed under the GNU LGPL
  
   Please refer to the file COPYING.LIB contained in the distribution for
   licensing conditions
*/

#ifndef __HERMES_HEAD_C__
#define __HERMES_HEAD_C__


#include "HermConf.h"
#include "Types.h"
#include "Clear.h"
#include "Convert.h"


/* Clearer functions */

void ClearC_32(HermesClearInterface *iface);
void ClearC_24(HermesClearInterface *iface);
void ClearC_16(HermesClearInterface *iface);
void ClearC_8(HermesClearInterface *iface);

/* Macros to help with conversion routines */

#define READ16(adr) *((short16 *)adr)
#define READ32(adr) *((int32 *)adr)

#define WRITE16(adr,s) *((short16 *)adr)=s
#define WRITE32(adr,s) *((int32 *)adr)=s


/* This little definition makes everything much nicer below here */

#define CONVERT_PARAMETERS char8 *source,char8 *dest,unsigned int count, \
  unsigned int inc_source


/* See FactConv.c for explanations of the following */

void NotApplicable(CONVERT_PARAMETERS);


/* Converter loop for specific converters */

void ConvertC(HermesConverterInterface *);
void ConvertCStretch(HermesConverterInterface *iface);


/* Generic converters */

void ConvertC_Generic32_Generic32(HermesConverterInterface *);
void ConvertC_Generic32_Generic24(HermesConverterInterface *);
void ConvertC_Generic32_Generic16(HermesConverterInterface *);
void ConvertC_Generic32_Generic8(HermesConverterInterface *);

void ConvertC_Generic24_Generic32(HermesConverterInterface *);
void ConvertC_Generic24_Generic24(HermesConverterInterface *);
void ConvertC_Generic24_Generic16(HermesConverterInterface *);
void ConvertC_Generic24_Generic8(HermesConverterInterface *);

void ConvertC_Generic16_Generic32(HermesConverterInterface *);
void ConvertC_Generic16_Generic24(HermesConverterInterface *);
void ConvertC_Generic16_Generic16(HermesConverterInterface *);
void ConvertC_Generic16_Generic8(HermesConverterInterface *);


/* From muhmu */

void ConvertC_muhmu32_32rgb888(CONVERT_PARAMETERS);
void ConvertC_muhmu32_32bgr888(CONVERT_PARAMETERS);
void ConvertC_muhmu32_32rgba888(CONVERT_PARAMETERS);
void ConvertC_muhmu32_32bgra888(CONVERT_PARAMETERS);
void ConvertC_muhmu32_24rgb888(CONVERT_PARAMETERS);
void ConvertC_muhmu32_24bgr888(CONVERT_PARAMETERS);
void ConvertC_muhmu32_16rgb565(CONVERT_PARAMETERS);
void ConvertC_muhmu32_16bgr565(CONVERT_PARAMETERS);
void ConvertC_muhmu32_16rgb555(CONVERT_PARAMETERS);
void ConvertC_muhmu32_16bgr555(CONVERT_PARAMETERS);
void ConvertC_muhmu32_8rgb332(CONVERT_PARAMETERS);

void ConvertC_muhmu32_16rgb565_S(CONVERT_PARAMETERS);
void ConvertC_muhmu32_16bgr565_S(CONVERT_PARAMETERS);
void ConvertC_muhmu32_16rgb555_S(CONVERT_PARAMETERS);
void ConvertC_muhmu32_16bgr555_S(CONVERT_PARAMETERS);
void ConvertC_muhmu32_8rgb332_S(CONVERT_PARAMETERS);


/* From 32 bit RGB */

void ConvertC_32rgb888_32bgr888(CONVERT_PARAMETERS);
void ConvertC_32rgb888_32rgba888(CONVERT_PARAMETERS);
void ConvertC_32rgb888_32bgra888(CONVERT_PARAMETERS);
void ConvertC_32rgb888_24rgb888(CONVERT_PARAMETERS);
void ConvertC_32rgb888_24bgr888(CONVERT_PARAMETERS);
void ConvertC_32rgb888_16rgb565(CONVERT_PARAMETERS);
void ConvertC_32rgb888_16bgr565(CONVERT_PARAMETERS);
void ConvertC_32rgb888_16rgb555(CONVERT_PARAMETERS);
void ConvertC_32rgb888_16bgr555(CONVERT_PARAMETERS);
void ConvertC_32rgb888_8rgb332(CONVERT_PARAMETERS);

void ConvertC_32rgb888_32bgr888_S(CONVERT_PARAMETERS);
void ConvertC_32rgb888_32rgba888_S(CONVERT_PARAMETERS);
void ConvertC_32rgb888_32bgra888_S(CONVERT_PARAMETERS);
void ConvertC_32rgb888_16rgb565_S(CONVERT_PARAMETERS);
void ConvertC_32rgb888_16bgr565_S(CONVERT_PARAMETERS);
void ConvertC_32rgb888_16rgb555_S(CONVERT_PARAMETERS);
void ConvertC_32rgb888_16bgr555_S(CONVERT_PARAMETERS);
void ConvertC_32rgb888_8rgb332_S(CONVERT_PARAMETERS);

void ConvertC_32rgb888_16rgb565_dither(HermesConverterInterface*);
void ConvertC_32rgb888_8rgb332_dither(HermesConverterInterface*);


/* From 24 bit RGB */

void ConvertC_24rgb888_32rgb888(CONVERT_PARAMETERS);
void ConvertC_24rgb888_32bgr888(CONVERT_PARAMETERS);
void ConvertC_24rgb888_32rgba888(CONVERT_PARAMETERS);
void ConvertC_24rgb888_32bgra888(CONVERT_PARAMETERS);
void ConvertC_24rgb888_24bgr888(CONVERT_PARAMETERS);
void ConvertC_24rgb888_16rgb565(CONVERT_PARAMETERS);
void ConvertC_24rgb888_16bgr565(CONVERT_PARAMETERS);
void ConvertC_24rgb888_16rgb555(CONVERT_PARAMETERS);
void ConvertC_24rgb888_16bgr555(CONVERT_PARAMETERS);
void ConvertC_24rgb888_8rgb332(CONVERT_PARAMETERS);


/* From 16 bit RGB */

void ConvertC_16rgb565_32rgb888(CONVERT_PARAMETERS);
void ConvertC_16rgb565_32bgr888(CONVERT_PARAMETERS);
void ConvertC_16rgb565_32rgba888(CONVERT_PARAMETERS);
void ConvertC_16rgb565_32bgra888(CONVERT_PARAMETERS);
void ConvertC_16rgb565_24rgb888(CONVERT_PARAMETERS);
void ConvertC_16rgb565_24bgr888(CONVERT_PARAMETERS);
void ConvertC_16rgb565_16bgr565(CONVERT_PARAMETERS);
void ConvertC_16rgb565_16rgb555(CONVERT_PARAMETERS);
void ConvertC_16rgb565_16bgr555(CONVERT_PARAMETERS);
void ConvertC_16rgb565_8rgb332(CONVERT_PARAMETERS);

void ConvertC_16rgb565_32rgb888_S(CONVERT_PARAMETERS);
void ConvertC_16rgb565_32bgr888_S(CONVERT_PARAMETERS);
void ConvertC_16rgb565_32rgba888_S(CONVERT_PARAMETERS);
void ConvertC_16rgb565_32bgra888_S(CONVERT_PARAMETERS);
void ConvertC_16rgb565_16bgr565_S(CONVERT_PARAMETERS);
void ConvertC_16rgb565_16rgb555_S(CONVERT_PARAMETERS);
void ConvertC_16rgb565_16bgr555_S(CONVERT_PARAMETERS);
void ConvertC_16rgb565_8rgb332_S(CONVERT_PARAMETERS);

/* From 8 bit indexed */
void ConvertC_index8_32(HermesConverterInterface *);
void ConvertC_index8_24(HermesConverterInterface *);
void ConvertC_index8_16(HermesConverterInterface *);

void ConvertC_index8_32_S(HermesConverterInterface *);
void ConvertC_index8_16_S(HermesConverterInterface *);


void CopyC_4byte(CONVERT_PARAMETERS);
void CopyC_3byte(CONVERT_PARAMETERS);
void CopyC_2byte(CONVERT_PARAMETERS);
void CopyC_1byte(CONVERT_PARAMETERS);
void CopyC_4byte_S(CONVERT_PARAMETERS);
void CopyC_3byte_S(CONVERT_PARAMETERS);
void CopyC_2byte_S(CONVERT_PARAMETERS);
void CopyC_1byte_S(CONVERT_PARAMETERS);

#endif


