mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-13 03:40:31 +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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user