diff --git a/core/dplugins/dimg/heif/dimgheifplugin.h b/core/dplugins/dimg/heif/dimgheifplugin.h index 335037ea17..bbb278ac4f 100644 --- a/core/dplugins/dimg/heif/dimgheifplugin.h +++ b/core/dplugins/dimg/heif/dimgheifplugin.h @@ -1,73 +1,73 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-26 * Description : HEIF DImg plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program 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 2, or (at your option) any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_HEIF_DIMG_PLUGIN_H -#define DIGIKAM_HEIF_DIMG_PLUGIN_H +#ifndef DIGIKAM_DIMG_HEIF_PLUGIN_H +#define DIGIKAM_DIMG_HEIF_PLUGIN_H // Qt includes #include #include // Local includes #include "dplugindimg.h" #include "dimg.h" #include "dimgloader.h" #define DPLUGIN_IID "org.kde.digikam.plugin.dimg.HEIF" using namespace Digikam; namespace DigikamHEIFDImgPlugin { class DImgHEIFPlugin : public DPluginDImg { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginDImg) public: explicit DImgHEIFPlugin(QObject* const parent = nullptr); ~DImgHEIFPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; QString loaderName() const; QString typeMimes() const; bool canRead(const QString& filePath) const; bool canWrite(const QString& format) const; DImgLoader* loader(DImg* const image, const DRawDecoding& rawSettings = DRawDecoding()) const; }; } // namespace DigikamHEIFDImgPlugin -#endif // DIGIKAM_HEIF_DIMG_PLUGIN_H +#endif // DIGIKAM_DIMG_HEIF_PLUGIN_H diff --git a/core/dplugins/dimg/imagemagick/dimgimagemagickplugin.h b/core/dplugins/dimg/imagemagick/dimgimagemagickplugin.h index 59fcb7084e..02616ec236 100644 --- a/core/dplugins/dimg/imagemagick/dimgimagemagickplugin.h +++ b/core/dplugins/dimg/imagemagick/dimgimagemagickplugin.h @@ -1,72 +1,72 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-21 * Description : ImageMagick DImg plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program 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 2, or (at your option) any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_IMAGE_MAGICK_DIMG_PLUGIN_H -#define DIGIKAM_IMAGE_MAGICK_DIMG_PLUGIN_H +#ifndef DIGIKAM_DIMG_IMAGE_MAGICK_PLUGIN_H +#define DIGIKAM_DIMG_IMAGE_MAGICK_PLUGIN_H // Qt includes #include #include // Local includes #include "dplugindimg.h" #include "dimg.h" #define DPLUGIN_IID "org.kde.digikam.plugin.dimg.ImageMagick" using namespace Digikam; namespace DigikamImageMagickDImgPlugin { class DImgImageMagickPlugin : public DPluginDImg { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginDImg) public: explicit DImgImageMagickPlugin(QObject* const parent = nullptr); ~DImgImageMagickPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; QString loaderName() const; QString typeMimes() const; bool canRead(const QString& filePath) const; bool canWrite(const QString& format) const; DImgLoader* loader(DImg* const image, const DRawDecoding& rawSettings = DRawDecoding()) const; }; } // namespace DigikamImageMagickDImgPlugin -#endif // DIGIKAM_IMAGE_MAGICK_DIMG_PLUGIN_H +#endif // DIGIKAM_DIMG_IMAGE_MAGICK_PLUGIN_H diff --git a/core/dplugins/dimg/jpeg/dimgjpegplugin.h b/core/dplugins/dimg/jpeg/dimgjpegplugin.h index 46410b2bac..99416e57f3 100644 --- a/core/dplugins/dimg/jpeg/dimgjpegplugin.h +++ b/core/dplugins/dimg/jpeg/dimgjpegplugin.h @@ -1,73 +1,73 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-21 * Description : JPEG DImg plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program 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 2, or (at your option) any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_JPEG_DIMG_PLUGIN_H -#define DIGIKAM_JPEG_DIMG_PLUGIN_H +#ifndef DIGIKAM_DIMG_JPEG_PLUGIN_H +#define DIGIKAM_DIMG_JPEG_PLUGIN_H // Qt includes #include #include // Local includes #include "dplugindimg.h" #include "dimg.h" #include "dimgloader.h" #define DPLUGIN_IID "org.kde.digikam.plugin.dimg.JPEG" using namespace Digikam; namespace DigikamJPEGDImgPlugin { class DImgJPEGPlugin : public DPluginDImg { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginDImg) public: explicit DImgJPEGPlugin(QObject* const parent = nullptr); ~DImgJPEGPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; QString loaderName() const; QString typeMimes() const; bool canRead(const QString& filePath) const; bool canWrite(const QString& format) const; DImgLoader* loader(DImg* const image, const DRawDecoding& rawSettings = DRawDecoding()) const; }; } // namespace DigikamJPEGDImgPlugin -#endif // DIGIKAM_JPEG_DIMG_PLUGIN_H +#endif // DIGIKAM_DIMG_JPEG_PLUGIN_H diff --git a/core/dplugins/dimg/jpeg2000/dimgjpeg2000loader.h b/core/dplugins/dimg/jpeg2000/dimgjpeg2000loader.h index 83871bba8b..c6030c82c1 100644 --- a/core/dplugins/dimg/jpeg2000/dimgjpeg2000loader.h +++ b/core/dplugins/dimg/jpeg2000/dimgjpeg2000loader.h @@ -1,60 +1,60 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2006-06-14 * Description : A JPEG-2000 IO file for DImg framework * * Copyright (C) 2006-2019 by Gilles Caulier * * This program 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 2, or (at your option) * any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_DIMG_JP2000_LOADER_H -#define DIGIKAM_DIMG_JP2000_LOADER_H +#ifndef DIGIKAM_DIMG_JPEG_2000_LOADER_H +#define DIGIKAM_DIMG_JPEG_2000_LOADER_H // Local includes #include "dimg.h" #include "dimgloader.h" #include "digikam_export.h" using namespace Digikam; namespace DigikamJPEG2000DImgPlugin { class DIGIKAM_EXPORT DImgJPEG2000Loader : public DImgLoader { public: explicit DImgJPEG2000Loader(DImg* const image); bool load(const QString& filePath, DImgLoaderObserver* const observer) override; bool save(const QString& filePath, DImgLoaderObserver* const observer) override; virtual bool hasAlpha() const override; virtual bool sixteenBit() const override; virtual bool isReadOnly() const override; private: bool m_sixteenBit; bool m_hasAlpha; }; } // namespace DigikamJPEG2000DImgPlugin -#endif // DIGIKAM_DIMG_JP2000_LOADER_H +#endif // DIGIKAM_DIMG_JPEG_2000_LOADER_H diff --git a/core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.h b/core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.h index 3fc8310013..0fc094da75 100644 --- a/core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.h +++ b/core/dplugins/dimg/jpeg2000/dimgjpeg2000plugin.h @@ -1,73 +1,73 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-22 * Description : JPEG-2000 DImg plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program 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 2, or (at your option) any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_JPEG2000_DIMG_PLUGIN_H -#define DIGIKAM_JPEG2000_DIMG_PLUGIN_H +#ifndef DIGIKAM_DIMG_JPEG_2000_PLUGIN_H +#define DIGIKAM_DIMG_JPEG_2000_PLUGIN_H // Qt includes #include #include // Local includes #include "dplugindimg.h" #include "dimg.h" #include "dimgloader.h" #define DPLUGIN_IID "org.kde.digikam.plugin.dimg.JPEG2000" using namespace Digikam; namespace DigikamJPEG2000DImgPlugin { class DImgJPEG2000Plugin : public DPluginDImg { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginDImg) public: explicit DImgJPEG2000Plugin(QObject* const parent = nullptr); ~DImgJPEG2000Plugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; QString loaderName() const; QString typeMimes() const; bool canRead(const QString& filePath) const; bool canWrite(const QString& format) const; DImgLoader* loader(DImg* const image, const DRawDecoding& rawSettings = DRawDecoding()) const; }; } // namespace DigikamJPEG2000DImgPlugin -#endif // DIGIKAM_JPEG2000_DIMG_PLUGIN_H +#endif // DIGIKAM_DIMG_JPEG_2000_PLUGIN_H diff --git a/core/dplugins/dimg/pgf/dimgpgfplugin.h b/core/dplugins/dimg/pgf/dimgpgfplugin.h index 5ef81ff90f..4e14cc009d 100644 --- a/core/dplugins/dimg/pgf/dimgpgfplugin.h +++ b/core/dplugins/dimg/pgf/dimgpgfplugin.h @@ -1,73 +1,73 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-22 * Description : PGF DImg plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program 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 2, or (at your option) any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_PGF_DIMG_PLUGIN_H -#define DIGIKAM_PGF_DIMG_PLUGIN_H +#ifndef DIGIKAM_DIMG_PGF_PLUGIN_H +#define DIGIKAM_DIMG_PGF_PLUGIN_H // Qt includes #include #include // Local includes #include "dplugindimg.h" #include "dimg.h" #include "dimgloader.h" #define DPLUGIN_IID "org.kde.digikam.plugin.dimg.PGF" using namespace Digikam; namespace DigikamPGFDImgPlugin { class DImgPGFPlugin : public DPluginDImg { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginDImg) public: explicit DImgPGFPlugin(QObject* const parent = nullptr); ~DImgPGFPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; QString loaderName() const; QString typeMimes() const; bool canRead(const QString& filePath) const; bool canWrite(const QString& format) const; DImgLoader* loader(DImg* const image, const DRawDecoding& rawSettings = DRawDecoding()) const; }; } // namespace DigikamPGFDImgPlugin -#endif // DIGIKAM_PGF_DIMG_PLUGIN_H +#endif // DIGIKAM_DIMG_PGF_PLUGIN_H diff --git a/core/dplugins/dimg/png/dimgpngplugin.h b/core/dplugins/dimg/png/dimgpngplugin.h index 84ff57b25b..332d66626a 100644 --- a/core/dplugins/dimg/png/dimgpngplugin.h +++ b/core/dplugins/dimg/png/dimgpngplugin.h @@ -1,73 +1,73 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-22 * Description : PNG DImg plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program 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 2, or (at your option) any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_PNG_DIMG_PLUGIN_H -#define DIGIKAM_PNG_DIMG_PLUGIN_H +#ifndef DIGIKAM_DIMG_PNG_PLUGIN_H +#define DIGIKAM_DIMG_PNG_PLUGIN_H // Qt includes #include #include // Local includes #include "dplugindimg.h" #include "dimg.h" #include "dimgloader.h" #define DPLUGIN_IID "org.kde.digikam.plugin.dimg.PNG" using namespace Digikam; namespace DigikamPNGDImgPlugin { class DImgPNGPlugin : public DPluginDImg { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginDImg) public: explicit DImgPNGPlugin(QObject* const parent = nullptr); ~DImgPNGPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; QString loaderName() const; QString typeMimes() const; bool canRead(const QString& filePath) const; bool canWrite(const QString& format) const; DImgLoader* loader(DImg* const image, const DRawDecoding& rawSettings = DRawDecoding()) const; }; } // namespace DigikamPNGDImgPlugin -#endif // DIGIKAM_PNG_DIMG_PLUGIN_H +#endif // DIGIKAM_DIMG_PNG_PLUGIN_H diff --git a/core/dplugins/dimg/qimage/dimgqimageplugin.h b/core/dplugins/dimg/qimage/dimgqimageplugin.h index 93eafe0139..b695ad1c27 100644 --- a/core/dplugins/dimg/qimage/dimgqimageplugin.h +++ b/core/dplugins/dimg/qimage/dimgqimageplugin.h @@ -1,72 +1,72 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-20 * Description : QImage DImg plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program 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 2, or (at your option) any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_QIMAGE_DIMG_PLUGIN_H -#define DIGIKAM_QIMAGE_DIMG_PLUGIN_H +#ifndef DIGIKAM_DIMG_QIMAGE_PLUGIN_H +#define DIGIKAM_DIMG_QIMAGE_PLUGIN_H // Qt includes #include #include // Local includes #include "dplugindimg.h" #include "dimg.h" #define DPLUGIN_IID "org.kde.digikam.plugin.dimg.QImage" using namespace Digikam; namespace DigikamQImageDImgPlugin { class DImgQImagePlugin : public DPluginDImg { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginDImg) public: explicit DImgQImagePlugin(QObject* const parent = nullptr); ~DImgQImagePlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; QString loaderName() const; QString typeMimes() const; bool canRead(const QString& filePath) const; bool canWrite(const QString& format) const; DImgLoader* loader(DImg* const image, const DRawDecoding& rawSettings = DRawDecoding()) const; }; } // namespace DigikamQImageDImgPlugin -#endif // DIGIKAM_QIMAGE_DIMG_PLUGIN_H +#endif // DIGIKAM_DIMG_QIMAGE_PLUGIN_H diff --git a/core/dplugins/dimg/raw/dimgrawplugin.h b/core/dplugins/dimg/raw/dimgrawplugin.h index 351b477801..4def845572 100644 --- a/core/dplugins/dimg/raw/dimgrawplugin.h +++ b/core/dplugins/dimg/raw/dimgrawplugin.h @@ -1,73 +1,73 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-22 * Description : RAW DImg plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program 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 2, or (at your option) any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_RAW_DIMG_PLUGIN_H -#define DIGIKAM_RAW_DIMG_PLUGIN_H +#ifndef DIGIKAM_DIMG_RAW_PLUGIN_H +#define DIGIKAM_DIMG_RAW_PLUGIN_H // Qt includes #include #include // Local includes #include "dplugindimg.h" #include "dimg.h" #include "dimgloader.h" #define DPLUGIN_IID "org.kde.digikam.plugin.dimg.RAW" using namespace Digikam; namespace DigikamRAWDImgPlugin { class DImgRAWPlugin : public DPluginDImg { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginDImg) public: explicit DImgRAWPlugin(QObject* const parent = nullptr); ~DImgRAWPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; QString loaderName() const; QString typeMimes() const; bool canRead(const QString& filePath) const; bool canWrite(const QString& format) const; DImgLoader* loader(DImg* const image, const DRawDecoding& rawSettings = DRawDecoding()) const; }; } // namespace DigikamRAWDImgPlugin -#endif // DIGIKAM_RAW_DIMG_PLUGIN_H +#endif // DIGIKAM_DIMG_RAW_PLUGIN_H diff --git a/core/dplugins/dimg/tiff/dimgtiffplugin.h b/core/dplugins/dimg/tiff/dimgtiffplugin.h index f1db1f68c2..c4562c72ef 100644 --- a/core/dplugins/dimg/tiff/dimgtiffplugin.h +++ b/core/dplugins/dimg/tiff/dimgtiffplugin.h @@ -1,73 +1,73 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-22 * Description : TIFF DImg plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program 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 2, or (at your option) any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_TIFF_DIMG_PLUGIN_H -#define DIGIKAM_TIFF_DIMG_PLUGIN_H +#ifndef DIGIKAM_DIMG_TIFF_PLUGIN_H +#define DIGIKAM_DIMG_TIFF_PLUGIN_H // Qt includes #include #include // Local includes #include "dplugindimg.h" #include "dimg.h" #include "dimgloader.h" #define DPLUGIN_IID "org.kde.digikam.plugin.dimg.TIFF" using namespace Digikam; namespace DigikamTIFFDImgPlugin { class DImgTIFFPlugin : public DPluginDImg { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginDImg) public: explicit DImgTIFFPlugin(QObject* const parent = nullptr); ~DImgTIFFPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; QString loaderName() const; QString typeMimes() const; bool canRead(const QString& filePath) const; bool canWrite(const QString& format) const; DImgLoader* loader(DImg* const image, const DRawDecoding& rawSettings = DRawDecoding()) const; }; } // namespace DigikamTIFFDImgPlugin -#endif // DIGIKAM_TIFF_DIMG_PLUGIN_H +#endif // DIGIKAM_DIMG_TIFF_PLUGIN_H diff --git a/core/dplugins/editor/enhance/healingclone/healingclonetool.cpp b/core/dplugins/editor/enhance/healingclone/healingclonetool.cpp index 76544fbd41..bc15cd593b 100644 --- a/core/dplugins/editor/enhance/healingclone/healingclonetool.cpp +++ b/core/dplugins/editor/enhance/healingclone/healingclonetool.cpp @@ -1,667 +1,667 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2017-06-15 * Description : a tool to replace part of the image using another * * Copyright (C) 2004-2019 by Gilles Caulier * Copyright (C) 2017 by Shaza Ismail Kaoud * Copyright (C) 2019 by Ahmed Fathi * * This program 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 2, or (at your option) * any later version. * * This program 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. * * ============================================================ */ #include "healingclonetool.h" // C++ includes #include // Qt includes #include #include #include #include #include #include // KDE includes #include #include // Local includes #include "dexpanderbox.h" #include "dnuminput.h" #include "editortoolsettings.h" #include "imageiface.h" #include "itempropertiestxtlabel.h" #include "healingclonetoolwidget.h" namespace DigikamEditorHealingCloneToolPlugin { class Q_DECL_HIDDEN HealingCloneTool::Private { public: explicit Private() : btnSize(QSize(50, 50)), iconSize(QSize(30, 30)), radiusInput(nullptr), blurPercent(nullptr), previewWidget(nullptr), gboxSettings(nullptr), srcButton(nullptr), lassoButton(nullptr), moveButton(nullptr), undoCloneButton(nullptr), redoCloneButton(nullptr), resetLassoPoint(true), insideLassoOperation(false) { } static const QString configGroupName; static const QString configRadiusAdjustmentEntry; static const QString configBlurAdjustmentEntry; const QSize btnSize; const QSize iconSize; DIntNumInput* radiusInput; DDoubleNumInput* blurPercent; HealingCloneToolWidget* previewWidget; EditorToolSettings* gboxSettings; QPushButton* srcButton; QPushButton* lassoButton; QPushButton* moveButton; QPushButton* undoCloneButton; QPushButton* redoCloneButton; DImg cloneImg; std::stack undoStack; std::stack redoStack; bool resetLassoPoint; bool insideLassoOperation; QPoint previousLassoPoint; QPoint startLassoPoint; std::vector lassoColors; std::vector lassoPoints; QPolygon lassoPolygon; std::vector> lassoFlags; std::map, DColor> lassoColorsMap; }; const QString HealingCloneTool::Private::configGroupName(QLatin1String("Healing Clone Tool")); const QString HealingCloneTool::Private::configRadiusAdjustmentEntry(QLatin1String("RadiusAdjustment")); const QString HealingCloneTool::Private::configBlurAdjustmentEntry(QLatin1String("BlurAdjustment")); // -------------------------------------------------------- HealingCloneTool::HealingCloneTool(QObject* const parent) : EditorTool(parent), d(new Private) { setObjectName(QLatin1String("healing clone")); setToolHelp(QLatin1String("healingclonetool.anchor")); d->gboxSettings = new EditorToolSettings(0); d->previewWidget = new HealingCloneToolWidget; refreshImage(); d->previewWidget->setFocusPolicy(Qt::StrongFocus); setToolView(d->previewWidget); setPreviewModeMask(PreviewToolBar::PreviewTargetImage); // -------------------------------------------------------- QLabel* const label = new QLabel(i18n("Brush Radius:")); d->radiusInput = new DIntNumInput(); d->radiusInput->setRange(0, 200, 1); d->radiusInput->setDefaultValue(50); d->radiusInput->setWhatsThis(i18n("A radius of 0 has no effect, " "1 and above determine the brush radius " "that determines the size of parts copied in the image. \nShortcut :: [ and ]")); d->radiusInput->setToolTip(i18n("A radius of 0 has no effect, " "1 and above determine the brush radius " "that determines the size of parts copied in the image. \nShortcut :: [ and ]")); d->previewWidget->setBrushValue(d->radiusInput->value()); // -------------------------------------------------------- QLabel* const label2 = new QLabel(i18n("Radial Blur Percent:")); d->blurPercent = new DDoubleNumInput(); d->blurPercent->setRange(0, 100, 0.1); d->blurPercent->setDefaultValue(0); d->blurPercent->setWhatsThis(i18n("A percent of 0 has no effect, values " "above 0 represent a factor for mixing " "the destination color with source color " "this is done radially i.e. the inner part of " "the brush radius is totally from source and mixing " "with destination is done gradually till the outer part " "of the circle.")); // -------------------------------------------------------- d->srcButton = new QPushButton(); d->srcButton->setFixedSize(d->btnSize); d->srcButton->setIcon(QIcon::fromTheme(QLatin1String("crosshairs"))); d->srcButton->setIconSize(d->iconSize); d->srcButton->setWhatsThis(i18n("Select Source Point.\nShortcut: S")); d->srcButton->setToolTip(i18n("Select Source Point.\nShortcut: S")); // -------------------------------------------------------- d->lassoButton = new QPushButton(); d->lassoButton->setFixedSize(d->btnSize); d->lassoButton->setIcon(QIcon::fromTheme(QLatin1String("edit-select-lasso"))); d->lassoButton->setIconSize(d->iconSize); d->lassoButton->setWhatsThis(i18n("Polygon Selection With Lasso.\nShortcut: L\n" "To Continue polygon, either press L or double click\n" "To Cancel, press ESC")); d->lassoButton->setToolTip(i18n("Polygon Selection With Lasso.\nShortcut: L\n" "To Continue polygon, either press L or double click\n" "To Cancel, press ESC")); // -------------------------------------------------------- d->moveButton = new QPushButton(); d->moveButton->setFixedSize(d->btnSize); d->moveButton->setIcon(QIcon::fromTheme(QLatin1String("transform-browse"))); d->moveButton->setIconSize(d->iconSize); d->moveButton->setWhatsThis(i18n("Move Image.\nShortcut: M")); d->moveButton->setToolTip(i18n("Move Image.\nShortcut: M")); // -------------------------------------------------------- d->undoCloneButton = new QPushButton(); d->undoCloneButton->setFixedSize(d->btnSize); d->undoCloneButton->setIcon(QIcon::fromTheme(QLatin1String("edit-undo"))); d->undoCloneButton->setIconSize(d->iconSize); d->undoCloneButton->setWhatsThis(i18n("Undo clone operation.\nShortcut: CTRL+Z")); d->undoCloneButton->setToolTip(i18n("Undo clone operation.\nShortcut: CTRL+Z")); // -------------------------------------------------------- d->redoCloneButton = new QPushButton(); d->redoCloneButton->setFixedSize(d->btnSize); d->redoCloneButton->setIcon(QIcon::fromTheme(QLatin1String("edit-redo"))); d->redoCloneButton->setIconSize(d->iconSize); d->redoCloneButton->setWhatsThis(i18n("Redo clone operation.\nShortcut: CTRL+Y")); d->redoCloneButton->setToolTip(i18n("Redo clone operation.\nShortcut: CTRL+Y")); // -------------------------------------------------------- QString help = i18n("

How To Use:

" "* Press s to switch to source-selection mode, and select source point on image.
" "* Press s again and start cloning.
" "* Press [ and ] to change brush size.
" "* Press CTRL+Mousewheel to zoom in/out.
" "* Press m to pan the image if image is larger than viewport.
" "* Press l to start lasso mode. Start drawing lasso boundary either " "continuously or discretely, then double-click or press l again to close the boundary.
" "* Inside lasso mode, you can clone only inside the lasso region.

"); DTextBrowser* const label3 = new DTextBrowser(help); label3->setLinesNumber(20); // Tool Buttons const int spacing = d->gboxSettings->spacingHint(); QGridLayout* const grid = new QGridLayout(); QGroupBox* const iconsGroupBox = new QGroupBox(); QHBoxLayout* const iconsHBox = new QHBoxLayout(); iconsHBox->setSpacing(0); iconsHBox->addWidget(d->srcButton); iconsHBox->addWidget(d->lassoButton); iconsHBox->addWidget(d->moveButton); iconsHBox->addWidget(d->undoCloneButton); iconsHBox->addWidget(d->redoCloneButton); iconsGroupBox->setLayout(iconsHBox); // --- grid->addWidget(iconsGroupBox); grid->addWidget(new DLineWidget(Qt::Horizontal, d->gboxSettings->plainPage()), 3, 0, 1, 2); grid->addWidget(label, 4, 0, 1, 2); grid->addWidget(d->radiusInput, 5, 0, 1, 2); grid->addWidget(label2, 6, 0, 1, 2); grid->addWidget(d->blurPercent, 7, 0, 1, 2); grid->addWidget(new DLineWidget(Qt::Horizontal, d->gboxSettings->plainPage()), 8, 0, 1, 2); grid->addWidget(label3, 9, 0, 1, 2); grid->setRowStretch(10, 10); grid->setContentsMargins(spacing, spacing, spacing, spacing); grid->setSpacing(spacing); d->gboxSettings->plainPage()->setLayout(grid); // -------------------------------------------------------- setPreviewModeMask(PreviewToolBar::PreviewTargetImage); setToolSettings(d->gboxSettings); setToolView(d->previewWidget); // -------------------------------------------------------- d->lassoColors.push_back(DColor(Qt::red)); d->lassoColors.push_back(DColor(Qt::white)); d->lassoColors.push_back(DColor(Qt::black)); d->lassoColors.push_back(DColor(Qt::yellow)); d->lassoColors.push_back(DColor(Qt::blue)); d->lassoColors.push_back(DColor(Qt::yellow)); // -------------------------------------------------------- connect(d->radiusInput, SIGNAL(valueChanged(int)), this, SLOT(slotRadiusChanged(int))); connect(d->srcButton, SIGNAL(clicked(bool)), d->previewWidget, SLOT(slotSetSourcePoint())); connect(d->moveButton, SIGNAL(clicked(bool)), d->previewWidget, SLOT(slotMoveImage())); connect(d->lassoButton, SIGNAL(clicked(bool)), d->previewWidget, SLOT(slotLassoSelect())); connect(d->undoCloneButton, SIGNAL(clicked(bool)), this, SLOT(slotUndoClone())); connect(d->redoCloneButton, SIGNAL(clicked(bool)), this, SLOT(slotRedoClone())); connect(d->previewWidget, SIGNAL(signalClone(QPoint,QPoint)), this, SLOT(slotReplace(QPoint,QPoint))); connect(d->previewWidget, SIGNAL(signalLasso(QPoint)), this, SLOT(slotLasso(QPoint))); connect(d->previewWidget, SIGNAL(signalResetLassoPoint()), this, SLOT(slotResetLassoPoints())); connect(d->previewWidget, SIGNAL(signalContinuePolygon()), this, SLOT(slotContinuePolygon())); connect(d->previewWidget, SIGNAL(signalIncreaseBrushRadius()), this, SLOT(slotIncreaseBrushRadius())); connect(d->previewWidget, SIGNAL(signalDecreaseBrushRadius()), this, SLOT(slotDecreaseBrushRadius())); // undo - redo connect(d->previewWidget, SIGNAL(signalPushToUndoStack()), this, SLOT(slotPushToUndoStack())); connect(d->previewWidget, SIGNAL(signalUndoClone()), this, SLOT(slotUndoClone())); connect(d->previewWidget, SIGNAL(signalRedoClone()), this, SLOT(slotRedoClone())); d->cloneImg = d->previewWidget->getOriginalImage(); } HealingCloneTool::~HealingCloneTool() { delete d; } void HealingCloneTool::readSettings() { KSharedConfig::Ptr config = KSharedConfig::openConfig(); KConfigGroup group = config->group(d->configGroupName); d->radiusInput->setValue(group.readEntry(d->configRadiusAdjustmentEntry, d->radiusInput->defaultValue())); d->blurPercent->setValue(group.readEntry(d->configBlurAdjustmentEntry, d->blurPercent->defaultValue())); } void HealingCloneTool::writeSettings() { KSharedConfig::Ptr config = KSharedConfig::openConfig(); KConfigGroup group = config->group(d->configGroupName); group.writeEntry(d->configRadiusAdjustmentEntry, d->radiusInput->value()); group.writeEntry(d->configBlurAdjustmentEntry, d->blurPercent->value()); config->sync(); } void HealingCloneTool::finalRendering() { ImageIface iface; FilterAction action(QLatin1String("digikam:healingCloneTool"), 1); iface.setOriginal(i18n("healingClone"), action, d->cloneImg); } void HealingCloneTool::slotResetSettings() { d->radiusInput->blockSignals(true); d->radiusInput->slotReset(); d->radiusInput->blockSignals(false); } void HealingCloneTool::slotResized() { toolView()->update(); } void HealingCloneTool::slotReplace(const QPoint& srcPoint, const QPoint& dstPoint) { clone(&d->cloneImg, srcPoint, dstPoint); } void HealingCloneTool::slotRadiusChanged(int r) { d->previewWidget->setBrushValue(r); } void HealingCloneTool::clone(DImg* const img, const QPoint& srcPoint, const QPoint& dstPoint) { double blurPercent = d->blurPercent->value() / 100; int radius = d->radiusInput->value(); for (int i = -1 * radius ; i < radius ; ++i) { for (int j = -1 * radius ; j < radius ; ++j) { int rPercent = (i * i) + (j * j); if (rPercent < (radius * radius)) // Check for inside the circle { if ((srcPoint.x() + i < 0) || (srcPoint.x() + i >= (int)img->width()) || (srcPoint.y() + j < 0) || (srcPoint.y() + j >= (int)img->height()) || (dstPoint.x() + i < 0) || (dstPoint.x() + i >= (int)img->width()) || (dstPoint.y() + j < 0) || (dstPoint.y() + j >= (int)img->height())) { continue; } DColor cSrc = img->getPixelColor(srcPoint.x() + i, srcPoint.y() + j); if (d->insideLassoOperation && !d->lassoPoints.empty()) { if (d->lassoFlags.at(dstPoint.x() + i).at(dstPoint.y() + j)) { continue; } bool isInside = d->lassoPolygon.containsPoint(QPoint(dstPoint.x() + i, dstPoint.y() + j), Qt::OddEvenFill); if (!isInside) { continue; } if (d->lassoFlags.at(srcPoint.x() + i).at(srcPoint.y() + j)) { cSrc = d->lassoColorsMap[std::make_pair(srcPoint.x() + i, srcPoint.y() + j)]; } } double rP = blurPercent * rPercent / (radius * radius); DColor cDst = img->getPixelColor(dstPoint.x() + i, dstPoint.y() + j); cSrc.multiply(1 - rP); cDst.multiply(rP); cSrc.blendAdd(cDst); img->setPixelColor(dstPoint.x() + i, dstPoint.y() + j, cSrc); d->previewWidget->setCloneVectorChanged(true); } } } d->previewWidget->updateImage(*img); } void HealingCloneTool::updateLasso(std::vector& points) { uint radius = 5; static uint colorCounter = 0; foreach (const QPoint& p, points) { for (uint i = 0 ; i < radius ; ++i) { for (uint j = 0 ; j < radius ; ++j) { uint x_shifted = p.x() + i; uint y_shifted = p.y() + j; DColor c = d->cloneImg.getPixelColor(x_shifted, y_shifted); d->lassoColorsMap.insert(std::make_pair(std::make_pair(x_shifted, y_shifted), c)); d->cloneImg.setPixelColor(x_shifted, y_shifted, d->lassoColors[(colorCounter) % d->lassoColors.size()]); d->lassoFlags.at(x_shifted).at(y_shifted) = true; colorCounter++; } } } d->previewWidget->updateImage(d->cloneImg); } void HealingCloneTool::slotLasso(const QPoint& dst) { if (d->resetLassoPoint) { d->previousLassoPoint = dst; d->resetLassoPoint = false; d->startLassoPoint = dst; } std::vector points = interpolate(d->previousLassoPoint, dst); d->lassoPoints.push_back(dst); d->previousLassoPoint = dst; updateLasso(points); d->previewWidget->setIsLassoPointsVectorEmpty(d->lassoPoints.empty()); } std::vector HealingCloneTool::interpolate(const QPoint& start, const QPoint& end) { std::vector points; points.push_back(start); QPointF distanceVec = QPoint(end.x()-start.x(), end.y() - start.y()); double distance = sqrt(distanceVec.x() * distanceVec.x() + distanceVec.y() * distanceVec.y()); //creating a unit vector distanceVec.setX(distanceVec.x() / distance); distanceVec.setY(distanceVec.y() / distance); int steps = (int) distance; for (int i = 0 ; i < steps ; ++i) { points.push_back(QPoint(start.x() + i * distanceVec.x(), start.y() + i * distanceVec.y())); } points.push_back(end); return points; } void HealingCloneTool::removeLassoPixels() { std::map, DColor>::iterator it; - for (it = d->lassoColorsMap.begin() ; it != d->lassoColorsMap.end() ; it++) + for (it = d->lassoColorsMap.begin() ; it != d->lassoColorsMap.end() ; ++it) { std::pair xy = it->first; DColor color = it->second; d->cloneImg.setPixelColor(xy.first, xy.second, color); } d->previewWidget->updateImage(d->cloneImg); } void HealingCloneTool::redrawLassoPixels() { int colorCounter = 0; std::map, DColor>::iterator it; - for (it = d->lassoColorsMap.begin() ; it != d->lassoColorsMap.end() ; it++) + for (it = d->lassoColorsMap.begin() ; it != d->lassoColorsMap.end() ; ++it) { colorCounter++; DColor color = d->lassoColors[(colorCounter) % d->lassoColors.size()]; std::pair xy = it->first; d->cloneImg.setPixelColor(xy.first, xy.second, color); } d->previewWidget->updateImage(d->cloneImg); } void HealingCloneTool::slotResetLassoPoints() { removeLassoPixels(); d->resetLassoPoint = true; d->lassoPoints.clear(); d->insideLassoOperation = true; d->lassoPolygon.clear(); d->lassoColorsMap.clear(); initializeLassoFlags(); d->previewWidget->setIsLassoPointsVectorEmpty(d->lassoPoints.empty()); } void HealingCloneTool::slotContinuePolygon() { if (d->lassoPoints.empty()) { return; } QPoint& start = d->startLassoPoint; QPoint& end = d->previousLassoPoint; std::vector points = interpolate(end,start); updateLasso(points); d->lassoPoints.push_back(start); QVector polygon; foreach (const QPoint& point, d->lassoPoints) { polygon.append(point); } d->lassoPolygon = QPolygon(polygon); } void HealingCloneTool::slotIncreaseBrushRadius() { int size = d->radiusInput->value(); d->radiusInput->setValue(size + 1); } void HealingCloneTool::slotDecreaseBrushRadius() { int size = d->radiusInput->value(); d->radiusInput->setValue(size - 1); } void HealingCloneTool::initializeLassoFlags() { int w = d->cloneImg.width(); int h = d->cloneImg.height(); d->lassoFlags.resize(w); for (int i = 0 ; i < w ; ++i) { d->lassoFlags.at(i).resize(h); } for (int i = 0 ; i < w ; ++i) { for (int j = 0 ; j < h ; ++j) { d->lassoFlags.at(i).at(j) = false; } } } void HealingCloneTool::slotPushToUndoStack() { d->redoStack = std::stack(); removeLassoPixels(); d->undoStack.push(d->previewWidget->getOriginalImage()); redrawLassoPixels(); } void HealingCloneTool::slotUndoClone() { if (d->undoStack.empty()) { return; } removeLassoPixels(); d->redoStack.push(d->previewWidget->getOriginalImage()); d->cloneImg = d->undoStack.top(); d->undoStack.pop(); d->previewWidget->updateImage(d->cloneImg); redrawLassoPixels(); } void HealingCloneTool::slotRedoClone() { // slotResetLassoPoints(); if (d->redoStack.empty()) { return; } removeLassoPixels(); d->undoStack.push(d->previewWidget->getOriginalImage()); d->cloneImg = d->redoStack.top(); d->redoStack.pop(); d->previewWidget->updateImage(d->cloneImg); redrawLassoPixels(); } void HealingCloneTool::refreshImage() { ImageRegionWidget* const wgt = dynamic_cast(d->previewWidget); if (wgt) { QRectF test = wgt->sceneRect(); ImageRegionItem* const item = dynamic_cast(wgt->item()); if (item) { int w = item->boundingRect().width(); int h = item->boundingRect().height(); test.setWidth(10); test.setHeight(10); wgt->fitInView(test, Qt::KeepAspectRatio); test.setWidth(w); test.setHeight(h); wgt->fitInView(test, Qt::KeepAspectRatio); } } } } // namespace DigikamEditorHealingCloneToolPlugin diff --git a/core/dplugins/editor/enhance/healingclone/healingclonetoolwidget.cpp b/core/dplugins/editor/enhance/healingclone/healingclonetoolwidget.cpp index b297573e83..b544a75cdb 100644 --- a/core/dplugins/editor/enhance/healingclone/healingclonetoolwidget.cpp +++ b/core/dplugins/editor/enhance/healingclone/healingclonetoolwidget.cpp @@ -1,674 +1,674 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2017-06-15 * Description : a brush for use with tool to replace part of the image using another * - * Copyright (C) 2017 by Shaza Ismail Kaoud - * Copyright (C) 2019 by Ahmed Fathi + * Copyright (C) 2017 by Shaza Ismail Kaoud + * Copyright (C) 2019 by Ahmed Fathi * * This program 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 2, or (at your option) * any later version. * * This program 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. * * ============================================================ */ #include "healingclonetoolwidget.h" // Qt includes #include #include #include // KDE includes #include // Local includes #include "digikam_debug.h" #include "overlaywidget.h" #include "previewlayout.h" namespace DigikamEditorHealingCloneToolPlugin { class Q_DECL_HIDDEN HealingCloneToolWidget::Private { public: explicit Private() : srcSet(true), isLassoPointsVectorEmpty(true), amIFocused(false), proceedInMoveEvent(false), cloneVectorChanged(true), brushRadius(1), brushValue(1), currentState(HealingCloneState::SELECT_SOURCE), previousState(HealingCloneState::DO_NOTHING), drawCursor(nullptr), sourceCursor(nullptr), sourceCursorCenter(nullptr) { - src = QPoint(0, 0); + src = QPoint(0, 0); } bool srcSet; bool isLassoPointsVectorEmpty; QPointF lastCursorPosition; QPoint src; QPoint dst; bool amIFocused; bool proceedInMoveEvent; bool cloneVectorChanged; int brushRadius; int brushValue; HealingCloneState currentState; HealingCloneState previousState; QGraphicsEllipseItem* drawCursor; QGraphicsEllipseItem* sourceCursor; QGraphicsEllipseItem* sourceCursorCenter; }; HealingCloneToolWidget::HealingCloneToolWidget(QWidget* const parent) : ImageRegionWidget(parent, false), d(new Private) { activateState(HealingCloneState::SELECT_SOURCE); updateSourceCursor(d->src, 10); connect(this, SIGNAL(viewportRectChanged(QRectF)), this, SLOT(slotImageRegionChanged())); } HealingCloneToolWidget::~HealingCloneToolWidget() { delete d->drawCursor; delete d->sourceCursor; delete d->sourceCursorCenter; delete d; } void HealingCloneToolWidget::mousePressEvent(QMouseEvent* e) { if (!d->amIFocused && (d->currentState == HealingCloneState::PAINT || d->currentState == HealingCloneState::LASSO_CLONE)) { d->amIFocused = true; return; } else if (!d->amIFocused) { d->amIFocused = true; } d->proceedInMoveEvent = true; if (d->currentState == HealingCloneState::DO_NOTHING) { ImageRegionWidget::mousePressEvent(e); return; } if ((d->currentState == HealingCloneState::PAINT || d->currentState == HealingCloneState::LASSO_CLONE)) { if (d->cloneVectorChanged) { setCloneVectorChanged(false); emit signalPushToUndoStack(); } } if (d->currentState == HealingCloneState::MOVE_IMAGE && (e->buttons() & Qt::LeftButton)) { ImageRegionWidget::mousePressEvent(e); } else if (d->srcSet) { ImageRegionWidget::mousePressEvent(e); } else if (d->currentState == HealingCloneState::LASSO_DRAW_BOUNDARY && (e->buttons() & Qt::LeftButton)) { QPoint dst = QPoint(e->x(), e->y()); emit signalLasso(mapToImageCoordinates(dst)); } else { if (e->button() == Qt::LeftButton) { d->dst = mapToImageCoordinates(e->pos()); emit signalClone(d->src, d->dst); } } } void HealingCloneToolWidget::mouseMoveEvent(QMouseEvent* e) { bool cursorOutsideScene = checkPointOutsideScene(e->pos()); d->lastCursorPosition = mapToScene(e->pos()); if (cursorOutsideScene && d->currentState != HealingCloneState::DO_NOTHING) { activateState(HealingCloneState::DO_NOTHING); } else if (!cursorOutsideScene && d->currentState == HealingCloneState::DO_NOTHING) { activateState(d->previousState); } setDrawCursorPosition(d->lastCursorPosition); if (d->currentState == HealingCloneState::DO_NOTHING) { ImageRegionWidget::mouseMoveEvent(e); return; } if (!d->proceedInMoveEvent) { return; } if (d->currentState == HealingCloneState::MOVE_IMAGE && (e->buttons() & Qt::LeftButton)) { ImageRegionWidget::mouseMoveEvent(e); } else if (d->currentState == HealingCloneState::LASSO_DRAW_BOUNDARY && (e->buttons() & Qt::LeftButton)) { QPoint dst = QPoint(e->x(), e->y()); emit signalLasso(mapToImageCoordinates(dst)); } else if ((e->buttons() & Qt::LeftButton) && !d->srcSet) { QPoint currentDst = mapToImageCoordinates(e->pos()); QPoint currentSrc = d->src; QPoint orgDst = d->dst; currentSrc = QPoint(currentSrc.x() + currentDst.x() - orgDst.x(), currentSrc.y() + currentDst.y() - orgDst.y()); // Source Cursor Update in scene coordinates QPointF tempCursorPosition = mapToScene(mapFromImageCoordinates(currentSrc)); setSourceCursorPosition(tempCursorPosition); emit signalClone(currentSrc, currentDst); } if (d->srcSet) { ImageRegionWidget::mouseMoveEvent(e); } } void HealingCloneToolWidget::mouseReleaseEvent(QMouseEvent* e) { ImageRegionWidget::mouseReleaseEvent(e); if (d->currentState == HealingCloneState::DO_NOTHING) { return; } if (d->currentState == HealingCloneState::MOVE_IMAGE) { // setCursor(Qt::OpenHandCursor); ImageRegionWidget::mouseReleaseEvent(e); } else if (d->srcSet) { d->src = mapToImageCoordinates(e->pos()); setSourceCursorPosition(mapToScene(e->pos())); undoSlotSetSourcePoint(); } else { QPointF tempCursorPosition = mapToScene(mapFromImageCoordinates(d->src)); setSourceCursorPosition(tempCursorPosition); } } -void HealingCloneToolWidget::mouseDoubleClickEvent(QMouseEvent* event) +void HealingCloneToolWidget::mouseDoubleClickEvent(QMouseEvent* e) { - if (event->button() == Qt::LeftButton) + if (e->button() == Qt::LeftButton) { if (d->currentState == HealingCloneState::LASSO_DRAW_BOUNDARY) { slotLassoSelect(); } } } -void HealingCloneToolWidget::keyPressEvent(QKeyEvent *e) +void HealingCloneToolWidget::keyPressEvent(QKeyEvent* e) { if (e->key() == Qt::Key_M) { slotMoveImage(); } else if (e->key() == Qt::Key_L) { slotLassoSelect(); } if (e->key() == Qt::Key_BracketLeft) { emit signalDecreaseBrushRadius(); } if (e->key() == Qt::Key_BracketRight) { emit signalIncreaseBrushRadius(); } if (e->matches(QKeySequence::Undo)) { emit signalUndoClone(); } if (e->matches(QKeySequence::Redo)) { emit signalRedoClone(); } QWidget::keyPressEvent(e); } -bool HealingCloneToolWidget::event(QEvent* event) +bool HealingCloneToolWidget::event(QEvent* e) { - QKeyEvent* const keyEvent = static_cast(event); + QKeyEvent* const keyEvent = static_cast(e); if (keyEvent && keyEvent->key() == Qt::Key_Escape && d->currentState != HealingCloneState::PAINT) { keyEvent->accept(); if (d->currentState == HealingCloneState::LASSO_DRAW_BOUNDARY) { if (!d->isLassoPointsVectorEmpty) { slotLassoSelect(); } slotLassoSelect(); } else if (d->currentState == HealingCloneState::LASSO_CLONE) { slotLassoSelect(); } return true; } - return QWidget::event(event); + return QWidget::event(e); } void HealingCloneToolWidget::keyReleaseEvent(QKeyEvent* e) { if (e->key() == Qt::Key_S) { if (d->currentState == HealingCloneState::SELECT_SOURCE) { undoSlotSetSourcePoint(); } else { slotSetSourcePoint(); } } } void HealingCloneToolWidget::focusOutEvent(QFocusEvent*) { d->amIFocused = false; d->proceedInMoveEvent = false; } void HealingCloneToolWidget::focusInEvent(QFocusEvent*) { } void HealingCloneToolWidget::slotSetSourcePoint() { d->srcSet = true; activateState(HealingCloneState::SELECT_SOURCE); } void HealingCloneToolWidget::slotMoveImage() { if (d->currentState == HealingCloneState::MOVE_IMAGE) { if (d->isLassoPointsVectorEmpty) { activateState(HealingCloneState::PAINT); } else { activateState(HealingCloneState::LASSO_CLONE); emit signalContinuePolygon(); } } else { activateState(HealingCloneState::MOVE_IMAGE); } } void HealingCloneToolWidget::slotLassoSelect() { if (d->currentState != HealingCloneState::LASSO_DRAW_BOUNDARY && d->currentState != HealingCloneState::LASSO_CLONE) { activateState(HealingCloneState::LASSO_DRAW_BOUNDARY); emit signalResetLassoPoint(); } else if (d->currentState == HealingCloneState::LASSO_DRAW_BOUNDARY) { if (d->isLassoPointsVectorEmpty) { activateState(HealingCloneState::PAINT); } else { activateState(HealingCloneState::LASSO_CLONE); emit signalContinuePolygon(); } } else if (d->currentState == HealingCloneState::LASSO_CLONE) { activateState(HealingCloneState::PAINT); emit signalResetLassoPoint(); } } void HealingCloneToolWidget::undoSlotSetSourcePoint() { d->srcSet = false; if (d->isLassoPointsVectorEmpty) { activateState(HealingCloneState::PAINT); } else { activateState(HealingCloneState::LASSO_CLONE); emit signalContinuePolygon(); } } void HealingCloneToolWidget::changeCursorShape(const QColor& color) { if (d->drawCursor) { scene()->removeItem(d->drawCursor); delete d->drawCursor; } int diameter = d->brushRadius * 2; d->drawCursor = new QGraphicsEllipseItem(0, 0, diameter, diameter); d->drawCursor->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); QPen pen(Qt::SolidLine); pen.setWidth(2); pen.setColor(color); d->drawCursor->setPen(pen); d->drawCursor->setBrush(QBrush(Qt::transparent)); d->drawCursor->setOpacity(1); scene()->addItem(d->drawCursor); QPointF tempCursorPosition = mapToScene(mapFromImageCoordinates(d->src)); updateSourceCursor(tempCursorPosition, diameter); } void HealingCloneToolWidget::setBrushValue(int value) { d->brushValue = value; slotImageRegionChanged(); } void HealingCloneToolWidget::setIsLassoPointsVectorEmpty(bool isEmpty) { d->isLassoPointsVectorEmpty = isEmpty; } void HealingCloneToolWidget::activateState(HealingCloneState state) { d->previousState = d->currentState; if (state != HealingCloneState::MOVE_IMAGE) { setDragMode(QGraphicsView::NoDrag); } if (d->currentState == HealingCloneState::LASSO_DRAW_BOUNDARY && state != HealingCloneState::LASSO_CLONE) { emit signalContinuePolygon(); } d->currentState = state; if (state == HealingCloneState::PAINT) { changeCursorShape(Qt::blue); setCursor(QCursor(Qt::BlankCursor)); setDrawCursorPosition(d->lastCursorPosition); } else if (state == HealingCloneState::MOVE_IMAGE) { if (QGraphicsView::dragMode() != QGraphicsView::ScrollHandDrag) { setDragMode(QGraphicsView::ScrollHandDrag); } } else if (state == HealingCloneState::LASSO_DRAW_BOUNDARY) { setCursor(QCursor(Qt::PointingHandCursor)); } else if (state == HealingCloneState::LASSO_CLONE) { changeCursorShape(Qt::blue); setCursor(QCursor(Qt::BlankCursor)); setDrawCursorPosition(d->lastCursorPosition); } else if (state == HealingCloneState::SELECT_SOURCE) { setCursor(QCursor(Qt::CrossCursor)); } else if (state ==HealingCloneState::DO_NOTHING) { setCursor(QCursor(Qt::ArrowCursor)); } } void HealingCloneToolWidget::setCloneVectorChanged(bool changed) { d->cloneVectorChanged = changed; } QPoint HealingCloneToolWidget::mapToImageCoordinates(const QPoint& point) const { QPoint ret; ImageRegionItem* const region = dynamic_cast(item()); if (region) { QPointF temp = region->zoomSettings()->mapZoomToImage(mapToScene(point)) ; ret = QPoint((int)temp.x(), (int)temp.y()); } return ret; } QPoint HealingCloneToolWidget::mapFromImageCoordinates(const QPoint& point) const { QPoint ret; ImageRegionItem* const region = dynamic_cast(item()); if (region) { ret = mapFromScene(region->zoomSettings()->mapImageToZoom(point)); } return ret; } void HealingCloneToolWidget::updateSourceCursor(const QPointF& pos, int diameter) { if (d->sourceCursor) { scene()->removeItem(d->sourceCursor); scene()->removeItem(d->sourceCursorCenter); delete d->sourceCursor; delete d->sourceCursorCenter; } d->sourceCursor = new QGraphicsEllipseItem(0, 0, diameter, diameter); d->sourceCursorCenter = new QGraphicsEllipseItem(0, 0, 2, 2); d->sourceCursor->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); d->sourceCursorCenter->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); QPen pen(Qt::DashDotDotLine); pen.setWidth(2); pen.setColor(Qt::black); d->sourceCursor->setPen(pen); d->sourceCursor->setBrush(QBrush(Qt::transparent)); d->sourceCursor->setOpacity(1); scene()->addItem(d->sourceCursor); pen.setStyle(Qt::SolidLine); d->sourceCursorCenter->setPen(pen); d->sourceCursorCenter->setBrush(QBrush(Qt::black)); d->sourceCursorCenter->setOpacity(1); scene()->addItem(d->sourceCursorCenter); setSourceCursorPosition(pos); } void HealingCloneToolWidget::setDrawCursorPosition(const QPointF& topLeftPos) { if (!d->drawCursor) { return; } double d1 = d->drawCursor->rect().width() / 2.0; QPointF shiftedPos = QPointF(topLeftPos.x() - d1, topLeftPos.y() - d1); // check if source is outside scene bool drawCursorOutsideScene = (topLeftPos.x() < 0) || (topLeftPos.x() > scene()->width()) || (topLeftPos.y() < 0) || (topLeftPos.y() > scene()->height()); if (drawCursorOutsideScene || (d->currentState != HealingCloneState::PAINT && d->currentState != HealingCloneState::LASSO_CLONE)) { d->drawCursor->setVisible(false); } else { d->drawCursor->setPos(shiftedPos); d->drawCursor->setVisible(true); } } void HealingCloneToolWidget::setSourceCursorPosition(const QPointF& topLeftPos) { double d1 = d->sourceCursor->rect().width() / 2.0; QPointF shiftedPos = QPointF(topLeftPos.x() - d1, topLeftPos.y() - d1); double d2 = d->sourceCursorCenter->rect().width() / 2.0; QPointF shiftedPos2 = QPointF(topLeftPos.x() - d2, topLeftPos.y() - d2); // check if source is outside scene bool sourceCursorOutsideScene = (topLeftPos.x() < 0) || (topLeftPos.x() > scene()->width()) || (topLeftPos.y() < 0) || (topLeftPos.y() > scene()->height()); if (sourceCursorOutsideScene) { d->sourceCursor->setVisible(false); d->sourceCursorCenter->setVisible(false); } else { d->sourceCursor->setPos(shiftedPos); d->sourceCursorCenter->setPos(shiftedPos2); d->sourceCursor->setVisible(true); d->sourceCursorCenter->setVisible(true); } } bool HealingCloneToolWidget::checkPointOutsideScene(const QPoint& globalPoint) const { bool pointOutsideScene; QPointF temp = mapToScene(globalPoint); if (viewport()->width() > scene()->width()) { pointOutsideScene = (temp.x() < 0) || (temp.x() > scene()->width()) || (temp.y() < 0) || (temp.y() > scene()->height()); } else { QPoint bottomRight = QPoint(viewport()->width(), viewport()->height()); int right = mapToScene(bottomRight).x(); int left = right - viewport()->width(); int bottom = mapToScene(bottomRight).y(); int top = bottom - viewport()->height(); pointOutsideScene = (temp.x() < left) || (temp.x() + 1 > right) || (temp.y() < top) || (temp.y() + 1 > bottom); } return pointOutsideScene; } void HealingCloneToolWidget::slotImageRegionChanged() { double zoom = layout()->realZoomFactor(); d->brushRadius = qRound(d->brushValue * zoom); activateState(d->currentState); if (!d->lastCursorPosition.isNull()) { setDrawCursorPosition(d->lastCursorPosition); } } } // namespace DigikamEditorHealingCloneToolPlugin diff --git a/core/dplugins/editor/enhance/healingclone/healingclonetoolwidget.h b/core/dplugins/editor/enhance/healingclone/healingclonetoolwidget.h index 7b69291dfc..3b9a4494b9 100644 --- a/core/dplugins/editor/enhance/healingclone/healingclonetoolwidget.h +++ b/core/dplugins/editor/enhance/healingclone/healingclonetoolwidget.h @@ -1,130 +1,130 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2017-06-15 * Description : a brush for use with tool to replace part of the image using another * - * Copyright (C) 2017 by Shaza Ismail Kaoud - * Copyright (C) 2019 by Ahmed Fathi + * Copyright (C) 2017 by Shaza Ismail Kaoud + * Copyright (C) 2019 by Ahmed Fathi * * This program 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 2, or (at your option) * any later version. * * This program 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. * * ============================================================ */ #ifndef DIGIKAM_HEALING_CLONE_TOOL_WIDGET_H #define DIGIKAM_HEALING_CLONE_TOOL_WIDGET_H // Local includes #include "previewtoolbar.h" #include "imageregionwidget.h" #include "imageregionitem.h" using namespace Digikam; namespace DigikamEditorHealingCloneToolPlugin { class HealingCloneToolWidget : public ImageRegionWidget { Q_OBJECT Q_ENUMS(HealingCloneState) public: enum HealingCloneState { SELECT_SOURCE, PAINT, LASSO_DRAW_BOUNDARY, LASSO_CLONE, MOVE_IMAGE, DO_NOTHING }; public: /** * Standard constructor */ explicit HealingCloneToolWidget(QWidget* const parent = nullptr); ~HealingCloneToolWidget(); void setBrushValue(int value); void setIsLassoPointsVectorEmpty(bool); void setCloneVectorChanged(bool); void setDrawCursorPosition(const QPointF& topLeftPos); void setSourceCursorPosition(const QPointF& topLeftPos); void changeCursorShape(const QColor& color); bool checkPointOutsideScene(const QPoint& point) const; void updateSourceCursor(const QPointF& pos = QPoint(), int diamter = 10); QPoint mapToImageCoordinates(const QPoint& point) const; QPoint mapFromImageCoordinates(const QPoint& point) const; public Q_SLOTS: /** * @brief slotSrcSet toggles the fixing of the brush source center */ void slotSetSourcePoint(); void slotMoveImage(); void slotLassoSelect(); Q_SIGNALS: /** * @brief signalClone emitted when the src is set and the user initiated a brush click * and keeps emitting with motion */ void signalClone(const QPoint& currentSrc, const QPoint& currentDst); void signalLasso(const QPoint& dst); void signalResetLassoPoint(); void signalContinuePolygon(); void signalIncreaseBrushRadius(); void signalDecreaseBrushRadius(); void signalPushToUndoStack(); void signalUndoClone(); void signalRedoClone(); private Q_SLOTS: void slotImageRegionChanged(); protected: void mouseReleaseEvent(QMouseEvent*) override; void mousePressEvent(QMouseEvent*) override; void mouseMoveEvent(QMouseEvent*) override; void mouseDoubleClickEvent(QMouseEvent*) override; void keyPressEvent(QKeyEvent*) override; void keyReleaseEvent(QKeyEvent*) override; void focusOutEvent(QFocusEvent*) override; void focusInEvent(QFocusEvent*) override; bool event(QEvent*) override; void undoSlotSetSourcePoint(); void activateState(HealingCloneState state); private: class Private; Private* const d; }; } // namespace DigikamEditorHealingCloneToolPlugin #endif // DIGIKAM_HEALING_CLONE_TOOL_WIDGET_H diff --git a/core/dplugins/rawimport/rawtherapee/rawimportrawtherapeeplugin.h b/core/dplugins/rawimport/rawtherapee/rawimportrawtherapeeplugin.h index f4a66d0de8..8b29ba053b 100644 --- a/core/dplugins/rawimport/rawtherapee/rawimportrawtherapeeplugin.h +++ b/core/dplugins/rawimport/rawtherapee/rawimportrawtherapeeplugin.h @@ -1,77 +1,77 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-18 * Description : RawTherapee raw import plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program 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 2, or (at your option) any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_RAWTHERAPEE_RAW_IMPORT_PLUGIN_H -#define DIGIKAM_RAWTHERAPEE_RAW_IMPORT_PLUGIN_H +#ifndef DIGIKAM_RAW_IMPORT_RAWTHERAPEE_PLUGIN_H +#define DIGIKAM_RAW_IMPORT_RAWTHERAPEE_PLUGIN_H // Qt includes #include // Local includes #include "dpluginrawimport.h" #define DPLUGIN_IID "org.kde.digikam.plugin.rawimport.RawTherapee" using namespace Digikam; namespace DigikamRawImportRawTherapeePlugin { class RawTherapeeRawImportPlugin : public DPluginRawImport { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginRawImport) public: explicit RawTherapeeRawImportPlugin(QObject* const parent = nullptr); ~RawTherapeeRawImportPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; bool run(const QString& filePath, const DRawDecoding& def); private Q_SLOTS: void slotErrorOccurred(QProcess::ProcessError); void slotProcessFinished(int, QProcess::ExitStatus); void slotProcessReadyRead(); private: class Private; Private* const d; }; } // namespace DigikamRawImportRawTherapeePlugin -#endif // DIGIKAM_RAWTHERAPEE_RAW_IMPORT_PLUGIN_H +#endif // DIGIKAM_RAW_IMPORT_RAWTHERAPEE_PLUGIN_H diff --git a/core/dplugins/rawimport/ufraw/rawimportufrawplugin.h b/core/dplugins/rawimport/ufraw/rawimportufrawplugin.h index 6f0f50620a..7bfe23fe10 100644 --- a/core/dplugins/rawimport/ufraw/rawimportufrawplugin.h +++ b/core/dplugins/rawimport/ufraw/rawimportufrawplugin.h @@ -1,77 +1,77 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2019-09-18 * Description : UFRaw raw import plugin. * * Copyright (C) 2019 by Gilles Caulier * * This program 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 2, or (at your option) any later version. * * This program 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. * * ============================================================ */ -#ifndef DIGIKAM_UFRAW_RAW_IMPORT_PLUGIN_H -#define DIGIKAM_UFRAW_RAW_IMPORT_PLUGIN_H +#ifndef DIGIKAM_RAW_IMPORT_UFRAW_PLUGIN_H +#define DIGIKAM_RAW_IMPORT_UFRAW_PLUGIN_H // Qt includes #include // Local includes #include "dpluginrawimport.h" #define DPLUGIN_IID "org.kde.digikam.plugin.rawimport.UFRaw" using namespace Digikam; namespace DigikamRawImportUFRawPlugin { class UFRawRawImportPlugin : public DPluginRawImport { Q_OBJECT Q_PLUGIN_METADATA(IID DPLUGIN_IID) Q_INTERFACES(Digikam::DPluginRawImport) public: explicit UFRawRawImportPlugin(QObject* const parent = nullptr); ~UFRawRawImportPlugin(); QString name() const override; QString iid() const override; QIcon icon() const override; QString details() const override; QString description() const override; QList authors() const override; void setup(QObject* const) override; bool run(const QString& filePath, const DRawDecoding& def); private Q_SLOTS: void slotErrorOccurred(QProcess::ProcessError); void slotProcessFinished(int, QProcess::ExitStatus); void slotProcessReadyRead(); private: - + class Private; Private* const d; }; } // namespace DigikamRawImportUFRawPlugin -#endif // DIGIKAM_UFRAW_RAW_IMPORT_PLUGIN_H +#endif // DIGIKAM_RAW_IMPORT_UFRAW_PLUGIN_H