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:
@@ -24,10 +24,10 @@ void IntelliTool::onMouseRightReleased(int x, int y){
|
||||
}
|
||||
|
||||
void IntelliTool::onMouseLeftPressed(int x, int y){
|
||||
this->isDrawing=true;
|
||||
//create drawing layer
|
||||
this->createToolLayer();
|
||||
Canvas->image->calculateVisiblity();
|
||||
this->isDrawing=this->createToolLayer();
|
||||
if(isDrawing){
|
||||
Canvas->image->calculateVisiblity();
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliTool::onMouseLeftReleased(int x, int y){
|
||||
@@ -48,18 +48,23 @@ void IntelliTool::onWheelScrolled(int value){
|
||||
//if needed for future general tasks implement in here
|
||||
}
|
||||
|
||||
void IntelliTool::createToolLayer(){
|
||||
Area->createTempTopLayer(Area->activeLayer);
|
||||
this->activeLayer=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer)];
|
||||
this->Canvas=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer+1)];
|
||||
bool IntelliTool::createToolLayer(){
|
||||
if(Area->createTempTopLayer(Area->activeLayer)){
|
||||
this->activeLayer=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer)];
|
||||
this->Canvas=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer+1)];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void IntelliTool::mergeToolLayer(){
|
||||
QColor clr_0;
|
||||
QColor clr_1;
|
||||
QImage updatedImage = activeLayer->image->getImageData();
|
||||
|
||||
for(int y=0; y<activeLayer->height; y++) {
|
||||
for(int x=0; x<activeLayer->width; x++) {
|
||||
clr_0=activeLayer->image->imageData.pixelColor(x,y);
|
||||
for(int x=0; x<activeLayer->width; x++) {
|
||||
clr_0=updatedImage.pixelColor(x,y);
|
||||
clr_1=Canvas->image->imageData.pixelColor(x,y);
|
||||
float t = static_cast<float>(clr_1.alpha())/255.f;
|
||||
int r =static_cast<int>(static_cast<float>(clr_1.red())*(t)+static_cast<float>(clr_0.red())*(1.f-t)+0.5f);
|
||||
@@ -71,10 +76,11 @@ void IntelliTool::mergeToolLayer(){
|
||||
clr_0.setBlue(b);
|
||||
clr_0.setAlpha(a);
|
||||
|
||||
activeLayer->image->imageData.setPixelColor(x, y, clr_0);
|
||||
updatedImage.setPixelColor(x, y, clr_0);
|
||||
}
|
||||
}
|
||||
Area->DumpyGui->UpdateGui();
|
||||
activeLayer->image->setImageData(updatedImage);
|
||||
Area->DummyGui->UpdateGui();
|
||||
}
|
||||
|
||||
void IntelliTool::deleteToolLayer(){
|
||||
|
||||
@@ -25,8 +25,9 @@ enum class Tooltype {
|
||||
private:
|
||||
/*!
|
||||
* \brief A function that creates a layer to draw on.
|
||||
* \return Returns if a layer could be created
|
||||
*/
|
||||
void createToolLayer();
|
||||
bool createToolLayer();
|
||||
|
||||
/*!
|
||||
* \brief A function that merges the drawing- and the active- layer.
|
||||
|
||||
@@ -57,10 +57,12 @@ void IntelliToolCircle::onMouseRightReleased(int x, int y){
|
||||
|
||||
void IntelliToolCircle::onMouseLeftPressed(int x, int y){
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
this->centerPoint=QPoint(x,y);
|
||||
int radius = 1;
|
||||
drawCircle(radius);
|
||||
Canvas->image->calculateVisiblity();
|
||||
if(this->isDrawing){
|
||||
this->centerPoint=QPoint(x,y);
|
||||
int radius = 1;
|
||||
drawCircle(radius);
|
||||
Canvas->image->calculateVisiblity();
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliToolCircle::onMouseLeftReleased(int x, int y){
|
||||
|
||||
Reference in New Issue
Block a user