mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
UI triangle
This commit is contained in:
@ -127,11 +127,15 @@ void MainWindow::on_GradientType_itemClicked(QListWidgetItem *item)
|
||||
else if (item->text() == "Triangle") {
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
{{100, 100}, {300, 200}, {200, 350}},
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{}, false
|
||||
);
|
||||
points = {{100 / 3.84, 100 / 3.84}, {300 / 3.84, 200 / 3.84}, {200 / 3.84, 350 / 3.84}};
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
}
|
||||
else if (item->text() == "Functional" ) {
|
||||
info.gradient_type = c_BrushTypePathNewLinearGradient;
|
||||
@ -141,11 +145,15 @@ void MainWindow::on_GradientType_itemClicked(QListWidgetItem *item)
|
||||
else if (item->text() == "TriangleParametric" ) {
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
{{100, 100}, {300, 200}, {200, 350}},
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{0, 0.4, 1}, true
|
||||
);
|
||||
points = {{100 / 3.84, 100 / 3.84}, {300 / 3.84, 200 / 3.84}, {200 / 3.84, 350 / 3.84}};
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
}
|
||||
else if (item->text() == "CoonsPatch" ) {
|
||||
info.gradient_type = c_BrushTypePathNewLinearGradient;
|
||||
@ -363,3 +371,222 @@ void MainWindow::on_ContinueBack_clicked(bool checked)
|
||||
on_RenderPic_clicked();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::on_TrianglePoint1X_sliderMoved(int position)
|
||||
{
|
||||
|
||||
info.triangle[0].x = position;
|
||||
if (info.ginfo.shading.shading_type == NSStructures::ShadingInfo::TriangleInterpolation)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{}, false
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
return;
|
||||
}
|
||||
else if (info.gradient_type == c_BrushTypeTriagnleMeshGradient)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{0, 0.4, 1}, true
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_TrianglePoint1Y_sliderMoved(int position)
|
||||
{
|
||||
info.triangle[0].y = position;
|
||||
if (info.ginfo.shading.shading_type == NSStructures::ShadingInfo::TriangleInterpolation)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{}, false
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
return;
|
||||
}
|
||||
else if (info.gradient_type == c_BrushTypeTriagnleMeshGradient)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{0, 0.4, 1}, true
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_TrianglePoint2X_sliderMoved(int position)
|
||||
{
|
||||
info.triangle[1].x = position;
|
||||
if (info.ginfo.shading.shading_type == NSStructures::ShadingInfo::TriangleInterpolation)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{}, false
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
return;
|
||||
}
|
||||
else if (info.gradient_type == c_BrushTypeTriagnleMeshGradient)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{0, 0.4, 1}, true
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_TrianglePoint2Y_sliderMoved(int position)
|
||||
{
|
||||
info.triangle[1].y = position;
|
||||
if (info.ginfo.shading.shading_type == NSStructures::ShadingInfo::TriangleInterpolation)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{}, false
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
return;
|
||||
}
|
||||
else if (info.gradient_type == c_BrushTypeTriagnleMeshGradient)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{0, 0.4, 1}, true
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_TrianglePoint3X_sliderMoved(int position)
|
||||
{
|
||||
info.triangle[2].x = position;
|
||||
if (info.ginfo.shading.shading_type == NSStructures::ShadingInfo::TriangleInterpolation)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{}, false
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
return;
|
||||
}
|
||||
else if (info.gradient_type == c_BrushTypeTriagnleMeshGradient)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{0, 0.4, 1}, true
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_TrianglePoint3Y_sliderMoved(int position)
|
||||
{
|
||||
info.triangle[2].y = position;
|
||||
if (info.ginfo.shading.shading_type == NSStructures::ShadingInfo::TriangleInterpolation)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{}, false
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
return;
|
||||
}
|
||||
else if (info.gradient_type == c_BrushTypeTriagnleMeshGradient)
|
||||
{
|
||||
info.gradient_type = c_BrushTypeTriagnleMeshGradient;
|
||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||
info.triangle,
|
||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||
{0, 0.4, 1}, true
|
||||
);
|
||||
points = {};
|
||||
for (auto p : info.triangle)
|
||||
{
|
||||
points.push_back({p.x / 3.84, p.y / 3.84});
|
||||
}
|
||||
on_RenderPic_clicked();
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@ struct Info {
|
||||
NSStructures::Point c0, c1;
|
||||
NSStructures::Point p0, p1;
|
||||
bool cont_b, cont_f;
|
||||
std::vector<NSStructures::Point> triangle ={{100, 100}, {300, 200}, {200, 350}};
|
||||
|
||||
|
||||
NSStructures::GradientInfo ginfo;
|
||||
@ -111,6 +112,18 @@ private slots:
|
||||
|
||||
void on_ContinueBack_clicked(bool checked);
|
||||
|
||||
void on_TrianglePoint1X_sliderMoved(int position);
|
||||
|
||||
void on_TrianglePoint1Y_sliderMoved(int position);
|
||||
|
||||
void on_TrianglePoint2X_sliderMoved(int position);
|
||||
|
||||
void on_TrianglePoint2Y_sliderMoved(int position);
|
||||
|
||||
void on_TrianglePoint3X_sliderMoved(int position);
|
||||
|
||||
void on_TrianglePoint3Y_sliderMoved(int position);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
|
||||
@ -422,6 +422,133 @@
|
||||
<string>Continue Back</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="TrianglePoint1X">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>190</y>
|
||||
<width>160</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>400</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="TrianglePoint1Y">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>220</y>
|
||||
<width>160</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>400</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="TrianglePoint2Y">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>290</y>
|
||||
<width>160</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>400</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="TrianglePoint2X">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>260</y>
|
||||
<width>160</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>400</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="TrianglePoint3Y">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>350</y>
|
||||
<width>160</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>400</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>350</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="TrianglePoint3X">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>320</y>
|
||||
<width>160</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>400</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>170</y>
|
||||
<width>111</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>XY triangle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
|
||||
Reference in New Issue
Block a user