diff --git a/src/Tool/IntelliTool.cpp b/src/Tool/IntelliTool.cpp index 7d85547..995c37e 100644 --- a/src/Tool/IntelliTool.cpp +++ b/src/Tool/IntelliTool.cpp @@ -79,7 +79,10 @@ void IntelliTool::mergeToolLayer(){ updatedImage.setPixelColor(x, y, clr_0); } } - activeLayer->image->setImageData(updatedImage); + activeLayer->image->setImageData(updatedImage); + if(Canvas->image->getPolygonData().size() != 0){ + activeLayer->image->setPolygon(Canvas->image->getPolygonData()); + } Area->DummyGui->UpdateGui(); } diff --git a/src/Tool/IntelliToolPolygon.cpp b/src/Tool/IntelliToolPolygon.cpp index 452c2bc..84923c3 100644 --- a/src/Tool/IntelliToolPolygon.cpp +++ b/src/Tool/IntelliToolPolygon.cpp @@ -73,24 +73,30 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){ isInside = false; isPointNearStart = false; isDrawing = false; - std::vector Triangles = IntelliTriangulation::calculateTriangles(QPointList); - QPoint Point; - QColor colorTwo(colorPicker->getSecondColor()); - 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(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(), Toolsettings->getLineWidth()); - } - QPointList.clear(); - IntelliTool::onMouseLeftReleased(x,y); + if(false){ + std::vector Triangles = IntelliTriangulation::calculateTriangles(QPointList); + QPoint Point; + QColor colorTwo(colorPicker->getSecondColor()); + 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(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(), Toolsettings->getLineWidth()); + } + + } + else{ + Canvas->image->setPolygon(QPointList); + } + IntelliTool::onMouseLeftReleased(x,y); + QPointList.clear(); } } diff --git a/src/Tool/IntelliToolPolygon.h b/src/Tool/IntelliToolPolygon.h index 920a556..d4a7561 100644 --- a/src/Tool/IntelliToolPolygon.h +++ b/src/Tool/IntelliToolPolygon.h @@ -91,7 +91,6 @@ virtual void onWheelScrolled(int value) override; */ virtual void onMouseMoved(int x, int y) override; - }; #endif // INTELLITOOLPOLYGON_H