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 }
IntelliTool::onMouseRightPressed
virtual void onMouseRightPressed(int x, int y)
Definition: IntelliTool.cpp:14
IntelliTool::onMouseLeftReleased
virtual void onMouseLeftReleased(int x, int y)
Definition: IntelliTool.cpp:32
IntelliTool::colorPicker
IntelliColorPicker * colorPicker
Definition: IntelliTool.h:17
IntelliImage::drawLine
virtual void drawLine(const QPoint &p1, const QPoint &p2, const QColor &color, const int &penWidth)
Definition: IntelliImage.cpp:55
IntelliTool::onMouseLeftPressed
virtual void onMouseLeftPressed(int x, int y)
Definition: IntelliTool.cpp:25
IntelliToolPen::~IntelliToolPen
virtual ~IntelliToolPen() override
Definition: IntelliToolPen.cpp:12
IntelliImage::drawPixel
virtual void drawPixel(const QPoint &p1, const QColor &color)
Definition: IntelliImage.cpp:44
IntelliToolPen::onMouseMoved
virtual void onMouseMoved(int x, int y) override
Definition: IntelliToolPen.cpp:35
IntelliToolPen::onMouseRightPressed
virtual void onMouseRightPressed(int x, int y) override
Definition: IntelliToolPen.cpp:16
IntelliToolPen::onMouseRightReleased
virtual void onMouseRightReleased(int x, int y) override
Definition: IntelliToolPen.cpp:20
PaintingArea
Definition: PaintingArea.h:28
IntelliTool::onMouseRightReleased
virtual void onMouseRightReleased(int x, int y)
Definition: IntelliTool.cpp:21
IntelliTool::Canvas
LayerObject * Canvas
Definition: IntelliTool.h:20
IntelliTool::drawing
bool drawing
Definition: IntelliTool.h:21
IntelliTool
Definition: IntelliTool.h:10
IntelliToolPen::onMouseLeftReleased
virtual void onMouseLeftReleased(int x, int y) override
Definition: IntelliToolPen.cpp:31
PaintingArea.h
IntelliColorPicker::getFirstColor
QColor getFirstColor()
Definition: IntelliColorPicker.cpp:16
IntelliColorPicker
Definition: IntelliColorPicker.h:8
LayerObject::image
IntelliImage * image
Definition: PaintingArea.h:18
IntelliToolPen.h
IntelliTool::onMouseMoved
virtual void onMouseMoved(int x, int y)
Definition: IntelliTool.cpp:41
IntelliToolPen::onMouseLeftPressed
virtual void onMouseLeftPressed(int x, int y) override
Definition: IntelliToolPen.cpp:24
IntelliImage::calculateVisiblity
virtual void calculateVisiblity()=0
IntelliToolPen::IntelliToolPen
IntelliToolPen(PaintingArea *Area, IntelliColorPicker *colorPicker)
Definition: IntelliToolPen.cpp:7