From dddef56c874ee0536823698493d5e173afb9c3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 8 Feb 2023 19:11:44 +0100 Subject: [PATCH] python: adapt to Magnum changes. Which means the API gets renamed, so a breaking change. --- src/python/magnum/math.vector.h | 12 ++++++------ src/python/magnum/test/test_math.py | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/python/magnum/math.vector.h b/src/python/magnum/math.vector.h index a1d2a21..706db51 100644 --- a/src/python/magnum/math.vector.h +++ b/src/python/magnum/math.vector.h @@ -575,8 +575,8 @@ template void color3(py::class_, Math::Vector3>& c) .def_static("from_hsv", [](Degd hue, typename Math::Color3::FloatingPointType saturation, typename Math::Color3::FloatingPointType value) { return Math::Color3::fromHsv({Math::Deg(hue), saturation, value}); }, "Create RGB color from HSV representation", py::arg("hue"), py::arg("saturation"), py::arg("value")) - .def_static("from_srgb", [](UnsignedInt srgb) { - return Math::Color3::fromSrgb(srgb); + .def_static("from_srgb_int", [](UnsignedInt srgb) { + return Math::Color3::fromSrgbInt(srgb); }, "Create linear RGB color from 24-bit sRGB representation", py::arg("srgb")) .def_static("from_xyz", &Color3::fromXyz, "Create RGB color from CIE XYZ representation", py::arg("xyz")) @@ -638,11 +638,11 @@ template void color4(py::class_, Math::Vector4>& c) return Math::Color4::fromHsv({Math::Deg(hue), saturation, value}, alpha); }, "Create RGB color from HSV representation", py::arg("hue"), py::arg("saturation"), py::arg("value"), py::arg("alpha") = Math::Implementation::fullChannel()) - .def_static("from_srgb_alpha", [](UnsignedInt srgbAlpha) { - return Math::Color4::fromSrgbAlpha(srgbAlpha); + .def_static("from_srgb_alpha_int", [](UnsignedInt srgbAlpha) { + return Math::Color4::fromSrgbAlphaInt(srgbAlpha); }, "Create linear RGBA color from 32-bit sRGB a alpha representation", py::arg("srgb_alpha")) - .def_static("from_srgb", [](UnsignedInt srgb, T a) { - return Math::Color4::fromSrgb(srgb, a); + .def_static("from_srgb_int", [](UnsignedInt srgb, T a) { + return Math::Color4::fromSrgbInt(srgb, a); }, "Create linear RGBA color from 32-bit sRGB a alpha representation", py::arg("srgb"), py::arg("a") = Math::Implementation::fullChannel()) .def_static("from_xyz", &Color4::fromXyz, "Create RGBA color from CIE XYZ representation", py::arg("xyz"), py::arg("a") = Math::Implementation::fullChannel()) diff --git a/src/python/magnum/test/test_math.py b/src/python/magnum/test/test_math.py index 187534f..d41fdb6 100644 --- a/src/python/magnum/test/test_math.py +++ b/src/python/magnum/test/test_math.py @@ -477,7 +477,7 @@ class Color3_(unittest.TestCase): def test_srgb(self): # Cross-checked with C++ tests - a = Color3.from_srgb(0xf32a80) + a = Color3.from_srgb_int(0xf32a80) self.assertEqual(a, Color3(0.896269, 0.0231534, 0.215861)) self.assertEqual(a.to_srgb_int(), 0xf32a80) @@ -547,15 +547,15 @@ class Color4_(unittest.TestCase): def test_srgb(self): # Cross-checked with C++ tests - a = Color4.from_srgb(0xf32a80) + a = Color4.from_srgb_int(0xf32a80) self.assertEqual(a, Color4(0.896269, 0.0231534, 0.215861, 1.0)) self.assertEqual(a.to_srgb_alpha_int(), 0xf32a80ff) def test_srgb_alpha(self): # Cross-checked with C++ tests - a = Color4.from_srgb(0xf32a80, a=0.137255) - b = Color4.from_srgb_alpha(0xf32a8023) + a = Color4.from_srgb_int(0xf32a80, a=0.137255) + b = Color4.from_srgb_alpha_int(0xf32a8023) self.assertEqual(a, Color4(0.896269, 0.0231534, 0.215861, 0.137255)) self.assertEqual(b, Color4(0.896269, 0.0231534, 0.215861, 0.137255))