1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /** @file
3  * @brief SVG composite filter effect
4  *//*
5  * Authors:
6  *   Hugo Rodrigues <haa.rodrigues@gmail.com>
7  *
8  * Copyright (C) 2006 Hugo Rodrigues
9  *
10  * Released under GNU GPL v2+, read the file 'COPYING' for more information.
11  */
12 #ifndef SP_FECOMPOSITE_H_SEEN
13 #define SP_FECOMPOSITE_H_SEEN
14 
15 #include "sp-filter-primitive.h"
16 
17 #define SP_FECOMPOSITE(obj) (dynamic_cast<SPFeComposite*>((SPObject*)obj))
18 #define SP_IS_FECOMPOSITE(obj) (dynamic_cast<const SPFeComposite*>((SPObject*)obj) != NULL)
19 
20 enum FeCompositeOperator {
21     // Default value is 'over', but let's distinquish specifying the
22     // default and implicitly using the default
23     COMPOSITE_DEFAULT,
24     COMPOSITE_OVER,              /* Source Over */
25     COMPOSITE_IN,                /* Source In   */
26     COMPOSITE_OUT,               /* Source Out  */
27     COMPOSITE_ATOP,              /* Source Atop */
28     COMPOSITE_XOR,
29     COMPOSITE_ARITHMETIC,        /* Not a fundamental PorterDuff operator, nor Cairo */
30 #ifdef WITH_CSSCOMPOSITE
31     // New in CSS
32     COMPOSITE_CLEAR,
33     COMPOSITE_COPY,              /* Source      */
34     COMPOSITE_DESTINATION,
35     COMPOSITE_DESTINATION_OVER,
36     COMPOSITE_DESTINATION_IN,
37     COMPOSITE_DESTINATION_OUT,
38     COMPOSITE_DESTINATION_ATOP,
39     COMPOSITE_LIGHTER,           /* Plus, Add (Not a fundamental PorterDuff operator  */
40 #endif
41     COMPOSITE_ENDOPERATOR        /* Cairo Saturate is not included in CSS */
42 };
43 
44 class SPFeComposite : public SPFilterPrimitive {
45 public:
46 	SPFeComposite();
47 	~SPFeComposite() override;
48 
49     FeCompositeOperator composite_operator;
50     double k1, k2, k3, k4;
51     int in2;
52 
53 protected:
54     void build(SPDocument* doc, Inkscape::XML::Node* repr) override;
55 	void release() override;
56 
57 	void set(SPAttr key, const gchar* value) override;
58 
59 	void update(SPCtx* ctx, unsigned int flags) override;
60 
61 	Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags) override;
62 
63 	void build_renderer(Inkscape::Filters::Filter* filter) override;
64 };
65 
66 #endif /* !SP_FECOMPOSITE_H_SEEN */
67 
68 /*
69   Local Variables:
70   mode:c++
71   c-file-style:"stroustrup"
72   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
73   indent-tabs-mode:nil
74   fill-column:99
75   End:
76 */
77 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
78