Browse Source

Added convenience Color3ub and Color4ub typedefs.

pull/51/head
Vladimír Vondruš 13 years ago
parent
commit
c5bab9bb52
  1. 10
      src/Color.h
  2. 2
      src/Magnum.h
  3. 6
      src/Test/ColorTest.cpp

10
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 T> class BasicColor3: public Math::Vector3<T> {
/** @brief Three-component (RGB) float color */
typedef BasicColor3<Float> Color3;
/** @brief Three-component (RGB) unsigned byte color */
typedef BasicColor3<UnsignedByte> 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<T> {
/** @brief Four-component (RGBA) float color */
typedef BasicColor4<Float> Color4;
/** @brief Four-component (RGBA) unsigned byte color */
typedef BasicColor4<UnsignedByte> Color4ub;
MAGNUM_VECTORn_OPERATOR_IMPLEMENTATION(4, BasicColor4)
/** @debugoperator{Magnum::BasicColor3} */

2
src/Magnum.h

@ -549,7 +549,9 @@ enum class BufferTextureFormat: GLenum;
template<class> class BasicColor3;
template<class> class BasicColor4;
typedef BasicColor3<Float> Color3;
typedef BasicColor3<UnsignedByte> Color3ub;
typedef BasicColor4<Float> Color4;
typedef BasicColor4<UnsignedByte> Color4ub;
enum class ColorFormat: GLenum;
enum class ColorType: GLenum;

6
src/Test/ColorTest.cpp

@ -61,9 +61,6 @@ class ColorTest: public TestSuite::Tester {
void configuration();
};
typedef BasicColor3<UnsignedByte> Color3ub;
typedef BasicColor4<UnsignedByte> Color4ub;
ColorTest::ColorTest() {
addTests({&ColorTest::construct,
&ColorTest::constructDefault,
@ -152,9 +149,6 @@ void ColorTest::constructParts() {
}
void ColorTest::constructConversion() {
typedef BasicColor3<UnsignedByte> Color3ub;
typedef BasicColor4<UnsignedByte> Color4ub;
constexpr Color3 a(10.1f, 12.5f, 0.75f);
#ifndef CORRADE_GCC46_COMPATIBILITY
constexpr /* Not constexpr under GCC < 4.7 */

Loading…
Cancel
Save