mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-13 11:50:31 +02:00
Restyled project for uncrustify
This commit is contained in:
@@ -6,75 +6,74 @@
|
||||
#include <queue>
|
||||
|
||||
IntelliToolFloodFill::IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker)
|
||||
:IntelliTool(Area, colorPicker){
|
||||
: IntelliTool(Area, colorPicker){
|
||||
}
|
||||
|
||||
IntelliToolFloodFill::~IntelliToolFloodFill(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
void IntelliToolFloodFill::onMouseRightPressed(int x, int y){
|
||||
IntelliTool::onMouseRightPressed(x,y);
|
||||
IntelliTool::onMouseRightPressed(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolFloodFill::onMouseRightReleased(int x, int y){
|
||||
IntelliTool::onMouseRightReleased(x,y);
|
||||
IntelliTool::onMouseRightReleased(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolFloodFill::onMouseLeftPressed(int x, int y){
|
||||
if(!(x>=0 && x<Area->getWidthOfActive() && y>=0 && y<Area->getHeightOfActive())){
|
||||
return;
|
||||
}
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
if(!(x>=0 && x<Area->getWidthOfActive() && y>=0 && y<Area->getHeightOfActive())) {
|
||||
return;
|
||||
}
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
|
||||
QPoint start(x,y);
|
||||
std::queue<QPoint> Q;
|
||||
Q.push(start);
|
||||
QPoint start(x,y);
|
||||
std::queue<QPoint> Q;
|
||||
Q.push(start);
|
||||
|
||||
QColor oldColor = this->Active->image->getPixelColor(start);
|
||||
QColor newColor = this->colorPicker->getFirstColor();
|
||||
Canvas->image->drawPixel(start,newColor);
|
||||
QColor oldColor = this->Active->image->getPixelColor(start);
|
||||
QColor newColor = this->colorPicker->getFirstColor();
|
||||
Canvas->image->drawPixel(start,newColor);
|
||||
|
||||
QPoint left, right, top, down;
|
||||
while(!Q.empty()){
|
||||
QPoint Current = Q.front();
|
||||
Q.pop();
|
||||
QPoint left, right, top, down;
|
||||
while(!Q.empty()) {
|
||||
QPoint Current = Q.front();
|
||||
Q.pop();
|
||||
|
||||
left = QPoint(Current.x()-1,Current.y() );
|
||||
right = QPoint(Current.x()+1,Current.y() );
|
||||
top = QPoint(Current.x() ,Current.y()-1);
|
||||
down = QPoint(Current.x() ,Current.y()+1);
|
||||
if((right.x() < Canvas->width) && (Canvas->image->getPixelColor(right) != newColor) && (Active->image->getPixelColor(right) == oldColor)){
|
||||
Canvas->image->drawPixel(right,newColor);
|
||||
Q.push(right);
|
||||
}
|
||||
if((left.x() >= 0) && (Canvas->image->getPixelColor(left) != newColor) && (Active->image->getPixelColor(left) == oldColor)){
|
||||
Canvas->image->drawPixel(left,newColor);
|
||||
Q.push(left);
|
||||
}
|
||||
if((top.y() >= 0) && (Canvas->image->getPixelColor(top) != newColor) && (Active->image->getPixelColor(top) == oldColor)){
|
||||
Canvas->image->drawPixel(top,newColor);
|
||||
Q.push(top);
|
||||
}
|
||||
if((down.y() < Canvas->height) && (Canvas->image->getPixelColor(down) != newColor) && (Active->image->getPixelColor(down) == oldColor)){
|
||||
Canvas->image->drawPixel(down,newColor);
|
||||
Q.push(down);
|
||||
}
|
||||
}
|
||||
left = QPoint(Current.x()-1,Current.y() );
|
||||
right = QPoint(Current.x()+1,Current.y() );
|
||||
top = QPoint(Current.x(),Current.y()-1);
|
||||
down = QPoint(Current.x(),Current.y()+1);
|
||||
if((right.x() < Canvas->width) && (Canvas->image->getPixelColor(right) != newColor) && (Active->image->getPixelColor(right) == oldColor)) {
|
||||
Canvas->image->drawPixel(right,newColor);
|
||||
Q.push(right);
|
||||
}
|
||||
if((left.x() >= 0) && (Canvas->image->getPixelColor(left) != newColor) && (Active->image->getPixelColor(left) == oldColor)) {
|
||||
Canvas->image->drawPixel(left,newColor);
|
||||
Q.push(left);
|
||||
}
|
||||
if((top.y() >= 0) && (Canvas->image->getPixelColor(top) != newColor) && (Active->image->getPixelColor(top) == oldColor)) {
|
||||
Canvas->image->drawPixel(top,newColor);
|
||||
Q.push(top);
|
||||
}
|
||||
if((down.y() < Canvas->height) && (Canvas->image->getPixelColor(down) != newColor) && (Active->image->getPixelColor(down) == oldColor)) {
|
||||
Canvas->image->drawPixel(down,newColor);
|
||||
Q.push(down);
|
||||
}
|
||||
}
|
||||
|
||||
Canvas->image->calculateVisiblity();
|
||||
Canvas->image->calculateVisiblity();
|
||||
}
|
||||
|
||||
void IntelliToolFloodFill::onMouseLeftReleased(int x, int y){
|
||||
IntelliTool::onMouseLeftReleased(x,y);
|
||||
IntelliTool::onMouseLeftReleased(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolFloodFill::onWheelScrolled(int value){
|
||||
IntelliTool::onWheelScrolled(value);
|
||||
IntelliTool::onWheelScrolled(value);
|
||||
|
||||
}
|
||||
|
||||
void IntelliToolFloodFill::onMouseMoved(int x, int y){
|
||||
IntelliTool::onMouseMoved(x,y);
|
||||
IntelliTool::onMouseMoved(x,y);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user