8 #ifndef DXLE_INC_COLOR_HPP_ 9 #define DXLE_INC_COLOR_HPP_ 12 #if defined(__c2__) && __clang_major__ == 3 && __clang_minor__ == 8 23 #include <type_traits> 62 #ifndef DXLE_NO_CXX14_CONSTEXPR 63 assert(0 <= v && v <= 255);
68 DXLE_CXX14_CONSTEXPR rgb_value_t& operator=(
int v){ assert(0 <= v && v <= 255); value = v;
return *
this; }
79 : red(), green(), blue()
82 : red(red_), green(green_), blue(blue_)
96 typedef decltype(DxLib::GetColor(0, 0, 0)) value_type;
103 : value(static_cast<value_type&&>(other.value))
106 : value(DxLib::GetColor(Red, Green, Blue))
108 #ifndef DXLE_NO_CXX14_CONSTEXPR 109 assert(0 <= Red && Red <= 255);
110 assert(0 <= Green && Green <= 255);
111 assert(0 <= Blue && Blue <= 255);
117 : value(DxLib::GetColor(rgb_color.red, rgb_color.green, rgb_color.blue))
123 static dx_color GetColor(
int Red,
int Green,
int Blue) {
return MakeDxColor(Red, Green, Blue); }
125 static dx_color GetColor3(
const DxLib::COLORDATA *ColorData,
int Red,
int Green,
int Blue,
int Alpha = 255) {
return DxLib::GetColor3(ColorData, Red, Green, Blue, Alpha); }
127 static dx_color GetColor4(
const DxLib::COLORDATA *DestColorData,
const DxLib::COLORDATA* SrcColorData,
const dx_color& SrcColor) {
return DxLib::GetColor4(DestColorData, SrcColorData, SrcColor.value); }
138 int GetColor5(
const DxLib::COLORDATA *ColorData,
int *Red,
int *Green,
int *Blue,
int *Alpha = NULL)const DXLE_NOEXCEPT_OR_NOTHROW {
return DxLib::GetColor5(ColorData, value, Red, Green, Blue, Alpha); }
140 value_type
get()
const DXLE_NOEXCEPT_OR_NOTHROW {
return value; }
163 dx_color(value_type param)DXLE_NOEXCEPT_OR_NOTHROW
183 template<typename color_t, typename enable_if<std::is_constructible<dx_color, color_t&&>::value, std::nullptr_t>::type =
nullptr>
185 : value(
std::forward<color_t>(color))
195 return static_cast<to
>(std::forward<from>(bace));
205 #if defined(DXLE_NO_CXX14_CONSTEXPR) && !defined(DXLE_NO_CXX11_CONSTEXPR) 276 static_assert((
unsigned)
color_tag::numof_variation == (
sizeof(rgb_meta) /
sizeof(rgb_meta[0])),
"color variation is not match. Please debug DxLibEx.");
279 red = rgb_meta[(unsigned)color_tag_][0];
280 green = rgb_meta[(unsigned)color_tag_][1];
281 blue = rgb_meta[(unsigned)color_tag_][2];
285 :
rgb(dx_color_.GetRGB())
291 : value(static_cast<
dx_color>(
rgb{ color_tag_ }).
get())
298 return rgb{ r, g, b };
303 using namespace color;
318 typedef decltype(DxLib::GetColor(0, 0, 0))
value_type;
320 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor( 0, 0, 0); } }
static const black ;
321 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor( 0, 0, 255); } }
static const blue ;
322 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor( 0, 255, 255); } }
static const cyan ;
323 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor(169, 169, 169); } }
static const darkgray ;
324 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor(190, 190, 190); } }
static const gray ;
325 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor( 0, 255, 0); } }
static const green ;
326 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor(211, 211, 211); } }
static const lightgray;
327 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor(255, 0, 255); } }
static const magenta ;
328 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor(255, 165, 0); } }
static const orange ;
329 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor(255, 192, 203); } }
static const pink ;
330 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor(255, 0, 0); } }
static const red ;
331 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor(255, 255, 255); } }
static const white ;
332 struct {
inline operator Color()
const DXLE_NOEXCEPT {
return DxLib::GetColor(255, 255, 0); } }
static const yellow ;
335 static Color
GetColor(
int Red,
int Green,
int Blue)
DXLE_NOEXCEPT {
return DxLib::GetColor(Red, Green, Blue); }
337 static Color
GetColor3(
const COLORDATA *ColorData,
int Red,
int Green,
int Blue,
int Alpha = 255)
DXLE_NOEXCEPT {
return DxLib::GetColor3(ColorData, Red, Green, Blue, Alpha); }
339 static Color
GetColor4(
const COLORDATA *DestColorData,
const COLORDATA* SrcColorData,
const Color& SrcColor)
DXLE_NOEXCEPT {
return DxLib::GetColor4(DestColorData, SrcColorData, SrcColor.value); }
344 int GetColor2(
int *Red,
int *Green,
int *Blue)
const DXLE_NOEXCEPT {
return DxLib::GetColor2(value, Red, Green, Blue); }
346 int GetColor5(
const COLORDATA *ColorData,
int *Red,
int *Green,
int *Blue,
int *Alpha = NULL)
const DXLE_NOEXCEPT {
return DxLib::GetColor5(ColorData, value, Red, Green, Blue, Alpha); }
377 #endif//#if 0 old version rgb GetRGB() const DXLE_NOEXCEPT_OR_NOTHROW
カラー値から赤、緑、青の値を取得する
static dx_color MakeDxColor(int Red, int Green, int Blue)
DrawPixel 等の描画関数で使用するカラー値を取得する
int GetColor5(const DxLib::COLORDATA *ColorData, int *Red, int *Green, int *Blue, int *Alpha=NULL) const DXLE_NOEXCEPT_OR_NOTHROW
指定のカラーフォーマットのカラー値を赤、緑、青、アルファの値を取得する
decltype(DxLib::GetColor(0, 0, 0)) typedef value_type
DXLE_CXX14_CONSTEXPR rgb & reverse() DXLE_NOEXCEPT_OR_NOTHROW
dx_color(const rgb &rgb_color) DXLE_NOEXCEPT_OR_NOTHROW
static dx_color GetColor(int Red, int Green, int Blue)
DrawPixel 等の描画関数で使用するカラー値を取得する
#define DXLE_CONSTEXPR_OR_CONST
#define DXLE_CXX14_CONSTEXPR
to color_cast(from &&bace)
DXLE_CONSTEXPR rgb(int red_, int green_, int blue_)
DXLE_CONSTEXPR dx_color(dx_color &&other) DXLE_NOEXCEPT_OR_NOTHROW
int GetRGB(int *Red, int *Green, int *Blue) const DXLE_NOEXCEPT_OR_NOTHROW
カラー値から赤、緑、青の値を取得する
dx_color_param(const dx_color_param &other) DXLE_NOEXCEPT_OR_NOTHROW
dx_color(int Red, int Green, int Blue)
#define DXLE_NOEXCEPT_IF(COND)
DXLE_CONSTEXPR dx_color() DXLE_NOEXCEPT_OR_NOTHROW
#define DXLE_NOEXCEPT_OR_NOTHROW
int GetColor2(int *Red, int *Green, int *Blue) const DXLE_NOEXCEPT_OR_NOTHROW
カラー値から赤、緑、青の値を取得する
dx_color_param(color_t &&color) DXLE_NOEXCEPT_IF((std
DXLE_CONSTEXPR rgb() DXLE_NOEXCEPT_OR_NOTHROW
static dx_color GetColor4(const DxLib::COLORDATA *DestColorData, const DxLib::COLORDATA *SrcColorData, const dx_color &SrcColor)
指定のカラーフォーマットのカラー値を別のカラーフォーマットのカラー値に変換する
static dx_color GetColor3(const DxLib::COLORDATA *ColorData, int Red, int Green, int Blue, int Alpha=255)
指定のピクセルフォーマットに対応したカラー値を得る