From 624eb0fde6b1ffd19139ca85111f8106ceec8efd Mon Sep 17 00:00:00 2001 From: Conrad Date: Thu, 9 Jan 2020 11:35:36 +0100 Subject: [PATCH 1/3] Uncrustify all .cpp files --- src/Image/IntelliImage.cpp | 100 +++++++++++++++---------------- src/Image/IntelliRasterImage.cpp | 20 +++---- src/Image/IntelliShapedImage.cpp | 44 +++++++------- src/Layer/PaintingArea.cpp | 24 ++++---- 4 files changed, 94 insertions(+), 94 deletions(-) diff --git a/src/Image/IntelliImage.cpp b/src/Image/IntelliImage.cpp index 4e97513..576a93d 100644 --- a/src/Image/IntelliImage.cpp +++ b/src/Image/IntelliImage.cpp @@ -3,15 +3,15 @@ #include IntelliImage::IntelliImage(int width, int height, bool fastRendererOn) - : imageData(QSize(width, height), fastRendererOn ? QImage::Format_Indexed8 : QImage::Format_ARGB32){ - if(fastRendererOn){ - imageData = imageData.convertToFormat(QImage::Format_ARGB32); - } - imageData.fill(QColor(255,255,255,255)); - if(fastRendererOn){ - imageData = imageData.convertToFormat(QImage::Format_Indexed8); - } - this->fastRenderer = fastRendererOn; + : imageData(QSize(width, height), fastRendererOn ? QImage::Format_Indexed8 : QImage::Format_ARGB32){ + if(fastRendererOn) { + imageData = imageData.convertToFormat(QImage::Format_ARGB32); + } + imageData.fill(QColor(255,255,255,255)); + if(fastRendererOn) { + imageData = imageData.convertToFormat(QImage::Format_Indexed8); + } + this->fastRenderer = fastRendererOn; } @@ -30,7 +30,7 @@ bool IntelliImage::loadImage(const QString &filePath){ // scaled Image to size of Layer loadedImage = loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio); - imageData = loadedImage.convertToFormat(fastRenderer ? QImage::Format_Indexed8 : QImage::Format_ARGB32); + imageData = loadedImage.convertToFormat(fastRenderer ? QImage::Format_Indexed8 : QImage::Format_ARGB32); return true; } @@ -40,23 +40,23 @@ void IntelliImage::resizeImage(QImage*image, const QSize &newSize){ return; // Create a new image to display and fill it with white - QImage newImage(newSize, QImage::Format_ARGB32); + QImage newImage(newSize, QImage::Format_ARGB32); newImage.fill(qRgb(255, 255, 255)); // Draw the image QPainter painter(&newImage); painter.drawImage(QPoint(0, 0), *image); *image = newImage; - if(fastRenderer){ - this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); - } + if(fastRenderer) { + this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); + } } void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){ - if(fastRenderer){ - this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32); - } - // Used to draw on the widget + if(fastRenderer) { + this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32); + } + // Used to draw on the widget QPainter painter(&imageData); // Set the current settings for the pen @@ -64,32 +64,32 @@ void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){ // Draw a line from the last registered point to the current painter.drawPoint(p1); - if(fastRenderer){ - this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); - } + if(fastRenderer) { + this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); + } } void IntelliImage::drawPoint(const QPoint &p1, const QColor& color, const int& penWidth){ - if(fastRenderer){ - this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32); - } - // Used to draw on the widget + if(fastRenderer) { + this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32); + } + // Used to draw on the widget QPainter painter(&imageData); // Set the current settings for the pen painter.setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); // Draw a line from the last registered point to the current painter.drawPoint(p1); - if(fastRenderer){ - this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); - } + if(fastRenderer) { + this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); + } } void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth){ - if(fastRenderer){ - this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32); - } - // Used to draw on the widget + if(fastRenderer) { + this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32); + } + // Used to draw on the widget QPainter painter(&imageData); // Set the current settings for the pen @@ -97,34 +97,34 @@ void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& co // Draw a line from the last registered point to the current painter.drawLine(p1, p2); - if(fastRenderer){ - this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); - } + if(fastRenderer) { + this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); + } } void IntelliImage::drawPlain(const QColor& color){ - if(fastRenderer){ - this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32); - } - imageData.fill(color); - if(fastRenderer){ - this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); - } + if(fastRenderer) { + this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32); + } + imageData.fill(color); + if(fastRenderer) { + this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); + } } QColor IntelliImage::getPixelColor(QPoint& point){ - if(fastRenderer){ - QImage copy = this->imageData.convertToFormat(QImage::Format_ARGB32); - return copy.pixelColor(point); - } - return imageData.pixelColor(point); + if(fastRenderer) { + QImage copy = this->imageData.convertToFormat(QImage::Format_ARGB32); + return copy.pixelColor(point); + } + return imageData.pixelColor(point); } QImage IntelliImage::getImageData(){ - return this->imageData; + return this->imageData; } void IntelliImage::updateRendererSetting(bool fastRendererOn){ - this->fastRenderer = fastRendererOn; - this->imageData = this->imageData.convertToFormat(fastRenderer ? QImage::Format_Indexed8 : QImage::Format_ARGB32); + this->fastRenderer = fastRendererOn; + this->imageData = this->imageData.convertToFormat(fastRenderer ? QImage::Format_Indexed8 : QImage::Format_ARGB32); } diff --git a/src/Image/IntelliRasterImage.cpp b/src/Image/IntelliRasterImage.cpp index 4bd0891..0d28e5d 100644 --- a/src/Image/IntelliRasterImage.cpp +++ b/src/Image/IntelliRasterImage.cpp @@ -4,9 +4,9 @@ #include IntelliRasterImage::IntelliRasterImage(int width, int height, bool fastRendererOn) - : IntelliImage(width, height, fastRendererOn){ - TypeOfImage = IntelliImage::ImageType::RASTERIMAGE; - this->fastRenderer = fastRendererOn; + : IntelliImage(width, height, fastRendererOn){ + TypeOfImage = IntelliImage::ImageType::RASTERIMAGE; + this->fastRenderer = fastRendererOn; } IntelliRasterImage::~IntelliRasterImage(){ @@ -14,7 +14,7 @@ IntelliRasterImage::~IntelliRasterImage(){ } IntelliImage* IntelliRasterImage::getDeepCopy(){ - IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), false); + IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), false); raster->imageData.fill(Qt::transparent); raster->TypeOfImage = IntelliImage::ImageType::RASTERIMAGE; return raster; @@ -30,9 +30,9 @@ QImage IntelliRasterImage::getDisplayable(int alpha){ QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){ QImage copy = imageData; - if(fastRenderer){ - copy = copy.convertToFormat(QImage::Format_ARGB32); - } + if(fastRenderer) { + copy = copy.convertToFormat(QImage::Format_ARGB32); + } for(int y = 0; y IntelliShapedImage::IntelliShapedImage(int width, int height, bool fastRendererOn) - : IntelliRasterImage(width, height, fastRendererOn){ - TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE; - this->fastRenderer = fastRendererOn; + : IntelliRasterImage(width, height, fastRendererOn){ + TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE; + this->fastRenderer = fastRendererOn; } IntelliShapedImage::~IntelliShapedImage(){ @@ -19,7 +19,7 @@ QImage IntelliShapedImage::getDisplayable(int alpha){ } IntelliImage* IntelliShapedImage::getDeepCopy(){ - IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), false); + IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), false); shaped->setPolygon(this->polygonData); shaped->imageData.fill(Qt::transparent); shaped->TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE; @@ -27,11 +27,11 @@ IntelliImage* IntelliShapedImage::getDeepCopy(){ } void IntelliShapedImage::calculateVisiblity(){ - if(fastRenderer){ - this->imageData = imageData.convertToFormat(QImage::Format_ARGB32); - } + if(fastRenderer) { + this->imageData = imageData.convertToFormat(QImage::Format_ARGB32); + } - if(polygonData.size()<=2) { + if(polygonData.size()<=2) { QColor clr; for(int y=0; yimageData = this->imageData.convertToFormat(QImage::Format_Indexed8); - } + if(fastRenderer) { + this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); + } return; } QColor clr; @@ -50,7 +50,7 @@ void IntelliShapedImage::calculateVisiblity(){ for(int x=0; ximageData = this->imageData.convertToFormat(QImage::Format_Indexed8); - } + if(fastRenderer) { + this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); + } } QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){ QImage copy = imageData; - if(fastRenderer){ - copy = copy.convertToFormat(QImage::Format_ARGB32); - } + if(fastRenderer) { + copy = copy.convertToFormat(QImage::Format_ARGB32); + } for(int y = 0; y& polygonData){ for(auto element:polygonData) { this->polygonData.push_back(QPoint(element.x(), element.y())); } - triangles = IntelliTriangulation::calculateTriangles(polygonData); + triangles = IntelliTriangulation::calculateTriangles(polygonData); } calculateVisiblity(); return; diff --git a/src/Layer/PaintingArea.cpp b/src/Layer/PaintingArea.cpp index 2258376..7dd3e01 100644 --- a/src/Layer/PaintingArea.cpp +++ b/src/Layer/PaintingArea.cpp @@ -31,7 +31,7 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent) polygon.push_back(QPoint(000,100)); layerBundle[0].image->setPolygon(polygon); - this->addLayer(200,200,150,150,IntelliImage::ImageType::RASTERIMAGE); + this->addLayer(200,200,150,150,IntelliImage::ImageType::RASTERIMAGE); layerBundle[1].image->drawPlain(QColor(0,255,0,255)); layerBundle[1].alpha=200; @@ -59,10 +59,10 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff newLayer.height = height; newLayer.widthOffset = widthOffset; newLayer.heightOffset = heightOffset; - if(type==IntelliImage::ImageType::RASTERIMAGE) { - newLayer.image = new IntelliRasterImage(width,height,renderSettings.getFastRenderer()); - }else if(type==IntelliImage::ImageType::SHAPEDIMAGE) { - newLayer.image = new IntelliShapedImage(width, height, renderSettings.getFastRenderer()); + if(type==IntelliImage::ImageType::RASTERIMAGE) { + newLayer.image = new IntelliRasterImage(width,height,renderSettings.getFastRenderer()); + }else if(type==IntelliImage::ImageType::SHAPEDIMAGE) { + newLayer.image = new IntelliShapedImage(width, height, renderSettings.getFastRenderer()); } newLayer.alpha = 255; this->layerBundle.push_back(newLayer); @@ -158,13 +158,13 @@ void PaintingArea::movePositionActive(int x, int y){ } void PaintingArea::moveActiveLayer(int idx){ - if(Tool != nullptr){ - if(Tool->getIsDrawing()){ - IntelliTool* temp = copyActiveTool(); - delete this->Tool; - this->Tool = temp; - } - } + if(Tool != nullptr) { + if(Tool->getIsDrawing()) { + IntelliTool* temp = copyActiveTool(); + delete this->Tool; + this->Tool = temp; + } + } if(idx==1) { this->selectLayerUp(); }else if(idx==-1) { From 14e4d50541584d8ef7b55abd2432c11453795ddc Mon Sep 17 00:00:00 2001 From: Conrad Date: Thu, 9 Jan 2020 11:36:10 +0100 Subject: [PATCH 2/3] Update cppcheck errors --- cppcheck_errors.txt | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/cppcheck_errors.txt b/cppcheck_errors.txt index dbbc1f3..edc41a2 100644 --- a/cppcheck_errors.txt +++ b/cppcheck_errors.txt @@ -10,7 +10,7 @@ src/IntelliHelper/IntelliColorPicker.cpp:5:3: performance: Variable 'secondColor 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:333:22: style: Redundant condition: If 'activeLayer > 0', the comparison 'activeLayer != -1' is always true. [redundantCondition] +src/Layer/PaintingArea.cpp:335: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] @@ -58,28 +58,25 @@ bool isDrawing; src/GUI/IntelliPhotoGui.cpp:23:0: style: The function 'closeEvent' is never used. [unusedFunction] ^ -src/IntelliHelper/IntelliRenderSettings.cpp:8:0: style: The function 'getFastRenderer' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:271:0: style: The function 'mouseMoveEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:269:0: style: The function 'mouseMoveEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:255:0: style: The function 'mousePressEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:253:0: style: The function 'mousePressEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:281:0: style: The function 'mouseReleaseEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:279:0: style: The function 'mouseReleaseEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:307:0: style: The function 'paintEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:305:0: style: The function 'paintEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:318:0: style: The function 'resizeEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:316:0: style: The function 'resizeEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:323:0: style: The function 'resizeLayer' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:321:0: style: The function 'resizeLayer' is never used. [unusedFunction] - -^ -src/Layer/PaintingArea.cpp:173:0: style: The function 'slotActivateLayer' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:175:0: style: The function 'slotActivateLayer' is never used. [unusedFunction] ^ src/GUI/IntelliPhotoGui.cpp:157:0: style: The function 'slotClearActiveLayer' is never used. [unusedFunction] @@ -88,7 +85,7 @@ src/GUI/IntelliPhotoGui.cpp:157:0: style: The function 'slotClearActiveLayer' is src/Layer/PaintingArea.cpp:83:0: style: The function 'slotDeleteActiveLayer' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:292:0: style: The function 'wheelEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:294: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] From 124dfd7931f7a4fccc1bf52c2c8829179ff14e1e Mon Sep 17 00:00:00 2001 From: Conrad Date: Thu, 9 Jan 2020 11:44:26 +0100 Subject: [PATCH 3/3] Uncrustified header files --- src/Layer/PaintingArea.h | 334 +++++++++++++++++++-------------------- 1 file changed, 167 insertions(+), 167 deletions(-) diff --git a/src/Layer/PaintingArea.h b/src/Layer/PaintingArea.h index 31b3916..7bb1ee6 100644 --- a/src/Layer/PaintingArea.h +++ b/src/Layer/PaintingArea.h @@ -22,13 +22,13 @@ * \param widthOffset - Stores the number of pixles from the left side of the painting area * \param heightOffset - Stores the number of pixles from the top of the painting area */ -struct LayerObject{ - IntelliImage* image; - int width; - int height; - int widthOffset; - int heightOffset; - int alpha=255; +struct LayerObject { + IntelliImage* image; + int width; + int height; + int widthOffset; + int heightOffset; + int alpha=255; }; /*! @@ -36,193 +36,193 @@ struct LayerObject{ */ class PaintingArea : public QWidget { - // Declares our class as a QObject which is the base class - // for all Qt objects - // QObjects handle events - Q_OBJECT - friend IntelliTool; - friend IntelliPhotoGui; +// Declares our class as a QObject which is the base class +// for all Qt objects +// QObjects handle events +Q_OBJECT +friend IntelliTool; +friend IntelliPhotoGui; public: - /*! - * \brief PaintingArea is the constructor of the PaintingArea class, which initiates the working environment - * \param maxWidth - The maximum amount of pixles that are inside painting area from left to right (default=600px) - * \param maxHeight - The maximum amount of pixles that are inside painting area from top to bottom (default=600px) - * \param parent - The parent window of the main window (default=nullptr) - */ - PaintingArea(int maxWidth=600, int maxHeight=600, QWidget *parent = nullptr); +/*! + * \brief PaintingArea is the constructor of the PaintingArea class, which initiates the working environment + * \param maxWidth - The maximum amount of pixles that are inside painting area from left to right (default=600px) + * \param maxHeight - The maximum amount of pixles that are inside painting area from top to bottom (default=600px) + * \param parent - The parent window of the main window (default=nullptr) + */ +PaintingArea(int maxWidth=600, int maxHeight=600, QWidget*parent = nullptr); - /*! - * \brief This deconstructor is used to clear up the memory and remove the currently active window - */ - ~PaintingArea() override; +/*! + * \brief This deconstructor is used to clear up the memory and remove the currently active window + */ +~PaintingArea() override; - // Handles all events +// Handles all events - /*! - * \brief The open method is used for loading a picture into the current layer - * \param fileName - Path and filename which are used to determine where the to-be-opened file is stored - * \return Returns a boolean variable whether the file was successfully opened or not - */ - bool open(const QString &filePath); - /*! - * \brief The save method is used for exporting the current project as one picture - * \param fileName - * \param fileFormat - * \return Returns a boolean variable, true if the file was saved successfully, false if not - */ - bool save(const QString &filePath, const char *fileFormat); +/*! + * \brief The open method is used for loading a picture into the current layer + * \param fileName - Path and filename which are used to determine where the to-be-opened file is stored + * \return Returns a boolean variable whether the file was successfully opened or not + */ +bool open(const QString &filePath); +/*! + * \brief The save method is used for exporting the current project as one picture + * \param fileName + * \param fileFormat + * \return Returns a boolean variable, true if the file was saved successfully, false if not + */ +bool save(const QString &filePath, const char*fileFormat); - /*! - * \brief The addLayer adds a layer to the current project/ painting area - * \param width - Width of the layer in pixles - * \param height - Height of the layer in pixles - * \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles - * \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles - * \param type - Defining the ImageType of the new layer - * \return Returns the number of layers in the project - */ - int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE); - /*! - * \brief The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer stack - * \param idx - Index of the position the new layer should be added - * \param width - Width of the layer in pixles - * \param height - Height of the layer in pixles - * \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles - * \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles - * \param type - Defining the ImageType of the new layer - * \return Returns the id of the layer position - */ - int addLayerAt(int idx, int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE); - /*! - * \brief The deleteLayer method removes a layer at a given idx - * \param idx - The index of the layer to be removed - */ - void deleteLayer(int idx); - /*! - * \brief The setLayerToActive method marks a specific layer as active - * \param idx - The index of the layer to be active - */ - void setLayerActive(int idx); - /*! - * \brief The setAlphaOfLayer method sets the alpha value of a specific layer - * \param idx - The index of the layer where the change should be applied - * \param alpha - New alpha value of the layer - */ - void setLayerAlpha(int idx, int alpha); - /*! - * \brief The floodFill method fills a the active layer with a given color - * \param r - Red value of the color the layer should be filled with - * \param g - Green value of the color the layer should be filled with - * \param b - Blue value of the color the layer should be filled with - * \param a - Alpha value of the color the layer should be filled with - */ - void floodFill(int r, int g, int b, int a); - /*! - * \brief The movePositionActive method moves the active layer to certain position - * \param x - The x value the new center of the layer should be at - * \param y - The y value the new center of the layer should be at - */ - void movePositionActive(int x, int y); - /*! - * \brief The moveActiveLayer moves the active layer to a specific position in the layer stack - * \param idx - The index of the new position the layer should be in - */ - void moveActiveLayer(int idx); +/*! + * \brief The addLayer adds a layer to the current project/ painting area + * \param width - Width of the layer in pixles + * \param height - Height of the layer in pixles + * \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles + * \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles + * \param type - Defining the ImageType of the new layer + * \return Returns the number of layers in the project + */ +int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE); +/*! + * \brief The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer stack + * \param idx - Index of the position the new layer should be added + * \param width - Width of the layer in pixles + * \param height - Height of the layer in pixles + * \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles + * \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles + * \param type - Defining the ImageType of the new layer + * \return Returns the id of the layer position + */ +int addLayerAt(int idx, int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE); +/*! + * \brief The deleteLayer method removes a layer at a given idx + * \param idx - The index of the layer to be removed + */ +void deleteLayer(int idx); +/*! + * \brief The setLayerToActive method marks a specific layer as active + * \param idx - The index of the layer to be active + */ +void setLayerActive(int idx); +/*! + * \brief The setAlphaOfLayer method sets the alpha value of a specific layer + * \param idx - The index of the layer where the change should be applied + * \param alpha - New alpha value of the layer + */ +void setLayerAlpha(int idx, int alpha); +/*! + * \brief The floodFill method fills a the active layer with a given color + * \param r - Red value of the color the layer should be filled with + * \param g - Green value of the color the layer should be filled with + * \param b - Blue value of the color the layer should be filled with + * \param a - Alpha value of the color the layer should be filled with + */ +void floodFill(int r, int g, int b, int a); +/*! + * \brief The movePositionActive method moves the active layer to certain position + * \param x - The x value the new center of the layer should be at + * \param y - The y value the new center of the layer should be at + */ +void movePositionActive(int x, int y); +/*! + * \brief The moveActiveLayer moves the active layer to a specific position in the layer stack + * \param idx - The index of the new position the layer should be in + */ +void moveActiveLayer(int idx); - //change properties of colorPicker - /*! - * \brief The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color - */ - void colorPickerSetFirstColor(); - /*! - * \brief The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color - */ - void colorPickerSetSecondColor(); - /*! - * \brief The colorPickerSwitchColor swaps the primary color with the secondary drawing color - */ - void colorPickerSwapColors(); +//change properties of colorPicker +/*! + * \brief The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color + */ +void colorPickerSetFirstColor(); +/*! + * \brief The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color + */ +void colorPickerSetSecondColor(); +/*! + * \brief The colorPickerSwitchColor swaps the primary color with the secondary drawing color + */ +void colorPickerSwapColors(); - // Create tools - void createPenTool(); - void createPlainTool(); - void createLineTool(); - void createRectangleTool(); - void createCircleTool(); - void createPolygonTool(); - void createFloodFillTool(); +// Create tools +void createPenTool(); +void createPlainTool(); +void createLineTool(); +void createRectangleTool(); +void createCircleTool(); +void createPolygonTool(); +void createFloodFillTool(); - /*! - * \brief The getWidthOfActive gets the horizontal dimensions of the active layer - * \return Returns the horizontal pixle count of the active layer - */ - int getWidthOfActive(); - /*! - * \brief The getHeightOfActive gets the vertical dimensions of the active layer - * \return Returns the vertical pixle count of the active layer - */ - int getHeightOfActive(); +/*! + * \brief The getWidthOfActive gets the horizontal dimensions of the active layer + * \return Returns the horizontal pixle count of the active layer + */ +int getWidthOfActive(); +/*! + * \brief The getHeightOfActive gets the vertical dimensions of the active layer + * \return Returns the vertical pixle count of the active layer + */ +int getHeightOfActive(); - IntelliImage::ImageType getTypeOfImageRealLayer(); +IntelliImage::ImageType getTypeOfImageRealLayer(); - std::vector getPolygonDataOfRealLayer(); +std::vector getPolygonDataOfRealLayer(); - int getNumberOfActiveLayer(); +int getNumberOfActiveLayer(); - IntelliImage* getImageOfActiveLayer(); +IntelliImage* getImageOfActiveLayer(); - IntelliToolsettings Toolsettings; - IntelliColorPicker colorPicker; +IntelliToolsettings Toolsettings; +IntelliColorPicker colorPicker; public slots: - // Events to handle - /*! - * \brief The slotActivateLayer method handles the event of selecting one layer as active - * \param a - idx of the layer to be active - */ - void slotActivateLayer(int a); - /*! - * \brief The slotDeleteActiveLayer method handles the deletion of the active layer - */ - void slotDeleteActiveLayer(); +// Events to handle +/*! + * \brief The slotActivateLayer method handles the event of selecting one layer as active + * \param a - idx of the layer to be active + */ +void slotActivateLayer(int a); +/*! + * \brief The slotDeleteActiveLayer method handles the deletion of the active layer + */ +void slotDeleteActiveLayer(); protected: - void mousePressEvent(QMouseEvent *event) override; - void mouseMoveEvent(QMouseEvent *event) override; - void mouseReleaseEvent(QMouseEvent *event) override; +void mousePressEvent(QMouseEvent*event) override; +void mouseMoveEvent(QMouseEvent*event) override; +void mouseReleaseEvent(QMouseEvent*event) override; - void wheelEvent(QWheelEvent *event) override; - // Updates the painting area where we are painting - void paintEvent(QPaintEvent *event) override; +void wheelEvent(QWheelEvent*event) override; +// Updates the painting area where we are painting +void paintEvent(QPaintEvent*event) override; - // Makes sure the area we are drawing on remains - // as large as the widget - void resizeEvent(QResizeEvent *event) override; +// Makes sure the area we are drawing on remains +// as large as the widget +void resizeEvent(QResizeEvent*event) override; private: - void setLayerDimensions(int maxWidth, int maxHeight); - void selectLayerUp(); - void selectLayerDown(); - IntelliTool* copyActiveTool(); +void setLayerDimensions(int maxWidth, int maxHeight); +void selectLayerUp(); +void selectLayerDown(); +IntelliTool* copyActiveTool(); - QImage* Canvas; - int maxWidth; - int maxHeight; +QImage* Canvas; +int maxWidth; +int maxHeight; - IntelliRenderSettings renderSettings; - IntelliTool* Tool; - IntelliPhotoGui* DumpyGui; +IntelliRenderSettings renderSettings; +IntelliTool* Tool; +IntelliPhotoGui* DumpyGui; - std::vector layerBundle; - int activeLayer=-1; +std::vector layerBundle; +int activeLayer=-1; - void drawLayers(bool forSaving=false); +void drawLayers(bool forSaving=false); - void resizeLayer(QImage *image_res, const QSize &newSize); +void resizeLayer(QImage*image_res, const QSize &newSize); - // Helper for Tool - // TODO: Always create this layer on top and return the id here! - void createTempTopLayer(int idx); +// Helper for Tool +// TODO: Always create this layer on top and return the id here! +void createTempTopLayer(int idx); }; #endif