SDXFrameWork  0.13
SDXFrameWork
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | Static Public Attributes | List of all members
SDX::Color Class Reference

色を表すクラス. More...

#include <Color.h>

Public Member Functions

 Color (int 赤, int 緑, int 青, int α値=255)
 RGB値から色に変換. More...
 
void SetColor (int 赤, int 緑, int 青, int α値=255)
 色の各要素を設定. More...
 
int GetRed () const
 赤の要素を取得. More...
 
int GetGreen () const
 緑の要素を取得. More...
 
int GetBlue () const
 青の要素を取得. More...
 
int GetAlpha () const
 透明度を取得. More...
 
 operator SDL_Color () const
 型変換. More...
 
bool operator== (const Color &比較色) const
 比較オペレータ. More...
 
bool operator!= (const Color &比較色) const
 比較オペレータ. More...
 

Static Public Attributes

static const Color Black = { 0, 0, 0 }
 黒 [RGB]0,0,0
 
static const Color Silver = { 192, 192, 192 }
 銀 [R]192,192,192
 
static const Color Gray
 灰 [RGB]128,128,128
 
static const Color White
 白 [RGB]255,255,255
 
static const Color Maroon
 栗 [RGB]128,0,0
 
static const Color Red
 赤 [RGB]255,0,0
 
static const Color Purple
 紫 [RGB]128,0,128
 
static const Color Fuchsia
 赤紫 [RGB]255,0,255
 
static const Color Green
 濃緑 [RGB]0,128,0
 
static const Color Lime
 明緑 [RGB]0,255,0
 
static const Color Olive
 暗黄 [RGB]128,128,0
 
static const Color Yellow
 黄 [[RGB]255,255,0
 
static const Color Navy
 濃青 [RGB]0,0,128
 
static const Color Blue
 青 [RGB]0,0,255
 
static const Color Teal
 青緑 [RGB]0,128,128
 
static const Color Aqua
 水 [RGB]0,255,255
 

Detailed Description

色を表すクラス.

//Copyright © 2014 SDXFramework
//[License]GNU Affero General Public License, version 3
//[Contact]http://sourceforge.jp/projects/dxframework/
//図形を異なる色で描画
bool SampleColor()
{
using namespace SDX;
System::Initialise("Color", 640, 480);
while (System::Update())
{
//赤い線を描画、普通に指定する
Drawing::Line({ 10, 10 }, { 200, 10 }, Color(255, 0, 0), 3);
//緑の四角を描画、省略してみる
Drawing::Rect({ 10, 100, 200, 200 }, { 0, 255, 0 }, true);
//半透明の青い●を描画、塗りつぶし有り
Drawing::Circle({ 110, 300, 50 }, {0,0,255,128});
if (Input::key.Return.on){ break;}//Enterで終了
}
return true;
}

Constructor & Destructor Documentation

SDX::Color::Color ( int  ,
int  ,
int  ,
int  α値 = 255 
)
inline

RGB値から色に変換.

赤、緑、青の各要素は0~255で指定する

Member Function Documentation

void SDX::Color::SetColor ( int  ,
int  ,
int  ,
int  α値 = 255 
)
inline

色の各要素を設定.

int SDX::Color::GetRed ( ) const
inline

赤の要素を取得.

int SDX::Color::GetGreen ( ) const
inline

緑の要素を取得.

int SDX::Color::GetBlue ( ) const
inline

青の要素を取得.

int SDX::Color::GetAlpha ( ) const
inline

透明度を取得.

SDX::Color::operator SDL_Color ( ) const
inline

型変換.

bool SDX::Color::operator== ( const Color 比較色) const
inline

比較オペレータ.

bool SDX::Color::operator!= ( const Color 比較色) const
inline

比較オペレータ.