1
#ifndef __INKSCAPE_EXTENSION_INTERNAL_FILTER_SNOW_H__
2
#define __INKSCAPE_EXTENSION_INTERNAL_FILTER_SNOW_H__
3
/* Change the 'SNOW' above to be your file name */
6
* Copyright (C) 2008 Authors:
7
* Ted Gould <ted@gould.cx>
9
* Released under GNU GPL, read the file 'COPYING' for more information
11
/* ^^^ Change the copyright to be you and your e-mail address ^^^ */
20
class Snow : public Inkscape::Extension::Internal::Filter::Filter {
22
virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
25
Snow ( ) : Filter() { };
26
virtual ~Snow ( ) { if (_filter != NULL) g_free((void *)_filter); return; }
29
static void init (void) {
30
Inkscape::Extension::build_from_mem(
31
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
32
"<name>" N_("Snow crest") "</name>\n"
33
"<id>org.inkscape.effect.filter.snow</id>\n"
34
"<param name=\"drift\" gui-text=\"" N_("Drift Size") "\" type=\"float\" min=\"0.0\" max=\"20.0\">3.5</param>\n"
36
"<object-type>all</object-type>\n"
38
"<submenu name=\"" N_("Filters") "\">\n"
39
"<submenu name=\"Protrusions\"/>\n"
42
"<menu-tip>" N_("Snow has fallen on object") "</menu-tip>\n"
44
"</inkscape-extension>\n", new Snow());
50
Snow::get_filter_text (Inkscape::Extension::Extension * ext)
52
if (_filter != NULL) g_free((void *)_filter);
54
float drift = ext->get_param_float("drift");
56
_filter = g_strdup_printf(
57
"<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" inkscape:label=\"Snow\">\n"
58
"<feConvolveMatrix order=\"3 3\" kernelMatrix=\"1 1 1 0 0 0 -1 -1 -1\" preserveAlpha=\"false\" divisor=\"3\"/>\n"
59
"<feMorphology operator=\"dilate\" radius=\"1 %f\"/>\n"
60
"<feGaussianBlur stdDeviation=\"1.6270889487870621\" result=\"result0\"/>\n"
61
"<feColorMatrix values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0\" result=\"result1\"/>\n"
62
"<feOffset dx=\"0\" dy=\"1\" result=\"result5\"/>\n"
63
"<feDiffuseLighting in=\"result0\" diffuseConstant=\"2.2613065326633168\" surfaceScale=\"1\">\n"
64
"<feDistantLight azimuth=\"225\" elevation=\"32\"/>\n"
65
"</feDiffuseLighting>\n"
66
"<feComposite in2=\"result1\" operator=\"in\" result=\"result2\"/>\n"
67
"<feColorMatrix values=\"0.4 0 0 0 0.6 0 0.4 0 0 0.6 0 0 0 0 1 0 0 0 1 0\" result=\"result4\"/>\n"
68
"<feComposite in2=\"result5\" in=\"result4\"/>\n"
69
"<feComposite in2=\"SourceGraphic\"/>\n"
70
"</filter>\n", drift);
75
}; /* namespace Filter */
76
}; /* namespace Internal */
77
}; /* namespace Extension */
78
}; /* namespace Inkscape */
80
/* Change the 'SNOW' below to be your file name */
81
#endif /* __INKSCAPE_EXTENSION_INTERNAL_FILTER_SNOW_H__ */