From c5bab9bb520c2e2e2f14affb8211f56f591b1b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 7 Jan 2014 00:23:33 +0100 Subject: [PATCH] Added convenience Color3ub and Color4ub typedefs. --- src/Color.h | 10 ++++++++-- src/Magnum.h | 2 ++ src/Test/ColorTest.cpp | 6 ------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Color.h b/src/Color.h index eb592f799..279387dc8 100644 --- a/src/Color.h +++ b/src/Color.h @@ -151,7 +151,7 @@ Conversion from and to HSV is done always using floating-point types, so hue is always in range in range @f$ [0.0, 360.0] @f$, saturation and value in range @f$ [0.0, 1.0] @f$. -@see @ref Color3, @ref BasicColor4 +@see @ref Color3, @ref Color3ub, @ref BasicColor4 */ /* Not using template specialization because some internal functions are impossible to explicitly instantiate */ @@ -332,13 +332,16 @@ template class BasicColor3: public Math::Vector3 { /** @brief Three-component (RGB) float color */ typedef BasicColor3 Color3; +/** @brief Three-component (RGB) unsigned byte color */ +typedef BasicColor3 Color3ub; + MAGNUM_VECTORn_OPERATOR_IMPLEMENTATION(3, BasicColor3) /** @brief Four-component (RGBA) color See @ref BasicColor3 for more information. -@see @ref Color4 +@see @ref Color4, @ref Color4ub */ /* Not using template specialization because some internal functions are impossible to explicitly instantiate */ @@ -500,6 +503,9 @@ class BasicColor4: public Math::Vector4 { /** @brief Four-component (RGBA) float color */ typedef BasicColor4 Color4; +/** @brief Four-component (RGBA) unsigned byte color */ +typedef BasicColor4 Color4ub; + MAGNUM_VECTORn_OPERATOR_IMPLEMENTATION(4, BasicColor4) /** @debugoperator{Magnum::BasicColor3} */ diff --git a/src/Magnum.h b/src/Magnum.h index b32c26603..96d5f8e70 100644 --- a/src/Magnum.h +++ b/src/Magnum.h @@ -549,7 +549,9 @@ enum class BufferTextureFormat: GLenum; template class BasicColor3; template class BasicColor4; typedef BasicColor3 Color3; +typedef BasicColor3 Color3ub; typedef BasicColor4 Color4; +typedef BasicColor4 Color4ub; enum class ColorFormat: GLenum; enum class ColorType: GLenum; diff --git a/src/Test/ColorTest.cpp b/src/Test/ColorTest.cpp index 4f70770d0..dfb1ac2c5 100644 --- a/src/Test/ColorTest.cpp +++ b/src/Test/ColorTest.cpp @@ -61,9 +61,6 @@ class ColorTest: public TestSuite::Tester { void configuration(); }; -typedef BasicColor3 Color3ub; -typedef BasicColor4 Color4ub; - ColorTest::ColorTest() { addTests({&ColorTest::construct, &ColorTest::constructDefault, @@ -152,9 +149,6 @@ void ColorTest::constructParts() { } void ColorTest::constructConversion() { - typedef BasicColor3 Color3ub; - typedef BasicColor4 Color4ub; - constexpr Color3 a(10.1f, 12.5f, 0.75f); #ifndef CORRADE_GCC46_COMPATIBILITY constexpr /* Not constexpr under GCC < 4.7 */