IntelliPhoto  0.5
IntelliRasterImage.cpp
Go to the documentation of this file.
2 #include <QPainter>
3 #include <QRect>
4 #include <QDebug>
5 
7  : IntelliImage(weight, height){
8 
9 }
10 
12 
13 }
14 
16  IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height());
17  raster->imageData.fill(Qt::transparent);
18  return raster;
19 }
20 
22  // not used in raster image
23 }
24 
26  return getDisplayable(imageData.size(), alpha);
27 }
28 
29 QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
30  QImage copy = imageData;
31  for(int y = 0; y<copy.height(); y++) {
32  for(int x = 0; x<copy.width(); x++) {
33  QColor clr = copy.pixelColor(x,y);
34  clr.setAlpha(std::min(alpha, clr.alpha()));
35  copy.setPixelColor(x,y, clr);
36  }
37  }
38  return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
39 }
40 
41 void IntelliRasterImage::setPolygon(const std::vector<QPoint>& polygonData){
42  qDebug() << "Raster Image has no polygon data " << polygonData.size() <<"\n";
43  return;
44 }
IntelliRasterImage::~IntelliRasterImage
virtual ~IntelliRasterImage() override
An Destructor.
Definition: IntelliRasterImage.cpp:11
IntelliRasterImage.h
IntelliRasterImage::getDisplayable
virtual QImage getDisplayable(const QSize &displaySize, int alpha) override
A function returning the displayable ImageData in a requested transparence and size.
Definition: IntelliRasterImage.cpp:29
IntelliImage::imageData
QImage imageData
The underlying image data.
Definition: IntelliImage.h:32
IntelliImage
An abstract class which manages the basic IntelliImage operations.
Definition: IntelliImage.h:24
IntelliRasterImage::getDeepCopy
virtual IntelliImage * getDeepCopy() override
A function that copys all that returns a [allocated] Image.
Definition: IntelliRasterImage.cpp:15
IntelliRasterImage::calculateVisiblity
virtual void calculateVisiblity() override
A function that calculates the visibility of the image if a polygon is given. [does nothing in Raster...
Definition: IntelliRasterImage.cpp:21
IntelliRasterImage::setPolygon
virtual void setPolygon(const std::vector< QPoint > &polygonData) override
An abstract function that sets the data of the visible Polygon, if needed.
Definition: IntelliRasterImage.cpp:41
IntelliRasterImage::IntelliRasterImage
IntelliRasterImage(int weight, int height)
The Construcor of the IntelliRasterImage. Given the Image dimensions.
Definition: IntelliRasterImage.cpp:6
IntelliRasterImage
The IntelliRasterImage manages a Rasterimage.
Definition: IntelliRasterImage.h:9