Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Remove KoFilterEffect

Dmitry Kazakov896e1232cb5b
diff --git a/krita/data/kritarc b/krita/data/kritarc
index 8fab8554a5..2ec8f714e7 100644
--- a/krita/data/kritarc
+++ b/krita/data/kritarc
@@ -66,7 +66,7 @@ DockerPlugins=\\0
DockerPluginsDisabled=textdocumentinspection
FlakePlugins=,
ShapePlugins=,
-ToolsBlacklist=CreatePathTool,KoPencilTool,KarbonFilterEffectsTool,KritaShape/KisToolText
+ToolsBlacklist=CreatePathTool,KoPencilTool,KritaShape/KisToolText
ToolPlugins=,,
ToolPluginsDisabled=
diff --git a/libs/flake/CMakeLists.txt b/libs/flake/CMakeLists.txt
index b3eb11351c..526a7ee294 100644
--- a/libs/flake/CMakeLists.txt
+++ b/libs/flake/CMakeLists.txt
@@ -106,13 +106,6 @@ set(kritaflake_SRCS
KoSharedSavingData.cpp
KoViewConverter.cpp
KoViewTransformStillPoint.cpp
- KoFilterEffect.cpp
- KoFilterEffectStack.cpp
- KoFilterEffectFactoryBase.cpp
- KoFilterEffectRegistry.cpp
- KoFilterEffectConfigWidgetBase.cpp
- KoFilterEffectRenderContext.cpp
- KoFilterEffectLoadingContext.cpp
KoTextShapeDataBase.cpp
KoTosContainer.cpp
KoTosContainerModel.cpp
@@ -206,7 +199,6 @@ set(kritaflake_SRCS
svg/SvgParser.cpp
svg/SvgStyleParser.cpp
svg/SvgGradientHelper.cpp
- svg/SvgFilterHelper.cpp
svg/SvgCssHelper.cpp
svg/SvgClipPathHelper.cpp
svg/SvgLoadingContext.cpp
diff --git a/libs/flake/KoFilterEffect.cpp b/libs/flake/KoFilterEffect.cpp
deleted file mode 100644
index b098ad7879..0000000000
--- a/libs/flake/KoFilterEffect.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Cyrille Berger <[email protected]>
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#include "KoFilterEffect.h"
-#include "KoXmlWriter.h"
-
-#include <QImage>
-#include <QString>
-#include <QRectF>
-
-class Q_DECL_HIDDEN KoFilterEffect::Private
-{
-public:
- Private()
- : filterRect(0, 0, 1, 1)
- , requiredInputCount(1), maximalInputCount(1)
- {
- // add the default input
- inputs.append(QString());
- }
-
- QString id;
- QString name;
- QRectF filterRect;
- QList<QString> inputs;
- QString output;
- int requiredInputCount;
- int maximalInputCount;
-};
-
-KoFilterEffect::KoFilterEffect(const QString &id, const QString &name)
- : d(new Private)
-{
- d->id = id;
- d->name = name;
-}
-
-KoFilterEffect::~KoFilterEffect()
-{
- delete d;
-}
-
-QString KoFilterEffect::name() const
-{
- return d->name;
-}
-
-QString KoFilterEffect::id() const
-{
- return d->id;
-}
-
-void KoFilterEffect::setFilterRect(const QRectF &filterRect)
-{
- d->filterRect = filterRect;
-}
-
-QRectF KoFilterEffect::filterRect() const
-{
- return d->filterRect;
-}
-
-QRectF KoFilterEffect::filterRectForBoundingRect(const QRectF &boundingRect) const
-{
- qreal x = boundingRect.x() + d->filterRect.x() * boundingRect.width();
- qreal y = boundingRect.y() + d->filterRect.y() * boundingRect.height();
- qreal w = d->filterRect.width() * boundingRect.width();
- qreal h = d->filterRect.height() * boundingRect.height();
- return QRectF(x, y, w, h);
-}
-
-QList<QString> KoFilterEffect::inputs() const
-{
- return d->inputs;
-}
-
-void KoFilterEffect::addInput(const QString &input)
-{
- if (d->inputs.count() < d->maximalInputCount)
- d->inputs.append(input);
-}
-
-void KoFilterEffect::insertInput(int index, const QString &input)
-{
- if (d->inputs.count() < d->maximalInputCount)
- d->inputs.insert(index, input);
-}
-
-void KoFilterEffect::setInput(int index, const QString &input)
-{
- if (index < d->inputs.count())
- d->inputs[index] = input;
-}
-
-void KoFilterEffect::removeInput(int index)
-{
- if (d->inputs.count() > d->requiredInputCount)
- d->inputs.removeAt(index);
-}
-
-void KoFilterEffect::setOutput(const QString &output)
-{
- d->output = output;
-}
-
-QString KoFilterEffect::output() const
-{
- return d->output;
-}
-
-int KoFilterEffect::requiredInputCount() const
-{
- return d->requiredInputCount;
-}
-
-int KoFilterEffect::maximalInputCount() const
-{
- return qMax(d->maximalInputCount, d->requiredInputCount);
-}
-
-QImage KoFilterEffect::processImages(const QList<QImage> &images, const KoFilterEffectRenderContext &/*context*/) const
-{
- Q_ASSERT(images.count());
- return images.first();
-}
-
-void KoFilterEffect::setRequiredInputCount(int count)
-{
- d->requiredInputCount = qMax(0, count);
- for (int i = d->inputs.count(); i < d->requiredInputCount; ++i)
- d->inputs.append(QString());
-}
-
-void KoFilterEffect::setMaximalInputCount(int count)
-{
- d->maximalInputCount = qMax(0,count);
- if (d->inputs.count() > maximalInputCount()) {
- int removeCount = d->inputs.count()-maximalInputCount();
- for (int i = 0; i < removeCount; ++i)
- d->inputs.pop_back();
- }
-}
-
-void KoFilterEffect::saveCommonAttributes(KoXmlWriter &writer)
-{
- writer.addAttribute("result", output());
- if (requiredInputCount() == 1 && maximalInputCount() == 1 && d->inputs.count() == 1) {
- writer.addAttribute("in", d->inputs[0]);
- }
- writer.addAttribute("x", d->filterRect.x());
- writer.addAttribute("y", d->filterRect.y());
- writer.addAttribute("width", d->filterRect.width());
- writer.addAttribute("height", d->filterRect.height());
-}
diff --git a/libs/flake/KoFilterEffect.h b/libs/flake/KoFilterEffect.h
deleted file mode 100644
index 667e3f6c4a..0000000000
--- a/libs/flake/KoFilterEffect.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Cyrille Berger <[email protected]>
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#ifndef _KO_FILTER_EFFECT_H_
-#define _KO_FILTER_EFFECT_H_
-
-class QImage;
-class QString;
-class QRectF;
-class KoXmlWriter;
-class KoFilterEffectRenderContext;
-class KoFilterEffectLoadingContext;
-
-#include <QDomDocument>
-
-#include "kritaflake_export.h"
-#include <QList>
-
-/**
- * This is the base for filter effect (blur, invert...) that can be applied on a shape.
- * All sizes and coordinates of the filter effect are stored in object bounding box
- * coordinates, where (0,0) refers to the top-left corner of a shapes bounding rect
- * and (1,1) refers to the bottom-right corner.
- * When loading, a transformation matrix is given to convert from user space coordinates.
- * Another transformation matrix is given via the render context to convert back to
- * user space coordinates when applying the effect.
- * Using object bounding box coordinates internally makes it easy to share effects
- * between shapes or even between users via the filter effect resources.
- */
-class KRITAFLAKE_EXPORT KoFilterEffect
-{
-public:
- KoFilterEffect(const QString &id, const QString &name);
- virtual ~KoFilterEffect();
-
- /// Returns the user visible name of the filter
- QString name() const;
-
- /// Returns the unique id of the filter
- QString id() const;
-
- /// Sets the region the filter is applied to in bounding box units
- void setFilterRect(const QRectF &filterRect);
-
- /// Returns the region this filter is applied to in bounding box units
- QRectF filterRect() const;
-
- /// Returns the region this filter is applied to for the given bounding rect
- QRectF filterRectForBoundingRect(const QRectF &boundingRect) const;
-
- /**
- * Sets the name of the output image
- *
- * The name is used so that other effects can reference
- * the output of this effect as one of their input images.
- *
- * @param output the output image name
- */
- void setOutput(const QString &output);
-
- /// Returns the name of the output image
- QString output() const;
-
- /**
- * Returns list of named input images of this filter effect.
- *
- * These names identify the input images for this filter effect.
- * These can be one of the keywords SourceGraphic, SourceAlpha,
- * BackgroundImage, BackgroundAlpha, FillPaint or StrokePaint,
- * as well as a named output of another filter effect in the stack.
- * An empty input list of the first effect in the stack default to
- * SourceGraphic, whereas on subsequent effects it defaults to the
- * result of the previous filter effect.
- */
- QList<QString> inputs() const;
-
- /// Adds a new input at the end of the input list
- void addInput(const QString &input);
-
- /// Inserts an input at the given position in the input list
- void insertInput(int index, const QString &input);
-
- /// Sets an existing input to a new value
- void setInput(int index, const QString &input);
-
- /// Removes an input from the given position in the input list
- void removeInput(int index);
-
- /**
- * Return the required number of input images.
- * The default required number of input images is 1.
- * Derived classes should call setRequiredInputCount to set
- * a different number.
- */
- int requiredInputCount() const;
-
- /**
- * Returns the maximal number of input images.
- * The default maximal number of input images is 1.
- * Derived classes should call setMaximalInputCount to set
- * a different number.
- */
- int maximalInputCount() const;
-
- /**
- * Apply the effect on an image.
- * @param image the image the filter should be applied to
- * @param context the render context providing additional data
- */
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const = 0;
-
- /**
- * Apply the effect on a list of images.
- * @param images the images the filter should be applied to
- * @param context the render context providing additional data
- */
- virtual QImage processImages(const QList<QImage> &images, const KoFilterEffectRenderContext &context) const;
-
- /**
- * Loads data from given xml element.
- * @param element the xml element to load data from
- * @param context the loading context providing additional data
- * @return true if loading was successful, else false
- */
- virtual bool load(const QDomElement &element, const KoFilterEffectLoadingContext &context) = 0;
-
- /**
- * Writes custom data to given xml element.
- * @param writer the xml writer to write data to
- */
- virtual void save(KoXmlWriter &writer) = 0;
-
-protected:
- /// Sets the required number of input images
- void setRequiredInputCount(int count);
-
- /// Sets the maximal number of input images
- void setMaximalInputCount(int count);
-
- /**
- * Saves common filter attributes
- *
- * Saves result, subregion and input attributes. The input attribute
- * is only saved if required, maximal and actual input count equals 1.
- * All other filters have to write inputs on their own.
- */
- void saveCommonAttributes(KoXmlWriter &writer);
-
-private:
- class Private;
- Private* const d;
-};
-
-#endif // _KO_FILTER_EFFECT_H_
diff --git a/libs/flake/KoFilterEffectConfigWidgetBase.cpp b/libs/flake/KoFilterEffectConfigWidgetBase.cpp
deleted file mode 100644
index 728f8b88e1..0000000000
--- a/libs/flake/KoFilterEffectConfigWidgetBase.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#include "KoFilterEffectConfigWidgetBase.h"
-
-KoFilterEffectConfigWidgetBase::KoFilterEffectConfigWidgetBase(QWidget *parent)
-: QWidget(parent)
-{
-}
diff --git a/libs/flake/KoFilterEffectConfigWidgetBase.h b/libs/flake/KoFilterEffectConfigWidgetBase.h
deleted file mode 100644
index dd271ebe8d..0000000000
--- a/libs/flake/KoFilterEffectConfigWidgetBase.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#ifndef KOFILTEREFFECTCONFIGWIDGETBASE_H
-#define KOFILTEREFFECTCONFIGWIDGETBASE_H
-
-#include "kritaflake_export.h"
-#include <QWidget>
-
-class KoFilterEffect;
-
-/// Base class for filter effects config widgets
-class KRITAFLAKE_EXPORT KoFilterEffectConfigWidgetBase : public QWidget
-{
- Q_OBJECT
-public:
- explicit KoFilterEffectConfigWidgetBase(QWidget *parent = 0);
- ~KoFilterEffectConfigWidgetBase() override {};
-
- /// Sets the filter effect to be edited by the config widget
- virtual bool editFilterEffect(KoFilterEffect *filterEffect) = 0;
-
-Q_SIGNALS:
- /// Is emitted when the filter effect has changed
- void filterChanged();
-};
-
-#endif // KOFILTEREFFECTCONFIGWIDGETBASE_H
diff --git a/libs/flake/KoFilterEffectFactoryBase.cpp b/libs/flake/KoFilterEffectFactoryBase.cpp
deleted file mode 100644
index 9675061d4d..0000000000
--- a/libs/flake/KoFilterEffectFactoryBase.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#include "KoFilterEffectFactoryBase.h"
-#include <QString>
-
-class Q_DECL_HIDDEN KoFilterEffectFactoryBase::Private
-{
-public:
- Private(const QString &_id, const QString &_name) : id(_id), name(_name)
- {
- }
- const QString id;
- const QString name;
-};
-
-KoFilterEffectFactoryBase::KoFilterEffectFactoryBase(const QString &id, const QString &name)
- : d(new Private(id, name))
-{
-}
-
-KoFilterEffectFactoryBase::~KoFilterEffectFactoryBase()
-{
- delete d;
-}
-
-QString KoFilterEffectFactoryBase::name() const
-{
- return d->name;
-}
-
-QString KoFilterEffectFactoryBase::id() const
-{
- return d->id;
-}
diff --git a/libs/flake/KoFilterEffectFactoryBase.h b/libs/flake/KoFilterEffectFactoryBase.h
deleted file mode 100644
index 7962f95704..0000000000
--- a/libs/flake/KoFilterEffectFactoryBase.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#ifndef KOFILTEREFFECTFACTORY_H
-#define KOFILTEREFFECTFACTORY_H
-
-#include "kritaflake_export.h"
-
-class KoFilterEffect;
-class KoFilterEffectConfigWidgetBase;
-class QString;
-
-/// API docs go here
-class KRITAFLAKE_EXPORT KoFilterEffectFactoryBase
-{
-public:
-
- /**
- * Create the new factory
- * @param id a string that will be used internally for referencing the filter effect
- * @param name the user visible name of the filter effect this factory creates
- */
- KoFilterEffectFactoryBase(const QString &id, const QString &name);
- virtual ~KoFilterEffectFactoryBase();
-
- /**
- * Returns the id for the filter this factory creates.
- * @return the id for the filter this factory creates
- */
- QString id() const;
-
- /**
- * Returns the user visible (and translated) name to be seen by the user.
- * @return the user visible (and translated) name to be seen by the user
- */
- QString name() const;
-
- /**
- * This method should be implemented by factories to create a filter effect.
- * @return a new filter effect
- */
- virtual KoFilterEffect *createFilterEffect() const = 0;
-
- /**
- * This method should be implemented by factories to create a filter effect config widget.
- * @return the filter effect options widget
- */
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const = 0;
-
-private:
- class Private;
- Private * const d;
-};
-
-#endif // KOFILTEREFFECTFACTORY_H
diff --git a/libs/flake/KoFilterEffectLoadingContext.cpp b/libs/flake/KoFilterEffectLoadingContext.cpp
deleted file mode 100644
index 56e9abc406..0000000000
--- a/libs/flake/KoFilterEffectLoadingContext.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/* This file is part of the KDE project
-* SPDX-FileCopyrightText: 2010 Jan Hambrecht <[email protected]>
-*
-* SPDX-License-Identifier: LGPL-2.1-or-later
-*/
-
-#include "KoFilterEffectLoadingContext.h"
-
-#include <QString>
-#include <QRectF>
-#include <QFileInfo>
-#include <QDir>
-
-class Q_DECL_HIDDEN KoFilterEffectLoadingContext::Private
-{
-public:
- Private()
- : convertFilterUnits(false), convertFilterPrimitiveUnits(false)
- {}
- QString basePath;
- QRectF shapeBound;
- bool convertFilterUnits;
- bool convertFilterPrimitiveUnits;
-};
-
-KoFilterEffectLoadingContext::KoFilterEffectLoadingContext(const QString &basePath)
- : d(new Private())
-{
- d->basePath = basePath;
-}
-
-KoFilterEffectLoadingContext::~KoFilterEffectLoadingContext()
-{
- delete d;
-}
-
-void KoFilterEffectLoadingContext::setShapeBoundingBox(const QRectF &shapeBound)
-{
- d->shapeBound = shapeBound;
-}
-
-void KoFilterEffectLoadingContext::enableFilterUnitsConversion(bool enable)
-{
- d->convertFilterUnits = enable;
-}
-
-void KoFilterEffectLoadingContext::enableFilterPrimitiveUnitsConversion(bool enable)
-{
- d->convertFilterPrimitiveUnits = enable;
-}
-
-QPointF KoFilterEffectLoadingContext::convertFilterUnits(const QPointF &value) const
-{
- if (!d->convertFilterUnits)
- return value;
-
- return QPointF(convertFilterUnitsX(value.x()), convertFilterUnitsY(value.y()));
-}
-
-qreal KoFilterEffectLoadingContext::convertFilterUnitsX(qreal value) const
-{
- if (!d->convertFilterUnits)
- return value;
-
- return value / d->shapeBound.width();
-}
-
-qreal KoFilterEffectLoadingContext::convertFilterUnitsY(qreal value) const
-{
- if (!d->convertFilterUnits)
- return value;
-
- return value / d->shapeBound.height();
-}
-
-QPointF KoFilterEffectLoadingContext::convertFilterPrimitiveUnits(const QPointF &value) const
-{
- if (!d->convertFilterPrimitiveUnits)
- return value;
-
- return QPointF(convertFilterPrimitiveUnitsX(value.x()), convertFilterPrimitiveUnitsY(value.y()));
-}
-
-qreal KoFilterEffectLoadingContext::convertFilterPrimitiveUnitsX(qreal value) const
-{
- if (!d->convertFilterPrimitiveUnits)
- return value;
-
- return value / d->shapeBound.width();
-}
-
-qreal KoFilterEffectLoadingContext::convertFilterPrimitiveUnitsY(qreal value) const
-{
- if (!d->convertFilterPrimitiveUnits)
- return value;
-
- return value / d->shapeBound.height();
-}
-
-QString KoFilterEffectLoadingContext::pathFromHref(const QString &href) const
-{
- QFileInfo info(href);
- if (! info.isRelative())
- return href;
-
- QFileInfo pathInfo(QFileInfo(d->basePath).filePath());
-
- QString relFile = href;
- while (relFile.startsWith(QLatin1String("../"))) {
- relFile.remove(0, 3);
- pathInfo.setFile(pathInfo.dir(), QString());
- }
-
- QString absFile = pathInfo.absolutePath() + '/' + relFile;
-
- return absFile;
-}
diff --git a/libs/flake/KoFilterEffectLoadingContext.h b/libs/flake/KoFilterEffectLoadingContext.h
deleted file mode 100644
index 3d567f7231..0000000000
--- a/libs/flake/KoFilterEffectLoadingContext.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* This file is part of the KDE project
-* SPDX-FileCopyrightText: 2010 Jan Hambrecht <[email protected]>
-*
-* SPDX-License-Identifier: LGPL-2.1-or-later
-*/
-
-#ifndef KOFILTEREFFECTLOADINGCONTEXT_H
-#define KOFILTEREFFECTLOADINGCONTEXT_H
-
-#include "kritaflake_export.h"
-
-class QRectF;
-class QPointF;
-
-#include <QtGlobal>
-#include <QString>
-
-/// This class provides a loading context for filter effects
-class KRITAFLAKE_EXPORT KoFilterEffectLoadingContext
-{
-public:
- /**
- * Constructs a new filter effect loading context
- * @param basePath the xml document base path
- */
- explicit KoFilterEffectLoadingContext(const QString &basePath = QString());
-
- /// Destructor
- virtual ~KoFilterEffectLoadingContext();
-
- /**
- * Sets the bounding box of the shape a filter is loaded for.
- * The shapes bounding box is used to convert from user space
- * coordinates to bounding box coordinates for filter attributes.
- * @param shapeBound the shapes bounding box
- */
- void setShapeBoundingBox(const QRectF &shapeBound);
-
- /// Enables conversion of filter units
- void enableFilterUnitsConversion(bool enable);
-
- /// Enables conversion of filter primitive units
- void enableFilterPrimitiveUnitsConversion(bool enable);
-
- /// Converts a point value from user space to bounding box coordinates
- QPointF convertFilterUnits(const QPointF &value) const;
-
- /// Converts an x value from user space to bounding box coordinates
- qreal convertFilterUnitsX(qreal value) const;
-
- /// Converts an y value from user space to bounding box coordinates
- qreal convertFilterUnitsY(qreal value) const;
-
- QPointF convertFilterPrimitiveUnits(const QPointF &value) const;
-
- /// Converts an x value from user space to bounding box coordinates
- qreal convertFilterPrimitiveUnitsX(qreal value) const;
-
- /// Converts an y value from user space to bounding box coordinates
- qreal convertFilterPrimitiveUnitsY(qreal value) const;
-
- /// Converts a href to an absolute path name
- QString pathFromHref(const QString &href) const;
-
-private:
- class Private;
- Private * const d;
-};
-
-#endif // KOFILTEREFFECTLOADINGCONTEXT_H
-
diff --git a/libs/flake/KoFilterEffectRegistry.cpp b/libs/flake/KoFilterEffectRegistry.cpp
deleted file mode 100644
index 18bdbb4352..0000000000
--- a/libs/flake/KoFilterEffectRegistry.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#include "KoFilterEffectRegistry.h"
-
-#include <QGlobalStatic>
-
-#include "KoFilterEffect.h"
-#include "KoFilterEffectFactoryBase.h"
-#include <KoPluginLoader.h>
-
-#include <FlakeDebug.h>
-
-Q_GLOBAL_STATIC(KoFilterEffectRegistry, s_instance)
-
-KoFilterEffectRegistry::KoFilterEffectRegistry()
- : d(0)
-{
-}
-
-void KoFilterEffectRegistry::init()
-{
- KoPluginLoader::PluginsConfig config;
- config.group = "krita";
- config.blacklist = "FilterEffectPluginsDisabled";
- KoPluginLoader::instance()->load(QString::fromLatin1("Krita/FilterEffect"),
- config);
-}
-
-
-KoFilterEffectRegistry::~KoFilterEffectRegistry()
-{
- qDeleteAll(doubleEntries());
- qDeleteAll(values());
-}
-
-KoFilterEffectRegistry* KoFilterEffectRegistry::instance()
-{
- if (!s_instance.exists()) {
- s_instance->init();
- }
- return s_instance;
-}
-
-KoFilterEffect * KoFilterEffectRegistry::createFilterEffectFromXml(const QDomElement & element, const KoFilterEffectLoadingContext &context)
-{
- KoFilterEffectFactoryBase * factory = get(element.tagName());
- if (!factory)
- return 0;
-
- KoFilterEffect * filterEffect = factory->createFilterEffect();
- if (filterEffect->load(element, context))
- return filterEffect;
-
- delete filterEffect;
- return 0;
-}
diff --git a/libs/flake/KoFilterEffectRegistry.h b/libs/flake/KoFilterEffectRegistry.h
deleted file mode 100644
index e8b8b7fd97..0000000000
--- a/libs/flake/KoFilterEffectRegistry.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#ifndef KOFILTEREFFECTREGISTRY_H
-#define KOFILTEREFFECTREGISTRY_H
-
-#include <KoGenericRegistry.h>
-#include <KoFilterEffectFactoryBase.h>
-
-#include "kritaflake_export.h"
-
-#include <QDomDocument>
-class KoFilterEffectLoadingContext;
-class KoFilterEffect;
-
-class KRITAFLAKE_EXPORT KoFilterEffectRegistry : public KoGenericRegistry<KoFilterEffectFactoryBase*>
-{
-public:
- KoFilterEffectRegistry();
- ~KoFilterEffectRegistry() override;
-
- /**
- * Return the only instance of KoFilterEffectRegistry.
- * Creates an instance on the first call.
- */
- static KoFilterEffectRegistry *instance();
-
- /**
- * Creates filter effect from given xml element.
- * @param element the xml element to load from
- * @param context the loading context
- * @return the created filter effect if successful, otherwise returns 0
- */
- KoFilterEffect *createFilterEffectFromXml(const QDomElement &element, const KoFilterEffectLoadingContext &context);
-
-private:
-
- KoFilterEffectRegistry(const KoFilterEffectRegistry&);
- KoFilterEffectRegistry operator=(const KoFilterEffectRegistry&);
- void init();
-
- class Private;
- Private * const d;
-};
-
-#endif // KOFILTEREFFECTREGISTRY_H
diff --git a/libs/flake/KoFilterEffectRenderContext.cpp b/libs/flake/KoFilterEffectRenderContext.cpp
deleted file mode 100644
index f8aa971458..0000000000
--- a/libs/flake/KoFilterEffectRenderContext.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#include "KoFilterEffectRenderContext.h"
-#include "KoViewConverter.h"
-
-#include <QRectF>
-
-class Q_DECL_HIDDEN KoFilterEffectRenderContext::Private
-{
-public:
- Private(const KoViewConverter &viewConverter)
- : converter(viewConverter)
- {}
-
- QRectF filterRegion;
- QRectF shapeBound;
- const KoViewConverter & converter;
-};
-
-KoFilterEffectRenderContext::KoFilterEffectRenderContext(const KoViewConverter &converter)
-: d(new Private(converter))
-{
-}
-
-KoFilterEffectRenderContext::~KoFilterEffectRenderContext()
-{
- delete d;
-}
-
-QRectF KoFilterEffectRenderContext::filterRegion() const
-{
- return d->filterRegion;
-}
-
-void KoFilterEffectRenderContext::setFilterRegion(const QRectF &filterRegion)
-{
- d->filterRegion = filterRegion;
-}
-
-void KoFilterEffectRenderContext::setShapeBoundingBox(const QRectF &bound)
-{
- d->shapeBound = bound;
-}
-
-QPointF KoFilterEffectRenderContext::toUserSpace(const QPointF &value) const
-{
- return QPointF(value.x()*d->shapeBound.width(), value.y()*d->shapeBound.height());
-}
-
-qreal KoFilterEffectRenderContext::toUserSpaceX(qreal value) const
-{
- return value * d->shapeBound.width();
-}
-
-qreal KoFilterEffectRenderContext::toUserSpaceY(qreal value) const
-{
- return value * d->shapeBound.height();
-}
-
-const KoViewConverter * KoFilterEffectRenderContext::viewConverter() const
-{
- return &d->converter;
-}
diff --git a/libs/flake/KoFilterEffectRenderContext.h b/libs/flake/KoFilterEffectRenderContext.h
deleted file mode 100644
index 175de4e51a..0000000000
--- a/libs/flake/KoFilterEffectRenderContext.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#ifndef KOFILTEREFFECTRENDERCONTEXT_H
-#define KOFILTEREFFECTRENDERCONTEXT_H
-
-#include "kritaflake_export.h"
-
-#include <QtGlobal>
-
-class QRectF;
-class QPointF;
-class KoViewConverter;
-
-/// This class provides the render context for filter effects
-class KRITAFLAKE_EXPORT KoFilterEffectRenderContext
-{
-public:
- explicit KoFilterEffectRenderContext(const KoViewConverter &converter);
- ~KoFilterEffectRenderContext();
-
- /// Returns the filter region the filter is applied to
- QRectF filterRegion() const;
-
- /// Sets the filter region the filter is applied to
- void setFilterRegion(const QRectF &filterRegion);
-
- /// Sets the shape bounding box used to convert to user space coordinates
- void setShapeBoundingBox(const QRectF &bound);
-
- /// Converts point from bounding box coordinates to user space coordinates
- QPointF toUserSpace(const QPointF &value) const;
-
- /// Converts x-coordinate from bounding box coordinates to user space coordinates
- qreal toUserSpaceX(qreal value) const;
-
- /// Converts y-coordinate from bounding box coordinates to user space coordinates
- qreal toUserSpaceY(qreal value) const;
-
- /// Returns the view converter
- const KoViewConverter *viewConverter() const;
-
-private:
- class Private;
- Private * const d;
-};
-
-#endif // KOFILTEREFFECTRENDERCONTEXT_H
diff --git a/libs/flake/KoFilterEffectStack.cpp b/libs/flake/KoFilterEffectStack.cpp
deleted file mode 100644
index d0952944dd..0000000000
--- a/libs/flake/KoFilterEffectStack.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009-2010 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#include "KoFilterEffectStack.h"
-#include "KoFilterEffect.h"
-#include "KoXmlWriter.h"
-
-#include <QRectF>
-#include <QAtomicInt>
-#include <QSet>
-#include <QDebug>
-
-class Q_DECL_HIDDEN KoFilterEffectStack::Private
-{
-public:
- Private()
- : clipRect(-0.1, -0.1, 1.2, 1.2) // initialize as per svg spec
- {
- }
-
- ~Private()
- {
- qDeleteAll(filterEffects);
- }
-
- QList<KoFilterEffect*> filterEffects;
- QRectF clipRect;
- QAtomicInt refCount;
-};
-
-KoFilterEffectStack::KoFilterEffectStack()
-: d(new Private())
-{
-}
-
-KoFilterEffectStack::~KoFilterEffectStack()
-{
- delete d;
-}
-
-QList<KoFilterEffect*> KoFilterEffectStack::filterEffects() const
-{
- return d->filterEffects;
-}
-
-bool KoFilterEffectStack::isEmpty() const
-{
- return d->filterEffects.isEmpty();
-}
-
-void KoFilterEffectStack::insertFilterEffect(int index, KoFilterEffect * filter)
-{
- if (filter)
- d->filterEffects.insert(index, filter);
-}
-
-void KoFilterEffectStack::appendFilterEffect(KoFilterEffect *filter)
-{
- if (filter)
- d->filterEffects.append(filter);
-}
-
-void KoFilterEffectStack::removeFilterEffect(int index)
-{
- KoFilterEffect * filter = takeFilterEffect(index);
- delete filter;
-}
-
-KoFilterEffect* KoFilterEffectStack::takeFilterEffect(int index)
-{
- if (index >= d->filterEffects.size())
- return 0;
- return d->filterEffects.takeAt(index);
-}
-
-void KoFilterEffectStack::setClipRect(const QRectF &clipRect)
-{
- d->clipRect = clipRect;
-}
-
-QRectF KoFilterEffectStack::clipRect() const
-{
- return d->clipRect;
-}
-
-QRectF KoFilterEffectStack::clipRectForBoundingRect(const QRectF &boundingRect) const
-{
- qreal x = boundingRect.x() + d->clipRect.x() * boundingRect.width();
- qreal y = boundingRect.y() + d->clipRect.y() * boundingRect.height();
- qreal w = d->clipRect.width() * boundingRect.width();
- qreal h = d->clipRect.height() * boundingRect.height();
- return QRectF(x, y, w, h);
-}
-
-bool KoFilterEffectStack::ref()
-{
- return d->refCount.ref();
-}
-
-bool KoFilterEffectStack::deref()
-{
- return d->refCount.deref();
-}
-
-int KoFilterEffectStack::useCount() const
-{
- return d->refCount;
-}
-
-void KoFilterEffectStack::save(KoXmlWriter &writer, const QString &filterId)
-{
- writer.startElement("filter");
- writer.addAttribute("id", filterId);
- writer.addAttribute("filterUnits", "objectBoundingBox");
- writer.addAttribute("primitiveUnits", "objectBoundingBox");
- writer.addAttribute("x", d->clipRect.x());
- writer.addAttribute("y", d->clipRect.y());
- writer.addAttribute("width", d->clipRect.width());
- writer.addAttribute("height", d->clipRect.height());
-
- Q_FOREACH (KoFilterEffect *effect, d->filterEffects) {
- effect->save(writer);
- }
-
- writer.endElement();
-}
-
-QSet<QString> KoFilterEffectStack::requiredStandardsInputs() const
-{
- static QSet<QString> stdInputs = QSet<QString>()
- << "SourceGraphic"
- << "SourceAlpha"
- << "BackgroundImage"
- << "BackgroundAlpha"
- << "FillPaint"
- << "StrokePaint";
-
- QSet<QString> requiredInputs;
- if (isEmpty())
- return requiredInputs;
-
- if (d->filterEffects.first()->inputs().contains(QString()))
- requiredInputs.insert("SourceGraphic");
-
- Q_FOREACH (KoFilterEffect *effect, d->filterEffects) {
- Q_FOREACH (const QString &input, effect->inputs()) {
- if (stdInputs.contains(input))
- requiredInputs.insert(input);
- }
- }
-
- return requiredInputs;
-}
diff --git a/libs/flake/KoFilterEffectStack.h b/libs/flake/KoFilterEffectStack.h
deleted file mode 100644
index 0cb52ec94c..0000000000
--- a/libs/flake/KoFilterEffectStack.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.1-or-later
- */
-
-#ifndef KOFILTEREFFECTSTACK
-#define KOFILTEREFFECTSTACK
-
-#include "kritaflake_export.h"
-
-#include <QList>
-
-class KoFilterEffect;
-class KoXmlWriter;
-
-class QRectF;
-
-/// This class manages a stack of filter effects
-class KRITAFLAKE_EXPORT KoFilterEffectStack
-{
-public:
- /// Creates an empty filter effect stack
- KoFilterEffectStack();
-
- /// Destroys the filter effect stack, deleting all filter effects
- ~KoFilterEffectStack();
-
- /**
- * The first filter of the list is the first to be applied.
- *
- * @return the list of filter effects applied on the shape when rendering.
- */
- QList<KoFilterEffect*> filterEffects() const;
-
- /**
- * Returns if the filter effect stack is empty.
- * @return false if the stack contains filter effects, otherwise true
- */
- bool isEmpty() const;
-
- /**
- * Inserts a new filter at the given position in the filter list.
- *
- * The filter stack take ownership of the inserted filter effect.
- *
- * @param index the list index to insert the new filter at
- * @param filter the new filter to insert
- */
- void insertFilterEffect(int index, KoFilterEffect *filter);
-
- /**
- * Appends a new filter at the end of the filter list.
- *
- * The filter stack take ownership of the appended filter effect.
- *
- * @param filter the new filter to append
- */
- void appendFilterEffect(KoFilterEffect *filter);
-
- /**
- * Removes the filter with the given index from the filter list.
- *
- * The filter gets deleted after removal from the list.
- *
- * @param index the index of the filter to remove
- */
- void removeFilterEffect(int index);
-
- /**
- * Take filter effect with given index from the stack and returns it.
- * @param index the index of the filter to take
- * @return the filter effect, of 0 if no filter effect with the given index exists
- */
- KoFilterEffect* takeFilterEffect(int index);
-
- /// Sets the clipping rectangle used for this filter in bounding box units
- void setClipRect(const QRectF &clipRect);
-
- /// Returns the clipping rectangle used for this filter in bounding box units
- QRectF clipRect() const;
-
- /// Returns the clipping rectangle for the given bounding rect
- QRectF clipRectForBoundingRect(const QRectF &boundingRect) const;
-
- /**
- * Increments the use-value.
- * Returns true if the new value is non-zero, false otherwise.
- */
- bool ref();
-
- /**
- * Decrements the use-value.
- * Returns true if the new value is non-zero, false otherwise.
- */
- bool deref();
-
- /// Return reference counter
- int useCount() const;
-
- /**
- * Saves filter stack using given xml writer.
- * @param writer the xml writer to write data to
- * @param id the filter id to write, used for referencing the filter
- */
- void save(KoXmlWriter &writer, const QString &filterId);
-
- /// Returns list of required standard inputs
- QSet<QString> requiredStandardsInputs() const;
-private:
- class Private;
- Private * const d;
-};
-
-#endif // KOFILTEREFFECTSTACK
diff --git a/libs/flake/KoPathShape.cpp b/libs/flake/KoPathShape.cpp
index 90bd9ea13a..a43beab258 100644
--- a/libs/flake/KoPathShape.cpp
+++ b/libs/flake/KoPathShape.cpp
@@ -18,7 +18,6 @@
#include "KoShapeLoadingContext.h"
#include "KoShapeBackground.h"
#include "KoShapeContainer.h"
-#include "KoFilterEffectStack.h"
#include "KoMarker.h"
#include "KoShapeStroke.h"
#include "KoInsets.h"
@@ -291,13 +290,7 @@ QRectF KoPathShape::boundingRect() const
#endif
// add 10% extra update area around the doubled insets
- QRectF bb = transform.mapRect(kisGrowRect(outline().boundingRect(), 1.1 * 0.5 * outlineSweepWidth));
-
- if (filterEffectStack()) {
- QRectF clipRect = filterEffectStack()->clipRectForBoundingRect(QRectF(QPointF(), size()));
- bb |= transform.mapRect(clipRect);
- }
- return bb;
+ return transform.mapRect(kisGrowRect(outline().boundingRect(), 1.1 * 0.5 * outlineSweepWidth));
}
QSizeF KoPathShape::size() const
diff --git a/libs/flake/KoShape.cpp b/libs/flake/KoShape.cpp
index 7cf5018e94..e76904eac0 100644
--- a/libs/flake/KoShape.cpp
+++ b/libs/flake/KoShape.cpp
@@ -32,7 +32,6 @@
#include "KoShapeStroke.h"
#include "KoClipPath.h"
#include "KoPathShape.h"
-#include "KoFilterEffectStack.h"
#include <KoSnapData.h>
#include <KoXmlWriter.h>
@@ -55,7 +54,6 @@
KoShape::SharedData::SharedData()
: QSharedData()
, size(50, 50)
- , filterEffectStack(0)
, transparency(0.0)
, zIndex(0)
, runThrough(0)
@@ -91,7 +89,6 @@ KoShape::SharedData::SharedData(const SharedData &rhs)
, clipMask(rhs.clipMask ? rhs.clipMask->clone() : 0)
, additionalAttributes(rhs.additionalAttributes)
, additionalStyleAttributes(rhs.additionalStyleAttributes)
- , filterEffectStack(0) // WARNING: not implemented in Krita
, transparency(rhs.transparency)
, hyperLink(rhs.hyperLink)
@@ -119,8 +116,6 @@ KoShape::SharedData::SharedData(const SharedData &rhs)
KoShape::SharedData::~SharedData()
{
- if (filterEffectStack && !filterEffectStack->deref())
- delete filterEffectStack;
}
void KoShape::shapeChangedPriv(KoShape::ChangeType type)
@@ -328,11 +323,6 @@ QRectF KoShape::boundingRect() const
bb.adjust(-insets.left, -insets.top, insets.right, insets.bottom);
}
bb = transform.mapRect(bb);
- if (s->filterEffectStack) {
- QRectF clipRect = s->filterEffectStack->clipRectForBoundingRect(outlineRect());
- bb |= transform.mapRect(clipRect);
- }
-
return bb;
}
@@ -1258,22 +1248,6 @@ void KoShape::removeAdditionalStyleAttribute(const char *name)
s->additionalStyleAttributes.remove(name);
}
-KoFilterEffectStack *KoShape::filterEffectStack() const
-{
- return s->filterEffectStack;
-}
-
-void KoShape::setFilterEffectStack(KoFilterEffectStack *filterEffectStack)
-{
- if (s->filterEffectStack)
- s->filterEffectStack->deref();
- s->filterEffectStack = filterEffectStack;
- if (s->filterEffectStack) {
- s->filterEffectStack->ref();
- }
- notifyChanged();
-}
-
QSet<KoShape*> KoShape::toolDelegates() const
{
return d->toolDelegates;
diff --git a/libs/flake/KoShape.h b/libs/flake/KoShape.h
index 4cbb70e63f..7b2871185e 100644
--- a/libs/flake/KoShape.h
+++ b/libs/flake/KoShape.h
@@ -34,7 +34,6 @@ class KoShapeUserData;
class KoViewConverter;
class KoShapeSavingContext;
class KoShapeLoadingContext;
-class KoFilterEffectStack;
class KoSnapData;
class KoClipPath;
class KoClipMask;
@@ -1022,16 +1021,6 @@ public:
void removeAdditionalStyleAttribute(const char *name);
- /**
- * Returns the filter effect stack of the shape
- *
- * @return the list of filter effects applied on the shape when rendering.
- */
- KoFilterEffectStack *filterEffectStack() const;
-
- /// Sets the new filter effect stack, removing the old one
- void setFilterEffectStack(KoFilterEffectStack *filterEffectStack);
-
/**
* Return the tool delegates for this shape.
* In Flake a shape being selected will cause the tool manager to make available all tools that
diff --git a/libs/flake/KoShapeManager.cpp b/libs/flake/KoShapeManager.cpp
index c432f9b23a..58f55d2dc7 100644
--- a/libs/flake/KoShapeManager.cpp
+++ b/libs/flake/KoShapeManager.cpp
@@ -20,9 +20,6 @@
#include "KoShapeGroup.h"
#include "KoToolProxy.h"
#include "KoShapeLayer.h"
-#include "KoFilterEffect.h"
-#include "KoFilterEffectStack.h"
-#include "KoFilterEffectRenderContext.h"
#include "KoShapeBackground.h"
#include <KoRTree.h>
#include "KoClipPath.h"
@@ -64,7 +61,6 @@ inline bool shapeUsedInRenderingTree(KoShape *shape)
*/
inline bool shapeHasGroupEffects(KoShape *shape) {
return shape->clipPath() ||
- (shape->filterEffectStack() && !shape->filterEffectStack()->isEmpty()) ||
shape->clipMask();
}
diff --git a/libs/flake/KoShape_p.h b/libs/flake/KoShape_p.h
index 719f17c155..282d683ecc 100644
--- a/libs/flake/KoShape_p.h
+++ b/libs/flake/KoShape_p.h
@@ -48,7 +48,6 @@ public:
QScopedPointer<KoClipMask> clipMask; ///< the current clip mask
QMap<QString, QString> additionalAttributes;
QMap<QByteArray, QString> additionalStyleAttributes;
- KoFilterEffectStack *filterEffectStack; ///< stack of filter effects applied to the shape
qreal transparency; ///< the shapes transparency
QString hyperLink; //hyperlink for this shape
diff --git a/libs/flake/svg/SvgFilterHelper.cpp b/libs/flake/svg/SvgFilterHelper.cpp
deleted file mode 100644
index 90d62ef566..0000000000
--- a/libs/flake/svg/SvgFilterHelper.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.0-or-later
- */
-
-#include "SvgFilterHelper.h"
-#include "SvgUtil.h"
-
-SvgFilterHelper::SvgFilterHelper()
- : m_filterUnits(KoFlake::ObjectBoundingBox) // default as per svg spec
- , m_primitiveUnits(KoFlake::UserSpaceOnUse) // default as per svg spec
- , m_position(-0.1, -0.1) // default as per svg spec
- , m_size(1.2, 1.2) // default as per svg spec
-{
-}
-
-SvgFilterHelper::~SvgFilterHelper()
-{
-}
-
-void SvgFilterHelper::setFilterUnits(KoFlake::CoordinateSystem filterUnits)
-{
- m_filterUnits = filterUnits;
-}
-
-KoFlake::CoordinateSystem SvgFilterHelper::filterUnits() const
-{
- return m_filterUnits;
-}
-
-void SvgFilterHelper::setPrimitiveUnits(KoFlake::CoordinateSystem primitiveUnits)
-{
- m_primitiveUnits = primitiveUnits;
-}
-
-KoFlake::CoordinateSystem SvgFilterHelper::primitiveUnits() const
-{
- return m_primitiveUnits;
-}
-
-void SvgFilterHelper::setPosition(const QPointF & position)
-{
- m_position = position;
-}
-
-QPointF SvgFilterHelper::position(const QRectF & objectBound) const
-{
- if (m_filterUnits == KoFlake::UserSpaceOnUse) {
- return m_position;
- } else {
- return SvgUtil::objectToUserSpace(m_position, objectBound);
- }
-}
-
-void SvgFilterHelper::setSize(const QSizeF & size)
-{
- m_size = size;
-}
-
-QSizeF SvgFilterHelper::size(const QRectF & objectBound) const
-{
- if (m_filterUnits == KoFlake::UserSpaceOnUse) {
- return m_size;
- } else {
- return SvgUtil::objectToUserSpace(m_size, objectBound);
- }
-}
-
-void SvgFilterHelper::setContent(const QDomElement &content)
-{
- m_filterContent = content;
-}
-
-QDomElement SvgFilterHelper::content() const
-{
- return m_filterContent;
-}
diff --git a/libs/flake/svg/SvgFilterHelper.h b/libs/flake/svg/SvgFilterHelper.h
deleted file mode 100644
index f1f5dfb849..0000000000
--- a/libs/flake/svg/SvgFilterHelper.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* This file is part of the KDE project
- * SPDX-FileCopyrightText: 2009 Jan Hambrecht <[email protected]>
- *
- * SPDX-License-Identifier: LGPL-2.0-or-later
- */
-
-#ifndef SVGFILTERHELPER_H
-#define SVGFILTERHELPER_H
-
-#include <QSizeF>
-#include <QPointF>
-#include <QDomDocument>
-
-#include <KoFlakeCoordinateSystem.h>
-
-class QRectF;
-
-class SvgFilterHelper
-{
-public:
- SvgFilterHelper();
- ~SvgFilterHelper();
-
- /// Set the filter units type
- void setFilterUnits(KoFlake::CoordinateSystem filterUnits);
- /// Returns the filter units type
- KoFlake::CoordinateSystem filterUnits() const;
-
- /// Set the filter primitive units type
- void setPrimitiveUnits(KoFlake::CoordinateSystem primitiveUnits);
- /// Returns the filter primitive units type
- KoFlake::CoordinateSystem primitiveUnits() const;
-
- /// Sets filter position
- void setPosition(const QPointF & position);
- /// Returns filter position (objectBound is used when filterUnits == ObjectBoundingBox)
- QPointF position(const QRectF & objectBound) const;
-
- /// Sets filter size
- void setSize(const QSizeF & size);
- /// Returns filter size (objectBound is used when filterUnits == ObjectBoundingBox)
- QSizeF size(const QRectF & objectBound) const;
-
- /// Sets the dom element containing the filter
- void setContent(const QDomElement &content);
- /// Return the filer element
- QDomElement content() const;
-
- static QPointF toUserSpace(const QPointF &position, const QRectF &objectBound);
- static QSizeF toUserSpace(const QSizeF &size, const QRectF &objectBound);
-private:
- KoFlake::CoordinateSystem m_filterUnits;
- KoFlake::CoordinateSystem m_primitiveUnits;
- QPointF m_position;
- QSizeF m_size;
- QDomElement m_filterContent;
-};
-
-#endif // SVGFILTERHELPER_H
diff --git a/libs/flake/svg/SvgParser.cpp b/libs/flake/svg/SvgParser.cpp
index 800f9662e4..ba0828b602 100644
--- a/libs/flake/svg/SvgParser.cpp
+++ b/libs/flake/svg/SvgParser.cpp
@@ -35,10 +35,6 @@
#include <KoGradientBackground.h>
#include <KoMeshGradientBackground.h>
#include <KoPatternBackground.h>
-#include <KoFilterEffectRegistry.h>
-#include <KoFilterEffect.h>
-#include "KoFilterEffectStack.h"
-#include "KoFilterEffectLoadingContext.h"
#include <KoClipPath.h>
#include <KoClipMask.h>
#include <KoXmlNS.h>
@@ -49,7 +45,6 @@
#include "SvgUtil.h"
#include "SvgShape.h"
#include "SvgGraphicContext.h"
-#include "SvgFilterHelper.h"
#include "SvgGradientHelper.h"
#include "SvgClipPathHelper.h"
#include "parsers/SvgTransformParser.h"
@@ -265,43 +260,6 @@ QSharedPointer<KoVectorPatternBackground> SvgParser::findPattern(const QString &
return result;
}
-SvgFilterHelper* SvgParser::findFilter(const QString &id, const QString &href)
-{
- // check if filter was already parsed, and return it
- if (m_filters.contains(id))
- return &m_filters[ id ];
-
- // check if filter was stored for later parsing
- if (!m_context.hasDefinition(id))
- return 0;
-
- const QDomElement &e = m_context.definition(id);
- if (e.childNodes().count() == 0) {
- QString mhref = e.attribute("xlink:href").mid(1);
-
- if (m_context.hasDefinition(mhref))
- return findFilter(mhref, id);
- else
- return 0;
- } else {
- // ok parse filter now
- if (! parseFilter(m_context.definition(id), m_context.definition(href)))
- return 0;
- }
-
- // return successfully parsed filter or 0
- QString n;
- if (href.isEmpty())
- n = id;
- else
- n = href;
-
- if (m_filters.contains(n))
- return &m_filters[ n ];
- else
- return 0;
-}
-
SvgClipPathHelper* SvgParser::findClipPath(const QString &id)
{
return m_clipPaths.contains(id) ? &m_clipPaths[id] : 0;
@@ -721,55 +679,6 @@ QSharedPointer<KoVectorPatternBackground> SvgParser::parsePattern(const QDomElem
return pattHelper;
}
-bool SvgParser::parseFilter(const QDomElement &e, const QDomElement &referencedBy)
-{
- SvgFilterHelper filter;
-
- // Use the filter that is referencing, or if there isn't one, the original filter
- QDomElement b;
- if (!referencedBy.isNull())
- b = referencedBy;
- else
- b = e;
-
- // check if we are referencing another filter
- if (e.hasAttribute("xlink:href")) {
- QString href = e.attribute("xlink:href").mid(1);
- if (! href.isEmpty()) {
- // copy the referenced filter if found
- SvgFilterHelper *refFilter = findFilter(href);
- if (refFilter)
- filter = *refFilter;
- }
- } else {
- filter.setContent(b);
- }
-
- if (b.attribute("filterUnits") == "userSpaceOnUse")
- filter.setFilterUnits(KoFlake::UserSpaceOnUse);
- if (b.attribute("primitiveUnits") == "objectBoundingBox")
- filter.setPrimitiveUnits(KoFlake::ObjectBoundingBox);
-
- // parse filter region rectangle
- if (filter.filterUnits() == KoFlake::UserSpaceOnUse) {
- filter.setPosition(QPointF(parseUnitX(b.attribute("x")),
- parseUnitY(b.attribute("y"))));
- filter.setSize(QSizeF(parseUnitX(b.attribute("width")),
- parseUnitY(b.attribute("height"))));
- } else {
- // x, y, width, height are in percentages of the object referencing the filter
- // so we just parse the percentages
- filter.setPosition(QPointF(SvgUtil::fromPercentage(b.attribute("x", "-0.1")),
- SvgUtil::fromPercentage(b.attribute("y", "-0.1"))));
- filter.setSize(QSizeF(SvgUtil::fromPercentage(b.attribute("width", "1.2")),
- SvgUtil::fromPercentage(b.attribute("height", "1.2"))));
- }
-
- m_filters.insert(b.attribute("id"), filter);
-
- return true;
-}
-
bool SvgParser::parseMarker(const QDomElement &e)
{
const QString id = e.attribute("id");
@@ -963,7 +872,6 @@ void SvgParser::applyCurrentStyle(KoShape *shape, const QPointF &shapeToOriginal
applyMarkers(pathShape);
}
- applyFilter(shape);
applyClipping(shape, shapeToOriginalUserCoordinates);
applyMaskClipping(shape, shapeToOriginalUserCoordinates);
@@ -1025,7 +933,6 @@ void SvgParser::applyStyle(KoShape *obj, const SvgStyles &styles, const QPointF
applyMarkers(pathShape);
}
- applyFilter(obj);
applyClipping(obj, shapeToOriginalUserCoordinates);
applyMaskClipping(obj, shapeToOriginalUserCoordinates);
@@ -1283,134 +1190,6 @@ void SvgParser::applyStrokeStyle(KoShape *shape)
}
}
-void SvgParser::applyFilter(KoShape *shape)
-{
- SvgGraphicsContext *gc = m_context.currentGC();
- if (! gc)
- return;
-
- if (gc->filterId.isEmpty())
- return;
-
- SvgFilterHelper *filter = findFilter(gc->filterId);
- if (! filter)
- return;
-
- QDomElement content = filter->content();
-
- // parse filter region
- QRectF bound(shape->position(), shape->size());
- // work on bounding box without viewbox transformation applied
- // so user space coordinates of bounding box and filter region match up
- bound = gc->viewboxTransform.inverted().mapRect(bound);
-
- QRectF filterRegion(filter->position(bound), filter->size(bound));
-
- // convert filter region to boundingbox units
- QRectF objectFilterRegion;
- objectFilterRegion.setTopLeft(SvgUtil::userSpaceToObject(filterRegion.topLeft(), bound));
- objectFilterRegion.setSize(SvgUtil::userSpaceToObject(filterRegion.size(), bound));
-
- KoFilterEffectLoadingContext context(m_context.xmlBaseDir());
- context.setShapeBoundingBox(bound);
- // enable units conversion
- context.enableFilterUnitsConversion(filter->filterUnits() == KoFlake::UserSpaceOnUse);
- context.enableFilterPrimitiveUnitsConversion(filter->primitiveUnits() == KoFlake::UserSpaceOnUse);
-
- KoFilterEffectRegistry *registry = KoFilterEffectRegistry::instance();
-
- KoFilterEffectStack *filterStack = 0;
-
- QSet<QString> stdInputs;
- stdInputs << "SourceGraphic" << "SourceAlpha";
- stdInputs << "BackgroundImage" << "BackgroundAlpha";
- stdInputs << "FillPaint" << "StrokePaint";
-
- QMap<QString, KoFilterEffect*> inputs;
-
- // create the filter effects and add them to the shape
- for (QDomNode n = content.firstChild(); !n.isNull(); n = n.nextSibling()) {
- QDomElement primitive = n.toElement();
- KoFilterEffect *filterEffect = registry->createFilterEffectFromXml(primitive, context);
- if (!filterEffect) {
- debugFlake << "filter effect" << primitive.tagName() << "is not implemented yet";
- continue;
- }
-
- const QString input = primitive.attribute("in");
- if (!input.isEmpty()) {
- filterEffect->setInput(0, input);
- }
- const QString output = primitive.attribute("result");
- if (!output.isEmpty()) {
- filterEffect->setOutput(output);
- }
-
- QRectF subRegion;
- // parse subregion
- if (filter->primitiveUnits() == KoFlake::UserSpaceOnUse) {
- const QString xa = primitive.attribute("x");
- const QString ya = primitive.attribute("y");
- const QString wa = primitive.attribute("width");
- const QString ha = primitive.attribute("height");
-
- if (xa.isEmpty() || ya.isEmpty() || wa.isEmpty() || ha.isEmpty()) {
- bool hasStdInput = false;
- bool isFirstEffect = filterStack == 0;
- // check if one of the inputs is a standard input
- Q_FOREACH (const QString &input, filterEffect->inputs()) {
- if ((isFirstEffect && input.isEmpty()) || stdInputs.contains(input)) {
- hasStdInput = true;
- break;
- }
- }
- if (hasStdInput || primitive.tagName() == "feImage") {
- // default to 0%, 0%, 100%, 100%
- subRegion.setTopLeft(QPointF(0, 0));
- subRegion.setSize(QSizeF(1, 1));
- } else {
- // defaults to bounding rect of all referenced nodes
- Q_FOREACH (const QString &input, filterEffect->inputs()) {
- if (!inputs.contains(input))
- continue;
-
- KoFilterEffect *inputFilter = inputs[input];
- if (inputFilter)
- subRegion |= inputFilter->filterRect();
- }
- }
- } else {
- const qreal x = parseUnitX(xa);
- const qreal y = parseUnitY(ya);
- const qreal w = parseUnitX(wa);
- const qreal h = parseUnitY(ha);
- subRegion.setTopLeft(SvgUtil::userSpaceToObject(QPointF(x, y), bound));
- subRegion.setSize(SvgUtil::userSpaceToObject(QSizeF(w, h), bound));
- }
- } else {
- // x, y, width, height are in percentages of the object referencing the filter
- // so we just parse the percentages
- const qreal x = SvgUtil::fromPercentage(primitive.attribute("x", "0"));
- const qreal y = SvgUtil::fromPercentage(primitive.attribute("y", "0"));
- const qreal w = SvgUtil::fromPercentage(primitive.attribute("width", "1"));
- const qreal h = SvgUtil::fromPercentage(primitive.attribute("height", "1"));
- subRegion = QRectF(QPointF(x, y), QSizeF(w, h));
- }
-
- filterEffect->setFilterRect(subRegion);
-
- if (!filterStack)
- filterStack = new KoFilterEffectStack();
-
- filterStack->appendFilterEffect(filterEffect);
- inputs[filterEffect->output()] = filterEffect;
- }
- if (filterStack) {
- filterStack->setClipRect(objectFilterRegion);
- shape->setFilterEffectStack(filterStack);
- }
-}
-
void SvgParser::applyMarkers(KoPathShape *shape)
{
SvgGraphicsContext *gc = m_context.currentGC();
@@ -2051,7 +1830,7 @@ QList<KoShape*> SvgParser::parseSingleElement(const QDomElement &b, DeferredUseS
} else if (b.tagName() == "linearGradient" || b.tagName() == "radialGradient") {
} else if (b.tagName() == "pattern") {
} else if (b.tagName() == "filter") {
- parseFilter(b);
+ // not supported!
} else if (b.tagName() == "clipPath") {
parseClipPath(b);
} else if (b.tagName() == "mask") {
diff --git a/libs/flake/svg/SvgParser.h b/libs/flake/svg/SvgParser.h
index c03848779f..c74f80bd33 100644
--- a/libs/flake/svg/SvgParser.h
+++ b/libs/flake/svg/SvgParser.h
@@ -17,7 +17,6 @@
#include "kritaflake_export.h"
#include "SvgGradientHelper.h"
-#include "SvgFilterHelper.h"
#include "SvgClipPathHelper.h"
#include "SvgLoadingContext.h"
#include "SvgStyleParser.h"
@@ -166,9 +165,6 @@ protected:
/// find pattern with given id in pattern map
QSharedPointer<KoVectorPatternBackground> findPattern(const QString &id, const KoShape *shape);
- /// find filter with given id in filter map
- SvgFilterHelper* findFilter(const QString &id, const QString &href = QString());
-
/// find clip path with given id in clip path map
SvgClipPathHelper* findClipPath(const QString &id);
@@ -206,9 +202,6 @@ protected:
/// Applies the current stroke style to the object
void applyStrokeStyle(KoShape * shape);
- /// Applies the current filter to the object
- void applyFilter(KoShape * shape);
-
/// Applies the current clip path to the object
void applyClipping(KoShape *shape, const QPointF &shapeToOriginalUserCoordinates);
void applyMaskClipping(KoShape *shape, const QPointF &shapeToOriginalUserCoordinates);
@@ -231,7 +224,6 @@ protected:
private:
SvgLoadingContext m_context;
QMap<QString, SvgGradientHelper> m_gradients;
- QMap<QString, SvgFilterHelper> m_filters;
QMap<QString, SvgClipPathHelper> m_clipPaths;
QMap<QString, QSharedPointer<KoClipMask>> m_clipMasks;
QMap<QString, QExplicitlySharedDataPointer<KoMarker>> m_markers;
diff --git a/libs/flake/svg/SvgStyleWriter.cpp b/libs/flake/svg/SvgStyleWriter.cpp
index dde733c5a9..4b7767dffc 100644
--- a/libs/flake/svg/SvgStyleWriter.cpp
+++ b/libs/flake/svg/SvgStyleWriter.cpp
@@ -27,8 +27,6 @@
#include <KoShape.h>
#include <KoPathShape.h>
#include <KoPathSegment.h>
-#include <KoFilterEffect.h>
-#include <KoFilterEffectStack.h>
#include <KoColorBackground.h>
#include <KoGradientBackground.h>
#include <KoMeshGradientBackground.h>
@@ -64,7 +62,6 @@ void SvgStyleWriter::saveSvgStyle(KoShape *shape, SvgSavingContext &context)
saveSvgStroke(shape->stroke(), context);
}
- saveSvgEffects(shape, context);
saveSvgClipping(shape, context);
saveSvgMasking(shape, context);
saveSvgMarkers(shape, context);
@@ -195,23 +192,6 @@ void SvgStyleWriter::saveSvgStroke(KoShapeStrokeModelSP stroke, SvgSavingContext
}
}
-void SvgStyleWriter::saveSvgEffects(KoShape *shape, SvgSavingContext &context)
-{
- KoFilterEffectStack * filterStack = shape->filterEffectStack();
- if (!filterStack)
- return;
-
- QList<KoFilterEffect*> filterEffects = filterStack->filterEffects();
- if (!filterEffects.count())
- return;
-
- const QString uid = context.createUID("filter");
-
- filterStack->save(context.styleWriter(), uid);
-
- context.shapeWriter().addAttribute("filter", "url(#" + uid + ")");
-}
-
void embedShapes(const QList<KoShape*> &shapes, KoXmlWriter &outWriter)
{
QBuffer buffer;
diff --git a/libs/flake/svg/SvgStyleWriter.h b/libs/flake/svg/SvgStyleWriter.h
index 96b124e990..847e18a0ff 100644
--- a/libs/flake/svg/SvgStyleWriter.h
+++ b/libs/flake/svg/SvgStyleWriter.h
@@ -53,8 +53,6 @@ public:
static void saveMetadata(const KoShape *shape, SvgSavingContext &context);
protected:
- /// Saves effects of specified shape
- static void saveSvgEffects(KoShape *shape, SvgSavingContext &context);
/// Saves clipping of specified shape
static void saveSvgClipping(KoShape *shape, SvgSavingContext &context);
/// Saves masking of specified shape
diff --git a/libs/resources/KisResourceTypes.cpp b/libs/resources/KisResourceTypes.cpp
index 5e8e0911fa..945e81f28b 100644
--- a/libs/resources/KisResourceTypes.cpp
+++ b/libs/resources/KisResourceTypes.cpp
@@ -22,7 +22,6 @@ namespace ResourceType {
const QString Sessions {QStringLiteral("sessions")};
const QString GamutMasks {QStringLiteral("gamutmasks")};
const QString SeExprScripts {QStringLiteral("seexpr_scripts")};
- const QString FilterEffects {QStringLiteral("ko_effects")};
const QString TaskSets {QStringLiteral("tasksets")};
const QString LayerStyles {QStringLiteral("layerstyles")};
const QString FontFamilies {QStringLiteral("fontfamilies")};
@@ -53,7 +52,6 @@ namespace ResourceName {
const KLocalizedString Sessions = ki18nc("resource type", "Sessions");
const KLocalizedString GamutMasks = ki18nc("resource type", "Gamut Masks");
const KLocalizedString SeExprScripts = ki18nc("resource type", "SeExpr Scripts");
- const KLocalizedString FilterEffects = ki18nc("resource type", "Filter Effects");
const KLocalizedString TaskSets = ki18nc("resource type", "Task Sets");
const KLocalizedString LayerStyles = ki18nc("resource type", "Layer Styles");
const KLocalizedString FontFamilies = ki18nc("resource type", "Font Families");
@@ -78,7 +76,6 @@ QString ResourceName::resourceTypeToName(const QString &resourceType)
typeMap[ResourceType::Sessions] = ResourceName::Sessions.toString();
typeMap[ResourceType::GamutMasks] = ResourceName::GamutMasks.toString();
typeMap[ResourceType::SeExprScripts] = ResourceName::SeExprScripts.toString();
- typeMap[ResourceType::FilterEffects] = ResourceName::FilterEffects.toString();
typeMap[ResourceType::TaskSets] = ResourceName::TaskSets.toString();
typeMap[ResourceType::LayerStyles] = ResourceName::LayerStyles.toString();
typeMap[ResourceType::FontFamilies] = ResourceName::FontFamilies.toString();
diff --git a/libs/resources/KisResourceTypes.h b/libs/resources/KisResourceTypes.h
index 54af5fadd4..bdc74efa5b 100644
--- a/libs/resources/KisResourceTypes.h
+++ b/libs/resources/KisResourceTypes.h
@@ -25,7 +25,6 @@ namespace ResourceType {
KRITARESOURCES_EXPORT extern const QString Sessions;
KRITARESOURCES_EXPORT extern const QString GamutMasks;
KRITARESOURCES_EXPORT extern const QString SeExprScripts;
- KRITARESOURCES_EXPORT extern const QString FilterEffects;
KRITARESOURCES_EXPORT extern const QString TaskSets;
KRITARESOURCES_EXPORT extern const QString LayerStyles;
KRITARESOURCES_EXPORT extern const QString FontFamilies;
@@ -56,7 +55,6 @@ namespace ResourceName {
KRITARESOURCES_EXPORT extern const KLocalizedString Sessions;
KRITARESOURCES_EXPORT extern const KLocalizedString GamutMasks;
KRITARESOURCES_EXPORT extern const KLocalizedString SeExprScripts;
- KRITARESOURCES_EXPORT extern const KLocalizedString FilterEffects;
KRITARESOURCES_EXPORT extern const KLocalizedString TaskSets;
KRITARESOURCES_EXPORT extern const KLocalizedString LayerStyles;
KRITARESOURCES_EXPORT extern const KLocalizedString FontFamilies;
diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cpp
index 65ba31999a..bdcbacaf78 100644
--- a/libs/ui/KisApplication.cpp
+++ b/libs/ui/KisApplication.cpp
@@ -378,7 +378,6 @@ void KisApplication::addResourceTypes()
KoResourcePaths::addAssetType("kis_actions", "data", "/pykrita");
KoResourcePaths::addAssetType("icc_profiles", "data", "/color/icc");
KoResourcePaths::addAssetType("icc_profiles", "data", "/profiles/");
- KoResourcePaths::addAssetType(ResourceType::FilterEffects, "data", "/effects/");
KoResourcePaths::addAssetType("tags", "data", "/tags/");
KoResourcePaths::addAssetType("templates", "data", "/templates");
KoResourcePaths::addAssetType("pythonscripts", "data", "/pykrita");