diff --git a/Examples/biggest_flex_featureimage.jpg b/Examples/biggest_flex_featureimage.jpg deleted file mode 100644 index e830e0a..0000000 Binary files a/Examples/biggest_flex_featureimage.jpg and /dev/null differ diff --git a/Examples/farbkreis_featuredimage.png b/Examples/farbkreis_featuredimage.png deleted file mode 100644 index 10e2872..0000000 Binary files a/Examples/farbkreis_featuredimage.png and /dev/null differ diff --git a/cppcheck_config.txt b/cppcheck_config.txt index 6f6a929..ba080ef 100644 --- a/cppcheck_config.txt +++ b/cppcheck_config.txt @@ -1,34 +1,61 @@ -src/GUI/IntelliInputDialog.h:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/GUI/IntelliInputDialog.h:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/GUI/IntelliInputDialog.cpp:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/GUI/IntelliInputDialog.h:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/GUI/IntelliPhotoGui.h:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/GUI/IntelliInputDialog.h:6:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/GUI/IntelliPhotoGui.h:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/GUI/IntelliInputDialog.h:7:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/GUI/IntelliPhotoGui.h:6:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/GUI/IntelliInputDialog.h:8:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/GUI/IntelliPhotoGui.h:7:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/GUI/IntelliInputDialog.h:9:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/GUI/IntelliPhotoGui.h:8:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/GUI/IntelliInputDialog.h:10:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/GUI/IntelliPhotoGui.h:9:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/GUI/IntelliPhotoGui.h:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/GUI/IntelliPhotoGui.h:10:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/GUI/IntelliPhotoGui.h:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/GUI/IntelliPhotoGui.h:11:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/GUI/IntelliPhotoGui.h:6:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/GUI/IntelliPhotoGui.h:12:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/GUI/IntelliPhotoGui.h:7:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:8:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:9:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:10:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:11:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:12:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:13:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:14:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:15:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliPhotoGui.h:16:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ src/GUI/IntelliPhotoGui.cpp:4:0: information: Include file: "Layer/PaintingArea.h" not found. [missingInclude] @@ -82,10 +109,10 @@ src/IntelliHelper/IntelliColorPicker.h:6:0: information: Include file: "QColorDi src/IntelliHelper/IntelliToolsettings.cpp:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/IntelliHelper/IntelliTriangulation.h:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/IntelliHelper/IntelliTriangulation.h:7:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ -src/IntelliHelper/IntelliTriangulation.h:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +src/IntelliHelper/IntelliTriangulation.h:8:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ src/IntelliHelper/IntelliTriangulation.cpp:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] @@ -171,12 +198,6 @@ src/Layer/PaintingArea.cpp:18:0: information: Include file: "Tool/IntelliToolFlo ^ src/Layer/PaintingArea.cpp:19:0: information: Include file: "Tool/IntelliToolPolygon.h" not found. [missingInclude] -^ -src/Tool/IntelliColorPicker.cpp:1:0: information: Include file: "IntelliColorPicker.h" not found. [missingInclude] - -^ -src/Tool/IntelliColorPicker.cpp:2:0: information: Include file: "QDebug" not found. [missingInclude] - ^ src/Tool/IntelliTool.h:4:0: information: Include file: "IntelliHelper/IntelliColorPicker.h" not found. [missingInclude] @@ -282,6 +303,9 @@ src/Tool/IntelliToolPolygon.cpp:4:0: information: Include file: n ^ src/Tool/IntelliToolPolygon.cpp:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] +^ +src/Tool/IntelliToolPolygon.cpp:6:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + ^ src/Tool/IntelliToolRectangle.h:6:0: information: Include file: "QColor" not found. [missingInclude] @@ -304,3 +328,54 @@ src/main.cpp:3:0: information: Include file: not found. Please note: Cp src/main.cpp:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ +src/mainUnitTest.cpp:1:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/mainUnitTest.cpp:3:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/mainUnitTest.cpp:252:0: information: Include file: "tst_unittest.moc" not found. [missingInclude] + +^ +src/tst_unittest.cpp:1:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/tst_unittest.cpp:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliImage.h:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliImage.h:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliImage.h:6:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliImage.h:7:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliImage.h:8:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliImage.h:9:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/Image/IntelliImage.h:11:0: information: Include file: "IntelliHelper/IntelliTriangulation.h" not found. [missingInclude] + +^ +src/Image/IntelliImage.h:12:0: information: Include file: "IntelliHelper/IntelliRenderSettings.h" not found. [missingInclude] + +^ +src/Image/IntelliRasterImage.h:4:0: information: Include file: "Image/IntelliImage.h" not found. [missingInclude] + +^ +src/Image/IntelliShapedImage.h:4:0: information: Include file: "Image/IntelliRasterImage.h" not found. [missingInclude] + +^ +src/Image/IntelliShapedImage.h:5:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/tst_unittest.cpp:1697:0: information: Include file: "tst_unittest.moc" not found. [missingInclude] + +^ diff --git a/cppcheck_errors.txt b/cppcheck_errors.txt index bf06cfd..99be2cd 100644 --- a/cppcheck_errors.txt +++ b/cppcheck_errors.txt @@ -1,79 +1,298 @@ -src/IntelliHelper/IntelliColorPicker.cpp:4:3: performance: Variable 'firstColor' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList] - firstColor = {255,0,0,255}; - ^ -src/IntelliHelper/IntelliColorPicker.cpp:5:3: performance: Variable 'secondColor' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList] - secondColor = {0,255,255,255}; - ^ -src/IntelliHelper/IntelliTriangulation.cpp:116:63: style: Parameter 'triangles' can be declared with const [constParameter] -bool IntelliTriangulation::isInPolygon(std::vector &triangles, QPoint &point){ - ^ -src/Layer/PaintingArea.cpp:344:22: style: Redundant condition: If 'activeLayer > 0', the comparison 'activeLayer != -1' is always true. [redundantCondition] - if(activeLayer!=-1 && activeLayer>0) { - ^ -src/Tool/IntelliTool.cpp:4:14: warning: Member variable 'IntelliTool::ActiveType' is not initialized in the constructor. [uninitMemberVar] -IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){ - ^ -src/Tool/IntelliTool.cpp:4:14: warning: Member variable 'IntelliTool::activeLayer' is not initialized in the constructor. [uninitMemberVar] -IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){ - ^ -src/Tool/IntelliTool.cpp:4:14: warning: Member variable 'IntelliTool::Canvas' is not initialized in the constructor. [uninitMemberVar] -IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){ - ^ -src/Tool/IntelliToolCircle.cpp:42:9: style: Local variable 'yMin' shadows outer variable [shadowVariable] - int yMin = static_cast(centerPoint.y() - sqrt(pow(radius,2) - pow(i - centerPoint.x(),2))); - ^ -src/Tool/IntelliToolCircle.cpp:18:7: note: Shadowed declaration - int yMin, yMax, xMin, xMax; - ^ -src/Tool/IntelliToolCircle.cpp:42:9: note: Shadow variable - int yMin = static_cast(centerPoint.y() - sqrt(pow(radius,2) - pow(i - centerPoint.x(),2))); - ^ -src/Tool/IntelliToolCircle.cpp:43:9: style: Local variable 'yMax' shadows outer variable [shadowVariable] - int yMax = static_cast(centerPoint.y() + sqrt(pow(radius,2) - pow(i - centerPoint.x(),2))); - ^ -src/Tool/IntelliToolCircle.cpp:18:13: note: Shadowed declaration - int yMin, yMax, xMin, xMax; - ^ -src/Tool/IntelliToolCircle.cpp:43:9: note: Shadow variable - int yMax = static_cast(centerPoint.y() + sqrt(pow(radius,2) - pow(i - centerPoint.x(),2))); - ^ -src/Tool/IntelliToolPolygon.h:25:6: warning: The class 'IntelliToolPolygon' defines member variable with name 'isDrawing' also defined in its parent class 'IntelliTool'. [duplInheritedMember] -bool isDrawing; - ^ -src/Tool/IntelliTool.h:69:6: note: Parent variable 'IntelliTool::isDrawing' -bool isDrawing = false; - ^ -src/Tool/IntelliToolPolygon.h:25:6: note: Derived variable 'IntelliToolPolygon::isDrawing' -bool isDrawing; - ^ +src/tst_unittest.cpp:1370:0: style: The function 'bench_Circle_fullDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1388:0: style: The function 'bench_Circle_interruptedDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1409:0: style: The function 'bench_FloodFill_fullDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1427:0: style: The function 'bench_FloodFill_interruptedDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1448:0: style: The function 'bench_Line_fullDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1466:0: style: The function 'bench_Line_interruptedDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1487:0: style: The function 'bench_Pen_fullDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1505:0: style: The function 'bench_Pen_interruptedDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1525:0: style: The function 'bench_Plain_fullDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1543:0: style: The function 'bench_Plain_interruptedDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1563:0: style: The function 'bench_Polygon_fullDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1602:0: style: The function 'bench_Polygon_interruptedDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1222:0: style: The function 'bench_RasterImage_drawLine' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1210:0: style: The function 'bench_RasterImage_drawPixel' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1235:0: style: The function 'bench_RasterImage_drawPoint' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1247:0: style: The function 'bench_RasterImage_getDisplayable' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1269:0: style: The function 'bench_RasterImage_getImageData' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1257:0: style: The function 'bench_RasterImage_getPixelColor' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1279:0: style: The function 'bench_RasterImage_setImageData' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1626:0: style: The function 'bench_Rectangle_fullDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1645:0: style: The function 'bench_Rectangle_interruptedDraw' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1302:0: style: The function 'bench_ShapedImage_drawLine' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1290:0: style: The function 'bench_ShapedImage_drawPixel' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1315:0: style: The function 'bench_ShapedImage_drawPoint' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1327:0: style: The function 'bench_ShapedImage_getDisplayable' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1349:0: style: The function 'bench_ShapedImage_getImageData' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1337:0: style: The function 'bench_ShapedImage_getPixelColor' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1359:0: style: The function 'bench_ShapedImage_setImageData' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1666:0: style: The function 'bench_Triangulation_Coverage' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1079:0: style: The function 'bench_addLayer' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1180:0: style: The function 'bench_createTools' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1086:0: style: The function 'bench_deleteLayer' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1115:0: style: The function 'bench_floodFill' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1125:0: style: The function 'bench_moveActive' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1093:0: style: The function 'bench_setActive' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1105:0: style: The function 'bench_setAlpha' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1168:0: style: The function 'bench_setLayerDown' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1155:0: style: The function 'bench_setLayerUp' is never used. [unusedFunction] + +^ +src/tst_unittest.cpp:1138:0: style: The function 'bench_setPolygon' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:118:0: style: The function 'cleanupTestCase' is never used. [unusedFunction] + +^ src/GUI/IntelliPhotoGui.cpp:23:0: style: The function 'closeEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:271:0: style: The function 'mouseMoveEvent' is never used. [unusedFunction] +src/mainUnitTest.cpp:113:0: style: The function 'initTestCase' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:252:0: style: The function 'mousePressEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:281:0: style: The function 'mouseMoveEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:284:0: style: The function 'mouseReleaseEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:262:0: style: The function 'mousePressEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:314:0: style: The function 'paintEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:294:0: style: The function 'mouseReleaseEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:325:0: style: The function 'resizeEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:324:0: style: The function 'paintEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:330:0: style: The function 'resizeLayer' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:180:0: style: The function 'slotActivateLayer' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:170:0: style: The function 'slotActivateLayer' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:96:0: style: The function 'slotDeleteActiveLayer' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:88:0: style: The function 'slotDeleteActiveLayer' is never used. [unusedFunction] +src/mainUnitTest.cpp:211:0: style: The function 'test_Circle_fullDraw' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:299:0: style: The function 'wheelEvent' is never used. [unusedFunction] +src/mainUnitTest.cpp:213:0: style: The function 'test_Circle_interruptedDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:216:0: style: The function 'test_FloodFill_fullDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:218:0: style: The function 'test_FloodFill_interruptedDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:221:0: style: The function 'test_Line_fullDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:223:0: style: The function 'test_Line_interruptedDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:226:0: style: The function 'test_Pen_fullDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:228:0: style: The function 'test_Pen_interruptedDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:231:0: style: The function 'test_Plain_fullDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:233:0: style: The function 'test_Plain_interruptedDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:236:0: style: The function 'test_Polygon_fullDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:238:0: style: The function 'test_Polygon_interruptedDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:157:0: style: The function 'test_RasterImage_drawLine' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:155:0: style: The function 'test_RasterImage_drawPixel' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:159:0: style: The function 'test_RasterImage_drawPoint' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:161:0: style: The function 'test_RasterImage_getDisplayable' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:169:0: style: The function 'test_RasterImage_getImageData' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:167:0: style: The function 'test_RasterImage_getPixelColor' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:165:0: style: The function 'test_RasterImage_loadImage' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:171:0: style: The function 'test_RasterImage_setImageData' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:163:0: style: The function 'test_RasterImage_setPolygon' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:241:0: style: The function 'test_Rectangle_fullDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:243:0: style: The function 'test_Rectangle_interruptedDraw' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:177:0: style: The function 'test_ShapedImage_drawLine' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:175:0: style: The function 'test_ShapedImage_drawPixel' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:179:0: style: The function 'test_ShapedImage_drawPoint' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:181:0: style: The function 'test_ShapedImage_getDisplayable' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:189:0: style: The function 'test_ShapedImage_getImageData' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:187:0: style: The function 'test_ShapedImage_getPixelColor' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:185:0: style: The function 'test_ShapedImage_loadImage' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:191:0: style: The function 'test_ShapedImage_setImageData' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:183:0: style: The function 'test_ShapedImage_setPolygon' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:247:0: style: The function 'test_Triangulation_Coverage' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:132:0: style: The function 'test_addLayer' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:195:0: style: The function 'test_createTool_Circle' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:197:0: style: The function 'test_createTool_FloodFill' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:199:0: style: The function 'test_createTool_Line' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:201:0: style: The function 'test_createTool_Pen' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:203:0: style: The function 'test_createTool_Plain' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:205:0: style: The function 'test_createTool_Polygon' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:207:0: style: The function 'test_createTool_Rectangle' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:151:0: style: The function 'test_createTools' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:134:0: style: The function 'test_deleteLayer' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:140:0: style: The function 'test_floodFill' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:142:0: style: The function 'test_moveActive' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:136:0: style: The function 'test_setActive' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:138:0: style: The function 'test_setAlpha' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:148:0: style: The function 'test_setLayerDown' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:146:0: style: The function 'test_setLayerUp' is never used. [unusedFunction] + +^ +src/mainUnitTest.cpp:144:0: style: The function 'test_setPolygon' is never used. [unusedFunction] + +^ +src/Layer/PaintingArea.cpp:309:0: style: The function 'wheelEvent' is never used. [unusedFunction] ^ nofile:0:0: information: Cppcheck cannot find all the include files (use --check-config for details) [missingInclude] diff --git a/docs/html/_intelli_color_picker_8cpp_source.html b/docs/html/_intelli_color_picker_8cpp_source.html index 7d1ff02..cf20522 100644 --- a/docs/html/_intelli_color_picker_8cpp_source.html +++ b/docs/html/_intelli_color_picker_8cpp_source.html @@ -89,42 +89,46 @@ $(document).ready(function(){initNavTree('_intelli_color_picker_8cpp_source.html Go to the documentation of this file.
1 #include "IntelliColorPicker.h"
2 
-
4  firstColor = QColor(255,0,0,255);
-
5  secondColor = QColor(0,255,255,255);
-
6 }
-
7 
- -
9 
-
10 }
-
11 
- -
13  std::swap(firstColor, secondColor);
-
14 }
-
15 
- -
17  return this->firstColor;
-
18 }
-
19 
- -
21  return this->secondColor;
-
22 }
-
23 
- -
25  this->firstColor = Color;
-
26 }
-
27 
- -
29  this->secondColor = Color;
-
30 }
+
4  initializeColors();
+
5 }
+
6 
+ +
8 
+
9 }
+
10 
+ +
12  std::swap(firstColor, secondColor);
+
13 }
+
14 
+ +
16  return this->firstColor;
+
17 }
+
18 
+ +
20  return this->secondColor;
+
21 }
+
22 
+ +
24  this->firstColor = Color;
+
25 }
+
26 
+ +
28  this->secondColor = Color;
+
29 }
+
30 
+
31 void IntelliColorPicker::initializeColors(){
+
32  this->firstColor = QColor(255,0,0,255);
+
33  this->secondColor = QColor(0,0,0,255);
+
34 }
-
virtual ~IntelliColorPicker()
IntelliColorPicker destructor clears up his used memory, if there is some.
-
void setSecondColor(QColor Color)
A function to set the secondary color.
-
QColor getSecondColor()
A function to read the secondary selected color.
+
virtual ~IntelliColorPicker()
IntelliColorPicker destructor clears up his used memory, if there is some.
+
void setSecondColor(QColor Color)
A function to set the secondary color.
+
QColor getSecondColor()
A function to read the secondary selected color.
-
void setFirstColor(QColor Color)
A function to set the primary color.
-
QColor getFirstColor()
A function to read the primary selected color.
-
void swapColors()
A function switching primary and secondary color.
+
void setFirstColor(QColor Color)
A function to set the primary color.
+
QColor getFirstColor()
A function to read the primary selected color.
+
void swapColors()
A function switching primary and secondary color.
IntelliColorPicker()
IntelliColorPicker constructor, setting 2 preset colors, be careful, theese color may change in produ...
-
virtual ~IntelliColorPicker()
IntelliColorPicker destructor clears up his used memory, if there is some.
-
void setSecondColor(QColor Color)
A function to set the secondary color.
-
QColor getSecondColor()
A function to read the secondary selected color.
-
void setFirstColor(QColor Color)
A function to set the primary color.
-
QColor getFirstColor()
A function to read the primary selected color.
+
virtual ~IntelliColorPicker()
IntelliColorPicker destructor clears up his used memory, if there is some.
+
void setSecondColor(QColor Color)
A function to set the secondary color.
+
QColor getSecondColor()
A function to read the secondary selected color.
+
void setFirstColor(QColor Color)
A function to set the primary color.
+
QColor getFirstColor()
A function to read the primary selected color.
The IntelliColorPicker manages the selected colors for one whole project.
-
void swapColors()
A function switching primary and secondary color.
+
void swapColors()
A function switching primary and secondary color.
IntelliColorPicker()
IntelliColorPicker constructor, setting 2 preset colors, be careful, theese color may change in produ...
void createCircleTool()
@@ -915,7 +963,7 @@ $(document).ready(function(){initNavTree('_intelli_photo_gui_8cpp_source.html','
void setLayerActive(int idx)
The setLayerToActive method marks a specific layer as active.
void deleteLayer(int idx, bool isTool=false)
The deleteLayer method removes a layer at a given idx.
-
QColor getSecondColor()
A function to read the secondary selected color.
+
QColor getSecondColor()
A function to read the secondary selected color.
void createPlainTool()
IntelliPhotoGui()
The IntelliPhotoGui method is the constructor and is used to create a new instance of the main progra...
The PaintingArea class manages the methods and stores information about the current painting area,...
Definition: PaintingArea.h:53
@@ -929,16 +977,16 @@ $(document).ready(function(){initNavTree('_intelli_photo_gui_8cpp_source.html','
void closeEvent(QCloseEvent *event) override
The closeEvent function handles closing events.
virtual QImage getImageData()
getImageData returns the data of the current image (Note: It will allways return a ARGB32bit QImage!...
-
void setToolWidth(int value)
+
void setToolWidth(int value)
bool open(const QString &filePath)
The open method is used for loading a picture into the current layer.
void createPolygonTool()
void moveActiveLayer(int idx)
The moveActiveLayer moves the active layer to a specific position in the layer stack.
IntelliColorPicker colorPicker
Definition: PaintingArea.h:202
-
QColor getFirstColor()
A function to read the primary selected color.
+
QColor getFirstColor()
A function to read the primary selected color.
void createFloodFillTool()
void setInnerAlpha(int innerAlpha)
- +
IntelliToolsettings Toolsettings
Definition: PaintingArea.h:201
void setPolygon(int idx)
setPolygon is used for setting polygondata, it only works on RASTER images
diff --git a/docs/html/_intelli_photo_gui_8h_source.html b/docs/html/_intelli_photo_gui_8h_source.html index 918ad77..c09ecc4 100644 --- a/docs/html/_intelli_photo_gui_8h_source.html +++ b/docs/html/_intelli_photo_gui_8h_source.html @@ -165,119 +165,127 @@ $(document).ready(function(){initNavTree('_intelli_photo_gui_8h_source.html','')
86 
87 void slotAboutDialog();
88 
-
89 void slotEnterPressed();
+
89 void slotChangeDim();
90 
-
91 void slotSetWidth();
-
92 void slotSetInnerAlpha();
-
93 
-
94 void slotResetTools();
+
91 void slotEnterPressed();
+
92 
+
93 void slotSetWidth();
+
94 void slotSetInnerAlpha();
95 
-
96 private:
-
97 void createActions();
-
98 void createMenus();
-
99 void createGui();
-
100 // Set the style of the GUI
-
101 void setIntelliStyle();
-
102 
-
103 // Will check if changes have occurred since last save
-
104 bool maybeSave();
-
105 // Opens the Save dialog and saves
-
106 bool saveFile(const QByteArray &fileFormat);
-
107 
-
108 void setDefaultToolValue();
+
96 void slotResetTools();
+
97 
+
98 private:
+
99 void createActions();
+
100 void createMenus();
+
101 void createGui();
+
102 // Set the style of the GUI
+
103 void setIntelliStyle();
+
104 
+
105 // Will check if changes have occurred since last save
+
106 bool maybeSave();
+
107 // Opens the Save dialog and saves
+
108 bool saveFile(const QByteArray &fileFormat);
109 
-
110 // What we'll draw on
-
111 PaintingArea* paintingArea;
-
112 
-
113 const QSize Buttonsize = QSize(35,35);
-
114 QPixmap preview;
-
115 QPushButton* CircleButton;
-
116 QPushButton* FloodFillButton;
-
117 QPushButton* LineButton;
-
118 QPushButton* PenButton;
-
119 QPushButton* PlainButton;
-
120 QPushButton* PolygonButton;
-
121 QPushButton* RectangleButton;
-
122 QLabel* WidthLine;
-
123 QLabel* innerAlphaLine;
-
124 QLineEdit* EditLineWidth;
-
125 QLineEdit* EditLineInnerAlpha;
-
126 QIntValidator* ValidatorLineWidth;
-
127 QIntValidator* ValidatorInnerAlpha;
-
128 
-
129 QPushButton* FirstColorButton;
-
130 QPushButton* SecondColorButton;
-
131 QPushButton* SwitchColorButton;
-
132 
-
133 QLabel* ActiveLayerLine;
-
134 QLabel* ActiveLayerImageLabel;
-
135 
-
136 // The menu widgets
-
137 QMenu*saveAsMenu;
-
138 QMenu*fileMenu;
-
139 QMenu*renderMenu;
-
140 QMenu*optionMenu;
-
141 QMenu*layerCreationMenu;
-
142 QMenu*layerMenu;
-
143 QMenu*colorMenu;
-
144 QMenu*toolCreationMenu;
-
145 QMenu*toolSettingsMenu;
-
146 QMenu*toolMenu;
-
147 QMenu*helpMenu;
-
148 
-
149 // All the actions that can occur
-
150 // meta image actions (need further modularisation)
-
151 QAction* actionOpen;
-
152 QAction* actionExit;
+
110 void setDefaultToolValue();
+
111 
+
112 // What we'll draw on
+
113 PaintingArea* paintingArea;
+
114 
+
115 const QSize Buttonsize = QSize(35,35);
+
116 QPixmap preview;
+
117 QPushButton* CircleButton;
+
118 QPushButton* FloodFillButton;
+
119 QPushButton* LineButton;
+
120 QPushButton* PenButton;
+
121 QPushButton* PlainButton;
+
122 QPushButton* PolygonButton;
+
123 QPushButton* RectangleButton;
+
124 QLabel* WidthLine;
+
125 QLabel* innerAlphaLine;
+
126 QLineEdit* EditLineWidth;
+
127 QLineEdit* EditLineInnerAlpha;
+
128 QIntValidator* ValidatorLineWidth;
+
129 QIntValidator* ValidatorInnerAlpha;
+
130 
+
131 QPushButton* FirstColorButton;
+
132 QPushButton* SecondColorButton;
+
133 QPushButton* SwitchColorButton;
+
134 
+
135 QLabel* ActiveLayerLine;
+
136 QLabel* ActiveLayerImageLabel;
+
137 
+
138 QPushButton* dimActive;
+
139 QPushButton* dimCanvas;
+
140 
+
141 // The menu widgets
+
142 QMenu*saveAsMenu;
+
143 QMenu*fileMenu;
+
144 QMenu*renderMenu;
+
145 QMenu*optionMenu;
+
146 QMenu*layerCreationMenu;
+
147 QMenu*layerMenu;
+
148 QMenu*colorMenu;
+
149 QMenu*toolCreationMenu;
+
150 QMenu*toolSettingsMenu;
+
151 QMenu*toolMenu;
+
152 QMenu*helpMenu;
153 
-
154 //Rendersetting actions
-
155 QAction*actionUpdateRenderSettingsOn;
-
156 QAction*actionUpdateRenderSettingsOff;
-
157 
-
158 // color Picker actions
-
159 QAction* actionColorPickerFirstColor;
-
160 QAction* actionColorPickerSecondColor;
-
161 QAction* actionColorSwap;
+
154 // All the actions that can occur
+
155 // meta image actions (need further modularisation)
+
156 QAction* actionOpen;
+
157 QAction* actionExit;
+
158 
+
159 //Rendersetting actions
+
160 QAction*actionUpdateRenderSettingsOn;
+
161 QAction*actionUpdateRenderSettingsOff;
162 
-
163 // tool actions
-
164 QAction* actionCreatePenTool;
-
165 QAction* actionCreatePlainTool;
-
166 QAction* actionCreateLineTool;
-
167 QAction* actionCreateRectangleTool;
-
168 QAction* actionCreateCircleTool;
-
169 QAction* actionCreatePolygonTool;
-
170 QAction* actionCreateFloodFillTool;
-
171 
-
172 // dialog actions
-
173 QAction* actionAboutDialog;
-
174 QAction* actionAboutQtDialog;
-
175 
-
176 // layer change actions
-
177 QAction* actionCreateNewRasterLayer;
-
178 QAction* actionCreateNewShapedLayer;
-
179 QAction* actionDeleteLayer;
-
180 QAction* actionSetActiveLayer;
-
181 QAction* actionSetActiveAlpha;
-
182 QAction* actionSetPolygon;
-
183 QAction* actionMovePositionUp;
-
184 QAction* actionMovePositionDown;
-
185 QAction* actionMovePositionLeft;
-
186 QAction* actionMovePositionRight;
-
187 QAction* actionMoveLayerUp;
-
188 QAction* actionMoveLayerDown;
-
189 
-
190 // Actions tied to specific file formats
-
191 QList<QAction*> actionSaveAs;
-
192 
-
193 QAction* actionSetWidth;
-
194 QAction* actionSetInnerAlpha;
-
195 
-
196 // main GUI elements
-
197 QWidget* centralGuiWidget;
-
198 QGridLayout* mainLayout;
-
199 };
+
163 // color Picker actions
+
164 QAction* actionColorPickerFirstColor;
+
165 QAction* actionColorPickerSecondColor;
+
166 QAction* actionColorSwap;
+
167 
+
168 // tool actions
+
169 QAction* actionCreatePenTool;
+
170 QAction* actionCreatePlainTool;
+
171 QAction* actionCreateLineTool;
+
172 QAction* actionCreateRectangleTool;
+
173 QAction* actionCreateCircleTool;
+
174 QAction* actionCreatePolygonTool;
+
175 QAction* actionCreateFloodFillTool;
+
176 
+
177 // dimension actions
+
178 QAction*actionChangeDim;
+
179 
+
180 // dialog actions
+
181 QAction* actionAboutDialog;
+
182 QAction* actionAboutQtDialog;
+
183 
+
184 // layer change actions
+
185 QAction* actionCreateNewRasterLayer;
+
186 QAction* actionCreateNewShapedLayer;
+
187 QAction* actionDeleteLayer;
+
188 QAction* actionSetActiveLayer;
+
189 QAction* actionSetActiveAlpha;
+
190 QAction* actionSetPolygon;
+
191 QAction* actionMovePositionUp;
+
192 QAction* actionMovePositionDown;
+
193 QAction* actionMovePositionLeft;
+
194 QAction* actionMovePositionRight;
+
195 QAction* actionMoveLayerUp;
+
196 QAction* actionMoveLayerDown;
+
197 
+
198 // Actions tied to specific file formats
+
199 QList<QAction*> actionSaveAs;
200 
-
201 #endif
+
201 QAction* actionSetWidth;
+
202 QAction* actionSetInnerAlpha;
+
203 
+
204 // main GUI elements
+
205 QWidget* centralGuiWidget;
+
206 QGridLayout* mainLayout;
+
207 };
+
208 
+
209 #endif
@@ -286,9 +294,9 @@ $(document).ready(function(){initNavTree('_intelli_photo_gui_8h_source.html','')
The PaintingArea class manages the methods and stores information about the current painting area,...
Definition: PaintingArea.h:53
An abstract class that manages the basic events, like mouse clicks or scrolls events.
Definition: IntelliTool.h:17
void closeEvent(QCloseEvent *event) override
The closeEvent function handles closing events.
-
void setToolWidth(int value)
+
void setToolWidth(int value)
The IntelliColorPicker manages the selected colors for one whole project.
- +

Go to the source code of this file.

diff --git a/docs/html/_intelli_tool_polygon_8cpp_source.html b/docs/html/_intelli_tool_polygon_8cpp_source.html index 5b880b5..c95a794 100644 --- a/docs/html/_intelli_tool_polygon_8cpp_source.html +++ b/docs/html/_intelli_tool_polygon_8cpp_source.html @@ -91,151 +91,152 @@ $(document).ready(function(){initNavTree('_intelli_tool_polygon_8cpp_source.html
3 #include <QCursor>
4 #include <QInputDialog>
5 #include <QDebug>
-
6 
-
7 IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings, bool isSettingPolygon)
-
8  : IntelliTool(Area, colorPicker, Toolsettings){
-
9  isPointNearStart = false;
-
10  drawingOfPolygon = false;
-
11  isInside = false;
-
12  this->isSettingPolygon = isSettingPolygon;
-
13  if(isSettingPolygon) {
- -
15  }
- -
17 }
-
18 
- -
20  if(drawingOfPolygon) {
- -
22  }
-
23 }
-
24 
- -
26  if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
-
27  if(Area->getPolygonDataOfRealLayer().size()>2) {
-
28  std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer());
-
29  QPoint Point(x,y);
-
30  isInside = IntelliTriangulation::isInPolygon(Triangles,Point);
-
31  }
-
32  else{
-
33  isInside = true;
-
34  }
-
35  if(isSettingPolygon) {
-
36  isInside = true;
-
37  }
-
38  }
-
39  else if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::RASTERIMAGE && x >= 0 && y >= 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
-
40  isInside = true;
-
41  }
-
42 
-
43  if(isInside && !drawingOfPolygon) {
- -
45  QPoint drawingPoint = QPoint(x,y);
-
46 
-
47  drawingOfPolygon = true;
-
48  QPointList.push_back(drawingPoint);
-
49 
-
50  this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
-
51  if(!isSettingPolygon) {
- -
53  }
-
54  }
-
55  else if(drawingOfPolygon && QPointList.size() > 0 && isNearStart(x,y,QPointList.front())) {
-
56  if(QPointList.size() > 2) {
-
57  isPointNearStart = true;
-
58  this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
-
59  if(!isSettingPolygon) {
- -
61  }
-
62  }
-
63  else{
-
64  isInside = false;
-
65  drawingOfPolygon = false;
-
66  QPointList.clear();
- - -
69  }
-
70 
-
71  }
-
72  else if(drawingOfPolygon) {
-
73  QPoint drawingPoint(x,y);
-
74  QPointList.push_back(drawingPoint);
-
75  this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
-
76  if(!isSettingPolygon) {
- -
78  }
-
79  }
-
80 }
-
81 
- -
83  drawingOfPolygon = false;
-
84  isInside = false;
-
85  isPointNearStart = false;
-
86  QPointList.clear();
- -
88 }
-
89 
- -
91  if(isPointNearStart) {
-
92  isInside = false;
-
93  isPointNearStart = false;
-
94  drawingOfPolygon = false;
-
95  if(!isSettingPolygon) {
-
96  std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
-
97  QPoint Point;
-
98  QColor colorTwo(colorPicker->getSecondColor());
-
99  colorTwo.setAlpha(Toolsettings->getInnerAlpha());
-
100  for(int i = 0; i < activeLayer->width; i++) {
-
101  for(int j = 0; j < activeLayer->height; j++) {
-
102  Point = QPoint(i,j);
-
103  if(IntelliTriangulation::isInPolygon(Triangles,Point)) {
-
104  this->Canvas->image->drawPixel(Point, colorTwo);
-
105  }
-
106  }
-
107  }
-
108  for(int i = 0; i<static_cast<int>(QPointList.size()); i++) {
-
109  int next = static_cast<int>((i + static_cast<int>(1)) % static_cast<int>(QPointList.size()));
-
110  this->Canvas->image->drawLine(QPointList[static_cast<unsigned long long>(i)], QPointList[static_cast<unsigned long long>(next)], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
-
111  }
-
112 
-
113  }
-
114  else{
-
115  Canvas->image->setPolygon(QPointList);
- -
117  }
- -
119  QPointList.clear();
-
120  }
-
121 }
-
122 
- - -
125 }
-
126 
- -
128  if(!isSettingPolygon) {
- -
130  if(!isDrawing) {
- -
132  }
-
133  }
-
134 }
-
135 
- -
137  if(!isSettingPolygon) {
- -
139  }
-
140 }
-
141 
-
142 bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){
-
143  int StartX = Startpoint.x();
-
144  int StartY = Startpoint.y();
-
145  int valueToNear = 5;
-
146 
-
147  float euklid = sqrt(pow(static_cast<float>(StartX-x),2.f)+pow(static_cast<float>(StartY-y),2.f));
-
148 
-
149  return static_cast<int>(euklid)<valueToNear;
-
150 }
+
6 #include <cmath>
+
7 
+
8 IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings, bool isSettingPolygon)
+
9  : IntelliTool(Area, colorPicker, Toolsettings){
+
10  isPointNearStart = false;
+
11  drawingOfPolygon = false;
+
12  isInside = false;
+
13  this->isSettingPolygon = isSettingPolygon;
+
14  if(isSettingPolygon) {
+ +
16  }
+ +
18 }
+
19 
+ +
21  if(drawingOfPolygon) {
+ +
23  }
+
24 }
+
25 
+ +
27  if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
+
28  if(Area->getPolygonDataOfRealLayer().size()>2) {
+
29  std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer());
+
30  QPoint Point(x,y);
+
31  isInside = IntelliTriangulation::isInPolygon(Triangles,Point);
+
32  }
+
33  else{
+
34  isInside = true;
+
35  }
+
36  if(isSettingPolygon) {
+
37  isInside = true;
+
38  }
+
39  }
+
40  else if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::RASTERIMAGE && x >= 0 && y >= 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
+
41  isInside = true;
+
42  }
+
43 
+
44  if(isInside && !drawingOfPolygon) {
+ +
46  QPoint drawingPoint = QPoint(x,y);
+
47 
+
48  drawingOfPolygon = true;
+
49  QPointList.push_back(drawingPoint);
+
50 
+
51  this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
+
52  if(!isSettingPolygon) {
+ +
54  }
+
55  }
+
56  else if(drawingOfPolygon && QPointList.size() > 0 && isNearStart(x,y,QPointList.front())) {
+
57  if(QPointList.size() > 2) {
+
58  isPointNearStart = true;
+
59  this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
+
60  if(!isSettingPolygon) {
+ +
62  }
+
63  }
+
64  else{
+
65  isInside = false;
+
66  drawingOfPolygon = false;
+
67  QPointList.clear();
+ + +
70  }
+
71 
+
72  }
+
73  else if(drawingOfPolygon) {
+
74  QPoint drawingPoint(x,y);
+
75  QPointList.push_back(drawingPoint);
+
76  this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
+
77  if(!isSettingPolygon) {
+ +
79  }
+
80  }
+
81 }
+
82 
+ +
84  drawingOfPolygon = false;
+
85  isInside = false;
+
86  isPointNearStart = false;
+
87  QPointList.clear();
+ +
89 }
+
90 
+ +
92  if(isPointNearStart) {
+
93  isInside = false;
+
94  isPointNearStart = false;
+
95  drawingOfPolygon = false;
+
96  if(!isSettingPolygon) {
+
97  std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
+
98  QPoint Point;
+
99  QColor colorTwo(colorPicker->getSecondColor());
+
100  colorTwo.setAlpha(Toolsettings->getInnerAlpha());
+
101  for(int i = 0; i < activeLayer->width; i++) {
+
102  for(int j = 0; j < activeLayer->height; j++) {
+
103  Point = QPoint(i,j);
+
104  if(IntelliTriangulation::isInPolygon(Triangles,Point)) {
+
105  this->Canvas->image->drawPixel(Point, colorTwo);
+
106  }
+
107  }
+
108  }
+
109  for(int i = 0; i<static_cast<int>(QPointList.size()); i++) {
+
110  int next = static_cast<int>((i + static_cast<int>(1)) % static_cast<int>(QPointList.size()));
+
111  this->Canvas->image->drawLine(QPointList[static_cast<unsigned long long>(i)], QPointList[static_cast<unsigned long long>(next)], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
+
112  }
+
113 
+
114  }
+
115  else{
+
116  Canvas->image->setPolygon(QPointList);
+ +
118  }
+ +
120  QPointList.clear();
+
121  }
+
122 }
+
123 
+ + +
126 }
+
127 
+ +
129  if(!isSettingPolygon) {
+ +
131  if(!isDrawing) {
+ +
133  }
+
134  }
+
135 }
+
136 
+ +
138  if(!isSettingPolygon) {
+ +
140  }
+
141 }
+
142 
+
143 bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){
+
144  int StartX = Startpoint.x();
+
145  int StartY = Startpoint.y();
+
146  int valueToNear = 5;
+
147 
+
148  float euklid = sqrt(pow(static_cast<float>(StartX - x),2.f) + pow(static_cast<float>(StartY - y),2.f));
+
149 
+
150  return static_cast<int>(euklid)<valueToNear;
+
151 }
virtual void onMouseRightPressed(int x, int y)
A function managing the right click Pressed of a Mouse. Constructing the Canvas to draw on....
Definition: IntelliTool.cpp:18
@@ -248,15 +249,15 @@ $(document).ready(function(){initNavTree('_intelli_tool_polygon_8cpp_source.html
virtual void drawPixel(const QPoint &p1, const QColor &color)
A funtcion used to draw a pixel on the Image with the given Color.
std::vector< Triangle > calculateTriangles(std::vector< QPoint > polyPoints)
A function to split a polygon in its spanning traingles by using Meisters Theorem of graph theory by ...
PaintingArea * Area
A pointer to the general PaintingArea to interact with.
Definition: IntelliTool.h:50
-
QColor getSecondColor()
A function to read the secondary selected color.
-
virtual void onMouseMoved(int x, int y) override
A function managing the mouse moved event.
+
QColor getSecondColor()
A function to read the secondary selected color.
+
virtual void onMouseMoved(int x, int y) override
A function managing the mouse moved event.
The PaintingArea class manages the methods and stores information about the current painting area,...
Definition: PaintingArea.h:53
bool isDrawing
A flag checking if the user is currently drawing or not.
Definition: IntelliTool.h:74
virtual void drawPoint(const QPoint &p1, const QColor &color, const int &penWidth)
A function that draws a point between on a given point in a given color.
virtual void onMouseRightReleased(int x, int y)
A function managing the right click Released of a Mouse. Merging the Canvas to Active....
Definition: IntelliTool.cpp:25
LayerObject * activeLayer
A pointer to the underlying active Layer, do not work on this. This is used for data grabbing or prev...
Definition: IntelliTool.h:64
-
IntelliToolPolygon(PaintingArea *Area, IntelliColorPicker *colorPicker, IntelliToolsettings *Toolsettings, bool isSettingPolygon=false)
A constructor setting the general paintingArea and colorPicker.
+
IntelliToolPolygon(PaintingArea *Area, IntelliColorPicker *colorPicker, IntelliToolsettings *Toolsettings, bool isSettingPolygon=false)
A constructor setting the general paintingArea and colorPicker.
LayerObject * Canvas
A pointer to the drawing canvas of the tool, work on this.
Definition: IntelliTool.h:69
IntelliImage::ImageType getTypeOfImageRealLayer()
@@ -264,28 +265,28 @@ $(document).ready(function(){initNavTree('_intelli_tool_polygon_8cpp_source.html
An abstract class that manages the basic events, like mouse clicks or scrolls events.
Definition: IntelliTool.h:17
virtual void setImageData(const QImage &newData)
setImageData overwrites the old imageData the new imageData.
-
virtual void onMouseRightPressed(int x, int y) override
A function managing the right click pressed of a mouse. Resetting the current fill.
+
virtual void onMouseRightPressed(int x, int y) override
A function managing the right click pressed of a mouse. Resetting the current fill.
-
QColor getFirstColor()
A function to read the primary selected color.
+
QColor getFirstColor()
A function to read the primary selected color.
int height
height - Stores the height of a layer in pixels.
Definition: PaintingArea.h:35
QImage getImageDataOfActiveLayer()
getImageDataOfActiveLayer used to get the currents active imageData (if there isn't any active layer ...
Tooltype ActiveType
Definition: IntelliTool.h:52
The IntelliColorPicker manages the selected colors for one whole project.
-
~IntelliToolPolygon() override
A Destructor.
+
~IntelliToolPolygon() override
A Destructor.
IntelliImage * image
image - Stores the imageData of the current LayerObject.
Definition: PaintingArea.h:27
std::vector< QPoint > getPolygonDataOfRealLayer()
void setLineWidth(int LineWidth)
virtual void onMouseMoved(int x, int y)
A function managing the mouse moved event. Call this in child classes!
Definition: IntelliTool.cpp:46
-
virtual void onMouseLeftPressed(int x, int y) override
A function managing the left click pressed of a mouse. Setting polygon points.
-
virtual void onMouseRightReleased(int x, int y) override
A function managing the right click released of a mouse.
-
virtual void onMouseLeftReleased(int x, int y) override
A function managing the left click released of a mouse. Merging the fill to the active layer.
+
virtual void onMouseLeftPressed(int x, int y) override
A function managing the left click pressed of a mouse. Setting polygon points.
+
virtual void onMouseRightReleased(int x, int y) override
A function managing the right click released of a mouse.
+
virtual void onMouseLeftReleased(int x, int y) override
A function managing the left click released of a mouse. Merging the fill to the active layer.
virtual void calculateVisiblity()=0
An abstract function that calculates the visiblity of the Image data if needed.
bool isInPolygon(const std::vector< Triangle > &triangles, QPoint &point)
A function to check if a point lies in a polygon by checking its spanning triangles.
virtual void onWheelScrolled(int value)
A function managing the scroll event. A positive value means scrolling outwards. Call this in child c...
Definition: IntelliTool.cpp:51
-
virtual void onWheelScrolled(int value) override
A function managing the scroll event. CHanging the lineWidth relative to value.
+
virtual void onWheelScrolled(int value) override
A function managing the scroll event. CHanging the lineWidth relative to value.
virtual void setPolygon(const std::vector< QPoint > &polygonData)=0
An abstract function that sets the data of the visible Polygon, if needed.
@@ -193,7 +193,7 @@ Public Member Functions

A function to read the primary selected color.

Returns
Returns the primary color.
-

Definition at line 16 of file IntelliColorPicker.cpp.

+

Definition at line 15 of file IntelliColorPicker.cpp.

@@ -215,7 +215,7 @@ Public Member Functions

A function to read the secondary selected color.

Returns
Returns the secondary color.
-

Definition at line 20 of file IntelliColorPicker.cpp.

+

Definition at line 19 of file IntelliColorPicker.cpp.

@@ -243,7 +243,7 @@ Public Member Functions -

Definition at line 24 of file IntelliColorPicker.cpp.

+

Definition at line 23 of file IntelliColorPicker.cpp.

@@ -271,7 +271,7 @@ Public Member Functions -

Definition at line 28 of file IntelliColorPicker.cpp.

+

Definition at line 27 of file IntelliColorPicker.cpp.

@@ -292,7 +292,7 @@ Public Member Functions

A function switching primary and secondary color.

-

Definition at line 12 of file IntelliColorPicker.cpp.

+

Definition at line 11 of file IntelliColorPicker.cpp.

diff --git a/docs/html/class_intelli_photo_gui.html b/docs/html/class_intelli_photo_gui.html index 3a16fe9..5399f88 100644 --- a/docs/html/class_intelli_photo_gui.html +++ b/docs/html/class_intelli_photo_gui.html @@ -191,7 +191,7 @@ Protected Member Functions
-

Definition at line 790 of file IntelliPhotoGui.cpp.

+

Definition at line 827 of file IntelliPhotoGui.cpp.

@@ -210,7 +210,7 @@ Protected Member Functions
-

Definition at line 799 of file IntelliPhotoGui.cpp.

+

Definition at line 836 of file IntelliPhotoGui.cpp.

diff --git a/docs/html/class_intelli_tool_polygon.html b/docs/html/class_intelli_tool_polygon.html index db07444..1019ad1 100644 --- a/docs/html/class_intelli_tool_polygon.html +++ b/docs/html/class_intelli_tool_polygon.html @@ -232,7 +232,7 @@ Additional Inherited Members -

Definition at line 7 of file IntelliToolPolygon.cpp.

+

Definition at line 8 of file IntelliToolPolygon.cpp.

@@ -261,7 +261,7 @@ Additional Inherited Members

A Destructor.

-

Definition at line 19 of file IntelliToolPolygon.cpp.

+

Definition at line 20 of file IntelliToolPolygon.cpp.

@@ -311,7 +311,7 @@ Additional Inherited Members

Reimplemented from IntelliTool.

-

Definition at line 25 of file IntelliToolPolygon.cpp.

+

Definition at line 26 of file IntelliToolPolygon.cpp.

@@ -360,7 +360,7 @@ Additional Inherited Members

Reimplemented from IntelliTool.

-

Definition at line 90 of file IntelliToolPolygon.cpp.

+

Definition at line 91 of file IntelliToolPolygon.cpp.

@@ -409,7 +409,7 @@ Additional Inherited Members

Reimplemented from IntelliTool.

-

Definition at line 136 of file IntelliToolPolygon.cpp.

+

Definition at line 137 of file IntelliToolPolygon.cpp.

@@ -458,7 +458,7 @@ Additional Inherited Members

Reimplemented from IntelliTool.

-

Definition at line 82 of file IntelliToolPolygon.cpp.

+

Definition at line 83 of file IntelliToolPolygon.cpp.

@@ -507,7 +507,7 @@ Additional Inherited Members

Reimplemented from IntelliTool.

-

Definition at line 123 of file IntelliToolPolygon.cpp.

+

Definition at line 124 of file IntelliToolPolygon.cpp.

@@ -545,7 +545,7 @@ Additional Inherited Members

Reimplemented from IntelliTool.

-

Definition at line 127 of file IntelliToolPolygon.cpp.

+

Definition at line 128 of file IntelliToolPolygon.cpp.

diff --git a/docs/html/main_unit_test_8cpp_source.html b/docs/html/main_unit_test_8cpp_source.html index c21eb0f..8b5a315 100644 --- a/docs/html/main_unit_test_8cpp_source.html +++ b/docs/html/main_unit_test_8cpp_source.html @@ -86,111 +86,111 @@ $(document).ready(function(){initNavTree('main_unit_test_8cpp_source.html','');
mainUnitTest.cpp
-Go to the documentation of this file.
1 #include <QtTest>
+Go to the documentation of this file.
1 #include <QtTest>
2 // add necessary includes here
-
3 #include<string>
+
3 #include <string>
4 
5 #include "GUI/IntelliPhotoGui.h"
6 
7 
8 class UnitTest : public QObject
9 {
-
10  Q_OBJECT
+
10 Q_OBJECT
11 private:
-
12  IntelliPhotoGui* gui;
-
13  PaintingArea* area;
-
14  QApplication* app;
+
12 IntelliPhotoGui* gui;
+
13 PaintingArea* area;
+
14 QApplication* app;
15 
16 public:
-
17  UnitTest();
-
18  ~UnitTest();
+
17 UnitTest();
+
18 ~UnitTest();
19 
20 private slots:
-
21  void initTestCase();
-
22  void cleanupTestCase();
-
23  //void test_case1();
+
21 void initTestCase();
+
22 void cleanupTestCase();
+
23 //void test_case1();
24 
-
25  //test painting area
-
26  void test_addLayer();
-
27  void test_deleteLayer();
-
28  void test_setActive();
-
29  void test_setAlpha();
-
30  void test_floodFill();
-
31  void test_moveActive();
-
32  void test_setPolygon();
-
33  void test_setLayerUp();
-
34  void test_setLayerDown();
+
25 //test painting area
+
26 void test_addLayer();
+
27 void test_deleteLayer();
+
28 void test_setActive();
+
29 void test_setAlpha();
+
30 void test_floodFill();
+
31 void test_moveActive();
+
32 void test_setPolygon();
+
33 void test_setLayerUp();
+
34 void test_setLayerDown();
35 
-
36  void test_createTools();
+
36 void test_createTools();
37 
-
38  //test Raster-Image operations
-
39  void test_RasterImage_drawPixel();
-
40  void test_RasterImage_drawLine();
-
41  void test_RasterImage_drawPoint();
-
42  void test_RasterImage_getDisplayable();
-
43  void test_RasterImage_setPolygon();
-
44  void test_RasterImage_loadImage();
-
45  void test_RasterImage_getPixelColor();
-
46  void test_RasterImage_getImageData();
-
47  void test_RasterImage_setImageData();
+
38 //test Raster-Image operations
+
39 void test_RasterImage_drawPixel();
+
40 void test_RasterImage_drawLine();
+
41 void test_RasterImage_drawPoint();
+
42 void test_RasterImage_getDisplayable();
+
43 void test_RasterImage_setPolygon();
+
44 void test_RasterImage_loadImage();
+
45 void test_RasterImage_getPixelColor();
+
46 void test_RasterImage_getImageData();
+
47 void test_RasterImage_setImageData();
48 
-
49  //test Shaped-Image operations
-
50  void test_ShapedImage_drawPixel();
-
51  void test_ShapedImage_drawLine();
-
52  void test_ShapedImage_drawPoint();
-
53  void test_ShapedImage_getDisplayable();
-
54  void test_ShapedImage_setPolygon();
-
55  void test_ShapedImage_loadImage();
-
56  void test_ShapedImage_getPixelColor();
-
57  void test_ShapedImage_getImageData();
-
58  void test_ShapedImage_setImageData();
+
49 //test Shaped-Image operations
+
50 void test_ShapedImage_drawPixel();
+
51 void test_ShapedImage_drawLine();
+
52 void test_ShapedImage_drawPoint();
+
53 void test_ShapedImage_getDisplayable();
+
54 void test_ShapedImage_setPolygon();
+
55 void test_ShapedImage_loadImage();
+
56 void test_ShapedImage_getPixelColor();
+
57 void test_ShapedImage_getImageData();
+
58 void test_ShapedImage_setImageData();
59 
-
60  //test painting-area tools
-
61  void test_createTool_Circle();
-
62  void test_createTool_FloodFill();
-
63  void test_createTool_Line();
-
64  void test_createTool_Pen();
-
65  void test_createTool_Plain();
-
66  void test_createTool_Polygon();
-
67  void test_createTool_Rectangle();
+
60 //test painting-area tools
+
61 void test_createTool_Circle();
+
62 void test_createTool_FloodFill();
+
63 void test_createTool_Line();
+
64 void test_createTool_Pen();
+
65 void test_createTool_Plain();
+
66 void test_createTool_Polygon();
+
67 void test_createTool_Rectangle();
68 
-
69  //test tools
-
70  void test_Circle_fullDraw();
-
71  void test_Circle_interruptedDraw();
+
69 //test tools
+
70 void test_Circle_fullDraw();
+
71 void test_Circle_interruptedDraw();
72 
-
73  void test_FloodFill_fullDraw();
-
74  void test_FloodFill_interruptedDraw();
+
73 void test_FloodFill_fullDraw();
+
74 void test_FloodFill_interruptedDraw();
75 
-
76  void test_Line_fullDraw();
-
77  void test_Line_interruptedDraw();
+
76 void test_Line_fullDraw();
+
77 void test_Line_interruptedDraw();
78 
-
79  void test_Pen_fullDraw();
-
80  void test_Pen_interruptedDraw();
+
79 void test_Pen_fullDraw();
+
80 void test_Pen_interruptedDraw();
81 
-
82  void test_Plain_fullDraw();
-
83  void test_Plain_interruptedDraw();
+
82 void test_Plain_fullDraw();
+
83 void test_Plain_interruptedDraw();
84 
-
85  void test_Polygon_fullDraw();
-
86  void test_Polygon_interruptedDraw();
+
85 void test_Polygon_fullDraw();
+
86 void test_Polygon_interruptedDraw();
87 
-
88  void test_Rectangle_fullDraw();
-
89  void test_Rectangle_interruptedDraw();
+
88 void test_Rectangle_fullDraw();
+
89 void test_Rectangle_interruptedDraw();
90 
-
91  //test Triangulation
-
92  void test_Triangulation_Coverage();
+
91 //test Triangulation
+
92 void test_Triangulation_Coverage();
93 };
94 
96 {
-
97  char arg0[] = "programName";
-
98  char arg1[] = "arg1";
-
99  char arg2[] = "arg2";
-
100  char *argv[] = {arg0, arg1, arg2, nullptr};
-
101  int argc = sizeof(argv) / sizeof(char*) - 1;
+
97  char arg0[] = "programName";
+
98  char arg1[] = "arg1";
+
99  char arg2[] = "arg2";
+
100  char*argv[] = {arg0, arg1, arg2, nullptr};
+
101  int argc = sizeof(argv) / sizeof(char*) - 1;
102 
-
103  app = new QApplication(argc,argv);
-
104  gui = new IntelliPhotoGui();
-
105  area = gui->paintingArea;
+
103  app = new QApplication(argc,argv);
+
104  gui = new IntelliPhotoGui();
+
105  area = gui->paintingArea;
106 }
107 
@@ -205,8 +205,8 @@ $(document).ready(function(){initNavTree('main_unit_test_8cpp_source.html','');
117 
118 void UnitTest::cleanupTestCase()
119 {
-
120  delete gui;
-
121  delete app;
+
120  delete gui;
+
121  delete app;
122 }
123 
124 //void UnitTest::test_case1()
@@ -217,77 +217,127 @@ $(document).ready(function(){initNavTree('main_unit_test_8cpp_source.html','');
129 //}
130 
131 //test painting area
-
132 void UnitTest::test_addLayer(){}
-
133 void UnitTest::test_deleteLayer(){}
-
134 void UnitTest::test_setActive(){}
-
135 void UnitTest::test_setAlpha(){}
-
136 void UnitTest::test_floodFill(){}
-
137 void UnitTest::test_moveActive(){}
-
138 void UnitTest::test_setPolygon(){}
-
139 void UnitTest::test_setLayerUp(){}
-
140 void UnitTest::test_setLayerDown(){}
-
141 
-
142 void UnitTest::test_createTools(){}
-
143 
-
144 //test Raster-Image operations
-
145 void UnitTest::test_RasterImage_drawPixel(){}
-
146 void UnitTest::test_RasterImage_drawLine(){}
-
147 void UnitTest::test_RasterImage_drawPoint(){}
-
148 void UnitTest::test_RasterImage_getDisplayable(){}
-
149 void UnitTest::test_RasterImage_setPolygon(){}
-
150 void UnitTest::test_RasterImage_loadImage(){}
-
151 void UnitTest::test_RasterImage_getPixelColor(){}
-
152 void UnitTest::test_RasterImage_getImageData(){}
-
153 void UnitTest::test_RasterImage_setImageData(){}
-
154 
-
155 //test Shaped-Image operations
-
156 void UnitTest::test_ShapedImage_drawPixel(){}
-
157 void UnitTest::test_ShapedImage_drawLine(){}
-
158 void UnitTest::test_ShapedImage_drawPoint(){}
-
159 void UnitTest::test_ShapedImage_getDisplayable(){}
-
160 void UnitTest::test_ShapedImage_setPolygon(){}
-
161 void UnitTest::test_ShapedImage_loadImage(){}
-
162 void UnitTest::test_ShapedImage_getPixelColor(){}
-
163 void UnitTest::test_ShapedImage_getImageData(){}
-
164 void UnitTest::test_ShapedImage_setImageData(){}
-
165 
-
166 //test painting-area tools
-
167 void UnitTest::test_createTool_Circle(){}
-
168 void UnitTest::test_createTool_FloodFill(){}
-
169 void UnitTest::test_createTool_Line(){}
-
170 void UnitTest::test_createTool_Pen(){}
-
171 void UnitTest::test_createTool_Plain(){}
-
172 void UnitTest::test_createTool_Polygon(){}
-
173 void UnitTest::test_createTool_Rectangle(){}
-
174 
-
175 //test tools
-
176 void UnitTest::test_Circle_fullDraw(){}
-
177 void UnitTest::test_Circle_interruptedDraw(){}
-
178 
-
179 void UnitTest::test_FloodFill_fullDraw(){}
-
180 void UnitTest::test_FloodFill_interruptedDraw(){}
-
181 
-
182 void UnitTest::test_Line_fullDraw(){}
-
183 void UnitTest::test_Line_interruptedDraw(){}
-
184 
-
185 void UnitTest::test_Pen_fullDraw(){}
-
186 void UnitTest::test_Pen_interruptedDraw(){}
-
187 
-
188 void UnitTest::test_Plain_fullDraw(){}
-
189 void UnitTest::test_Plain_interruptedDraw(){}
-
190 
-
191 void UnitTest::test_Polygon_fullDraw(){}
-
192 void UnitTest::test_Polygon_interruptedDraw(){}
+
132 void UnitTest::test_addLayer(){
+
133 }
+
134 void UnitTest::test_deleteLayer(){
+
135 }
+
136 void UnitTest::test_setActive(){
+
137 }
+
138 void UnitTest::test_setAlpha(){
+
139 }
+
140 void UnitTest::test_floodFill(){
+
141 }
+
142 void UnitTest::test_moveActive(){
+
143 }
+
144 void UnitTest::test_setPolygon(){
+
145 }
+
146 void UnitTest::test_setLayerUp(){
+
147 }
+
148 void UnitTest::test_setLayerDown(){
+
149 }
+
150 
+
151 void UnitTest::test_createTools(){
+
152 }
+
153 
+
154 //test Raster-Image operations
+
155 void UnitTest::test_RasterImage_drawPixel(){
+
156 }
+
157 void UnitTest::test_RasterImage_drawLine(){
+
158 }
+
159 void UnitTest::test_RasterImage_drawPoint(){
+
160 }
+
161 void UnitTest::test_RasterImage_getDisplayable(){
+
162 }
+
163 void UnitTest::test_RasterImage_setPolygon(){
+
164 }
+
165 void UnitTest::test_RasterImage_loadImage(){
+
166 }
+
167 void UnitTest::test_RasterImage_getPixelColor(){
+
168 }
+
169 void UnitTest::test_RasterImage_getImageData(){
+
170 }
+
171 void UnitTest::test_RasterImage_setImageData(){
+
172 }
+
173 
+
174 //test Shaped-Image operations
+
175 void UnitTest::test_ShapedImage_drawPixel(){
+
176 }
+
177 void UnitTest::test_ShapedImage_drawLine(){
+
178 }
+
179 void UnitTest::test_ShapedImage_drawPoint(){
+
180 }
+
181 void UnitTest::test_ShapedImage_getDisplayable(){
+
182 }
+
183 void UnitTest::test_ShapedImage_setPolygon(){
+
184 }
+
185 void UnitTest::test_ShapedImage_loadImage(){
+
186 }
+
187 void UnitTest::test_ShapedImage_getPixelColor(){
+
188 }
+
189 void UnitTest::test_ShapedImage_getImageData(){
+
190 }
+
191 void UnitTest::test_ShapedImage_setImageData(){
+
192 }
193 
-
194 void UnitTest::test_Rectangle_fullDraw(){}
-
195 void UnitTest::test_Rectangle_interruptedDraw(){}
-
196 
-
197 //test Triangulation
-
198 void UnitTest::test_Triangulation_Coverage(){}
-
199 
-
200 QTEST_APPLESS_MAIN(UnitTest)
-
201 
-
202 #include "tst_unittest.moc"
+
194 //test painting-area tools
+
195 void UnitTest::test_createTool_Circle(){
+
196 }
+
197 void UnitTest::test_createTool_FloodFill(){
+
198 }
+
199 void UnitTest::test_createTool_Line(){
+
200 }
+
201 void UnitTest::test_createTool_Pen(){
+
202 }
+
203 void UnitTest::test_createTool_Plain(){
+
204 }
+
205 void UnitTest::test_createTool_Polygon(){
+
206 }
+
207 void UnitTest::test_createTool_Rectangle(){
+
208 }
+
209 
+
210 //test tools
+
211 void UnitTest::test_Circle_fullDraw(){
+
212 }
+
213 void UnitTest::test_Circle_interruptedDraw(){
+
214 }
+
215 
+
216 void UnitTest::test_FloodFill_fullDraw(){
+
217 }
+
218 void UnitTest::test_FloodFill_interruptedDraw(){
+
219 }
+
220 
+
221 void UnitTest::test_Line_fullDraw(){
+
222 }
+
223 void UnitTest::test_Line_interruptedDraw(){
+
224 }
+
225 
+
226 void UnitTest::test_Pen_fullDraw(){
+
227 }
+
228 void UnitTest::test_Pen_interruptedDraw(){
+
229 }
+
230 
+
231 void UnitTest::test_Plain_fullDraw(){
+
232 }
+
233 void UnitTest::test_Plain_interruptedDraw(){
+
234 }
+
235 
+
236 void UnitTest::test_Polygon_fullDraw(){
+
237 }
+
238 void UnitTest::test_Polygon_interruptedDraw(){
+
239 }
+
240 
+
241 void UnitTest::test_Rectangle_fullDraw(){
+
242 }
+
243 void UnitTest::test_Rectangle_interruptedDraw(){
+
244 }
+
245 
+
246 //test Triangulation
+
247 void UnitTest::test_Triangulation_Coverage(){
+
248 }
+
249 
+
250 QTEST_APPLESS_MAIN(UnitTest)
+
251 
+
252 #include "tst_unittest.moc"
diff --git a/docs/html/tst__unittest_8cpp_source.html b/docs/html/tst__unittest_8cpp_source.html index 6e615ba..a402e28 100644 --- a/docs/html/tst__unittest_8cpp_source.html +++ b/docs/html/tst__unittest_8cpp_source.html @@ -535,9 +535,9 @@ $(document).ready(function(){initNavTree('tst__unittest_8cpp_source.html',''); i
449  area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
450  QImage img = area->layerBundle[0].image->getDisplayable(QSize(200,200),255);
451  QPoint point;
-
452  for(size_t i=0; i<200; i++) {
+
452  for(size_t i = 0; i<200; i++) {
453  point.setX(static_cast<int>(i));
-
454  for(size_t j=0; j<200; j++) {
+
454  for(size_t j = 0; j<200; j++) {
455  point.setY(static_cast<int>(j));
456  QVERIFY(img.pixelColor(point) == QColor(255,255,255,255));
457  }
@@ -1766,9 +1766,9 @@ $(document).ready(function(){initNavTree('tst__unittest_8cpp_source.html',''); i
1681  QBENCHMARK{
1682  std::vector<Triangle> tria = IntelliTriangulation::calculateTriangles(points);
1683  QPoint point;
-
1684  for(int i=0; i<200; i++) {
+
1684  for(int i = 0; i<200; i++) {
1685  point.setX(i);
-
1686  for(int j=0; j<200; j++) {
+
1686  for(int j = 0; j<200; j++) {
1687  point.setY(j);
1688  IntelliTriangulation::isInPolygon(tria, point);
1689  }
@@ -1799,10 +1799,10 @@ $(document).ready(function(){initNavTree('tst__unittest_8cpp_source.html',''); i
void deleteLayer(int idx, bool isTool=false)
The deleteLayer method removes a layer at a given idx.
The IntelliPhotoGui base class handles the graphical user interface and events for the intelliPhoto p...
-
void setSecondColor(QColor Color)
A function to set the secondary color.
+
void setSecondColor(QColor Color)
A function to set the secondary color.
The IntelliToolPlainTool class represents a tool to fill the whole canvas with one color.
The IntelliShapedImage manages a Shapedimage.
-
QColor getSecondColor()
A function to read the secondary selected color.
+
QColor getSecondColor()
A function to read the secondary selected color.
void createPlainTool()
@@ -1818,13 +1818,13 @@ $(document).ready(function(){initNavTree('tst__unittest_8cpp_source.html',''); i -
void setFirstColor(QColor Color)
A function to set the primary color.
+
void setFirstColor(QColor Color)
A function to set the primary color.
void createPolygonTool()
void moveActiveLayer(int idx)
The moveActiveLayer moves the active layer to a specific position in the layer stack.
IntelliColorPicker colorPicker
Definition: PaintingArea.h:202
-
QColor getFirstColor()
A function to read the primary selected color.
+
QColor getFirstColor()
A function to read the primary selected color.
void createFloodFillTool()
diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 3af696b..5237ee0 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -14,8 +14,8 @@ IntelliPhotoGui::IntelliPhotoGui(){ // set style of the gui setIntelliStyle(); // Size the app - resize(600,600); - showMaximized(); + resize(600,600); + showMaximized(); setDefaultToolValue(); } @@ -73,9 +73,9 @@ void IntelliPhotoGui::slotCreateNewRasterLayer(){ // "New Layer" is the title of the window // the next tr is the text to display // Define the standard Value, min, max, step and ok button - int width = IntelliInputDialog::getInt("New Raster Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1); + int width = IntelliInputDialog::getInt("New Raster Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1); - int height = IntelliInputDialog::getInt("New Raster Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2); + int height = IntelliInputDialog::getInt("New Raster Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2); // Create New Layer if (ok1&&ok2) { @@ -92,9 +92,9 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){ // "New Layer" is the title of the window // the next tr is the text to display // Define the standard Value, min, max, step and ok button - int width = IntelliInputDialog::getInt("New Shaped Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1); + int width = IntelliInputDialog::getInt("New Shaped Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1); - int height = IntelliInputDialog::getInt("New Shaped Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2); + int height = IntelliInputDialog::getInt("New Shaped Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2); // Create New Layer if (ok1&&ok2) { @@ -105,21 +105,21 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){ // Opens a dialog that allows the user to change Dimension void IntelliPhotoGui::slotChangeDim(){ - // Stores button value - bool ok1, ok2; + // Stores button value + bool ok1, ok2; - // "change Dimension" is the title of the window - // the next tr is the text to display - // Define the standard Value, min, step and ok button - int width = IntelliInputDialog::getInt("New Canvas Size", "Width:", 600, 1, 50000 , 1, &ok1); + // "change Dimension" is the title of the window + // the next tr is the text to display + // Define the standard Value, min, step and ok button + int width = IntelliInputDialog::getInt("New Canvas Size", "Width:", 600, 1, 50000, 1, &ok1); - int height = IntelliInputDialog::getInt("New Canvas Size", "Height:", 600, 1, 50000, 1, &ok2); + int height = IntelliInputDialog::getInt("New Canvas Size", "Height:", 600, 1, 50000, 1, &ok2); - // Change dimension - if (ok1&&ok2) { - paintingArea->setLayerDimensions(width,height); - UpdateGui(); - } + // Change dimension + if (ok1&&ok2) { + paintingArea->setLayerDimensions(width,height); + UpdateGui(); + } } // Opens a dialog that allows the user to delete a Layer @@ -317,7 +317,7 @@ void IntelliPhotoGui::slotSetWidth(){ void IntelliPhotoGui::slotSetInnerAlpha(){ bool ok1; - int temp = IntelliInputDialog::getInt("Toolsettings", "Alpha:", 5, 1, 50, 1, &ok1); + int temp = IntelliInputDialog::getInt("Toolsettings", "Alpha:", 5, 1, 50, 1, &ok1); if(ok1) { paintingArea->Toolsettings.setInnerAlpha(temp); EditLineInnerAlpha->setText(QString("%1").arg(temp)); @@ -378,10 +378,10 @@ void IntelliPhotoGui::createActions(){ actionDeleteLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_D)); connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer())); - actionChangeDim = new QAction(tr("&Change Dimension"), this); - actionChangeDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_X)); - connect(actionChangeDim, SIGNAL(triggered()), this, SLOT(slotChangeDim())); - connect(dimCanvas, SIGNAL(clicked()), this, SLOT(slotChangeDim())); + actionChangeDim = new QAction(tr("&Change Dimension"), this); + actionChangeDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_X)); + connect(actionChangeDim, SIGNAL(triggered()), this, SLOT(slotChangeDim())); + connect(dimCanvas, SIGNAL(clicked()), this, SLOT(slotChangeDim())); actionSetActiveLayer = new QAction(tr("&set Active"), this); actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A)); @@ -539,9 +539,9 @@ void IntelliPhotoGui::createMenus(){ fileMenu->addAction(actionExit); //Attach all actions to Render Settings - renderMenu = new QMenu(tr("&Fast Renderer"), this); - renderMenu->addAction(actionUpdateRenderSettingsOn); - renderMenu->addAction(actionUpdateRenderSettingsOff); + renderMenu = new QMenu(tr("&Fast Renderer"), this); + renderMenu->addAction(actionUpdateRenderSettingsOn); + renderMenu->addAction(actionUpdateRenderSettingsOff); //Attach all Layer Creations to Menu layerCreationMenu = new QMenu(tr("&Create new Layer"), this); @@ -598,7 +598,7 @@ void IntelliPhotoGui::createMenus(){ optionMenu->addMenu(toolMenu); optionMenu->addSeparator(); optionMenu->addMenu(renderMenu); - optionMenu->addAction(actionChangeDim); + optionMenu->addAction(actionChangeDim); // Attach all actions to Help helpMenu = new QMenu(tr("&Help"), this); @@ -621,8 +621,8 @@ void IntelliPhotoGui::createGui(){ centralGuiWidget->setLayout(mainLayout); // create Gui elements - // get and set max width and height - paintingArea = new PaintingArea(1280, 720); + // get and set max width and height + paintingArea = new PaintingArea(1280, 720); paintingArea->DummyGui = this; preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg"); @@ -728,14 +728,14 @@ void IntelliPhotoGui::createGui(){ ActiveLayerImageLabel->setFixedSize(Buttonsize * 2); ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize * 2)); - dimActive = new QPushButton(); - dimActive->setFixedSize(Buttonsize.width()*2,Buttonsize.height()/2); - dimActive->setText("0x0"); + dimActive = new QPushButton(); + dimActive->setFixedSize(Buttonsize.width() * 2,Buttonsize.height() / 2); + dimActive->setText("0x0"); - dimCanvas = new QPushButton(); - dimCanvas->setFixedSize(Buttonsize.width()*2,Buttonsize.height()/2); - QString String = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height()); - dimCanvas->setText(String); + dimCanvas = new QPushButton(); + dimCanvas->setFixedSize(Buttonsize.width() * 2,Buttonsize.height() / 2); + QString String = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height()); + dimCanvas->setText(String); // set gui elements mainLayout->addWidget(paintingArea,1,1,20,1); @@ -755,8 +755,8 @@ void IntelliPhotoGui::createGui(){ mainLayout->addWidget(SwitchColorButton,10,2,1,2); mainLayout->addWidget(ActiveLayerLine,11,2,1,2); mainLayout->addWidget(ActiveLayerImageLabel,12,2,1,2); - mainLayout->addWidget(dimActive,13,2,1,2); - mainLayout->addWidget(dimCanvas,14,2,1,2); + mainLayout->addWidget(dimActive,13,2,1,2); + mainLayout->addWidget(dimCanvas,14,2,1,2); mainLayout->setHorizontalSpacing(0); } @@ -852,14 +852,14 @@ void IntelliPhotoGui::UpdateGui(){ string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name()); SecondColorButton->setStyleSheet(string); - string = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height()); - dimCanvas->setText(string); + string = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height()); + dimCanvas->setText(string); - if(paintingArea->layerBundle.size() != 0){ - string = QString("%1x%2").arg(paintingArea->layerBundle[static_cast(paintingArea->getNumberOfActiveLayer())].width).arg(paintingArea->layerBundle[static_cast(paintingArea->getNumberOfActiveLayer())].height); - dimActive->setText(string); - } - else{ - dimActive->setText("0x0"); - } + if(paintingArea->layerBundle.size() != 0) { + string = QString("%1x%2").arg(paintingArea->layerBundle[static_cast(paintingArea->getNumberOfActiveLayer())].width).arg(paintingArea->layerBundle[static_cast(paintingArea->getNumberOfActiveLayer())].height); + dimActive->setText(string); + } + else{ + dimActive->setText("0x0"); + } } diff --git a/src/Image/IntelliImage.h b/src/Image/IntelliImage.h index 46f9d9b..5c19186 100644 --- a/src/Image/IntelliImage.h +++ b/src/Image/IntelliImage.h @@ -20,7 +20,7 @@ class IntelliTool; * \brief An abstract class which manages the basic IntelliImage operations. */ class IntelliImage { - friend UnitTest; +friend UnitTest; friend IntelliTool; public: diff --git a/src/Image/IntelliRasterImage.h b/src/Image/IntelliRasterImage.h index eecc67c..a67472a 100644 --- a/src/Image/IntelliRasterImage.h +++ b/src/Image/IntelliRasterImage.h @@ -10,7 +10,7 @@ class UnitTest; * \brief The IntelliRasterImage manages a RASTERIMAGE. */ class IntelliRasterImage : public IntelliImage { - friend UnitTest; +friend UnitTest; friend IntelliTool; protected: /*! diff --git a/src/Image/IntelliShapedImage.h b/src/Image/IntelliShapedImage.h index 001ce02..32c4c9f 100644 --- a/src/Image/IntelliShapedImage.h +++ b/src/Image/IntelliShapedImage.h @@ -11,7 +11,7 @@ class UnitTest; * \brief The IntelliShapedImage manages a Shapedimage. */ class IntelliShapedImage : public IntelliRasterImage { - friend UnitTest; +friend UnitTest; friend IntelliTool; private: /*! diff --git a/src/IntelliHelper/IntelliColorPicker.cpp b/src/IntelliHelper/IntelliColorPicker.cpp index 9d79722..b13ca02 100644 --- a/src/IntelliHelper/IntelliColorPicker.cpp +++ b/src/IntelliHelper/IntelliColorPicker.cpp @@ -1,7 +1,7 @@ #include "IntelliColorPicker.h" IntelliColorPicker::IntelliColorPicker(){ - initializeColors(); + initializeColors(); } IntelliColorPicker::~IntelliColorPicker(){ @@ -29,6 +29,6 @@ void IntelliColorPicker::setSecondColor(QColor Color){ } void IntelliColorPicker::initializeColors(){ - this->firstColor = QColor(255,0,0,255); - this->secondColor = QColor(0,0,0,255); + this->firstColor = QColor(255,0,0,255); + this->secondColor = QColor(0,0,0,255); } diff --git a/src/IntelliHelper/IntelliColorPicker.h b/src/IntelliHelper/IntelliColorPicker.h index 1efc591..401d74d 100644 --- a/src/IntelliHelper/IntelliColorPicker.h +++ b/src/IntelliHelper/IntelliColorPicker.h @@ -12,7 +12,7 @@ class UnitTest; * \brief The IntelliColorPicker manages the selected colors for one whole project. */ class IntelliColorPicker { - friend UnitTest; +friend UnitTest; public: /*! * \brief IntelliColorPicker constructor, setting 2 preset colors, be careful, theese color may change in production. diff --git a/src/IntelliHelper/IntelliRenderSettings.h b/src/IntelliHelper/IntelliRenderSettings.h index 1fef570..b8b1a87 100644 --- a/src/IntelliHelper/IntelliRenderSettings.h +++ b/src/IntelliHelper/IntelliRenderSettings.h @@ -7,7 +7,7 @@ class UnitTest; class IntelliRenderSettings { - friend UnitTest; +friend UnitTest; public: IntelliRenderSettings(); diff --git a/src/Layer/PaintingArea.cpp b/src/Layer/PaintingArea.cpp index 3dfb526..0bf6a0e 100644 --- a/src/Layer/PaintingArea.cpp +++ b/src/Layer/PaintingArea.cpp @@ -332,15 +332,15 @@ void PaintingArea::paintEvent(QPaintEvent*event){ void PaintingArea::selectLayerUp(){ updateTools(); - 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(){ updateTools(); - if(activeLayer>0) { + if(activeLayer>0) { std::swap(layerBundle[static_cast(activeLayer)], layerBundle[static_cast(activeLayer - 1)]); activeLayer--; } diff --git a/src/Layer/PaintingArea.h b/src/Layer/PaintingArea.h index 3b04198..58eb411 100644 --- a/src/Layer/PaintingArea.h +++ b/src/Layer/PaintingArea.h @@ -21,29 +21,29 @@ class UnitTest; * \brief The LayerObject struct holds all the information needed to construct a layer */ struct LayerObject { - /*! - * \brief image - Stores the imageData of the current LayerObject. - */ + /*! + * \brief image - Stores the imageData of the current LayerObject. + */ IntelliImage* image; - /*! - * \brief width - Stores the width of a layer in pixels. - */ + /*! + * \brief width - Stores the width of a layer in pixels. + */ int width; - /*! - * \brief height - Stores the height of a layer in pixels. - */ + /*! + * \brief height - Stores the height of a layer in pixels. + */ int height; - /*! - * \brief widthOffset - Stores the number of pixles from the left side of the painting area. - */ + /*! + * \brief widthOffset - Stores the number of pixles from the left side of the painting area. + */ int widthOffset; - /*! - * \brief heightOffset - Stores the number of pixles from the top of the painting area. - */ + /*! + * \brief heightOffset - Stores the number of pixles from the top of the painting area. + */ int heightOffset; - /*! - * \brief alpha - Stores the alpha value of the layer (default=255). - */ + /*! + * \brief alpha - Stores the alpha value of the layer (default=255). + */ int alpha = 255; }; diff --git a/src/Tool/IntelliTool.cpp b/src/Tool/IntelliTool.cpp index 592bb2a..07ed62b 100644 --- a/src/Tool/IntelliTool.cpp +++ b/src/Tool/IntelliTool.cpp @@ -6,9 +6,9 @@ IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, In this->colorPicker = colorPicker; this->Toolsettings = Toolsettings; this->isDrawing = false; - this->ActiveType = Tooltype::NONE; - this->activeLayer = nullptr; - this->Canvas = nullptr; + this->ActiveType = Tooltype::NONE; + this->activeLayer = nullptr; + this->Canvas = nullptr; } IntelliTool::~IntelliTool(){ @@ -17,7 +17,7 @@ IntelliTool::~IntelliTool(){ void IntelliTool::onMouseRightPressed(int x, int y){ if(isDrawing) { - isDrawing = false; + isDrawing = false; this->deleteToolLayer(); } } diff --git a/src/Tool/IntelliTool.h b/src/Tool/IntelliTool.h index a3b2959..07b78bf 100644 --- a/src/Tool/IntelliTool.h +++ b/src/Tool/IntelliTool.h @@ -15,7 +15,7 @@ class PaintingArea; * \brief An abstract class that manages the basic events, like mouse clicks or scrolls events. */ class IntelliTool { - friend UnitTest; +friend UnitTest; public: enum class Tooltype { CIRCLE, @@ -24,8 +24,8 @@ enum class Tooltype { PEN, PLAIN, POLYGON, - RECTANGLE, - NONE + RECTANGLE, + NONE }; private: /*! diff --git a/src/Tool/IntelliToolCircle.cpp b/src/Tool/IntelliToolCircle.cpp index 5bf2ef9..17131bf 100644 --- a/src/Tool/IntelliToolCircle.cpp +++ b/src/Tool/IntelliToolCircle.cpp @@ -15,30 +15,30 @@ IntelliToolCircle::~IntelliToolCircle(){ void IntelliToolCircle::drawCircle(int radius){ QColor inner = this->colorPicker->getSecondColor(); inner.setAlpha(Toolsettings->getInnerAlpha()); - int yMinimum, yMaximum, xMinimum, xMaximum; - yMinimum = centerPoint.y() - radius; - yMaximum = centerPoint.y() + radius; + int yMinimum, yMaximum, xMinimum, xMaximum; + yMinimum = centerPoint.y() - radius; + yMaximum = centerPoint.y() + radius; // x = x0+-sqrt(r2-(y-y0)2) - for(int i = yMinimum; i<=yMaximum; i++) { - xMinimum = static_cast(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); - xMaximum = static_cast(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); - this->Canvas->image->drawLine(QPoint(xMinimum,i), QPoint(xMaximum,i),inner,1); + for(int i = yMinimum; i<=yMaximum; i++) { + xMinimum = static_cast(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); + xMaximum = static_cast(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); + this->Canvas->image->drawLine(QPoint(xMinimum,i), QPoint(xMaximum,i),inner,1); } //TODO implement circle drawing algorithm bresenham radius = static_cast(radius + (Toolsettings->getLineWidth() / 2.)); - yMinimum = (centerPoint.y() - radius); - yMaximum = (centerPoint.y() + radius); - for(int i = yMinimum; i<=yMaximum; i++) { - xMinimum = static_cast(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); - xMaximum = static_cast(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); - this->Canvas->image->drawPoint(QPoint(xMinimum,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); - this->Canvas->image->drawPoint(QPoint(xMaximum,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); + yMinimum = (centerPoint.y() - radius); + yMaximum = (centerPoint.y() + radius); + for(int i = yMinimum; i<=yMaximum; i++) { + xMinimum = static_cast(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); + xMaximum = static_cast(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2))); + this->Canvas->image->drawPoint(QPoint(xMinimum,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); + this->Canvas->image->drawPoint(QPoint(xMaximum,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth()); } - xMinimum = (centerPoint.x() - radius); - xMaximum = (centerPoint.x() + radius); - for(int i = xMinimum; i<=xMaximum; i++) { + xMinimum = (centerPoint.x() - radius); + xMaximum = (centerPoint.x() + radius); + for(int i = xMinimum; i<=xMaximum; 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()); diff --git a/src/Tool/IntelliToolCircle.h b/src/Tool/IntelliToolCircle.h index e33ac45..d9c0b82 100644 --- a/src/Tool/IntelliToolCircle.h +++ b/src/Tool/IntelliToolCircle.h @@ -12,7 +12,7 @@ class UnitTest; * \brief The IntelliToolCircle class represents a tool to draw a circle. */ class IntelliToolCircle : public IntelliTool { - friend UnitTest; +friend UnitTest; /*! * \brief A function that implements a circle drawing algorithm. * \param radius - The radius of the circle. diff --git a/src/Tool/IntelliToolFloodFill.h b/src/Tool/IntelliToolFloodFill.h index b1d29f6..0c4ae1d 100644 --- a/src/Tool/IntelliToolFloodFill.h +++ b/src/Tool/IntelliToolFloodFill.h @@ -12,7 +12,7 @@ class UnitTest; * \brief The IntelliToolFloodFill class represents a tool to flood FIll a certian area. */ class IntelliToolFloodFill : public IntelliTool { - friend UnitTest; +friend UnitTest; public: /*! * \brief A constructor setting the general paintingArea and colorPicker. diff --git a/src/Tool/IntelliToolLine.h b/src/Tool/IntelliToolLine.h index 1a4c8aa..a644192 100644 --- a/src/Tool/IntelliToolLine.h +++ b/src/Tool/IntelliToolLine.h @@ -11,7 +11,7 @@ class UnitTest; * \brief The IntelliToolFloodFill class represents a tool to draw a line. */ class IntelliToolLine : public IntelliTool { - friend UnitTest; +friend UnitTest; /*! * \brief The starting point of the line. */ diff --git a/src/Tool/IntelliToolPen.h b/src/Tool/IntelliToolPen.h index 851ec74..e7ee043 100644 --- a/src/Tool/IntelliToolPen.h +++ b/src/Tool/IntelliToolPen.h @@ -12,7 +12,7 @@ class UnitTest; * \brief The IntelliToolPen class represents a tool to draw a line. */ class IntelliToolPen : public IntelliTool { - friend UnitTest; +friend UnitTest; /*! * \brief point - Represents the previous point to help drawing a line. */ diff --git a/src/Tool/IntelliToolPlain.h b/src/Tool/IntelliToolPlain.h index 0c97c15..99a3258 100644 --- a/src/Tool/IntelliToolPlain.h +++ b/src/Tool/IntelliToolPlain.h @@ -11,7 +11,7 @@ class UnitTest; * \brief The IntelliToolPlainTool class represents a tool to fill the whole canvas with one color. */ class IntelliToolPlainTool : public IntelliTool { - friend UnitTest; +friend UnitTest; public: /*! * \brief A constructor setting the general paintingArea and colorPicker. diff --git a/src/Tool/IntelliToolPolygon.cpp b/src/Tool/IntelliToolPolygon.cpp index c866424..507ffb7 100644 --- a/src/Tool/IntelliToolPolygon.cpp +++ b/src/Tool/IntelliToolPolygon.cpp @@ -24,7 +24,7 @@ IntelliToolPolygon::~IntelliToolPolygon(){ } void IntelliToolPolygon::onMouseLeftPressed(int x, int y){ - if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && xgetWidthOfActive() && ygetHeightOfActive()) { + if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && xgetWidthOfActive() && ygetHeightOfActive()) { if(Area->getPolygonDataOfRealLayer().size()>2) { std::vector Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer()); QPoint Point(x,y); @@ -53,7 +53,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){ this->Canvas->image->calculateVisiblity(); } } - else if(drawingOfPolygon && QPointList.size() > 0 && isNearStart(x,y,QPointList.front())) { + else if(drawingOfPolygon && QPointList.size() > 0 && isNearStart(x,y,QPointList.front())) { if(QPointList.size() > 2) { isPointNearStart = true; this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth()); @@ -81,7 +81,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){ } void IntelliToolPolygon::onMouseRightPressed(int x, int y){ - drawingOfPolygon = false; + drawingOfPolygon = false; isInside = false; isPointNearStart = false; QPointList.clear(); @@ -92,7 +92,7 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){ if(isPointNearStart) { isInside = false; isPointNearStart = false; - drawingOfPolygon = false; + drawingOfPolygon = false; if(!isSettingPolygon) { std::vector Triangles = IntelliTriangulation::calculateTriangles(QPointList); QPoint Point; @@ -145,7 +145,7 @@ bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){ int StartY = Startpoint.y(); int valueToNear = 5; - float euklid = sqrt(pow(static_cast(StartX-x),2.f)+pow(static_cast(StartY-y),2.f)); + float euklid = sqrt(pow(static_cast(StartX - x),2.f) + pow(static_cast(StartY - y),2.f)); - return static_cast(euklid)(euklid) +#include // add necessary includes here -#include +#include #include "GUI/IntelliPhotoGui.h" class UnitTest : public QObject { - Q_OBJECT +Q_OBJECT private: - IntelliPhotoGui* gui; - PaintingArea* area; - QApplication* app; +IntelliPhotoGui* gui; +PaintingArea* area; +QApplication* app; public: - UnitTest(); - ~UnitTest(); +UnitTest(); +~UnitTest(); private slots: - void initTestCase(); - void cleanupTestCase(); - //void test_case1(); +void initTestCase(); +void cleanupTestCase(); +//void test_case1(); - //test painting area - void test_addLayer(); - void test_deleteLayer(); - void test_setActive(); - void test_setAlpha(); - void test_floodFill(); - void test_moveActive(); - void test_setPolygon(); - void test_setLayerUp(); - void test_setLayerDown(); +//test painting area +void test_addLayer(); +void test_deleteLayer(); +void test_setActive(); +void test_setAlpha(); +void test_floodFill(); +void test_moveActive(); +void test_setPolygon(); +void test_setLayerUp(); +void test_setLayerDown(); - void test_createTools(); +void test_createTools(); - //test Raster-Image operations - void test_RasterImage_drawPixel(); - void test_RasterImage_drawLine(); - void test_RasterImage_drawPoint(); - void test_RasterImage_getDisplayable(); - void test_RasterImage_setPolygon(); - void test_RasterImage_loadImage(); - void test_RasterImage_getPixelColor(); - void test_RasterImage_getImageData(); - void test_RasterImage_setImageData(); +//test Raster-Image operations +void test_RasterImage_drawPixel(); +void test_RasterImage_drawLine(); +void test_RasterImage_drawPoint(); +void test_RasterImage_getDisplayable(); +void test_RasterImage_setPolygon(); +void test_RasterImage_loadImage(); +void test_RasterImage_getPixelColor(); +void test_RasterImage_getImageData(); +void test_RasterImage_setImageData(); - //test Shaped-Image operations - void test_ShapedImage_drawPixel(); - void test_ShapedImage_drawLine(); - void test_ShapedImage_drawPoint(); - void test_ShapedImage_getDisplayable(); - void test_ShapedImage_setPolygon(); - void test_ShapedImage_loadImage(); - void test_ShapedImage_getPixelColor(); - void test_ShapedImage_getImageData(); - void test_ShapedImage_setImageData(); +//test Shaped-Image operations +void test_ShapedImage_drawPixel(); +void test_ShapedImage_drawLine(); +void test_ShapedImage_drawPoint(); +void test_ShapedImage_getDisplayable(); +void test_ShapedImage_setPolygon(); +void test_ShapedImage_loadImage(); +void test_ShapedImage_getPixelColor(); +void test_ShapedImage_getImageData(); +void test_ShapedImage_setImageData(); - //test painting-area tools - void test_createTool_Circle(); - void test_createTool_FloodFill(); - void test_createTool_Line(); - void test_createTool_Pen(); - void test_createTool_Plain(); - void test_createTool_Polygon(); - void test_createTool_Rectangle(); +//test painting-area tools +void test_createTool_Circle(); +void test_createTool_FloodFill(); +void test_createTool_Line(); +void test_createTool_Pen(); +void test_createTool_Plain(); +void test_createTool_Polygon(); +void test_createTool_Rectangle(); - //test tools - void test_Circle_fullDraw(); - void test_Circle_interruptedDraw(); +//test tools +void test_Circle_fullDraw(); +void test_Circle_interruptedDraw(); - void test_FloodFill_fullDraw(); - void test_FloodFill_interruptedDraw(); +void test_FloodFill_fullDraw(); +void test_FloodFill_interruptedDraw(); - void test_Line_fullDraw(); - void test_Line_interruptedDraw(); +void test_Line_fullDraw(); +void test_Line_interruptedDraw(); - void test_Pen_fullDraw(); - void test_Pen_interruptedDraw(); +void test_Pen_fullDraw(); +void test_Pen_interruptedDraw(); - void test_Plain_fullDraw(); - void test_Plain_interruptedDraw(); +void test_Plain_fullDraw(); +void test_Plain_interruptedDraw(); - void test_Polygon_fullDraw(); - void test_Polygon_interruptedDraw(); +void test_Polygon_fullDraw(); +void test_Polygon_interruptedDraw(); - void test_Rectangle_fullDraw(); - void test_Rectangle_interruptedDraw(); +void test_Rectangle_fullDraw(); +void test_Rectangle_interruptedDraw(); - //test Triangulation - void test_Triangulation_Coverage(); +//test Triangulation +void test_Triangulation_Coverage(); }; UnitTest::UnitTest() { - char arg0[] = "programName"; - char arg1[] = "arg1"; - char arg2[] = "arg2"; - char *argv[] = {arg0, arg1, arg2, nullptr}; - int argc = sizeof(argv) / sizeof(char*) - 1; + char arg0[] = "programName"; + char arg1[] = "arg1"; + char arg2[] = "arg2"; + char*argv[] = {arg0, arg1, arg2, nullptr}; + int argc = sizeof(argv) / sizeof(char*) - 1; - app = new QApplication(argc,argv); - gui = new IntelliPhotoGui(); - area = gui->paintingArea; + app = new QApplication(argc,argv); + gui = new IntelliPhotoGui(); + area = gui->paintingArea; } UnitTest::~UnitTest() @@ -117,8 +117,8 @@ void UnitTest::initTestCase() void UnitTest::cleanupTestCase() { - delete gui; - delete app; + delete gui; + delete app; } //void UnitTest::test_case1() @@ -129,73 +129,123 @@ void UnitTest::cleanupTestCase() //} //test painting area -void UnitTest::test_addLayer(){} -void UnitTest::test_deleteLayer(){} -void UnitTest::test_setActive(){} -void UnitTest::test_setAlpha(){} -void UnitTest::test_floodFill(){} -void UnitTest::test_moveActive(){} -void UnitTest::test_setPolygon(){} -void UnitTest::test_setLayerUp(){} -void UnitTest::test_setLayerDown(){} +void UnitTest::test_addLayer(){ +} +void UnitTest::test_deleteLayer(){ +} +void UnitTest::test_setActive(){ +} +void UnitTest::test_setAlpha(){ +} +void UnitTest::test_floodFill(){ +} +void UnitTest::test_moveActive(){ +} +void UnitTest::test_setPolygon(){ +} +void UnitTest::test_setLayerUp(){ +} +void UnitTest::test_setLayerDown(){ +} -void UnitTest::test_createTools(){} +void UnitTest::test_createTools(){ +} //test Raster-Image operations -void UnitTest::test_RasterImage_drawPixel(){} -void UnitTest::test_RasterImage_drawLine(){} -void UnitTest::test_RasterImage_drawPoint(){} -void UnitTest::test_RasterImage_getDisplayable(){} -void UnitTest::test_RasterImage_setPolygon(){} -void UnitTest::test_RasterImage_loadImage(){} -void UnitTest::test_RasterImage_getPixelColor(){} -void UnitTest::test_RasterImage_getImageData(){} -void UnitTest::test_RasterImage_setImageData(){} +void UnitTest::test_RasterImage_drawPixel(){ +} +void UnitTest::test_RasterImage_drawLine(){ +} +void UnitTest::test_RasterImage_drawPoint(){ +} +void UnitTest::test_RasterImage_getDisplayable(){ +} +void UnitTest::test_RasterImage_setPolygon(){ +} +void UnitTest::test_RasterImage_loadImage(){ +} +void UnitTest::test_RasterImage_getPixelColor(){ +} +void UnitTest::test_RasterImage_getImageData(){ +} +void UnitTest::test_RasterImage_setImageData(){ +} //test Shaped-Image operations -void UnitTest::test_ShapedImage_drawPixel(){} -void UnitTest::test_ShapedImage_drawLine(){} -void UnitTest::test_ShapedImage_drawPoint(){} -void UnitTest::test_ShapedImage_getDisplayable(){} -void UnitTest::test_ShapedImage_setPolygon(){} -void UnitTest::test_ShapedImage_loadImage(){} -void UnitTest::test_ShapedImage_getPixelColor(){} -void UnitTest::test_ShapedImage_getImageData(){} -void UnitTest::test_ShapedImage_setImageData(){} +void UnitTest::test_ShapedImage_drawPixel(){ +} +void UnitTest::test_ShapedImage_drawLine(){ +} +void UnitTest::test_ShapedImage_drawPoint(){ +} +void UnitTest::test_ShapedImage_getDisplayable(){ +} +void UnitTest::test_ShapedImage_setPolygon(){ +} +void UnitTest::test_ShapedImage_loadImage(){ +} +void UnitTest::test_ShapedImage_getPixelColor(){ +} +void UnitTest::test_ShapedImage_getImageData(){ +} +void UnitTest::test_ShapedImage_setImageData(){ +} //test painting-area tools -void UnitTest::test_createTool_Circle(){} -void UnitTest::test_createTool_FloodFill(){} -void UnitTest::test_createTool_Line(){} -void UnitTest::test_createTool_Pen(){} -void UnitTest::test_createTool_Plain(){} -void UnitTest::test_createTool_Polygon(){} -void UnitTest::test_createTool_Rectangle(){} +void UnitTest::test_createTool_Circle(){ +} +void UnitTest::test_createTool_FloodFill(){ +} +void UnitTest::test_createTool_Line(){ +} +void UnitTest::test_createTool_Pen(){ +} +void UnitTest::test_createTool_Plain(){ +} +void UnitTest::test_createTool_Polygon(){ +} +void UnitTest::test_createTool_Rectangle(){ +} //test tools -void UnitTest::test_Circle_fullDraw(){} -void UnitTest::test_Circle_interruptedDraw(){} +void UnitTest::test_Circle_fullDraw(){ +} +void UnitTest::test_Circle_interruptedDraw(){ +} -void UnitTest::test_FloodFill_fullDraw(){} -void UnitTest::test_FloodFill_interruptedDraw(){} +void UnitTest::test_FloodFill_fullDraw(){ +} +void UnitTest::test_FloodFill_interruptedDraw(){ +} -void UnitTest::test_Line_fullDraw(){} -void UnitTest::test_Line_interruptedDraw(){} +void UnitTest::test_Line_fullDraw(){ +} +void UnitTest::test_Line_interruptedDraw(){ +} -void UnitTest::test_Pen_fullDraw(){} -void UnitTest::test_Pen_interruptedDraw(){} +void UnitTest::test_Pen_fullDraw(){ +} +void UnitTest::test_Pen_interruptedDraw(){ +} -void UnitTest::test_Plain_fullDraw(){} -void UnitTest::test_Plain_interruptedDraw(){} +void UnitTest::test_Plain_fullDraw(){ +} +void UnitTest::test_Plain_interruptedDraw(){ +} -void UnitTest::test_Polygon_fullDraw(){} -void UnitTest::test_Polygon_interruptedDraw(){} +void UnitTest::test_Polygon_fullDraw(){ +} +void UnitTest::test_Polygon_interruptedDraw(){ +} -void UnitTest::test_Rectangle_fullDraw(){} -void UnitTest::test_Rectangle_interruptedDraw(){} +void UnitTest::test_Rectangle_fullDraw(){ +} +void UnitTest::test_Rectangle_interruptedDraw(){ +} //test Triangulation -void UnitTest::test_Triangulation_Coverage(){} +void UnitTest::test_Triangulation_Coverage(){ +} QTEST_APPLESS_MAIN(UnitTest) diff --git a/src/tst_unittest.cpp b/src/tst_unittest.cpp index dc21b8a..5e9f88c 100644 --- a/src/tst_unittest.cpp +++ b/src/tst_unittest.cpp @@ -282,7 +282,7 @@ void UnitTest::test_moveActive(){ area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE); - area->layerBundle[1].image->drawPlain(QColor(0, 0, 0, 255)); + area->layerBundle[1].image->drawPlain(QColor(0, 0, 0, 255)); QPoint point(0,0); area->moveActiveLayer(-1); @@ -449,9 +449,9 @@ void UnitTest::test_RasterImage_getDisplayable(){ area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255)); QImage img = area->layerBundle[0].image->getDisplayable(QSize(200,200),255); QPoint point; - for(size_t i=0; i<200; i++) { + for(size_t i = 0; i<200; i++) { point.setX(static_cast(i)); - for(size_t j=0; j<200; j++) { + for(size_t j = 0; j<200; j++) { point.setY(static_cast(j)); QVERIFY(img.pixelColor(point) == QColor(255,255,255,255)); } @@ -1136,20 +1136,20 @@ void UnitTest::bench_moveActive(){ } void UnitTest::bench_setPolygon(){ - area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE); + area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE); - std::vector polygon{ - QPoint(10,00), - QPoint(00,10), - QPoint(10,10), - QPoint(00,10) - }; + std::vector polygon{ + QPoint(10,00), + QPoint(00,10), + QPoint(10,10), + QPoint(00,10) + }; - QBENCHMARK{ - area->layerBundle[0].image->setPolygon(polygon); - } + QBENCHMARK{ + area->layerBundle[0].image->setPolygon(polygon); + } - area->deleteLayer(0); + area->deleteLayer(0); } void UnitTest::bench_setLayerUp(){ @@ -1561,65 +1561,65 @@ void UnitTest::bench_Plain_interruptedDraw(){ } void UnitTest::bench_Polygon_fullDraw(){ - area->addLayer(21,21,10,20,IntelliImage::ImageType::RASTERIMAGE); - std::vector points{ - QPoint(10,00), - QPoint(00,10), - QPoint(10,20), - QPoint(20,10) - }; + area->addLayer(21,21,10,20,IntelliImage::ImageType::RASTERIMAGE); + std::vector points{ + QPoint(10,00), + QPoint(00,10), + QPoint(10,20), + QPoint(20,10) + }; - area->colorPicker.setFirstColor(QColor(255,255,255,255)); - area->colorPicker.setSecondColor(QColor(0,0,0,255)); - area->createPolygonTool(); - area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255)); + area->colorPicker.setFirstColor(QColor(255,255,255,255)); + area->colorPicker.setSecondColor(QColor(0,0,0,255)); + area->createPolygonTool(); + area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255)); - QBENCHMARK{ - area->Tool->onMouseLeftPressed(points[0].x(), points[0].y()); - area->Tool->onMouseLeftReleased(points[0].x(), points[0].y()); - area->Tool->onMouseMoved(points[1].x(), points[1].y()); + QBENCHMARK{ + area->Tool->onMouseLeftPressed(points[0].x(), points[0].y()); + area->Tool->onMouseLeftReleased(points[0].x(), points[0].y()); + area->Tool->onMouseMoved(points[1].x(), points[1].y()); - area->Tool->onMouseLeftPressed(points[1].x(), points[1].y()); - area->Tool->onMouseLeftReleased(points[1].x(), points[1].y()); - area->Tool->onMouseMoved(points[2].x(), points[2].y()); + area->Tool->onMouseLeftPressed(points[1].x(), points[1].y()); + area->Tool->onMouseLeftReleased(points[1].x(), points[1].y()); + area->Tool->onMouseMoved(points[2].x(), points[2].y()); - area->Tool->onMouseLeftPressed(points[2].x(), points[2].y()); - area->Tool->onMouseLeftReleased(points[2].x(), points[2].y()); - area->Tool->onMouseMoved(points[3].x(), points[3].y()); + area->Tool->onMouseLeftPressed(points[2].x(), points[2].y()); + area->Tool->onMouseLeftReleased(points[2].x(), points[2].y()); + area->Tool->onMouseMoved(points[3].x(), points[3].y()); - area->Tool->onMouseLeftPressed(points[3].x(), points[3].y()); - area->Tool->onMouseLeftReleased(points[3].x(), points[3].y()); - area->Tool->onMouseMoved(points[0].x(), points[0].y()); + area->Tool->onMouseLeftPressed(points[3].x(), points[3].y()); + area->Tool->onMouseLeftReleased(points[3].x(), points[3].y()); + area->Tool->onMouseMoved(points[0].x(), points[0].y()); - area->Tool->onMouseLeftPressed(points[0].x(), points[0].y()); - area->Tool->onMouseLeftReleased(points[0].x(), points[0].y()); - } + area->Tool->onMouseLeftPressed(points[0].x(), points[0].y()); + area->Tool->onMouseLeftReleased(points[0].x(), points[0].y()); + } - area->deleteLayer(0); + area->deleteLayer(0); } void UnitTest::bench_Polygon_interruptedDraw(){ - area->addLayer(201,201,10,20,IntelliImage::ImageType::RASTERIMAGE); - std::vector points{ - QPoint(100,000) - }; + area->addLayer(201,201,10,20,IntelliImage::ImageType::RASTERIMAGE); + std::vector points{ + QPoint(100,000) + }; - area->colorPicker.setFirstColor(QColor(255,255,255,255)); - area->colorPicker.setSecondColor(QColor(0,0,0,255)); - area->createPolygonTool(); - area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255)); + area->colorPicker.setFirstColor(QColor(255,255,255,255)); + area->colorPicker.setSecondColor(QColor(0,0,0,255)); + area->createPolygonTool(); + area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255)); - QBENCHMARK{ - area->Tool->onMouseLeftPressed(points[0].x(), points[0].y()); - area->Tool->onMouseLeftReleased(points[0].x(), points[0].y()); + QBENCHMARK{ + area->Tool->onMouseLeftPressed(points[0].x(), points[0].y()); + area->Tool->onMouseLeftReleased(points[0].x(), points[0].y()); - area->Tool->onMouseRightPressed(points[0].x(), points[0].y()); - area->Tool->onMouseRightReleased(points[0].x(), points[0].y()); - } + area->Tool->onMouseRightPressed(points[0].x(), points[0].y()); + area->Tool->onMouseRightReleased(points[0].x(), points[0].y()); + } - area->deleteLayer(0); + area->deleteLayer(0); } @@ -1681,9 +1681,9 @@ void UnitTest::bench_Triangulation_Coverage(){ QBENCHMARK{ std::vector tria = IntelliTriangulation::calculateTriangles(points); QPoint point; - for(int i=0; i<200; i++) { + for(int i = 0; i<200; i++) { point.setX(i); - for(int j=0; j<200; j++) { + for(int j = 0; j<200; j++) { point.setY(j); IntelliTriangulation::isInPolygon(tria, point); }