Merge branch 'experimental_layer' into dev

This commit is contained in:
2019-12-06 08:55:24 +01:00
51 changed files with 5351 additions and 15 deletions

View File

@@ -35,6 +35,7 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
this->addLayer(200,200,150,150);
layerStructure[1].image->floodFill(QColor(0,255,0,255));
layerStructure[1].alpha=200;
activeLayer=1;
#endif
}
@@ -55,7 +56,7 @@ void PaintingArea::setUp(int maxWidth, int maxHeight){
myPenColor = Qt::blue;
}
void PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset, ImageType type){
int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset, ImageType type){
LayerObject newLayer;
newLayer.width = width;
newLayer.height = height;
@@ -68,7 +69,7 @@ void PaintingArea::addLayer(int width, int height, int widthOffset, int heightOf
}
newLayer.alpha = 255;
this->layerStructure.push_back(newLayer);
return layerStructure.size()-1;
}
void PaintingArea::deleteLayer(int index){
@@ -80,6 +81,11 @@ void PaintingArea::deleteLayer(int index){
}
}
void PaintingArea::deleteActiveLayer(){
this->layerStructure.erase(layerStructure.begin()+activeLayer);
activeLayer--;
}
void PaintingArea::setLayerToActive(int index) {
if(index<layerStructure.size()){
this->activeLayer=index;
@@ -185,7 +191,7 @@ void PaintingArea::getMoveLeft(int a){
}
void PaintingArea::getMoveLayerUp(){
if(activeLayer<layerStructure.size() && activeLayer>=0){
if(activeLayer<layerStructure.size()-1 && activeLayer>=0){
std::swap(layerStructure[activeLayer], layerStructure[activeLayer+1]);
activeLayer++;
}

View File

@@ -23,7 +23,7 @@ public:
bool openImage(const QString &fileName);
bool saveImage(const QString &fileName, const char *fileFormat);
void 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, ImageType type = ImageType::Raster_Image);
void deleteLayer(int index);
void setLayerToActive(int index);
void setAlphaToLayer(int index, int alpha);
@@ -44,6 +44,7 @@ public slots:
// Events to handle
void clearImage(int r, int g, int b);
void activate(int a);
void deleteActiveLayer();
void setAlpha(int a);
void getMoveUp(int a);