Polygon Fixes

Polygon kann jetzt im Shaped-Image nicht außerhalb des Polygons gestartet werden
This commit is contained in:
AshBastian
2020-01-07 17:39:52 +01:00
parent 011026899c
commit e540bd64f2
11 changed files with 67 additions and 21 deletions

View File

@@ -22,7 +22,7 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
: QWidget(parent){
this->Tool = nullptr;
this->setLayerDimensions(maxWidth, maxHeight);
this->addLayer(200,200,0,0,ImageType::Shaped_Image);
this->addLayer(200,200,0,0,IntelliImage::ImageType::Shaped_Image);
layerBundle[0].image->drawPlain(QColor(0,0,255,255));
std::vector<QPoint> polygon;
polygon.push_back(QPoint(100,000));
@@ -31,7 +31,7 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
polygon.push_back(QPoint(000,100));
layerBundle[0].image->setPolygon(polygon);
this->addLayer(200,200,150,150);
this->addLayer(200,200,150,150,IntelliImage::ImageType::Raster_Image);
layerBundle[1].image->drawPlain(QColor(0,255,0,255));
layerBundle[1].alpha=200;
@@ -53,15 +53,15 @@ void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){
}
int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset, ImageType type){
int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset, IntelliImage::ImageType type){
LayerObject newLayer;
newLayer.width = width;
newLayer.height = height;
newLayer.widthOffset = widthOffset;
newLayer.heightOffset = heightOffset;
if(type==ImageType::Raster_Image) {
if(type==IntelliImage::ImageType::Raster_Image) {
newLayer.image = new IntelliRasterImage(width,height);
}else if(type==ImageType::Shaped_Image) {
}else if(type==IntelliImage::ImageType::Shaped_Image) {
newLayer.image = new IntelliShapedImage(width, height);
}
newLayer.alpha = 255;
@@ -234,6 +234,14 @@ int PaintingArea::getHeightOfActive(){
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].height;
}
IntelliImage::ImageType PaintingArea::getTypeOfImageRealLayer(){
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].image->getTypeOfImage();
}
std::vector<QPoint> PaintingArea::getPolygonDataOfRealLayer(){
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].image->getPolygonData();
}
// If a mouse button is pressed check if it was the
// left button and if so store the current position
// Set that we are currently drawing

View File

@@ -79,7 +79,7 @@ public:
* \param type - Defining the ImageType of the new layer
* \return Returns the number of layers in the project
*/
int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, ImageType type = ImageType::Raster_Image);
int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::Raster_Image);
/*!
* \brief The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer stack
* \param idx - ID of the position the new layer should be added
@@ -90,7 +90,7 @@ public:
* \param type - Defining the ImageType of the new layer
* \return Returns the id of the layer position
*/
int addLayerAt(int idx, int width, int height, int widthOffset=0, int heightOffset=0, ImageType type = ImageType::Raster_Image);
int addLayerAt(int idx, int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::Raster_Image);
/*!
* \brief The deleteLayer method removes a layer at a given index
* \param index - The index of the layer to be removed
@@ -161,6 +161,10 @@ public:
*/
int getHeightOfActive();
IntelliImage::ImageType getTypeOfImageRealLayer();
std::vector<QPoint> getPolygonDataOfRealLayer();
public slots:
// Events to handle
/*!