2013-04-04 14:14:49 +00:00
|
|
|
/*
|
|
|
|
* Header file for Color
|
|
|
|
* Copyright (C) 2013 Lu Wang <coolwanglu@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef COLOR_H__
|
|
|
|
#define COLOR_H__
|
|
|
|
|
|
|
|
#include <ostream>
|
|
|
|
|
|
|
|
#include <GfxState.h>
|
|
|
|
|
|
|
|
namespace pdf2htmlEX {
|
|
|
|
|
|
|
|
struct Color
|
|
|
|
{
|
|
|
|
bool transparent;
|
|
|
|
GfxRGB rgb;
|
2014-06-26 13:28:32 +00:00
|
|
|
Color();
|
|
|
|
Color(double r, double g, double b, bool transparent = false);
|
|
|
|
Color(const GfxRGB& rgb);
|
2013-04-04 14:14:49 +00:00
|
|
|
bool operator == (const Color & c) const {
|
|
|
|
if(transparent != c.transparent)
|
|
|
|
return false;
|
|
|
|
if(transparent)
|
|
|
|
return true;
|
|
|
|
return ((rgb.r == c.rgb.r) && (rgb.g == c.rgb.g) && (rgb.b == c.rgb.b));
|
|
|
|
}
|
2014-06-27 08:11:42 +00:00
|
|
|
void get_gfx_color(GfxColor & gc) const;
|
2014-06-26 13:28:32 +00:00
|
|
|
// Color distance, [0,1].
|
2014-06-27 08:11:42 +00:00
|
|
|
double distance(const Color & other) const;
|
2013-04-04 14:14:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
std::ostream & operator << (std::ostream & out, const Color & color);
|
|
|
|
|
|
|
|
} // namespace pdf2htmlEX
|
|
|
|
|
|
|
|
#endif // COLOR_H__
|