Restore of old painting

This commit is contained in:
Jonas Mucke
2019-12-04 18:07:54 +01:00
parent 69c2750358
commit 161165bf34
13 changed files with 82 additions and 867 deletions

View File

@@ -19,10 +19,8 @@ bool IntelliImage::loadImage(const QString &fileName){
if (!loadedImage.load(fileName))
return false;
// scaled Image to size of Layer
// loadedImage = loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio);
imageData = loadedImage.convertToFormat(QImage::Format_ARGB32);
loadedImage =loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio);
imageData= loadedImage.convertToFormat(QImage::Format_ARGB32);
return true;
}

View File

@@ -29,8 +29,8 @@ public:
virtual void floodFill(const QColor& color);
//returns the filtered output
virtual QImage getDisplayable(const QSize& displaySize, int alpha)=0;
virtual QImage getDisplayable(int alpha=255)=0;
virtual QImage getDisplayable(const QSize& displaySize)=0;
virtual QImage getDisplayable()=0;
//returns the filtered output

View File

@@ -12,19 +12,12 @@ IntelliRasterImage::~IntelliRasterImage(){
}
QImage IntelliRasterImage::getDisplayable(int alpha){
return getDisplayable(imageData.size(), alpha);
QImage IntelliRasterImage::getDisplayable(){
return getDisplayable(imageData.size());
}
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize){
QImage copy = imageData;
for(int y = 0; y<copy.height(); y++){
for(int x = 0; x<copy.width(); x++){
QColor clr = copy.pixelColor(x,y);
clr.setAlpha(alpha);
copy.setPixelColor(x,y, clr);
}
}
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
}

View File

@@ -10,8 +10,8 @@ public:
virtual ~IntelliRasterImage() override;
//returns the filtered output
virtual QImage getDisplayable(const QSize& displaySize,int alpha) override;
virtual QImage getDisplayable(int alpha=255) override;
virtual QImage getDisplayable(const QSize& displaySize) override;
virtual QImage getDisplayable() override;
//sets the data for the visible image

View File

@@ -12,11 +12,11 @@ IntelliShapedImage::~IntelliShapedImage(){
}
QImage IntelliShapedImage::getDisplayable(int alpha){
QImage IntelliShapedImage::getDisplayable(){
return getDisplayable(imageData.size());
}
QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
QImage IntelliShapedImage::getDisplayable(const QSize& displaySize){
QImage copy = imageData;
QPoint startPoint;
QPoint extrem(0,copy.width()+1);
@@ -38,10 +38,6 @@ QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
QColor tmpColor(0,0,0);
tmpColor.setAlpha(0);
copy.setPixelColor(startPoint,tmpColor);
}else{
QColor clr = copy.pixelColor(x,y);
clr.setAlpha(alpha);
copy.setPixelColor(x,y,clr);
}
}
}

View File

@@ -12,8 +12,8 @@ public:
virtual ~IntelliShapedImage() override;
//returns the filtered output
virtual QImage getDisplayable(const QSize& displaySize, int alpha=255) override;
virtual QImage getDisplayable(int alpha=255) override;
virtual QImage getDisplayable(const QSize& displaySize) override;
virtual QImage getDisplayable() override;
//sets the data for the visible image
virtual void setPolygon(const std::vector<QPoint>& polygonData) override;