From d4313e29a050df13140457a97bede8c4ea6eb722 Mon Sep 17 00:00:00 2001 From: Conrad Date: Thu, 9 Jan 2020 10:18:28 +0100 Subject: [PATCH] Ran Uncrustify Again --- src/GUI/IntelliPhotoGui.cpp | 362 ++++++++++---------- src/Image/IntelliImage.cpp | 4 +- src/Image/IntelliImage.h | 6 +- src/Image/IntelliRasterImage.cpp | 4 +- src/Image/IntelliShapedImage.cpp | 4 +- src/IntelliHelper/IntelliRenderSettings.cpp | 2 +- src/IntelliHelper/IntelliRenderSettings.h | 14 +- src/IntelliHelper/IntelliToolsettings.cpp | 44 +-- src/IntelliHelper/IntelliToolsettings.h | 38 +- src/IntelliHelper/IntelliTriangulation.cpp | 8 +- src/IntelliHelper/IntelliTriangulation.h | 6 +- src/Layer/PaintingArea.cpp | 158 ++++----- src/Tool/IntelliTool.cpp | 12 +- src/Tool/IntelliTool.h | 18 +- src/Tool/IntelliToolCircle.cpp | 32 +- src/Tool/IntelliToolFloodFill.cpp | 6 +- src/Tool/IntelliToolLine.cpp | 20 +- src/Tool/IntelliToolPen.cpp | 12 +- src/Tool/IntelliToolPlain.cpp | 6 +- src/Tool/IntelliToolPolygon.cpp | 74 ++-- src/Tool/IntelliToolRectangle.cpp | 26 +- 21 files changed, 428 insertions(+), 428 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 6fb1e81..283f7fb 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -16,7 +16,7 @@ IntelliPhotoGui::IntelliPhotoGui(){ // Size the app resize(600,600); showMaximized(); - setDefaultToolValue(); + setDefaultToolValue(); } // User tried to close the app @@ -81,7 +81,7 @@ void IntelliPhotoGui::slotCreateNewLayer(){ if (ok1&&ok2) { int layer = paintingArea->addLayer(width,height,0,0); - UpdateGui(); + UpdateGui(); } } @@ -95,12 +95,12 @@ void IntelliPhotoGui::slotDeleteLayer(){ // Define the standard Value, min, max, step and ok button int layerNumber = QInputDialog::getInt(this, tr("delete Layer"), tr("Number:"), - paintingArea->getNumberOfActiveLayer(),0, 500, 1, &ok); + paintingArea->getNumberOfActiveLayer(),0, 500, 1, &ok); // Create New Layer - if (ok){ + if (ok) { paintingArea->deleteLayer(layerNumber); - UpdateGui(); - } + UpdateGui(); + } } void IntelliPhotoGui::slotSetActiveAlpha(){ @@ -120,7 +120,7 @@ void IntelliPhotoGui::slotSetActiveAlpha(){ if (ok1&&ok2) { paintingArea->setLayerAlpha(layer,alpha); - UpdateGui(); + UpdateGui(); } } @@ -179,7 +179,7 @@ void IntelliPhotoGui::slotClearActiveLayer(){ if (ok1&&ok2&&ok3&&ok4) { paintingArea->floodFill(red, green, blue, alpha); - UpdateGui(); + UpdateGui(); } } @@ -196,57 +196,57 @@ void IntelliPhotoGui::slotSetActiveLayer(){ if (ok1) { paintingArea->setLayerActive(layer); - UpdateGui(); + UpdateGui(); } } void IntelliPhotoGui::slotSetFirstColor(){ paintingArea->colorPickerSetFirstColor(); - UpdateGui(); + UpdateGui(); } void IntelliPhotoGui::slotSetSecondColor(){ paintingArea->colorPickerSetSecondColor(); - UpdateGui(); + UpdateGui(); } void IntelliPhotoGui::slotSwapColor(){ paintingArea->colorPickerSwapColors(); - UpdateGui(); + UpdateGui(); } void IntelliPhotoGui::slotCreatePenTool(){ - PenButton->setChecked(true); + PenButton->setChecked(true); paintingArea->createPenTool(); } void IntelliPhotoGui::slotCreatePlainTool(){ - PlainButton->setChecked(true); + PlainButton->setChecked(true); paintingArea->createPlainTool(); } void IntelliPhotoGui::slotCreateLineTool(){ - LineButton->setChecked(true); + LineButton->setChecked(true); paintingArea->createLineTool(); } void IntelliPhotoGui::slotCreateRectangleTool(){ - RectangleButton->setChecked(true); + RectangleButton->setChecked(true); paintingArea->createRectangleTool(); } void IntelliPhotoGui::slotCreateCircleTool(){ - CircleButton->setChecked(true); + CircleButton->setChecked(true); paintingArea->createCircleTool(); } void IntelliPhotoGui::slotCreatePolygonTool(){ - PolygonButton->setChecked(true); + PolygonButton->setChecked(true); paintingArea->createPolygonTool(); } void IntelliPhotoGui::slotCreateFloodFillTool(){ - FloodFillButton->setChecked(true); + FloodFillButton->setChecked(true); paintingArea->createFloodFillTool(); } @@ -258,26 +258,26 @@ void IntelliPhotoGui::slotAboutDialog(){ } 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()); + 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); + 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 @@ -359,45 +359,45 @@ void IntelliPhotoGui::createActions(){ //Create Color Actions here actionColorPickerFirstColor = new QAction(tr("&Main"), this); connect(actionColorPickerFirstColor, SIGNAL(triggered()), this, SLOT(slotSetFirstColor())); - connect(FirstColorButton, SIGNAL(clicked()), this, SLOT(slotSetFirstColor())); + connect(FirstColorButton, SIGNAL(clicked()), this, SLOT(slotSetFirstColor())); actionColorPickerSecondColor = new QAction(tr("&Secondary"), this); connect(actionColorPickerSecondColor, SIGNAL(triggered()), this, SLOT(slotSetSecondColor())); - connect(SecondColorButton, SIGNAL(clicked()), this, SLOT(slotSetSecondColor())); + connect(SecondColorButton, SIGNAL(clicked()), this, SLOT(slotSetSecondColor())); actionColorSwap = new QAction(tr("&Switch"), this); actionColorSwap->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S)); connect(actionColorSwap, SIGNAL(triggered()), this, SLOT(slotSwapColor())); - connect(SwitchColorButton, SIGNAL(clicked()), this, SLOT(slotSwapColor())); + connect(SwitchColorButton, SIGNAL(clicked()), this, SLOT(slotSwapColor())); //Create Tool actions down here actionCreatePlainTool = new QAction(tr("&Plain"), this); - connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); + 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(slotResetTools())); - 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(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(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(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(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(slotResetTools())); connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool())); // Create about action and tie to IntelliPhotoGui::about() @@ -408,29 +408,29 @@ void IntelliPhotoGui::createActions(){ 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(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(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(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(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(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(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(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())); + connect(RectangleButton,SIGNAL(pressed()), this, SLOT(slotResetTools())); + connect(RectangleButton, SIGNAL(clicked()), this, SLOT(slotCreateRectangleTool())); } // Create the menubar @@ -472,12 +472,12 @@ void IntelliPhotoGui::createMenus(){ //Attach all Tool Options toolMenu = new QMenu(tr("&Tools"), this); - toolMenu->addAction(actionCreateCircleTool); - toolMenu->addAction(actionCreateFloodFillTool); - toolMenu->addAction(actionCreateLineTool); + toolMenu->addAction(actionCreateCircleTool); + toolMenu->addAction(actionCreateFloodFillTool); + toolMenu->addAction(actionCreateLineTool); toolMenu->addAction(actionCreatePenTool); toolMenu->addAction(actionCreatePlainTool); - toolMenu->addAction(actionCreatePolygonTool); + toolMenu->addAction(actionCreatePolygonTool); toolMenu->addAction(actionCreateRectangleTool); toolMenu->addSeparator(); toolMenu->addMenu(colorMenu); @@ -506,137 +506,137 @@ void IntelliPhotoGui::createGui(){ // create Gui elements paintingArea = new PaintingArea(); - paintingArea->DumpyGui = this; + paintingArea->DumpyGui = this; - 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/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/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/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/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/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/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); + 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(Buttonsize.width(),Buttonsize.height()/3); + WidthLine = new QLabel(); + WidthLine->setText("Width"); + WidthLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); - EditLineWidth = new QLineEdit(); - EditLineWidth->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); - EditLineWidth->setText("5"); - ValidatorLineWidth = new QIntValidator(); - ValidatorLineWidth->setTop(99); - ValidatorLineWidth->setBottom(1); - EditLineWidth->setValidator(ValidatorLineWidth); + EditLineWidth = new QLineEdit(); + EditLineWidth->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); + EditLineWidth->setText("5"); + ValidatorLineWidth = new QIntValidator(); + ValidatorLineWidth->setTop(99); + ValidatorLineWidth->setBottom(1); + EditLineWidth->setValidator(ValidatorLineWidth); - innerAlphaLine = new QLabel(); - innerAlphaLine->setText("Inner Alpha"); - innerAlphaLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); + innerAlphaLine = new QLabel(); + innerAlphaLine->setText("Inner Alpha"); + innerAlphaLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); - EditLineInnerAlpha = new QLineEdit(); - EditLineInnerAlpha->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); - EditLineInnerAlpha->setText("255"); - ValidatorInnerAlpha = new QIntValidator(); - ValidatorInnerAlpha->setTop(999); - ValidatorInnerAlpha->setBottom(0); - EditLineInnerAlpha->setValidator(ValidatorInnerAlpha); + EditLineInnerAlpha = new QLineEdit(); + EditLineInnerAlpha->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); + EditLineInnerAlpha->setText("255"); + ValidatorInnerAlpha = new QIntValidator(); + ValidatorInnerAlpha->setTop(999); + ValidatorInnerAlpha->setBottom(0); + EditLineInnerAlpha->setValidator(ValidatorInnerAlpha); - FirstColorButton = new QPushButton(); - FirstColorButton->setFixedSize(Buttonsize/2); + FirstColorButton = new QPushButton(); + FirstColorButton->setFixedSize(Buttonsize/2); - SecondColorButton = new QPushButton(); - SecondColorButton->setFixedSize(Buttonsize/2); + SecondColorButton = new QPushButton(); + SecondColorButton->setFixedSize(Buttonsize/2); - p = QPixmap(":/Icons/Buttons/icons/Wechselpfeile.png"); - SwitchColorButton = new QPushButton(); - SwitchColorButton->setFixedSize(Buttonsize.width(),Buttonsize.height()/2); - SwitchColorButton->setIcon(p); - SwitchColorButton->setIconSize(QSize(Buttonsize.width(),Buttonsize.height()/2)); + p = QPixmap(":/Icons/Buttons/icons/Wechselpfeile.png"); + SwitchColorButton = new QPushButton(); + SwitchColorButton->setFixedSize(Buttonsize.width(),Buttonsize.height()/2); + SwitchColorButton->setIcon(p); + SwitchColorButton->setIconSize(QSize(Buttonsize.width(),Buttonsize.height()/2)); - ActiveLayerLine = new QLabel(); - QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer()); - ActiveLayerLine->setText(string); - ActiveLayerLine->setFixedSize(Buttonsize.width()+10,Buttonsize.height()/3); + ActiveLayerLine = new QLabel(); + QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer()); + ActiveLayerLine->setText(string); + ActiveLayerLine->setFixedSize(Buttonsize.width()+10,Buttonsize.height()/3); - p = p.fromImage(paintingArea->getImageOfActiveLayer()->getImageData()); + p = p.fromImage(paintingArea->getImageOfActiveLayer()->getImageData()); - ActiveLayerImageButton = new QPushButton(); - ActiveLayerImageButton->setFixedSize(Buttonsize); - ActiveLayerImageButton->setIcon(p); - ActiveLayerImageButton->setIconSize(Buttonsize); + ActiveLayerImageButton = new QPushButton(); + ActiveLayerImageButton->setFixedSize(Buttonsize); + ActiveLayerImageButton->setIcon(p); + ActiveLayerImageButton->setIconSize(Buttonsize); // set gui elements - mainLayout->addWidget(paintingArea,1,1,20,1); - mainLayout->addWidget(CircleButton,1,2,1,2); - mainLayout->addWidget(FloodFillButton,2,2,1,2); - mainLayout->addWidget(LineButton,3,2,1,2); - mainLayout->addWidget(PenButton,4,2,1,2); - mainLayout->addWidget(PlainButton,5,2,1,2); - mainLayout->addWidget(PolygonButton,6,2,1,2); - mainLayout->addWidget(RectangleButton,7,2,1,2); - mainLayout->addWidget(WidthLine,8,2,1,2); - mainLayout->addWidget(EditLineWidth,9,2,1,2); - mainLayout->addWidget(innerAlphaLine,10,2,1,2); - mainLayout->addWidget(EditLineInnerAlpha,11,2,1,2); - mainLayout->addWidget(FirstColorButton,12,2,1,1); - mainLayout->addWidget(SecondColorButton,12,3,1,1); - mainLayout->addWidget(SwitchColorButton,13,2,1,2); - mainLayout->addWidget(ActiveLayerLine,14,2,1,2); - mainLayout->addWidget(ActiveLayerImageButton,15,2,1,2); + mainLayout->addWidget(paintingArea,1,1,20,1); + mainLayout->addWidget(CircleButton,1,2,1,2); + mainLayout->addWidget(FloodFillButton,2,2,1,2); + mainLayout->addWidget(LineButton,3,2,1,2); + mainLayout->addWidget(PenButton,4,2,1,2); + mainLayout->addWidget(PlainButton,5,2,1,2); + mainLayout->addWidget(PolygonButton,6,2,1,2); + mainLayout->addWidget(RectangleButton,7,2,1,2); + mainLayout->addWidget(WidthLine,8,2,1,2); + mainLayout->addWidget(EditLineWidth,9,2,1,2); + mainLayout->addWidget(innerAlphaLine,10,2,1,2); + mainLayout->addWidget(EditLineInnerAlpha,11,2,1,2); + mainLayout->addWidget(FirstColorButton,12,2,1,1); + mainLayout->addWidget(SecondColorButton,12,3,1,1); + mainLayout->addWidget(SwitchColorButton,13,2,1,2); + mainLayout->addWidget(ActiveLayerLine,14,2,1,2); + mainLayout->addWidget(ActiveLayerImageButton,15,2,1,2); } void IntelliPhotoGui::setIntelliStyle(){ // Set the title setWindowTitle("IntelliPhoto Prototype"); // Set style sheet - this->setStyleSheet("background-color:rgb(64,64,64)"); - this->centralGuiWidget->setStyleSheet("color:rgb(255,255,255)"); + this->setStyleSheet("background-color:rgb(64,64,64)"); + this->centralGuiWidget->setStyleSheet("color:rgb(255,255,255)"); this->menuBar()->setStyleSheet("color:rgb(255,255,255)"); - QString string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name()); - FirstColorButton->setStyleSheet(string); - string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name()); - SecondColorButton->setStyleSheet(string); + QString string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name()); + FirstColorButton->setStyleSheet(string); + string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name()); + SecondColorButton->setStyleSheet(string); } bool IntelliPhotoGui::maybeSave(){ @@ -688,18 +688,18 @@ bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat){ } void IntelliPhotoGui::setDefaultToolValue(){ - slotEnterPressed(); + slotEnterPressed(); } void IntelliPhotoGui::UpdateGui(){ - QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer()); - ActiveLayerLine->setText(string); - p = p.fromImage(paintingArea->getImageOfActiveLayer()->getImageData()); - ActiveLayerImageButton->setIcon(p); - ActiveLayerImageButton->setIconSize(Buttonsize); + QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer()); + ActiveLayerLine->setText(string); + p = p.fromImage(paintingArea->getImageOfActiveLayer()->getImageData()); + ActiveLayerImageButton->setIcon(p); + ActiveLayerImageButton->setIconSize(Buttonsize); - string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name()); - FirstColorButton->setStyleSheet(string); - string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name()); - SecondColorButton->setStyleSheet(string); + string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name()); + FirstColorButton->setStyleSheet(string); + string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name()); + SecondColorButton->setStyleSheet(string); } diff --git a/src/Image/IntelliImage.cpp b/src/Image/IntelliImage.cpp index 48deb91..c7edd6b 100644 --- a/src/Image/IntelliImage.cpp +++ b/src/Image/IntelliImage.cpp @@ -17,7 +17,7 @@ bool IntelliImage::loadImage(const QString &filePath){ QImage loadedImage; // If the image wasn't loaded leave this function - if (!loadedImage.load(filePath)) + if (!loadedImage.load(filePath)) return false; // scaled Image to size of Layer @@ -83,5 +83,5 @@ QColor IntelliImage::getPixelColor(QPoint& point){ } QImage IntelliImage::getImageData(){ - return imageData; + return imageData; } diff --git a/src/Image/IntelliImage.h b/src/Image/IntelliImage.h index 4d527cf..c8b26cc 100644 --- a/src/Image/IntelliImage.h +++ b/src/Image/IntelliImage.h @@ -24,8 +24,8 @@ public: * \brief The Types, which an Image can be. */ enum class ImageType { - RASTERIMAGE, - SHAPEDIMAGE + RASTERIMAGE, + SHAPEDIMAGE }; protected: @@ -125,7 +125,7 @@ virtual std::vector getPolygonData(){ } virtual ImageType getTypeOfImage(){ - return TypeOfImage; + return TypeOfImage; } /*! diff --git a/src/Image/IntelliRasterImage.cpp b/src/Image/IntelliRasterImage.cpp index cf141bd..ad0f935 100644 --- a/src/Image/IntelliRasterImage.cpp +++ b/src/Image/IntelliRasterImage.cpp @@ -5,7 +5,7 @@ IntelliRasterImage::IntelliRasterImage(int weight, int height) : IntelliImage(weight, height){ - TypeOfImage = IntelliImage::ImageType::RASTERIMAGE; + TypeOfImage = IntelliImage::ImageType::RASTERIMAGE; } IntelliRasterImage::~IntelliRasterImage(){ @@ -15,7 +15,7 @@ IntelliRasterImage::~IntelliRasterImage(){ IntelliImage* IntelliRasterImage::getDeepCopy(){ IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height()); raster->imageData.fill(Qt::transparent); - raster->TypeOfImage = IntelliImage::ImageType::RASTERIMAGE; + raster->TypeOfImage = IntelliImage::ImageType::RASTERIMAGE; return raster; } diff --git a/src/Image/IntelliShapedImage.cpp b/src/Image/IntelliShapedImage.cpp index 4fd7502..e5ddf4e 100644 --- a/src/Image/IntelliShapedImage.cpp +++ b/src/Image/IntelliShapedImage.cpp @@ -6,7 +6,7 @@ IntelliShapedImage::IntelliShapedImage(int weight, int height) : IntelliRasterImage(weight, height){ - TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE; + TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE; } IntelliShapedImage::~IntelliShapedImage(){ @@ -21,7 +21,7 @@ IntelliImage* IntelliShapedImage::getDeepCopy(){ IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height()); shaped->setPolygon(this->polygonData); shaped->imageData.fill(Qt::transparent); - shaped->TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE; + shaped->TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE; return shaped; } diff --git a/src/IntelliHelper/IntelliRenderSettings.cpp b/src/IntelliHelper/IntelliRenderSettings.cpp index 5673a2a..3424bb6 100644 --- a/src/IntelliHelper/IntelliRenderSettings.cpp +++ b/src/IntelliHelper/IntelliRenderSettings.cpp @@ -6,5 +6,5 @@ IntelliRenderSettings::IntelliRenderSettings() } bool IntelliRenderSettings::getFastRenderer(){ - return fastRenderer; + return fastRenderer; } diff --git a/src/IntelliHelper/IntelliRenderSettings.h b/src/IntelliHelper/IntelliRenderSettings.h index 5763bb0..e932435 100644 --- a/src/IntelliHelper/IntelliRenderSettings.h +++ b/src/IntelliHelper/IntelliRenderSettings.h @@ -5,16 +5,16 @@ class IntelliRenderSettings { public: - IntelliRenderSettings(); +IntelliRenderSettings(); - /*! - * \brief The getfastRenderer gets the value of the flag for the fastRenderer setting. - * \return Returns true if fastRenderer is active else false - */ - bool getFastRenderer(); +/*! + * \brief The getfastRenderer gets the value of the flag for the fastRenderer setting. + * \return Returns true if fastRenderer is active else false + */ +bool getFastRenderer(); private: - bool fastRenderer = true; +bool fastRenderer = true; }; #endif // INTELLIRENDERSETTINGS_H diff --git a/src/IntelliHelper/IntelliToolsettings.cpp b/src/IntelliHelper/IntelliToolsettings.cpp index 6f95d1c..7a4219c 100644 --- a/src/IntelliHelper/IntelliToolsettings.cpp +++ b/src/IntelliHelper/IntelliToolsettings.cpp @@ -3,9 +3,9 @@ IntelliToolsettings::IntelliToolsettings() { - lineWidth = 1; - innerAlpha = 255; - Linestyle = LineStyle::SOLID_LINE; + lineWidth = 1; + innerAlpha = 255; + Linestyle = LineStyle::SOLID_LINE; } IntelliToolsettings::~IntelliToolsettings(){ @@ -13,41 +13,41 @@ IntelliToolsettings::~IntelliToolsettings(){ } int IntelliToolsettings::getLineWidth(){ - return lineWidth; + return lineWidth; } void IntelliToolsettings::setLineWidth(){ - lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1); + 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; + if(LineWidth < 1) { + LineWidth = 1; + } + else if(LineWidth > 50) { + LineWidth = 50; + } + lineWidth = LineWidth; } int IntelliToolsettings::getInnerAlpha(){ - return this->innerAlpha; + return this->innerAlpha; } void IntelliToolsettings::setInnerAlpha(){ - this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Aplha Input", "Value",0,0,255,1); + 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; + if(innerAlpha < 0) { + innerAlpha = 0; + } + else if(innerAlpha > 255) { + innerAlpha = 255; + } + this->innerAlpha = innerAlpha; } IntelliToolsettings::LineStyle IntelliToolsettings::getLinestyle(){ - return Linestyle; + return Linestyle; } diff --git a/src/IntelliHelper/IntelliToolsettings.h b/src/IntelliHelper/IntelliToolsettings.h index 3907bb1..1a63bbc 100644 --- a/src/IntelliHelper/IntelliToolsettings.h +++ b/src/IntelliHelper/IntelliToolsettings.h @@ -3,27 +3,27 @@ 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(); +/*! + * \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; +int lineWidth; +int innerAlpha; +LineStyle Linestyle; }; #endif // INTELLITOOLSETTINGS_H diff --git a/src/IntelliHelper/IntelliTriangulation.cpp b/src/IntelliHelper/IntelliTriangulation.cpp index 42f44d9..d46288a 100644 --- a/src/IntelliHelper/IntelliTriangulation.cpp +++ b/src/IntelliHelper/IntelliTriangulation.cpp @@ -19,7 +19,7 @@ std::vector IntelliTriangulation::calculateTriangles(std::vector(sqrt(pow(AP.x(),2.)+pow(AP.y(),2.))*sqrt(pow(BP.x(),2.)+pow(BP.y(),2.))); + float absolute = static_cast(sqrt(pow(AP.x(),2.)+pow(AP.y(),2.))*sqrt(pow(BP.x(),2.)+pow(BP.y(),2.))); return acos(topSclar/absolute); }; @@ -46,7 +46,7 @@ std::vector IntelliTriangulation::calculateTriangles(std::vector(angle)<(pi/2.); + return static_cast(angle)<(pi/2.); }; std::vector Vertices; @@ -88,7 +88,7 @@ std::vector IntelliTriangulation::calculateTriangles(std::vector IntelliTriangulation::calculateTriangles(std::vector &triangles, QPoint &point){ for(auto triangle : triangles) { - if(IntelliTriangulation::isInTriangle(triangle, point)) { + if(IntelliTriangulation::isInTriangle(triangle, point)) { return true; } } diff --git a/src/IntelliHelper/IntelliTriangulation.h b/src/IntelliHelper/IntelliTriangulation.h index cbc6024..21ebfa3 100644 --- a/src/IntelliHelper/IntelliTriangulation.h +++ b/src/IntelliHelper/IntelliTriangulation.h @@ -34,9 +34,9 @@ inline bool isInTriangle(Triangle& tri, QPoint& P){ float val1, val2, val3; bool neg, pos; - val1 = IntelliTriangulation::sign(P,tri.A,tri.B); - val2 = IntelliTriangulation::sign(P,tri.B,tri.C); - val3 = IntelliTriangulation::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/Layer/PaintingArea.cpp b/src/Layer/PaintingArea.cpp index 6daf7c1..e55cc33 100644 --- a/src/Layer/PaintingArea.cpp +++ b/src/Layer/PaintingArea.cpp @@ -20,9 +20,9 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent) : QWidget(parent){ - this->Tool = nullptr; - this->setLayerDimensions(maxWidth, maxHeight); - this->addLayer(200,200,0,0,IntelliImage::ImageType::SHAPEDIMAGE); + this->Tool = nullptr; + this->setLayerDimensions(maxWidth, maxHeight); + this->addLayer(200,200,0,0,IntelliImage::ImageType::SHAPEDIMAGE); layerBundle[0].image->drawPlain(QColor(0,0,255,255)); std::vector polygon; polygon.push_back(QPoint(100,000)); @@ -31,7 +31,7 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent) polygon.push_back(QPoint(000,100)); layerBundle[0].image->setPolygon(polygon); - this->addLayer(200,200,150,150,IntelliImage::ImageType::RASTERIMAGE); + this->addLayer(200,200,150,150,IntelliImage::ImageType::RASTERIMAGE); layerBundle[1].image->drawPlain(QColor(0,255,0,255)); layerBundle[1].alpha=200; @@ -59,22 +59,22 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff newLayer.height = height; newLayer.widthOffset = widthOffset; newLayer.heightOffset = heightOffset; - if(type==IntelliImage::ImageType::RASTERIMAGE) { + if(type==IntelliImage::ImageType::RASTERIMAGE) { newLayer.image = new IntelliRasterImage(width,height); - }else if(type==IntelliImage::ImageType::SHAPEDIMAGE) { + }else if(type==IntelliImage::ImageType::SHAPEDIMAGE) { newLayer.image = new IntelliShapedImage(width, height); } newLayer.alpha = 255; this->layerBundle.push_back(newLayer); - activeLayer = static_cast(layerBundle.size())-1; - return activeLayer; + activeLayer = static_cast(layerBundle.size())-1; + return activeLayer; } void PaintingArea::deleteLayer(int idx){ if(idx(layerBundle.size())) { this->layerBundle.erase(layerBundle.begin()+idx); - if(activeLayer>=idx && activeLayer != 0) { + if(activeLayer>=idx && activeLayer != 0) { activeLayer--; } } @@ -105,7 +105,7 @@ bool PaintingArea::open(const QString &filePath){ return false; } IntelliImage* active = layerBundle[static_cast(activeLayer)].image; - bool open = active->loadImage(filePath); + bool open = active->loadImage(filePath); active->calculateVisiblity(); update(); return open; @@ -116,19 +116,19 @@ bool PaintingArea::save(const QString &filePath, const char*fileFormat){ if(layerBundle.size()==0) { return false; } - this->drawLayers(true); + this->drawLayers(true); if(!strcmp(fileFormat,"PNG")) { - QImage visibleImage = Canvas->convertToFormat(QImage::Format_Indexed8); + QImage visibleImage = Canvas->convertToFormat(QImage::Format_Indexed8); fileFormat = "png"; - if (visibleImage.save(filePath, fileFormat)) { + if (visibleImage.save(filePath, fileFormat)) { return true; } else { return false; } } - if (Canvas->save(filePath, fileFormat)) { + if (Canvas->save(filePath, fileFormat)) { return true; } else { return false; @@ -146,23 +146,23 @@ void PaintingArea::floodFill(int r, int g, int b, int a){ } void PaintingArea::movePositionActive(int x, int y){ - if(Tool!=nullptr){ - if(Tool->getIsDrawing()){ - IntelliTool* temp = copyActiveTool(); - delete this->Tool; - this->Tool = temp; - } - } - layerBundle[static_cast(activeLayer)].widthOffset += x; + if(Tool!=nullptr) { + if(Tool->getIsDrawing()) { + IntelliTool* temp = copyActiveTool(); + delete this->Tool; + this->Tool = temp; + } + } + layerBundle[static_cast(activeLayer)].widthOffset += x; layerBundle[static_cast(activeLayer)].heightOffset += y; } void PaintingArea::moveActiveLayer(int idx){ - if(Tool->getIsDrawing()){ - IntelliTool* temp = copyActiveTool(); - delete this->Tool; - this->Tool = temp; - } + if(Tool->getIsDrawing()) { + IntelliTool* temp = copyActiveTool(); + delete this->Tool; + this->Tool = temp; + } if(idx==1) { this->selectLayerUp(); }else if(idx==-1) { @@ -171,13 +171,13 @@ void PaintingArea::moveActiveLayer(int idx){ } void PaintingArea::slotActivateLayer(int a){ - if(Tool != nullptr){ - if(Tool->getIsDrawing()){ - IntelliTool* temp = copyActiveTool(); - delete this->Tool; - this->Tool = temp; - } - } + if(Tool != nullptr) { + if(Tool->getIsDrawing()) { + IntelliTool* temp = copyActiveTool(); + delete this->Tool; + this->Tool = temp; + } + } if(a>=0 && a < static_cast(layerBundle.size())) { this->setLayerActive(a); } @@ -199,52 +199,52 @@ void PaintingArea::colorPickerSwapColors(){ void PaintingArea::createPenTool(){ delete this->Tool; - Tool = new IntelliToolPen(this, &colorPicker, &Toolsettings); + Tool = new IntelliToolPen(this, &colorPicker, &Toolsettings); } void PaintingArea::createPlainTool(){ delete this->Tool; - Tool = new IntelliToolPlainTool(this, &colorPicker, &Toolsettings); + Tool = new IntelliToolPlainTool(this, &colorPicker, &Toolsettings); } void PaintingArea::createLineTool(){ delete this->Tool; - Tool = new IntelliToolLine(this, &colorPicker, &Toolsettings); + Tool = new IntelliToolLine(this, &colorPicker, &Toolsettings); } void PaintingArea::createRectangleTool(){ delete this->Tool; - Tool = new IntelliToolRectangle(this, &colorPicker, &Toolsettings); + Tool = new IntelliToolRectangle(this, &colorPicker, &Toolsettings); } void PaintingArea::createCircleTool(){ delete this->Tool; - Tool = new IntelliToolCircle(this, &colorPicker, &Toolsettings); + Tool = new IntelliToolCircle(this, &colorPicker, &Toolsettings); } void PaintingArea::createPolygonTool(){ delete this->Tool; - Tool = new IntelliToolPolygon(this, &colorPicker, &Toolsettings); + Tool = new IntelliToolPolygon(this, &colorPicker, &Toolsettings); } void PaintingArea::createFloodFillTool(){ delete this->Tool; - Tool = new IntelliToolFloodFill(this, &colorPicker, &Toolsettings); + Tool = new IntelliToolFloodFill(this, &colorPicker, &Toolsettings); } int PaintingArea::getWidthOfActive(){ - return this->layerBundle[static_cast(activeLayer)].width; + return this->layerBundle[static_cast(activeLayer)].width; } int PaintingArea::getHeightOfActive(){ - return this->layerBundle[static_cast(activeLayer)].height; + return this->layerBundle[static_cast(activeLayer)].height; } IntelliImage::ImageType PaintingArea::getTypeOfImageRealLayer(){ - return this->layerBundle[static_cast(activeLayer)].image->getTypeOfImage(); + return this->layerBundle[static_cast(activeLayer)].image->getTypeOfImage(); } std::vector PaintingArea::getPolygonDataOfRealLayer(){ - return this->layerBundle[static_cast(activeLayer)].image->getPolygonData(); + return this->layerBundle[static_cast(activeLayer)].image->getPolygonData(); } // If a mouse button is pressed check if it was the @@ -253,8 +253,8 @@ std::vector PaintingArea::getPolygonDataOfRealLayer(){ void PaintingArea::mousePressEvent(QMouseEvent*event){ if(Tool == nullptr) return; - int x = event->x()-layerBundle[static_cast(activeLayer)].widthOffset; - int y = event->y()-layerBundle[static_cast(activeLayer)].heightOffset; + int x = event->x()-layerBundle[static_cast(activeLayer)].widthOffset; + int y = event->y()-layerBundle[static_cast(activeLayer)].heightOffset; if(event->button() == Qt::LeftButton) { Tool->onMouseLeftPressed(x, y); }else if(event->button() == Qt::RightButton) { @@ -269,8 +269,8 @@ void PaintingArea::mousePressEvent(QMouseEvent*event){ void PaintingArea::mouseMoveEvent(QMouseEvent*event){ if(Tool == nullptr) return; - int x = event->x()-layerBundle[static_cast(activeLayer)].widthOffset; - int y = event->y()-layerBundle[static_cast(activeLayer)].heightOffset; + int x = event->x()-layerBundle[static_cast(activeLayer)].widthOffset; + int y = event->y()-layerBundle[static_cast(activeLayer)].heightOffset; Tool->onMouseMoved(x, y); update(); } @@ -279,8 +279,8 @@ void PaintingArea::mouseMoveEvent(QMouseEvent*event){ void PaintingArea::mouseReleaseEvent(QMouseEvent*event){ if(Tool == nullptr) return; - int x = event->x()-layerBundle[static_cast(activeLayer)].widthOffset; - int y = event->y()-layerBundle[static_cast(activeLayer)].heightOffset; + int x = event->x()-layerBundle[static_cast(activeLayer)].widthOffset; + int y = event->y()-layerBundle[static_cast(activeLayer)].heightOffset; if(event->button() == Qt::LeftButton) { Tool->onMouseLeftReleased(x, y); }else if(event->button() == Qt::RightButton) { @@ -290,20 +290,20 @@ void PaintingArea::mouseReleaseEvent(QMouseEvent*event){ } void PaintingArea::wheelEvent(QWheelEvent*event){ - if(this->Tool != nullptr){ - QPoint numDegrees = event->angleDelta() / 8; - if(!numDegrees.isNull()) { - QPoint numSteps = numDegrees / 15; - Tool->onWheelScrolled(numSteps.y()* -1); - } - } + if(this->Tool != nullptr) { + QPoint numDegrees = event->angleDelta() / 8; + if(!numDegrees.isNull()) { + QPoint numSteps = numDegrees / 15; + Tool->onWheelScrolled(numSteps.y()* -1); + } + } } // QPainter provides functions to draw on the widget // The QPaintEvent is sent to widgets that need to // update themselves void PaintingArea::paintEvent(QPaintEvent*event){ - this->drawLayers(); + this->drawLayers(); QPainter painter(this); QRect dirtyRec = event->rect(); @@ -323,15 +323,15 @@ void PaintingArea::resizeLayer(QImage*image_res, const QSize &newSize){ } void PaintingArea::selectLayerUp(){ - if(activeLayer!=-1 && static_cast(activeLayer)(activeLayer)], layerBundle[static_cast(activeLayer+1)]); + if(activeLayer!=-1 && static_cast(activeLayer)(activeLayer)], layerBundle[static_cast(activeLayer+1)]); activeLayer++; } } void PaintingArea::selectLayerDown(){ if(activeLayer!=-1 && activeLayer>0) { - std::swap(layerBundle[static_cast(activeLayer)], layerBundle[static_cast(activeLayer-1)]); + std::swap(layerBundle[static_cast(activeLayer)], layerBundle[static_cast(activeLayer-1)]); activeLayer--; } } @@ -375,32 +375,32 @@ void PaintingArea::createTempTopLayer(int idx){ if(idx>=0) { LayerObject newLayer; newLayer.alpha = 255; - newLayer.height = layerBundle[static_cast(idx)].height; - newLayer.width = layerBundle[static_cast(idx)].width; - newLayer.heightOffset = layerBundle[static_cast(idx)].heightOffset; - newLayer.widthOffset = layerBundle[static_cast(idx)].widthOffset; - newLayer.image = layerBundle[static_cast(idx)].image->getDeepCopy(); + newLayer.height = layerBundle[static_cast(idx)].height; + newLayer.width = layerBundle[static_cast(idx)].width; + newLayer.heightOffset = layerBundle[static_cast(idx)].heightOffset; + newLayer.widthOffset = layerBundle[static_cast(idx)].widthOffset; + newLayer.image = layerBundle[static_cast(idx)].image->getDeepCopy(); layerBundle.insert(layerBundle.begin()+idx+1,newLayer); } } IntelliTool* PaintingArea::copyActiveTool(){ - switch(Tool->getTooltype()){ - 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; - } + switch(Tool->getTooltype()) { + 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; + } } int PaintingArea::getNumberOfActiveLayer(){ - return activeLayer; + return activeLayer; } IntelliImage* PaintingArea::getImageOfActiveLayer(){ - return layerBundle[activeLayer].image; + return layerBundle[activeLayer].image; } diff --git a/src/Tool/IntelliTool.cpp b/src/Tool/IntelliTool.cpp index e75abdb..91979e3 100644 --- a/src/Tool/IntelliTool.cpp +++ b/src/Tool/IntelliTool.cpp @@ -4,7 +4,7 @@ IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){ this->Area=Area; this->colorPicker=colorPicker; - this->Toolsettings=Toolsettings; + this->Toolsettings=Toolsettings; } @@ -50,8 +50,8 @@ void IntelliTool::onWheelScrolled(int value){ void IntelliTool::createToolLayer(){ Area->createTempTopLayer(Area->activeLayer); - this->activeLayer=&Area->layerBundle[static_cast(Area->activeLayer)]; - this->Canvas=&Area->layerBundle[static_cast(Area->activeLayer+1)]; + this->activeLayer=&Area->layerBundle[static_cast(Area->activeLayer)]; + this->Canvas=&Area->layerBundle[static_cast(Area->activeLayer+1)]; } void IntelliTool::mergeToolLayer(){ @@ -74,7 +74,7 @@ void IntelliTool::mergeToolLayer(){ activeLayer->image->imageData.setPixelColor(x, y, clr_0); } } - Area->DumpyGui->UpdateGui(); + Area->DumpyGui->UpdateGui(); } void IntelliTool::deleteToolLayer(){ @@ -83,9 +83,9 @@ void IntelliTool::deleteToolLayer(){ } IntelliTool::Tooltype IntelliTool::getTooltype(){ - return ActiveType; + return ActiveType; } bool IntelliTool::getIsDrawing(){ - return isDrawing; + return isDrawing; } diff --git a/src/Tool/IntelliTool.h b/src/Tool/IntelliTool.h index ab4028a..4353018 100644 --- a/src/Tool/IntelliTool.h +++ b/src/Tool/IntelliTool.h @@ -13,15 +13,15 @@ class PaintingArea; */ class IntelliTool { public: - enum class Tooltype{ - CIRCLE, - FLOODFILL, - LINE, - PEN, - PLAIN, - POLYGON, - RECTANGLE - }; +enum class Tooltype { + CIRCLE, + FLOODFILL, + LINE, + PEN, + PLAIN, + POLYGON, + RECTANGLE +}; private: /*! * \brief A function that creates a layer to draw on. diff --git a/src/Tool/IntelliToolCircle.cpp b/src/Tool/IntelliToolCircle.cpp index 6d22618..b8e9d59 100644 --- a/src/Tool/IntelliToolCircle.cpp +++ b/src/Tool/IntelliToolCircle.cpp @@ -4,46 +4,46 @@ #include IntelliToolCircle::IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) - : IntelliTool(Area, colorPicker, Toolsettings){ - this->ActiveType = Tooltype::CIRCLE; + : IntelliTool(Area, colorPicker, Toolsettings){ + this->ActiveType = Tooltype::CIRCLE; } IntelliToolCircle::~IntelliToolCircle(){ - IntelliTool::onMouseRightPressed(0,0); + IntelliTool::onMouseRightPressed(0,0); } void IntelliToolCircle::drawCircle(int radius){ int outer = radius+20; QColor inner = this->colorPicker->getSecondColor(); - inner.setAlpha(Toolsettings->getInnerAlpha()); + inner.setAlpha(Toolsettings->getInnerAlpha()); int yMin, yMax, xMin, xMax; yMin = centerPoint.y()-radius; yMax = centerPoint.y()+radius; // x = x0+-sqrt(r2-(y-y0)2) 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))); + 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->drawLine(QPoint(xMin,i), QPoint(xMax,i),inner,1); } //TODO implement circle drawing algorithm bresenham - radius = static_cast(radius +(Toolsettings->getLineWidth()/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(),Toolsettings->getLineWidth()); - this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); + 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(),Toolsettings->getLineWidth()); + this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); } xMin = (centerPoint.x()-radius); xMax = (centerPoint.x()+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(),Toolsettings->getLineWidth()); - this->Canvas->image->drawPoint(QPoint(i, yMax), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); + 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(),Toolsettings->getLineWidth()); + this->Canvas->image->drawPoint(QPoint(i, yMax), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); } } @@ -69,7 +69,7 @@ void IntelliToolCircle::onMouseLeftReleased(int x, int y){ void IntelliToolCircle::onWheelScrolled(int value){ IntelliTool::onWheelScrolled(value); - Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value); + Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value); } void IntelliToolCircle::onMouseMoved(int x, int y){ diff --git a/src/Tool/IntelliToolFloodFill.cpp b/src/Tool/IntelliToolFloodFill.cpp index ed14009..cb135f8 100644 --- a/src/Tool/IntelliToolFloodFill.cpp +++ b/src/Tool/IntelliToolFloodFill.cpp @@ -6,12 +6,12 @@ #include IntelliToolFloodFill::IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) - : IntelliTool(Area, colorPicker, Toolsettings){ - this->ActiveType = Tooltype::FLOODFILL; + : IntelliTool(Area, colorPicker, Toolsettings){ + this->ActiveType = Tooltype::FLOODFILL; } IntelliToolFloodFill::~IntelliToolFloodFill(){ - IntelliTool::onMouseRightPressed(0,0); + IntelliTool::onMouseRightPressed(0,0); } void IntelliToolFloodFill::onMouseRightPressed(int x, int y){ diff --git a/src/Tool/IntelliToolLine.cpp b/src/Tool/IntelliToolLine.cpp index 0ccd9a1..97daa85 100644 --- a/src/Tool/IntelliToolLine.cpp +++ b/src/Tool/IntelliToolLine.cpp @@ -4,12 +4,12 @@ #include "QInputDialog" IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) - : IntelliTool(Area, colorPicker, Toolsettings){ - this->ActiveType = Tooltype::LINE; + : IntelliTool(Area, colorPicker, Toolsettings){ + this->ActiveType = Tooltype::LINE; } IntelliToolLine::~IntelliToolLine(){ - IntelliTool::onMouseRightPressed(0,0); + IntelliTool::onMouseRightPressed(0,0); } void IntelliToolLine::onMouseRightPressed(int x, int y){ @@ -23,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(),Toolsettings->getLineWidth()); + this->Canvas->image->drawPoint(lineStartingPoint, colorPicker->getFirstColor(),Toolsettings->getLineWidth()); Canvas->image->calculateVisiblity(); } @@ -33,21 +33,21 @@ void IntelliToolLine::onMouseLeftReleased(int x, int y){ void IntelliToolLine::onWheelScrolled(int value){ IntelliTool::onWheelScrolled(value); - Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value); + 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(Toolsettings->getLinestyle()) { - case IntelliToolsettings::LineStyle::SOLID_LINE: - this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),Toolsettings->getLineWidth()); + switch(Toolsettings->getLinestyle()) { + case IntelliToolsettings::LineStyle::SOLID_LINE: + this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),Toolsettings->getLineWidth()); break; - case IntelliToolsettings::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); + int m = static_cast(static_cast(p2.y()-p1.y())/static_cast(p2.x()-p1.x())+0.5f); int c = lineStartingPoint.y()-lineStartingPoint.x()*m; break; diff --git a/src/Tool/IntelliToolPen.cpp b/src/Tool/IntelliToolPen.cpp index 61af1c4..70f2dc3 100644 --- a/src/Tool/IntelliToolPen.cpp +++ b/src/Tool/IntelliToolPen.cpp @@ -5,12 +5,12 @@ #include "QInputDialog" IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) - : IntelliTool(Area, colorPicker, Toolsettings){ - this->ActiveType = Tooltype::PEN; + : IntelliTool(Area, colorPicker, Toolsettings){ + this->ActiveType = Tooltype::PEN; } IntelliToolPen::~IntelliToolPen(){ - IntelliTool::onMouseRightPressed(0,0); + IntelliTool::onMouseRightPressed(0,0); } void IntelliToolPen::onMouseRightPressed(int x, int y){ @@ -24,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(), Toolsettings->getLineWidth()); + this->Canvas->image->drawPoint(previousPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth()); Canvas->image->calculateVisiblity(); } @@ -35,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(), Toolsettings->getLineWidth()); + this->Canvas->image->drawLine(this->previousPoint, newPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth()); this->previousPoint=newPoint; } IntelliTool::onMouseMoved(x,y); @@ -43,5 +43,5 @@ void IntelliToolPen::onMouseMoved(int x, int y){ void IntelliToolPen::onWheelScrolled(int value){ IntelliTool::onWheelScrolled(value); - Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value); + Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value); } diff --git a/src/Tool/IntelliToolPlain.cpp b/src/Tool/IntelliToolPlain.cpp index 51984a2..13bce09 100644 --- a/src/Tool/IntelliToolPlain.cpp +++ b/src/Tool/IntelliToolPlain.cpp @@ -3,12 +3,12 @@ #include "QColorDialog" IntelliToolPlainTool::IntelliToolPlainTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) - : IntelliTool(Area, colorPicker, Toolsettings){ - this->ActiveType = Tooltype::PLAIN; + : IntelliTool(Area, colorPicker, Toolsettings){ + this->ActiveType = Tooltype::PLAIN; } IntelliToolPlainTool::~IntelliToolPlainTool(){ - IntelliTool::onMouseRightPressed(0,0); + IntelliTool::onMouseRightPressed(0,0); } void IntelliToolPlainTool::onMouseLeftPressed(int x, int y){ diff --git a/src/Tool/IntelliToolPolygon.cpp b/src/Tool/IntelliToolPolygon.cpp index ae8b55e..452c2bc 100644 --- a/src/Tool/IntelliToolPolygon.cpp +++ b/src/Tool/IntelliToolPolygon.cpp @@ -5,63 +5,63 @@ #include IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) - : IntelliTool(Area, colorPicker, Toolsettings){ + : IntelliTool(Area, colorPicker, Toolsettings){ isPointNearStart = false; isDrawing = false; - isInside = false; - this->ActiveType = Tooltype::POLYGON; + isInside = false; + this->ActiveType = Tooltype::POLYGON; } IntelliToolPolygon::~IntelliToolPolygon(){ - if(isDrawing){ - IntelliTool::onMouseRightPressed(0,0); - } + if(isDrawing) { + IntelliTool::onMouseRightPressed(0,0); + } } void IntelliToolPolygon::onMouseLeftPressed(int x, int y){ - if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && xgetWidthOfActive() && ygetHeightOfActive()){ - std::vector Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer()); - QPoint Point(x,y); - isInside = IntelliTriangulation::isInPolygon(Triangles,Point); - } - else if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::RASTERIMAGE && x > 0 && y > 0 && xgetWidthOfActive() && ygetHeightOfActive()){ - isInside = true; - } + if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && xgetWidthOfActive() && ygetHeightOfActive()) { + std::vector Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer()); + QPoint Point(x,y); + isInside = IntelliTriangulation::isInPolygon(Triangles,Point); + } + else if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::RASTERIMAGE && x > 0 && y > 0 && xgetWidthOfActive() && ygetHeightOfActive()) { + isInside = true; + } - if(isInside && !isDrawing) { + if(isInside && !isDrawing) { IntelliTool::onMouseLeftPressed(x,y); QPoint drawingPoint = QPoint(x,y); isDrawing = true; QPointList.push_back(drawingPoint); - this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), Toolsettings->getLineWidth()); + 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(), Toolsettings->getLineWidth()); - this->Canvas->image->calculateVisiblity(); - } - else{ - isInside = false; - isDrawing = false; - QPointList.clear(); - IntelliTool::onMouseRightPressed(x,y); - } + if(QPointList.size() > 2) { + isPointNearStart = true; + this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth()); + this->Canvas->image->calculateVisiblity(); + } + else{ + isInside = false; + isDrawing = false; + QPointList.clear(); + IntelliTool::onMouseRightPressed(x,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(), Toolsettings->getLineWidth()); + this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), Toolsettings->getLineWidth()); this->Canvas->image->calculateVisiblity(); } } void IntelliToolPolygon::onMouseRightPressed(int x, int y){ - isInside = false; + isInside = false; isDrawing = false; isPointNearStart = false; QPointList.clear(); @@ -69,14 +69,14 @@ void IntelliToolPolygon::onMouseRightPressed(int x, int y){ } void IntelliToolPolygon::onMouseLeftReleased(int x, int y){ - if(isPointNearStart) { - isInside = false; + if(isPointNearStart) { + isInside = false; isPointNearStart = false; isDrawing = false; std::vector Triangles = IntelliTriangulation::calculateTriangles(QPointList); QPoint Point; QColor colorTwo(colorPicker->getSecondColor()); - colorTwo.setAlpha(Toolsettings->getInnerAlpha()); + colorTwo.setAlpha(Toolsettings->getInnerAlpha()); for(int i = 0; i < activeLayer->width; i++) { for(int j = 0; j < activeLayer->height; j++) { Point = QPoint(i,j); @@ -85,9 +85,9 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){ } } } - 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(), Toolsettings->getLineWidth()); + 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(), Toolsettings->getLineWidth()); } QPointList.clear(); IntelliTool::onMouseLeftReleased(x,y); @@ -101,7 +101,7 @@ void IntelliToolPolygon::onMouseRightReleased(int x, int y){ void IntelliToolPolygon::onWheelScrolled(int value){ IntelliTool::onWheelScrolled(value); if(!isDrawing) { - Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value); + Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value); } } @@ -113,7 +113,7 @@ bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){ bool isNear = false; int StartX = Startpoint.x(); int StartY = Startpoint.y(); - int valueToNear = 5; + int valueToNear = 5; for(int i = StartX - valueToNear; i < StartX + valueToNear; i++) { for(int j = StartY - valueToNear; j < StartY + valueToNear; j++) { diff --git a/src/Tool/IntelliToolRectangle.cpp b/src/Tool/IntelliToolRectangle.cpp index e92eb10..29fa038 100644 --- a/src/Tool/IntelliToolRectangle.cpp +++ b/src/Tool/IntelliToolRectangle.cpp @@ -3,30 +3,30 @@ #include "QInputDialog" IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) - : IntelliTool(Area, colorPicker, Toolsettings){ - this->ActiveType = Tooltype::RECTANGLE; + : IntelliTool(Area, colorPicker, Toolsettings){ + this->ActiveType = Tooltype::RECTANGLE; } IntelliToolRectangle::~IntelliToolRectangle(){ - IntelliTool::onMouseRightPressed(0,0); + IntelliTool::onMouseRightPressed(0,0); } void IntelliToolRectangle::drawRectangle(QPoint otherCorner){ - int xMin = std::min(originCorner.x(), otherCorner.x()); - int xMax = std::max(originCorner.x(), otherCorner.x()); + int xMin = std::min(originCorner.x(), otherCorner.x()); + int xMax = std::max(originCorner.x(), otherCorner.x()); - int yMin = std::min(originCorner.y(), otherCorner.y()); - int yMax = std::max(originCorner.y(), otherCorner.y()); + int yMin = std::min(originCorner.y(), otherCorner.y()); + int yMax = std::max(originCorner.y(), otherCorner.y()); QColor clr = colorPicker->getSecondColor(); - clr.setAlpha(Toolsettings->getInnerAlpha()); + 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(), 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()); + 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){ @@ -59,5 +59,5 @@ void IntelliToolRectangle::onMouseMoved(int x, int y){ void IntelliToolRectangle::onWheelScrolled(int value){ IntelliTool::onWheelScrolled(value); - Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value); + Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value); }