//================================================================
// X Window specific color functions
//
// AUTHOR:  Gabor Nagy
// DATE:    2024-Aug-15 18:21:32
//
// Copyright (C) 1996-2026 by Gabor Nagy. All rights reserved.
//================================================================
#ifndef _EXColor_h
#define _EXColor_h

#include <EParam.h>

#include <Color/Color.h>

#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
extern "C" {
#endif


extern void     EcX_XColorToRGB8(const XeVisual* PVisual, const Pixel PXColor, EcRGB8Color* POutRGB8Color);
extern Pixel    EcX_RGBAiToXColor(const XeVisual* PVisual, const EcRGBAiColor* PRGBAiColor);
extern Pixel    EcX_RGBAfToXColor(const XeVisual* PVisual, const EcRGBAf32Color* PRGBAiColor);

extern Pixel    EcX_GetRGBColor(Display* PDisplay, Colormap PColormap, const int PR, const int PG, const int PB);
extern Pixel    EcX_GetRGB8Color(Display* PDisplay, Colormap PColormap, const EcRGB8Color* PColor);

extern Pixel    EcX_GetRGBAiColor(Display* PDisplay, Colormap PColormap, const EcRGBAiColor* PColor);
extern Pixel    EcX_GetRGBfColor(Display* PDisplay, Colormap PColormap, const EcRGBf32Color* PColor);
extern Pixel    EcX_GetRGBAfColor(Display* PDisplay, Colormap PColormap, const EcRGBAf32Color* PColor);

extern Pixel    EcX_GetRGBAp8Color(Display* PDisplay, Colormap PColormap, const EcRGBAp8Color PColor);


extern Pixel    EcX_GetRGBAiColorShade(Display* PXDisplay, Colormap PXColormap, const EcRGBAiColor* PColor, const float PGain);

extern void     EcX_StoreRGBAiColor(Display* PDisplay, Colormap PColormap, const Pixel PPixelValue, const EcRGBAiColor* PColor);

extern Pixel    EcX_ColorShade(Display* PDisplay, const Colormap PColormap, const Pixel PColor, const float PFactor);


extern EcRGB8Color  EcX_ColorToRGB8(Display* PDisplay, Colormap PColormap, const Pixel PSrcColor);
extern void         EcX_BuildChanelTable8(const int PShift, unsigned long PMask, Pixel* PTable);


#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
}	// Close scope of 'extern "C"' declaration
#endif

#endif	// _EXColor_h
