diff --git a/flameshot.pro b/flameshot.pro
index 483acb74..e37d5c32 100644
--- a/flameshot.pro
+++ b/flameshot.pro
@@ -90,7 +90,8 @@ SOURCES += src/main.cpp\
src/capture/workers/launcher/applauncherwidget.cpp \
src/capture/tools/applauncher.cpp \
src/utils/desktopfileparse.cpp \
- src/capture/workers/launcher/launcheritemdelegate.cpp
+ src/capture/workers/launcher/launcheritemdelegate.cpp \
+ src/capture/tools/blurtool.cpp
HEADERS += \
src/capture/widget/buttonhandler.h \
@@ -145,7 +146,8 @@ HEADERS += \
src/capture/workers/launcher/applauncherwidget.h \
src/capture/tools/applauncher.h \
src/utils/desktopfileparse.h \
- src/capture/workers/launcher/launcheritemdelegate.h
+ src/capture/workers/launcher/launcheritemdelegate.h \
+ src/capture/tools/blurtool.h
RESOURCES += \
graphics.qrc
diff --git a/graphics.qrc b/graphics.qrc
index c5b1c71f..4252195b 100644
--- a/graphics.qrc
+++ b/graphics.qrc
@@ -41,5 +41,7 @@
img/buttonIconsWhite/size_indicator.png
img/buttonIconsBlack/open_with.png
img/buttonIconsWhite/open_with.png
+ img/buttonIconsBlack/blur.png
+ img/buttonIconsWhite/blur.png
diff --git a/img/buttonIconsBlack/blur.png b/img/buttonIconsBlack/blur.png
new file mode 100644
index 00000000..19f95e3f
Binary files /dev/null and b/img/buttonIconsBlack/blur.png differ
diff --git a/img/buttonIconsBlack/blur.svg b/img/buttonIconsBlack/blur.svg
new file mode 100644
index 00000000..bb4f8451
--- /dev/null
+++ b/img/buttonIconsBlack/blur.svg
@@ -0,0 +1,4 @@
+
diff --git a/img/buttonIconsWhite/blur.png b/img/buttonIconsWhite/blur.png
new file mode 100644
index 00000000..07a55769
Binary files /dev/null and b/img/buttonIconsWhite/blur.png differ
diff --git a/img/buttonIconsWhite/blur.svg b/img/buttonIconsWhite/blur.svg
new file mode 100644
index 00000000..7cfb8051
--- /dev/null
+++ b/img/buttonIconsWhite/blur.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/src/capture/tools/blurtool.cpp b/src/capture/tools/blurtool.cpp
new file mode 100644
index 00000000..8b49945d
--- /dev/null
+++ b/src/capture/tools/blurtool.cpp
@@ -0,0 +1,81 @@
+// Copyright 2017 Alejandro Sirgo Rica
+//
+// This file is part of Flameshot.
+//
+// Flameshot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Flameshot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Flameshot. If not, see .
+
+#include "blurtool.h"
+#include
+#include
+#include
+#include
+
+BlurTool::BlurTool(QObject *parent) : CaptureTool(parent) {
+
+}
+
+int BlurTool::id() const {
+ return 0;
+}
+
+bool BlurTool::isSelectable() const {
+ return true;
+}
+
+QString BlurTool::iconName() const {
+ return "blur.png";
+}
+
+QString BlurTool::name() const {
+ return tr("Blur");
+}
+
+QString BlurTool::description() const {
+ return tr("Sets the Blur as the paint tool");
+}
+
+CaptureTool::ToolWorkType BlurTool::toolType() const {
+ return TYPE_LINE_DRAWER;
+}
+#include
+void BlurTool::processImage(
+ QPainter &painter,
+ const QVector &points,
+ const QColor &color,
+ const int thickness)
+{
+ Q_UNUSED(color);
+ Q_UNUSED(thickness);
+ QPoint p0 = points[0];
+ QPoint p1 = points[1];
+
+ QRect selection = QRect(p0, p1).normalized();
+ QPixmap *refPixmap = dynamic_cast(painter.device());
+
+ QGraphicsBlurEffect *blur = new QGraphicsBlurEffect;
+ blur->setBlurRadius(10);
+ QGraphicsPixmapItem *item = new QGraphicsPixmapItem (
+ refPixmap->copy(selection));
+ item->setGraphicsEffect(blur);
+
+ QGraphicsScene scene;
+ scene.addItem(item);
+
+ scene.render(&painter, selection, QRectF());
+ blur->setBlurRadius(15);
+ scene.render(&painter, selection, QRectF());
+}
+
+void BlurTool::onPressed() {
+}
diff --git a/src/capture/tools/blurtool.h b/src/capture/tools/blurtool.h
new file mode 100644
index 00000000..4cea9c84
--- /dev/null
+++ b/src/capture/tools/blurtool.h
@@ -0,0 +1,51 @@
+// Copyright 2017 Alejandro Sirgo Rica
+//
+// This file is part of Flameshot.
+//
+// Flameshot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Flameshot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Flameshot. If not, see .
+
+
+#ifndef BLURTOOL_H
+#define BLURTOOL_H
+
+#include "capturetool.h"
+
+class BlurTool : public CaptureTool
+{
+ Q_OBJECT
+public:
+ explicit BlurTool(QObject *parent = nullptr);
+
+ int id() const override;
+ bool isSelectable() const override;
+ ToolWorkType toolType() const override;
+
+ QString iconName() const override;
+ QString name() const override;
+ QString description() const override;
+
+ void processImage(
+ QPainter &painter,
+ const QVector &points,
+ const QColor &color,
+ const int thickness) override;
+
+ void onPressed() override;
+
+private:
+ bool needsAdjustment(const QPoint &p0, const QPoint &p1) const;
+
+};
+
+#endif // BLURTOOL_H
diff --git a/src/capture/tools/toolfactory.cpp b/src/capture/tools/toolfactory.cpp
index 294c1811..d9cbd480 100644
--- a/src/capture/tools/toolfactory.cpp
+++ b/src/capture/tools/toolfactory.cpp
@@ -31,6 +31,7 @@
#include "sizeindicatortool.h"
#include "undotool.h"
#include "applauncher.h"
+#include "blurtool.h"
ToolFactory::ToolFactory(QObject *parent) : QObject(parent)
{
@@ -88,6 +89,9 @@ CaptureTool* ToolFactory::CreateTool(
case CaptureButton::TYPE_OPEN_APP:
tool = new AppLauncher(parent);
break;
+ case CaptureButton::TYPE_BLUR:
+ tool = new BlurTool(parent);
+ break;
default:
tool = nullptr;
break;
diff --git a/src/capture/widget/capturebutton.cpp b/src/capture/widget/capturebutton.cpp
index fe86dd03..b608a6ef 100644
--- a/src/capture/widget/capturebutton.cpp
+++ b/src/capture/widget/capturebutton.cpp
@@ -191,6 +191,7 @@ static std::map buttonTypeOrder {
{ CaptureButton::TYPE_EXIT, 12 },
{ CaptureButton::TYPE_IMAGEUPLOADER, 13 },
{ CaptureButton::TYPE_OPEN_APP, 14 },
+ { CaptureButton::TYPE_BLUR, 15 },
};
int CaptureButton::getPriorityByButton(CaptureButton::ButtonType b) {
@@ -214,4 +215,5 @@ QVector CaptureButton::iterableButtonTypes = {
CaptureButton::TYPE_EXIT,
CaptureButton::TYPE_IMAGEUPLOADER,
CaptureButton::TYPE_OPEN_APP,
+ CaptureButton::TYPE_BLUR,
};
diff --git a/src/capture/widget/capturebutton.h b/src/capture/widget/capturebutton.h
index 44877815..39a607af 100644
--- a/src/capture/widget/capturebutton.h
+++ b/src/capture/widget/capturebutton.h
@@ -49,6 +49,7 @@ public:
TYPE_EXIT,
TYPE_IMAGEUPLOADER,
TYPE_OPEN_APP,
+ TYPE_BLUR,
};
CaptureButton() = delete;
diff --git a/src/capture/widget/capturewidget.cpp b/src/capture/widget/capturewidget.cpp
index 789c405a..653c0be5 100644
--- a/src/capture/widget/capturewidget.cpp
+++ b/src/capture/widget/capturewidget.cpp
@@ -446,7 +446,8 @@ void CaptureWidget::setState(CaptureButton *b) {
m_state = t;
m_toolIsForDrawing =
(b->tool()->toolType() !=
- CaptureTool::ToolWorkType::TYPE_WORKER);
+ CaptureTool::ToolWorkType::TYPE_WORKER) &&
+ b->buttonType() != CaptureButton::TYPE_BLUR;
if (m_lastPressedButton) {
m_lastPressedButton->setColor(m_uiColor);
}