2013-01-19 22:42:50 +00:00
|
|
|
#ifndef _PAYSAGES_TOOLS_COLOR_H_
|
|
|
|
#define _PAYSAGES_TOOLS_COLOR_H_
|
2012-01-29 17:39:56 +00:00
|
|
|
|
2012-03-08 15:10:25 +00:00
|
|
|
#include "curve.h"
|
2013-01-14 19:07:56 +00:00
|
|
|
#include "pack.h"
|
2012-01-29 17:39:56 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-05-29 13:32:23 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2012-06-17 09:40:40 +00:00
|
|
|
double r;
|
|
|
|
double g;
|
|
|
|
double b;
|
|
|
|
double a;
|
2012-05-29 13:32:23 +00:00
|
|
|
} Color;
|
|
|
|
|
|
|
|
extern Color COLOR_TRANSPARENT;
|
|
|
|
extern Color COLOR_BLACK;
|
|
|
|
extern Color COLOR_RED;
|
|
|
|
extern Color COLOR_GREEN;
|
|
|
|
extern Color COLOR_BLUE;
|
|
|
|
extern Color COLOR_WHITE;
|
|
|
|
extern Color COLOR_GREY;
|
|
|
|
|
2012-03-08 15:10:25 +00:00
|
|
|
/* Color */
|
2012-04-22 17:12:39 +00:00
|
|
|
void colorSave(PackStream* stream, Color* col);
|
|
|
|
void colorLoad(PackStream* stream, Color* col);
|
2012-03-08 15:10:25 +00:00
|
|
|
|
2012-01-29 17:39:56 +00:00
|
|
|
unsigned int colorTo32BitRGBA(Color* col);
|
|
|
|
unsigned int colorTo32BitBGRA(Color* col);
|
|
|
|
unsigned int colorTo32BitARGB(Color* col);
|
|
|
|
unsigned int colorTo32BitABGR(Color* col);
|
2012-03-08 15:10:25 +00:00
|
|
|
|
2012-07-19 15:04:27 +00:00
|
|
|
Color colorFrom32BitRGBA(unsigned int col);
|
|
|
|
Color colorFrom32BitBGRA(unsigned int col);
|
|
|
|
Color colorFrom32BitARGB(unsigned int col);
|
|
|
|
Color colorFrom32BitABGR(unsigned int col);
|
|
|
|
|
2012-01-29 17:39:56 +00:00
|
|
|
void colorMask(Color* base, Color* mask);
|
2012-06-17 09:40:40 +00:00
|
|
|
double colorNormalize(Color* col);
|
|
|
|
double colorGetValue(Color* col);
|
2012-01-29 17:39:56 +00:00
|
|
|
|
2013-01-14 19:07:56 +00:00
|
|
|
/* HDR profile for tone-mapping */
|
|
|
|
typedef struct ColorProfile ColorProfile;
|
|
|
|
|
|
|
|
ColorProfile* colorProfileCreate();
|
|
|
|
void colorProfileDelete(ColorProfile* profile);
|
|
|
|
|
|
|
|
void colorProfileSave(PackStream* stream, ColorProfile* profile);
|
|
|
|
void colorProfileLoad(PackStream* stream, ColorProfile* profile);
|
|
|
|
|
|
|
|
void colorProfileClear(ColorProfile* profile);
|
|
|
|
int colorProfileCollect(ColorProfile* profile, Color pixel);
|
|
|
|
Color colorProfileApply(ColorProfile* profile, Color pixel);
|
|
|
|
|
2012-03-08 15:10:25 +00:00
|
|
|
/* ColorGradation */
|
|
|
|
typedef struct ColorGradation ColorGradation;
|
|
|
|
|
|
|
|
ColorGradation* colorGradationCreate();
|
|
|
|
void colorGradationDelete(ColorGradation* gradation);
|
|
|
|
void colorGradationCopy(ColorGradation* source, ColorGradation* destination);
|
2012-06-22 22:13:55 +00:00
|
|
|
void colorGradationClear(ColorGradation* gradation);
|
2012-03-08 15:10:25 +00:00
|
|
|
|
2012-04-22 17:12:39 +00:00
|
|
|
void colorGradationSave(PackStream* stream, ColorGradation* gradation);
|
|
|
|
void colorGradationLoad(PackStream* stream, ColorGradation* gradation);
|
2012-03-08 15:10:25 +00:00
|
|
|
|
|
|
|
void colorGradationGetRedCurve(ColorGradation* gradation, Curve* curve);
|
|
|
|
void colorGradationGetGreenCurve(ColorGradation* gradation, Curve* curve);
|
|
|
|
void colorGradationGetBlueCurve(ColorGradation* gradation, Curve* curve);
|
|
|
|
|
|
|
|
void colorGradationSetRedCurve(ColorGradation* gradation, Curve* curve);
|
|
|
|
void colorGradationSetGreenCurve(ColorGradation* gradation, Curve* curve);
|
|
|
|
void colorGradationSetBlueCurve(ColorGradation* gradation, Curve* curve);
|
|
|
|
|
2012-06-17 09:40:40 +00:00
|
|
|
void colorGradationQuickAdd(ColorGradation* gradation, double value, Color* col);
|
|
|
|
void colorGradationQuickAddRgb(ColorGradation* gradation, double value, double r, double g, double b);
|
2012-03-08 15:10:25 +00:00
|
|
|
|
2012-06-17 09:40:40 +00:00
|
|
|
Color colorGradationGet(ColorGradation* gradation, double value);
|
2012-01-29 17:39:56 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|