Merge branch 'dev' into dev_PolygonTool

This commit is contained in:
2019-12-19 11:31:34 +01:00
12 changed files with 179 additions and 56 deletions

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