-
#include "IntelliPhotoGui.h"
#include "Layer/PaintingArea.h"
@@ -19,7 +16,7 @@ IntelliPhotoGui::IntelliPhotoGui(){
// Size the app
resize(600,600);
showMaximized();
-
+ setDefaultToolValue();
}
// User tried to close the app
@@ -211,30 +208,37 @@ void IntelliPhotoGui::slotSwapColor(){
}
void IntelliPhotoGui::slotCreatePenTool(){
+ PenButton->setChecked(true);
paintingArea->createPenTool();
}
void IntelliPhotoGui::slotCreatePlainTool(){
+ PlainButton->setChecked(true);
paintingArea->createPlainTool();
}
void IntelliPhotoGui::slotCreateLineTool(){
+ LineButton->setChecked(true);
paintingArea->createLineTool();
}
void IntelliPhotoGui::slotCreateRectangleTool(){
+ RectangleButton->setChecked(true);
paintingArea->createRectangleTool();
}
void IntelliPhotoGui::slotCreateCircleTool(){
+ CircleButton->setChecked(true);
paintingArea->createCircleTool();
}
void IntelliPhotoGui::slotCreatePolygonTool(){
+ PolygonButton->setChecked(true);
paintingArea->createPolygonTool();
}
void IntelliPhotoGui::slotCreateFloodFillTool(){
+ FloodFillButton->setChecked(true);
paintingArea->createFloodFillTool();
}
@@ -245,6 +249,29 @@ void IntelliPhotoGui::slotAboutDialog(){
tr("IntelliPhotoPretty basic editor.
"));
}
+void IntelliPhotoGui::slotEnterPressed(){
+ QString string = EditLineWidth->text();
+ if(string.toInt() > 50){
+ EditLineWidth->setText("50");
+ }
+ paintingArea->Toolsettings.setLineWidth(string.toInt());
+ string = EditLineInnerAlpha->text();
+ if(string.toInt() > 255){
+ EditLineInnerAlpha->setText("255");
+ }
+ paintingArea->Toolsettings.setInnerAlpha(string.toInt());
+}
+
+void IntelliPhotoGui::slotResetTools(){
+ CircleButton->setChecked(false);
+ FloodFillButton->setChecked(false);
+ LineButton->setChecked(false);
+ PenButton->setChecked(false);
+ PlainButton->setChecked(false);
+ PolygonButton->setChecked(false);
+ RectangleButton->setChecked(false);
+}
+
// Define menu actions that call functions
void IntelliPhotoGui::createActions(){
// Get a list of the supported file formats
@@ -334,24 +361,32 @@ void IntelliPhotoGui::createActions(){
//Create Tool actions down here
actionCreatePlainTool = new QAction(tr("&Plain"), this);
+ connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotCreatePlainTool()));
+
actionCreatePenTool = new QAction(tr("&Pen"),this);
- connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool()));
+ connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
+ connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool()));
actionCreateLineTool = new QAction(tr("&Line"), this);
+ connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool()));
actionCreateCircleTool = new QAction(tr("&Circle"), this);
+ connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotCreateCircleTool()));
actionCreateRectangleTool = new QAction(tr("&Rectangle"), this);
+ connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotCreateRectangleTool()));
actionCreatePolygonTool = new QAction(tr("&Polygon"), this);
+ connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotCreatePolygonTool()));
actionCreateFloodFillTool = new QAction(tr("&FloodFill"), this);
+ connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool()));
// Create about action and tie to IntelliPhotoGui::about()
@@ -361,6 +396,30 @@ void IntelliPhotoGui::createActions(){
// Create about Qt action and tie to IntelliPhotoGui::aboutQt()
actionAboutQtDialog = new QAction(tr("About &Qt"), this);
connect(actionAboutQtDialog, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+
+ connect(EditLineWidth, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
+ connect(EditLineInnerAlpha, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
+
+ connect(CircleButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
+ connect(CircleButton, SIGNAL(clicked()), this, SLOT(slotCreateCircleTool()));
+
+ connect(FloodFillButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
+ connect(FloodFillButton, SIGNAL(clicked()), this, SLOT(slotCreateFloodFillTool()));
+
+ connect(LineButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
+ connect(LineButton, SIGNAL(clicked()), this, SLOT(slotCreateLineTool()));
+
+ connect(PenButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
+ connect(PenButton, SIGNAL(clicked()), this, SLOT(slotCreatePenTool()));
+
+ connect(PlainButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
+ connect(PlainButton, SIGNAL(clicked()), this, SLOT(slotCreatePlainTool()));
+
+ connect(PolygonButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
+ connect(PolygonButton, SIGNAL(clicked()), this, SLOT(slotCreatePolygonTool()));
+
+ connect(RectangleButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
+ connect(RectangleButton, SIGNAL(clicked()), this, SLOT(slotCreateRectangleTool()));
}
// Create the menubar
@@ -437,8 +496,100 @@ void IntelliPhotoGui::createGui(){
// create Gui elements
paintingArea = new PaintingArea();
+ p = QPixmap(":/Icons/Buttons/icons/circle-tool.svg");
+ CircleButton = new QPushButton();
+ CircleButton->setFixedSize(Buttonsize);
+ CircleButton->setIcon(p);
+ CircleButton->setIconSize(Buttonsize);
+ CircleButton->setCheckable(true);
+
+ p = QPixmap(":/Icons/Buttons/icons/flood-fill-tool.svg");
+ FloodFillButton = new QPushButton();
+ FloodFillButton->setFixedSize(Buttonsize);
+ FloodFillButton->setIcon(p);
+ FloodFillButton->setIconSize(Buttonsize);
+ FloodFillButton->setCheckable(true);
+
+ p = QPixmap(":/Icons/Buttons/icons/icon.png");
+ LineButton = new QPushButton();
+ LineButton->setFixedSize(Buttonsize);
+ LineButton->setIcon(p);
+ LineButton->setIconSize(Buttonsize);
+ LineButton->setCheckable(true);
+
+ p = QPixmap(":/Icons/Buttons/icons/pen-tool.svg");
+ PenButton = new QPushButton();
+ PenButton->setFixedSize(Buttonsize);
+ PenButton->setIcon(p);
+ PenButton->setIconSize(Buttonsize);
+ PenButton->setCheckable(true);
+
+ p = QPixmap(":/Icons/Buttons/icons/icon.png");
+ PlainButton = new QPushButton();
+ PlainButton->setFixedSize(Buttonsize);
+ PlainButton->setIcon(p);
+ PlainButton->setIconSize(Buttonsize);
+ PlainButton->setCheckable(true);
+
+ p = QPixmap(":/Icons/Buttons/icons/polygon-tool.svg");
+ PolygonButton = new QPushButton();
+ PolygonButton->setFixedSize(Buttonsize);
+ PolygonButton->setIcon(p);
+ PolygonButton->setIconSize(Buttonsize);
+ PolygonButton->setCheckable(true);
+
+ p = QPixmap(":/Icons/Buttons/icons/rectangle-tool.svg");
+ RectangleButton = new QPushButton();
+ RectangleButton->setFixedSize(Buttonsize);
+ RectangleButton->setIcon(p);
+ RectangleButton->setIconSize(Buttonsize);
+ RectangleButton->setCheckable(true);
+
+ WidthLine = new QLabel();
+ WidthLine->setText("Width");
+ WidthLine->setFixedSize(QSize(55,20));
+
+ EditLineWidth = new QLineEdit();
+ EditLineWidth->setFixedSize(QSize(50,20));
+ EditLineWidth->setText("5");
+ ValidatorLineWidth = new QIntValidator();
+ ValidatorLineWidth->setTop(99);
+ ValidatorLineWidth->setBottom(1);
+ EditLineWidth->setValidator(ValidatorLineWidth);
+
+ innerAlphaLine = new QLabel();
+ innerAlphaLine->setText("Inner Alpha");
+ innerAlphaLine->setFixedSize(QSize(55,20));
+
+ EditLineInnerAlpha = new QLineEdit();
+ EditLineInnerAlpha->setFixedSize(QSize(50,20));
+ EditLineInnerAlpha->setText("255");
+ ValidatorInnerAlpha = new QIntValidator();
+ ValidatorInnerAlpha->setTop(999);
+ ValidatorInnerAlpha->setBottom(0);
+ EditLineInnerAlpha->setValidator(ValidatorInnerAlpha);
+
+ Farbe1 = new QLabel();
+ Farbe1->setText("");
+ QPalette Palette;
+ Palette.setColor(QPalette::Background,QColor(0,0,0));//paintingArea->colorPicker.getFirstColor());
+ Farbe1->setPalette(Palette);
+ Farbe1->setFixedSize(QSize(20,20));
+
// set gui elements
- mainLayout->addWidget(paintingArea);
+ mainLayout->addWidget(paintingArea,1,1,20,1);
+ mainLayout->addWidget(CircleButton,1,2,1,1);
+ mainLayout->addWidget(FloodFillButton,2,2,1,1);
+ mainLayout->addWidget(LineButton,3,2,1,1);
+ mainLayout->addWidget(PenButton,4,2,1,1);
+ mainLayout->addWidget(PlainButton,5,2,1,1);
+ mainLayout->addWidget(PolygonButton,6,2,1,1);
+ mainLayout->addWidget(RectangleButton,7,2,1,1);
+ mainLayout->addWidget(WidthLine,8,2,1,1);
+ mainLayout->addWidget(EditLineWidth,9,2,1,1);
+ mainLayout->addWidget(innerAlphaLine,10,2,1,1);
+ mainLayout->addWidget(EditLineInnerAlpha,11,2,1,1);
+ mainLayout->addWidget(Farbe1,12,2,1,1);
}
void IntelliPhotoGui::setIntelliStyle(){
@@ -497,3 +648,7 @@ bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat){
return paintingArea->save(fileName, fileFormat.constData());
}
}
+
+void IntelliPhotoGui::setDefaultToolValue(){
+ slotEnterPressed();
+}
diff --git a/src/GUI/IntelliPhotoGui.h b/src/GUI/IntelliPhotoGui.h
index e76485c..e993982 100644
--- a/src/GUI/IntelliPhotoGui.h
+++ b/src/GUI/IntelliPhotoGui.h
@@ -1,6 +1,8 @@
#ifndef IntelliPhotoGui_H
#define IntelliPhotoGui_H
+#include
+#include
#include
#include
#include
@@ -69,6 +71,10 @@ void slotCreateFloodFillTool();
// slots for dialogs
void slotAboutDialog();
+void slotEnterPressed();
+
+void slotResetTools();
+
private:
// Will tie user actions to functions
void createActions();
@@ -83,9 +89,29 @@ bool maybeSave();
// Opens the Save dialog and saves
bool saveFile(const QByteArray &fileFormat);
+void setDefaultToolValue();
+
// What we'll draw on
PaintingArea* paintingArea;
+const QSize Buttonsize = QSize(50,50);
+QPixmap p;
+QPushButton* CircleButton;
+QPushButton* FloodFillButton;
+QPushButton* LineButton;
+QPushButton* PenButton;
+QPushButton* PlainButton;
+QPushButton* PolygonButton;
+QPushButton* RectangleButton;
+QLabel* WidthLine;
+QLabel* innerAlphaLine;
+QLineEdit* EditLineWidth;
+QLineEdit* EditLineInnerAlpha;
+QIntValidator* ValidatorLineWidth;
+QIntValidator* ValidatorInnerAlpha;
+
+QLabel* Farbe1;
+
// The menu widgets
QMenu*saveAsMenu;
QMenu*fileMenu;
@@ -135,7 +161,7 @@ QList actionSaveAs;
// main GUI elements
QWidget* centralGuiWidget;
-QGridLayout*mainLayout;
+QGridLayout* mainLayout;
};
#endif
diff --git a/src/Image/IntelliImage.h b/src/Image/IntelliImage.h
index 454a704..c5928c0 100644
--- a/src/Image/IntelliImage.h
+++ b/src/Image/IntelliImage.h
@@ -8,8 +8,11 @@
#include
#include
-#include "IntelliHelper/IntelliHelper.h"
+<<<<<<< src/Image/IntelliImage.h
#include "IntelliHelper/IntelliRenderSettings.h"
+=======
+#include "IntelliHelper/IntelliTriangulation.h"
+>>>>>>> src/Image/IntelliImage.h
class IntelliTool;
diff --git a/src/Image/IntelliShapedImage.cpp b/src/Image/IntelliShapedImage.cpp
index a77d2f2..d461417 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
@@ -50,7 +50,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..6f95d1c
--- /dev/null
+++ b/src/IntelliHelper/IntelliToolsettings.cpp
@@ -0,0 +1,53 @@
+#include "IntelliToolsettings.h"
+#include
+
+IntelliToolsettings::IntelliToolsettings()
+{
+ lineWidth = 1;
+ innerAlpha = 255;
+ Linestyle = LineStyle::SOLID_LINE;
+}
+
+IntelliToolsettings::~IntelliToolsettings(){
+
+}
+
+int IntelliToolsettings::getLineWidth(){
+ return lineWidth;
+}
+
+void IntelliToolsettings::setLineWidth(){
+ lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
+}
+
+void IntelliToolsettings::setLineWidth(int LineWidth){
+ if(LineWidth < 1){
+ LineWidth = 1;
+ }
+ else if(LineWidth > 50){
+ LineWidth = 50;
+ }
+ lineWidth = LineWidth;
+}
+
+int IntelliToolsettings::getInnerAlpha(){
+ return this->innerAlpha;
+}
+
+void IntelliToolsettings::setInnerAlpha(){
+ this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Aplha Input", "Value",0,0,255,1);
+}
+
+void IntelliToolsettings::setInnerAlpha(int innerAlpha){
+ if(innerAlpha < 0){
+ innerAlpha = 0;
+ }
+ else if(innerAlpha > 255){
+ innerAlpha = 255;
+ }
+ this->innerAlpha = 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..3907bb1
--- /dev/null
+++ b/src/IntelliHelper/IntelliToolsettings.h
@@ -0,0 +1,29 @@
+#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();
+ virtual ~IntelliToolsettings();
+ int getLineWidth();
+ void setLineWidth();
+ void setLineWidth(int LineWidth);
+ int getInnerAlpha();
+ void setInnerAlpha();
+ void setInnerAlpha(int innerAlpha);
+ 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 830d22a..c3cafc6 100644
--- a/src/IntelliPhoto.pro
+++ b/src/IntelliPhoto.pro
@@ -21,8 +21,12 @@ SOURCES += \
Image/IntelliRasterImage.cpp \
Image/IntelliShapedImage.cpp \
IntelliHelper/IntelliColorPicker.cpp \
- IntelliHelper/IntelliHelper.cpp \
+<<<<<<< src/IntelliPhoto.pro
IntelliHelper/IntelliRenderSettings.cpp \
+=======
+ IntelliHelper/IntelliToolsettings.cpp \
+ IntelliHelper/IntelliTriangulation.cpp \
+>>>>>>> src/IntelliPhoto.pro
Layer/PaintingArea.cpp \
Tool/IntelliTool.cpp \
Tool/IntelliToolCircle.cpp \
@@ -40,8 +44,13 @@ HEADERS += \
Image/IntelliRasterImage.h \
Image/IntelliShapedImage.h \
IntelliHelper/IntelliColorPicker.h \
+<<<<<<< src/IntelliPhoto.pro
IntelliHelper/IntelliHelper.h \
IntelliHelper/IntelliRenderSettings.h \
+=======
+ IntelliHelper/IntelliToolsettings.h \
+ IntelliHelper/IntelliTriangulation.h \
+>>>>>>> src/IntelliPhoto.pro
Layer/PaintingArea.h \
Tool/IntelliTool.h \
Tool/IntelliToolCircle.h \
@@ -65,3 +74,6 @@ ICON = icon.icns
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+
+RESOURCES += \
+ Bilder.qrc
diff --git a/src/Layer/PaintingArea.cpp b/src/Layer/PaintingArea.cpp
index 7388487..e0da084 100644
--- a/src/Layer/PaintingArea.cpp
+++ b/src/Layer/PaintingArea.cpp
@@ -206,36 +206,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(){
@@ -400,13 +400,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 bac09e3..4f41b9d 100644
--- a/src/Layer/PaintingArea.h
+++ b/src/Layer/PaintingArea.h
@@ -166,6 +166,9 @@ public:
std::vector getPolygonDataOfRealLayer();
+ IntelliToolsettings Toolsettings;
+ IntelliColorPicker colorPicker;
+
public slots:
// Events to handle
/*!
@@ -201,8 +204,10 @@ private:
int maxWidth;
int maxHeight;
+<<<<<<< src/Layer/PaintingArea.h
IntelliRenderSettings renderSettings;
- IntelliColorPicker colorPicker;
+=======
+>>>>>>> src/Layer/PaintingArea.h
IntelliTool* Tool;
std::vector layerBundle;
diff --git a/src/Tool/IntelliTool.cpp b/src/Tool/IntelliTool.cpp
index 88d2e07..695dc37 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..6d22618 100644
--- a/src/Tool/IntelliToolCircle.cpp
+++ b/src/Tool/IntelliToolCircle.cpp
@@ -3,10 +3,8 @@
#include "QInputDialog"
#include
-IntelliToolCircle::IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker)
- : IntelliTool(Area, colorPicker){
- 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);
+IntelliToolCircle::IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
+ : IntelliTool(Area, colorPicker, Toolsettings){
this->ActiveType = Tooltype::CIRCLE;
}
@@ -17,7 +15,7 @@ IntelliToolCircle::~IntelliToolCircle(){
void IntelliToolCircle::drawCircle(int radius){
int outer = radius+20;
QColor inner = this->colorPicker->getSecondColor();
- inner.setAlpha(innerAlpha);
+ inner.setAlpha(Toolsettings->getInnerAlpha());
int yMin, yMax, xMin, xMax;
yMin = centerPoint.y()-radius;
yMax = centerPoint.y()+radius;
@@ -29,14 +27,14 @@ void IntelliToolCircle::drawCircle(int radius){
}
//TODO implement circle drawing algorithm bresenham
- radius = static_cast(radius +(this->borderWidth/2.)-1.);
+ radius = static_cast(radius +(Toolsettings->getLineWidth()/2.)-1.);
yMin = (centerPoint.y()-radius);
yMax = (centerPoint.y()+radius);
for(int i=yMin; i<=yMax; i++) {
xMin = static_cast(centerPoint.x()-sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
xMax = static_cast(centerPoint.x()+sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
- this->Canvas->image->drawPoint(QPoint(xMin,i), colorPicker->getFirstColor(),borderWidth);
- this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),borderWidth);
+ this->Canvas->image->drawPoint(QPoint(xMin,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
+ this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
}
xMin = (centerPoint.x()-radius);
@@ -44,8 +42,8 @@ void IntelliToolCircle::drawCircle(int radius){
for(int i=xMin; i<=xMax; i++) {
int yMin = static_cast(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
int yMax = static_cast(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
- this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),borderWidth);
- this->Canvas->image->drawPoint(QPoint(i, yMax), colorPicker->getFirstColor(),borderWidth);
+ this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
+ this->Canvas->image->drawPoint(QPoint(i, yMax), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
}
}
@@ -71,10 +69,7 @@ void IntelliToolCircle::onMouseLeftReleased(int x, int y){
void IntelliToolCircle::onWheelScrolled(int value){
IntelliTool::onWheelScrolled(value);
- this->borderWidth+=value;
- if(this->borderWidth<=0) {
- this->borderWidth=1;
- }
+ Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
}
void IntelliToolCircle::onMouseMoved(int x, int y){
diff --git a/src/Tool/IntelliToolCircle.h b/src/Tool/IntelliToolCircle.h
index 94f34e1..d75665d 100644
--- a/src/Tool/IntelliToolCircle.h
+++ b/src/Tool/IntelliToolCircle.h
@@ -19,22 +19,13 @@ void drawCircle(int radius);
*/
QPoint centerPoint;
-/*!
- * \brief The alpha value of the inner circle.
- */
-int innerAlpha;
-
-/*!
- * \brief The width of the outer circle edge.
- */
-int borderWidth;
public:
/*!
* \brief A constructor setting the general paintingArea and colorPicker. And reading in the inner alpha and edgeWidth.
* \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..0ccd9a1 100644
--- a/src/Tool/IntelliToolLine.cpp
+++ b/src/Tool/IntelliToolLine.cpp
@@ -3,12 +3,9 @@
#include "QColorDialog"
#include "QInputDialog"
-IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker)
- : IntelliTool(Area, colorPicker){
- this->lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
+IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
+ : IntelliTool(Area, colorPicker, Toolsettings){
this->ActiveType = Tooltype::LINE;
- //create checkbox or scroll dialog to get line style
- this->lineStyle = LineStyle::SOLID_LINE;
}
IntelliToolLine::~IntelliToolLine(){
@@ -26,7 +23,7 @@ void IntelliToolLine::onMouseRightReleased(int x, int y){
void IntelliToolLine::onMouseLeftPressed(int x, int y){
IntelliTool::onMouseLeftPressed(x,y);
this->lineStartingPoint=QPoint(x,y);
- this->Canvas->image->drawPoint(lineStartingPoint, colorPicker->getFirstColor(),lineWidth);
+ this->Canvas->image->drawPoint(lineStartingPoint, colorPicker->getFirstColor(),Toolsettings->getLineWidth());
Canvas->image->calculateVisiblity();
}
@@ -36,21 +33,18 @@ void IntelliToolLine::onMouseLeftReleased(int x, int y){
void IntelliToolLine::onWheelScrolled(int value){
IntelliTool::onWheelScrolled(value);
- this->lineWidth+=value;
- if(this->lineWidth<=0) {
- this->lineWidth=1;
- }
+ Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
}
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:
- this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),lineWidth);
+ switch(Toolsettings->getLinestyle()) {
+ case IntelliToolsettings::LineStyle::SOLID_LINE:
+ this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),Toolsettings->getLineWidth());
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..1bae946 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.
*/
@@ -21,15 +13,6 @@ class IntelliToolLine : public IntelliTool {
*/
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 +20,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..61af1c4 100644
--- a/src/Tool/IntelliToolPen.cpp
+++ b/src/Tool/IntelliToolPen.cpp
@@ -4,9 +4,8 @@
#include "QColorDialog"
#include "QInputDialog"
-IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker)
- : IntelliTool(Area, colorPicker){
- this->penWidth = QInputDialog::getInt(nullptr, "Pen width", "Width:", 1,0, 50, 1);
+IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
+ : IntelliTool(Area, colorPicker, Toolsettings){
this->ActiveType = Tooltype::PEN;
}
@@ -25,7 +24,7 @@ void IntelliToolPen::onMouseRightReleased(int x, int y){
void IntelliToolPen::onMouseLeftPressed(int x, int y){
IntelliTool::onMouseLeftPressed(x,y);
this->previousPoint=QPoint(x,y);
- this->Canvas->image->drawPoint(previousPoint, colorPicker->getFirstColor(), penWidth);
+ this->Canvas->image->drawPoint(previousPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth());
Canvas->image->calculateVisiblity();
}
@@ -36,7 +35,7 @@ void IntelliToolPen::onMouseLeftReleased(int x, int y){
void IntelliToolPen::onMouseMoved(int x, int y){
if(this->isDrawing) {
QPoint newPoint(x,y);
- this->Canvas->image->drawLine(this->previousPoint, newPoint, colorPicker->getFirstColor(), penWidth);
+ this->Canvas->image->drawLine(this->previousPoint, newPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth());
this->previousPoint=newPoint;
}
IntelliTool::onMouseMoved(x,y);
@@ -44,8 +43,5 @@ void IntelliToolPen::onMouseMoved(int x, int y){
void IntelliToolPen::onWheelScrolled(int value){
IntelliTool::onWheelScrolled(value);
- this->penWidth+=value;
- if(this->penWidth<=0) {
- this->penWidth=1;
- }
+ Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
}
diff --git a/src/Tool/IntelliToolPen.h b/src/Tool/IntelliToolPen.h
index 32d540a..39aab9e 100644
--- a/src/Tool/IntelliToolPen.h
+++ b/src/Tool/IntelliToolPen.h
@@ -9,10 +9,6 @@
* \brief The IntelliToolPen class represents a tool to draw a line.
*/
class IntelliToolPen : public IntelliTool {
-/*!
- * \brief penWidth - The width of the Pen while drawing.
- */
-int penWidth;
/*!
* \brief point - Represents the previous point to help drawing a line.
*/
@@ -23,7 +19,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..28dfd31 100644
--- a/src/Tool/IntelliToolPolygon.cpp
+++ b/src/Tool/IntelliToolPolygon.cpp
@@ -4,10 +4,8 @@
#include
#include
-IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker)
- : IntelliTool(Area, colorPicker){
- 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);
+IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
+ : IntelliTool(Area, colorPicker, Toolsettings){
isPointNearStart = false;
isDrawing = false;
isInside = false;
@@ -22,9 +20,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;
@@ -37,13 +35,13 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
isDrawing = true;
QPointList.push_back(drawingPoint);
- this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), lineWidth);
+ this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
this->Canvas->image->calculateVisiblity();
}
else if(isDrawing && isNearStart(x,y,QPointList.front())) {
if(QPointList.size() > 2){
isPointNearStart = true;
- this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), lineWidth);
+ this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
this->Canvas->image->calculateVisiblity();
}
else{
@@ -57,7 +55,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
else if(isDrawing) {
QPoint drawingPoint(x,y);
QPointList.push_back(drawingPoint);
- this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), lineWidth);
+ this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
this->Canvas->image->calculateVisiblity();
}
}
@@ -75,21 +73,21 @@ 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);
+ colorTwo.setAlpha(Toolsettings->getInnerAlpha());
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);
}
}
}
for(int i=0; i(QPointList.size()); i++) {
int next = static_cast((i+static_cast(1))%static_cast(QPointList.size()));
- this->Canvas->image->drawLine(QPointList[static_cast(i)], QPointList[static_cast(next)], colorPicker->getFirstColor(), lineWidth);
+ this->Canvas->image->drawLine(QPointList[static_cast(i)], QPointList[static_cast(next)], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
}
QPointList.clear();
IntelliTool::onMouseLeftReleased(x,y);
@@ -103,12 +101,7 @@ void IntelliToolPolygon::onMouseRightReleased(int x, int y){
void IntelliToolPolygon::onWheelScrolled(int value){
IntelliTool::onWheelScrolled(value);
if(!isDrawing) {
- if(lineWidth + value < 10) {
- lineWidth += value;
- }
- if(lineWidth < 1) {
- lineWidth = 1;
- }
+ Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value);
}
}
diff --git a/src/Tool/IntelliToolPolygon.h b/src/Tool/IntelliToolPolygon.h
index baa68eb..920a556 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
/*!
@@ -19,11 +19,6 @@ class IntelliToolPolygon : public IntelliTool
*/
bool isNearStart(int x, int y, QPoint Startpoint);
-/*!
- * \brief LineWidth of the drawing polygon.
- */
-int lineWidth;
-
/*!
* \brief IsDrawing true while drawing, else false.
*/
@@ -39,11 +34,6 @@ bool isInside;
*/
bool isPointNearStart;
-/*!
- * \brief The alpha value of the inner circle.
- */
-int innerAlpha;
-
/*!
* \brief QPointList list of all points of the polygon.
*/
@@ -54,7 +44,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..e92eb10 100644
--- a/src/Tool/IntelliToolRectangle.cpp
+++ b/src/Tool/IntelliToolRectangle.cpp
@@ -2,10 +2,8 @@
#include "Layer/PaintingArea.h"
#include "QInputDialog"
-IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker)
- : IntelliTool(Area, colorPicker){
- 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);
+IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
+ : IntelliTool(Area, colorPicker, Toolsettings){
this->ActiveType = Tooltype::RECTANGLE;
}
@@ -21,14 +19,14 @@ void IntelliToolRectangle::drawRectangle(QPoint otherCorner){
int yMax = std::max(originCorner.y(), otherCorner.y());
QColor clr = colorPicker->getSecondColor();
- clr.setAlpha(innerAlpha);
+ clr.setAlpha(Toolsettings->getInnerAlpha());
for(int y=yMin; y<=yMax; y++) {
this->Canvas->image->drawLine(QPoint(xMin,y), QPoint(xMax, y), clr, 1);
}
- this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), borderWidth);
- this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), borderWidth);
- this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), borderWidth);
- this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), borderWidth);
+ this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
+ this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
+ this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
+ this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
}
void IntelliToolRectangle::onMouseRightPressed(int x, int y){
@@ -61,8 +59,5 @@ void IntelliToolRectangle::onMouseMoved(int x, int y){
void IntelliToolRectangle::onWheelScrolled(int value){
IntelliTool::onWheelScrolled(value);
- this->borderWidth+=value;
- if(this->borderWidth<=0) {
- this->borderWidth=1;
- }
+ Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
}
diff --git a/src/Tool/IntelliToolRectangle.h b/src/Tool/IntelliToolRectangle.h
index 31d9edd..041e860 100644
--- a/src/Tool/IntelliToolRectangle.h
+++ b/src/Tool/IntelliToolRectangle.h
@@ -19,21 +19,13 @@ void drawRectangle(QPoint otherCorner);
* \brief origincorner - The first corner point of the rectangle.
*/
QPoint originCorner;
-/*!
- * \brief alphaInner- Represents the alpha value of the inside.
- */
-int innerAlpha;
-/*!
- * \brief edgeWidth - The width of the rectangle edges.
- */
-int borderWidth;
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, IntelliToolsettings* Toolsettings);
/*!
* \brief A Destructor.
*/
diff --git a/src/icons/circle-tool.svg b/src/icons/circle-tool.svg
new file mode 100644
index 0000000..a6cc0e4
--- /dev/null
+++ b/src/icons/circle-tool.svg
@@ -0,0 +1,94 @@
+
+
+
+
diff --git a/src/icons/eraser-tool.svg b/src/icons/eraser-tool.svg
new file mode 100644
index 0000000..cdc518d
--- /dev/null
+++ b/src/icons/eraser-tool.svg
@@ -0,0 +1,109 @@
+
+
+
+
diff --git a/src/icons/flood-fill-tool.svg b/src/icons/flood-fill-tool.svg
new file mode 100644
index 0000000..980bb7a
--- /dev/null
+++ b/src/icons/flood-fill-tool.svg
@@ -0,0 +1,194 @@
+
+
+
+
diff --git a/src/icons/icon.png b/src/icons/icon.png
new file mode 100644
index 0000000..2829667
Binary files /dev/null and b/src/icons/icon.png differ
diff --git a/src/icons/magic-wand-tool.svg b/src/icons/magic-wand-tool.svg
new file mode 100644
index 0000000..71f019d
--- /dev/null
+++ b/src/icons/magic-wand-tool.svg
@@ -0,0 +1,169 @@
+
+
+
+
diff --git a/src/icons/pen-tool.svg b/src/icons/pen-tool.svg
new file mode 100644
index 0000000..5dd9782
--- /dev/null
+++ b/src/icons/pen-tool.svg
@@ -0,0 +1,105 @@
+
+
+
+
diff --git a/src/icons/polygon-tool.svg b/src/icons/polygon-tool.svg
new file mode 100644
index 0000000..7602729
--- /dev/null
+++ b/src/icons/polygon-tool.svg
@@ -0,0 +1,117 @@
+
+
+
+
diff --git a/src/icons/rectangle-tool.svg b/src/icons/rectangle-tool.svg
new file mode 100644
index 0000000..3056a02
--- /dev/null
+++ b/src/icons/rectangle-tool.svg
@@ -0,0 +1,101 @@
+
+
+
+
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[]){
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 433b697..0bbafd4 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -16,7 +16,36 @@
true
-
+
+
+
+
+ 120
+ 100
+ 256
+ 192
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+