summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Koller <kollix@aon.at>2016-08-10 09:19:17 (GMT)
committerMartin Koller <kollix@aon.at>2016-08-10 09:19:17 (GMT)
commit015d25f5db41b06e27227372917564b413a46b14 (patch)
treed81fcebebc9beb2e27a043a101212afcd069bcf8
parent23d779e4e202e2ea7b986e0a872deeaa1a7e95fe (diff)
add a "make confidential" action which blurs the image/selection
FEATURE: 366436
-rw-r--r--imagelib/effects/kpEffectBlurSharpen.cpp18
-rw-r--r--imagelib/effects/kpEffectBlurSharpen.h2
-rw-r--r--kolourpaintui.rc3
-rw-r--r--mainWindow/kpMainWindow.h5
-rw-r--r--mainWindow/kpMainWindowPrivate.h3
-rw-r--r--mainWindow/kpMainWindow_Image.cpp27
6 files changed, 44 insertions, 14 deletions
diff --git a/imagelib/effects/kpEffectBlurSharpen.cpp b/imagelib/effects/kpEffectBlurSharpen.cpp
index 9f43156..2e06e0e 100644
--- a/imagelib/effects/kpEffectBlurSharpen.cpp
+++ b/imagelib/effects/kpEffectBlurSharpen.cpp
@@ -59,13 +59,11 @@
//
-static QImage BlurQImage (const QImage qimage_, int strength)
+static QImage BlurQImage(const QImage &qimage, int strength)
{
- QImage qimage = qimage_;
if (strength == 0)
return qimage;
-
// The numbers that follow were picked by experimentation to try to get
// an effect linearly proportional to <strength> and at the same time,
// be fast enough.
@@ -85,11 +83,8 @@ static QImage BlurQImage (const QImage qimage_, int strength)
<< endl;
#endif
-
- qimage = Blitz::blur (qimage, qRound (radius));
-
-
- return qimage;
+ QImage img(qimage);
+ return Blitz::blur(img, qRound(radius));
}
//---------------------------------------------------------------------
@@ -160,7 +155,7 @@ static QImage SharpenQImage (const QImage &qimage_, int strength)
for (int i = 0; i < repeat; i++)
{
#if DEBUG_KP_EFFECT_BLUR_SHARPEN
- QTime timer; timer.start ();
+ QTime timer; timer.start ();
#endif
qimage = Blitz::gaussianSharpen (qimage, radius, sigma);
#if DEBUG_KP_EFFECT_BLUR_SHARPEN
@@ -192,6 +187,11 @@ kpImage kpEffectBlurSharpen::applyEffect (const kpImage &image,
return ::BlurQImage (image, strength);
else if (type == Sharpen)
return ::SharpenQImage (image, strength);
+ else if (type == MakeConfidential)
+ {
+ QImage img(image);
+ return Blitz::blur(img, qMin(20, img.width() / 2));
+ }
else
return kpImage();
}
diff --git a/imagelib/effects/kpEffectBlurSharpen.h b/imagelib/effects/kpEffectBlurSharpen.h
index 25b92f2..a79b974 100644
--- a/imagelib/effects/kpEffectBlurSharpen.h
+++ b/imagelib/effects/kpEffectBlurSharpen.h
@@ -38,7 +38,7 @@ class kpEffectBlurSharpen
public:
enum Type
{
- None = 0, Blur, Sharpen
+ None = 0, Blur, Sharpen, MakeConfidential
};
// Blur or Sharpen with this strength is the same as None.
diff --git a/kolourpaintui.rc b/kolourpaintui.rc
index 465a647..98864cd 100644
--- a/kolourpaintui.rc
+++ b/kolourpaintui.rc
@@ -4,7 +4,7 @@ SYNC: Do not change the number of quotes before the version number
- it is parsed by the KolourPaint wrapper shell script (in standalone
backport releases of KolourPaint)
-->
-<gui name="kolourpaint" version="73">
+<gui name="kolourpaint" version="74">
<!--
SYNC: Check for duplicate actions in menus caused by some of our actions
@@ -84,6 +84,7 @@ SYNC: Check for duplicate actions in menus caused by some of our actions
<Separator />
<Action name="image_convert_to_black_and_white" />
<Action name="image_convert_to_grayscale" />
+ <Action name="image_make_confidential" />
<Action name="image_more_effects" />
<Separator />
<Action name="image_invert_colors" />
diff --git a/mainWindow/kpMainWindow.h b/mainWindow/kpMainWindow.h
index 91ff588..afc9f58 100644
--- a/mainWindow/kpMainWindow.h
+++ b/mainWindow/kpMainWindow.h
@@ -558,11 +558,11 @@ public:
bool addSelCreateCmdIfSelAvail = true,
bool addSelContentCmdIfSelAvail = true);
-private slots:
- void slotResizeScale ();
public slots:
void slotCrop ();
+
private slots:
+ void slotResizeScale ();
void slotAutoCrop ();
void slotFlip ();
void slotMirror ();
@@ -576,6 +576,7 @@ private slots:
void slotConvertToGrayscale ();
void slotInvertColors ();
void slotClear ();
+ void slotMakeConfidential();
void slotMoreEffects ();
diff --git a/mainWindow/kpMainWindowPrivate.h b/mainWindow/kpMainWindowPrivate.h
index db8b2a4..687f135 100644
--- a/mainWindow/kpMainWindowPrivate.h
+++ b/mainWindow/kpMainWindowPrivate.h
@@ -191,6 +191,7 @@ struct kpMainWindowPrivate
actionSkew(0),
actionConvertToBlackAndWhite(0),
actionConvertToGrayscale(0),
+ actionBlur(0),
actionMoreEffects(0),
actionInvertColors(0),
actionClear(0),
@@ -367,7 +368,7 @@ struct kpMainWindowPrivate
*actionRotate, *actionRotateLeft, *actionRotateRight,
*actionSkew,
*actionConvertToBlackAndWhite, *actionConvertToGrayscale,
- *actionMoreEffects,
+ *actionBlur, *actionMoreEffects,
*actionInvertColors, *actionClear;
// Implemented in kpMainWindow_Tools.cpp, not kpImageWindow_Image.cpp
diff --git a/mainWindow/kpMainWindow_Image.cpp b/mainWindow/kpMainWindow_Image.cpp
index b6d5cfd..95200dc 100644
--- a/mainWindow/kpMainWindow_Image.cpp
+++ b/mainWindow/kpMainWindow_Image.cpp
@@ -56,6 +56,8 @@
#include "commands/imagelib/transforms/kpTransformSkewCommand.h"
#include "dialogs/imagelib/transforms/kpTransformSkewDialog.h"
#include "views/manager/kpViewManager.h"
+#include "commands/imagelib/effects/kpEffectBlurSharpenCommand.h"
+#include "imagelib/effects/kpEffectBlurSharpen.h"
#include <kactioncollection.h>
#include <kapplication.h>
@@ -181,6 +183,10 @@ void kpMainWindow::setupImageMenuActions ()
connect (d->actionClear, SIGNAL (triggered (bool)), SLOT (slotClear ()));
ac->setDefaultShortcut (d->actionClear, Qt::CTRL + Qt::SHIFT + Qt::Key_N);
+ d->actionBlur = ac->addAction("image_make_confidential");
+ d->actionBlur->setText(i18n("Make Confidential"));
+ connect(d->actionBlur, SIGNAL(triggered(bool)), SLOT(slotMakeConfidential()));
+
d->actionMoreEffects = ac->addAction ("image_more_effects");
d->actionMoreEffects->setText (i18n ("&More Effects..."));
connect (d->actionMoreEffects, SIGNAL (triggered (bool)), SLOT (slotMoreEffects ()));
@@ -208,6 +214,7 @@ void kpMainWindow::enableImageMenuDocumentActions (bool enable)
d->actionConvertToGrayscale->setEnabled (enable);
d->actionInvertColors->setEnabled (enable);
d->actionClear->setEnabled (enable);
+ d->actionBlur->setEnabled (enable);
d->actionMoreEffects->setEnabled (enable);
d->imageMenuDocumentActionsEnabled = enable;
@@ -261,6 +268,7 @@ void kpMainWindow::slotImageMenuUpdateDueToSelection ()
d->actionConvertToGrayscale->setEnabled (enable);
d->actionInvertColors->setEnabled (enable);
d->actionClear->setEnabled (enable);
+ d->actionBlur->setEnabled (enable);
d->actionMoreEffects->setEnabled (enable);
}
@@ -545,6 +553,8 @@ void kpMainWindow::slotConvertToGrayscale ()
commandEnvironment ()));
}
+//--------------------------------------------------------------------------------
+
// private slot
void kpMainWindow::slotInvertColors ()
{
@@ -555,6 +565,8 @@ void kpMainWindow::slotInvertColors ()
commandEnvironment ()));
}
+//--------------------------------------------------------------------------------
+
// private slot
void kpMainWindow::slotClear ()
{
@@ -567,6 +579,19 @@ void kpMainWindow::slotClear ()
commandEnvironment ()));
}
+//--------------------------------------------------------------------------------
+
+void kpMainWindow::slotMakeConfidential()
+{
+ toolEndShape();
+
+ addImageOrSelectionCommand(
+ new kpEffectBlurSharpenCommand(kpEffectBlurSharpen::MakeConfidential, kpEffectBlurSharpen::MaxStrength,
+ d->document->selection(), commandEnvironment()));
+}
+
+//--------------------------------------------------------------------------------
+
// private slot
void kpMainWindow::slotMoreEffects ()
{
@@ -593,3 +618,5 @@ void kpMainWindow::slotMoreEffects ()
cfg.sync ();
}
}
+
+//--------------------------------------------------------------------------------