From 8b1fd5c3f09865a131bb727c6e6845cc5a10bb03 Mon Sep 17 00:00:00 2001 From: AshBastian Date: Thu, 9 Jan 2020 00:52:17 +0100 Subject: [PATCH 1/2] Fixes --- src/Image/IntelliImage.h | 3 --- src/IntelliPhoto.pro | 7 ------- src/Layer/PaintingArea.h | 3 --- 3 files changed, 13 deletions(-) diff --git a/src/Image/IntelliImage.h b/src/Image/IntelliImage.h index c5928c0..b3626ab 100644 --- a/src/Image/IntelliImage.h +++ b/src/Image/IntelliImage.h @@ -8,11 +8,8 @@ #include #include -<<<<<<< src/Image/IntelliImage.h #include "IntelliHelper/IntelliRenderSettings.h" -======= #include "IntelliHelper/IntelliTriangulation.h" ->>>>>>> src/Image/IntelliImage.h class IntelliTool; diff --git a/src/IntelliPhoto.pro b/src/IntelliPhoto.pro index c3cafc6..13b6975 100644 --- a/src/IntelliPhoto.pro +++ b/src/IntelliPhoto.pro @@ -21,12 +21,9 @@ SOURCES += \ Image/IntelliRasterImage.cpp \ Image/IntelliShapedImage.cpp \ IntelliHelper/IntelliColorPicker.cpp \ -<<<<<<< src/IntelliPhoto.pro IntelliHelper/IntelliRenderSettings.cpp \ -======= IntelliHelper/IntelliToolsettings.cpp \ IntelliHelper/IntelliTriangulation.cpp \ ->>>>>>> src/IntelliPhoto.pro Layer/PaintingArea.cpp \ Tool/IntelliTool.cpp \ Tool/IntelliToolCircle.cpp \ @@ -44,13 +41,9 @@ HEADERS += \ Image/IntelliRasterImage.h \ Image/IntelliShapedImage.h \ IntelliHelper/IntelliColorPicker.h \ -<<<<<<< src/IntelliPhoto.pro - IntelliHelper/IntelliHelper.h \ IntelliHelper/IntelliRenderSettings.h \ -======= IntelliHelper/IntelliToolsettings.h \ IntelliHelper/IntelliTriangulation.h \ ->>>>>>> src/IntelliPhoto.pro Layer/PaintingArea.h \ Tool/IntelliTool.h \ Tool/IntelliToolCircle.h \ diff --git a/src/Layer/PaintingArea.h b/src/Layer/PaintingArea.h index 4f41b9d..b277158 100644 --- a/src/Layer/PaintingArea.h +++ b/src/Layer/PaintingArea.h @@ -204,10 +204,7 @@ private: int maxWidth; int maxHeight; -<<<<<<< src/Layer/PaintingArea.h IntelliRenderSettings renderSettings; -======= ->>>>>>> src/Layer/PaintingArea.h IntelliTool* Tool; std::vector layerBundle; From 46a69024d374ae0d9aacfee00f6f82ffdd5d30c7 Mon Sep 17 00:00:00 2001 From: AshBastian Date: Thu, 9 Jan 2020 00:58:03 +0100 Subject: [PATCH 2/2] Fix --- src/Bilder.qrc | 1 + src/GUI/IntelliPhotoGui.cpp | 84 ++++++++++++++++++++++--------- src/GUI/IntelliPhotoGui.h | 8 ++- src/Image/IntelliImage.cpp | 63 ++++------------------- src/Image/IntelliImage.h | 17 +------ src/Image/IntelliRasterImage.cpp | 13 ++--- src/Image/IntelliRasterImage.h | 3 +- src/Image/IntelliShapedImage.cpp | 25 ++------- src/Image/IntelliShapedImage.h | 3 +- src/IntelliPhoto.pro | 2 - src/Layer/PaintingArea.cpp | 59 ++++++++-------------- src/Layer/PaintingArea.h | 4 +- src/Tool/IntelliTool.cpp | 6 --- src/icons/Wechselpfeile.png | Bin 0 -> 7700 bytes src/mainwindow.ui | 31 +----------- 15 files changed, 111 insertions(+), 208 deletions(-) create mode 100644 src/icons/Wechselpfeile.png diff --git a/src/Bilder.qrc b/src/Bilder.qrc index df17641..3e190f4 100644 --- a/src/Bilder.qrc +++ b/src/Bilder.qrc @@ -8,5 +8,6 @@ icons/pen-tool.svg icons/polygon-tool.svg icons/rectangle-tool.svg + icons/Wechselpfeile.png diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index fa34f28..d11563d 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -97,8 +97,11 @@ void IntelliPhotoGui::slotDeleteLayer(){ tr("Number:"), 1,0, 500, 1, &ok); // Create New Layer - if (ok) + if (ok){ paintingArea->deleteLayer(layerNumber); + QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer()); + ActiveLayerLine->setText(string); + } } void IntelliPhotoGui::slotSetActiveAlpha(){ @@ -192,19 +195,29 @@ void IntelliPhotoGui::slotSetActiveLayer(){ if (ok1) { paintingArea->setLayerActive(layer); + QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer()); + ActiveLayerLine->setText(string); } } void IntelliPhotoGui::slotSetFirstColor(){ paintingArea->colorPickerSetFirstColor(); + QString string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name()); + FirstColorButton->setStyleSheet(string); } void IntelliPhotoGui::slotSetSecondColor(){ paintingArea->colorPickerSetSecondColor(); + QString string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name()); + SecondColorButton->setStyleSheet(string); } void IntelliPhotoGui::slotSwapColor(){ paintingArea->colorPickerSwapColors(); + QString string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name()); + FirstColorButton->setStyleSheet(string); + string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name()); + SecondColorButton->setStyleSheet(string); } void IntelliPhotoGui::slotCreatePenTool(){ @@ -351,13 +364,16 @@ void IntelliPhotoGui::createActions(){ //Create Color Actions here actionColorPickerFirstColor = new QAction(tr("&Main"), this); connect(actionColorPickerFirstColor, SIGNAL(triggered()), this, SLOT(slotSetFirstColor())); + connect(FirstColorButton, SIGNAL(clicked()), this, SLOT(slotSetFirstColor())); actionColorPickerSecondColor = new QAction(tr("&Secondary"), this); connect(actionColorPickerSecondColor, SIGNAL(triggered()), this, SLOT(slotSetSecondColor())); + connect(SecondColorButton, SIGNAL(clicked()), this, SLOT(slotSetSecondColor())); actionColorSwap = new QAction(tr("&Switch"), this); actionColorSwap->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S)); connect(actionColorSwap, SIGNAL(triggered()), this, SLOT(slotSwapColor())); + connect(SwitchColorButton, SIGNAL(clicked()), this, SLOT(slotSwapColor())); //Create Tool actions down here actionCreatePlainTool = new QAction(tr("&Plain"), this); @@ -547,10 +563,10 @@ void IntelliPhotoGui::createGui(){ WidthLine = new QLabel(); WidthLine->setText("Width"); - WidthLine->setFixedSize(QSize(55,20)); + WidthLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); EditLineWidth = new QLineEdit(); - EditLineWidth->setFixedSize(QSize(50,20)); + EditLineWidth->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); EditLineWidth->setText("5"); ValidatorLineWidth = new QIntValidator(); ValidatorLineWidth->setTop(99); @@ -559,46 +575,64 @@ void IntelliPhotoGui::createGui(){ innerAlphaLine = new QLabel(); innerAlphaLine->setText("Inner Alpha"); - innerAlphaLine->setFixedSize(QSize(55,20)); + innerAlphaLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); EditLineInnerAlpha = new QLineEdit(); - EditLineInnerAlpha->setFixedSize(QSize(50,20)); + EditLineInnerAlpha->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); EditLineInnerAlpha->setText("255"); ValidatorInnerAlpha = new QIntValidator(); ValidatorInnerAlpha->setTop(999); ValidatorInnerAlpha->setBottom(0); EditLineInnerAlpha->setValidator(ValidatorInnerAlpha); - Farbe1 = new QLabel(); - Farbe1->setText(""); - QPalette Palette; - Palette.setColor(QPalette::Background,QColor(0,0,0));//paintingArea->colorPicker.getFirstColor()); - Farbe1->setPalette(Palette); - Farbe1->setFixedSize(QSize(20,20)); + FirstColorButton = new QPushButton(); + FirstColorButton->setFixedSize(Buttonsize/2); + + SecondColorButton = new QPushButton(); + SecondColorButton->setFixedSize(Buttonsize/2); + + p = QPixmap(":/Icons/Buttons/icons/Wechselpfeile.png"); + SwitchColorButton = new QPushButton(); + SwitchColorButton->setFixedSize(Buttonsize.width(),Buttonsize.height()/2); + SwitchColorButton->setIcon(p); + SwitchColorButton->setIconSize(QSize(Buttonsize.width(),Buttonsize.height()/2)); + + ActiveLayerLine = new QLabel(); + QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer()); + ActiveLayerLine->setText(string); + ActiveLayerLine->setFixedSize(Buttonsize.width()+10,Buttonsize.height()/3); // set gui elements + mainLayout->addWidget(paintingArea,1,1,20,1); - mainLayout->addWidget(CircleButton,1,2,1,1); - mainLayout->addWidget(FloodFillButton,2,2,1,1); - mainLayout->addWidget(LineButton,3,2,1,1); - mainLayout->addWidget(PenButton,4,2,1,1); - mainLayout->addWidget(PlainButton,5,2,1,1); - mainLayout->addWidget(PolygonButton,6,2,1,1); - mainLayout->addWidget(RectangleButton,7,2,1,1); - mainLayout->addWidget(WidthLine,8,2,1,1); - mainLayout->addWidget(EditLineWidth,9,2,1,1); - mainLayout->addWidget(innerAlphaLine,10,2,1,1); - mainLayout->addWidget(EditLineInnerAlpha,11,2,1,1); - mainLayout->addWidget(Farbe1,12,2,1,1); + mainLayout->addWidget(CircleButton,1,2,1,2); + mainLayout->addWidget(FloodFillButton,2,2,1,2); + mainLayout->addWidget(LineButton,3,2,1,2); + mainLayout->addWidget(PenButton,4,2,1,2); + mainLayout->addWidget(PlainButton,5,2,1,2); + mainLayout->addWidget(PolygonButton,6,2,1,2); + mainLayout->addWidget(RectangleButton,7,2,1,2); + mainLayout->addWidget(WidthLine,8,2,1,2); + mainLayout->addWidget(EditLineWidth,9,2,1,2); + mainLayout->addWidget(innerAlphaLine,10,2,1,2); + mainLayout->addWidget(EditLineInnerAlpha,11,2,1,2); + mainLayout->addWidget(FirstColorButton,12,2,1,1); + mainLayout->addWidget(SecondColorButton,12,3,1,1); + mainLayout->addWidget(SwitchColorButton,13,2,1,2); + mainLayout->addWidget(ActiveLayerLine,14,2,1,2); } void IntelliPhotoGui::setIntelliStyle(){ // Set the title setWindowTitle("IntelliPhoto Prototype"); // Set style sheet - this->setStyleSheet("background-color:rgb(64,64,64)"); - this->centralGuiWidget->setStyleSheet("color:rgb(255,255,255)"); + this->setStyleSheet("background-color:rgb(64,64,64)"); + this->centralGuiWidget->setStyleSheet("color:rgb(255,255,255)"); this->menuBar()->setStyleSheet("color:rgb(255,255,255)"); + QString string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name()); + FirstColorButton->setStyleSheet(string); + string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name()); + SecondColorButton->setStyleSheet(string); } bool IntelliPhotoGui::maybeSave(){ diff --git a/src/GUI/IntelliPhotoGui.h b/src/GUI/IntelliPhotoGui.h index e993982..4985534 100644 --- a/src/GUI/IntelliPhotoGui.h +++ b/src/GUI/IntelliPhotoGui.h @@ -94,7 +94,7 @@ void setDefaultToolValue(); // What we'll draw on PaintingArea* paintingArea; -const QSize Buttonsize = QSize(50,50); +const QSize Buttonsize = QSize(70,70); QPixmap p; QPushButton* CircleButton; QPushButton* FloodFillButton; @@ -110,7 +110,11 @@ QLineEdit* EditLineInnerAlpha; QIntValidator* ValidatorLineWidth; QIntValidator* ValidatorInnerAlpha; -QLabel* Farbe1; +QPushButton* FirstColorButton; +QPushButton* SecondColorButton; +QPushButton* SwitchColorButton; + +QLabel* ActiveLayerLine; // The menu widgets QMenu*saveAsMenu; diff --git a/src/Image/IntelliImage.cpp b/src/Image/IntelliImage.cpp index 4c1b01d..0a4b919 100644 --- a/src/Image/IntelliImage.cpp +++ b/src/Image/IntelliImage.cpp @@ -2,16 +2,9 @@ #include #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; +IntelliImage::IntelliImage(int weight, int height) + : imageData(QSize(weight, height), QImage::Format_ARGB32){ + imageData.fill(QColor(255,255,255,255)); } @@ -30,7 +23,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(QImage::Format_ARGB32); return true; } @@ -40,23 +33,17 @@ 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); - } } 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 + // Used to draw on the widget QPainter painter(&imageData); // Set the current settings for the pen @@ -64,32 +51,20 @@ 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); - } } 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 + // 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); - } } 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 + // Used to draw on the widget QPainter painter(&imageData); // Set the current settings for the pen @@ -97,30 +72,12 @@ 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); - } } 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); - } + imageData.fill(color); } QColor IntelliImage::getPixelColor(QPoint& point){ - if(fastRenderer){ - QImage copy = this->imageData.convertToFormat(QImage::Format_ARGB32); - return copy.pixelColor(point); - } - return imageData.pixelColor(point); -} - -void IntelliImage::updateRendererSetting(bool fastRendererOn){ - this->fastRenderer = fastRendererOn; - this->imageData = this->imageData.convertToFormat(fastRenderer ? QImage::Format_Indexed8 : QImage::Format_ARGB32); + return imageData.pixelColor(point); } diff --git a/src/Image/IntelliImage.h b/src/Image/IntelliImage.h index b3626ab..43cc69a 100644 --- a/src/Image/IntelliImage.h +++ b/src/Image/IntelliImage.h @@ -8,7 +8,6 @@ #include #include -#include "IntelliHelper/IntelliRenderSettings.h" #include "IntelliHelper/IntelliTriangulation.h" class IntelliTool; @@ -40,20 +39,13 @@ QImage imageData; * \brief The Type, an Image is. */ ImageType TypeOfImage; - -/*! - * \brief fastRenderer is the flag that represents the usage of 8bit pictures. - */ -bool fastRenderer; - public: /*! * \brief The Construcor of the IntelliImage. Given the Image dimensions. * \param width - The width of the Image. * \param height - The height of the Image. - * \param fastRendererOn - Represents the flag for 8bit picture handelling. */ -IntelliImage(int width, int height, bool fastRendererOn); +IntelliImage(int width, int height); /*! * \brief An Abstract Destructor. @@ -148,13 +140,6 @@ virtual bool loadImage(const QString &filePath); * \return The color of the Pixel as QColor. */ virtual QColor getPixelColor(QPoint& point); - -/*! - * \brief updateRendererSetting updates the existing image format to the new format. - * \param fastRendererOn flag for the 8bit image handeling. - */ -virtual void updateRendererSetting(bool fastRendererOn); - }; #endif diff --git a/src/Image/IntelliRasterImage.cpp b/src/Image/IntelliRasterImage.cpp index 7e97e55..8e8f918 100644 --- a/src/Image/IntelliRasterImage.cpp +++ b/src/Image/IntelliRasterImage.cpp @@ -3,10 +3,9 @@ #include #include -IntelliRasterImage::IntelliRasterImage(int width, int height, bool fastRendererOn) - : IntelliImage(width, height, fastRendererOn){ +IntelliRasterImage::IntelliRasterImage(int weight, int height) + : IntelliImage(weight, height){ TypeOfImage = IntelliImage::ImageType::Raster_Image; - this->fastRenderer = fastRendererOn; } IntelliRasterImage::~IntelliRasterImage(){ @@ -14,7 +13,7 @@ IntelliRasterImage::~IntelliRasterImage(){ } IntelliImage* IntelliRasterImage::getDeepCopy(){ - IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), false); + IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height()); raster->imageData.fill(Qt::transparent); raster->TypeOfImage = IntelliImage::ImageType::Raster_Image; return raster; @@ -30,9 +29,6 @@ QImage IntelliRasterImage::getDisplayable(int alpha){ QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){ QImage copy = imageData; - if(fastRenderer){ - copy = copy.convertToFormat(QImage::Format_ARGB32); - } for(int y = 0; y #include -IntelliShapedImage::IntelliShapedImage(int width, int height, bool fastRendererOn) - : IntelliRasterImage(width, height, fastRendererOn){ +IntelliShapedImage::IntelliShapedImage(int weight, int height) + : IntelliRasterImage(weight, height){ TypeOfImage = IntelliImage::ImageType::Shaped_Image; - this->fastRenderer = fastRendererOn; } IntelliShapedImage::~IntelliShapedImage(){ @@ -19,7 +18,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()); shaped->setPolygon(this->polygonData); shaped->imageData.fill(Qt::transparent); shaped->TypeOfImage = IntelliImage::ImageType::Shaped_Image; @@ -27,11 +26,7 @@ IntelliImage* IntelliShapedImage::getDeepCopy(){ } void IntelliShapedImage::calculateVisiblity(){ - 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); - } return; } QColor clr; @@ -59,16 +51,10 @@ void IntelliShapedImage::calculateVisiblity(){ imageData.setPixelColor(x,y,clr); } } - 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); - } for(int y = 0; yTool = nullptr; - this->renderSettings = IntelliRenderSettings(); this->setLayerDimensions(maxWidth, maxHeight); this->addLayer(200,200,0,0,IntelliImage::ImageType::Shaped_Image); layerBundle[0].image->drawPlain(QColor(0,0,255,255)); @@ -37,7 +36,6 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent) layerBundle[1].alpha=200; activeLayer=0; - } PaintingArea::~PaintingArea(){ @@ -48,8 +46,7 @@ void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){ //set standart parameter this->maxWidth = maxWidth; this->maxHeight = maxHeight; - if(renderSettings.getFastRenderer()) Canvas = new QImage(maxWidth,maxHeight, QImage::Format_Indexed8); - else Canvas = new QImage(maxWidth,maxHeight, QImage::Format_ARGB32); + Canvas = new QImage(maxWidth,maxHeight, QImage::Format_ARGB32); // Roots the widget to the top left even if resized setAttribute(Qt::WA_StaticContents); @@ -63,14 +60,11 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff newLayer.widthOffset = widthOffset; newLayer.heightOffset = heightOffset; if(type==IntelliImage::ImageType::Raster_Image) { - newLayer.image = new IntelliRasterImage(width,height,renderSettings.getFastRenderer()); + newLayer.image = new IntelliRasterImage(width,height); }else if(type==IntelliImage::ImageType::Shaped_Image) { - newLayer.image = new IntelliShapedImage(width, height, renderSettings.getFastRenderer()); + newLayer.image = new IntelliShapedImage(width, height); } - - newLayer.alpha = 255; - - + newLayer.alpha = 255; this->layerBundle.push_back(newLayer); return static_cast(layerBundle.size())-1; } @@ -124,7 +118,7 @@ bool PaintingArea::save(const QString &filePath, const char*fileFormat){ this->drawLayers(true); if(!strcmp(fileFormat,"PNG")) { - QImage visibleImage = Canvas->convertToFormat(QImage::Format_Indexed8); + QImage visibleImage = Canvas->convertToFormat(QImage::Format_Indexed8); fileFormat = "png"; if (visibleImage.save(filePath, fileFormat)) { return true; @@ -151,25 +145,21 @@ void PaintingArea::floodFill(int r, int g, int b, int a){ } void PaintingArea::movePositionActive(int x, int y){ - if(Tool!=nullptr){ - if(Tool->getIsDrawing()){ - IntelliTool* temp = copyActiveTool(); - delete this->Tool; - this->Tool = temp; - } + if(Tool->getIsDrawing()){ + IntelliTool* temp = copyActiveTool(); + delete this->Tool; + this->Tool = temp; } layerBundle[static_cast(activeLayer)].widthOffset += x; layerBundle[static_cast(activeLayer)].heightOffset += y; } void PaintingArea::moveActiveLayer(int idx){ - if(Tool!=nullptr){ - if(Tool->getIsDrawing()){ - IntelliTool* temp = copyActiveTool(); - delete this->Tool; - this->Tool = temp; - } - } + if(Tool->getIsDrawing()){ + IntelliTool* temp = copyActiveTool(); + delete this->Tool; + this->Tool = temp; + } if(idx==1) { this->selectLayerUp(); }else if(idx==-1) { @@ -178,13 +168,11 @@ void PaintingArea::moveActiveLayer(int idx){ } void PaintingArea::slotActivateLayer(int a){ - if(Tool!=nullptr){ if(Tool->getIsDrawing()){ IntelliTool* temp = copyActiveTool(); delete this->Tool; this->Tool = temp; } - } if(a>=0 && a < static_cast(layerBundle.size())) { this->setLayerActive(a); } @@ -314,7 +302,7 @@ void PaintingArea::paintEvent(QPaintEvent*event){ QPainter painter(this); QRect dirtyRec = event->rect(); - painter.drawImage(dirtyRec, *Canvas, dirtyRec); + painter.drawImage(dirtyRec, *Canvas, dirtyRec); update(); } @@ -345,17 +333,13 @@ void PaintingArea::selectLayerDown(){ void PaintingArea::drawLayers(bool forSaving){ if(forSaving) { - Canvas->fill(Qt::GlobalColor::transparent); + Canvas->fill(Qt::GlobalColor::transparent); }else{ - Canvas->fill(Qt::GlobalColor::black); + Canvas->fill(Qt::GlobalColor::black); } for(size_t i=0; igetDisplayable(layer.alpha); - if(renderSettings.getFastRenderer()){ - cpy = cpy.convertToFormat(QImage::Format_ARGB32); - *Canvas = Canvas->convertToFormat(QImage::Format_ARGB32); - } QColor clr_0; QColor clr_1; for(int y=0; y=maxWidth) break; - clr_0=Canvas->pixelColor(layer.widthOffset+x, layer.heightOffset+y); + clr_0=Canvas->pixelColor(layer.widthOffset+x, layer.heightOffset+y); clr_1=cpy.pixelColor(x,y); float t = static_cast(clr_1.alpha())/255.f; int r =static_cast(static_cast(clr_1.red())*(t)+static_cast(clr_0.red())*(1.f-t)+0.5f); @@ -380,9 +364,6 @@ void PaintingArea::drawLayers(bool forSaving){ } } } - if(renderSettings.getFastRenderer()){ - *Canvas = Canvas->convertToFormat(QImage::Format_Indexed8); - } } void PaintingArea::createTempTopLayer(int idx){ @@ -410,3 +391,7 @@ IntelliTool* PaintingArea::copyActiveTool(){ default: return nullptr; } } + +int PaintingArea::getNumberOfActiveLayer(){ + return activeLayer; +} diff --git a/src/Layer/PaintingArea.h b/src/Layer/PaintingArea.h index b277158..5b98820 100644 --- a/src/Layer/PaintingArea.h +++ b/src/Layer/PaintingArea.h @@ -12,7 +12,6 @@ #include "Image/IntelliShapedImage.h" #include "Tool/IntelliTool.h" #include "IntelliHelper/IntelliColorPicker.h" -#include "IntelliHelper/IntelliRenderSettings.h" /*! * \brief The LayerObject struct holds all the information needed to construct a layer @@ -166,6 +165,8 @@ public: std::vector getPolygonDataOfRealLayer(); + int getNumberOfActiveLayer(); + IntelliToolsettings Toolsettings; IntelliColorPicker colorPicker; @@ -204,7 +205,6 @@ private: int maxWidth; int maxHeight; - IntelliRenderSettings renderSettings; IntelliTool* Tool; std::vector layerBundle; diff --git a/src/Tool/IntelliTool.cpp b/src/Tool/IntelliTool.cpp index 695dc37..8a1cbbb 100644 --- a/src/Tool/IntelliTool.cpp +++ b/src/Tool/IntelliTool.cpp @@ -57,9 +57,6 @@ void IntelliTool::createToolLayer(){ void IntelliTool::mergeToolLayer(){ QColor clr_0; QColor clr_1; - if(Area->renderSettings.getFastRenderer()){ - activeLayer->image->imageData = activeLayer->image->imageData.convertToFormat(QImage::Format_ARGB32); - } for(int y=0; yheight; y++) { for(int x=0; xwidth; x++) { clr_0=activeLayer->image->imageData.pixelColor(x,y); @@ -77,9 +74,6 @@ void IntelliTool::mergeToolLayer(){ activeLayer->image->imageData.setPixelColor(x, y, clr_0); } } - if(Area->renderSettings.getFastRenderer()){ - activeLayer->image->imageData = activeLayer->image->imageData.convertToFormat(QImage::Format_Indexed8); - } } void IntelliTool::deleteToolLayer(){ diff --git a/src/icons/Wechselpfeile.png b/src/icons/Wechselpfeile.png new file mode 100644 index 0000000000000000000000000000000000000000..505fcdd9fec67d71205724e38d35627b4ea16f32 GIT binary patch literal 7700 zcmeHMXIN8Nw+<*u7ZnvjGz38y4JjlfM3CMFLJ1ulHRU9PmXJa~L8J)?B2C3Y8Kv0} zP@32PrFRfSMNv^e1RVj9LFAsGpECE(o$t=`-0$CnCnS6CcfD(!_pG(g+E3!_Z7pOZ z6(u1Mh>Vq`DGB_ffp4_<3h@6$?7`dMhX|KsVGJp3+cXLemNSfqMi5BxF{#gFF>oxw zwshx0AX=)zw@6T~K_CPo6|&#SjYlF2pll9{&h!PKykIr}1%jA#2qfsyt#qFhRh(?p z!le9x@HvB(Cs;+G zWPbSX2Sbr}4kGs~yZ`a@Ab(yzIf@~=p!o3UeDM(Db)V$$HTd5Bm$J%>_RM7U4dbM5 zo>fliapOo}18h3`JP7YRr!K6)l}2Z-s|rQ5_ZdF>B6#Pi>T|?1A}F!ZMWfy4z2wZp z%KAHn@`(;_u8}&9v`yNLysP-~+sk7v6Hl$fjJ}9<3D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XJPZiD8VK#u2`(i`iUuC=9a=7E~(0J8#OWoBzyXuL1tzW_i^SwjE- literal 0 HcmV?d00001 diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 0bbafd4..433b697 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -16,36 +16,7 @@ true - - - - - 120 - 100 - 256 - 192 - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 0 - - - - - +