1 // SPDX-License-Identifier: GPL-2.0-or-later
2 #ifndef INKSCAPE_EXTENSION_INTERNAL_FILTER_FILTER_H
3 #define INKSCAPE_EXTENSION_INTERNAL_FILTER_FILTER_H
4 
5 /*
6  * Copyright (C) 2008 Authors:
7  *   Ted Gould <ted@gould.cx>
8  *
9  * Released under GNU GPL v2+, read the file 'COPYING' for more information.
10  */
11 
12 #include <glibmm/i18n.h>
13 
14 #include "extension/implementation/implementation.h"
15 
16 namespace Inkscape {
17 
18 namespace XML {
19 	struct Document;
20 }
21 
22 namespace Extension {
23 
24 class Effect;
25 class Extension;
26 
27 namespace Internal {
28 namespace Filter {
29 
30 class Filter : public Inkscape::Extension::Implementation::Implementation {
31 protected:
32 	gchar const * _filter;
33 	virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
34 
35 private:
36 	Inkscape::XML::Document * get_filter (Inkscape::Extension::Extension * ext);
37 	void merge_filters (Inkscape::XML::Node * to, Inkscape::XML::Node * from, Inkscape::XML::Document * doc, gchar const * srcGraphic = nullptr, gchar const * srcGraphicAlpha = nullptr);
38 
39 public:
40 	Filter();
41 	Filter(gchar const * filter);
42 	~Filter() override;
43 
44 	bool load(Inkscape::Extension::Extension *module) override;
45 	Inkscape::Extension::Implementation::ImplementationDocumentCache * newDocCache (Inkscape::Extension::Extension * ext, Inkscape::UI::View::View * doc) override;
46 	void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache) override;
47 
48 	static void filter_init(gchar const * id, gchar const * name, gchar const * submenu, gchar const * tip, gchar const * filter);
49 	static void filters_all();
50 
51 	/* File loader related */
52 	static void filters_all_files();
53 	static void filters_load_node(Inkscape::XML::Node *node, gchar * menuname);
54 
55 };
56 
57 }; /* namespace Filter */
58 }; /* namespace Internal */
59 }; /* namespace Extension */
60 }; /* namespace Inkscape */
61 
62 #endif // INKSCAPE_EXTENSION_INTERNAL_FILTER_FILTER_H
63