mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-14 12:20:32 +02:00
now working 100% :D
Fixed a bug where a not activatet tool caused trouble.
This commit is contained in:
@@ -41,7 +41,9 @@ void IntelliImage::resizeImage(QImage*image, const QSize &newSize){
|
||||
QPainter painter(&newImage);
|
||||
painter.drawImage(QPoint(0, 0), *image);
|
||||
*image = newImage;
|
||||
updateRendererSetting(fastRenderer);
|
||||
if(fastRenderer){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
||||
@@ -56,7 +58,9 @@ void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
||||
|
||||
// Draw a line from the last registered point to the current
|
||||
painter.drawPoint(p1);
|
||||
updateRendererSetting(fastRenderer);
|
||||
if(fastRenderer){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliImage::drawPoint(const QPoint &p1, const QColor& color, const int& penWidth){
|
||||
@@ -70,7 +74,9 @@ 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);
|
||||
updateRendererSetting(fastRenderer);
|
||||
if(fastRenderer){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth){
|
||||
@@ -85,7 +91,9 @@ 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);
|
||||
updateRendererSetting(fastRenderer);
|
||||
if(fastRenderer){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliImage::drawPlain(const QColor& color){
|
||||
@@ -93,11 +101,17 @@ void IntelliImage::drawPlain(const QColor& color){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
imageData.fill(color);
|
||||
updateRendererSetting(fastRenderer);
|
||||
if(fastRenderer){
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
QColor IntelliImage::getPixelColor(QPoint& point){
|
||||
return imageData.pixelColor(point);
|
||||
if(fastRenderer){
|
||||
QImage copy = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
return copy.pixelColor(point);
|
||||
}
|
||||
return imageData.pixelColor(point);
|
||||
}
|
||||
|
||||
void IntelliImage::updateRendererSetting(bool fastRendererOn){
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
bool getFastRenderer();
|
||||
|
||||
private:
|
||||
bool fastRenderer = false;
|
||||
bool fastRenderer = true;
|
||||
};
|
||||
|
||||
#endif // INTELLIRENDERSETTINGS_H
|
||||
|
||||
@@ -147,21 +147,25 @@ void PaintingArea::floodFill(int r, int g, int b, int a){
|
||||
}
|
||||
|
||||
void PaintingArea::movePositionActive(int x, int y){
|
||||
if(Tool->getIsDrawing()){
|
||||
IntelliTool* temp = copyActiveTool();
|
||||
delete this->Tool;
|
||||
this->Tool = temp;
|
||||
if(Tool!=nullptr){
|
||||
if(Tool->getIsDrawing()){
|
||||
IntelliTool* temp = copyActiveTool();
|
||||
delete this->Tool;
|
||||
this->Tool = temp;
|
||||
}
|
||||
}
|
||||
layerBundle[static_cast<size_t>(activeLayer)].widthOffset += x;
|
||||
layerBundle[static_cast<size_t>(activeLayer)].heightOffset += y;
|
||||
}
|
||||
|
||||
void PaintingArea::moveActiveLayer(int idx){
|
||||
if(Tool->getIsDrawing()){
|
||||
IntelliTool* temp = copyActiveTool();
|
||||
delete this->Tool;
|
||||
this->Tool = temp;
|
||||
}
|
||||
if(Tool!=nullptr){
|
||||
if(Tool->getIsDrawing()){
|
||||
IntelliTool* temp = copyActiveTool();
|
||||
delete this->Tool;
|
||||
this->Tool = temp;
|
||||
}
|
||||
}
|
||||
if(idx==1) {
|
||||
this->selectLayerUp();
|
||||
}else if(idx==-1) {
|
||||
@@ -170,11 +174,13 @@ void PaintingArea::moveActiveLayer(int idx){
|
||||
}
|
||||
|
||||
void PaintingArea::slotActivateLayer(int a){
|
||||
if(Tool!=nullptr){
|
||||
if(Tool->getIsDrawing()){
|
||||
IntelliTool* temp = copyActiveTool();
|
||||
delete this->Tool;
|
||||
this->Tool = temp;
|
||||
}
|
||||
}
|
||||
if(a>=0 && a < static_cast<int>(layerBundle.size())) {
|
||||
this->setLayerActive(a);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void IntelliTool::mergeToolLayer(){
|
||||
QColor clr_0;
|
||||
QColor clr_1;
|
||||
if(Area->renderSettings.getFastRenderer()){
|
||||
activeLayer->image->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
activeLayer->image->imageData = activeLayer->image->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
for(int y=0; y<activeLayer->height; y++) {
|
||||
for(int x=0; x<activeLayer->width; x++) {
|
||||
@@ -77,7 +77,7 @@ void IntelliTool::mergeToolLayer(){
|
||||
}
|
||||
}
|
||||
if(Area->renderSettings.getFastRenderer()){
|
||||
activeLayer->image->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
activeLayer->image->imageData = activeLayer->image->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user