IntelliRasterImage.cpp
Go to the documentation of this file.
#include "Image/IntelliRasterImage.h"
#include <QPainter>
#include <QRect>
#include <QDebug>
IntelliRasterImage::IntelliRasterImage(int width, int height, bool fastRendererOn)
: IntelliImage(width, height, fastRendererOn){
TypeOfImage = ImageType::RASTERIMAGE;
}
IntelliRasterImage::~IntelliRasterImage(){
}
IntelliImage* IntelliRasterImage::getDeepCopy(){
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), false);
raster->imageData.fill(Qt::transparent);
raster->TypeOfImage = ImageType::RASTERIMAGE;
return raster;
}
void IntelliRasterImage::calculateVisiblity(){
// not used in raster image
}
QImage IntelliRasterImage::getDisplayable(int alpha){
return getDisplayable(imageData.size(), alpha);
}
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
QImage copy = imageData;
if(fastRenderering) {
copy = copy.convertToFormat(QImage::Format_ARGB32);
}
for(int y = 0; y<copy.height(); y++) {
for(int x = 0; x<copy.width(); x++) {
QColor clr = copy.pixelColor(x,y);
clr.setAlpha(std::min(alpha, clr.alpha()));
copy.setPixelColor(x,y, clr);
}
}
if(fastRenderering) {
copy = copy.convertToFormat(QImage::Format_Indexed8);
}
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
}
void IntelliRasterImage::setPolygon(const std::vector<QPoint>& polygonData){
return;
}
std::vector<QPoint> IntelliRasterImage::getPolygon(){
return std::vector<QPoint>();
}
ImageType::RASTERIMAGE
@ RASTERIMAGE
IntelliRasterImage::~IntelliRasterImage
virtual ~IntelliRasterImage() override
An Destructor.
Definition: IntelliRasterImage.cpp:12
IntelliRasterImage::IntelliRasterImage
IntelliRasterImage(int width, int height, bool fastRendererOn)
The Construcor of the IntelliRasterImage. Given the Image dimensions.
Definition: IntelliRasterImage.cpp:6
IntelliRasterImage.h
IntelliImage::fastRenderering
bool fastRenderering
fastRendering is the flag that represents the usage of 8bit pictures.
Definition: IntelliImage.h:51
IntelliRasterImage::getPolygon
virtual std::vector< QPoint > getPolygon()
getPolygon
Definition: IntelliRasterImage.cpp:53
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:31
IntelliImage::TypeOfImage
ImageType TypeOfImage
The Type, an Image is.
Definition: IntelliImage.h:46
IntelliImage::imageData
QImage imageData
The underlying image data.
Definition: IntelliImage.h:41
IntelliImage
An abstract class which manages the basic IntelliImage operations.
Definition: IntelliImage.h:30
IntelliRasterImage::getDeepCopy
virtual IntelliImage * getDeepCopy() override
A function that copys all that returns a [allocated] Image.
Definition: IntelliRasterImage.cpp:16
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:23
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:49
IntelliRasterImage
The IntelliRasterImage manages a RASTERIMAGE.
Definition: IntelliRasterImage.h:12