Merge branch 'dev-rectangle-rename' into 'dev'

Rectangle Refractoring

See merge request creyd/intelliphoto!19
This commit is contained in:
Conrad
2019-12-18 11:43:07 +00:00
4 changed files with 23 additions and 23 deletions

View File

@@ -28,7 +28,7 @@ SOURCES += \
Tool/IntelliToolLine.cpp \
Tool/IntelliToolPen.cpp \
Tool/IntelliToolPlain.cpp \
Tool/IntelliToolRechteck.cpp \
Tool/IntelliToolRectangle.cpp \
main.cpp
HEADERS += \
@@ -44,7 +44,7 @@ HEADERS += \
Tool/IntelliToolLine.h \
Tool/IntelliToolPen.h \
Tool/IntelliToolPlain.h \
Tool/IntelliToolRechteck.h \
Tool/IntelliToolRectangle.h \
Tool/intellitoolcircle.h
FORMS += \

View File

@@ -14,12 +14,12 @@
#include "Tool/IntelliToolPlain.h"
#include "Tool/IntelliToolLine.h"
#include "Tool/IntelliToolCircle.h"
#include "Tool/IntelliToolRechteck.h"
#include "Tool/IntelliToolRectangle.h"
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
:QWidget(parent){
//test yout tool here and reset after accomplished test
this->Tool = new IntelliToolRechteck(this, &colorPicker);
this->Tool = new IntelliToolRectangle(this, &colorPicker);
this->setUp(maxWidth, maxHeight);
//tetsing
this->addLayer(200,200,0,0,ImageType::Shaped_Image);

View File

@@ -1,18 +1,18 @@
#include"IntelliToolRechteck.h"
#include"IntelliToolRectangle.h"
#include "Layer/PaintingArea.h"
#include "QInputDialog"
IntelliToolRechteck::IntelliToolRechteck(PaintingArea* Area, IntelliColorPicker* colorPicker)
IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker)
:IntelliTool(Area, colorPicker){
this->alphaInner = QInputDialog::getInt(nullptr,"Inner Alpha Value", "Value:", 0,0,255,1);
this->edgeWidth = QInputDialog::getInt(nullptr,"Outer edge width", "Value:", 0,1,255,1);
}
IntelliToolRechteck::~IntelliToolRechteck(){
IntelliToolRectangle::~IntelliToolRectangle(){
}
void IntelliToolRechteck::drawRechteck(QPoint otherCornor){
void IntelliToolRectangle::drawRectangle(QPoint otherCornor){
int xMin = std::min(originCornor.x(), otherCornor.x());
int xMax = std::max(originCornor.x(), otherCornor.x());
@@ -30,36 +30,36 @@ void IntelliToolRechteck::drawRechteck(QPoint otherCornor){
this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), edgeWidth);
}
void IntelliToolRechteck::onMouseRightPressed(int x, int y){
void IntelliToolRectangle::onMouseRightPressed(int x, int y){
IntelliTool::onMouseRightPressed(x,y);
}
void IntelliToolRechteck::onMouseRightReleased(int x, int y){
void IntelliToolRectangle::onMouseRightReleased(int x, int y){
IntelliTool::onMouseRightReleased(x,y);
}
void IntelliToolRechteck::onMouseLeftPressed(int x, int y){
void IntelliToolRectangle::onMouseLeftPressed(int x, int y){
IntelliTool::onMouseLeftPressed(x,y);
this->originCornor=QPoint(x,y);
drawRechteck(originCornor);
drawRectangle(originCornor);
Canvas->image->calculateVisiblity();
}
void IntelliToolRechteck::onMouseLeftReleased(int x, int y){
void IntelliToolRectangle::onMouseLeftReleased(int x, int y){
IntelliTool::onMouseLeftReleased(x,y);
}
void IntelliToolRechteck::onMouseMoved(int x, int y){
void IntelliToolRectangle::onMouseMoved(int x, int y){
IntelliTool::onMouseMoved(x,y);
if(this->drawing){
this->Canvas->image->drawPlain(Qt::transparent);
QPoint next(x,y);
drawRechteck(next);
drawRectangle(next);
}
IntelliTool::onMouseMoved(x,y);
}
void IntelliToolRechteck::onWheelScrolled(int value){
void IntelliToolRectangle::onWheelScrolled(int value){
IntelliTool::onWheelScrolled(value);
this->edgeWidth+=value;
if(this->edgeWidth<=0){

View File

@@ -1,20 +1,20 @@
#ifndef INTELLIRECHTECKTOOL_H
#define INTELLIRECHTECKTOOL_H
#ifndef INTELLIRECTANGLETOOL_H
#define INTELLIRECTANGLETOOL_H
#include "IntelliTool.h"
#include "QColor"
#include "QPoint"
class IntelliToolRechteck : public IntelliTool{
void drawRechteck(QPoint otherCornor);
class IntelliToolRectangle : public IntelliTool{
void drawRectangle(QPoint otherCornor);
QPoint originCornor;
int alphaInner;
int edgeWidth;
public:
IntelliToolRechteck(PaintingArea* Area, IntelliColorPicker* colorPicker);
virtual ~IntelliToolRechteck() override;
IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker);
virtual ~IntelliToolRectangle() override;
virtual void onMouseRightPressed(int x, int y) override;
virtual void onMouseRightReleased(int x, int y) override;
@@ -26,4 +26,4 @@ public:
virtual void onMouseMoved(int x, int y) override;
};
#endif // INTELLIRECHTECKTOOL_H
#endif // INTELLIRECTANGLETOOL_H