mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-16 05:10:32 +02:00
Adding doc for Plain/Rectangle/Pen Tool, and also some update to Plaintool
This commit is contained in:
@@ -56,7 +56,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief A constructor setting the general Painting Area and colorPicker.
|
* \brief A constructor setting the general Painting Area and colorPicker.
|
||||||
* \param Area - The general PaintingArea used by the project.
|
* \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);
|
IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||||
|
|
||||||
|
|||||||
@@ -1,111 +0,0 @@
|
|||||||
#ifndef Intelli_Tool_H
|
|
||||||
#define Intelli_Tool_H
|
|
||||||
|
|
||||||
#include "IntelliHelper/IntelliColorPicker.h"
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -23,33 +23,36 @@ public:
|
|||||||
* \param colorPicker - The general colorPicker used by the project.
|
* \param colorPicker - The general colorPicker used by the project.
|
||||||
*/
|
*/
|
||||||
IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||||
|
/*!
|
||||||
|
* \brief A Destructor.
|
||||||
|
*/
|
||||||
virtual ~IntelliToolPen() override;
|
virtual ~IntelliToolPen() override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief A function managing the right click pressed of a mouse.Resetting the current draw.
|
* \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 x - The x coordinate relative to the active/canvas layer.
|
||||||
* \param y - The y 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;
|
virtual void onMouseRightPressed(int x, int y) override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief A function managing the right click released of a mouse.
|
* \brief A function managing the right click released of a mouse.
|
||||||
* \param x - The x 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.
|
* \param y - The y coordinate relative to the active/canvas layer.
|
||||||
*/
|
*/
|
||||||
virtual void onMouseRightReleased(int x, int y) override;
|
virtual void onMouseRightReleased(int x, int y) override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief A function managing the left click pressed of a mouse. Starting the drawing procedure.
|
* \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 x - The x coordinate relative to the active/canvas layer.
|
||||||
* \param y - The y 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;
|
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..
|
* \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 x - The x coordinate relative to the active/canvas layer.
|
||||||
* \param y - The y 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;
|
virtual void onMouseLeftReleased(int x, int y) override;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ IntelliToolPlainTool::IntelliToolPlainTool(PaintingArea* Area, IntelliColorPicke
|
|||||||
:IntelliTool(Area, colorPicker){
|
:IntelliTool(Area, colorPicker){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IntelliToolPlainTool::~IntelliToolPlainTool(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void IntelliToolPlainTool::onMouseLeftPressed(int x, int y){
|
void IntelliToolPlainTool::onMouseLeftPressed(int x, int y){
|
||||||
IntelliTool::onMouseLeftPressed(x,y);
|
IntelliTool::onMouseLeftPressed(x,y);
|
||||||
this->Canvas->image->drawPlain(colorPicker->getFirstColor());
|
this->Canvas->image->drawPlain(colorPicker->getFirstColor());
|
||||||
|
|||||||
@@ -3,18 +3,61 @@
|
|||||||
|
|
||||||
#include "IntelliTool.h"
|
#include "IntelliTool.h"
|
||||||
#include "QColor"
|
#include "QColor"
|
||||||
|
/*!
|
||||||
|
* \brief The IntelliToolPlainTool class represents a tool to fill the whole canvas with one color.
|
||||||
|
*/
|
||||||
class IntelliToolPlainTool : public IntelliTool{
|
class IntelliToolPlainTool : public IntelliTool{
|
||||||
public:
|
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);
|
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;
|
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;
|
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;
|
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;
|
virtual void onMouseMoved(int x, int y) override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,24 +5,79 @@
|
|||||||
|
|
||||||
#include "QColor"
|
#include "QColor"
|
||||||
#include "QPoint"
|
#include "QPoint"
|
||||||
|
/*!
|
||||||
|
* \brief The IntelliToolRectangle class represents a tool to draw a rectangle.
|
||||||
|
*/
|
||||||
class IntelliToolRectangle : public IntelliTool{
|
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);
|
void drawRectangle(QPoint otherCornor);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief originCornor - The first corner point of the rectangle.
|
||||||
|
*/
|
||||||
QPoint originCornor;
|
QPoint originCornor;
|
||||||
|
/*!
|
||||||
|
* \brief alphaInner- Represents the alpha value of the inside.
|
||||||
|
*/
|
||||||
int alphaInner;
|
int alphaInner;
|
||||||
|
/*!
|
||||||
|
* \brief edgeWidth - The width of the rectangle edges.
|
||||||
|
*/
|
||||||
int edgeWidth;
|
int edgeWidth;
|
||||||
public:
|
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);
|
IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||||
|
/*!
|
||||||
|
* \brief A Destructor.
|
||||||
|
*/
|
||||||
virtual ~IntelliToolRectangle() override;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
virtual void onMouseMoved(int x, int y) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user