mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-16 21:30:31 +02:00
Linenverwaltung
This commit is contained in:
@@ -436,9 +436,11 @@ void IntelliPhotoGui::createGui(){
|
|||||||
|
|
||||||
// create Gui elements
|
// create Gui elements
|
||||||
paintingArea = new PaintingArea();
|
paintingArea = new PaintingArea();
|
||||||
|
Push
|
||||||
|
|
||||||
// set gui elements
|
// set gui elements
|
||||||
mainLayout->addWidget(paintingArea);
|
mainLayout->addWidget(paintingArea,1,1,10,10);
|
||||||
|
mainLayout->addWiget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::setIntelliStyle(){
|
void IntelliPhotoGui::setIntelliStyle(){
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ bool saveFile(const QByteArray &fileFormat);
|
|||||||
// What we'll draw on
|
// What we'll draw on
|
||||||
PaintingArea* paintingArea;
|
PaintingArea* paintingArea;
|
||||||
|
|
||||||
|
QPushButton* PushButton;
|
||||||
|
|
||||||
// The menu widgets
|
// The menu widgets
|
||||||
QMenu*saveAsMenu;
|
QMenu*saveAsMenu;
|
||||||
QMenu*fileMenu;
|
QMenu*fileMenu;
|
||||||
@@ -135,7 +137,7 @@ QList<QAction*> actionSaveAs;
|
|||||||
|
|
||||||
// main GUI elements
|
// main GUI elements
|
||||||
QWidget* centralGuiWidget;
|
QWidget* centralGuiWidget;
|
||||||
QGridLayout*mainLayout;
|
QGridLayout* mainLayout;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IntelliToolsettings.h"
|
#include "IntelliToolsettings.h"
|
||||||
|
#include <QInputDialog>
|
||||||
|
|
||||||
IntelliToolsettings::IntelliToolsettings()
|
IntelliToolsettings::IntelliToolsettings()
|
||||||
{
|
{
|
||||||
@@ -15,8 +16,36 @@ int IntelliToolsettings::getLineWidth(){
|
|||||||
return lineWidth;
|
return lineWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IntelliToolsettings::setLineWidth(){
|
||||||
|
lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliToolsettings::setLineWidth(int LineWidth){
|
||||||
|
if(LineWidth < 1){
|
||||||
|
LineWidth = 1;
|
||||||
|
}
|
||||||
|
else if(LineWidth > 50){
|
||||||
|
LineWidth = 50;
|
||||||
|
}
|
||||||
|
lineWidth = LineWidth;
|
||||||
|
}
|
||||||
|
|
||||||
int IntelliToolsettings::getInnerAlpha(){
|
int IntelliToolsettings::getInnerAlpha(){
|
||||||
return innerAlpha;
|
return this->innerAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliToolsettings::setInnerAlpha(){
|
||||||
|
this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Aplha Input", "Value",0,0,255,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliToolsettings::setInnerAlpha(int innerAlpha){
|
||||||
|
if(innerAlpha < 0){
|
||||||
|
innerAlpha = 0;
|
||||||
|
}
|
||||||
|
else if(innerAlpha > 255){
|
||||||
|
innerAlpha = 255;
|
||||||
|
}
|
||||||
|
this->innerAlpha = innerAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolsettings::LineStyle IntelliToolsettings::getLinestyle(){
|
IntelliToolsettings::LineStyle IntelliToolsettings::getLinestyle(){
|
||||||
|
|||||||
@@ -13,7 +13,11 @@ public:
|
|||||||
IntelliToolsettings();
|
IntelliToolsettings();
|
||||||
virtual ~IntelliToolsettings();
|
virtual ~IntelliToolsettings();
|
||||||
int getLineWidth();
|
int getLineWidth();
|
||||||
|
void setLineWidth();
|
||||||
|
void setLineWidth(int LineWidth);
|
||||||
int getInnerAlpha();
|
int getInnerAlpha();
|
||||||
|
void setInnerAlpha();
|
||||||
|
void setInnerAlpha(int innerAlpha);
|
||||||
LineStyle getLinestyle();
|
LineStyle getLinestyle();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
IntelliToolCircle::IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolCircle::IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Alpha Value", "Value:", 0,0,255,1);
|
|
||||||
this->borderWidth = QInputDialog::getInt(nullptr,"Outer edge width", "Value:", 0,1,255,1);
|
|
||||||
this->ActiveType = Tooltype::CIRCLE;
|
this->ActiveType = Tooltype::CIRCLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +15,7 @@ IntelliToolCircle::~IntelliToolCircle(){
|
|||||||
void IntelliToolCircle::drawCircle(int radius){
|
void IntelliToolCircle::drawCircle(int radius){
|
||||||
int outer = radius+20;
|
int outer = radius+20;
|
||||||
QColor inner = this->colorPicker->getSecondColor();
|
QColor inner = this->colorPicker->getSecondColor();
|
||||||
inner.setAlpha(innerAlpha);
|
inner.setAlpha(Toolsettings->getInnerAlpha());
|
||||||
int yMin, yMax, xMin, xMax;
|
int yMin, yMax, xMin, xMax;
|
||||||
yMin = centerPoint.y()-radius;
|
yMin = centerPoint.y()-radius;
|
||||||
yMax = centerPoint.y()+radius;
|
yMax = centerPoint.y()+radius;
|
||||||
@@ -29,14 +27,14 @@ void IntelliToolCircle::drawCircle(int radius){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO implement circle drawing algorithm bresenham
|
//TODO implement circle drawing algorithm bresenham
|
||||||
radius = static_cast<int>(radius +(this->borderWidth/2.)-1.);
|
radius = static_cast<int>(radius +(Toolsettings->getLineWidth()/2.)-1.);
|
||||||
yMin = (centerPoint.y()-radius);
|
yMin = (centerPoint.y()-radius);
|
||||||
yMax = (centerPoint.y()+radius);
|
yMax = (centerPoint.y()+radius);
|
||||||
for(int i=yMin; i<=yMax; i++) {
|
for(int i=yMin; i<=yMax; i++) {
|
||||||
xMin = static_cast<int>(centerPoint.x()-sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
xMin = static_cast<int>(centerPoint.x()-sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
||||||
xMax = static_cast<int>(centerPoint.x()+sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
xMax = static_cast<int>(centerPoint.x()+sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
||||||
this->Canvas->image->drawPoint(QPoint(xMin,i), colorPicker->getFirstColor(),borderWidth);
|
this->Canvas->image->drawPoint(QPoint(xMin,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),borderWidth);
|
this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
xMin = (centerPoint.x()-radius);
|
xMin = (centerPoint.x()-radius);
|
||||||
@@ -44,8 +42,8 @@ void IntelliToolCircle::drawCircle(int radius){
|
|||||||
for(int i=xMin; i<=xMax; i++) {
|
for(int i=xMin; i<=xMax; i++) {
|
||||||
int yMin = static_cast<int>(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
|
int yMin = static_cast<int>(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
|
||||||
int yMax = static_cast<int>(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
|
int yMax = static_cast<int>(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
|
||||||
this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),borderWidth);
|
this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->drawPoint(QPoint(i, yMax), colorPicker->getFirstColor(),borderWidth);
|
this->Canvas->image->drawPoint(QPoint(i, yMax), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,10 +69,7 @@ void IntelliToolCircle::onMouseLeftReleased(int x, int y){
|
|||||||
|
|
||||||
void IntelliToolCircle::onWheelScrolled(int value){
|
void IntelliToolCircle::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
IntelliTool::onWheelScrolled(value);
|
||||||
this->borderWidth+=value;
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
||||||
if(this->borderWidth<=0) {
|
|
||||||
this->borderWidth=1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolCircle::onMouseMoved(int x, int y){
|
void IntelliToolCircle::onMouseMoved(int x, int y){
|
||||||
|
|||||||
@@ -19,15 +19,6 @@ void drawCircle(int radius);
|
|||||||
*/
|
*/
|
||||||
QPoint centerPoint;
|
QPoint centerPoint;
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief The alpha value of the inner circle.
|
|
||||||
*/
|
|
||||||
int innerAlpha;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief The width of the outer circle edge.
|
|
||||||
*/
|
|
||||||
int borderWidth;
|
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief A constructor setting the general paintingArea and colorPicker. And reading in the inner alpha and edgeWidth.
|
* \brief A constructor setting the general paintingArea and colorPicker. And reading in the inner alpha and edgeWidth.
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
this->lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
|
|
||||||
this->ActiveType = Tooltype::LINE;
|
this->ActiveType = Tooltype::LINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ void IntelliToolLine::onMouseRightReleased(int x, int y){
|
|||||||
void IntelliToolLine::onMouseLeftPressed(int x, int y){
|
void IntelliToolLine::onMouseLeftPressed(int x, int y){
|
||||||
IntelliTool::onMouseLeftPressed(x,y);
|
IntelliTool::onMouseLeftPressed(x,y);
|
||||||
this->lineStartingPoint=QPoint(x,y);
|
this->lineStartingPoint=QPoint(x,y);
|
||||||
this->Canvas->image->drawPoint(lineStartingPoint, colorPicker->getFirstColor(),lineWidth);
|
this->Canvas->image->drawPoint(lineStartingPoint, colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
Canvas->image->calculateVisiblity();
|
Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,10 +33,7 @@ void IntelliToolLine::onMouseLeftReleased(int x, int y){
|
|||||||
|
|
||||||
void IntelliToolLine::onWheelScrolled(int value){
|
void IntelliToolLine::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
IntelliTool::onWheelScrolled(value);
|
||||||
this->lineWidth+=value;
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
||||||
if(this->lineWidth<=0) {
|
|
||||||
this->lineWidth=1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolLine::onMouseMoved(int x, int y){
|
void IntelliToolLine::onMouseMoved(int x, int y){
|
||||||
@@ -46,7 +42,7 @@ void IntelliToolLine::onMouseMoved(int x, int y){
|
|||||||
QPoint next(x,y);
|
QPoint next(x,y);
|
||||||
switch(Toolsettings->getLinestyle()) {
|
switch(Toolsettings->getLinestyle()) {
|
||||||
case IntelliToolsettings::LineStyle::SOLID_LINE:
|
case IntelliToolsettings::LineStyle::SOLID_LINE:
|
||||||
this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),lineWidth);
|
this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
break;
|
break;
|
||||||
case IntelliToolsettings::LineStyle::DOTTED_LINE:
|
case IntelliToolsettings::LineStyle::DOTTED_LINE:
|
||||||
QPoint p1 =lineStartingPoint.x() <= next.x() ? lineStartingPoint : next;
|
QPoint p1 =lineStartingPoint.x() <= next.x() ? lineStartingPoint : next;
|
||||||
|
|||||||
@@ -13,10 +13,6 @@ class IntelliToolLine : public IntelliTool {
|
|||||||
*/
|
*/
|
||||||
QPoint lineStartingPoint;
|
QPoint lineStartingPoint;
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief The width of the line to draw.
|
|
||||||
*/
|
|
||||||
int lineWidth;
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
this->penWidth = QInputDialog::getInt(nullptr, "Pen width", "Width:", 1,0, 50, 1);
|
|
||||||
this->ActiveType = Tooltype::PEN;
|
this->ActiveType = Tooltype::PEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ void IntelliToolPen::onMouseRightReleased(int x, int y){
|
|||||||
void IntelliToolPen::onMouseLeftPressed(int x, int y){
|
void IntelliToolPen::onMouseLeftPressed(int x, int y){
|
||||||
IntelliTool::onMouseLeftPressed(x,y);
|
IntelliTool::onMouseLeftPressed(x,y);
|
||||||
this->previousPoint=QPoint(x,y);
|
this->previousPoint=QPoint(x,y);
|
||||||
this->Canvas->image->drawPoint(previousPoint, colorPicker->getFirstColor(), penWidth);
|
this->Canvas->image->drawPoint(previousPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
Canvas->image->calculateVisiblity();
|
Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +35,7 @@ void IntelliToolPen::onMouseLeftReleased(int x, int y){
|
|||||||
void IntelliToolPen::onMouseMoved(int x, int y){
|
void IntelliToolPen::onMouseMoved(int x, int y){
|
||||||
if(this->isDrawing) {
|
if(this->isDrawing) {
|
||||||
QPoint newPoint(x,y);
|
QPoint newPoint(x,y);
|
||||||
this->Canvas->image->drawLine(this->previousPoint, newPoint, colorPicker->getFirstColor(), penWidth);
|
this->Canvas->image->drawLine(this->previousPoint, newPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->previousPoint=newPoint;
|
this->previousPoint=newPoint;
|
||||||
}
|
}
|
||||||
IntelliTool::onMouseMoved(x,y);
|
IntelliTool::onMouseMoved(x,y);
|
||||||
@@ -44,8 +43,5 @@ void IntelliToolPen::onMouseMoved(int x, int y){
|
|||||||
|
|
||||||
void IntelliToolPen::onWheelScrolled(int value){
|
void IntelliToolPen::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
IntelliTool::onWheelScrolled(value);
|
||||||
this->penWidth+=value;
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
||||||
if(this->penWidth<=0) {
|
|
||||||
this->penWidth=1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,6 @@
|
|||||||
* \brief The IntelliToolPen class represents a tool to draw a line.
|
* \brief The IntelliToolPen class represents a tool to draw a line.
|
||||||
*/
|
*/
|
||||||
class IntelliToolPen : public IntelliTool {
|
class IntelliToolPen : public IntelliTool {
|
||||||
/*!
|
|
||||||
* \brief penWidth - The width of the Pen while drawing.
|
|
||||||
*/
|
|
||||||
int penWidth;
|
|
||||||
/*!
|
/*!
|
||||||
* \brief point - Represents the previous point to help drawing a line.
|
* \brief point - Represents the previous point to help drawing a line.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Alpha Value", "Value:", 255,0,255,1);
|
|
||||||
lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",5,1,10,1);
|
|
||||||
isPointNearStart = false;
|
isPointNearStart = false;
|
||||||
isDrawing = false;
|
isDrawing = false;
|
||||||
isInside = false;
|
isInside = false;
|
||||||
@@ -37,13 +35,13 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
|||||||
isDrawing = true;
|
isDrawing = true;
|
||||||
QPointList.push_back(drawingPoint);
|
QPointList.push_back(drawingPoint);
|
||||||
|
|
||||||
this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), lineWidth);
|
this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->calculateVisiblity();
|
this->Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
else if(isDrawing && isNearStart(x,y,QPointList.front())) {
|
else if(isDrawing && isNearStart(x,y,QPointList.front())) {
|
||||||
if(QPointList.size() > 2){
|
if(QPointList.size() > 2){
|
||||||
isPointNearStart = true;
|
isPointNearStart = true;
|
||||||
this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), lineWidth);
|
this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->calculateVisiblity();
|
this->Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -57,7 +55,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
|||||||
else if(isDrawing) {
|
else if(isDrawing) {
|
||||||
QPoint drawingPoint(x,y);
|
QPoint drawingPoint(x,y);
|
||||||
QPointList.push_back(drawingPoint);
|
QPointList.push_back(drawingPoint);
|
||||||
this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), lineWidth);
|
this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->calculateVisiblity();
|
this->Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +76,7 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
|
|||||||
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
|
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
|
||||||
QPoint Point;
|
QPoint Point;
|
||||||
QColor colorTwo(colorPicker->getSecondColor());
|
QColor colorTwo(colorPicker->getSecondColor());
|
||||||
colorTwo.setAlpha(innerAlpha);
|
colorTwo.setAlpha(Toolsettings->getInnerAlpha());
|
||||||
for(int i = 0; i < activeLayer->width; i++) {
|
for(int i = 0; i < activeLayer->width; i++) {
|
||||||
for(int j = 0; j < activeLayer->height; j++) {
|
for(int j = 0; j < activeLayer->height; j++) {
|
||||||
Point = QPoint(i,j);
|
Point = QPoint(i,j);
|
||||||
@@ -89,7 +87,7 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
|
|||||||
}
|
}
|
||||||
for(int i=0; i<static_cast<int>(QPointList.size()); i++) {
|
for(int i=0; i<static_cast<int>(QPointList.size()); i++) {
|
||||||
int next = static_cast<int>((i+static_cast<int>(1))%static_cast<int>(QPointList.size()));
|
int next = static_cast<int>((i+static_cast<int>(1))%static_cast<int>(QPointList.size()));
|
||||||
this->Canvas->image->drawLine(QPointList[static_cast<unsigned long long>(i)], QPointList[static_cast<unsigned long long>(next)], colorPicker->getFirstColor(), lineWidth);
|
this->Canvas->image->drawLine(QPointList[static_cast<unsigned long long>(i)], QPointList[static_cast<unsigned long long>(next)], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
}
|
}
|
||||||
QPointList.clear();
|
QPointList.clear();
|
||||||
IntelliTool::onMouseLeftReleased(x,y);
|
IntelliTool::onMouseLeftReleased(x,y);
|
||||||
@@ -103,12 +101,7 @@ void IntelliToolPolygon::onMouseRightReleased(int x, int y){
|
|||||||
void IntelliToolPolygon::onWheelScrolled(int value){
|
void IntelliToolPolygon::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
IntelliTool::onWheelScrolled(value);
|
||||||
if(!isDrawing) {
|
if(!isDrawing) {
|
||||||
if(lineWidth + value < 10) {
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value);
|
||||||
lineWidth += value;
|
|
||||||
}
|
|
||||||
if(lineWidth < 1) {
|
|
||||||
lineWidth = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,6 @@ class IntelliToolPolygon : public IntelliTool
|
|||||||
*/
|
*/
|
||||||
bool isNearStart(int x, int y, QPoint Startpoint);
|
bool isNearStart(int x, int y, QPoint Startpoint);
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief LineWidth of the drawing polygon.
|
|
||||||
*/
|
|
||||||
int lineWidth;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief IsDrawing true while drawing, else false.
|
* \brief IsDrawing true while drawing, else false.
|
||||||
*/
|
*/
|
||||||
@@ -39,11 +34,6 @@ bool isInside;
|
|||||||
*/
|
*/
|
||||||
bool isPointNearStart;
|
bool isPointNearStart;
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief The alpha value of the inner circle.
|
|
||||||
*/
|
|
||||||
int innerAlpha;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief QPointList list of all points of the polygon.
|
* \brief QPointList list of all points of the polygon.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Alpha Value", "Value:", 0,0,255,1);
|
|
||||||
this->borderWidth = QInputDialog::getInt(nullptr,"Outer edge width", "Value:", 0,1,255,1);
|
|
||||||
this->ActiveType = Tooltype::RECTANGLE;
|
this->ActiveType = Tooltype::RECTANGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,14 +19,14 @@ void IntelliToolRectangle::drawRectangle(QPoint otherCorner){
|
|||||||
int yMax = std::max(originCorner.y(), otherCorner.y());
|
int yMax = std::max(originCorner.y(), otherCorner.y());
|
||||||
|
|
||||||
QColor clr = colorPicker->getSecondColor();
|
QColor clr = colorPicker->getSecondColor();
|
||||||
clr.setAlpha(innerAlpha);
|
clr.setAlpha(Toolsettings->getInnerAlpha());
|
||||||
for(int y=yMin; y<=yMax; y++) {
|
for(int y=yMin; y<=yMax; y++) {
|
||||||
this->Canvas->image->drawLine(QPoint(xMin,y), QPoint(xMax, y), clr, 1);
|
this->Canvas->image->drawLine(QPoint(xMin,y), QPoint(xMax, y), clr, 1);
|
||||||
}
|
}
|
||||||
this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), borderWidth);
|
this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), borderWidth);
|
this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), borderWidth);
|
this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), borderWidth);
|
this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolRectangle::onMouseRightPressed(int x, int y){
|
void IntelliToolRectangle::onMouseRightPressed(int x, int y){
|
||||||
@@ -61,8 +59,5 @@ void IntelliToolRectangle::onMouseMoved(int x, int y){
|
|||||||
|
|
||||||
void IntelliToolRectangle::onWheelScrolled(int value){
|
void IntelliToolRectangle::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
IntelliTool::onWheelScrolled(value);
|
||||||
this->borderWidth+=value;
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
||||||
if(this->borderWidth<=0) {
|
|
||||||
this->borderWidth=1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,6 @@ void drawRectangle(QPoint otherCorner);
|
|||||||
* \brief origincorner - The first corner point of the rectangle.
|
* \brief origincorner - The first corner point of the rectangle.
|
||||||
*/
|
*/
|
||||||
QPoint originCorner;
|
QPoint originCorner;
|
||||||
/*!
|
|
||||||
* \brief alphaInner- Represents the alpha value of the inside.
|
|
||||||
*/
|
|
||||||
int innerAlpha;
|
|
||||||
/*!
|
|
||||||
* \brief edgeWidth - The width of the rectangle edges.
|
|
||||||
*/
|
|
||||||
int borderWidth;
|
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief A constructor setting the general paintingArea and colorPicker. And reading in the alphaInner and edgeWidth.
|
* \brief A constructor setting the general paintingArea and colorPicker. And reading in the alphaInner and edgeWidth.
|
||||||
|
|||||||
Reference in New Issue
Block a user