mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-15 04:40:37 +02:00
Änderung der Vererbung der Tools und einfügen des ColorPickers (Farbmanager)
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
#include "IntelliToolSetColorTool.h"
|
||||
#include "IntelliColorPicker.h"
|
||||
#include "QDebug"
|
||||
|
||||
IntelliToolSetColorTool::IntelliToolSetColorTool(PaintingArea* Area)
|
||||
IntelliColorPicker::IntelliColorPicker(PaintingArea* Area)
|
||||
:IntelliTool(Area){
|
||||
firstColor = {255,0,0,255};
|
||||
secondColor = {0,0,255,255};
|
||||
}
|
||||
|
||||
IntelliToolSetColorTool::~IntelliToolSetColorTool(){
|
||||
IntelliColorPicker::~IntelliColorPicker(){
|
||||
|
||||
}
|
||||
|
||||
void IntelliToolSetColorTool::getColorbar(int firstOrSecondColor = 1){
|
||||
void IntelliColorPicker::getColorbar(int firstOrSecondColor = 1){
|
||||
QString Titel;
|
||||
QColor newColor;
|
||||
if(firstOrSecondColor == 1){
|
||||
@@ -27,10 +27,10 @@ void IntelliToolSetColorTool::getColorbar(int firstOrSecondColor = 1){
|
||||
}
|
||||
}
|
||||
|
||||
QColor IntelliToolSetColorTool::getFirstColor(){
|
||||
QColor IntelliColorPicker::getFirstColor(){
|
||||
return firstColor;
|
||||
}
|
||||
|
||||
QColor IntelliToolSetColorTool::getSecondColor(){
|
||||
QColor IntelliColorPicker::getSecondColor(){
|
||||
return secondColor;
|
||||
}
|
||||
@@ -10,10 +10,6 @@ IntelliTool::~IntelliTool(){
|
||||
|
||||
}
|
||||
|
||||
void IntelliTool::getColorbar(int firstOrSecondColor){
|
||||
//optional for tool
|
||||
}
|
||||
|
||||
void IntelliTool::onMouseRightPressed(int x, int y){
|
||||
if(drawing){
|
||||
drawing=false;
|
||||
|
||||
@@ -21,8 +21,6 @@ public:
|
||||
IntelliTool(PaintingArea* Area);
|
||||
virtual ~IntelliTool() = 0;
|
||||
|
||||
virtual void getColorbar(int firstOrSecondColor);
|
||||
|
||||
virtual void onMouseRightPressed(int x, int y);
|
||||
virtual void onMouseRightReleased(int x, int y);
|
||||
virtual void onMouseLeftPressed(int x, int y);
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#include "Layer/PaintingArea.h"
|
||||
|
||||
IntelliToolFloodFillTool::IntelliToolFloodFillTool(PaintingArea* Area)
|
||||
:IntelliToolSetColorTool(Area)
|
||||
:IntelliTool(Area)
|
||||
{
|
||||
Tool = Area->getTool();
|
||||
Tool = Area->getColorTool();
|
||||
isPressed = false;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ void IntelliToolFloodFillTool::onMouseLeftPressed(int x, int y){
|
||||
if(!isPressed){
|
||||
isPressed = true;
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
Tool = Area->getTool();
|
||||
Tool = Area->getColorTool();
|
||||
this->Canvas->image->floodFill(Tool->getFirstColor());
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ void IntelliToolFloodFillTool::onMouseRightPressed(int x, int y){
|
||||
if(!isPressed){
|
||||
isPressed = true;
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
Tool = Area->getTool();
|
||||
Tool = Area->getColorTool();
|
||||
this->Canvas->image->floodFill(Tool->getSecondColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
#ifndef INTELLITOOLFLOODFILLTOOL_H
|
||||
#define INTELLITOOLFLOODFILLTOOL_H
|
||||
|
||||
#include "IntelliToolSetColorTool.h"
|
||||
#include "IntelliHelper/IntelliColorPicker.h"
|
||||
|
||||
class IntelliToolFloodFillTool : public IntelliToolSetColorTool
|
||||
class IntelliToolFloodFillTool : public IntelliTool
|
||||
{
|
||||
public:
|
||||
IntelliToolFloodFillTool(PaintingArea *Area);
|
||||
|
||||
void IntelliToolFloodFillTool::onMouseLeftPressed(int x, int y) override;
|
||||
void IntelliToolFloodFillTool::onMouseLeftReleased(int x, int y) override;
|
||||
void IntelliToolFloodFillTool::onMouseRightPressed(int x, int y) override;
|
||||
void IntelliToolFloodFillTool::onMouseRightReleased(int x, int y) override;
|
||||
void IntelliToolFloodFillTool::onMouseMoved(int x, int y) override;
|
||||
void onMouseLeftPressed(int x, int y) override;
|
||||
void onMouseLeftReleased(int x, int y) override;
|
||||
void onMouseRightPressed(int x, int y) override;
|
||||
void onMouseRightReleased(int x, int y) override;
|
||||
void onMouseMoved(int x, int y) override;
|
||||
|
||||
private:
|
||||
IntelliToolSetColorTool* Tool;
|
||||
IntelliColorPicker* Tool;
|
||||
bool isPressed;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#include "IntelliToolPen.h"
|
||||
#include "Layer/PaintingArea.h"
|
||||
#include "QDebug"
|
||||
|
||||
IntelliToolPen::IntelliToolPen(PaintingArea* Area)
|
||||
:IntelliToolSetColorTool(Area){
|
||||
|
||||
:IntelliTool(Area){
|
||||
Tool = new IntelliColorPicker(Area);
|
||||
}
|
||||
|
||||
IntelliToolPen::~IntelliToolPen(){
|
||||
@@ -35,8 +34,7 @@ void IntelliToolPen::onMouseLeftReleased(int x, int y){
|
||||
void IntelliToolPen::onMouseMoved(int x, int y){
|
||||
if(this->drawing){
|
||||
QPoint newPoint(x,y);
|
||||
Tool = Area->getTool();
|
||||
qDebug() << Tool->getFirstColor();
|
||||
Tool = Area->getColorTool();
|
||||
this->Canvas->image->drawLine(this->point, newPoint, Tool->getFirstColor(), 2);
|
||||
this->point=newPoint;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#ifndef INTELLITOOLPEN_H
|
||||
#define INTELLITOOLPEN_H
|
||||
|
||||
#include"IntelliToolSetColorTool.h"
|
||||
#include"IntelliTool.h"
|
||||
#include"QColor"
|
||||
#include"QPoint"
|
||||
|
||||
class IntelliToolPen : public IntelliToolSetColorTool{
|
||||
class IntelliColorPicker;
|
||||
|
||||
class IntelliToolPen : public IntelliTool{
|
||||
QPoint point;
|
||||
public:
|
||||
IntelliToolPen(PaintingArea* Area);
|
||||
@@ -19,7 +21,7 @@ public:
|
||||
virtual void onMouseMoved(int x, int y) override;
|
||||
|
||||
private:
|
||||
IntelliToolSetColorTool* Tool;
|
||||
IntelliColorPicker* Tool;
|
||||
};
|
||||
|
||||
#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