#include "Image/IntelliShapedImage.h" #include "IntelliHelper/IntelliTriangulation.h" #include #include #include IntelliShapedImage::IntelliShapedImage(int weight, int height) : IntelliRasterImage(weight, height){ TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE; } IntelliShapedImage::~IntelliShapedImage(){ } QImage IntelliShapedImage::getDisplayable(int alpha){ return getDisplayable(imageData.size(),alpha); } IntelliImage* IntelliShapedImage::getDeepCopy(){ IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height()); shaped->setPolygon(this->polygonData); shaped->imageData.fill(Qt::transparent); shaped->TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE; return shaped; } void IntelliShapedImage::calculateVisiblity(){ if(polygonData.size()<=2) { QColor clr; for(int y=0; y& polygonData){ if(polygonData.size()<3) { this->polygonData.clear(); }else{ this->polygonData.clear(); for(auto element:polygonData) { this->polygonData.push_back(QPoint(element.x(), element.y())); } triangles = IntelliTriangulation::calculateTriangles(polygonData); } calculateVisiblity(); return; }