IntelliPhoto  0.4
IntelliToolPen.cpp
Go to the documentation of this file.
1 #include "IntelliToolPen.h"
2 #include "Layer/PaintingArea.h"
3 #include "QDebug"
4 #include "QColorDialog"
5 #include "QInputDialog"
6 
8  :IntelliTool(Area, colorPicker){
9  this->penWidth = QInputDialog::getInt(nullptr, "Pen width", "Width:", 1,0, 50, 1);
10 }
11 
13 
14 }
15 
18 }
19 
22 }
23 
26  this->point=QPoint(x,y);
27  this->Canvas->image->drawPixel(point, colorPicker->getFirstColor());
29 }
30 
33 }
34 
35 void IntelliToolPen::onMouseMoved(int x, int y){
36  if(this->drawing){
37  QPoint newPoint(x,y);
38  this->Canvas->image->drawLine(this->point, newPoint, colorPicker->getFirstColor(), penWidth);
39  this->point=newPoint;
40  }
42 }
43 
46  this->penWidth+=value;
47  if(this->penWidth<=0){
48  this->penWidth=1;
49  }
50 }
IntelliTool::onMouseRightPressed
virtual void onMouseRightPressed(int x, int y)
A function managing the right click Pressed of a Mouse. Constructing the Canvas to draw on....
Definition: IntelliTool.cpp:14
IntelliTool::onMouseLeftReleased
virtual void onMouseLeftReleased(int x, int y)
A function managing the left click Released of a Mouse. Call this in child classes!
Definition: IntelliTool.cpp:32
IntelliTool::colorPicker
IntelliColorPicker * colorPicker
A pointer to the IntelliColorPicker of the PaintingArea to interact with, and get the colors.
Definition: IntelliTool.h:38
IntelliImage::drawLine
virtual void drawLine(const QPoint &p1, const QPoint &p2, const QColor &color, const int &penWidth)
A function that draws A Line between two given Points in a given color.
Definition: IntelliImage.cpp:65
IntelliTool::onMouseLeftPressed
virtual void onMouseLeftPressed(int x, int y)
A function managing the left click Pressed of a Mouse. Resetting the current draw....
Definition: IntelliTool.cpp:25
IntelliToolPen::~IntelliToolPen
virtual ~IntelliToolPen() override
Definition: IntelliToolPen.cpp:12
IntelliImage::drawPixel
virtual void drawPixel(const QPoint &p1, const QColor &color)
A funtcion used to draw a pixel on the Image with the given Color.
Definition: IntelliImage.cpp:44
IntelliToolPen::onMouseMoved
virtual void onMouseMoved(int x, int y) override
A function managing the mouse moved event. Call this in child classes!
Definition: IntelliToolPen.cpp:35
IntelliToolPen::onMouseRightPressed
virtual void onMouseRightPressed(int x, int y) override
A function managing the right click Pressed of a Mouse. Constructing the Canvas to draw on....
Definition: IntelliToolPen.cpp:16
IntelliToolPen::onMouseRightReleased
virtual void onMouseRightReleased(int x, int y) override
A function managing the right click Released of a Mouse. Merging the Canvas to Active....
Definition: IntelliToolPen.cpp:20
PaintingArea
Definition: PaintingArea.h:26
IntelliTool::onMouseRightReleased
virtual void onMouseRightReleased(int x, int y)
A function managing the right click Released of a Mouse. Merging the Canvas to Active....
Definition: IntelliTool.cpp:21
IntelliTool::Canvas
LayerObject * Canvas
A pointer to the drawing canvas of the tool, work on this.
Definition: IntelliTool.h:48
IntelliToolPen::onWheelScrolled
virtual void onWheelScrolled(int value) override
A function managing the scroll event. A Positive Value means scrolling outwards. Call this in child c...
Definition: IntelliToolPen.cpp:44
IntelliTool::drawing
bool drawing
A flag checking if the user is currently drawing or not.
Definition: IntelliTool.h:53
IntelliTool
An abstract class that manages the basic events, like mouse clicks or scrolls events.
Definition: IntelliTool.h:13
IntelliToolPen::onMouseLeftReleased
virtual void onMouseLeftReleased(int x, int y) override
A function managing the left click Released of a Mouse. Call this in child classes!
Definition: IntelliToolPen.cpp:31
PaintingArea.h
IntelliColorPicker::getFirstColor
QColor getFirstColor()
A function to read the primary selected color.
Definition: IntelliColorPicker.cpp:16
IntelliColorPicker
The IntelliColorPicker manages the selected colors for one whole project.
Definition: IntelliColorPicker.h:11
LayerObject::image
IntelliImage * image
Definition: PaintingArea.h:18
IntelliToolPen.h
IntelliTool::onMouseMoved
virtual void onMouseMoved(int x, int y)
A function managing the mouse moved event. Call this in child classes!
Definition: IntelliTool.cpp:41
IntelliToolPen::onMouseLeftPressed
virtual void onMouseLeftPressed(int x, int y) override
A function managing the left click Pressed of a Mouse. Resetting the current draw....
Definition: IntelliToolPen.cpp:24
IntelliImage::calculateVisiblity
virtual void calculateVisiblity()=0
An abstract function that calculates the visiblity of the Image data if needed.
IntelliTool::onWheelScrolled
virtual void onWheelScrolled(int value)
A function managing the scroll event. A Positive Value means scrolling outwards. Call this in child c...
Definition: IntelliTool.cpp:46
IntelliToolPen::IntelliToolPen
IntelliToolPen(PaintingArea *Area, IntelliColorPicker *colorPicker)
Definition: IntelliToolPen.cpp:7