这个类主要是颜色操作,操作详细原理如下图:
类声明:
class RGBColor { public: RGBColor(); ~RGBColor(); RGBColor(ldouble a); RGBColor(ldouble red, ldouble green, ldouble blue); RGBColor(const RGBColor& c); RGBColor operator+(const RGBColor& c) const; RGBColor& operator+=(const RGBColor& c); RGBColor operator*(const ldouble a) const; RGBColor& operator*=(const ldouble a); RGBColor operator/(const ldouble f) const; RGBColor& operator/=(const ldouble f); RGBColor operator*(const RGBColor& c) const; RGBColor& operator=(const RGBColor& c); bool operator==(const RGBColor& c) const; bool operator!=(const RGBColor& c) const; RGBColor powc(ldouble p) const; ldouble average() const; friend std::ostream& operator<<(std::ostream& os, const RGBColor& c); friend std::istream& operator>>(std::istream& is, RGBColor& c); ldouble r, g, b; };