Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-filter.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
/*
5 * Authors:
6 * Hugo Rodrigues <haa.rodrigues@gmail.com>
7 * Niko Kiirala <niko@kiirala.com>
8 *
9 * Copyright (C) 2006,2007 Authors
10 *
11 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
12 */
13#ifndef SP_FILTER_H_SEEN
14#define SP_FILTER_H_SEEN
15
16#include <memory>
17#include <glibmm/ustring.h>
18
19#include <sigc++/scoped_connection.h>
20#include "number-opt-number.h"
21#include "sp-dimensions.h"
22#include "sp-filter-units.h"
23#include "sp-item.h"
24#include "sp-object.h"
25
26namespace Inkscape {
27class Drawing;
28class DrawingItem;
29namespace Filters { class Filter; }
30} // namespace Inkscape
31
34
36 : public SPObject
37 , public SPDimensions
38{
39public:
40 SPFilter();
41 ~SPFilter() override;
42 int tag() const override { return tag_of<decltype(*this)>; }
43
45 std::unique_ptr<Inkscape::Filters::Filter> build_renderer(Inkscape::DrawingItem *item);
46
48 int primitive_count() const;
49
52 void set_filter_region(double x, double y, double width, double height);
54
56 bool valid_for(SPObject const *obj) const;
57
59 Glib::ustring get_new_result_name() const;
60
63
69 std::unique_ptr<SPFilterReference> href;
71
72 sigc::scoped_connection modified_connection;
73
74 unsigned getRefCount();
75 unsigned _refcount = 0;
76
77 void invalidate_slots();
78 void ensure_slots();
79
80protected:
81 void build(SPDocument *doc, Inkscape::XML::Node *repr) override;
82 void release() override;
83 void set(SPAttr key, char const *value) override;
84 void update(SPCtx *ctx, unsigned flags) override;
85 void modified(unsigned flags) override;
87
91
92private:
93 bool slots_valid = true;
94
95 std::vector<Inkscape::DrawingItem*> views;
96};
97
98#endif // SP_FILTER_H_SEEN
99
100/*
101 Local Variables:
102 mode:c++
103 c-file-style:"stroustrup"
104 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
105 indent-tabs-mode:nil
106 fill-column:99
107 End:
108*/
109// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
SPAttr
Definition attributes.h:27
constexpr int tag_of
Convenience function to retrieve the tag (class id) of a given type.
Definition cast.h:26
Axis aligned, non-empty rectangle.
Definition rect.h:92
SVG drawing item for display.
Interface for refcounted XML nodes.
Definition node.h:80
SVGLength y
SVGLength height
SVGLength width
SVGLength x
Typed SVG document implementation.
Definition document.h:101
Glib::ustring get_new_result_name() const
Returns a result image name that is not in use inside this filter.
void hide(Inkscape::DrawingItem *item)
void order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_repr, Inkscape::XML::Node *new_repr) override
unsigned getRefCount()
Returns the number of references to the filter.
Geom::Rect get_automatic_filter_region(SPItem const *item) const
Generate a filter region based on the item and return it.
void modified(unsigned flags) override
void update_filter_region(SPItem *item)
Update the filter region based on the object's bounding box.
int primitive_count() const
Returns the number of filter primitives in this SPFilter object.
void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) override
bool primitiveUnits_set
Definition sp-filter.h:67
void release() override
Definition sp-filter.cpp:90
unsigned _refcount
Definition sp-filter.h:75
std::vector< Inkscape::DrawingItem * > views
Definition sp-filter.h:95
Inkscape::XML::Node * write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned flags) override
void set_filter_region(double x, double y, double width, double height)
Set the filter region attributes from a bounding box.
~SPFilter() override
void remove_child(Inkscape::XML::Node *child) override
std::unique_ptr< SPFilterReference > href
Definition sp-filter.h:69
void update_filter_all_regions()
Update the filter's region based on its detectable href links.
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
Definition sp-filter.cpp:70
bool valid_for(SPObject const *obj) const
Checks each filter primitive to make sure the object won't cause issues.
void update(SPCtx *ctx, unsigned flags) override
bool filterUnits_set
Definition sp-filter.h:65
void show(Inkscape::DrawingItem *item)
bool auto_region
Definition sp-filter.h:70
NumberOptNumber filterRes
Definition sp-filter.h:68
SPFilterUnits primitiveUnits
Definition sp-filter.h:66
sigc::scoped_connection modified_connection
Definition sp-filter.h:72
bool slots_valid
Definition sp-filter.h:93
void ensure_slots()
int tag() const override
Definition sp-filter.h:42
SPFilterUnits filterUnits
Definition sp-filter.h:64
void invalidate_slots()
std::unique_ptr< Inkscape::Filters::Filter > build_renderer(Inkscape::DrawingItem *item)
Returns a renderer for this filter, for use by the DrawingItem item.
Base class for visual SVG elements.
Definition sp-item.h:109
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
Inkscape::XML::Node * repr
Definition sp-object.h:193
SPItem * item
Helper class to stream background task notifications as a series of messages.
static cairo_user_data_key_t key
<number-opt-number> implementation.
Ocnode * child[8]
Definition quantize.cpp:33
Ocnode ** ref
Definition quantize.cpp:32
TODO: insert short description here.
SPFilterUnits
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.
Interface for XML documents.
Definition document.h:43
Unused.
Definition sp-object.h:94