diff --git a/src/Tool/IntelliTool.h b/src/Tool/IntelliTool.h index 5225a7a..6ef8631 100644 --- a/src/Tool/IntelliTool.h +++ b/src/Tool/IntelliTool.h @@ -56,7 +56,7 @@ public: /*! * \brief A constructor setting the general Painting Area and colorPicker. * \param Area - The general PaintingArea used by the project. - * \param colorPicker - The general colorPicker used by the project + * \param colorPicker - The general colorPicker used by the project. */ IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker); diff --git a/src/Tool/IntelliTool.h.autosave b/src/Tool/IntelliTool.h.autosave deleted file mode 100644 index 6ef8631..0000000 --- a/src/Tool/IntelliTool.h.autosave +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef Intelli_Tool_H -#define Intelli_Tool_H - -#include "IntelliHelper/IntelliColorPicker.h" -#include - -class LayerObject; -class PaintingArea; - -/*! - * \brief An abstract class that manages the basic events, like mouse clicks or scrolls events. - */ -class IntelliTool{ -private: - /*! - * \brief A function that creates a layer to draw on. - */ - void createToolLayer(); - - /*! - * \brief A function that merges the drawing- and the active- layer. - */ - void mergeToolLayer(); - - /*! - * \brief A function that deletes the drawinglayer. - */ - void deleteToolLayer(); -protected: - /*! - * \brief A pointer to the general PaintingArea to interact with. - */ - PaintingArea* Area; - - /*! - * \brief A pointer to the IntelliColorPicker of the PaintingArea to interact with, and get the colors. - */ - IntelliColorPicker* colorPicker; - - /*! - * \brief A pointer to the underlying active Layer, do not work on this. This is used for data grabbing or previews. - */ - LayerObject* Active; - - /*! - * \brief A pointer to the drawing canvas of the tool, work on this. - */ - LayerObject* Canvas; - - /*! - * \brief A flag checking if the user is currently drawing or not. - */ - bool drawing = false; - -public: - /*! - * \brief A constructor setting the general Painting Area and colorPicker. - * \param Area - The general PaintingArea used by the project. - * \param colorPicker - The general colorPicker used by the project. - */ - IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker); - - /*! - * \brief An abstract Destructor. - */ - virtual ~IntelliTool() = 0; - - /*! - * \brief A function managing the right click Pressed of a Mouse. Constructing the Canvas to draw on. Call this in child classes! - * \param x - The x coordinate relative to the Active/Canvas Layer. - * \param y - The y coordinate relative to the Active/Canvas Layer. - */ - virtual void onMouseRightPressed(int x, int y); - - /*! - * \brief A function managing the right click Released of a Mouse. Merging the Canvas to Active. Call this in child classes! - * \param x - The x coordinate relative to the Active/Canvas Layer. - * \param y - The y coordinate relative to the Active/Canvas Layer. - */ - virtual void onMouseRightReleased(int x, int y); - - /*! - * \brief A function managing the left click Pressed of a Mouse. Resetting the current draw. Call this in child classes! - * \param x - The x coordinate relative to the Active/Canvas Layer. - * \param y - The y coordinate relative to the Active/Canvas Layer. - */ - virtual void onMouseLeftPressed(int x, int y); - - /*! - * \brief A function managing the left click Released of a Mouse. Call this in child classes! - * \param x - The x coordinate relative to the Active/Canvas Layer. - * \param y - The y coordinate relative to the Active/Canvas Layer. - */ - virtual void onMouseLeftReleased(int x, int y); - - /*! - * \brief A function managing the scroll event. A Positive Value means scrolling outwards. Call this in child classes! - * \param value - The absolute the scroll has changed. - */ - virtual void onWheelScrolled(int value); - - /*! - * \brief A function managing the mouse moved event. Call this in child classes! - * \param x - The x coordinate of the new Mouse Position. - * \param y - The y coordinate of the new Mouse Position. - */ - virtual void onMouseMoved(int x, int y); - - -}; -#endif diff --git a/src/Tool/IntelliToolPen.h b/src/Tool/IntelliToolPen.h index 4bee026..25bc4d4 100644 --- a/src/Tool/IntelliToolPen.h +++ b/src/Tool/IntelliToolPen.h @@ -23,33 +23,36 @@ public: * \param colorPicker - The general colorPicker used by the project. */ IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker); + /*! + * \brief A Destructor. + */ virtual ~IntelliToolPen() override; /*! * \brief A function managing the right click pressed of a mouse.Resetting the current draw. - * \param x - The x coordinate relative to the active/canvas Layer. - * \param y - The y coordinate relative to the active/canvas Layer. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. */ virtual void onMouseRightPressed(int x, int y) override; /*! * \brief A function managing the right click released of a mouse. - * \param x - The x coordinate relative to the active/canvas Layer. - * \param y - The y coordinate relative to the active/canvas Layer. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. */ virtual void onMouseRightReleased(int x, int y) override; /*! * \brief A function managing the left click pressed of a mouse. Starting the drawing procedure. - * \param x - The x coordinate relative to the active/canvas Layer. - * \param y - The y coordinate relative to the active/canvas Layer. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. */ virtual void onMouseLeftPressed(int x, int y) override; /*! - * \brief A function managing the left click released of a mouse. Merging the drawing to the active layer.. - * \param x - The x coordinate relative to the active/canvas Layer. - * \param y - The y coordinate relative to the active/canvas Layer. + * \brief A function managing the left click released of a mouse. Merging the drawing to the active layer. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. */ virtual void onMouseLeftReleased(int x, int y) override; diff --git a/src/Tool/IntelliToolPlain.cpp b/src/Tool/IntelliToolPlain.cpp index 34e3c5f..b501386 100644 --- a/src/Tool/IntelliToolPlain.cpp +++ b/src/Tool/IntelliToolPlain.cpp @@ -6,6 +6,10 @@ IntelliToolPlainTool::IntelliToolPlainTool(PaintingArea* Area, IntelliColorPicke :IntelliTool(Area, colorPicker){ } +IntelliToolPlainTool::~IntelliToolPlainTool(){ + +} + void IntelliToolPlainTool::onMouseLeftPressed(int x, int y){ IntelliTool::onMouseLeftPressed(x,y); this->Canvas->image->drawPlain(colorPicker->getFirstColor()); diff --git a/src/Tool/IntelliToolPlain.h b/src/Tool/IntelliToolPlain.h index aad7633..b6380ed 100644 --- a/src/Tool/IntelliToolPlain.h +++ b/src/Tool/IntelliToolPlain.h @@ -3,18 +3,61 @@ #include "IntelliTool.h" #include "QColor" - +/*! + * \brief The IntelliToolPlainTool class represents a tool to fill the whole canvas with one color. + */ class IntelliToolPlainTool : public IntelliTool{ public: + /*! + * \brief A constructor setting the general paintingArea and colorPicker. + * \param Area - The general paintingArea used by the project. + * \param colorPicker - The general colorPicker used by the project. + */ IntelliToolPlainTool(PaintingArea *Area, IntelliColorPicker* colorPicker); + /*! + * \brief A Destructor. + */ + virtual ~IntelliToolPlainTool() override; - virtual void onMouseLeftPressed(int x, int y) override; - virtual void onMouseLeftReleased(int x, int y) override; + /*! + * \brief A function managing the right click pressed of a mouse.Resetting the current fill. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. + */ virtual void onMouseRightPressed(int x, int y) override; + + /*! + * \brief A function managing the right click released of a mouse. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. + */ virtual void onMouseRightReleased(int x, int y) override; + /*! + * \brief A function managing the left click pressed of a mouse. Filling the whole canvas. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. + */ + virtual void onMouseLeftPressed(int x, int y) override; + + /*! + * \brief A function managing the left click released of a mouse. Merging the fill to the active layer. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. + */ + virtual void onMouseLeftReleased(int x, int y) override; + + /*! + * \brief A function managing the scroll event. + * \param value - The absolute the scroll has changed. + */ virtual void onWheelScrolled(int value) override; + /*! + * \brief A function managing the mouse moved event. + * \param x - The x coordinate of the new mouse position. + * \param y - The y coordinate of the new mouse position. + */ virtual void onMouseMoved(int x, int y) override; }; diff --git a/src/Tool/IntelliToolRectangle.h b/src/Tool/IntelliToolRectangle.h index 2b59629..249e146 100644 --- a/src/Tool/IntelliToolRectangle.h +++ b/src/Tool/IntelliToolRectangle.h @@ -5,24 +5,79 @@ #include "QColor" #include "QPoint" - +/*! + * \brief The IntelliToolRectangle class represents a tool to draw a rectangle. + */ class IntelliToolRectangle : public IntelliTool{ + /*! + * \brief A function that implements a rectagle drawing algorithm. + * \param otherCornor - The second corner point of the rectangle. + */ void drawRectangle(QPoint otherCornor); + /*! + * \brief originCornor - The first corner point of the rectangle. + */ QPoint originCornor; + /*! + * \brief alphaInner- Represents the alpha value of the inside. + */ int alphaInner; + /*! + * \brief edgeWidth - The width of the rectangle edges. + */ int edgeWidth; public: + /*! + * \brief A constructor setting the general paintingArea and colorPicker. And reading in the alphaInner and edgeWidth. + * \param Area - The general paintingArea used by the project. + * \param colorPicker - The general colorPicker used by the project. + */ IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker); + /*! + * \brief A Destructor. + */ virtual ~IntelliToolRectangle() override; + /*! + * \brief A function managing the right click pressed of a mouse.Resetting the current draw. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. + */ virtual void onMouseRightPressed(int x, int y) override; + + /*! + * \brief A function managing the right click released of a mouse. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. + */ virtual void onMouseRightReleased(int x, int y) override; + + /*! + * \brief A function managing the left click pressed of a mouse. Setting the originCorner and draws a rectangle. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. + */ virtual void onMouseLeftPressed(int x, int y) override; + + /*! + * \brief A function managing the left click released of a mouse. Merging the draw to the active layer. + * \param x - The x coordinate relative to the active/canvas layer. + * \param y - The y coordinate relative to the active/canvas layer. + */ virtual void onMouseLeftReleased(int x, int y) override; + /*! + * \brief A function managing the scroll event.Changing edgeWidth relativ to value. + * \param value - The absolute the scroll has changed. + */ virtual void onWheelScrolled(int value) override; + /*! + * \brief A function managing the mouse moved event.Drawing a rectangle to currrent mouse position. + * \param x - The x coordinate of the new mouse position. + * \param y - The y coordinate of the new mouse position. + */ virtual void onMouseMoved(int x, int y) override; };