SDXFrameWork 0.10 SDXFrameWork

- Main Page
- Related Pages
- Classes

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 }
SDX::Color::Aqua
static const Color Aqua
水 [RGB]0,255,255
Definition: Color.h:93
SDX::Color::GetGreen
int GetGreen() const
緑の要素を取得.
Definition: Color.h:36
SDX::Color::Color
Color(int 赤, int 緑, int 青, int α値=255)
RGB値から色に変換.
Definition: Color.h:18
SDX::Color::Red
static const Color Red
赤 [RGB]255,0,0
Definition: Color.h:83
SDX::Color::Maroon
static const Color Maroon
栗 [RGB]128,0,0
Definition: Color.h:82
SDX::Color::Yellow
static const Color Yellow
黄 [[RGB]255,255,0
Definition: Color.h:89
SDX::Color::Olive
static const Color Olive
暗黄 [RGB]128,128,0
Definition: Color.h:88
SDX::Color::GetBlue
int GetBlue() const
青の要素を取得.
Definition: Color.h:42
SDX::Color::Blue
static const Color Blue
青 [RGB]0,0,255
Definition: Color.h:91
SDX::Color::Silver
static const Color Silver
銀 [R]192,192,192
Definition: Color.h:79
SDX::Color::operator!=
bool operator!=(const Color &比較色) const
比較オペレータ.
Definition: Color.h:71
SDX::Color::SetColor
void SetColor(int 赤, int 緑, int 青, int α値=255)
色の各要素を設定.
Definition: Color.h:24
SDX::Color::Green
static const Color Green
濃緑 [RGB]0,128,0
Definition: Color.h:86
SDX::Color::White
static const Color White
白 [RGB]255,255,255
Definition: Color.h:81
SDX::Color
色を表すクラス.
Definition: Color.h:11
SDX::Color::Lime
static const Color Lime
明緑 [RGB]0,255,0
Definition: Color.h:87
SDX::Color::Gray
static const Color Gray
灰 [RGB]128,128,128
Definition: Color.h:80
SDX::Color::Black
static const Color Black
黒 [RGB]0,0,0
Definition: Color.h:78
SDX::Color::GetRed
int GetRed() const
赤の要素を取得.
Definition: Color.h:30
SDX::Color::Teal
static const Color Teal
青緑 [RGB]0,128,128
Definition: Color.h:92
SDX::Color::operator==
bool operator==(const Color &比較色) const
比較オペレータ.
Definition: Color.h:60
SDX::Color::GetAlpha
int GetAlpha() const
透明度を取得.
Definition: Color.h:48
SDX::Color::Fuchsia
static const Color Fuchsia
赤紫 [RGB]255,0,255
Definition: Color.h:85
SDX::Color::Purple
static const Color Purple
紫 [RGB]128,0,128
Definition: Color.h:84
SDX::Color::Navy
static const Color Navy
濃青 [RGB]0,0,128
Definition: Color.h:90