// Color.h -- An RGBA color class // // SEE ALSO // Color.cpp - Implementation // // Copyright © Daniel Scharstein, 2003. // /////////////////////////////////////////////////////////////////////////// #pragma once class CCol { public: uchar B, G, R, A; // A channel is highest one // Constructors and helper functions CCol() : B(0), G(0), R(0), A(255) {} CCol(uchar r, uchar g, uchar b, uchar a=255) : // use full alpha by default B(b), G(g), R(r), A(a) {} CCol(int id); // create unique color from integer ID bool operator==(const CCol& ref); bool operator!=(const CCol& ref); void printName();//prints a five character name of the color. Only works for ids 0 through 15 char* describe();//returns a six letter char* description of any color. float similarity(CCol c);//determines how similar the color is to c int getId(); // translate color into integer void overWriteWith(CCol fg); // put fg "over" this color, using fg's alpha }; inline bool CCol::operator==(const CCol& ref) { return (B == ref.B && G == ref.G && R == ref.R && A == ref.A); } inline bool CCol::operator!=(const CCol& ref) { return ! ((*this) == ref); }