mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-14 20:30:32 +02:00
ToolSettings
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#include "IntelliTool.h"
|
||||
#include "Layer/PaintingArea.h"
|
||||
|
||||
IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker){
|
||||
IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){
|
||||
this->Area=Area;
|
||||
this->colorPicker=colorPicker;
|
||||
this->Toolsettings=Toolsettings;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define Intelli_Tool_H
|
||||
|
||||
#include "IntelliHelper/IntelliColorPicker.h"
|
||||
#include "IntelliHelper/IntelliToolsettings.h"
|
||||
#include <vector>
|
||||
|
||||
struct LayerObject;
|
||||
@@ -49,6 +50,8 @@ Tooltype ActiveType;
|
||||
*/
|
||||
IntelliColorPicker* colorPicker;
|
||||
|
||||
IntelliToolsettings* Toolsettings;
|
||||
|
||||
/*!
|
||||
* \brief A pointer to the underlying active Layer, do not work on this. This is used for data grabbing or previews.
|
||||
*/
|
||||
@@ -70,7 +73,7 @@ public:
|
||||
* \param Area - The general PaintingArea used by the project.
|
||||
* \param colorPicker - The general colorPicker used by the project.
|
||||
*/
|
||||
IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||
IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
|
||||
/*!
|
||||
* \brief An abstract Destructor.
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#include "QInputDialog"
|
||||
#include <cmath>
|
||||
|
||||
IntelliToolCircle::IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker)
|
||||
: IntelliTool(Area, colorPicker){
|
||||
IntelliToolCircle::IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* 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;
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
* \param Area - The general paintingArea used by the project.
|
||||
* \param colorPicker - The general colorPicker used by the project.
|
||||
*/
|
||||
IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||
IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
|
||||
/*!
|
||||
* \brief A Destructor.
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include <functional>
|
||||
#include <queue>
|
||||
|
||||
IntelliToolFloodFill::IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker)
|
||||
: IntelliTool(Area, colorPicker){
|
||||
IntelliToolFloodFill::IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||
this->ActiveType = Tooltype::FLOODFILL;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
* \param Area - The general paintingArea used by the project.
|
||||
* \param colorPicker - The general colorPicker used by the project.
|
||||
*/
|
||||
IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||
IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
|
||||
/*!
|
||||
* \brief A Destructor.
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
#include "QColorDialog"
|
||||
#include "QInputDialog"
|
||||
|
||||
IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker)
|
||||
: IntelliTool(Area, colorPicker){
|
||||
IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||
this->lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
|
||||
this->ActiveType = Tooltype::LINE;
|
||||
//create checkbox or scroll dialog to get line style
|
||||
this->lineStyle = LineStyle::SOLID_LINE;
|
||||
}
|
||||
|
||||
IntelliToolLine::~IntelliToolLine(){
|
||||
@@ -46,11 +44,11 @@ void IntelliToolLine::onMouseMoved(int x, int y){
|
||||
if(this->isDrawing) {
|
||||
this->Canvas->image->drawPlain(Qt::transparent);
|
||||
QPoint next(x,y);
|
||||
switch(lineStyle) {
|
||||
case LineStyle::SOLID_LINE:
|
||||
switch(Toolsettings->getLinestyle()) {
|
||||
case IntelliToolsettings::LineStyle::SOLID_LINE:
|
||||
this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),lineWidth);
|
||||
break;
|
||||
case LineStyle::DOTTED_LINE:
|
||||
case IntelliToolsettings::LineStyle::DOTTED_LINE:
|
||||
QPoint p1 =lineStartingPoint.x() <= next.x() ? lineStartingPoint : next;
|
||||
QPoint p2 =lineStartingPoint.x() < next.x() ? next : lineStartingPoint;
|
||||
int m = static_cast<int>(static_cast<float>(p2.y()-p1.y())/static_cast<float>(p2.x()-p1.x())+0.5f);
|
||||
|
||||
@@ -4,14 +4,6 @@
|
||||
|
||||
#include "QPoint"
|
||||
|
||||
/*!
|
||||
* \brief The LineStyle enum classifing all ways of drawing a line.
|
||||
*/
|
||||
enum class LineStyle {
|
||||
SOLID_LINE,
|
||||
DOTTED_LINE
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief The IntelliToolFloodFill class represents a tool to draw a line.
|
||||
*/
|
||||
@@ -25,11 +17,6 @@ QPoint lineStartingPoint;
|
||||
* \brief The width of the line to draw.
|
||||
*/
|
||||
int lineWidth;
|
||||
|
||||
/*!
|
||||
* \brief The style of the line. Apropriate to LineStyle.
|
||||
*/
|
||||
LineStyle lineStyle;
|
||||
public:
|
||||
|
||||
/*!
|
||||
@@ -37,7 +24,7 @@ public:
|
||||
* \param Area - The general paintingArea used by the project.
|
||||
* \param colorPicker - The general colorPicker used by the project.
|
||||
*/
|
||||
IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||
IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
|
||||
/*!
|
||||
* \brief An abstract Destructor.
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "QColorDialog"
|
||||
#include "QInputDialog"
|
||||
|
||||
IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker)
|
||||
: IntelliTool(Area, colorPicker){
|
||||
IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||
this->penWidth = QInputDialog::getInt(nullptr, "Pen width", "Width:", 1,0, 50, 1);
|
||||
this->ActiveType = Tooltype::PEN;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
* \param Area - The general PaintingArea used by the project.
|
||||
* \param colorPicker - The general colorPicker used by the project.
|
||||
*/
|
||||
IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||
IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
/*!
|
||||
* \brief A Destructor.
|
||||
*/
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include "Layer/PaintingArea.h"
|
||||
#include "QColorDialog"
|
||||
|
||||
IntelliToolPlainTool::IntelliToolPlainTool(PaintingArea* Area, IntelliColorPicker* colorPicker)
|
||||
: IntelliTool(Area, colorPicker){
|
||||
IntelliToolPlainTool::IntelliToolPlainTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||
this->ActiveType = Tooltype::PLAIN;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public:
|
||||
* \param Area - The general paintingArea used by the project.
|
||||
* \param colorPicker - The general colorPicker used by the project.
|
||||
*/
|
||||
IntelliToolPlainTool(PaintingArea*Area, IntelliColorPicker* colorPicker);
|
||||
IntelliToolPlainTool(PaintingArea*Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
/*!
|
||||
* \brief A Destructor.
|
||||
*/
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include <QInputDialog>
|
||||
#include <QDebug>
|
||||
|
||||
IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker)
|
||||
: IntelliTool(Area, colorPicker){
|
||||
IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* 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;
|
||||
@@ -22,9 +22,9 @@ IntelliToolPolygon::~IntelliToolPolygon(){
|
||||
|
||||
void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
||||
if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::Shaped_Image && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()){
|
||||
std::vector<Triangle> Triangles = IntelliHelper::calculateTriangles(Area->getPolygonDataOfRealLayer());
|
||||
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer());
|
||||
QPoint Point(x,y);
|
||||
isInside = IntelliHelper::isInPolygon(Triangles,Point);
|
||||
isInside = IntelliTriangulation::isInPolygon(Triangles,Point);
|
||||
}
|
||||
else if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::Raster_Image && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()){
|
||||
isInside = true;
|
||||
@@ -75,14 +75,14 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
|
||||
isInside = false;
|
||||
isPointNearStart = false;
|
||||
isDrawing = false;
|
||||
std::vector<Triangle> Triangles = IntelliHelper::calculateTriangles(QPointList);
|
||||
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
|
||||
QPoint Point;
|
||||
QColor colorTwo(colorPicker->getSecondColor());
|
||||
colorTwo.setAlpha(innerAlpha);
|
||||
for(int i = 0; i < activeLayer->width; i++) {
|
||||
for(int j = 0; j < activeLayer->height; j++) {
|
||||
Point = QPoint(i,j);
|
||||
if(IntelliHelper::isInPolygon(Triangles,Point)) {
|
||||
if(IntelliTriangulation::isInPolygon(Triangles,Point)) {
|
||||
this->Canvas->image->drawPixel(Point, colorTwo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define INTELLITOOLPOLYGON_H
|
||||
|
||||
#include "IntelliTool.h"
|
||||
#include "IntelliHelper/IntelliHelper.h"
|
||||
#include "IntelliHelper/IntelliTriangulation.h"
|
||||
#include <vector>
|
||||
#include <QPoint>
|
||||
/*!
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
* \param Area - The general paintingArea used by the project.
|
||||
* \param colorPicker - The general colorPicker used by the project.
|
||||
*/
|
||||
IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||
IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
/*!
|
||||
* \brief A Destructor.
|
||||
*/
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include "Layer/PaintingArea.h"
|
||||
#include "QInputDialog"
|
||||
|
||||
IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker)
|
||||
: IntelliTool(Area, colorPicker){
|
||||
IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* 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;
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
* \param Area - The general paintingArea used by the project.
|
||||
* \param colorPicker - The general colorPicker used by the project.
|
||||
*/
|
||||
IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||
IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
/*!
|
||||
* \brief A Destructor.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user