mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-18 22:30:30 +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);
|
QPainter painter(&newImage);
|
||||||
painter.drawImage(QPoint(0, 0), *image);
|
painter.drawImage(QPoint(0, 0), *image);
|
||||||
*image = newImage;
|
*image = newImage;
|
||||||
updateRendererSetting(fastRenderer);
|
if(fastRenderer){
|
||||||
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
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
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawPoint(p1);
|
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){
|
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));
|
painter.setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
// Draw a line from the last registered point to the current
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawPoint(p1);
|
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){
|
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
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawLine(p1, p2);
|
painter.drawLine(p1, p2);
|
||||||
updateRendererSetting(fastRenderer);
|
if(fastRenderer){
|
||||||
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::drawPlain(const QColor& color){
|
void IntelliImage::drawPlain(const QColor& color){
|
||||||
@@ -93,11 +101,17 @@ void IntelliImage::drawPlain(const QColor& color){
|
|||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
imageData.fill(color);
|
imageData.fill(color);
|
||||||
updateRendererSetting(fastRenderer);
|
if(fastRenderer){
|
||||||
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor IntelliImage::getPixelColor(QPoint& point){
|
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){
|
void IntelliImage::updateRendererSetting(bool fastRendererOn){
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public:
|
|||||||
bool getFastRenderer();
|
bool getFastRenderer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool fastRenderer = false;
|
bool fastRenderer = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INTELLIRENDERSETTINGS_H
|
#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){
|
void PaintingArea::movePositionActive(int x, int y){
|
||||||
if(Tool->getIsDrawing()){
|
if(Tool!=nullptr){
|
||||||
IntelliTool* temp = copyActiveTool();
|
if(Tool->getIsDrawing()){
|
||||||
delete this->Tool;
|
IntelliTool* temp = copyActiveTool();
|
||||||
this->Tool = temp;
|
delete this->Tool;
|
||||||
|
this->Tool = temp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
layerBundle[static_cast<size_t>(activeLayer)].widthOffset += x;
|
layerBundle[static_cast<size_t>(activeLayer)].widthOffset += x;
|
||||||
layerBundle[static_cast<size_t>(activeLayer)].heightOffset += y;
|
layerBundle[static_cast<size_t>(activeLayer)].heightOffset += y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::moveActiveLayer(int idx){
|
void PaintingArea::moveActiveLayer(int idx){
|
||||||
if(Tool->getIsDrawing()){
|
if(Tool!=nullptr){
|
||||||
IntelliTool* temp = copyActiveTool();
|
if(Tool->getIsDrawing()){
|
||||||
delete this->Tool;
|
IntelliTool* temp = copyActiveTool();
|
||||||
this->Tool = temp;
|
delete this->Tool;
|
||||||
}
|
this->Tool = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(idx==1) {
|
if(idx==1) {
|
||||||
this->selectLayerUp();
|
this->selectLayerUp();
|
||||||
}else if(idx==-1) {
|
}else if(idx==-1) {
|
||||||
@@ -170,11 +174,13 @@ void PaintingArea::moveActiveLayer(int idx){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::slotActivateLayer(int a){
|
void PaintingArea::slotActivateLayer(int a){
|
||||||
|
if(Tool!=nullptr){
|
||||||
if(Tool->getIsDrawing()){
|
if(Tool->getIsDrawing()){
|
||||||
IntelliTool* temp = copyActiveTool();
|
IntelliTool* temp = copyActiveTool();
|
||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
this->Tool = temp;
|
this->Tool = temp;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(a>=0 && a < static_cast<int>(layerBundle.size())) {
|
if(a>=0 && a < static_cast<int>(layerBundle.size())) {
|
||||||
this->setLayerActive(a);
|
this->setLayerActive(a);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void IntelliTool::mergeToolLayer(){
|
|||||||
QColor clr_0;
|
QColor clr_0;
|
||||||
QColor clr_1;
|
QColor clr_1;
|
||||||
if(Area->renderSettings.getFastRenderer()){
|
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 y=0; y<activeLayer->height; y++) {
|
||||||
for(int x=0; x<activeLayer->width; x++) {
|
for(int x=0; x<activeLayer->width; x++) {
|
||||||
@@ -77,7 +77,7 @@ void IntelliTool::mergeToolLayer(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Area->renderSettings.getFastRenderer()){
|
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