#include"Image/IntelliShapedImage.h" #include"IntelliHelper/IntelliHelper.h" #include #include #include IntelliShapedImage::IntelliShapedImage(int weight, int height) :IntelliImage(weight, height){ } IntelliShapedImage::~IntelliShapedImage(){ } QImage IntelliShapedImage::getDisplayable(){ return getDisplayable(imageData.size()); } QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){ if(polygonData.size()==0){ QImage copy = imageData; for(int y = 0; y not in Polygon if(!(cutNumberX&1)){ QColor tmpColor(0,0,0); tmpColor.setAlpha(0); copy.setPixelColor(startPoint,tmpColor); } } } return copy.scaled(displaySize,Qt::IgnoreAspectRatio); } void IntelliShapedImage::setPolygon(const std::vector& polygonData){ if(polygonData.size()<3){ return; } for(auto element:polygonData){ this->polygonData.push_back(QPoint(element.x(), element.y())); } return; }