Ver Fonte

PixelPaint: Add fill mode for the ellipse tool

Functionality was already there, just had to hook it up!
Valtteri Koskivuori há 4 anos atrás
pai
commit
4e6f03a860

+ 6 - 0
Userland/Applications/PixelPaint/EllipseTool.cpp

@@ -29,6 +29,9 @@ void EllipseTool::draw_using(GUI::Painter& painter, const Gfx::IntRect& ellipse_
     case Mode::Outline:
         painter.draw_ellipse_intersecting(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button), m_thickness);
         break;
+    case Mode::Fill:
+        painter.fill_ellipse(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button));
+        break;
     default:
         VERIFY_NOT_REACHED();
     }
@@ -96,6 +99,9 @@ void EllipseTool::on_tool_button_contextmenu(GUI::ContextMenuEvent& event)
         m_context_menu->add_action(GUI::Action::create("Outline", [this](auto&) {
             m_mode = Mode::Outline;
         }));
+        m_context_menu->add_action(GUI::Action::create("Fill", [this](auto&) {
+            m_mode = Mode::Fill;
+        }));
         m_context_menu->add_separator();
         m_thickness_actions.set_exclusive(true);
         auto insert_action = [&](int size, bool checked = false) {

+ 1 - 1
Userland/Applications/PixelPaint/EllipseTool.h

@@ -27,7 +27,7 @@ public:
 private:
     enum class Mode {
         Outline,
-        // FIXME: Add Mode::Fill
+        Fill,
     };
 
     void draw_using(GUI::Painter&, const Gfx::IntRect&);