SDXFrameWork  0.13
SDXFrameWork
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Color.h
1 //Copyright © 2014 SDXFramework
2 //[License]GNU Affero General Public License, version 3
3 //[Contact]http://sourceforge.jp/projects/dxframework/
4 #pragma once
5 #include <Multimedia/SDX.h>
6 
7 namespace SDX
8 {
11  class Color
12  {
13  private:
14  SDL_Color data;
15  public:
18  Color(int 赤, int 緑, int 青, int α値 = 255)
19  {
20  SetColor(赤, 緑, 青, α値);
21  }
22 
24  void SetColor(int 赤, int 緑, int 青, int α値 = 255)
25  {
26  data = { (Uint8)赤, (Uint8)緑, (Uint8)青, (Uint8)α値 };
27  }
28 
30  int GetRed() const
31  {
32  return data.r;
33  }
34 
36  int GetGreen() const
37  {
38  return data.g;
39  }
40 
42  int GetBlue() const
43  {
44  return data.b;
45  }
46 
48  int GetAlpha() const
49  {
50  return data.a;
51  }
52 
54  operator SDL_Color() const
55  {
56  return data;
57  }
58 
60  bool operator == (const Color &比較色) const
61  {
62  return (
63  GetRed() == 比較色.GetRed() &&
64  GetBlue() == 比較色.GetBlue() &&
65  GetGreen() == 比較色.GetGreen() &&
66  GetAlpha() == 比較色.GetAlpha()
67  );
68  }
69 
71  bool operator != (const Color &比較色) const
72  {
73  return !(比較色 == *this);
74  }
75 
76 
77 
78  static const Color Black;
79  static const Color Silver;
80  static const Color Gray;
81  static const Color White;
82  static const Color Maroon;
83  static const Color Red;
84  static const Color Purple;
85  static const Color Fuchsia;
86  static const Color Green;
87  static const Color Lime;
88  static const Color Olive;
89  static const Color Yellow;
90  static const Color Navy;
91  static const Color Blue;
92  static const Color Teal;
93  static const Color Aqua;
94  };
95 }
static const Color Aqua
水 [RGB]0,255,255
Definition: Color.h:93
int GetGreen() const
緑の要素を取得.
Definition: Color.h:36
Color(int 赤, int 緑, int 青, int α値=255)
RGB値から色に変換.
Definition: Color.h:18
static const Color Red
赤 [RGB]255,0,0
Definition: Color.h:83
static const Color Maroon
栗 [RGB]128,0,0
Definition: Color.h:82
static const Color Yellow
黄 [[RGB]255,255,0
Definition: Color.h:89
static const Color Olive
暗黄 [RGB]128,128,0
Definition: Color.h:88
int GetBlue() const
青の要素を取得.
Definition: Color.h:42
static const Color Blue
青 [RGB]0,0,255
Definition: Color.h:91
static const Color Silver
銀 [R]192,192,192
Definition: Color.h:79
bool operator!=(const Color &比較色) const
比較オペレータ.
Definition: Color.h:71
void SetColor(int 赤, int 緑, int 青, int α値=255)
色の各要素を設定.
Definition: Color.h:24
static const Color Green
濃緑 [RGB]0,128,0
Definition: Color.h:86
static const Color White
白 [RGB]255,255,255
Definition: Color.h:81
色を表すクラス.
Definition: Color.h:11
static const Color Lime
明緑 [RGB]0,255,0
Definition: Color.h:87
static const Color Gray
灰 [RGB]128,128,128
Definition: Color.h:80
static const Color Black
黒 [RGB]0,0,0
Definition: Color.h:78
int GetRed() const
赤の要素を取得.
Definition: Color.h:30
static const Color Teal
青緑 [RGB]0,128,128
Definition: Color.h:92
bool operator==(const Color &比較色) const
比較オペレータ.
Definition: Color.h:60
int GetAlpha() const
透明度を取得.
Definition: Color.h:48
static const Color Fuchsia
赤紫 [RGB]255,0,255
Definition: Color.h:85
static const Color Purple
紫 [RGB]128,0,128
Definition: Color.h:84
static const Color Navy
濃青 [RGB]0,0,128
Definition: Color.h:90