ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
color.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) by Fred Klaus *
3  * development@fkweb.de *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 #ifndef SDLTK_COLOR_H
21 #define SDLTK_COLOR_H
22 
23 #include "compspec.h"
24 #include "SDL.h"
25 
26 namespace sdltk
27 {
28 
30  class Color
31  {
32 
33  public:
34  Color();
35  Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a=255) {mR = r; mG = g; mB = b; mA = a;}
37 
38  Color(const Color & c) {mR = c.r(); mG = c.g(); mB = c.b(); mA = c.a();}
39 
40  bool operator== (const Color& color) const
41  {return mR == color.r() && mG == color.g() && mB == color.b() && mA == color.a();}
42  bool operator!= (const Color& color) const
43  {return !(mR == color.r() && mG == color.g() && mB == color.b() && mA == color.a());}
44 
45  Color operator+ (const Color& color) const;
46  Color operator- (const Color& color) const;
47  Color operator* (float value) const;
48 
49  void set(Uint8 r, Uint8 g, Uint8 b, Uint8 a=255);
50  void setBlack() {mR = 0; mG = 0; mB = 0; mA = 255;}
51  void setWhite() {mR = 255; mG = 255; mB = 255; mA = 255;}
52  void setAlpha(Uint8 a) {mA = a;}
53  void clearAlpha() {mA = 255;}
54  bool hasAlpha() {return (mA != 255);}
55 
56  Uint8 r() const {return mR;}
57  Uint8 g() const {return mG;}
58  Uint8 b() const {return mB;}
59  Uint8 a() const {return mA;}
60 
61  void setR(Uint8 r) {mR = r;}
62  void setG(Uint8 g) {mG = g;}
63  void setB(Uint8 b) {mB = b;}
64  void setA(Uint8 a) {mA = a;}
65 
66  protected:
67  Uint8 mR;
68  Uint8 mG;
69  Uint8 mB;
70  Uint8 mA;
71  };
72 
73 } // sdltk
74 
75 #endif // SDLTK_COLOR_H
Color()
Definition: color.cpp:25
Color operator*(float value) const
Definition: color.cpp:70
Color operator-(const Color &color) const
Definition: color.cpp:54
Uint8 g() const
Definition: color.h:57
Uint8 mB
Definition: color.h:69
void setAlpha(Uint8 a)
Definition: color.h:52
Uint8 a() const
Definition: color.h:59
bool operator==(const Color &color) const
Definition: color.h:40
void setG(Uint8 g)
Definition: color.h:62
void setB(Uint8 b)
Definition: color.h:63
void setA(Uint8 a)
Definition: color.h:64
Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a=255)
Definition: color.h:35
Color operator+(const Color &color) const
Definition: color.cpp:38
bool operator!=(const Color &color) const
Definition: color.h:42
Uint8 mR
Definition: color.h:67
~Color() ROLAND_DEFAULT Color(const Color &c)
Definition: color.h:36
Uint8 r() const
Definition: color.h:56
void setBlack()
Definition: color.h:50
Uint8 mA
Definition: color.h:70
void clearAlpha()
Definition: color.h:53
Uint8 b() const
Definition: color.h:58
Uint8 mG
Definition: color.h:68
#define ROLAND_DEFAULT
Definition: compspec.h:46
void setR(Uint8 r)
Definition: color.h:61
RGBA Color Type.
Definition: color.h:30
bool hasAlpha()
Definition: color.h:54
the SDL based Stuff
Definition: audio.cpp:22
void setWhite()
Definition: color.h:51