|
|
| Line 3: |
Line 3: |
|
| |
|
| === The API === | | === The API === |
| struct RGBA {
| | [http://www.pavlov.net/projects/thebes/public/Color.h Color.h] |
| double r, g, b, a;
| |
|
| |
| RGBA() { }
| |
| RGBA(const RGBA& c) : r(c.r), g(c.g), b(c.b), a(c.a) {}
| |
| RGBA(double _r, double _g, double _b, double _a=1.0) :
| |
| r(_r), g(_g), b(_b), a(_a) {}
| |
| RGBA(unsigned long c) {
| |
| a = (c & 0xff) / 255.0;
| |
| r = ((c >> 8) & 0xff) / 255.0;
| |
| g = ((c >> 16) & 0xff) / 255.0;
| |
| b = ((c >> 24) & 0xff) / 255.0;
| |
| }
| |
| RGBA(const nsAString& str) {
| |
| a = 1.0;
| |
| // if aString[0] is a #, parse it as hex
| |
| // if aString[0] is a letter, parse it as a color name
| |
| // if aString[0] is a number, parse it loosely as hex
| |
| }
| |
|
| |
| const nsAString& hex() const {
| |
| }
| |
| };
| |