diff --git a/Test/Applications/gradient/Gradient/mainwindow.cpp b/Test/Applications/gradient/Gradient/mainwindow.cpp index 88fcd0c783..6d1a853ae3 100644 --- a/Test/Applications/gradient/Gradient/mainwindow.cpp +++ b/Test/Applications/gradient/Gradient/mainwindow.cpp @@ -10,11 +10,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi { ui->setupUi(this); ui->lable_test->setStyleSheet("QLabel { background-color : white;}"); - ui->stackedWidget->setCurrentIndex(0); - ui->stackedWidget_2->setCurrentIndex(0); - ui->statusbar->showMessage("Linear"); + on_actionLinear_Gradient_triggered(); ui->Rainbow_Colorspace_Radio_Button->setChecked(true); - info.colorspace = Rainbow; } MainWindow::~MainWindow() @@ -27,8 +24,6 @@ void CleanupFunction(void *data) delete[] data; } -const int COORD_SIZE_MM = 100; - QImage GenerateImg(std::vector &points, Info &info, const int& w, const int& h) { NSGraphics::IGraphicsRenderer *pRasterRenderer = NSGraphics::Create(); @@ -95,7 +90,6 @@ void MainWindow::on_actionLinear_Gradient_triggered() ui->statusbar->showMessage("Linear"); info.gradient = Linear; info.gradient_type = c_BrushTypePathNewLinearGradient; - points = {{0, 0}, {500, 0}, {500, 500}, {0, 500}}; } void MainWindow::on_actionRadial_Gradient_triggered() @@ -105,7 +99,6 @@ void MainWindow::on_actionRadial_Gradient_triggered() ui->statusbar->showMessage("Radial"); info.gradient = Radial; info.gradient_type = c_BrushTypePathRadialGradient; - points = {{0, 0}, {500, 0}, {500, 500}, {0, 500}}; } void MainWindow::on_actionTriangle_Gradient_triggered() @@ -115,7 +108,6 @@ void MainWindow::on_actionTriangle_Gradient_triggered() ui->statusbar->showMessage("Triangle"); info.gradient = Triangle; info.gradient_type = c_BrushTypeTriagnleMeshGradient; - points = {{0, 0}, {500, 0}, {500, 500}, {0, 500}}; } void MainWindow::on_actionTriangle_Parametric_Gradient_triggered() @@ -125,7 +117,6 @@ void MainWindow::on_actionTriangle_Parametric_Gradient_triggered() ui->statusbar->showMessage("Triangle Parametric"); info.gradient = TriangleParametric; info.gradient_type = c_BrushTypeTriagnleMeshGradient; - points = {{0, 0}, {500, 0}, {500, 500}, {0, 500}}; } void MainWindow::on_actionCoons_Patch_Gradient_triggered() @@ -135,7 +126,6 @@ void MainWindow::on_actionCoons_Patch_Gradient_triggered() ui->statusbar->showMessage("Coons Patch"); info.gradient = CoonsPatch; info.gradient_type = c_BrushTypePathNewLinearGradient; - points = {{0, 0}, {500, 0}, {500, 500}, {0, 500}}; } void MainWindow::on_actionCoons_Patch_Parametric_triggered() @@ -145,7 +135,6 @@ void MainWindow::on_actionCoons_Patch_Parametric_triggered() ui->statusbar->showMessage("Coons Patch Parametric"); info.gradient = CoonsPatchParametric; info.gradient_type = c_BrushTypeCurveGradient; - points = {{0, 0}, {500, 0}, {500, 500}, {0, 500}}; } void MainWindow::on_actionTensor_Coons_Patch_Gradient_triggered() @@ -155,7 +144,6 @@ void MainWindow::on_actionTensor_Coons_Patch_Gradient_triggered() ui->statusbar->showMessage("Tensor Coons Patch"); info.gradient = TensorCoonsPatch; info.gradient_type = c_BrushTypePathNewLinearGradient; - points = {{0, 0}, {500, 0}, {500, 500}, {0, 500}}; } void MainWindow::on_actionTensor_Coons_Patch_Parametric_triggered() @@ -165,135 +153,44 @@ void MainWindow::on_actionTensor_Coons_Patch_Parametric_triggered() ui->statusbar->showMessage("Tensor Coons Patch Parametric"); info.gradient = TensorCoonsPatchParametric; info.gradient_type = c_BrushTypeTensorCurveGradient; - points = {{0, 0}, {500, 0}, {500, 500}, {0, 500}}; -} - -void MainWindow::on_BAW_Colorspace_Radio_Button_clicked() -{ - info.colorspace = BlackAndWhite; -} - -void MainWindow::on_RAB_Colorspace_Radio_Button_clicked() -{ - info.colorspace = RedAndBlue; -} - -void MainWindow::on_Pastel_Colorspace_Radio_Button_clicked() -{ - info.colorspace = Pastel; -} -void MainWindow::on_Rainbow_Colorspace_Radio_Button_clicked() -{ - info.colorspace = Rainbow; } void MainWindow::on_pushButton_clicked() { + points = {{0, 0}, + {static_cast(ui->lable_test->width()), 0}, + {static_cast(ui->lable_test->width()), static_cast(ui->lable_test->height())}, + {0, static_cast(ui->lable_test->height())}}; + if (info.gradient == Linear) { - if (ui->First_X_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("First X coordinate = NULL"); - return; - } info.p0.x = ui->First_X_Coordinate_Input->text().toInt(); - if (ui->First_Y_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("First Y coordinate = NULL"); - return; - } info.p0.y = ui->First_Y_Coordinate_Input->text().toInt(); - if (ui->Second_X_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("First X coordinate = NULL"); - return; - } info.p1.x = ui->Second_X_Coordinate_Input->text().toInt(); - if (ui->Second_Y_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("First X coordinate = NULL"); - return; - } info.p1.y = ui->Second_Y_Coordinate_Input->text().toInt(); + info.cont_b = ui->Continue_Shading_Backward->isChecked(); + info.cont_f = ui->Continue_Shading_Forward->isChecked(); info.ginfo = NSStructures::GInfoConstructor::get_linear(info.p0, info.p1, 0, 1, info.cont_b, info.cont_f); } else if (info.gradient == Radial) { - if (ui->First_Center_X_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("First Center X coordinate = NULL"); - return; - } info.c0.x = ui->First_Center_X_Coordinate_Input->text().toInt(); - if (ui->First_Center_Y_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("First Center Y coordinate = NULL"); - return; - } info.c0.y = ui->First_Center_Y_Coordinate_Input->text().toInt(); - if (ui->Second_Center_X_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("First Center X coordinate = NULL"); - return; - } info.c1.x = ui->Second_Center_X_Coordinate_Input->text().toInt(); - if (ui->Second_Center_Y_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("First Center X coordinate = NULL"); - return; - } info.c1.y = ui->Second_Center_Y_Coordinate_Input->text().toInt(); - if (ui->First_Radius_Input->text() == "") - { - ui->statusbar->showMessage("First Radius = NUll"); - return; - } info.r0 = ui->First_Radius_Input->text().toInt(); - if (ui->Second_Radius_Input->text() == "") - { - ui->statusbar->showMessage("Second Radius = NULL"); - return; - } info.r1 = ui->Second_Radius_Input->text().toInt(); + info.cont_b = ui->Continue_Shading_Backward_2->isChecked(); + info.cont_f = ui->Continue_Shading_Forward_2->isChecked(); info.ginfo = NSStructures::GInfoConstructor::get_radial(info.c0, info.c1, info.r0, info.r1, 0, 1, info.cont_b, info.cont_f); } else if (info.gradient == Triangle || info.gradient == TriangleParametric) { - if (ui->First_Vertex_X_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("First Vertex X coordinate = NULL"); - return; - } info.triangle[0].x = ui->First_Vertex_X_Coordinate_Input->text().toInt(); - if (ui->First_Vertex_Y_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("First Vertex Y coordinate = NULL"); - return; - } info.triangle[0].y = ui->First_Vertex_Y_Coordinate_Input->text().toInt(); - if (ui->Second_Vertex_X_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("Second Vertex X coordinate = NULL"); - return; - } info.triangle[1].x = ui->Second_Vertex_X_Coordinate_Input->text().toInt(); - if (ui->Second_Vertex_Y_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("Second Vertex Y coordinate = NULL"); - return; - } info.triangle[1].y = ui->Second_Vertex_Y_Coordinate_Input->text().toInt(); - if (ui->Third_Vertex_X_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("Third Vertex X coordinate = NULL"); - return; - } info.triangle[2].x = ui->Third_Vertex_X_Coordinate_Input->text().toInt(); - if (ui->Third_Vertex_Y_Coordinate_Input->text() == "") - { - ui->statusbar->showMessage("Third Vertex Y coordinate = NULL"); - return; - } info.triangle[2].y = ui->Third_Vertex_Y_Coordinate_Input->text().toInt(); info.ginfo = NSStructures::GInfoConstructor::get_triangle(info.triangle, {{255, 0, 0}, {0, 255, 0}, {0, 0, 255}}, @@ -307,150 +204,30 @@ void MainWindow::on_pushButton_clicked() } else if (info.gradient == CoonsPatch || info.gradient == CoonsPatchParametric) { - if (ui->First_Vertex_X_Coordinate_Input_3->text() == "") - { - ui->statusbar->showMessage("First Vertex X Coordinate = NULL"); - return; - } - info.curve[0].x = 5 * ui->First_Vertex_X_Coordinate_Input_3->text().toInt(); - if (ui->First_Vertex_Y_Coordinate_Input_3->text() == "") - { - ui->statusbar->showMessage("First Vertex Y Coordinate = NULL"); - return; - } - info.curve[0].y = 5 * ui->First_Vertex_Y_Coordinate_Input_3->text().toInt(); - if (ui->First_X_Coordinate_First_Edge->text() == "") - { - ui->statusbar->showMessage("First X Coordinate First Edge = NULL"); - return; - } - info.curve[1].x = 5 * ui->First_X_Coordinate_First_Edge->text().toInt(); - if (ui->First_Y_Coordinate_First_Edge->text() == "") - { - ui->statusbar->showMessage("First Y Coordinate First Edge = NULL"); - return; - } - info.curve[1].y = 5 * ui->First_Y_Coordinate_First_Edge->text().toInt(); - if (ui->Second_X_Coordinate_First_Edge->text() == "") - { - ui->statusbar->showMessage("Second X Coordinate First Edge = NULL"); - return; - } - info.curve[2].x = 5 * ui->Second_X_Coordinate_First_Edge->text().toInt(); - if (ui->Second_Y_Coordinate_First_Edge->text() == "") - { - ui->statusbar->showMessage("Second Y Coordinate First Edge = NULL"); - return; - } - info.curve[2].y = 5 * ui->Second_Y_Coordinate_First_Edge->text().toInt(); - if (ui->Second_Vertex_X_Coordinate_Input_3->text() == "") - { - ui->statusbar->showMessage("Second Vertex X Coordinate = NULL"); - return; - } - info.curve[3].x = 5 * ui->Second_Vertex_X_Coordinate_Input_3->text().toInt(); - if (ui->Second_Vertex_Y_Coordinate_Input_3->text() == "") - { - ui->statusbar->showMessage("Second Vertex Y Coordinate = NULL"); - return; - } - info.curve[3].y = 5 * ui->Second_Vertex_Y_Coordinate_Input_3->text().toInt(); - if (ui->First_X_Coordinate_Second_Edge->text() == "") - { - ui->statusbar->showMessage("First X Coordinate Second Edge = NULL"); - return; - } - info.curve[4].x = 5 * ui->First_X_Coordinate_Second_Edge->text().toInt(); - if (ui->First_Y_Coordinate_Second_Edge->text() == "") - { - ui->statusbar->showMessage("First Y Coordinate Second Edge = NULL"); - return; - } - info.curve[4].y = 5 * ui->First_Y_Coordinate_Second_Edge->text().toInt(); - if (ui->Second_X_Coordinate_Second_Edge->text() == "") - { - ui->statusbar->showMessage("Second X Coordinate Second Edge = NULL"); - return; - } - info.curve[5].x = 5 * ui->Second_X_Coordinate_Second_Edge->text().toInt(); - if (ui->Second_Y_Coordinate_Second_Edge->text() == "") - { - ui->statusbar->showMessage("Second Y Coordinate Second Edge = NULL"); - return; - } - info.curve[5].y = 5 * ui->Second_Y_Coordinate_Second_Edge->text().toInt(); - if (ui->Third_Vertex_X_Coordinate_Input_3->text() == "") - { - ui->statusbar->showMessage("Third Vertex X Coordinate = NULL"); - return; - } - info.curve[6].x = 5 * ui->Third_Vertex_X_Coordinate_Input_3->text().toInt(); - if (ui->Third_Vertex_Y_Coordinate_Input_3->text() == "") - { - ui->statusbar->showMessage("Third Vertex Y Coordinate = NULL"); - return; - } - info.curve[6].y = 5 * ui->Third_Vertex_Y_Coordinate_Input_3->text().toInt(); - if (ui->First_X_Coordinate_Third_Edge->text() == "") - { - ui->statusbar->showMessage("First X Coordinate Third Edge = NULL"); - return; - } - info.curve[7].x = 5 * ui->First_X_Coordinate_Third_Edge->text().toInt(); - if (ui->First_Y_Coordinate_Third_Edge->text() == "") - { - ui->statusbar->showMessage("First Y Coordinate Third Edge = NULL"); - return; - } - info.curve[7].y = 5 * ui->First_Y_Coordinate_Third_Edge->text().toInt(); - if (ui->Second_X_Coordinate_Third_Edge->text() == "") - { - ui->statusbar->showMessage("Second X Coordinate Third Edge = NULL"); - return; - } - info.curve[8].x = 5 * ui->Second_X_Coordinate_Third_Edge->text().toInt(); - if (ui->Second_Y_Coordinate_Third_Edge->text() == "") - { - ui->statusbar->showMessage("Second Y Coordinate Third Edge = NULL"); - return; - } - info.curve[8].y = 5 * ui->Second_Y_Coordinate_Third_Edge->text().toInt(); - if (ui->Fourth_Vertex_X_Coordinate_Input_3->text() == "") - { - ui->statusbar->showMessage("Fourth Vertex X Coordinate = NULL"); - return; - } - info.curve[9].x = 5 * ui->Fourth_Vertex_X_Coordinate_Input_3->text().toInt(); - if (ui->Fourth_Vertex_Y_Coordinate_Input_3->text() == "") - { - ui->statusbar->showMessage("Fourth Vertex Y Coordinate = NULL"); - return; - } - info.curve[9].y = 5 * ui->Fourth_Vertex_Y_Coordinate_Input_3->text().toInt(); - if (ui->First_X_Coordinate_Fourth_Edge->text() == "") - { - ui->statusbar->showMessage("First X Coordinate Fourth Edge = NULL"); - return; - } - info.curve[10].x = 5 * ui->First_X_Coordinate_Fourth_Edge->text().toInt(); - if (ui->First_Y_Coordinate_Fourth_Edge->text() == "") - { - ui->statusbar->showMessage("First Y Coordinate Fourth Edge = NULL"); - return; - } - info.curve[10].y = 5 * ui->First_Y_Coordinate_Fourth_Edge->text().toInt(); - if (ui->Second_X_Coordinate_Fourth_Edge->text() == "") - { - ui->statusbar->showMessage("Second X Coordinate Fourth Edge = NULL"); - return; - } - info.curve[11].x = 5 * ui->Second_X_Coordinate_Fourth_Edge->text().toInt(); - if (ui->Second_Y_Coordinate_Fourth_Edge->text() == "") - { - ui->statusbar->showMessage("Second Y Coordinate Fourth Edge = NULL"); - return; - } - info.curve[11].y = 5 * ui->Second_Y_Coordinate_Fourth_Edge->text().toInt(); + info.curve[0].x = MM_TO_COORD(ui->lable_test->width()) * ui->First_Vertex_X_Coordinate_Input_3->text().toInt(); + info.curve[0].y = MM_TO_COORD(ui->lable_test->height()) * ui->First_Vertex_Y_Coordinate_Input_3->text().toInt(); + info.curve[1].x = MM_TO_COORD(ui->lable_test->width()) * ui->First_X_Coordinate_First_Edge->text().toInt(); + info.curve[1].y = MM_TO_COORD(ui->lable_test->height()) * ui->First_Y_Coordinate_First_Edge->text().toInt(); + info.curve[2].x = MM_TO_COORD(ui->lable_test->width()) * ui->Second_X_Coordinate_First_Edge->text().toInt(); + info.curve[2].y = MM_TO_COORD(ui->lable_test->height()) * ui->Second_Y_Coordinate_First_Edge->text().toInt(); + info.curve[3].x = MM_TO_COORD(ui->lable_test->width()) * ui->Second_Vertex_X_Coordinate_Input_3->text().toInt(); + info.curve[3].y = MM_TO_COORD(ui->lable_test->height()) * ui->Second_Vertex_Y_Coordinate_Input_3->text().toInt(); + info.curve[4].x = MM_TO_COORD(ui->lable_test->width()) * ui->First_X_Coordinate_Second_Edge->text().toInt(); + info.curve[4].y = MM_TO_COORD(ui->lable_test->height()) * ui->First_Y_Coordinate_Second_Edge->text().toInt(); + info.curve[5].x = MM_TO_COORD(ui->lable_test->width()) * ui->Second_X_Coordinate_Second_Edge->text().toInt(); + info.curve[5].y = MM_TO_COORD(ui->lable_test->height()) * ui->Second_Y_Coordinate_Second_Edge->text().toInt(); + info.curve[6].x = MM_TO_COORD(ui->lable_test->width()) * ui->Third_Vertex_X_Coordinate_Input_3->text().toInt(); + info.curve[6].y = MM_TO_COORD(ui->lable_test->height()) * ui->Third_Vertex_Y_Coordinate_Input_3->text().toInt(); + info.curve[7].x = MM_TO_COORD(ui->lable_test->width()) * ui->First_X_Coordinate_Third_Edge->text().toInt(); + info.curve[7].y = MM_TO_COORD(ui->lable_test->height()) * ui->First_Y_Coordinate_Third_Edge->text().toInt(); + info.curve[8].x = MM_TO_COORD(ui->lable_test->width()) * ui->Second_X_Coordinate_Third_Edge->text().toInt(); + info.curve[8].y = MM_TO_COORD(ui->lable_test->height()) * ui->Second_Y_Coordinate_Third_Edge->text().toInt(); + info.curve[9].x = MM_TO_COORD(ui->lable_test->width()) * ui->Fourth_Vertex_X_Coordinate_Input_3->text().toInt(); + info.curve[9].y = MM_TO_COORD(ui->lable_test->height()) * ui->Fourth_Vertex_Y_Coordinate_Input_3->text().toInt(); + info.curve[10].x = MM_TO_COORD(ui->lable_test->width()) * ui->First_X_Coordinate_Fourth_Edge->text().toInt(); + info.curve[10].y = MM_TO_COORD(ui->lable_test->height()) * ui->First_Y_Coordinate_Fourth_Edge->text().toInt(); + info.curve[11].x = MM_TO_COORD(ui->lable_test->width()) * ui->Second_X_Coordinate_Fourth_Edge->text().toInt(); + info.curve[11].y = MM_TO_COORD(ui->lable_test->height()) * ui->Second_Y_Coordinate_Fourth_Edge->text().toInt(); info.ginfo = NSStructures::GInfoConstructor::get_curve( info.curve, {0, 0.5, 1, 0.5}, @@ -461,198 +238,38 @@ void MainWindow::on_pushButton_clicked() } else if (info.gradient == TensorCoonsPatch || info.gradient == TensorCoonsPatchParametric) { - if (ui->First_X_Coordinate_First_Edge_3->text() == "") - { - ui->statusbar->showMessage("First X Coordinate First Edge = NULL"); - return; - } - info.tensorcurve[0][0].x = 5 * ui->First_X_Coordinate_First_Edge_3->text().toInt(); - if (ui->First_Y_Coordinate_First_Edge_3->text() == "") - { - ui->statusbar->showMessage("First Y Coordinate First Edge = NULL"); - return; - } - info.tensorcurve[0][0].y = 5 * ui->First_Y_Coordinate_First_Edge_3->text().toInt(); - if (ui->Second_X_Coordinate_First_Edge_3->text() == "") - { - ui->statusbar->showMessage("Second X Coordinate First Edge = NULL"); - return; - } - info.tensorcurve[0][1].x = 5 * ui->Second_X_Coordinate_First_Edge_3->text().toInt(); - if (ui->Second_Y_Coordinate_First_Edge_3->text() == "") - { - ui->statusbar->showMessage("Second Y Coordinate First Edge = NULL"); - return; - } - info.tensorcurve[0][1].y = 5 * ui->Second_Y_Coordinate_First_Edge_3->text().toInt(); - if (ui->Third_X_Coordinate_First_Edge_3->text() == "") - { - ui->statusbar->showMessage("Third X Coordinate First Edge = NULL"); - return; - } - info.tensorcurve[0][2].x = 5 * ui->Third_X_Coordinate_First_Edge_3->text().toInt(); - if (ui->Third_Y_Coordinate_First_Edge_3->text() == "") - { - ui->statusbar->showMessage("Third Y Coordinate First Edge = NULL"); - return; - } - info.tensorcurve[0][2].y = 5 * ui->Third_Y_Coordinate_First_Edge_3->text().toInt(); - if (ui->Fourth_X_Coordinate_First_Edge_3->text() == "") - { - ui->statusbar->showMessage("Fourth X Coordinate First Edge = NULL"); - return; - } - info.tensorcurve[0][3].x = 5 * ui->Fourth_X_Coordinate_First_Edge_3->text().toInt(); - if (ui->Fourth_Y_Coordinate_First_Edge_3->text() == "") - { - ui->statusbar->showMessage("Fourth Y Coordinate First Edge = NULL"); - return; - } - info.tensorcurve[0][3].y = 5 * ui->Fourth_Y_Coordinate_First_Edge_3->text().toInt(); - if (ui->First_X_Coordinate_Second_Edge_3->text() == "") - { - ui->statusbar->showMessage("First X Coordinate Second Edge = NULL"); - return; - } - info.tensorcurve[1][0].x = 5 * ui->First_X_Coordinate_Second_Edge_3->text().toInt(); - if (ui->First_Vertex_Y_Coordinate_Input_3->text() == "") - { - ui->statusbar->showMessage("First Y Coordinate Second Edge = NULL"); - return; - } - info.tensorcurve[1][0].y = 5 * ui->First_Y_Coordinate_Second_Edge_3->text().toInt(); - if (ui->Second_X_Coordinate_Second_Edge_3->text() == "") - { - ui->statusbar->showMessage("Second X Coordinate Second Edge = NULL"); - return; - } - info.tensorcurve[1][1].x = 5 * ui->Second_X_Coordinate_Second_Edge_3->text().toInt(); - if (ui->Second_Y_Coordinate_Second_Edge_3->text() == "") - { - ui->statusbar->showMessage("Second Y Coordinate Second Edge = NULL"); - return; - } - info.tensorcurve[1][1].y = 5 * ui->Second_Y_Coordinate_Second_Edge_3->text().toInt(); - if (ui->Third_X_Coordinate_Second_Edge_3->text() == "") - { - ui->statusbar->showMessage("Third X Coordinate Second Edge = NULL"); - return; - } - info.tensorcurve[1][2].x = 5 * ui->Third_X_Coordinate_Second_Edge_3->text().toInt(); - if (ui->Third_Y_Coordinate_Second_Edge_3->text() == "") - { - ui->statusbar->showMessage("Third Y Coordinate Second Edge = NULL"); - return; - } - info.tensorcurve[1][2].y = 5 * ui->Third_Y_Coordinate_Second_Edge_3->text().toInt(); - if (ui->Fourth_X_Coordinate_Second_Edge_3->text() == "") - { - ui->statusbar->showMessage("Fourth X Coordinate Second Edge = NULL"); - return; - } - info.tensorcurve[1][3].x = 5 * ui->Fourth_X_Coordinate_Second_Edge_3->text().toInt(); - if (ui->Fourth_Y_Coordinate_Second_Edge_3->text() == "") - { - ui->statusbar->showMessage("Fourth Y Coordinate Second Edge = NULL"); - return; - } - info.tensorcurve[1][3].y = 5 * ui->Fourth_Y_Coordinate_Second_Edge_3->text().toInt(); - if (ui->First_X_Coordinate_Third_Edge_3->text() == "") - { - ui->statusbar->showMessage("First X Coordinate Third Edge = NULL"); - return; - } - info.tensorcurve[2][0].x = 5 * ui->First_X_Coordinate_Third_Edge_3->text().toInt(); - if (ui->First_Y_Coordinate_Third_Edge_3->text() == "") - { - ui->statusbar->showMessage("First Y Coordinate Third Edge = NULL"); - return; - } - info.tensorcurve[2][0].y = 5 * ui->First_Y_Coordinate_Third_Edge_3->text().toInt(); - if (ui->Second_X_Coordinate_Third_Edge_3->text() == "") - { - ui->statusbar->showMessage("Second X Coordinate Third Edge = NULL"); - return; - } - info.tensorcurve[2][1].x = 5 * ui->Second_Y_Coordinate_Third_Edge_3->text().toInt(); - if (ui->Second_Y_Coordinate_Third_Edge_3->text() == "") - { - ui->statusbar->showMessage("Second Y Coordinate Third Edge = NULL"); - return; - } - info.tensorcurve[2][1].y = 5 * ui->Second_Y_Coordinate_Third_Edge_3->text().toInt(); - if (ui->Third_X_Coordinate_Third_Edge_3->text() == "") - { - ui->statusbar->showMessage("Third X Coordinate Third Edge = NULL"); - return; - } - info.tensorcurve[2][2].x = 5 * ui->Third_X_Coordinate_Third_Edge_3->text().toInt(); - if (ui->Third_Y_Coordinate_Third_Edge_3->text() == "") - { - ui->statusbar->showMessage("Third Y Coordinate Third Edge = NULL"); - return; - } - info.tensorcurve[2][2].y = 5 * ui->Third_Y_Coordinate_Third_Edge_3->text().toInt(); - if (ui->Fourth_X_Coordinate_Third_Edge_3->text() == "") - { - ui->statusbar->showMessage("Fourth X Coordinate Third Edge = NULL"); - return; - } - info.tensorcurve[2][3].x = 5 * ui->Fourth_X_Coordinate_Third_Edge_3->text().toInt(); - if (ui->Fourth_Y_Coordinate_Third_Edge_3->text() == "") - { - ui->statusbar->showMessage("Fourth Y Coordinate Third Edge = NULL"); - return; - } - info.tensorcurve[2][3].y = 5 * ui->Fourth_Y_Coordinate_Third_Edge_3->text().toInt(); - if (ui->First_X_Coordinate_Fourth_Edge_3->text() == "") - { - ui->statusbar->showMessage("First X Coordinate Fourth Edge = NULL"); - return; - } - info.tensorcurve[3][0].x = 5 * ui->First_X_Coordinate_Fourth_Edge_3->text().toInt(); - if (ui->First_Y_Coordinate_Fourth_Edge_3->text() == "") - { - ui->statusbar->showMessage("First Y Coordinate Fourth Edge = NULL"); - return; - } - info.tensorcurve[3][0].y = 5 * ui->First_Y_Coordinate_Fourth_Edge_3->text().toInt(); - if (ui->Second_X_Coordinate_Fourth_Edge_3->text() == "") - { - ui->statusbar->showMessage("Second X Coordinate Fourth Edge = NULL"); - return; - } - info.tensorcurve[3][1].x = 5 * ui->Second_X_Coordinate_Fourth_Edge_3->text().toInt(); - if (ui->Second_Y_Coordinate_Fourth_Edge_3->text() == "") - { - ui->statusbar->showMessage("Second Y Coordinate Fourth Edge = NULL"); - return; - } - info.tensorcurve[3][1].y = 5 * ui->Second_Y_Coordinate_Fourth_Edge_3->text().toInt(); - if (ui->Third_X_Coordinate_Fourth_Edge_3->text() == "") - { - ui->statusbar->showMessage("Third X Coordinate Fourth Edge = NULL"); - return; - } - info.tensorcurve[3][2].x = 5 * ui->Third_X_Coordinate_Fourth_Edge_3->text().toInt(); - if (ui->Third_Y_Coordinate_Fourth_Edge_3->text() == "") - { - ui->statusbar->showMessage("Third X Coordinate Fourth Edge = NULL"); - return; - } - info.tensorcurve[3][2].y = 5 * ui->Third_Y_Coordinate_Fourth_Edge_3->text().toInt(); - if (ui->Fourth_X_Coordinate_Fourth_Edge_3->text() == "") - { - ui->statusbar->showMessage("Fourth X Coordinate Fourth Edge = NULL"); - return; - } - info.tensorcurve[3][3].x = 5 * ui->Fourth_X_Coordinate_Fourth_Edge_3->text().toInt(); - if (ui->Fourth_Y_Coordinate_Fourth_Edge_3->text() == "") - { - ui->statusbar->showMessage("Fourth Y Coordinate Fourth Edge = NULL"); - return; - } - info.tensorcurve[3][3].y = 5 * ui->Fourth_Y_Coordinate_Fourth_Edge_3->text().toInt(); + info.tensorcurve[0][0].x = MM_TO_COORD(ui->lable_test->width()) * ui->First_X_Coordinate_First_Edge_3->text().toInt(); + info.tensorcurve[0][0].y = MM_TO_COORD(ui->lable_test->height()) * ui->First_Y_Coordinate_First_Edge_3->text().toInt(); + info.tensorcurve[0][1].x = MM_TO_COORD(ui->lable_test->width()) * ui->Second_X_Coordinate_First_Edge_3->text().toInt(); + info.tensorcurve[0][1].y = MM_TO_COORD(ui->lable_test->height()) * ui->Second_Y_Coordinate_First_Edge_3->text().toInt(); + info.tensorcurve[0][2].x = MM_TO_COORD(ui->lable_test->width()) * ui->Third_X_Coordinate_First_Edge_3->text().toInt(); + info.tensorcurve[0][2].y = MM_TO_COORD(ui->lable_test->height()) * ui->Third_Y_Coordinate_First_Edge_3->text().toInt(); + info.tensorcurve[0][3].x = MM_TO_COORD(ui->lable_test->width()) * ui->Fourth_X_Coordinate_First_Edge_3->text().toInt(); + info.tensorcurve[0][3].y = MM_TO_COORD(ui->lable_test->height()) * ui->Fourth_Y_Coordinate_First_Edge_3->text().toInt(); + info.tensorcurve[1][0].x = MM_TO_COORD(ui->lable_test->width()) * ui->First_X_Coordinate_Second_Edge_3->text().toInt(); + info.tensorcurve[1][0].y = MM_TO_COORD(ui->lable_test->height()) * ui->First_Y_Coordinate_Second_Edge_3->text().toInt(); + info.tensorcurve[1][1].x = MM_TO_COORD(ui->lable_test->width()) * ui->Second_X_Coordinate_Second_Edge_3->text().toInt(); + info.tensorcurve[1][1].y = MM_TO_COORD(ui->lable_test->height()) * ui->Second_Y_Coordinate_Second_Edge_3->text().toInt(); + info.tensorcurve[1][2].x = MM_TO_COORD(ui->lable_test->width()) * ui->Third_X_Coordinate_Second_Edge_3->text().toInt(); + info.tensorcurve[1][2].y = MM_TO_COORD(ui->lable_test->height()) * ui->Third_Y_Coordinate_Second_Edge_3->text().toInt(); + info.tensorcurve[1][3].x = MM_TO_COORD(ui->lable_test->width()) * ui->Fourth_X_Coordinate_Second_Edge_3->text().toInt(); + info.tensorcurve[1][3].y = MM_TO_COORD(ui->lable_test->height()) * ui->Fourth_Y_Coordinate_Second_Edge_3->text().toInt(); + info.tensorcurve[2][0].x = MM_TO_COORD(ui->lable_test->width()) * ui->First_X_Coordinate_Third_Edge_3->text().toInt(); + info.tensorcurve[2][0].y = MM_TO_COORD(ui->lable_test->height()) * ui->First_Y_Coordinate_Third_Edge_3->text().toInt(); + info.tensorcurve[2][1].x = MM_TO_COORD(ui->lable_test->width()) * ui->Second_Y_Coordinate_Third_Edge_3->text().toInt(); + info.tensorcurve[2][1].y = MM_TO_COORD(ui->lable_test->height()) * ui->Second_Y_Coordinate_Third_Edge_3->text().toInt(); + info.tensorcurve[2][2].x = MM_TO_COORD(ui->lable_test->width()) * ui->Third_X_Coordinate_Third_Edge_3->text().toInt(); + info.tensorcurve[2][2].y = MM_TO_COORD(ui->lable_test->height()) * ui->Third_Y_Coordinate_Third_Edge_3->text().toInt(); + info.tensorcurve[2][3].x = MM_TO_COORD(ui->lable_test->width()) * ui->Fourth_X_Coordinate_Third_Edge_3->text().toInt(); + info.tensorcurve[2][3].y = MM_TO_COORD(ui->lable_test->height()) * ui->Fourth_Y_Coordinate_Third_Edge_3->text().toInt(); + info.tensorcurve[3][0].x = MM_TO_COORD(ui->lable_test->width()) * ui->First_X_Coordinate_Fourth_Edge_3->text().toInt(); + info.tensorcurve[3][0].y = MM_TO_COORD(ui->lable_test->height()) * ui->First_Y_Coordinate_Fourth_Edge_3->text().toInt(); + info.tensorcurve[3][1].x = MM_TO_COORD(ui->lable_test->width()) * ui->Second_X_Coordinate_Fourth_Edge_3->text().toInt(); + info.tensorcurve[3][1].y = MM_TO_COORD(ui->lable_test->height()) * ui->Second_Y_Coordinate_Fourth_Edge_3->text().toInt(); + info.tensorcurve[3][2].x = MM_TO_COORD(ui->lable_test->width()) * ui->Third_X_Coordinate_Fourth_Edge_3->text().toInt(); + info.tensorcurve[3][2].y = MM_TO_COORD(ui->lable_test->height()) * ui->Third_Y_Coordinate_Fourth_Edge_3->text().toInt(); + info.tensorcurve[3][3].x = MM_TO_COORD(ui->lable_test->width()) * ui->Fourth_X_Coordinate_Fourth_Edge_3->text().toInt(); + info.tensorcurve[3][3].y = MM_TO_COORD(ui->lable_test->height()) * ui->Fourth_Y_Coordinate_Fourth_Edge_3->text().toInt(); info.ginfo = NSStructures::GInfoConstructor::get_tensor_curve( info.tensorcurve, {{0, 0.5}, {1, 0.5}}, @@ -661,33 +278,28 @@ void MainWindow::on_pushButton_clicked() ); } - if (info.colorspace == NoColorspaceType) - { - ui->statusbar->showMessage("Colorspace - NULL"); - return; - } - else if (info.colorspace == Rainbow) + if (ui->Rainbow_Colorspace_Radio_Button->isChecked()) { info.c = {(LONG)0xFFff0000, (LONG)0xFFffa500, (LONG)0xFFffff00, (LONG)0xFF008000, (LONG)0xFF0000ff, (LONG)0xFFFF00FF}; info.p = {0.0, 0.2, 0.4, 0.6, 0.8, 1}; info.n_colors = 6; info.ginfo.shading.function.set_linear_interpolation({0xFFff0000, 0xFFffa500, 0xFFffff00, 0xFF008000, 0xFF0000ff, 0xFFFF00FF}, {0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f}); } - else if (info.colorspace == BlackAndWhite) + else if (ui->BAW_Colorspace_Radio_Button->isChecked()) { info.c = {(LONG)0xFFFFFFFF, (LONG)0xFF000000}; info.p = {0.0, 1}; info.n_colors = 2; info.ginfo.shading.function.set_linear_interpolation({0xFFFFFFFF, 0xFF000000}, {0.0f, 1.0f}); } - else if (info.colorspace == RedAndBlue) + else if (ui->RAB_Colorspace_Radio_Button->isChecked()) { info.c = {(LONG)0xFFFF0000, (LONG)0xFF0000FF}; info.p = {0.0, 1}; info.n_colors = 2; info.ginfo.shading.function.set_linear_interpolation({0xFFFF0000, 0xFF0000FF}, {0.0f, 1.0f}); } - else if (info.colorspace == Pastel) + else if (ui->Pastel_Colorspace_Radio_Button->isChecked()) { info.c = {(LONG)0xfff39189, (LONG)0xff046582}; info.p = {0.0, 1}; @@ -699,453 +311,3 @@ void MainWindow::on_pushButton_clicked() ui->lable_test->setPixmap(QPixmap::fromImage(pm)); ui->lable_test->setScaledContents(true); } - -void MainWindow::on_Continue_Shading_Forward_clicked(bool checked) -{ - info.cont_f = checked; -} - -void MainWindow::on_checkBox_2_clicked(bool checked) -{ - info.cont_b = checked; -} - -void MainWindow::on_Continue_Shading_Forward_2_clicked(bool checked) -{ - info.cont_f = checked; -} - -void MainWindow::on_Continue_Shading_Backward_2_clicked(bool checked) -{ - info.cont_b = checked; -} - -inline void ClampCoords(QLineEdit* edit) -{ - if (edit->text().toInt() < 0) - edit->setText("0"); - if (edit->text().toInt() > COORD_SIZE_MM) - edit->setText(QString::number(COORD_SIZE_MM)); -} - -void MainWindow::on_First_X_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->First_X_Coordinate_Input); -} - -void MainWindow::on_First_Y_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->First_Y_Coordinate_Input); -} - -void MainWindow::on_Second_X_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->Second_X_Coordinate_Input); -} - -void MainWindow::on_Second_Y_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->Second_Y_Coordinate_Input); -} - -void MainWindow::on_First_Center_X_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->First_Center_X_Coordinate_Input); -} - -void MainWindow::on_First_Center_Y_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->First_Center_Y_Coordinate_Input); -} - -void MainWindow::on_Second_Center_X_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->Second_Center_X_Coordinate_Input); -} - -void MainWindow::on_Second_Center_Y_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->Second_Center_Y_Coordinate_Input); -} - -void MainWindow::on_First_Radius_Input_editingFinished() -{ - ClampCoords(ui->First_Radius_Input); -} - -void MainWindow::on_Second_Radius_Input_editingFinished() -{ - ClampCoords(ui->Second_Radius_Input); -} - -void MainWindow::on_First_Vertex_X_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->First_Vertex_X_Coordinate_Input); -} - - -void MainWindow::on_First_Vertex_Y_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->First_Vertex_Y_Coordinate_Input); -} - - -void MainWindow::on_Second_Vertex_X_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->Second_Vertex_X_Coordinate_Input); -} - - -void MainWindow::on_Second_Vertex_Y_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->Second_Vertex_Y_Coordinate_Input); -} - - -void MainWindow::on_Third_Vertex_X_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->Third_Vertex_X_Coordinate_Input); -} - - -void MainWindow::on_Third_Vertex_Y_Coordinate_Input_editingFinished() -{ - ClampCoords(ui->Third_Vertex_Y_Coordinate_Input); -} - - -void MainWindow::on_First_Vertex_X_Coordinate_Input_3_editingFinished() -{ - ClampCoords(ui->First_Vertex_X_Coordinate_Input_3); -} - - -void MainWindow::on_First_Vertex_Y_Coordinate_Input_3_editingFinished() -{ - ClampCoords(ui->First_Vertex_Y_Coordinate_Input_3); -} - - -void MainWindow::on_Second_Vertex_X_Coordinate_Input_3_editingFinished() -{ - ClampCoords(ui->Second_Vertex_X_Coordinate_Input_3); -} - - -void MainWindow::on_Second_Vertex_Y_Coordinate_Input_3_editingFinished() -{ - ClampCoords(ui->Second_Vertex_Y_Coordinate_Input_3); -} - - -void MainWindow::on_Third_Vertex_X_Coordinate_Input_3_editingFinished() -{ - ClampCoords(ui->Third_Vertex_X_Coordinate_Input_3); -} - - -void MainWindow::on_Third_Vertex_Y_Coordinate_Input_3_editingFinished() -{ - ClampCoords(ui->Third_Vertex_Y_Coordinate_Input_3); -} - - -void MainWindow::on_Fourth_Vertex_X_Coordinate_Input_3_editingFinished() -{ - ClampCoords(ui->Fourth_Vertex_X_Coordinate_Input_3); -} - - -void MainWindow::on_Fourth_Vertex_Y_Coordinate_Input_3_editingFinished() -{ - ClampCoords(ui->Fourth_Vertex_Y_Coordinate_Input_3); -} - - -void MainWindow::on_First_X_Coordinate_First_Edge_editingFinished() -{ - ClampCoords(ui->First_X_Coordinate_First_Edge); -} - - -void MainWindow::on_First_Y_Coordinate_First_Edge_editingFinished() -{ - ClampCoords(ui->First_Y_Coordinate_First_Edge); -} - - -void MainWindow::on_Second_X_Coordinate_First_Edge_editingFinished() -{ - ClampCoords(ui->Second_X_Coordinate_First_Edge); -} - - -void MainWindow::on_Second_Y_Coordinate_First_Edge_editingFinished() -{ - ClampCoords(ui->Second_Y_Coordinate_First_Edge); -} - - -void MainWindow::on_First_X_Coordinate_Second_Edge_editingFinished() -{ - ClampCoords(ui->First_X_Coordinate_Second_Edge); -} - - -void MainWindow::on_First_Y_Coordinate_Second_Edge_editingFinished() -{ - ClampCoords(ui->First_Y_Coordinate_Second_Edge); -} - - -void MainWindow::on_Second_X_Coordinate_Second_Edge_editingFinished() -{ - ClampCoords(ui->Second_X_Coordinate_Second_Edge); -} - - -void MainWindow::on_Second_Y_Coordinate_Second_Edge_editingFinished() -{ - ClampCoords(ui->Second_Y_Coordinate_Second_Edge); -} - - -void MainWindow::on_First_X_Coordinate_Third_Edge_editingFinished() -{ - ClampCoords(ui->First_X_Coordinate_Third_Edge); -} - - -void MainWindow::on_First_Y_Coordinate_Third_Edge_editingFinished() -{ - ClampCoords(ui->First_Y_Coordinate_Third_Edge); -} - - -void MainWindow::on_Second_X_Coordinate_Third_Edge_editingFinished() -{ - ClampCoords(ui->Second_X_Coordinate_Third_Edge); -} - - -void MainWindow::on_Second_Y_Coordinate_Third_Edge_editingFinished() -{ - ClampCoords(ui->Second_Y_Coordinate_Third_Edge); -} - - -void MainWindow::on_First_X_Coordinate_Fourth_Edge_editingFinished() -{ - ClampCoords(ui->First_X_Coordinate_Fourth_Edge); -} - - -void MainWindow::on_First_Y_Coordinate_Fourth_Edge_editingFinished() -{ - ClampCoords(ui->First_Y_Coordinate_Fourth_Edge); -} - - -void MainWindow::on_Second_X_Coordinate_Fourth_Edge_editingFinished() -{ - ClampCoords(ui->Second_X_Coordinate_Fourth_Edge); -} - - -void MainWindow::on_Second_Y_Coordinate_Fourth_Edge_editingFinished() -{ - ClampCoords(ui->Second_Y_Coordinate_Fourth_Edge); -} - - -void MainWindow::on_First_X_Coordinate_First_Edge_3_editingFinished() -{ - ClampCoords(ui->First_X_Coordinate_First_Edge_3); -} - - -void MainWindow::on_First_Y_Coordinate_First_Edge_3_editingFinished() -{ - ClampCoords(ui->First_Y_Coordinate_First_Edge_3); -} - - -void MainWindow::on_Second_X_Coordinate_First_Edge_3_editingFinished() -{ - ClampCoords(ui->Second_X_Coordinate_First_Edge_3); -} - - -void MainWindow::on_Second_Y_Coordinate_First_Edge_3_editingFinished() -{ - ClampCoords(ui->Second_Y_Coordinate_First_Edge_3); -} - - -void MainWindow::on_Third_X_Coordinate_First_Edge_3_editingFinished() -{ - ClampCoords(ui->Third_X_Coordinate_First_Edge_3); -} - - -void MainWindow::on_Third_Y_Coordinate_First_Edge_3_editingFinished() -{ - ClampCoords(ui->Third_Y_Coordinate_First_Edge_3); -} - - -void MainWindow::on_Fourth_X_Coordinate_First_Edge_3_editingFinished() -{ - ClampCoords(ui->Fourth_X_Coordinate_First_Edge_3); -} - - -void MainWindow::on_Fourth_Y_Coordinate_First_Edge_3_editingFinished() -{ - ClampCoords(ui->Fourth_Y_Coordinate_First_Edge_3); -} - - -void MainWindow::on_First_X_Coordinate_Second_Edge_3_editingFinished() -{ - ClampCoords(ui->First_X_Coordinate_Second_Edge_3); -} - - -void MainWindow::on_First_Y_Coordinate_Second_Edge_3_editingFinished() -{ - ClampCoords(ui->First_Y_Coordinate_Second_Edge_3); -} - - -void MainWindow::on_Second_X_Coordinate_Second_Edge_3_editingFinished() -{ - ClampCoords(ui->Second_X_Coordinate_Second_Edge_3); -} - - -void MainWindow::on_Second_Y_Coordinate_Second_Edge_3_editingFinished() -{ - ClampCoords(ui->Second_Y_Coordinate_Second_Edge_3); -} - - -void MainWindow::on_Third_X_Coordinate_Second_Edge_3_editingFinished() -{ - ClampCoords(ui->Third_X_Coordinate_Second_Edge_3); -} - - -void MainWindow::on_Third_Y_Coordinate_Second_Edge_3_editingFinished() -{ - ClampCoords(ui->Third_Y_Coordinate_Second_Edge_3); -} - - -void MainWindow::on_Fourth_X_Coordinate_Second_Edge_3_editingFinished() -{ - ClampCoords(ui->Fourth_X_Coordinate_Second_Edge_3); -} - - -void MainWindow::on_Fourth_Y_Coordinate_Second_Edge_3_editingFinished() -{ - ClampCoords(ui->Fourth_Y_Coordinate_Second_Edge_3); -} - - -void MainWindow::on_First_X_Coordinate_Third_Edge_3_editingFinished() -{ - ClampCoords(ui->First_X_Coordinate_Third_Edge_3); -} - - -void MainWindow::on_First_Y_Coordinate_Third_Edge_3_editingFinished() -{ - ClampCoords(ui->First_Y_Coordinate_Third_Edge_3); -} - - -void MainWindow::on_Second_X_Coordinate_Third_Edge_3_editingFinished() -{ - ClampCoords(ui->Second_X_Coordinate_Third_Edge_3); -} - - -void MainWindow::on_Second_Y_Coordinate_Third_Edge_3_editingFinished() -{ - ClampCoords(ui->Second_Y_Coordinate_Third_Edge_3); -} - - -void MainWindow::on_Third_X_Coordinate_Third_Edge_3_editingFinished() -{ - ClampCoords(ui->Third_X_Coordinate_Third_Edge_3); -} - - -void MainWindow::on_Third_Y_Coordinate_Third_Edge_3_editingFinished() -{ - ClampCoords(ui->Third_Y_Coordinate_Third_Edge_3); -} - - -void MainWindow::on_Fourth_X_Coordinate_Third_Edge_3_editingFinished() -{ - ClampCoords(ui->Fourth_X_Coordinate_Third_Edge_3); -} - - -void MainWindow::on_Fourth_Y_Coordinate_Third_Edge_3_editingFinished() -{ - ClampCoords(ui->Fourth_Y_Coordinate_Third_Edge_3); -} - - -void MainWindow::on_First_X_Coordinate_Fourth_Edge_3_editingFinished() -{ - ClampCoords(ui->First_X_Coordinate_Fourth_Edge_3); -} - - -void MainWindow::on_First_Y_Coordinate_Fourth_Edge_3_editingFinished() -{ - ClampCoords(ui->First_Y_Coordinate_Fourth_Edge_3); -} - - -void MainWindow::on_Second_X_Coordinate_Fourth_Edge_3_editingFinished() -{ - ClampCoords(ui->Second_X_Coordinate_Fourth_Edge_3); -} - - -void MainWindow::on_Second_Y_Coordinate_Fourth_Edge_3_editingFinished() -{ - ClampCoords(ui->Second_Y_Coordinate_Fourth_Edge_3); -} - - -void MainWindow::on_Third_X_Coordinate_Fourth_Edge_3_editingFinished() -{ - ClampCoords(ui->Third_X_Coordinate_Fourth_Edge_3); -} - - -void MainWindow::on_Third_Y_Coordinate_Fourth_Edge_3_editingFinished() -{ - ClampCoords(ui->Third_Y_Coordinate_Fourth_Edge_3); -} - - -void MainWindow::on_Fourth_X_Coordinate_Fourth_Edge_3_editingFinished() -{ - ClampCoords(ui->Fourth_X_Coordinate_Fourth_Edge_3); -} - - -void MainWindow::on_Fourth_Y_Coordinate_Fourth_Edge_3_editingFinished() -{ - ClampCoords(ui->Fourth_Y_Coordinate_Fourth_Edge_3); -} - diff --git a/Test/Applications/gradient/Gradient/mainwindow.h b/Test/Applications/gradient/Gradient/mainwindow.h index 99c51b16d7..eece8a5562 100644 --- a/Test/Applications/gradient/Gradient/mainwindow.h +++ b/Test/Applications/gradient/Gradient/mainwindow.h @@ -4,8 +4,12 @@ #include #include #include +#include #include "../../../../DesktopEditor/graphics/structures.h" +#define COORD_SIZE_MM 100 +#define MM_TO_COORD(size) (size / COORD_SIZE_MM) + QT_BEGIN_NAMESPACE namespace Ui { @@ -13,6 +17,30 @@ namespace Ui } QT_END_NAMESPACE +class CustomLineEdit : public QLineEdit +{ + Q_OBJECT +public: + CustomLineEdit(QWidget *parent = nullptr) : QLineEdit(parent) + { + connect(this, &QLineEdit::editingFinished, this, &CustomLineEdit::onEditingFinished); + } + ~CustomLineEdit() + { + + } +public slots: + void onEditingFinished() + { + if (this->text() == "") + this->setText(this->placeholderText()); + if (this->text().toInt() < 0) + this->setText("0"); + if (this->text().toInt() > COORD_SIZE_MM) + this->setText(QString::number(COORD_SIZE_MM)); + } +}; + typedef enum { Linear, @@ -26,15 +54,6 @@ typedef enum Functional } GradientType; -typedef enum -{ - NoColorspaceType, - Rainbow, - BlackAndWhite, - RedAndBlue, - Pastel -} ColorspaceType; - struct Point { Point(double _x = 0, double _y = 0) : x(_x), y(_y) @@ -42,6 +61,7 @@ struct Point } double x, y; }; + struct Color { uint r, g, b; @@ -63,7 +83,6 @@ struct Color struct Info { - ColorspaceType colorspace = NoColorspaceType; GradientType gradient = Linear; float r0, r1; @@ -122,58 +141,10 @@ private slots: void on_actionRadial_Gradient_triggered(); - void on_BAW_Colorspace_Radio_Button_clicked(); - - void on_RAB_Colorspace_Radio_Button_clicked(); - - void on_Pastel_Colorspace_Radio_Button_clicked(); - - void on_Rainbow_Colorspace_Radio_Button_clicked(); - void on_pushButton_clicked(); - void on_Continue_Shading_Forward_clicked(bool checked); - - void on_checkBox_2_clicked(bool checked); - - void on_Continue_Shading_Forward_2_clicked(bool checked); - - void on_Continue_Shading_Backward_2_clicked(bool checked); - - void on_First_X_Coordinate_Input_editingFinished(); - - void on_First_Y_Coordinate_Input_editingFinished(); - - void on_Second_X_Coordinate_Input_editingFinished(); - - void on_Second_Y_Coordinate_Input_editingFinished(); - - void on_First_Center_X_Coordinate_Input_editingFinished(); - - void on_First_Center_Y_Coordinate_Input_editingFinished(); - - void on_Second_Center_X_Coordinate_Input_editingFinished(); - - void on_Second_Center_Y_Coordinate_Input_editingFinished(); - - void on_First_Radius_Input_editingFinished(); - - void on_Second_Radius_Input_editingFinished(); - void on_actionTriangle_Gradient_triggered(); - void on_First_Vertex_X_Coordinate_Input_editingFinished(); - - void on_First_Vertex_Y_Coordinate_Input_editingFinished(); - - void on_Second_Vertex_X_Coordinate_Input_editingFinished(); - - void on_Second_Vertex_Y_Coordinate_Input_editingFinished(); - - void on_Third_Vertex_X_Coordinate_Input_editingFinished(); - - void on_Third_Vertex_Y_Coordinate_Input_editingFinished(); - void on_actionTriangle_Parametric_Gradient_triggered(); void on_actionCoons_Patch_Gradient_triggered(); @@ -184,118 +155,6 @@ private slots: void on_actionTensor_Coons_Patch_Parametric_triggered(); - void on_First_Vertex_X_Coordinate_Input_3_editingFinished(); - - void on_First_Vertex_Y_Coordinate_Input_3_editingFinished(); - - void on_Second_Vertex_X_Coordinate_Input_3_editingFinished(); - - void on_Second_Vertex_Y_Coordinate_Input_3_editingFinished(); - - void on_Third_Vertex_X_Coordinate_Input_3_editingFinished(); - - void on_Third_Vertex_Y_Coordinate_Input_3_editingFinished(); - - void on_Fourth_Vertex_X_Coordinate_Input_3_editingFinished(); - - void on_Fourth_Vertex_Y_Coordinate_Input_3_editingFinished(); - - void on_First_X_Coordinate_First_Edge_editingFinished(); - - void on_First_Y_Coordinate_First_Edge_editingFinished(); - - void on_Second_X_Coordinate_First_Edge_editingFinished(); - - void on_Second_Y_Coordinate_First_Edge_editingFinished(); - - void on_First_X_Coordinate_Second_Edge_editingFinished(); - - void on_First_Y_Coordinate_Second_Edge_editingFinished(); - - void on_Second_X_Coordinate_Second_Edge_editingFinished(); - - void on_Second_Y_Coordinate_Second_Edge_editingFinished(); - - void on_First_X_Coordinate_Third_Edge_editingFinished(); - - void on_First_Y_Coordinate_Third_Edge_editingFinished(); - - void on_Second_X_Coordinate_Third_Edge_editingFinished(); - - void on_Second_Y_Coordinate_Third_Edge_editingFinished(); - - void on_First_X_Coordinate_Fourth_Edge_editingFinished(); - - void on_First_Y_Coordinate_Fourth_Edge_editingFinished(); - - void on_Second_X_Coordinate_Fourth_Edge_editingFinished(); - - void on_Second_Y_Coordinate_Fourth_Edge_editingFinished(); - - void on_First_X_Coordinate_First_Edge_3_editingFinished(); - - void on_First_Y_Coordinate_First_Edge_3_editingFinished(); - - void on_Second_X_Coordinate_First_Edge_3_editingFinished(); - - void on_Second_Y_Coordinate_First_Edge_3_editingFinished(); - - void on_Third_X_Coordinate_First_Edge_3_editingFinished(); - - void on_Third_Y_Coordinate_First_Edge_3_editingFinished(); - - void on_Fourth_X_Coordinate_First_Edge_3_editingFinished(); - - void on_Fourth_Y_Coordinate_First_Edge_3_editingFinished(); - - void on_First_X_Coordinate_Second_Edge_3_editingFinished(); - - void on_First_Y_Coordinate_Second_Edge_3_editingFinished(); - - void on_Second_X_Coordinate_Second_Edge_3_editingFinished(); - - void on_Second_Y_Coordinate_Second_Edge_3_editingFinished(); - - void on_Third_X_Coordinate_Second_Edge_3_editingFinished(); - - void on_Third_Y_Coordinate_Second_Edge_3_editingFinished(); - - void on_Fourth_X_Coordinate_Second_Edge_3_editingFinished(); - - void on_Fourth_Y_Coordinate_Second_Edge_3_editingFinished(); - - void on_First_X_Coordinate_Third_Edge_3_editingFinished(); - - void on_First_Y_Coordinate_Third_Edge_3_editingFinished(); - - void on_Second_X_Coordinate_Third_Edge_3_editingFinished(); - - void on_Second_Y_Coordinate_Third_Edge_3_editingFinished(); - - void on_Third_X_Coordinate_Third_Edge_3_editingFinished(); - - void on_Third_Y_Coordinate_Third_Edge_3_editingFinished(); - - void on_Fourth_X_Coordinate_Third_Edge_3_editingFinished(); - - void on_Fourth_Y_Coordinate_Third_Edge_3_editingFinished(); - - void on_First_X_Coordinate_Fourth_Edge_3_editingFinished(); - - void on_First_Y_Coordinate_Fourth_Edge_3_editingFinished(); - - void on_Second_X_Coordinate_Fourth_Edge_3_editingFinished(); - - void on_Second_Y_Coordinate_Fourth_Edge_3_editingFinished(); - - void on_Third_X_Coordinate_Fourth_Edge_3_editingFinished(); - - void on_Third_Y_Coordinate_Fourth_Edge_3_editingFinished(); - - void on_Fourth_X_Coordinate_Fourth_Edge_3_editingFinished(); - - void on_Fourth_Y_Coordinate_Fourth_Edge_3_editingFinished(); - private: Ui::MainWindow *ui; }; diff --git a/Test/Applications/gradient/Gradient/mainwindow.ui b/Test/Applications/gradient/Gradient/mainwindow.ui index 713a17ab4b..01e5f01b4d 100644 --- a/Test/Applications/gradient/Gradient/mainwindow.ui +++ b/Test/Applications/gradient/Gradient/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 1126 - 827 + 795 @@ -36,7 +36,7 @@ 510 0 610 - 740 + 710 @@ -46,9 +46,9 @@ 10 - 10 + 0 201 - 150 + 140 @@ -58,7 +58,7 @@ 20 - 30 + 20 112 26 @@ -71,7 +71,7 @@ 20 - 60 + 50 161 26 @@ -84,7 +84,7 @@ 20 - 90 + 80 131 26 @@ -97,7 +97,7 @@ 20 - 120 + 110 112 26 @@ -111,9 +111,9 @@ 10 - 160 + 140 590 - 570 + 560 @@ -124,7 +124,7 @@ 0 - 10 + 0 440 150 @@ -145,7 +145,7 @@ X Coordinate, First Point - + 10 @@ -157,6 +157,9 @@ 10 + + 10 + @@ -171,7 +174,7 @@ Y Coordinate, First Point - + 10 @@ -183,6 +186,9 @@ 10 + + 10 + @@ -197,7 +203,7 @@ X Coordinate, Second Point - + 240 @@ -209,6 +215,9 @@ 90 + + 90 + @@ -223,7 +232,7 @@ Y Coordinate, Second Point - + 240 @@ -235,14 +244,17 @@ 90 + + 90 + 450 - 10 - 131 + 0 + 130 150 @@ -262,7 +274,7 @@ Forward - + 20 @@ -282,8 +294,8 @@ 450 - 10 - 131 + 0 + 130 150 @@ -321,7 +333,7 @@ 0 - 10 + 0 440 150 @@ -342,7 +354,7 @@ X Coordinate, First Center - + 20 @@ -354,6 +366,9 @@ 50 + + 50 + @@ -368,7 +383,7 @@ Y Coordinate, First Center - + 20 @@ -380,6 +395,9 @@ 50 + + 50 + @@ -394,7 +412,7 @@ X Coordinate, Second Center - + 230 @@ -406,6 +424,9 @@ 50 + + 50 + @@ -420,7 +441,7 @@ Y Coordinate, Second Center - + 230 @@ -432,13 +453,16 @@ 50 + + 50 + 0 - 160 + 150 440 100 @@ -472,7 +496,7 @@ Second Radius - + 20 @@ -484,8 +508,11 @@ 10 + + 10 + - + 230 @@ -497,6 +524,9 @@ 30 + + 30 + @@ -505,7 +535,7 @@ 0 - 10 + 0 590 140 @@ -526,7 +556,7 @@ X Coordinate, First Vertex - + 10 @@ -538,6 +568,9 @@ 50 + + 50 + @@ -552,7 +585,7 @@ Y Coordinate, First Vertex - + 10 @@ -564,6 +597,9 @@ 20 + + 20 + @@ -578,7 +614,7 @@ X Coordinate, Second Vertex - + 200 @@ -590,6 +626,9 @@ 20 + + 20 + @@ -604,7 +643,7 @@ Y Coordinate, Second Vertex - + 200 @@ -616,6 +655,9 @@ 70 + + 70 + @@ -630,7 +672,7 @@ X Coordinate, Third Vertex - + 410 @@ -642,6 +684,9 @@ 80 + + 80 + @@ -656,7 +701,7 @@ Y Coordinate, Third Vertex - + 410 @@ -668,6 +713,9 @@ 70 + + 70 + @@ -676,7 +724,7 @@ 0 - 10 + 0 590 140 @@ -697,7 +745,7 @@ First X Coordinate - + 10 @@ -709,6 +757,9 @@ 20 + + 20 + @@ -723,7 +774,7 @@ First Y Coordinate - + 10 @@ -735,6 +786,9 @@ 60 + + 60 + @@ -749,7 +803,7 @@ Second X Coordinate - + 140 @@ -761,6 +815,9 @@ 20 + + 20 + @@ -775,7 +832,7 @@ Second Y Coordinate - + 140 @@ -787,6 +844,9 @@ 20 + + 20 + @@ -801,7 +861,7 @@ Third X Coordinate - + 300 @@ -813,6 +873,9 @@ 60 + + 60 + @@ -827,7 +890,7 @@ Third Y Coordinate - + 300 @@ -839,6 +902,9 @@ 20 + + 20 + @@ -853,7 +919,7 @@ Fourth X Coordinate - + 450 @@ -865,6 +931,9 @@ 60 + + 60 + @@ -879,7 +948,7 @@ Fourth Y Coorfinate - + 450 @@ -891,13 +960,16 @@ 60 + + 60 + 0 - 150 + 140 590 320 @@ -930,7 +1002,7 @@ First X Coordinate - + 10 @@ -942,6 +1014,9 @@ 10 + + 10 + @@ -956,7 +1031,7 @@ Second X Coordinate - + 140 @@ -968,6 +1043,9 @@ 30 + + 30 + @@ -982,7 +1060,7 @@ First Y Coordinate - + 10 @@ -994,6 +1072,9 @@ 50 + + 50 + @@ -1008,7 +1089,7 @@ Second Y Coordinate - + 140 @@ -1020,6 +1101,9 @@ 30 + + 30 + @@ -1047,7 +1131,7 @@ First X Coordinate - + 10 @@ -1059,6 +1143,9 @@ 30 + + 30 + @@ -1073,7 +1160,7 @@ Second X Coordinate - + 140 @@ -1085,6 +1172,9 @@ 50 + + 50 + @@ -1099,7 +1189,7 @@ First Y Coordinate - + 10 @@ -1111,6 +1201,9 @@ 10 + + 10 + @@ -1125,7 +1218,7 @@ Second Y Coordinate - + 140 @@ -1137,6 +1230,9 @@ 30 + + 30 + @@ -1164,7 +1260,7 @@ First X Coordinate - + 10 @@ -1176,6 +1272,9 @@ 50 + + 50 + @@ -1190,7 +1289,7 @@ Second X Coordinate - + 140 @@ -1202,6 +1301,9 @@ 70 + + 70 + @@ -1216,7 +1318,7 @@ First Y Coordinate - + 10 @@ -1228,6 +1330,9 @@ 30 + + 30 + @@ -1242,7 +1347,7 @@ Second Y Coordinate - + 140 @@ -1254,6 +1359,9 @@ 50 + + 50 + @@ -1281,7 +1389,7 @@ First X Coordinate - + 10 @@ -1293,6 +1401,9 @@ 50 + + 50 + @@ -1307,7 +1418,7 @@ Second X Coordinate - + 140 @@ -1319,6 +1430,9 @@ 30 + + 30 + @@ -1333,7 +1447,7 @@ First Y Coordinate - + 10 @@ -1345,6 +1459,9 @@ 70 + + 70 + @@ -1359,7 +1476,7 @@ Second Y Coordinate - + 140 @@ -1371,6 +1488,9 @@ 50 + + 50 + @@ -1380,7 +1500,7 @@ 0 - 10 + 0 590 140 @@ -1401,7 +1521,7 @@ First X Coordinate - + 10 @@ -1413,6 +1533,9 @@ 20 + + 20 + @@ -1427,7 +1550,7 @@ First Y Coordinate - + 10 @@ -1439,6 +1562,9 @@ 60 + + 60 + @@ -1453,7 +1579,7 @@ Second X Coordinate - + 140 @@ -1465,6 +1591,9 @@ 30 + + 30 + @@ -1479,7 +1608,7 @@ Second Y Coordinate - + 140 @@ -1491,6 +1620,9 @@ 50 + + 50 + @@ -1505,7 +1637,7 @@ Third X Coordinate - + 300 @@ -1517,6 +1649,9 @@ 10 + + 10 + @@ -1531,7 +1666,7 @@ Third Y Coordinate - + 300 @@ -1543,6 +1678,9 @@ 30 + + 30 + @@ -1557,7 +1695,7 @@ Fourth X Coordinate - + 450 @@ -1569,6 +1707,9 @@ 20 + + 20 + @@ -1583,7 +1724,7 @@ Fourth Y Coorfinate - + 450 @@ -1595,13 +1736,16 @@ 20 + + 20 + 0 - 150 + 140 590 140 @@ -1622,7 +1766,7 @@ First X Coordinate - + 10 @@ -1634,6 +1778,9 @@ 30 + + 30 + @@ -1648,7 +1795,7 @@ First Y Coordinate - + 10 @@ -1660,6 +1807,9 @@ 50 + + 50 + @@ -1674,7 +1824,7 @@ Second X Coordinate - + 140 @@ -1686,6 +1836,9 @@ 34 + + 34 + @@ -1700,7 +1853,7 @@ Second Y Coordinate - + 140 @@ -1712,6 +1865,9 @@ 46 + + 46 + @@ -1726,7 +1882,7 @@ Third X Coordinate - + 300 @@ -1738,6 +1894,9 @@ 34 + + 34 + @@ -1752,7 +1911,7 @@ Third Y Coordinate - + 300 @@ -1764,6 +1923,9 @@ 34 + + 34 + @@ -1778,7 +1940,7 @@ Fourth X Coordinate - + 450 @@ -1790,6 +1952,9 @@ 10 + + 10 + @@ -1804,7 +1969,7 @@ Fourth Y Coorfinate - + 450 @@ -1816,13 +1981,16 @@ 30 + + 30 + 0 - 290 + 280 590 140 @@ -1843,7 +2011,7 @@ First X Coordinate - + 10 @@ -1855,6 +2023,9 @@ 70 + + 70 + @@ -1869,7 +2040,7 @@ First Y Coordinate - + 10 @@ -1881,6 +2052,9 @@ 50 + + 50 + @@ -1895,7 +2069,7 @@ Second X Coordinate - + 140 @@ -1907,6 +2081,9 @@ 46 + + 46 + @@ -1921,7 +2098,7 @@ Second Y Coordinate - + 140 @@ -1933,6 +2110,9 @@ 46 + + 46 + @@ -1947,7 +2127,7 @@ Third X Coordinate - + 300 @@ -1959,6 +2139,9 @@ 46 + + 46 + @@ -1973,7 +2156,7 @@ Third Y Coordinate - + 300 @@ -1985,6 +2168,9 @@ 34 + + 34 + @@ -1999,7 +2185,7 @@ Fourth X Coordinate - + 450 @@ -2011,6 +2197,9 @@ 30 + + 30 + @@ -2025,7 +2214,7 @@ Fourth Y Coorfinate - + 450 @@ -2037,13 +2226,16 @@ 50 + + 50 + 0 - 430 + 420 590 140 @@ -2064,7 +2256,7 @@ First X Coordinate - + 10 @@ -2076,6 +2268,9 @@ 60 + + 60 + @@ -2090,7 +2285,7 @@ First Y Coordinate - + 10 @@ -2102,6 +2297,9 @@ 60 + + 60 + @@ -2116,7 +2314,7 @@ Second X Coordinate - + 140 @@ -2128,6 +2326,9 @@ 50 + + 50 + @@ -2142,7 +2343,7 @@ Second Y Coordinate - + 140 @@ -2154,6 +2355,9 @@ 50 + + 50 + @@ -2168,7 +2372,7 @@ Third X Coordinate - + 300 @@ -2180,6 +2384,9 @@ 70 + + 70 + @@ -2194,7 +2401,7 @@ Third Y Coordinate - + 300 @@ -2206,6 +2413,9 @@ 30 + + 30 + @@ -2220,7 +2430,7 @@ Fourth X Coordinate - + 450 @@ -2232,6 +2442,9 @@ 60 + + 60 + @@ -2246,7 +2459,7 @@ Fourth Y Coorfinate - + 450 @@ -2258,6 +2471,9 @@ 20 + + 20 + @@ -2265,8 +2481,8 @@ - 310 - 90 + 360 + 60 117 29 @@ -2282,7 +2498,7 @@ 10 510 490 - 220 + 190 @@ -2671,6 +2887,13 @@ + + + CustomLineEdit + QLineEdit +
mainwindow.h
+
+