mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-15 21:00:37 +02:00
kein bock mehr mach dein scheiß richtig das nächste mal
This commit is contained in:
@@ -10,6 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
SOURCES += tst_unittest.cpp \
|
SOURCES += tst_unittest.cpp \
|
||||||
|
GUI/IntelliInputDialog.cpp \
|
||||||
GUI/IntelliPhotoGui.cpp \
|
GUI/IntelliPhotoGui.cpp \
|
||||||
Image/IntelliImage.cpp \
|
Image/IntelliImage.cpp \
|
||||||
Image/IntelliRasterImage.cpp \
|
Image/IntelliRasterImage.cpp \
|
||||||
@@ -41,6 +42,7 @@ DISTFILES += \
|
|||||||
icons/rectangle-tool.svg
|
icons/rectangle-tool.svg
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
GUI/IntelliInputDialog.h \
|
||||||
GUI/IntelliPhotoGui.h \
|
GUI/IntelliPhotoGui.h \
|
||||||
Image/IntelliImage.h \
|
Image/IntelliImage.h \
|
||||||
Image/IntelliRasterImage.h \
|
Image/IntelliRasterImage.h \
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
|||||||
this->Canvas->image->calculateVisiblity();
|
this->Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(drawingOfPolygon && isNearStart(x,y,QPointList.front())) {
|
else if(drawingOfPolygon && QPointList.size() > 0 && isNearStart(x,y,QPointList.front())) {
|
||||||
if(QPointList.size() > 2) {
|
if(QPointList.size() > 2) {
|
||||||
isPointNearStart = true;
|
isPointNearStart = true;
|
||||||
this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
@@ -90,7 +90,6 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
|
|||||||
if(isPointNearStart) {
|
if(isPointNearStart) {
|
||||||
isInside = false;
|
isInside = false;
|
||||||
isPointNearStart = false;
|
isPointNearStart = false;
|
||||||
isDrawing = false;
|
|
||||||
if(!isSettingPolygon) {
|
if(!isSettingPolygon) {
|
||||||
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
|
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
|
||||||
QPoint Point;
|
QPoint Point;
|
||||||
@@ -139,17 +138,11 @@ void IntelliToolPolygon::onMouseMoved(int x, int y){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){
|
bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){
|
||||||
bool isNear = false;
|
|
||||||
int StartX = Startpoint.x();
|
int StartX = Startpoint.x();
|
||||||
int StartY = Startpoint.y();
|
int StartY = Startpoint.y();
|
||||||
int valueToNear = 5;
|
int valueToNear = 5;
|
||||||
|
|
||||||
for(int i = StartX - valueToNear; i < StartX + valueToNear; i++) {
|
float euklid = sqrt(pow(static_cast<float>(StartX-x),2.f)+pow(static_cast<float>(StartY-y),2.f));
|
||||||
for(int j = StartY - valueToNear; j < StartY + valueToNear; j++) {
|
|
||||||
if((i == x) && (j == y)) {
|
return static_cast<int>(euklid)<valueToNear;
|
||||||
isNear = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return isNear;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,24 +274,6 @@ void UnitTest::test_floodFill(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
area->layerBundle[0].image->drawPlain(QColor(-1, -1, -1, -1));
|
|
||||||
for(size_t i = 0; i<200; i++) {
|
|
||||||
point.setX(static_cast<int>(i));
|
|
||||||
for(size_t j = 0; i<200; i++) {
|
|
||||||
point.setY(static_cast<int>(j));
|
|
||||||
QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
area->layerBundle[0].image->drawPlain(QColor(256, 256, 256, 256));
|
|
||||||
for(size_t i = 0; i<200; i++) {
|
|
||||||
point.setX(static_cast<int>(i));
|
|
||||||
for(size_t j = 0; i<200; i++) {
|
|
||||||
point.setY(static_cast<int>(j));
|
|
||||||
QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
area->deleteLayer(0);
|
area->deleteLayer(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +281,7 @@ void UnitTest::test_moveActive(){
|
|||||||
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
|
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
|
||||||
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
|
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
|
||||||
|
|
||||||
area->layerBundle[0].image->drawPlain(QColor(0, 0, 0, 255));
|
area->layerBundle[1].image->drawPlain(QColor(0, 0, 0, 255));
|
||||||
QPoint point(0,0);
|
QPoint point(0,0);
|
||||||
|
|
||||||
area->moveActiveLayer(-1);
|
area->moveActiveLayer(-1);
|
||||||
@@ -1153,20 +1135,20 @@ void UnitTest::bench_moveActive(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UnitTest::bench_setPolygon(){
|
void UnitTest::bench_setPolygon(){
|
||||||
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
|
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
|
||||||
|
|
||||||
std::vector<QPoint> polygon{
|
std::vector<QPoint> polygon{
|
||||||
QPoint(10,00),
|
QPoint(10,00),
|
||||||
QPoint(00,10),
|
QPoint(00,10),
|
||||||
QPoint(10,10),
|
QPoint(10,10),
|
||||||
QPoint(00,10)
|
QPoint(00,10)
|
||||||
};
|
};
|
||||||
|
|
||||||
QBENCHMARK{
|
QBENCHMARK{
|
||||||
area->layerBundle[1].image->setPolygon(polygon);
|
area->layerBundle[0].image->setPolygon(polygon);
|
||||||
}
|
}
|
||||||
|
|
||||||
area->deleteLayer(0);
|
area->deleteLayer(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnitTest::bench_setLayerUp(){
|
void UnitTest::bench_setLayerUp(){
|
||||||
@@ -1578,65 +1560,65 @@ void UnitTest::bench_Plain_interruptedDraw(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UnitTest::bench_Polygon_fullDraw(){
|
void UnitTest::bench_Polygon_fullDraw(){
|
||||||
area->addLayer(21,21,10,20,IntelliImage::ImageType::RASTERIMAGE);
|
area->addLayer(21,21,10,20,IntelliImage::ImageType::RASTERIMAGE);
|
||||||
std::vector<QPoint> points{
|
std::vector<QPoint> points{
|
||||||
QPoint(10,00),
|
QPoint(10,00),
|
||||||
QPoint(00,10),
|
QPoint(00,10),
|
||||||
QPoint(10,20),
|
QPoint(10,20),
|
||||||
QPoint(20,10)
|
QPoint(20,10)
|
||||||
};
|
};
|
||||||
|
|
||||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||||
area->createPolygonTool();
|
area->createPolygonTool();
|
||||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||||
|
|
||||||
QBENCHMARK{
|
QBENCHMARK{
|
||||||
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
|
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
|
||||||
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
|
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
|
||||||
area->Tool->onMouseMoved(points[1].x(), points[1].y());
|
area->Tool->onMouseMoved(points[1].x(), points[1].y());
|
||||||
|
|
||||||
area->Tool->onMouseLeftPressed(points[1].x(), points[1].y());
|
area->Tool->onMouseLeftPressed(points[1].x(), points[1].y());
|
||||||
area->Tool->onMouseLeftReleased(points[1].x(), points[1].y());
|
area->Tool->onMouseLeftReleased(points[1].x(), points[1].y());
|
||||||
area->Tool->onMouseMoved(points[2].x(), points[2].y());
|
area->Tool->onMouseMoved(points[2].x(), points[2].y());
|
||||||
|
|
||||||
area->Tool->onMouseLeftPressed(points[2].x(), points[2].y());
|
area->Tool->onMouseLeftPressed(points[2].x(), points[2].y());
|
||||||
area->Tool->onMouseLeftReleased(points[2].x(), points[2].y());
|
area->Tool->onMouseLeftReleased(points[2].x(), points[2].y());
|
||||||
area->Tool->onMouseMoved(points[3].x(), points[3].y());
|
area->Tool->onMouseMoved(points[3].x(), points[3].y());
|
||||||
|
|
||||||
area->Tool->onMouseLeftPressed(points[3].x(), points[3].y());
|
area->Tool->onMouseLeftPressed(points[3].x(), points[3].y());
|
||||||
area->Tool->onMouseLeftReleased(points[3].x(), points[3].y());
|
area->Tool->onMouseLeftReleased(points[3].x(), points[3].y());
|
||||||
area->Tool->onMouseMoved(points[0].x(), points[0].y());
|
area->Tool->onMouseMoved(points[0].x(), points[0].y());
|
||||||
|
|
||||||
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
|
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
|
||||||
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
|
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
|
||||||
}
|
}
|
||||||
|
|
||||||
area->deleteLayer(0);
|
area->deleteLayer(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UnitTest::bench_Polygon_interruptedDraw(){
|
void UnitTest::bench_Polygon_interruptedDraw(){
|
||||||
area->addLayer(201,201,10,20,IntelliImage::ImageType::RASTERIMAGE);
|
area->addLayer(201,201,10,20,IntelliImage::ImageType::RASTERIMAGE);
|
||||||
std::vector<QPoint> points{
|
std::vector<QPoint> points{
|
||||||
QPoint(100,000)
|
QPoint(100,000)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||||
area->createPolygonTool();
|
area->createPolygonTool();
|
||||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||||
|
|
||||||
QBENCHMARK{
|
QBENCHMARK{
|
||||||
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
|
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
|
||||||
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
|
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
|
||||||
|
|
||||||
area->Tool->onMouseRightPressed(points[0].x(), points[0].y());
|
area->Tool->onMouseRightPressed(points[0].x(), points[0].y());
|
||||||
area->Tool->onMouseRightReleased(points[0].x(), points[0].y());
|
area->Tool->onMouseRightReleased(points[0].x(), points[0].y());
|
||||||
}
|
}
|
||||||
|
|
||||||
area->deleteLayer(0);
|
area->deleteLayer(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user