Browse Source

Math: default alpha parameter also for Color4::fromHSV().

Not sure why this was omitted.
pull/110/head
Vladimír Vondruš 11 years ago
parent
commit
f2e20ba5c0
  1. 2
      src/Magnum/Math/Color.h
  2. 4
      src/Magnum/Math/Test/ColorTest.cpp

2
src/Magnum/Math/Color.h

@ -438,7 +438,7 @@ class Color4: public Vector4<T> {
return Color4<T>(Implementation::fromHSV<T>(hsv), a); return Color4<T>(Implementation::fromHSV<T>(hsv), a);
} }
/** @overload */ /** @overload */
constexpr static Color4<T> fromHSV(Deg<FloatingPointType> hue, FloatingPointType saturation, FloatingPointType value, T alpha) { constexpr static Color4<T> fromHSV(Deg<FloatingPointType> hue, FloatingPointType saturation, FloatingPointType value, T alpha = Implementation::fullChannel<T>()) {
return fromHSV(std::make_tuple(hue, saturation, value), alpha); return fromHSV(std::make_tuple(hue, saturation, value), alpha);
} }

4
src/Magnum/Math/Test/ColorTest.cpp

@ -313,6 +313,10 @@ void ColorTest::hsvOverflow() {
void ColorTest::hsvAlpha() { void ColorTest::hsvAlpha() {
CORRADE_COMPARE(Color4ub::fromHSV(std::make_tuple(230.0_degf, 0.749f, 0.427f), 23), Color4ub(27, 40, 108, 23)); CORRADE_COMPARE(Color4ub::fromHSV(std::make_tuple(230.0_degf, 0.749f, 0.427f), 23), Color4ub(27, 40, 108, 23));
CORRADE_COMPARE(Color4ub::fromHSV(230.0_degf, 0.749f, 0.427f, 23), Color4ub(27, 40, 108, 23)); CORRADE_COMPARE(Color4ub::fromHSV(230.0_degf, 0.749f, 0.427f, 23), Color4ub(27, 40, 108, 23));
/* Default alpha */
CORRADE_COMPARE(Color4ub::fromHSV(std::make_tuple(230.0_degf, 0.749f, 0.427f)), Color4ub(27, 40, 108, 255));
CORRADE_COMPARE(Color4ub::fromHSV(230.0_degf, 0.749f, 0.427f), Color4ub(27, 40, 108, 255));
} }
void ColorTest::swizzleType() { void ColorTest::swizzleType() {

Loading…
Cancel
Save