diff --git a/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp index b3338be..29af67e 100644 --- a/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp +++ b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp @@ -143,7 +143,7 @@ void IntelliPhotoGui::createActions() // Create exit action and tie to IntelliPhotoGui::close() - exitAct = new QAction(tr("&Exit"), this); + exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); diff --git a/IntelliPhoto/Painting/GUI/IntelliPhotoGui.h b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.h index 992ccd0..7e77cef 100644 --- a/IntelliPhoto/Painting/GUI/IntelliPhotoGui.h +++ b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.h @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include // PaintingArea used to paint the image class PaintingArea; diff --git a/IntelliPhoto/Painting/Image/IntelliImage.cpp b/IntelliPhoto/Painting/Image/IntelliImage.cpp index 879e8c7..42be65d 100644 --- a/IntelliPhoto/Painting/Image/IntelliImage.cpp +++ b/IntelliPhoto/Painting/Image/IntelliImage.cpp @@ -19,10 +19,8 @@ bool IntelliImage::loadImage(const QString &fileName){ if (!loadedImage.load(fileName)) return false; - // scaled Image to size of Layer - // loadedImage = loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio); - - imageData = loadedImage.convertToFormat(QImage::Format_ARGB32); + loadedImage =loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio); + imageData= loadedImage.convertToFormat(QImage::Format_ARGB32); return true; } diff --git a/IntelliPhoto/Painting/Image/IntelliImage.h b/IntelliPhoto/Painting/Image/IntelliImage.h index a2fb3c0..030e3be 100644 --- a/IntelliPhoto/Painting/Image/IntelliImage.h +++ b/IntelliPhoto/Painting/Image/IntelliImage.h @@ -29,8 +29,8 @@ public: virtual void floodFill(const QColor& color); //returns the filtered output - virtual QImage getDisplayable(const QSize& displaySize, int alpha)=0; - virtual QImage getDisplayable(int alpha=255)=0; + virtual QImage getDisplayable(const QSize& displaySize)=0; + virtual QImage getDisplayable()=0; //returns the filtered output diff --git a/IntelliPhoto/Painting/Image/IntelliRasterImage.cpp b/IntelliPhoto/Painting/Image/IntelliRasterImage.cpp index b73c264..50eaa33 100644 --- a/IntelliPhoto/Painting/Image/IntelliRasterImage.cpp +++ b/IntelliPhoto/Painting/Image/IntelliRasterImage.cpp @@ -12,19 +12,12 @@ IntelliRasterImage::~IntelliRasterImage(){ } -QImage IntelliRasterImage::getDisplayable(int alpha){ - return getDisplayable(imageData.size(), alpha); +QImage IntelliRasterImage::getDisplayable(){ + return getDisplayable(imageData.size()); } -QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){ +QImage IntelliRasterImage::getDisplayable(const QSize& displaySize){ QImage copy = imageData; - for(int y = 0; y& polygonData) override; diff --git a/IntelliPhoto/Painting/IntelliPhoto.pro.user b/IntelliPhoto/Painting/IntelliPhoto.pro.user index c88bd21..8c0d660 100644 --- a/IntelliPhoto/Painting/IntelliPhoto.pro.user +++ b/IntelliPhoto/Painting/IntelliPhoto.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {87de10b7-9dd6-4379-8674-fd04613e186e} + {426164d9-3771-4235-8f83-cb0b49423ffc} ProjectExplorer.Project.ActiveTarget @@ -59,6 +59,11 @@ -fno-delayed-template-parsing true + true + + + + true @@ -67,11 +72,11 @@ Desktop Qt 5.12.5 MinGW 64-bit Desktop Qt 5.12.5 MinGW 64-bit qt.qt5.5125.win64_mingw73_kit - 0 + 1 0 0 - C:/Users/Jonas/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug true @@ -127,7 +132,7 @@ true - C:/Users/Jonas/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release true @@ -183,7 +188,7 @@ true - C:/Users/Jonas/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Profile + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Profile true @@ -306,8 +311,8 @@ 2 IntelliPhoto - IntelliPhoto2 - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Jonas/Desktop/IntelliPhoto/Painting/IntelliPhoto.pro + + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/Painting/IntelliPhoto.pro 3768 false @@ -317,7 +322,7 @@ false true - C:/Users/Jonas/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release 1 diff --git a/IntelliPhoto/Painting/IntelliPhoto.pro.user.2eff11b b/IntelliPhoto/Painting/IntelliPhoto.pro.user.2eff11b deleted file mode 100644 index 06819e8..0000000 --- a/IntelliPhoto/Painting/IntelliPhoto.pro.user.2eff11b +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - EnvironmentId - {2eff11b9-2504-4003-b4ce-30c119b76df9} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.12.5 MSVC2017 64bit - Desktop Qt 5.12.5 MSVC2017 64bit - qt.qt5.5125.win64_msvc2017_64_kit - 0 - 0 - 0 - - C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - Deployment - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deployment-Konfiguration - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - IntelliPhoto - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/Painting/IntelliPhoto.pro - - 3768 - false - true - true - false - false - true - - C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/IntelliPhoto/Painting/IntelliPhoto.pro.user.426164d b/IntelliPhoto/Painting/IntelliPhoto.pro.user.426164d deleted file mode 100644 index 7a6a7ab..0000000 --- a/IntelliPhoto/Painting/IntelliPhoto.pro.user.426164d +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - EnvironmentId - {426164d9-3771-4235-8f83-cb0b49423ffc} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - -fno-delayed-template-parsing - - true - true - - - - true - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.12.5 MinGW 64-bit - Desktop Qt 5.12.5 MinGW 64-bit - qt.qt5.5125.win64_mingw73_kit - 1 - 0 - 0 - - C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Erstellen - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Bereinigen - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - Deployment - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deployment-Konfiguration - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - IntelliPhoto - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/Painting/IntelliPhoto.pro - - 3768 - false - true - true - false - false - true - - C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/IntelliPhoto/Painting/Layer/PaintingArea.cpp b/IntelliPhoto/Painting/Layer/PaintingArea.cpp index 6f6e3cb..7c7f085 100644 --- a/IntelliPhoto/Painting/Layer/PaintingArea.cpp +++ b/IntelliPhoto/Painting/Layer/PaintingArea.cpp @@ -1,34 +1,30 @@ // ---------- PaintingArea.cpp ---------- #include -#include +#include #include "PaintingArea.h" #include "Image/IntelliRasterImage.h" #include "Image/IntelliShapedImage.h" -#include -#include +#include +#include -PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent) - :QWidget(parent){ - this->setUp(maxWidth, maxHeight); +PaintingArea::PaintingArea(QWidget *parent) + : QWidget(parent) +{ + //create standart image + this->image = new IntelliRasterImage(400,400); + std::vector poly; + poly.push_back(QPoint(200,0)); + poly.push_back(QPoint(400,300)); + poly.push_back(QPoint(0,300)); + poly.push_back(QPoint(200,0)); + image->setPolygon(poly); - //tetsing - this->addLayer(200,200,0,0); - this->addLayer(200,200,201,201); + this->setUp(); } - - - -void PaintingArea::setUp(int maxWidth, int maxHeight){ - - //set standart parameter - this->maxWidth = maxWidth; - this->maxHeight = maxHeight; - Canvas = new QImage(maxWidth,maxHeight, QImage::Format_ARGB32); - Canvas->fill(Qt::GlobalColor::white); - +void PaintingArea::setUp(){ // Roots the widget to the top left even if resized setAttribute(Qt::WA_StaticContents); @@ -36,52 +32,27 @@ void PaintingArea::setUp(int maxWidth, int maxHeight){ scribbling = false; myPenWidth = 1; myPenColor = Qt::blue; + } -void PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset, ImageType type){ - LayerObject newLayer; - newLayer.width = width; - newLayer.height = height; - newLayer.widthOffset = widthOffset; - newLayer.heightOffset = heightOffset; +PaintingArea::PaintingArea(int width, int height, ImageType type, QWidget *parent) + : QWidget(parent){ if(type==ImageType::Raster_Image){ - newLayer.image = new IntelliRasterImage(width,height); + this->image = new IntelliRasterImage(width, height); }else if(type==ImageType::Shaped_Image){ - newLayer.image = new IntelliShapedImage(width, height); + this->image = new IntelliShapedImage(width, height); + }else{ + qDebug() << "No valid Image type error"; + return; } - newLayer.alpha = 255; - this->layerStructure.push_back(newLayer); + this->setUp(); } -void PaintingArea::deleteLayer(int index){ - if(indexlayerStructure.erase(layerStructure.begin()+index); - if(activeLayer>=index){ - activeLayer--; - } - } -} - -void PaintingArea::setLayerToActive(int index) { - if(indexactiveLayer=index; - } -} - -void PaintingArea::setAlphaToLayer(int index, int alpha){ - if(indexactiveLayer==-1){ - return false; - } - IntelliImage* active = layerStructure[activeLayer].image; - bool open = active->loadImage(fileName); + bool open = image->loadImage(fileName); update(); return open; } @@ -89,22 +60,14 @@ bool PaintingArea::openImage(const QString &fileName) // Save the current image bool PaintingArea::saveImage(const QString &fileName, const char *fileFormat) { - if(this->activeLayer==-1){ + // Created to hold the image + QImage visibleImage = image->getDisplayable(); + + if (visibleImage.save(fileName, fileFormat)) { + return true; + } else { return false; } - // Created to hold the image - - for(size_t i=0; igetDisplayable(layer.alpha); - //TODO draw cpy to CANVAS - } - - //if (Canvas.save(fileName, fileFormat)) { - // return true; - //} else { - // return false; - //} } // Used to change the pen color @@ -122,13 +85,8 @@ void PaintingArea::setPenWidth(int newWidth) // Color the image area with white void PaintingArea::clearImage() { - if(this->activeLayer==-1){ - return; - } - IntelliImage* active = layerStructure[activeLayer].image; - active->floodFill(qRgb(255, 255, 255)); - - update(); + image->floodFill(qRgb(255, 255, 255)); + update(); } // If a mouse button is pressed check if it was the @@ -137,14 +95,8 @@ void PaintingArea::clearImage() void PaintingArea::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { - if(this->activeLayer==-1){ - return; - } - IntelliImage* active = layerStructure[activeLayer].image; - - int x = static_cast(event->x()*static_cast(active->x())/static_cast(size().width())); - int y = static_cast(event->y()*static_cast(active->y())/static_cast(size().height())); - //TODO CALCULATE LAST POINT + int x = event->x()*(float)image->x()/(float)size().width(); + int y = event->y()*(float)image->y()/(float)size().height(); lastPoint=QPoint(x,y); scribbling = true; } @@ -156,17 +108,9 @@ void PaintingArea::mousePressEvent(QMouseEvent *event) // from the last position to the current void PaintingArea::mouseMoveEvent(QMouseEvent *event) { - if ((event->buttons() & Qt::LeftButton) && scribbling){ - if(this->activeLayer==-1){ - return; - } - IntelliImage* active = layerStructure[activeLayer].image; - - int x = static_cast(event->x()*static_cast(active->x())/static_cast(size().width())); - int y = static_cast(event->y()*static_cast(active->y())/static_cast(size().height())); - - //TODO CALCULATE NEW POINT + int x = event->x()*(float)image->x()/(float)size().width(); + int y = event->y()*(float)image->y()/(float)size().height(); drawLineTo(QPoint(x,y)); update(); } @@ -176,15 +120,8 @@ void PaintingArea::mouseMoveEvent(QMouseEvent *event) void PaintingArea::mouseReleaseEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton && scribbling) { - if(this->activeLayer==-1){ - return; - } - IntelliImage* active = layerStructure[activeLayer].image; - - int x = static_cast(event->x()*static_cast(active->x())/static_cast(size().width())); - int y = static_cast(event->y()*static_cast(active->y())/static_cast(size().height())); - - //TODO CALCULATE NEW POINT + int x = event->x()*(float)image->x()/(float)size().width(); + int y = event->y()*(float)image->y()/(float)size().height(); drawLineTo(QPoint(x,y)); update(); scribbling = false; @@ -196,14 +133,9 @@ void PaintingArea::mouseReleaseEvent(QMouseEvent *event) // update themselves void PaintingArea::paintEvent(QPaintEvent *event) { - if(this->activeLayer==-1){ - return; - } - LayerObject active = layerStructure[activeLayer]; - QPainter painter(this); QRect dirtyRec = event->rect(); - painter.drawImage(dirtyRec, active.image->getDisplayable(dirtyRec.size(), active.alpha), dirtyRec); + painter.drawImage(dirtyRec, image->getDisplayable(dirtyRec.size()), dirtyRec); update(); } @@ -211,26 +143,17 @@ void PaintingArea::paintEvent(QPaintEvent *event) // to cut down on the need to resize the image void PaintingArea::resizeEvent(QResizeEvent *event) { - if(this->activeLayer==-1){ - return; - } - LayerObject active = layerStructure[activeLayer]; - QPainter painter(this); QRect dirtyRec(QPoint(0,0), event->size()); - painter.drawImage(dirtyRec, active.image->getDisplayable(event->size(), active.alpha), dirtyRec); + painter.drawImage(dirtyRec, image->getDisplayable(event->size()), dirtyRec); update(); + //QWidget::resizeEvent(event); } void PaintingArea::drawLineTo(const QPoint &endPoint) { - //// Used to draw on the widget - if(this->activeLayer==-1){ - return; - } - LayerObject active = layerStructure[activeLayer]; - - active.image->drawLine(lastPoint, endPoint,myPenColor, myPenWidth); + // Used to draw on the widget + image->drawLine(lastPoint, endPoint,myPenColor, myPenWidth); lastPoint = endPoint; update(); } diff --git a/IntelliPhoto/Painting/Layer/PaintingArea.h b/IntelliPhoto/Painting/Layer/PaintingArea.h index 91f821a..c3e1ea9 100644 --- a/IntelliPhoto/Painting/Layer/PaintingArea.h +++ b/IntelliPhoto/Painting/Layer/PaintingArea.h @@ -7,7 +7,6 @@ #include"Image/IntelliImage.h" #include #include -#include class PaintingArea : public QWidget { @@ -17,24 +16,19 @@ class PaintingArea : public QWidget Q_OBJECT public: - PaintingArea(int maxWidth=1000, int maxHeight=800, QWidget *parent = nullptr); + //create raster image 400*200 + PaintingArea(QWidget *parent = nullptr); + PaintingArea(int width, int height, ImageType type, QWidget *parent = nullptr); // Handles all events bool openImage(const QString &fileName); bool saveImage(const QString &fileName, const char *fileFormat); - - void addLayer(int width, int height, int widthOffset=0, int heightOffset=0, ImageType type = ImageType::Raster_Image); - void deleteLayer(int index); - void setLayerToActive(int index); - void setAlphaToLayer(int index, int alpha); + void setPenColor(const QColor &newColor); + void setPenWidth(int newWidth); // Has the image been modified since last save bool isModified() const { return modified; } - - void setPenColor(const QColor &newColor); QColor penColor() const { return myPenColor; } - - void setPenWidth(int newWidth); int penWidth() const { return myPenWidth; } public slots: @@ -43,7 +37,7 @@ public slots: void clearImage(); //void setUp helper for konstruktor - void setUp(int maxWidth, int maxHeight); + void setUp(); protected: void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; @@ -57,22 +51,6 @@ protected: void resizeEvent(QResizeEvent *event) override; private: - struct LayerObject{ - IntelliImage* image; - int width; - int height; - int widthOffset; - int heightOffset; - int alpha=255; - }; - - QImage* Canvas; - int maxWidth; - int maxHeight; - - std::vector layerStructure; - int activeLayer=-1; - void drawLineTo(const QPoint &endPoint); void resizeImage(QImage *image_res, const QSize &newSize); @@ -89,6 +67,7 @@ private: QColor myPenColor; // Stores the image being drawn + IntelliImage* image; // Stores the location at the current mouse event QPoint lastPoint;