@@ -729,136 +729,6 @@ void registerYupGraphicsBindings (py::module_& m)
729729 .def (py::self == py::self)
730730 .def (py::self != py::self)
731731 ;
732-
733- // ============================================================================================ yup::PixelARGB
734-
735- py::class_<PixelARGB> classPixelARGB (m, "PixelARGB");
736-
737- classPixelARGB
738- .def (py::init<>())
739- .def (py::init<uint8, uint8, uint8, uint8>())
740- .def ("getNativeARGB", &PixelARGB::getNativeARGB)
741- .def ("getInARGBMaskOrder", &PixelARGB::getInARGBMaskOrder)
742- .def ("getInARGBMemoryOrder", &PixelARGB::getInARGBMemoryOrder)
743- .def ("getEvenBytes", &PixelARGB::getEvenBytes)
744- .def ("getOddBytes", &PixelARGB::getOddBytes)
745- .def ("getAlpha", &PixelARGB::getAlpha)
746- .def ("getRed", &PixelARGB::getRed)
747- .def ("getGreen", &PixelARGB::getGreen)
748- .def ("getBlue", &PixelARGB::getBlue)
749- .def ("set", &PixelARGB::template set<PixelRGB>)
750- .def ("set", &PixelARGB::template set<PixelARGB>)
751- .def ("set", &PixelARGB::template set<PixelAlpha>)
752- .def ("setARGB", &PixelARGB::setARGB)
753- .def ("blend", static_cast<void (PixelARGB::*)(PixelRGB)> (&PixelARGB::blend))
754- .def ("blend", py::overload_cast<const PixelARGB&> (&PixelARGB::template blend<PixelARGB>))
755- .def ("blend", py::overload_cast<const PixelAlpha&> (&PixelARGB::template blend<PixelAlpha>))
756- .def ("blend", py::overload_cast<const PixelRGB&, uint32> (&PixelARGB::template blend<PixelRGB>))
757- .def ("blend", py::overload_cast<const PixelARGB&, uint32> (&PixelARGB::template blend<PixelARGB>))
758- .def ("blend", py::overload_cast<const PixelAlpha&, uint32> (&PixelARGB::template blend<PixelAlpha>))
759- .def ("tween", py::overload_cast<const PixelRGB&, uint32> (&PixelARGB::template tween<PixelRGB>))
760- .def ("tween", py::overload_cast<const PixelARGB&, uint32> (&PixelARGB::template tween<PixelARGB>))
761- .def ("tween", py::overload_cast<const PixelAlpha&, uint32> (&PixelARGB::template tween<PixelAlpha>))
762- .def ("setAlpha", &PixelARGB::setAlpha)
763- .def ("multiplyAlpha", py::overload_cast<int> (&PixelARGB::multiplyAlpha))
764- .def ("multiplyAlpha", py::overload_cast<float> (&PixelARGB::multiplyAlpha))
765- .def ("getUnpremultiplied", &PixelARGB::getUnpremultiplied)
766- .def ("premultiply", &PixelARGB::premultiply)
767- .def ("unpremultiply", &PixelARGB::unpremultiply)
768- .def ("desaturate", &PixelARGB::desaturate)
769- ;
770-
771- classPixelARGB.attr ("indexA") = py::int_ (static_cast<int> (PixelARGB::indexA));
772- classPixelARGB.attr ("indexR") = py::int_ (static_cast<int> (PixelARGB::indexR));
773- classPixelARGB.attr ("indexG") = py::int_ (static_cast<int> (PixelARGB::indexG));
774- classPixelARGB.attr ("indexB") = py::int_ (static_cast<int> (PixelARGB::indexB));
775-
776- py::class_<PixelRGB> classPixelRGB (m, "PixelRGB");
777-
778- classPixelRGB
779- .def (py::init<>())
780- .def (py::init ([](uint8 red, uint8 green, uint8 blue)
781- {
782- auto c = PixelRGB();
783- c.setARGB (255, red, green, blue);
784- return c;
785- }))
786- .def ("getNativeARGB", &PixelRGB::getNativeARGB)
787- .def ("getInARGBMaskOrder", &PixelRGB::getInARGBMaskOrder)
788- .def ("getInARGBMemoryOrder", &PixelRGB::getInARGBMemoryOrder)
789- .def ("getEvenBytes", &PixelRGB::getEvenBytes)
790- .def ("getOddBytes", &PixelRGB::getOddBytes)
791- .def ("getAlpha", &PixelRGB::getAlpha)
792- .def ("getRed", &PixelRGB::getRed)
793- .def ("getGreen", &PixelRGB::getGreen)
794- .def ("getBlue", &PixelRGB::getBlue)
795- .def ("set", &PixelRGB::template set<PixelRGB>)
796- .def ("set", &PixelRGB::template set<PixelARGB>)
797- .def ("set", &PixelRGB::template set<PixelAlpha>)
798- .def ("setARGB", &PixelRGB::setARGB)
799- .def ("blend", static_cast<void (PixelRGB::*)(PixelRGB)> (&PixelRGB::blend))
800- .def ("blend", py::overload_cast<const PixelARGB&> (&PixelRGB::template blend<PixelARGB>))
801- .def ("blend", py::overload_cast<const PixelAlpha&> (&PixelRGB::template blend<PixelAlpha>))
802- .def ("blend", py::overload_cast<const PixelRGB&, uint32> (&PixelRGB::template blend<PixelRGB>))
803- .def ("blend", py::overload_cast<const PixelARGB&, uint32> (&PixelRGB::template blend<PixelARGB>))
804- .def ("blend", py::overload_cast<const PixelAlpha&, uint32> (&PixelRGB::template blend<PixelAlpha>))
805- .def ("blend", py::overload_cast<const PixelRGB&, uint32> (&PixelRGB::template tween<PixelRGB>))
806- .def ("blend", py::overload_cast<const PixelARGB&, uint32> (&PixelRGB::template tween<PixelARGB>))
807- .def ("blend", py::overload_cast<const PixelAlpha&, uint32> (&PixelRGB::template tween<PixelAlpha>))
808- .def ("tween", py::overload_cast<const PixelRGB&, uint32> (&PixelRGB::template tween<PixelRGB>))
809- .def ("tween", py::overload_cast<const PixelARGB&, uint32> (&PixelRGB::template tween<PixelARGB>))
810- .def ("tween", py::overload_cast<const PixelAlpha&, uint32> (&PixelRGB::template tween<PixelAlpha>))
811- .def ("setAlpha", &PixelRGB::setAlpha)
812- .def ("multiplyAlpha", py::overload_cast<int> (&PixelRGB::multiplyAlpha))
813- .def ("multiplyAlpha", py::overload_cast<float> (&PixelRGB::multiplyAlpha))
814- .def ("premultiply", &PixelRGB::premultiply)
815- .def ("unpremultiply", &PixelRGB::unpremultiply)
816- .def ("desaturate", &PixelRGB::desaturate)
817- ;
818-
819- classPixelRGB.attr ("indexR") = py::int_ (static_cast<int> (PixelRGB::indexR));
820- classPixelRGB.attr ("indexG") = py::int_ (static_cast<int> (PixelRGB::indexG));
821- classPixelRGB.attr ("indexB") = py::int_ (static_cast<int> (PixelRGB::indexB));
822-
823- py::class_<PixelAlpha> classPixelAlpha (m, "PixelAlpha");
824-
825- classPixelAlpha
826- .def (py::init<>())
827- .def (py::init ([](uint8 alpha) { auto c = PixelAlpha(); c.setAlpha (alpha); return c; }))
828- .def ("getNativeARGB", &PixelAlpha::getNativeARGB)
829- .def ("getInARGBMaskOrder", &PixelAlpha::getInARGBMaskOrder)
830- .def ("getInARGBMemoryOrder", &PixelAlpha::getInARGBMemoryOrder)
831- .def ("getEvenBytes", &PixelAlpha::getEvenBytes)
832- .def ("getOddBytes", &PixelAlpha::getOddBytes)
833- .def ("getAlpha", &PixelAlpha::getAlpha)
834- .def ("getRed", &PixelAlpha::getRed)
835- .def ("getGreen", &PixelAlpha::getGreen)
836- .def ("getBlue", &PixelAlpha::getBlue)
837- .def ("set", &PixelAlpha::template set<PixelRGB>)
838- .def ("set", &PixelAlpha::template set<PixelARGB>)
839- .def ("set", &PixelAlpha::template set<PixelAlpha>)
840- .def ("setARGB", &PixelAlpha::setARGB)
841- .def ("blend", py::overload_cast<const PixelRGB&> (&PixelAlpha::template blend<PixelRGB>))
842- .def ("blend", py::overload_cast<const PixelARGB&> (&PixelAlpha::template blend<PixelARGB>))
843- .def ("blend", py::overload_cast<const PixelAlpha&> (&PixelAlpha::template blend<PixelAlpha>))
844- .def ("blend", py::overload_cast<const PixelRGB&, uint32> (&PixelAlpha::template blend<PixelRGB>))
845- .def ("blend", py::overload_cast<const PixelARGB&, uint32> (&PixelAlpha::template blend<PixelARGB>))
846- .def ("blend", py::overload_cast<const PixelAlpha&, uint32> (&PixelAlpha::template blend<PixelAlpha>))
847- .def ("blend", py::overload_cast<const PixelRGB&, uint32> (&PixelAlpha::template tween<PixelRGB>))
848- .def ("blend", py::overload_cast<const PixelARGB&, uint32> (&PixelAlpha::template tween<PixelARGB>))
849- .def ("blend", py::overload_cast<const PixelAlpha&, uint32> (&PixelAlpha::template tween<PixelAlpha>))
850- .def ("tween", py::overload_cast<const PixelRGB&, uint32> (&PixelAlpha::template tween<PixelRGB>))
851- .def ("tween", py::overload_cast<const PixelARGB&, uint32> (&PixelAlpha::template tween<PixelARGB>))
852- .def ("tween", py::overload_cast<const PixelAlpha&, uint32> (&PixelAlpha::template tween<PixelAlpha>))
853- .def ("setAlpha", &PixelAlpha::setAlpha)
854- .def ("multiplyAlpha", py::overload_cast<int> (&PixelAlpha::multiplyAlpha))
855- .def ("multiplyAlpha", py::overload_cast<float> (&PixelAlpha::multiplyAlpha))
856- .def ("premultiply", &PixelAlpha::premultiply)
857- .def ("unpremultiply", &PixelAlpha::unpremultiply)
858- .def ("desaturate", &PixelAlpha::desaturate)
859- ;
860-
861- classPixelAlpha.attr ("indexA") = py::int_ (static_cast<int> (PixelAlpha::indexA));
862732 */
863733
864734 // ============================================================================================ yup::Color
@@ -1467,17 +1337,42 @@ void registerYupGraphicsBindings (py::module_& m)
14671337 .def (py::init<const Image&, Point<int>, const RectangleList<int>&>(), "imageToRenderOnto"_a, "origin"_a, "initialClip"_a)
14681338 ;
14691339
1340+ */
1341+
14701342 // ============================================================================================ yup::Graphics
14711343
14721344 py::class_<Graphics> classGraphics (m, " Graphics" );
14731345
1474- py::enum_<Graphics::ResamplingQuality> (classGraphics, "ResamplingQuality")
1475- .value("lowResamplingQuality", Graphics::ResamplingQuality::lowResamplingQuality)
1476- .value("mediumResamplingQuality", Graphics::ResamplingQuality::mediumResamplingQuality)
1477- .value("highResamplingQuality", Graphics::ResamplingQuality::highResamplingQuality)
1478- .export_values();
1479-
14801346 classGraphics
1347+ .def (" setFillColor" , &Graphics::setFillColor)
1348+ .def (" getFillColor" , &Graphics::getFillColor)
1349+ .def (" setStrokeColor" , &Graphics::setStrokeColor)
1350+ .def (" getStrokeColor" , &Graphics::getStrokeColor)
1351+ .def (" setFillColorGradient" , &Graphics::setFillColorGradient)
1352+ .def (" getFillColorGradient" , &Graphics::getFillColorGradient)
1353+ .def (" setStrokeColorGradient" , &Graphics::setStrokeColorGradient)
1354+ .def (" getStrokeColorGradient" , &Graphics::getStrokeColorGradient)
1355+ .def (" setStrokeWidth" , &Graphics::setStrokeWidth)
1356+ .def (" getStrokeWidth" , &Graphics::getStrokeWidth)
1357+ .def (" setFeather" , &Graphics::setFeather)
1358+ .def (" getFeather" , &Graphics::getFeather)
1359+ .def (" setOpacity" , &Graphics::setOpacity)
1360+ .def (" getOpacity" , &Graphics::getOpacity)
1361+ .def (" setStrokeJoin" , &Graphics::setStrokeJoin)
1362+ .def (" getStrokeJoin" , &Graphics::getStrokeJoin)
1363+ .def (" setStrokeCap" , &Graphics::setStrokeCap)
1364+ .def (" getStrokeCap" , &Graphics::getStrokeCap)
1365+ .def (" setBlendMode" , &Graphics::setBlendMode)
1366+ .def (" getBlendMode" , &Graphics::getBlendMode)
1367+ .def (" setDrawingArea" , &Graphics::setDrawingArea)
1368+ .def (" getDrawingArea" , &Graphics::getDrawingArea)
1369+ .def (" setTransform" , &Graphics::setTransform)
1370+ .def (" getTransform" , &Graphics::getTransform)
1371+ .def (" setClipPath" , py::overload_cast<const Rectangle<float >&> (&Graphics::setClipPath))
1372+ .def (" setClipPath" , py::overload_cast<const Path&> (&Graphics::setClipPath))
1373+ .def (" getClipPath" , &Graphics::getClipPath)
1374+ .def (" fillAll" , &Graphics::fillAll)
1375+ /*
14811376 .def (py::init<const Image&>())
14821377 .def (py::init<LowLevelGraphicsContext&>())
14831378 .def ("setColor", &Graphics::setColor)
@@ -1616,37 +1511,36 @@ void registerYupGraphicsBindings (py::module_& m)
16161511 .def ("addTransform", &Graphics::addTransform)
16171512 .def ("resetToDefaultState", &Graphics::resetToDefaultState)
16181513 .def ("isVectorDevice", &Graphics::isVectorDevice)
1514+ */
16191515 ;
16201516
1621- struct PyGraphicsScopedSaveState
1517+ struct PyGraphicsSaveState
16221518 {
1623- PyGraphicsScopedSaveState (Graphics& g)
1519+ PyGraphicsSaveState (Graphics& g)
16241520 : g (g)
16251521 {
16261522 }
16271523
16281524 Graphics& g;
1629- std::variant<std::monostate, Graphics::ScopedSaveState > state;
1525+ std::variant<std::monostate, Graphics::SavedState > state;
16301526 };
16311527
1632- py::class_<PyGraphicsScopedSaveState > (classGraphics, "ScopedSaveState ")
1528+ py::class_<PyGraphicsSaveState > (classGraphics, " SavedState " )
16331529 .def (py::init<Graphics&>())
1634- .def ("__enter__", [](PyGraphicsScopedSaveState & self)
1530+ .def (" __enter__" , [](PyGraphicsSaveState & self)
16351531 {
1636- self.state.emplace<Graphics::ScopedSaveState > (self.g);
1532+ self.state .emplace <Graphics::SavedState > (self.g . saveState () );
16371533 })
1638- .def ("__exit__", [](PyGraphicsScopedSaveState & self, const std::optional<py::type>&, const std::optional<py::object>&, const std::optional<py::object>&)
1534+ .def (" __exit__" , [](PyGraphicsSaveState & self, const std::optional<py::type>&, const std::optional<py::object>&, const std::optional<py::object>&)
16391535 {
16401536 self.state .emplace <std::monostate>();
16411537 })
16421538 ;
16431539
1644- */
1645-
16461540 // ============================================================================================ yup::Colors
16471541
16481542 auto submoduleColors = m.def_submodule (" Colors" );
1649- // submoduleColors.def ("findColorForName ", &Colors::findColorForName );
1543+ submoduleColors.def (" getNamedColor " , &Colors::getNamedColor );
16501544 submoduleColors.attr (" transparentBlack" ) = Colors::transparentBlack;
16511545 submoduleColors.attr (" transparentWhite" ) = Colors::transparentWhite;
16521546 submoduleColors.attr (" aliceblue" ) = Colors::aliceblue;
0 commit comments