mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-15 12:50:33 +02:00
Änderung der Vererbung der Tools und einfügen des ColorPickers (Farbmanager)
This commit is contained in:
@@ -119,8 +119,19 @@ void IntelliPhotoGui::slotGetColorbar(){
|
|||||||
tr("Number:"),
|
tr("Number:"),
|
||||||
1,1, 2, 1, &ok1);
|
1,1, 2, 1, &ok1);
|
||||||
|
|
||||||
Tool = paintingArea->getTool();
|
paintingArea->getColorbar(firstOrSecondColor);
|
||||||
Tool->getColorbar(firstOrSecondColor);
|
}
|
||||||
|
|
||||||
|
void IntelliPhotoGui::slotSwitchColors(){
|
||||||
|
paintingArea->switchColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliPhotoGui::slotCreatePenTool(){
|
||||||
|
paintingArea->createPenTool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliPhotoGui::slotCreateFloodFillTool(){
|
||||||
|
paintingArea->createFloodFillTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSetActiveAlpha(){
|
void IntelliPhotoGui::slotSetActiveAlpha(){
|
||||||
@@ -280,9 +291,6 @@ void IntelliPhotoGui::createActions()
|
|||||||
actionDeleteLayer = new QAction(tr("&Delete Layer..."), this);
|
actionDeleteLayer = new QAction(tr("&Delete Layer..."), this);
|
||||||
connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer()));
|
connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer()));
|
||||||
|
|
||||||
actionGetColorbar = new QAction(tr("&Set Color"),this);
|
|
||||||
connect(actionGetColorbar, SIGNAL(triggered()), this, SLOT(slotGetColorbar()));
|
|
||||||
|
|
||||||
actionFloodFill = new QAction(tr("&clear Image"), this);
|
actionFloodFill = new QAction(tr("&clear Image"), this);
|
||||||
connect(actionFloodFill, SIGNAL(triggered()), this, SLOT(slotClearActiveLayer()));
|
connect(actionFloodFill, SIGNAL(triggered()), this, SLOT(slotClearActiveLayer()));
|
||||||
|
|
||||||
@@ -316,6 +324,20 @@ void IntelliPhotoGui::createActions()
|
|||||||
actionMoveLayerDown->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down));
|
actionMoveLayerDown->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down));
|
||||||
connect(actionMoveLayerDown, SIGNAL(triggered()), this, SLOT(slotMoveLayerDown()));
|
connect(actionMoveLayerDown, SIGNAL(triggered()), this, SLOT(slotMoveLayerDown()));
|
||||||
|
|
||||||
|
//Create Tool actions down here
|
||||||
|
actionGetColorbar = new QAction(tr("&Set Color"),this);
|
||||||
|
connect(actionGetColorbar, SIGNAL(triggered()), this, SLOT(slotGetColorbar()));
|
||||||
|
|
||||||
|
actionSwitchColors = new QAction(tr("&Switch Color"),this);
|
||||||
|
actionSwitchColors->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_C));
|
||||||
|
connect(actionSwitchColors, SIGNAL(triggered()),this, SLOT(slotSwitchColors()));
|
||||||
|
|
||||||
|
actionCreateFloodFillTool = new QAction(tr("&Flood Fill"), this);
|
||||||
|
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool()));
|
||||||
|
|
||||||
|
actionCreatePenTool = new QAction(tr("&Pen"),this);
|
||||||
|
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool()));
|
||||||
|
|
||||||
// Create about action and tie to IntelliPhotoGui::about()
|
// Create about action and tie to IntelliPhotoGui::about()
|
||||||
actionAboutDialog = new QAction(tr("&About"), this);
|
actionAboutDialog = new QAction(tr("&About"), this);
|
||||||
connect(actionAboutDialog, SIGNAL(triggered()), this, SLOT(slotAboutDialog()));
|
connect(actionAboutDialog, SIGNAL(triggered()), this, SLOT(slotAboutDialog()));
|
||||||
@@ -361,6 +383,9 @@ void IntelliPhotoGui::createMenus()
|
|||||||
//Attach all Tool Options
|
//Attach all Tool Options
|
||||||
toolMenu = new QMenu(tr("&Tools"), this);
|
toolMenu = new QMenu(tr("&Tools"), this);
|
||||||
toolMenu->addAction(actionGetColorbar);
|
toolMenu->addAction(actionGetColorbar);
|
||||||
|
toolMenu->addAction(actionSwitchColors);
|
||||||
|
toolMenu->addAction(actionCreatePenTool);
|
||||||
|
toolMenu->addAction(actionCreateFloodFillTool);
|
||||||
|
|
||||||
// Attach all actions to Help
|
// Attach all actions to Help
|
||||||
helpMenu = new QMenu(tr("&Help"), this);
|
helpMenu = new QMenu(tr("&Help"), this);
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ class PaintingArea;
|
|||||||
|
|
||||||
class IntelliTool;
|
class IntelliTool;
|
||||||
|
|
||||||
|
class IntelliColorPicker;
|
||||||
|
|
||||||
class IntelliPhotoGui : public QMainWindow
|
class IntelliPhotoGui : public QMainWindow
|
||||||
{
|
{
|
||||||
// Declares our class as a QObject which is the base class
|
// Declares our class as a QObject which is the base class
|
||||||
@@ -35,6 +37,9 @@ private slots:
|
|||||||
void slotDeleteLayer();
|
void slotDeleteLayer();
|
||||||
|
|
||||||
void slotGetColorbar();
|
void slotGetColorbar();
|
||||||
|
void slotSwitchColors();
|
||||||
|
void slotCreatePenTool();
|
||||||
|
void slotCreateFloodFillTool();
|
||||||
|
|
||||||
void slotAboutDialog();
|
void slotAboutDialog();
|
||||||
|
|
||||||
@@ -65,7 +70,6 @@ private:
|
|||||||
|
|
||||||
// What we'll draw on
|
// What we'll draw on
|
||||||
PaintingArea* paintingArea;
|
PaintingArea* paintingArea;
|
||||||
IntelliTool* Tool;
|
|
||||||
|
|
||||||
// The menu widgets
|
// The menu widgets
|
||||||
QMenu *saveAsMenu;
|
QMenu *saveAsMenu;
|
||||||
@@ -83,6 +87,9 @@ private:
|
|||||||
QAction *actionDeleteLayer;
|
QAction *actionDeleteLayer;
|
||||||
|
|
||||||
QAction *actionGetColorbar;
|
QAction *actionGetColorbar;
|
||||||
|
QAction *actionSwitchColors;
|
||||||
|
QAction *actionCreatePenTool;
|
||||||
|
QAction *actionCreateFloodFillTool;
|
||||||
|
|
||||||
QAction *actionAboutDialog;
|
QAction *actionAboutDialog;
|
||||||
QAction *actionAboutQtDialog;
|
QAction *actionAboutQtDialog;
|
||||||
|
|||||||
47
src/Painting/IntelliHelper/IntelliColorPicker.cpp
Normal file
47
src/Painting/IntelliHelper/IntelliColorPicker.cpp
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
#include "IntelliColorPicker.h"
|
||||||
|
|
||||||
|
IntelliColorPicker::IntelliColorPicker(PaintingArea* Area){
|
||||||
|
firstColor = {255,0,0,255};
|
||||||
|
secondColor = {0,0,255,255};
|
||||||
|
}
|
||||||
|
|
||||||
|
IntelliColorPicker::~IntelliColorPicker(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliColorPicker::getColorbar(int firstOrSecondColor = 1){
|
||||||
|
QString Titel;
|
||||||
|
QColor newColor;
|
||||||
|
if(firstOrSecondColor == 1){
|
||||||
|
Titel = "Choose first Color";
|
||||||
|
newColor = QColorDialog::getColor(this->firstColor,nullptr,Titel);
|
||||||
|
setFirstColor(newColor);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Titel = "Choose second Color";
|
||||||
|
newColor = QColorDialog::getColor(this->secondColor,nullptr,Titel);
|
||||||
|
setFirstColor(newColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliColorPicker::switchColors(){
|
||||||
|
QColor temp = this->firstColor;
|
||||||
|
this->firstColor = this->secondColor;
|
||||||
|
this->secondColor = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor IntelliColorPicker::getFirstColor(){
|
||||||
|
return this->firstColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor IntelliColorPicker::getSecondColor(){
|
||||||
|
return this->secondColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliColorPicker::setFirstColor(QColor Color){
|
||||||
|
this->firstColor = Color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliColorPicker::setSecondColor(QColor Color){
|
||||||
|
this->secondColor = Color;
|
||||||
|
}
|
||||||
28
src/Painting/IntelliHelper/IntelliColorPicker.h
Normal file
28
src/Painting/IntelliHelper/IntelliColorPicker.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef INTELLITOOLSETCOLORTOOL_H
|
||||||
|
#define INTELLITOOLSETCOLORTOOL_H
|
||||||
|
|
||||||
|
#include"Layer/PaintingArea.h"
|
||||||
|
#include"QColor"
|
||||||
|
#include"QPoint"
|
||||||
|
#include"QColorDialog"
|
||||||
|
|
||||||
|
class IntelliColorPicker{
|
||||||
|
public:
|
||||||
|
IntelliColorPicker(PaintingArea *Area);
|
||||||
|
virtual ~IntelliColorPicker();
|
||||||
|
|
||||||
|
void getColorbar(int firstOrSecondColor);
|
||||||
|
void switchColors();
|
||||||
|
|
||||||
|
QColor getFirstColor();
|
||||||
|
QColor getSecondColor();
|
||||||
|
|
||||||
|
void setFirstColor(QColor Color);
|
||||||
|
void setSecondColor(QColor Color);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QColor firstColor;
|
||||||
|
QColor secondColor;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INTELLITOOLSETCOLORTOOL_H
|
||||||
@@ -20,12 +20,12 @@ SOURCES += \
|
|||||||
Image/IntelliImage.cpp \
|
Image/IntelliImage.cpp \
|
||||||
Image/IntelliRasterImage.cpp \
|
Image/IntelliRasterImage.cpp \
|
||||||
Image/IntelliShapedImage.cpp \
|
Image/IntelliShapedImage.cpp \
|
||||||
|
IntelliHelper/IntelliColorPicker.cpp \
|
||||||
IntelliHelper/IntelliHelper.cpp \
|
IntelliHelper/IntelliHelper.cpp \
|
||||||
Layer/PaintingArea.cpp \
|
Layer/PaintingArea.cpp \
|
||||||
Tool/IntelliTool.cpp \
|
Tool/IntelliTool.cpp \
|
||||||
Tool/IntelliToolFloodFillTool.cpp \
|
Tool/IntelliToolFloodFillTool.cpp \
|
||||||
Tool/IntelliToolPen.cpp \
|
Tool/IntelliToolPen.cpp \
|
||||||
Tool/IntelliToolSetColorTool.cpp \
|
|
||||||
main.cpp
|
main.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
@@ -33,12 +33,12 @@ HEADERS += \
|
|||||||
Image/IntelliImage.h \
|
Image/IntelliImage.h \
|
||||||
Image/IntelliRasterImage.h \
|
Image/IntelliRasterImage.h \
|
||||||
Image/IntelliShapedImage.h \
|
Image/IntelliShapedImage.h \
|
||||||
|
IntelliHelper/IntelliColorPicker.h \
|
||||||
IntelliHelper/IntelliHelper.h \
|
IntelliHelper/IntelliHelper.h \
|
||||||
Layer/PaintingArea.h \
|
Layer/PaintingArea.h \
|
||||||
Tool/IntelliTool.h \
|
Tool/IntelliTool.h \
|
||||||
Tool/IntelliToolFloodFillTool.h \
|
Tool/IntelliToolFloodFillTool.h \
|
||||||
Tool/IntelliToolPen.h \
|
Tool/IntelliToolPen.h
|
||||||
Tool/IntelliToolSetColorTool.h
|
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
widget.ui
|
widget.ui
|
||||||
|
|||||||
@@ -8,17 +8,11 @@
|
|||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
|
||||||
#include "PaintingArea.h"
|
#include "PaintingArea.h"
|
||||||
#include "Image/IntelliRasterImage.h"
|
|
||||||
#include "Image/IntelliShapedImage.h"
|
|
||||||
#include "Tool/IntelliToolPen.h"
|
|
||||||
#include "Tool/IntelliToolSetColorTool.h"
|
|
||||||
#include "Tool/IntelliToolFloodFillTool.h"
|
|
||||||
|
|
||||||
|
|
||||||
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
|
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
|
||||||
:QWidget(parent){
|
:QWidget(parent){
|
||||||
this->Tool = new IntelliToolFloodFillTool(this);
|
this->Tool = new IntelliToolPen(this);
|
||||||
this->ColorTool = new IntelliToolSetColorTool(this);
|
this->ColorTool = new IntelliColorPicker(this);
|
||||||
this->setUp(maxWidth, maxHeight);
|
this->setUp(maxWidth, maxHeight);
|
||||||
//tetsing
|
//tetsing
|
||||||
this->addLayer(200,200,0,0,ImageType::Shaped_Image);
|
this->addLayer(200,200,0,0,ImageType::Shaped_Image);
|
||||||
@@ -37,10 +31,30 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
|
|||||||
activeLayer=1;
|
activeLayer=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolSetColorTool* PaintingArea::getTool(){
|
void PaintingArea::getColorbar(int firstOrSecondColor){
|
||||||
|
ColorTool->getColorbar(firstOrSecondColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
IntelliColorPicker* PaintingArea::getColorTool(){
|
||||||
return ColorTool;
|
return ColorTool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaintingArea::switchColors(){
|
||||||
|
ColorTool->switchColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PaintingArea::createPenTool(){
|
||||||
|
IntelliTool *temp = this->Tool;
|
||||||
|
this->Tool = new IntelliToolPen(this);
|
||||||
|
delete temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PaintingArea::createFloodFillTool(){
|
||||||
|
IntelliTool *temp = this->Tool;
|
||||||
|
this->Tool = new IntelliToolFloodFillTool(this);
|
||||||
|
delete temp;
|
||||||
|
}
|
||||||
|
|
||||||
void PaintingArea::setUp(int maxWidth, int maxHeight){
|
void PaintingArea::setUp(int maxWidth, int maxHeight){
|
||||||
//set standart parameter
|
//set standart parameter
|
||||||
this->maxWidth = maxWidth;
|
this->maxWidth = maxWidth;
|
||||||
|
|||||||
@@ -8,8 +8,11 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include "Image/IntelliImage.h"
|
#include "Image/IntelliImage.h"
|
||||||
|
#include "Image/IntelliRasterImage.h"
|
||||||
|
#include "Image/IntelliShapedImage.h"
|
||||||
#include "Tool/IntelliTool.h"
|
#include "Tool/IntelliTool.h"
|
||||||
#include "Tool/IntelliToolSetColorTool.h"
|
#include "Tool/IntelliToolPen.h"
|
||||||
|
#include "Tool/IntelliToolFloodFillTool.h"
|
||||||
|
|
||||||
|
|
||||||
struct LayerObject{
|
struct LayerObject{
|
||||||
@@ -23,6 +26,8 @@ struct LayerObject{
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class IntelliColorPicker;
|
||||||
|
|
||||||
class PaintingArea : public QWidget
|
class PaintingArea : public QWidget
|
||||||
{
|
{
|
||||||
// Declares our class as a QObject which is the base class
|
// Declares our class as a QObject which is the base class
|
||||||
@@ -33,7 +38,14 @@ class PaintingArea : public QWidget
|
|||||||
public:
|
public:
|
||||||
PaintingArea(int maxWidth=600, int maxHeight=600, QWidget *parent = nullptr);
|
PaintingArea(int maxWidth=600, int maxHeight=600, QWidget *parent = nullptr);
|
||||||
|
|
||||||
IntelliToolSetColorTool* getTool(); //TODO: rename function, when there are more Tools
|
IntelliColorPicker* getColorTool();
|
||||||
|
|
||||||
|
void getColorbar(int firstOrSecondColor);
|
||||||
|
void switchColors();
|
||||||
|
|
||||||
|
//Create Tools
|
||||||
|
void createPenTool();
|
||||||
|
void createFloodFillTool();
|
||||||
|
|
||||||
// Handles all events
|
// Handles all events
|
||||||
bool open(const QString &fileName);
|
bool open(const QString &fileName);
|
||||||
@@ -81,7 +93,7 @@ private:
|
|||||||
int maxHeight;
|
int maxHeight;
|
||||||
|
|
||||||
IntelliTool* Tool;
|
IntelliTool* Tool;
|
||||||
IntelliToolSetColorTool* ColorTool;
|
IntelliColorPicker* ColorTool;
|
||||||
|
|
||||||
std::vector<LayerObject> layerBundle;
|
std::vector<LayerObject> layerBundle;
|
||||||
int activeLayer=-1;
|
int activeLayer=-1;
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
#include "IntelliToolSetColorTool.h"
|
#include "IntelliColorPicker.h"
|
||||||
#include "QDebug"
|
#include "QDebug"
|
||||||
|
|
||||||
IntelliToolSetColorTool::IntelliToolSetColorTool(PaintingArea* Area)
|
IntelliColorPicker::IntelliColorPicker(PaintingArea* Area)
|
||||||
:IntelliTool(Area){
|
:IntelliTool(Area){
|
||||||
firstColor = {255,0,0,255};
|
firstColor = {255,0,0,255};
|
||||||
secondColor = {0,0,255,255};
|
secondColor = {0,0,255,255};
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolSetColorTool::~IntelliToolSetColorTool(){
|
IntelliColorPicker::~IntelliColorPicker(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolSetColorTool::getColorbar(int firstOrSecondColor = 1){
|
void IntelliColorPicker::getColorbar(int firstOrSecondColor = 1){
|
||||||
QString Titel;
|
QString Titel;
|
||||||
QColor newColor;
|
QColor newColor;
|
||||||
if(firstOrSecondColor == 1){
|
if(firstOrSecondColor == 1){
|
||||||
@@ -27,10 +27,10 @@ void IntelliToolSetColorTool::getColorbar(int firstOrSecondColor = 1){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor IntelliToolSetColorTool::getFirstColor(){
|
QColor IntelliColorPicker::getFirstColor(){
|
||||||
return firstColor;
|
return firstColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor IntelliToolSetColorTool::getSecondColor(){
|
QColor IntelliColorPicker::getSecondColor(){
|
||||||
return secondColor;
|
return secondColor;
|
||||||
}
|
}
|
||||||
@@ -10,10 +10,6 @@ IntelliTool::~IntelliTool(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliTool::getColorbar(int firstOrSecondColor){
|
|
||||||
//optional for tool
|
|
||||||
}
|
|
||||||
|
|
||||||
void IntelliTool::onMouseRightPressed(int x, int y){
|
void IntelliTool::onMouseRightPressed(int x, int y){
|
||||||
if(drawing){
|
if(drawing){
|
||||||
drawing=false;
|
drawing=false;
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ public:
|
|||||||
IntelliTool(PaintingArea* Area);
|
IntelliTool(PaintingArea* Area);
|
||||||
virtual ~IntelliTool() = 0;
|
virtual ~IntelliTool() = 0;
|
||||||
|
|
||||||
virtual void getColorbar(int firstOrSecondColor);
|
|
||||||
|
|
||||||
virtual void onMouseRightPressed(int x, int y);
|
virtual void onMouseRightPressed(int x, int y);
|
||||||
virtual void onMouseRightReleased(int x, int y);
|
virtual void onMouseRightReleased(int x, int y);
|
||||||
virtual void onMouseLeftPressed(int x, int y);
|
virtual void onMouseLeftPressed(int x, int y);
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
#include "Layer/PaintingArea.h"
|
#include "Layer/PaintingArea.h"
|
||||||
|
|
||||||
IntelliToolFloodFillTool::IntelliToolFloodFillTool(PaintingArea* Area)
|
IntelliToolFloodFillTool::IntelliToolFloodFillTool(PaintingArea* Area)
|
||||||
:IntelliToolSetColorTool(Area)
|
:IntelliTool(Area)
|
||||||
{
|
{
|
||||||
Tool = Area->getTool();
|
Tool = Area->getColorTool();
|
||||||
isPressed = false;
|
isPressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ void IntelliToolFloodFillTool::onMouseLeftPressed(int x, int y){
|
|||||||
if(!isPressed){
|
if(!isPressed){
|
||||||
isPressed = true;
|
isPressed = true;
|
||||||
IntelliTool::onMouseLeftPressed(x,y);
|
IntelliTool::onMouseLeftPressed(x,y);
|
||||||
Tool = Area->getTool();
|
Tool = Area->getColorTool();
|
||||||
this->Canvas->image->floodFill(Tool->getFirstColor());
|
this->Canvas->image->floodFill(Tool->getFirstColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ void IntelliToolFloodFillTool::onMouseRightPressed(int x, int y){
|
|||||||
if(!isPressed){
|
if(!isPressed){
|
||||||
isPressed = true;
|
isPressed = true;
|
||||||
IntelliTool::onMouseLeftPressed(x,y);
|
IntelliTool::onMouseLeftPressed(x,y);
|
||||||
Tool = Area->getTool();
|
Tool = Area->getColorTool();
|
||||||
this->Canvas->image->floodFill(Tool->getSecondColor());
|
this->Canvas->image->floodFill(Tool->getSecondColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
#ifndef INTELLITOOLFLOODFILLTOOL_H
|
#ifndef INTELLITOOLFLOODFILLTOOL_H
|
||||||
#define INTELLITOOLFLOODFILLTOOL_H
|
#define INTELLITOOLFLOODFILLTOOL_H
|
||||||
|
|
||||||
#include "IntelliToolSetColorTool.h"
|
#include "IntelliHelper/IntelliColorPicker.h"
|
||||||
|
|
||||||
class IntelliToolFloodFillTool : public IntelliToolSetColorTool
|
class IntelliToolFloodFillTool : public IntelliTool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IntelliToolFloodFillTool(PaintingArea *Area);
|
IntelliToolFloodFillTool(PaintingArea *Area);
|
||||||
|
|
||||||
void IntelliToolFloodFillTool::onMouseLeftPressed(int x, int y) override;
|
void onMouseLeftPressed(int x, int y) override;
|
||||||
void IntelliToolFloodFillTool::onMouseLeftReleased(int x, int y) override;
|
void onMouseLeftReleased(int x, int y) override;
|
||||||
void IntelliToolFloodFillTool::onMouseRightPressed(int x, int y) override;
|
void onMouseRightPressed(int x, int y) override;
|
||||||
void IntelliToolFloodFillTool::onMouseRightReleased(int x, int y) override;
|
void onMouseRightReleased(int x, int y) override;
|
||||||
void IntelliToolFloodFillTool::onMouseMoved(int x, int y) override;
|
void onMouseMoved(int x, int y) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IntelliToolSetColorTool* Tool;
|
IntelliColorPicker* Tool;
|
||||||
bool isPressed;
|
bool isPressed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
#include "IntelliToolPen.h"
|
#include "IntelliToolPen.h"
|
||||||
#include "Layer/PaintingArea.h"
|
#include "Layer/PaintingArea.h"
|
||||||
#include "QDebug"
|
|
||||||
|
|
||||||
IntelliToolPen::IntelliToolPen(PaintingArea* Area)
|
IntelliToolPen::IntelliToolPen(PaintingArea* Area)
|
||||||
:IntelliToolSetColorTool(Area){
|
:IntelliTool(Area){
|
||||||
|
Tool = new IntelliColorPicker(Area);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolPen::~IntelliToolPen(){
|
IntelliToolPen::~IntelliToolPen(){
|
||||||
@@ -35,8 +34,7 @@ void IntelliToolPen::onMouseLeftReleased(int x, int y){
|
|||||||
void IntelliToolPen::onMouseMoved(int x, int y){
|
void IntelliToolPen::onMouseMoved(int x, int y){
|
||||||
if(this->drawing){
|
if(this->drawing){
|
||||||
QPoint newPoint(x,y);
|
QPoint newPoint(x,y);
|
||||||
Tool = Area->getTool();
|
Tool = Area->getColorTool();
|
||||||
qDebug() << Tool->getFirstColor();
|
|
||||||
this->Canvas->image->drawLine(this->point, newPoint, Tool->getFirstColor(), 2);
|
this->Canvas->image->drawLine(this->point, newPoint, Tool->getFirstColor(), 2);
|
||||||
this->point=newPoint;
|
this->point=newPoint;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
#ifndef INTELLITOOLPEN_H
|
#ifndef INTELLITOOLPEN_H
|
||||||
#define INTELLITOOLPEN_H
|
#define INTELLITOOLPEN_H
|
||||||
|
|
||||||
#include"IntelliToolSetColorTool.h"
|
#include"IntelliTool.h"
|
||||||
#include"QColor"
|
#include"QColor"
|
||||||
#include"QPoint"
|
#include"QPoint"
|
||||||
|
|
||||||
class IntelliToolPen : public IntelliToolSetColorTool{
|
class IntelliColorPicker;
|
||||||
|
|
||||||
|
class IntelliToolPen : public IntelliTool{
|
||||||
QPoint point;
|
QPoint point;
|
||||||
public:
|
public:
|
||||||
IntelliToolPen(PaintingArea* Area);
|
IntelliToolPen(PaintingArea* Area);
|
||||||
@@ -19,7 +21,7 @@ public:
|
|||||||
virtual void onMouseMoved(int x, int y) override;
|
virtual void onMouseMoved(int x, int y) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IntelliToolSetColorTool* Tool;
|
IntelliColorPicker* Tool;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INTELLITOOLPEN_H
|
#endif // INTELLITOOLPEN_H
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
#ifndef INTELLITOOLSETCOLORTOOL_H
|
|
||||||
#define INTELLITOOLSETCOLORTOOL_H
|
|
||||||
|
|
||||||
#include"IntelliTool.h"
|
|
||||||
#include"QColor"
|
|
||||||
#include"QPoint"
|
|
||||||
#include"QColorDialog"
|
|
||||||
|
|
||||||
class IntelliToolSetColorTool: public IntelliTool{
|
|
||||||
public:
|
|
||||||
IntelliToolSetColorTool(PaintingArea *Area);
|
|
||||||
virtual ~IntelliToolSetColorTool() override;
|
|
||||||
|
|
||||||
void getColorbar(int firstOrSecondColor) override;
|
|
||||||
|
|
||||||
QColor IntelliToolSetColorTool::getFirstColor();
|
|
||||||
QColor IntelliToolSetColorTool::getSecondColor();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QColor firstColor;
|
|
||||||
QColor secondColor;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // INTELLITOOLSETCOLORTOOL_H
|
|
||||||
Reference in New Issue
Block a user