mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-15 04:40:37 +02:00
Minor Code Style Update + Documentation Spelling Fix
This commit is contained in:
@@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
// IntelliPhotoGui constructor
|
// IntelliPhotoGui constructor
|
||||||
IntelliPhotoGui::IntelliPhotoGui(){
|
IntelliPhotoGui::IntelliPhotoGui(){
|
||||||
//create Gui elements and lay them out
|
// create Gui elements and lay them out
|
||||||
createGui();
|
createGui();
|
||||||
// Create actions
|
// Create actions
|
||||||
createActions();
|
createActions();
|
||||||
//create Menus
|
// create Menus
|
||||||
createMenus();
|
createMenus();
|
||||||
//set style of the gui
|
// set style of the gui
|
||||||
setIntelliStyle();
|
setIntelliStyle();
|
||||||
// Size the app
|
// Size the app
|
||||||
showMaximized();
|
showMaximized();
|
||||||
@@ -69,7 +69,7 @@ void IntelliPhotoGui::slotCreateNewLayer(){
|
|||||||
// Stores button value
|
// Stores button value
|
||||||
bool ok1, ok2;
|
bool ok1, ok2;
|
||||||
|
|
||||||
// tr("New Layer") is the title
|
// "New Layer" is the title of the window
|
||||||
// the next tr is the text to display
|
// the next tr is the text to display
|
||||||
// Define the standard Value, min, max, step and ok button
|
// Define the standard Value, min, max, step and ok button
|
||||||
int width = QInputDialog::getInt(this, tr("New Layer"),
|
int width = QInputDialog::getInt(this, tr("New Layer"),
|
||||||
@@ -91,7 +91,7 @@ void IntelliPhotoGui::slotDeleteLayer(){
|
|||||||
// Stores button value
|
// Stores button value
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
// tr("delete Layer") is the title
|
// "delete Layer" is the title of the window
|
||||||
// the next tr is the text to display
|
// the next tr is the text to display
|
||||||
// Define the standard Value, min, max, step and ok button
|
// Define the standard Value, min, max, step and ok button
|
||||||
int layerNumber = QInputDialog::getInt(this, tr("delete Layer"),
|
int layerNumber = QInputDialog::getInt(this, tr("delete Layer"),
|
||||||
@@ -114,13 +114,13 @@ void IntelliPhotoGui::slotSetActiveAlpha(){
|
|||||||
// Stores button value
|
// Stores button value
|
||||||
bool ok1, ok2;
|
bool ok1, ok2;
|
||||||
|
|
||||||
// tr("Layer to set on") is the title
|
// "Layer to set on" is the title of the window
|
||||||
// the next tr is the text to display
|
// the next tr is the text to display
|
||||||
// Define the standard Value, min, max, step and ok button
|
// Define the standard Value, min, max, step and ok button
|
||||||
int layer = QInputDialog::getInt(this, tr("Layer to set on"),
|
int layer = QInputDialog::getInt(this, tr("Layer to set on"),
|
||||||
tr("Layer:"),
|
tr("Layer:"),
|
||||||
-1,-1,100,1, &ok1);
|
-1,-1,100,1, &ok1);
|
||||||
// tr("New Alpha") is the title
|
// "New Alpha" is the title of the window
|
||||||
int alpha = QInputDialog::getInt(this, tr("New Alpha"),
|
int alpha = QInputDialog::getInt(this, tr("New Alpha"),
|
||||||
tr("Alpha:"),
|
tr("Alpha:"),
|
||||||
255,0, 255, 1, &ok2);
|
255,0, 255, 1, &ok2);
|
||||||
@@ -164,21 +164,21 @@ void IntelliPhotoGui::slotClearActiveLayer(){
|
|||||||
// Stores button value
|
// Stores button value
|
||||||
bool ok1, ok2, ok3, ok4;
|
bool ok1, ok2, ok3, ok4;
|
||||||
|
|
||||||
// tr("Red Input") is the title
|
// "Red Input" is the title of the window
|
||||||
// the next tr is the text to display
|
// the next tr is the text to display
|
||||||
// Define the standard Value, min, max, step and ok button
|
// Define the standard Value, min, max, step and ok button
|
||||||
int red = QInputDialog::getInt(this, tr("Red Input"),
|
int red = QInputDialog::getInt(this, tr("Red Input"),
|
||||||
tr("Red:"),
|
tr("Red:"),
|
||||||
255,0, 255,1, &ok1);
|
255,0, 255,1, &ok1);
|
||||||
// tr("Green Input") is the title
|
// "Green Input" is the title of the window
|
||||||
int green = QInputDialog::getInt(this, tr("Green Input"),
|
int green = QInputDialog::getInt(this, tr("Green Input"),
|
||||||
tr("Green:"),
|
tr("Green:"),
|
||||||
255,0, 255, 1, &ok2);
|
255,0, 255, 1, &ok2);
|
||||||
// tr("Blue Input") is the title
|
// "Blue Input" is the title of the window
|
||||||
int blue = QInputDialog::getInt(this, tr("Blue Input"),
|
int blue = QInputDialog::getInt(this, tr("Blue Input"),
|
||||||
tr("Blue:"),
|
tr("Blue:"),
|
||||||
255,0, 255, 1, &ok3);
|
255,0, 255, 1, &ok3);
|
||||||
// tr("Alpha Input") is the title
|
// "Alpha Input" is the title of the window
|
||||||
int alpha = QInputDialog::getInt(this, tr("Alpha Input"),
|
int alpha = QInputDialog::getInt(this, tr("Alpha Input"),
|
||||||
tr("Alpha:"),
|
tr("Alpha:"),
|
||||||
255,0, 255, 1, &ok4);
|
255,0, 255, 1, &ok4);
|
||||||
@@ -192,7 +192,7 @@ void IntelliPhotoGui::slotSetActiveLayer(){
|
|||||||
// Stores button value
|
// Stores button value
|
||||||
bool ok1;
|
bool ok1;
|
||||||
|
|
||||||
// tr("Layer to set on") is the title
|
// "Layer to set on" is the title of the window
|
||||||
// the next tr is the text to display
|
// the next tr is the text to display
|
||||||
// Define the standard Value, min, max, step and ok button
|
// Define the standard Value, min, max, step and ok button
|
||||||
int layer = QInputDialog::getInt(this, tr("Layer to set on"),
|
int layer = QInputDialog::getInt(this, tr("Layer to set on"),
|
||||||
@@ -400,25 +400,25 @@ void IntelliPhotoGui::createMenus(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::createGui(){
|
void IntelliPhotoGui::createGui(){
|
||||||
//create a central widget to work on
|
// create a central widget to work on
|
||||||
centralGuiWidget = new QWidget(this);
|
centralGuiWidget = new QWidget(this);
|
||||||
setCentralWidget(centralGuiWidget);
|
setCentralWidget(centralGuiWidget);
|
||||||
|
|
||||||
//create the grid for the layout
|
// create the grid for the layout
|
||||||
mainLayout = new QGridLayout(centralGuiWidget);
|
mainLayout = new QGridLayout(centralGuiWidget);
|
||||||
centralGuiWidget->setLayout(mainLayout);
|
centralGuiWidget->setLayout(mainLayout);
|
||||||
|
|
||||||
//create Gui elements
|
// create Gui elements
|
||||||
paintingArea = new PaintingArea();
|
paintingArea = new PaintingArea();
|
||||||
|
|
||||||
//set gui elements
|
// set gui elements
|
||||||
mainLayout->addWidget(paintingArea);
|
mainLayout->addWidget(paintingArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::setIntelliStyle(){
|
void IntelliPhotoGui::setIntelliStyle(){
|
||||||
// Set the title
|
// Set the title
|
||||||
setWindowTitle("IntelliPhoto Prototype");
|
setWindowTitle("IntelliPhoto Prototype");
|
||||||
//set style sheet
|
// Set style sheet
|
||||||
this->setStyleSheet("background-color:rgb(64,64,64)");
|
this->setStyleSheet("background-color:rgb(64,64,64)");
|
||||||
this->centralGuiWidget->setStyleSheet("color:rgb(255,255,255)");
|
this->centralGuiWidget->setStyleSheet("color:rgb(255,255,255)");
|
||||||
this->menuBar()->setStyleSheet("color:rgb(255,255,255)");
|
this->menuBar()->setStyleSheet("color:rgb(255,255,255)");
|
||||||
@@ -427,11 +427,11 @@ void IntelliPhotoGui::setIntelliStyle(){
|
|||||||
bool IntelliPhotoGui::maybeSave(){
|
bool IntelliPhotoGui::maybeSave(){
|
||||||
// Check for changes since last save
|
// Check for changes since last save
|
||||||
|
|
||||||
//TODO insert variable for modified status here to make an save exit message
|
// TODO insert variable for modified status here to make an save exit message
|
||||||
if (false) {
|
if (false) {
|
||||||
QMessageBox::StandardButton ret;
|
QMessageBox::StandardButton ret;
|
||||||
|
|
||||||
// Painting is the title
|
// Painting is the title of the window
|
||||||
// Add text and the buttons
|
// Add text and the buttons
|
||||||
ret = QMessageBox::warning(this, tr("Painting"),
|
ret = QMessageBox::warning(this, tr("Painting"),
|
||||||
tr("The image has been modified.\n"
|
tr("The image has been modified.\n"
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ protected:
|
|||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//meta slots here (need further )
|
// meta slots here (need further )
|
||||||
void slotOpen();
|
void slotOpen();
|
||||||
void slotSave();
|
void slotSave();
|
||||||
|
|
||||||
//layer slots here
|
// layer slots here
|
||||||
void slotCreateNewLayer();
|
void slotCreateNewLayer();
|
||||||
void slotDeleteLayer();
|
void slotDeleteLayer();
|
||||||
void slotClearActiveLayer();
|
void slotClearActiveLayer();
|
||||||
@@ -46,26 +46,26 @@ private slots:
|
|||||||
void slotMoveLayerUp();
|
void slotMoveLayerUp();
|
||||||
void slotMoveLayerDown();
|
void slotMoveLayerDown();
|
||||||
|
|
||||||
//color Picker slots here
|
// color Picker slots here
|
||||||
void slotSetFirstColor();
|
void slotSetFirstColor();
|
||||||
void slotSetSecondColor();
|
void slotSetSecondColor();
|
||||||
void slotSwitchColor();
|
void slotSwitchColor();
|
||||||
|
|
||||||
//tool slots here
|
// tool slots here
|
||||||
void slotCreatePenTool();
|
void slotCreatePenTool();
|
||||||
void slotCreatePlainTool();
|
void slotCreatePlainTool();
|
||||||
void slotCreateLineTool();
|
void slotCreateLineTool();
|
||||||
|
|
||||||
//slots for dialogs
|
// slots for dialogs
|
||||||
void slotAboutDialog();
|
void slotAboutDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Will tie user actions to functions
|
// Will tie user actions to functions
|
||||||
void createActions();
|
void createActions();
|
||||||
void createMenus();
|
void createMenus();
|
||||||
//setup GUI elements
|
// setup GUI elements
|
||||||
void createGui();
|
void createGui();
|
||||||
//set style of the GUI
|
// set style of the GUI
|
||||||
void setIntelliStyle();
|
void setIntelliStyle();
|
||||||
|
|
||||||
|
|
||||||
@@ -87,26 +87,25 @@ private:
|
|||||||
QMenu *helpMenu;
|
QMenu *helpMenu;
|
||||||
|
|
||||||
// All the actions that can occur
|
// All the actions that can occur
|
||||||
|
// meta image actions (need further modularisation)
|
||||||
//meta image actions (need further modularisation)
|
|
||||||
QAction *actionOpen;
|
QAction *actionOpen;
|
||||||
QAction *actionExit;
|
QAction *actionExit;
|
||||||
|
|
||||||
//color Picker actions
|
// color Picker actions
|
||||||
QAction *actionColorPickerFirstColor;
|
QAction *actionColorPickerFirstColor;
|
||||||
QAction *actionColorPickerSecondColor;
|
QAction *actionColorPickerSecondColor;
|
||||||
QAction *actionColorSwitch;
|
QAction *actionColorSwitch;
|
||||||
|
|
||||||
//tool actions
|
// tool actions
|
||||||
QAction *actionCreatePenTool;
|
QAction *actionCreatePenTool;
|
||||||
QAction *actionCreatePlainTool;
|
QAction *actionCreatePlainTool;
|
||||||
QAction *actionCreateLineTool;
|
QAction *actionCreateLineTool;
|
||||||
|
|
||||||
//dialog actions
|
// dialog actions
|
||||||
QAction *actionAboutDialog;
|
QAction *actionAboutDialog;
|
||||||
QAction *actionAboutQtDialog;
|
QAction *actionAboutQtDialog;
|
||||||
|
|
||||||
//layer change actions
|
// layer change actions
|
||||||
QAction *actionCreateNewLayer;
|
QAction *actionCreateNewLayer;
|
||||||
QAction *actionDeleteLayer;
|
QAction *actionDeleteLayer;
|
||||||
QAction* actionSetActiveLayer;
|
QAction* actionSetActiveLayer;
|
||||||
@@ -121,10 +120,9 @@ private:
|
|||||||
// Actions tied to specific file formats
|
// Actions tied to specific file formats
|
||||||
QList<QAction *> actionSaveAs;
|
QList<QAction *> actionSaveAs;
|
||||||
|
|
||||||
//main GUI elements
|
// main GUI elements
|
||||||
QWidget* centralGuiWidget;
|
QWidget* centralGuiWidget;
|
||||||
QGridLayout *mainLayout;
|
QGridLayout *mainLayout;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& co
|
|||||||
|
|
||||||
// Draw a line from the last registered point to the current
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawLine(p1, p2);
|
painter.drawLine(p1, p2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::drawPlain(const QColor& color){
|
void IntelliImage::drawPlain(const QColor& color){
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ IntelliImage* IntelliRasterImage::getDeepCopy(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliRasterImage::calculateVisiblity(){
|
void IntelliRasterImage::calculateVisiblity(){
|
||||||
//not used in raster image
|
// not used in raster image
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage IntelliRasterImage::getDisplayable(int alpha){
|
QImage IntelliRasterImage::getDisplayable(int alpha){
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
class IntelliColorPicker{
|
class IntelliColorPicker{
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief IntelliColorPicker construktor, setting 2 preset colors, be careful, theese color may change in production.
|
* \brief IntelliColorPicker constructor, setting 2 preset colors, be careful, theese color may change in production.
|
||||||
*/
|
*/
|
||||||
IntelliColorPicker();
|
IntelliColorPicker();
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
std::vector<Triangle> IntelliHelper::calculateTriangles(std::vector<QPoint> polyPoints){
|
std::vector<Triangle> IntelliHelper::calculateTriangles(std::vector<QPoint> polyPoints){
|
||||||
//helper for managing the triangle vertices and their state
|
// helper for managing the triangle vertices and their state
|
||||||
struct TriangleHelper{
|
struct TriangleHelper{
|
||||||
QPoint vertex;
|
QPoint vertex;
|
||||||
float interiorAngle;
|
float interiorAngle;
|
||||||
@@ -13,7 +13,7 @@ std::vector<Triangle> IntelliHelper::calculateTriangles(std::vector<QPoint> poly
|
|||||||
bool isTip;
|
bool isTip;
|
||||||
};
|
};
|
||||||
|
|
||||||
//calculates the inner angle of 'point'
|
// calculates the inner angle of 'point'
|
||||||
auto calculateInner = [](QPoint& point, QPoint& prev, QPoint& post){
|
auto calculateInner = [](QPoint& point, QPoint& prev, QPoint& post){
|
||||||
QPoint AP(point.x()-prev.x(), point.y()-prev.y());
|
QPoint AP(point.x()-prev.x(), point.y()-prev.y());
|
||||||
QPoint BP(point.x()-post.x(), point.y()-post.y());
|
QPoint BP(point.x()-post.x(), point.y()-post.y());
|
||||||
@@ -23,7 +23,7 @@ std::vector<Triangle> IntelliHelper::calculateTriangles(std::vector<QPoint> poly
|
|||||||
return acos(topSclar/absolute);
|
return acos(topSclar/absolute);
|
||||||
};
|
};
|
||||||
|
|
||||||
//gets the first element of vec for which element.isTip == true holds
|
// gets the first element of vec for which element.isTip == true holds
|
||||||
auto getTip= [](const std::vector<TriangleHelper>& vec){
|
auto getTip= [](const std::vector<TriangleHelper>& vec){
|
||||||
for(auto element:vec){
|
for(auto element:vec){
|
||||||
if(element.isTip){
|
if(element.isTip){
|
||||||
@@ -33,17 +33,17 @@ std::vector<Triangle> IntelliHelper::calculateTriangles(std::vector<QPoint> poly
|
|||||||
return vec[0];
|
return vec[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
//get the vertex Index bevor index in relation to the container length
|
// get the vertex Index bevor index in relation to the container length
|
||||||
auto getPrev = [](int index, int length){
|
auto getPrev = [](int index, int length){
|
||||||
return (index-1)>0?(index-1):(length-1);
|
return (index-1)>0?(index-1):(length-1);
|
||||||
};
|
};
|
||||||
|
|
||||||
//get the vertex Index after index in relation to the container lenght
|
// get the vertex Index after index in relation to the container lenght
|
||||||
auto getPost = [](int index, int length){
|
auto getPost = [](int index, int length){
|
||||||
return (index+1)%length;
|
return (index+1)%length;
|
||||||
};
|
};
|
||||||
|
|
||||||
//return if the vertex is a tip
|
// return if the vertex is a tip
|
||||||
auto isTip = [](float angle){
|
auto isTip = [](float angle){
|
||||||
return angle<180.f;
|
return angle<180.f;
|
||||||
};
|
};
|
||||||
@@ -51,7 +51,7 @@ std::vector<Triangle> IntelliHelper::calculateTriangles(std::vector<QPoint> poly
|
|||||||
std::vector<TriangleHelper> Vertices;
|
std::vector<TriangleHelper> Vertices;
|
||||||
std::vector<Triangle> Triangles;
|
std::vector<Triangle> Triangles;
|
||||||
|
|
||||||
//set up all vertices and calculate intirior angle
|
// set up all vertices and calculate intirior angle
|
||||||
for(int i=0; i<static_cast<int>(polyPoints.size()); i++){
|
for(int i=0; i<static_cast<int>(polyPoints.size()); i++){
|
||||||
TriangleHelper helper;
|
TriangleHelper helper;
|
||||||
int prev = getPrev(i, static_cast<int>(polyPoints.size()));
|
int prev = getPrev(i, static_cast<int>(polyPoints.size()));
|
||||||
@@ -67,48 +67,47 @@ std::vector<Triangle> IntelliHelper::calculateTriangles(std::vector<QPoint> poly
|
|||||||
Vertices.push_back(helper);
|
Vertices.push_back(helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
//search triangles based on the intirior angles of each vertey
|
// search triangles based on the intirior angles of each vertey
|
||||||
while(Triangles.size() != polyPoints.size()-2){
|
while(Triangles.size() != polyPoints.size()-2){
|
||||||
Triangle tri;
|
Triangle tri;
|
||||||
TriangleHelper smallest = getTip(Vertices);
|
TriangleHelper smallest = getTip(Vertices);
|
||||||
int prev = getPrev(smallest.index, static_cast<int>(Vertices.size()));
|
int prev = getPrev(smallest.index, static_cast<int>(Vertices.size()));
|
||||||
int post = getPost(smallest.index, static_cast<int>(Vertices.size()));
|
int post = getPost(smallest.index, static_cast<int>(Vertices.size()));
|
||||||
|
|
||||||
//set triangle and push it
|
// set triangle and push it
|
||||||
tri.A = Vertices[static_cast<size_t>(prev)].vertex;
|
tri.A = Vertices[static_cast<size_t>(prev)].vertex;
|
||||||
tri.B = Vertices[static_cast<size_t>(smallest.index)].vertex;
|
tri.B = Vertices[static_cast<size_t>(smallest.index)].vertex;
|
||||||
tri.C = Vertices[static_cast<size_t>(post)].vertex;
|
tri.C = Vertices[static_cast<size_t>(post)].vertex;
|
||||||
Triangles.push_back(tri);
|
Triangles.push_back(tri);
|
||||||
|
|
||||||
//update Vertice array
|
// update Vertice array
|
||||||
Vertices.erase(Vertices.begin()+smallest.index);
|
Vertices.erase(Vertices.begin()+smallest.index);
|
||||||
for(size_t i=static_cast<size_t>(smallest.index); i<Vertices.size(); i++){
|
for(size_t i=static_cast<size_t>(smallest.index); i<Vertices.size(); i++){
|
||||||
Vertices[i].index-=1;
|
Vertices[i].index-=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//update post und prev index
|
// update post und prev index
|
||||||
post = post-1;
|
post = post-1;
|
||||||
prev = prev<smallest.index?prev:(prev-1);
|
prev = prev<smallest.index?prev:(prev-1);
|
||||||
|
|
||||||
//calcultae neighboors of prev and post to calculate new interior angles
|
// calcultae neighboors of prev and post to calculate new interior angles
|
||||||
int prevOfPrev = getPrev(prev, static_cast<int>(Vertices.size()));
|
int prevOfPrev = getPrev(prev, static_cast<int>(Vertices.size()));
|
||||||
int postOfPrev = getPost(prev, static_cast<int>(Vertices.size()));
|
int postOfPrev = getPost(prev, static_cast<int>(Vertices.size()));
|
||||||
|
|
||||||
int prevOfPost = getPrev(post, static_cast<int>(Vertices.size()));
|
int prevOfPost = getPrev(post, static_cast<int>(Vertices.size()));
|
||||||
int postOfPost = getPost(post, static_cast<int>(Vertices.size()));
|
int postOfPost = getPost(post, static_cast<int>(Vertices.size()));
|
||||||
|
|
||||||
//update vertices with interior angles
|
// update vertices with interior angles
|
||||||
//updtae prev
|
// updtae prev
|
||||||
Vertices[static_cast<size_t>(prev)].interiorAngle = calculateInner(Vertices[static_cast<size_t>(prev)].vertex,
|
Vertices[static_cast<size_t>(prev)].interiorAngle = calculateInner(Vertices[static_cast<size_t>(prev)].vertex,
|
||||||
Vertices[static_cast<size_t>(prevOfPrev)].vertex,
|
Vertices[static_cast<size_t>(prevOfPrev)].vertex,
|
||||||
Vertices[static_cast<size_t>(postOfPrev)].vertex);
|
Vertices[static_cast<size_t>(postOfPrev)].vertex);
|
||||||
Vertices[static_cast<size_t>(prev)].isTip = isTip(Vertices[static_cast<size_t>(prev)].interiorAngle);
|
Vertices[static_cast<size_t>(prev)].isTip = isTip(Vertices[static_cast<size_t>(prev)].interiorAngle);
|
||||||
//update post
|
// update post
|
||||||
Vertices[static_cast<size_t>(post)].interiorAngle = calculateInner(Vertices[static_cast<size_t>(post)].vertex,
|
Vertices[static_cast<size_t>(post)].interiorAngle = calculateInner(Vertices[static_cast<size_t>(post)].vertex,
|
||||||
Vertices[static_cast<size_t>(prevOfPost)].vertex,
|
Vertices[static_cast<size_t>(prevOfPost)].vertex,
|
||||||
Vertices[static_cast<size_t>(postOfPost)].vertex);
|
Vertices[static_cast<size_t>(postOfPost)].vertex);
|
||||||
Vertices[static_cast<size_t>(post)].isTip = isTip(Vertices[static_cast<size_t>(post)].interiorAngle);
|
Vertices[static_cast<size_t>(post)].isTip = isTip(Vertices[static_cast<size_t>(post)].interiorAngle);
|
||||||
|
|
||||||
}
|
}
|
||||||
return Triangles;
|
return Triangles;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ struct Triangle{
|
|||||||
QPoint A,B,C;
|
QPoint A,B,C;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
namespace IntelliHelper {
|
namespace IntelliHelper {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -59,7 +58,6 @@ namespace IntelliHelper {
|
|||||||
* \return Returns true if the point lies in the üpolygon, otherwise false.
|
* \return Returns true if the point lies in the üpolygon, otherwise false.
|
||||||
*/
|
*/
|
||||||
bool isInPolygon(std::vector<Triangle> &triangles, QPoint &point);
|
bool isInPolygon(std::vector<Triangle> &triangles, QPoint &point);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
|
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
|
||||||
:QWidget(parent){
|
:QWidget(parent){
|
||||||
//test yout tool here and reset after accomplished test
|
// Testing Area
|
||||||
|
// test yout tool here and reset after accomplished test
|
||||||
this->Tool = new IntelliToolFloodFill(this, &colorPicker);
|
this->Tool = new IntelliToolFloodFill(this, &colorPicker);
|
||||||
this->setUp(maxWidth, maxHeight);
|
this->setUp(maxWidth, maxHeight);
|
||||||
//tetsing
|
|
||||||
this->addLayer(200,200,0,0,ImageType::Shaped_Image);
|
this->addLayer(200,200,0,0,ImageType::Shaped_Image);
|
||||||
layerBundle[0].image->drawPlain(QColor(255,0,0,255));
|
layerBundle[0].image->drawPlain(QColor(255,0,0,255));
|
||||||
std::vector<QPoint> polygon;
|
std::vector<QPoint> polygon;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "Tool/IntelliTool.h"
|
#include "Tool/IntelliTool.h"
|
||||||
#include "IntelliHelper/IntelliColorPicker.h"
|
#include "IntelliHelper/IntelliColorPicker.h"
|
||||||
|
|
||||||
|
|
||||||
struct LayerObject{
|
struct LayerObject{
|
||||||
IntelliImage* image;
|
IntelliImage* image;
|
||||||
int width;
|
int width;
|
||||||
@@ -58,7 +57,6 @@ public:
|
|||||||
void createLineTool();
|
void createLineTool();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
// Events to handle
|
// Events to handle
|
||||||
void slotActivateLayer(int a);
|
void slotActivateLayer(int a);
|
||||||
void slotDeleteActiveLayer();
|
void slotDeleteActiveLayer();
|
||||||
@@ -95,7 +93,6 @@ private:
|
|||||||
|
|
||||||
void resizeImage(QImage *image_res, const QSize &newSize);
|
void resizeImage(QImage *image_res, const QSize &newSize);
|
||||||
|
|
||||||
|
|
||||||
//Helper for Tool
|
//Helper for Tool
|
||||||
void createTempLayerAfter(int idx);
|
void createTempLayerAfter(int idx);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user