mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-13 20:00:32 +02:00
Updatet ui fixed bugs, improved performance, just everything
Autors: @DerAnonymos @AshBastian @Sonaion
This commit is contained in:
@@ -11,7 +11,7 @@ IntelliImage::IntelliImage(int width, int height, bool fastRendererOn)
|
||||
if(fastRendererOn){
|
||||
imageData = imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
this->fastRenderer = fastRendererOn;
|
||||
this->fastRenderering = fastRendererOn;
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ bool IntelliImage::loadImage(const QString &filePath){
|
||||
// scaled Image to size of Layer
|
||||
loadedImage = loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio);
|
||||
|
||||
imageData = loadedImage.convertToFormat(fastRenderer ? QImage::Format_Indexed8 : QImage::Format_ARGB32);
|
||||
imageData = loadedImage.convertToFormat(fastRenderering ? QImage::Format_Indexed8 : QImage::Format_ARGB32);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,14 +46,16 @@ void IntelliImage::resizeImage(QImage*image, const QSize &newSize){
|
||||
// Draw the image
|
||||
QPainter painter(&newImage);
|
||||
painter.drawImage(QPoint(0, 0), *image);
|
||||
*image = newImage;
|
||||
if(fastRenderer){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
if(fastRenderering){
|
||||
*image = newImage.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
else{
|
||||
*image = newImage;
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
// Used to draw on the widget
|
||||
@@ -64,13 +66,13 @@ void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
||||
|
||||
// Draw a line from the last registered point to the current
|
||||
painter.drawPoint(p1);
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliImage::drawPoint(const QPoint &p1, const QColor& color, const int& penWidth){
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
// Used to draw on the widget
|
||||
@@ -80,13 +82,13 @@ void IntelliImage::drawPoint(const QPoint &p1, const QColor& color, const int& p
|
||||
painter.setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||
// Draw a line from the last registered point to the current
|
||||
painter.drawPoint(p1);
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth){
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
// Used to draw on the widget
|
||||
@@ -97,23 +99,23 @@ void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& co
|
||||
|
||||
// Draw a line from the last registered point to the current
|
||||
painter.drawLine(p1, p2);
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliImage::drawPlain(const QColor& color){
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
imageData.fill(color);
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
QColor IntelliImage::getPixelColor(QPoint& point){
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
QImage copy = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
return copy.pixelColor(point);
|
||||
}
|
||||
@@ -121,10 +123,29 @@ QColor IntelliImage::getPixelColor(QPoint& point){
|
||||
}
|
||||
|
||||
QImage IntelliImage::getImageData(){
|
||||
return this->imageData;
|
||||
QImage copy = imageData;
|
||||
if(fastRenderering){
|
||||
copy = copy.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
void IntelliImage::setImageData(const QImage& newData){
|
||||
imageData = newData;
|
||||
if(fastRenderering){
|
||||
this->imageData = imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
else {
|
||||
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliImage::updateRendererSetting(bool fastRendererOn){
|
||||
this->fastRenderer = fastRendererOn;
|
||||
this->imageData = this->imageData.convertToFormat(fastRenderer ? QImage::Format_Indexed8 : QImage::Format_ARGB32);
|
||||
this->fastRenderering = fastRendererOn;
|
||||
if(fastRenderering){
|
||||
this->imageData = imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
else {
|
||||
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ QImage imageData;
|
||||
ImageType TypeOfImage;
|
||||
|
||||
/*!
|
||||
* \brief fastRenderer is the flag that represents the usage of 8bit pictures.
|
||||
* \brief fastRendering is the flag that represents the usage of 8bit pictures.
|
||||
*/
|
||||
bool fastRenderer;
|
||||
bool fastRenderering;
|
||||
|
||||
public:
|
||||
/*!
|
||||
@@ -156,10 +156,16 @@ virtual QColor getPixelColor(QPoint& point);
|
||||
virtual void updateRendererSetting(bool fastRendererOn);
|
||||
|
||||
/*!
|
||||
* \brief getImageData returns the data of the current image.
|
||||
* \brief getImageData returns the data of the current image (Note: It will allways return a ARGB32bit QImage!).
|
||||
*/
|
||||
virtual QImage getImageData();
|
||||
|
||||
/*!
|
||||
* \brief setImageData overwrites the old imageData the new imageData.
|
||||
* \param newData - represents the new imageData
|
||||
*/
|
||||
virtual void setImageData(const QImage& newData);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
IntelliRasterImage::IntelliRasterImage(int width, int height, bool fastRendererOn)
|
||||
: IntelliImage(width, height, fastRendererOn){
|
||||
TypeOfImage = IntelliImage::ImageType::RASTERIMAGE;
|
||||
this->fastRenderer = fastRendererOn;
|
||||
this->fastRenderering = fastRendererOn;
|
||||
}
|
||||
|
||||
IntelliRasterImage::~IntelliRasterImage(){
|
||||
@@ -30,7 +30,7 @@ QImage IntelliRasterImage::getDisplayable(int alpha){
|
||||
|
||||
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
|
||||
QImage copy = imageData;
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
copy = copy.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
for(int y = 0; y<copy.height(); y++) {
|
||||
@@ -40,7 +40,7 @@ QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
|
||||
copy.setPixelColor(x,y, clr);
|
||||
}
|
||||
}
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
copy = copy.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
IntelliShapedImage::IntelliShapedImage(int width, int height, bool fastRendererOn)
|
||||
: IntelliRasterImage(width, height, fastRendererOn){
|
||||
TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE;
|
||||
this->fastRenderer = fastRendererOn;
|
||||
this->fastRenderering = fastRendererOn;
|
||||
}
|
||||
|
||||
IntelliShapedImage::~IntelliShapedImage(){
|
||||
@@ -27,7 +27,7 @@ IntelliImage* IntelliShapedImage::getDeepCopy(){
|
||||
}
|
||||
|
||||
void IntelliShapedImage::calculateVisiblity(){
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ void IntelliShapedImage::calculateVisiblity(){
|
||||
imageData.setPixelColor(x,y,clr);
|
||||
}
|
||||
}
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
return;
|
||||
@@ -59,14 +59,14 @@ void IntelliShapedImage::calculateVisiblity(){
|
||||
imageData.setPixelColor(x,y,clr);
|
||||
}
|
||||
}
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
|
||||
QImage copy = imageData;
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
copy = copy.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
for(int y = 0; y<copy.height(); y++) {
|
||||
@@ -76,7 +76,7 @@ QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
|
||||
copy.setPixelColor(x,y, clr);
|
||||
}
|
||||
}
|
||||
if(fastRenderer){
|
||||
if(fastRenderering){
|
||||
copy = copy.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
|
||||
|
||||
Reference in New Issue
Block a user