From 52a72c05c5708d69e10ad04807e317bbacaad539 Mon Sep 17 00:00:00 2001 From: AshBastian Date: Wed, 8 Jan 2020 15:47:16 +0100 Subject: [PATCH] ToolSettings --- src/Image/IntelliImage.h | 2 +- src/Image/IntelliShapedImage.cpp | 6 ++-- src/IntelliHelper/IntelliToolsettings.cpp | 19 +++++++++++++ src/IntelliHelper/IntelliToolsettings.h | 24 ++++++++++++++++ ...lliHelper.cpp => IntelliTriangulation.cpp} | 8 +++--- ...IntelliHelper.h => IntelliTriangulation.h} | 12 ++++---- src/IntelliPhoto.pro | 6 ++-- src/Layer/PaintingArea.cpp | 28 +++++++++---------- src/Layer/PaintingArea.h | 1 + src/Tool/IntelliTool.cpp | 3 +- src/Tool/IntelliTool.h | 5 +++- src/Tool/IntelliToolCircle.cpp | 4 +-- src/Tool/IntelliToolCircle.h | 2 +- src/Tool/IntelliToolFloodFill.cpp | 4 +-- src/Tool/IntelliToolFloodFill.h | 2 +- src/Tool/IntelliToolLine.cpp | 12 ++++---- src/Tool/IntelliToolLine.h | 15 +--------- src/Tool/IntelliToolPen.cpp | 4 +-- src/Tool/IntelliToolPen.h | 2 +- src/Tool/IntelliToolPlain.cpp | 4 +-- src/Tool/IntelliToolPlain.h | 2 +- src/Tool/IntelliToolPolygon.cpp | 12 ++++---- src/Tool/IntelliToolPolygon.h | 4 +-- src/Tool/IntelliToolRectangle.cpp | 4 +-- src/Tool/IntelliToolRectangle.h | 2 +- src/main.cpp | 1 - 26 files changed, 111 insertions(+), 77 deletions(-) create mode 100644 src/IntelliHelper/IntelliToolsettings.cpp create mode 100644 src/IntelliHelper/IntelliToolsettings.h rename src/IntelliHelper/{IntelliHelper.cpp => IntelliTriangulation.cpp} (94%) rename src/IntelliHelper/{IntelliHelper.h => IntelliTriangulation.h} (87%) diff --git a/src/Image/IntelliImage.h b/src/Image/IntelliImage.h index 04315c3..43cc69a 100644 --- a/src/Image/IntelliImage.h +++ b/src/Image/IntelliImage.h @@ -8,7 +8,7 @@ #include #include -#include "IntelliHelper/IntelliHelper.h" +#include "IntelliHelper/IntelliTriangulation.h" class IntelliTool; diff --git a/src/Image/IntelliShapedImage.cpp b/src/Image/IntelliShapedImage.cpp index b61cb23..3bf94d5 100644 --- a/src/Image/IntelliShapedImage.cpp +++ b/src/Image/IntelliShapedImage.cpp @@ -1,5 +1,5 @@ #include "Image/IntelliShapedImage.h" -#include "IntelliHelper/IntelliHelper.h" +#include "IntelliHelper/IntelliTriangulation.h" #include #include #include @@ -42,7 +42,7 @@ void IntelliShapedImage::calculateVisiblity(){ for(int x=0; x& polygonData){ for(auto element:polygonData) { this->polygonData.push_back(QPoint(element.x(), element.y())); } - triangles = IntelliHelper::calculateTriangles(polygonData); + triangles = IntelliTriangulation::calculateTriangles(polygonData); } calculateVisiblity(); return; diff --git a/src/IntelliHelper/IntelliToolsettings.cpp b/src/IntelliHelper/IntelliToolsettings.cpp new file mode 100644 index 0000000..1685aed --- /dev/null +++ b/src/IntelliHelper/IntelliToolsettings.cpp @@ -0,0 +1,19 @@ +#include "IntelliToolsettings.h" + +IntelliToolsettings::IntelliToolsettings() +{ + lineWidth = 1; + innerAlpha = 255; +} + +int IntelliToolsettings::getLineWidth(){ + return lineWidth; +} + +int IntelliToolsettings::getInnerAlpha(){ + return innerAlpha; +} + +IntelliToolsettings::LineStyle IntelliToolsettings::getLinestyle(){ + return Linestyle; +} diff --git a/src/IntelliHelper/IntelliToolsettings.h b/src/IntelliHelper/IntelliToolsettings.h new file mode 100644 index 0000000..200a5f3 --- /dev/null +++ b/src/IntelliHelper/IntelliToolsettings.h @@ -0,0 +1,24 @@ +#ifndef INTELLITOOLSETTINGS_H +#define INTELLITOOLSETTINGS_H + +class IntelliToolsettings { +public: + /*! + * \brief The LineStyle enum classifing all ways of drawing a line. + */ + enum class LineStyle { + SOLID_LINE, + DOTTED_LINE + }; + IntelliToolsettings(); + int getLineWidth(); + int getInnerAlpha(); + LineStyle getLinestyle(); + +private: + int lineWidth; + int innerAlpha; + LineStyle Linestyle; +}; + +#endif // INTELLITOOLSETTINGS_H diff --git a/src/IntelliHelper/IntelliHelper.cpp b/src/IntelliHelper/IntelliTriangulation.cpp similarity index 94% rename from src/IntelliHelper/IntelliHelper.cpp rename to src/IntelliHelper/IntelliTriangulation.cpp index 867a139..55ddd9a 100644 --- a/src/IntelliHelper/IntelliHelper.cpp +++ b/src/IntelliHelper/IntelliTriangulation.cpp @@ -1,10 +1,10 @@ -#include "IntelliHelper.h" +#include "IntelliTriangulation.h" #include #include #include #define pi 3.1415926535897932384626433832795 -std::vector IntelliHelper::calculateTriangles(std::vector polyPoints){ +std::vector IntelliTriangulation::calculateTriangles(std::vector polyPoints){ // helper for managing the triangle vertices and their state struct TriangleHelper { QPoint vertex; @@ -113,9 +113,9 @@ std::vector IntelliHelper::calculateTriangles(std::vector poly return Triangles; } -bool IntelliHelper::isInPolygon(std::vector &triangles, QPoint &point){ +bool IntelliTriangulation::isInPolygon(std::vector &triangles, QPoint &point){ for(auto triangle : triangles) { - if(IntelliHelper::isInTriangle(triangle, point)) { + if(IntelliTriangulation::isInTriangle(triangle, point)) { return true; } } diff --git a/src/IntelliHelper/IntelliHelper.h b/src/IntelliHelper/IntelliTriangulation.h similarity index 87% rename from src/IntelliHelper/IntelliHelper.h rename to src/IntelliHelper/IntelliTriangulation.h index 2af1748..cbc6024 100644 --- a/src/IntelliHelper/IntelliHelper.h +++ b/src/IntelliHelper/IntelliTriangulation.h @@ -1,5 +1,5 @@ -#ifndef INTELLIHELPER_H -#define INTELLIHELPER_H +#ifndef INTELLITRIANGULATION_H +#define INTELLITRIANGULATION_H #include #include @@ -11,7 +11,7 @@ struct Triangle { QPoint A,B,C; }; -namespace IntelliHelper { +namespace IntelliTriangulation { /*! * \brief A function to get the 2*area of a traingle, using its determinat. @@ -34,9 +34,9 @@ inline bool isInTriangle(Triangle& tri, QPoint& P){ float val1, val2, val3; bool neg, pos; - val1 = IntelliHelper::sign(P,tri.A,tri.B); - val2 = IntelliHelper::sign(P,tri.B,tri.C); - val3 = IntelliHelper::sign(P,tri.C,tri.A); + val1 = IntelliTriangulation::sign(P,tri.A,tri.B); + val2 = IntelliTriangulation::sign(P,tri.B,tri.C); + val3 = IntelliTriangulation::sign(P,tri.C,tri.A); neg = (val1<0.f) || (val2<0.f) || (val3<0.f); pos = (val1>0.f) || (val2>0.f) || (val3>0.f); diff --git a/src/IntelliPhoto.pro b/src/IntelliPhoto.pro index fe7264d..9b8d9c0 100644 --- a/src/IntelliPhoto.pro +++ b/src/IntelliPhoto.pro @@ -21,7 +21,8 @@ SOURCES += \ Image/IntelliRasterImage.cpp \ Image/IntelliShapedImage.cpp \ IntelliHelper/IntelliColorPicker.cpp \ - IntelliHelper/IntelliHelper.cpp \ + IntelliHelper/IntelliToolsettings.cpp \ + IntelliHelper/IntelliTriangulation.cpp \ Layer/PaintingArea.cpp \ Tool/IntelliTool.cpp \ Tool/IntelliToolCircle.cpp \ @@ -39,7 +40,8 @@ HEADERS += \ Image/IntelliRasterImage.h \ Image/IntelliShapedImage.h \ IntelliHelper/IntelliColorPicker.h \ - IntelliHelper/IntelliHelper.h \ + IntelliHelper/IntelliToolsettings.h \ + IntelliHelper/IntelliTriangulation.h \ Layer/PaintingArea.h \ Tool/IntelliTool.h \ Tool/IntelliToolCircle.h \ diff --git a/src/Layer/PaintingArea.cpp b/src/Layer/PaintingArea.cpp index 82380ec..44da7aa 100644 --- a/src/Layer/PaintingArea.cpp +++ b/src/Layer/PaintingArea.cpp @@ -194,36 +194,36 @@ void PaintingArea::colorPickerSwapColors(){ void PaintingArea::createPenTool(){ delete this->Tool; - Tool = new IntelliToolPen(this, &colorPicker); + Tool = new IntelliToolPen(this, &colorPicker, &Toolsettings); } void PaintingArea::createPlainTool(){ delete this->Tool; - Tool = new IntelliToolPlainTool(this, &colorPicker); + Tool = new IntelliToolPlainTool(this, &colorPicker, &Toolsettings); } void PaintingArea::createLineTool(){ delete this->Tool; - Tool = new IntelliToolLine(this, &colorPicker); + Tool = new IntelliToolLine(this, &colorPicker, &Toolsettings); } void PaintingArea::createRectangleTool(){ delete this->Tool; - Tool = new IntelliToolRectangle(this, &colorPicker); + Tool = new IntelliToolRectangle(this, &colorPicker, &Toolsettings); } void PaintingArea::createCircleTool(){ delete this->Tool; - Tool = new IntelliToolCircle(this, &colorPicker); + Tool = new IntelliToolCircle(this, &colorPicker, &Toolsettings); } void PaintingArea::createPolygonTool(){ delete this->Tool; - Tool = new IntelliToolPolygon(this, &colorPicker); + Tool = new IntelliToolPolygon(this, &colorPicker, &Toolsettings); } void PaintingArea::createFloodFillTool(){ delete this->Tool; - Tool = new IntelliToolFloodFill(this, &colorPicker); + Tool = new IntelliToolFloodFill(this, &colorPicker, &Toolsettings); } int PaintingArea::getWidthOfActive(){ @@ -381,13 +381,13 @@ void PaintingArea::createTempTopLayer(int idx){ IntelliTool* PaintingArea::copyActiveTool(){ switch(Tool->getTooltype()){ - case IntelliTool::Tooltype::CIRCLE: return new IntelliToolCircle(this,&colorPicker); - case IntelliTool::Tooltype::FLOODFILL: return new IntelliToolFloodFill(this,&colorPicker); - case IntelliTool::Tooltype::LINE: return new IntelliToolLine(this,&colorPicker); - case IntelliTool::Tooltype::PEN: return new IntelliToolPen(this,&colorPicker); - case IntelliTool::Tooltype::PLAIN: return new IntelliToolPlainTool(this,&colorPicker); - case IntelliTool::Tooltype::POLYGON: return new IntelliToolPolygon(this,&colorPicker); - case IntelliTool::Tooltype::RECTANGLE: return new IntelliToolRectangle(this,&colorPicker); + case IntelliTool::Tooltype::CIRCLE: return new IntelliToolCircle(this,&colorPicker, &Toolsettings); + case IntelliTool::Tooltype::FLOODFILL: return new IntelliToolFloodFill(this,&colorPicker, &Toolsettings); + case IntelliTool::Tooltype::LINE: return new IntelliToolLine(this,&colorPicker, &Toolsettings); + case IntelliTool::Tooltype::PEN: return new IntelliToolPen(this,&colorPicker, &Toolsettings); + case IntelliTool::Tooltype::PLAIN: return new IntelliToolPlainTool(this,&colorPicker, &Toolsettings); + case IntelliTool::Tooltype::POLYGON: return new IntelliToolPolygon(this,&colorPicker, &Toolsettings); + case IntelliTool::Tooltype::RECTANGLE: return new IntelliToolRectangle(this,&colorPicker, &Toolsettings); default: return nullptr; } } diff --git a/src/Layer/PaintingArea.h b/src/Layer/PaintingArea.h index 81e4af2..4d0f99b 100644 --- a/src/Layer/PaintingArea.h +++ b/src/Layer/PaintingArea.h @@ -202,6 +202,7 @@ private: IntelliTool* Tool; IntelliColorPicker colorPicker; + IntelliToolsettings Toolsettings; std::vector layerBundle; int activeLayer=-1; diff --git a/src/Tool/IntelliTool.cpp b/src/Tool/IntelliTool.cpp index fce3ff5..8a1cbbb 100644 --- a/src/Tool/IntelliTool.cpp +++ b/src/Tool/IntelliTool.cpp @@ -1,9 +1,10 @@ #include "IntelliTool.h" #include "Layer/PaintingArea.h" -IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker){ +IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){ this->Area=Area; this->colorPicker=colorPicker; + this->Toolsettings=Toolsettings; } diff --git a/src/Tool/IntelliTool.h b/src/Tool/IntelliTool.h index b7d86a5..ab4028a 100644 --- a/src/Tool/IntelliTool.h +++ b/src/Tool/IntelliTool.h @@ -2,6 +2,7 @@ #define Intelli_Tool_H #include "IntelliHelper/IntelliColorPicker.h" +#include "IntelliHelper/IntelliToolsettings.h" #include struct LayerObject; @@ -49,6 +50,8 @@ Tooltype ActiveType; */ IntelliColorPicker* colorPicker; +IntelliToolsettings* Toolsettings; + /*! * \brief A pointer to the underlying active Layer, do not work on this. This is used for data grabbing or previews. */ @@ -70,7 +73,7 @@ public: * \param Area - The general PaintingArea used by the project. * \param colorPicker - The general colorPicker used by the project. */ -IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker); +IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings); /*! * \brief An abstract Destructor. diff --git a/src/Tool/IntelliToolCircle.cpp b/src/Tool/IntelliToolCircle.cpp index 67a7e16..3ff93b3 100644 --- a/src/Tool/IntelliToolCircle.cpp +++ b/src/Tool/IntelliToolCircle.cpp @@ -3,8 +3,8 @@ #include "QInputDialog" #include -IntelliToolCircle::IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker) - : IntelliTool(Area, colorPicker){ +IntelliToolCircle::IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) + : IntelliTool(Area, colorPicker, Toolsettings){ this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Alpha Value", "Value:", 0,0,255,1); this->borderWidth = QInputDialog::getInt(nullptr,"Outer edge width", "Value:", 0,1,255,1); this->ActiveType = Tooltype::CIRCLE; diff --git a/src/Tool/IntelliToolCircle.h b/src/Tool/IntelliToolCircle.h index 94f34e1..a774f1b 100644 --- a/src/Tool/IntelliToolCircle.h +++ b/src/Tool/IntelliToolCircle.h @@ -34,7 +34,7 @@ public: * \param Area - The general paintingArea used by the project. * \param colorPicker - The general colorPicker used by the project. */ -IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker); +IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings); /*! * \brief A Destructor. diff --git a/src/Tool/IntelliToolFloodFill.cpp b/src/Tool/IntelliToolFloodFill.cpp index c91b961..ed14009 100644 --- a/src/Tool/IntelliToolFloodFill.cpp +++ b/src/Tool/IntelliToolFloodFill.cpp @@ -5,8 +5,8 @@ #include #include -IntelliToolFloodFill::IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker) - : IntelliTool(Area, colorPicker){ +IntelliToolFloodFill::IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) + : IntelliTool(Area, colorPicker, Toolsettings){ this->ActiveType = Tooltype::FLOODFILL; } diff --git a/src/Tool/IntelliToolFloodFill.h b/src/Tool/IntelliToolFloodFill.h index 81412ba..3e93699 100644 --- a/src/Tool/IntelliToolFloodFill.h +++ b/src/Tool/IntelliToolFloodFill.h @@ -14,7 +14,7 @@ public: * \param Area - The general paintingArea used by the project. * \param colorPicker - The general colorPicker used by the project. */ -IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker); +IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings); /*! * \brief A Destructor. diff --git a/src/Tool/IntelliToolLine.cpp b/src/Tool/IntelliToolLine.cpp index e91af5d..ceac201 100644 --- a/src/Tool/IntelliToolLine.cpp +++ b/src/Tool/IntelliToolLine.cpp @@ -3,12 +3,10 @@ #include "QColorDialog" #include "QInputDialog" -IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker) - : IntelliTool(Area, colorPicker){ +IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) + : IntelliTool(Area, colorPicker, Toolsettings){ this->lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1); this->ActiveType = Tooltype::LINE; - //create checkbox or scroll dialog to get line style - this->lineStyle = LineStyle::SOLID_LINE; } IntelliToolLine::~IntelliToolLine(){ @@ -46,11 +44,11 @@ void IntelliToolLine::onMouseMoved(int x, int y){ if(this->isDrawing) { this->Canvas->image->drawPlain(Qt::transparent); QPoint next(x,y); - switch(lineStyle) { - case LineStyle::SOLID_LINE: + switch(Toolsettings->getLinestyle()) { + case IntelliToolsettings::LineStyle::SOLID_LINE: this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),lineWidth); break; - case LineStyle::DOTTED_LINE: + case IntelliToolsettings::LineStyle::DOTTED_LINE: QPoint p1 =lineStartingPoint.x() <= next.x() ? lineStartingPoint : next; QPoint p2 =lineStartingPoint.x() < next.x() ? next : lineStartingPoint; int m = static_cast(static_cast(p2.y()-p1.y())/static_cast(p2.x()-p1.x())+0.5f); diff --git a/src/Tool/IntelliToolLine.h b/src/Tool/IntelliToolLine.h index c134c34..f40178a 100644 --- a/src/Tool/IntelliToolLine.h +++ b/src/Tool/IntelliToolLine.h @@ -4,14 +4,6 @@ #include "QPoint" -/*! - * \brief The LineStyle enum classifing all ways of drawing a line. - */ -enum class LineStyle { - SOLID_LINE, - DOTTED_LINE -}; - /*! * \brief The IntelliToolFloodFill class represents a tool to draw a line. */ @@ -25,11 +17,6 @@ QPoint lineStartingPoint; * \brief The width of the line to draw. */ int lineWidth; - -/*! - * \brief The style of the line. Apropriate to LineStyle. - */ -LineStyle lineStyle; public: /*! @@ -37,7 +24,7 @@ public: * \param Area - The general paintingArea used by the project. * \param colorPicker - The general colorPicker used by the project. */ -IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker); +IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings); /*! * \brief An abstract Destructor. diff --git a/src/Tool/IntelliToolPen.cpp b/src/Tool/IntelliToolPen.cpp index 90146e0..811984f 100644 --- a/src/Tool/IntelliToolPen.cpp +++ b/src/Tool/IntelliToolPen.cpp @@ -4,8 +4,8 @@ #include "QColorDialog" #include "QInputDialog" -IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker) - : IntelliTool(Area, colorPicker){ +IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) + : IntelliTool(Area, colorPicker, Toolsettings){ this->penWidth = QInputDialog::getInt(nullptr, "Pen width", "Width:", 1,0, 50, 1); this->ActiveType = Tooltype::PEN; } diff --git a/src/Tool/IntelliToolPen.h b/src/Tool/IntelliToolPen.h index 32d540a..b55ffa1 100644 --- a/src/Tool/IntelliToolPen.h +++ b/src/Tool/IntelliToolPen.h @@ -23,7 +23,7 @@ public: * \param Area - The general PaintingArea used by the project. * \param colorPicker - The general colorPicker used by the project. */ -IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker); +IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings); /*! * \brief A Destructor. */ diff --git a/src/Tool/IntelliToolPlain.cpp b/src/Tool/IntelliToolPlain.cpp index f89e01c..51984a2 100644 --- a/src/Tool/IntelliToolPlain.cpp +++ b/src/Tool/IntelliToolPlain.cpp @@ -2,8 +2,8 @@ #include "Layer/PaintingArea.h" #include "QColorDialog" -IntelliToolPlainTool::IntelliToolPlainTool(PaintingArea* Area, IntelliColorPicker* colorPicker) - : IntelliTool(Area, colorPicker){ +IntelliToolPlainTool::IntelliToolPlainTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) + : IntelliTool(Area, colorPicker, Toolsettings){ this->ActiveType = Tooltype::PLAIN; } diff --git a/src/Tool/IntelliToolPlain.h b/src/Tool/IntelliToolPlain.h index 08a79fc..c4b294c 100644 --- a/src/Tool/IntelliToolPlain.h +++ b/src/Tool/IntelliToolPlain.h @@ -13,7 +13,7 @@ public: * \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, IntelliToolsettings* Toolsettings); /*! * \brief A Destructor. */ diff --git a/src/Tool/IntelliToolPolygon.cpp b/src/Tool/IntelliToolPolygon.cpp index 4eb3eb7..ca8eced 100644 --- a/src/Tool/IntelliToolPolygon.cpp +++ b/src/Tool/IntelliToolPolygon.cpp @@ -4,8 +4,8 @@ #include #include -IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker) - : IntelliTool(Area, colorPicker){ +IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) + : IntelliTool(Area, colorPicker, Toolsettings){ this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Alpha Value", "Value:", 255,0,255,1); lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",5,1,10,1); isPointNearStart = false; @@ -22,9 +22,9 @@ IntelliToolPolygon::~IntelliToolPolygon(){ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){ if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::Shaped_Image && x > 0 && y > 0 && xgetWidthOfActive() && ygetHeightOfActive()){ - std::vector Triangles = IntelliHelper::calculateTriangles(Area->getPolygonDataOfRealLayer()); + std::vector Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer()); QPoint Point(x,y); - isInside = IntelliHelper::isInPolygon(Triangles,Point); + isInside = IntelliTriangulation::isInPolygon(Triangles,Point); } else if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::Raster_Image && x > 0 && y > 0 && xgetWidthOfActive() && ygetHeightOfActive()){ isInside = true; @@ -75,14 +75,14 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){ isInside = false; isPointNearStart = false; isDrawing = false; - std::vector Triangles = IntelliHelper::calculateTriangles(QPointList); + std::vector Triangles = IntelliTriangulation::calculateTriangles(QPointList); QPoint Point; QColor colorTwo(colorPicker->getSecondColor()); colorTwo.setAlpha(innerAlpha); for(int i = 0; i < activeLayer->width; i++) { for(int j = 0; j < activeLayer->height; j++) { Point = QPoint(i,j); - if(IntelliHelper::isInPolygon(Triangles,Point)) { + if(IntelliTriangulation::isInPolygon(Triangles,Point)) { this->Canvas->image->drawPixel(Point, colorTwo); } } diff --git a/src/Tool/IntelliToolPolygon.h b/src/Tool/IntelliToolPolygon.h index baa68eb..c6a5641 100644 --- a/src/Tool/IntelliToolPolygon.h +++ b/src/Tool/IntelliToolPolygon.h @@ -2,7 +2,7 @@ #define INTELLITOOLPOLYGON_H #include "IntelliTool.h" -#include "IntelliHelper/IntelliHelper.h" +#include "IntelliHelper/IntelliTriangulation.h" #include #include /*! @@ -54,7 +54,7 @@ public: * \param Area - The general paintingArea used by the project. * \param colorPicker - The general colorPicker used by the project. */ -IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker); +IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings); /*! * \brief A Destructor. */ diff --git a/src/Tool/IntelliToolRectangle.cpp b/src/Tool/IntelliToolRectangle.cpp index 36f9ba5..2bb1133 100644 --- a/src/Tool/IntelliToolRectangle.cpp +++ b/src/Tool/IntelliToolRectangle.cpp @@ -2,8 +2,8 @@ #include "Layer/PaintingArea.h" #include "QInputDialog" -IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker) - : IntelliTool(Area, colorPicker){ +IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) + : IntelliTool(Area, colorPicker, Toolsettings){ this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Alpha Value", "Value:", 0,0,255,1); this->borderWidth = QInputDialog::getInt(nullptr,"Outer edge width", "Value:", 0,1,255,1); this->ActiveType = Tooltype::RECTANGLE; diff --git a/src/Tool/IntelliToolRectangle.h b/src/Tool/IntelliToolRectangle.h index 31d9edd..41f36f5 100644 --- a/src/Tool/IntelliToolRectangle.h +++ b/src/Tool/IntelliToolRectangle.h @@ -33,7 +33,7 @@ public: * \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, IntelliToolsettings* Toolsettings); /*! * \brief A Destructor. */ diff --git a/src/main.cpp b/src/main.cpp index bcd7ae6..30adab2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,6 @@ #include "GUI/IntelliPhotoGui.h" #include #include -#include "IntelliHelper/IntelliHelper.h" #include int main(int argc, char*argv[]){