mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-15 04:40:37 +02:00
new tools
This commit is contained in:
@@ -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;
|
||||
@@ -69,6 +65,7 @@ void IntelliTool::mergeToolLayer(){
|
||||
|
||||
Active->image->imageData.setPixelColor(x, y, clr_0);
|
||||
}
|
||||
Active->image->calculateVisiblity();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +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);
|
||||
|
||||
49
src/Painting/Tool/IntelliToolLine.cpp
Normal file
49
src/Painting/Tool/IntelliToolLine.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "IntelliToolLine.h"
|
||||
#include "Layer/PaintingArea.h"
|
||||
#include "QColorDialog"
|
||||
#include "QInputDialog"
|
||||
|
||||
IntelliToolLine::IntelliToolLine(PaintingArea* Area)
|
||||
:IntelliTool(Area){
|
||||
this->color = QColorDialog::getColor(Qt::blue, nullptr, "Line Color");
|
||||
this->lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
|
||||
//create checkbox or scroll dialog to get line style
|
||||
this->lineStyle = LineStyle::SOLID_LINE;
|
||||
}
|
||||
|
||||
IntelliToolLine::~IntelliToolLine(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
void IntelliToolLine::onMouseRightPressed(int x, int y){
|
||||
IntelliTool::onMouseRightPressed(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolLine::onMouseRightReleased(int x, int y){
|
||||
IntelliTool::onMouseRightReleased(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolLine::onMouseLeftPressed(int x, int y){
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
this->start=QPoint(x,y);
|
||||
this->Canvas->image->drawLine(start, start, this->color, this->lineWidth);
|
||||
}
|
||||
|
||||
void IntelliToolLine::onMouseLeftReleased(int x, int y){
|
||||
IntelliTool::onMouseLeftReleased(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolLine::onMouseMoved(int x, int y){
|
||||
IntelliTool::onMouseMoved(x,y);
|
||||
if(this->drawing){
|
||||
this->Canvas->image->floodFill(Qt::transparent);
|
||||
QPoint next(x,y);
|
||||
switch(lineStyle){
|
||||
case LineStyle::SOLID_LINE :
|
||||
this->Canvas->image->drawLine(start,next,color,lineWidth);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
31
src/Painting/Tool/IntelliToolLine.h
Normal file
31
src/Painting/Tool/IntelliToolLine.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef INTELLITOOLLINE_H
|
||||
#define INTELLITOOLLINE_H
|
||||
#include "IntelliTool.h"
|
||||
|
||||
#include "QColor"
|
||||
#include "QPoint"
|
||||
|
||||
enum class LineStyle{
|
||||
SOLID_LINE
|
||||
};
|
||||
|
||||
class IntelliToolLine : public IntelliTool
|
||||
{
|
||||
QPoint start;
|
||||
QColor color;
|
||||
int lineWidth;
|
||||
LineStyle lineStyle;
|
||||
public:
|
||||
IntelliToolLine(PaintingArea* Area);
|
||||
virtual ~IntelliToolLine() override;
|
||||
|
||||
|
||||
virtual void onMouseRightPressed(int x, int y) override;
|
||||
virtual void onMouseRightReleased(int x, int y) override;
|
||||
virtual void onMouseLeftPressed(int x, int y) override;
|
||||
virtual void onMouseLeftReleased(int x, int y) override;
|
||||
|
||||
virtual void onMouseMoved(int x, int y) override;
|
||||
};
|
||||
|
||||
#endif // INTELLITOOLLINE_H
|
||||
@@ -7,9 +7,7 @@
|
||||
IntelliToolPen::IntelliToolPen(PaintingArea* Area)
|
||||
:IntelliTool(Area){
|
||||
this->color = QColorDialog::getColor(Qt::blue,nullptr,"Flood Fill Color");
|
||||
|
||||
bool ok;
|
||||
this->penWidth = QInputDialog::getInt(nullptr, "Pen width", "Number:", 1,0, 50, 1, &ok);
|
||||
this->penWidth = QInputDialog::getInt(nullptr, "Pen width", "Number:", 1,0, 50, 1);
|
||||
}
|
||||
|
||||
IntelliToolPen::~IntelliToolPen(){
|
||||
@@ -18,22 +16,18 @@ IntelliToolPen::~IntelliToolPen(){
|
||||
|
||||
void IntelliToolPen::onMouseRightPressed(int x, int y){
|
||||
IntelliTool::onMouseRightPressed(x,y);
|
||||
//implement in here
|
||||
}
|
||||
|
||||
void IntelliToolPen::onMouseRightReleased(int x, int y){
|
||||
IntelliTool::onMouseRightReleased(x,y);
|
||||
//implemnt in here
|
||||
}
|
||||
|
||||
void IntelliToolPen::onMouseLeftPressed(int x, int y){
|
||||
//implement in here
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
this->point=QPoint(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolPen::onMouseLeftReleased(int x, int y){
|
||||
//implement in here
|
||||
IntelliTool::onMouseLeftReleased(x,y);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,32 @@
|
||||
#include "IntelliToolFloodFillTool.h"
|
||||
#include "IntelliToolPlain.h"
|
||||
#include "Layer/PaintingArea.h"
|
||||
#include "QColorDialog"
|
||||
|
||||
IntelliToolFloodFillTool::IntelliToolFloodFillTool(PaintingArea* Area)
|
||||
IntelliToolPlainTool::IntelliToolPlainTool(PaintingArea* Area)
|
||||
:IntelliTool(Area){
|
||||
|
||||
this->color = QColorDialog::getColor(Qt::blue,nullptr,"Flood Fill Color");
|
||||
}
|
||||
|
||||
void IntelliToolFloodFillTool::onMouseLeftPressed(int x, int y){
|
||||
void IntelliToolPlainTool::onMouseLeftPressed(int x, int y){
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
this->Canvas->image->floodFill(color);
|
||||
}
|
||||
|
||||
void IntelliToolFloodFillTool::onMouseRightPressed(int x, int y){
|
||||
IntelliTool::onMouseRightPressed(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolFloodFillTool::onMouseRightReleased(int x, int y){
|
||||
IntelliTool::onMouseRightReleased(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolFloodFillTool::onMouseLeftReleased(int x, int y){
|
||||
void IntelliToolPlainTool::onMouseLeftReleased(int x, int y){
|
||||
IntelliTool::onMouseLeftReleased(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolFloodFillTool::onMouseMoved(int x, int y){
|
||||
IntelliTool::onMouseMoved(x,y);
|
||||
void IntelliToolPlainTool::onMouseRightPressed(int x, int y){
|
||||
IntelliTool::onMouseRightPressed(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolPlainTool::onMouseRightReleased(int x, int y){
|
||||
IntelliTool::onMouseRightReleased(x,y);
|
||||
}
|
||||
|
||||
|
||||
void IntelliToolPlainTool::onMouseMoved(int x, int y){
|
||||
IntelliTool::onMouseMoved(x,y);
|
||||
|
||||
}
|
||||
@@ -4,11 +4,11 @@
|
||||
#include "IntelliTool.h"
|
||||
#include "QColor"
|
||||
|
||||
class IntelliToolFloodFillTool : public IntelliTool
|
||||
class IntelliToolPlainTool : public IntelliTool
|
||||
{
|
||||
QColor color;
|
||||
public:
|
||||
IntelliToolFloodFillTool(PaintingArea *Area);
|
||||
IntelliToolPlainTool(PaintingArea *Area);
|
||||
|
||||
void onMouseLeftPressed(int x, int y) override;
|
||||
void onMouseLeftReleased(int x, int y) override;
|
||||
Reference in New Issue
Block a user