47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
|
|
#ifndef COLOR_H
|
|
#define COLOR_H COLOR_H
|
|
|
|
#include "refptr.h"
|
|
#include <iostream>
|
|
#include "util/Vector.h"
|
|
|
|
class Color
|
|
{
|
|
public:
|
|
double r, g, b;
|
|
|
|
Color();
|
|
Color(double r, double g, double b);
|
|
Color(const Vector & v);
|
|
Color(refptr<Vector> v);
|
|
|
|
Color operator*(const Color & other) const;
|
|
Color operator*(double scale) const;
|
|
Color operator/(double scale) const;
|
|
Color & operator+=(const Color & other);
|
|
Color & operator-=(const Color & other);
|
|
Color & operator*=(double scale);
|
|
Color & operator*=(const Color & other);
|
|
Color & operator/=(double scale);
|
|
Color & operator/=(const Color & other);
|
|
|
|
static const Color black;
|
|
static const Color white;
|
|
static const Color red;
|
|
static const Color green;
|
|
static const Color blue;
|
|
static const Color yellow;
|
|
static const Color cyan;
|
|
static const Color magenta;
|
|
};
|
|
|
|
Color operator+(const Color & c1, const Color & c2);
|
|
Color operator-(const Color & c1, const Color & c2);
|
|
static inline Color operator*(double d, const Color & c) { return c * d; }
|
|
static inline Color operator/(double d, const Color & c) { return c / d; }
|
|
std::ostream & operator<<(std::ostream & out, const Color & color);
|
|
|
|
#endif
|
|
|