1 #ifndef __INKSCAPE_EXTENSION_INTERNAL_FILTER_DROP_SHADOW_H__
2 #define __INKSCAPE_EXTENSION_INTERNAL_FILTER_DROP_SHADOW_H__
3 /* Change the 'DROP_SHADOW' above to be your file name */
5 /*
6 * Copyright (C) 2008 Authors:
7 * Ted Gould <ted@gould.cx>
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
11 /* ^^^ Change the copyright to be you and your e-mail address ^^^ */
13 #include "filter.h"
15 #include "extension/internal/clear-n_.h"
16 #include "extension/system.h"
17 #include "extension/extension.h"
19 namespace Inkscape {
20 namespace Extension {
21 namespace Internal {
22 namespace Filter {
24 class DropShadow : public Inkscape::Extension::Internal::Filter::Filter {
25 int myvar;
26 protected:
27 virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext);
29 public:
30 DropShadow ( ) : Filter() { };
31 //virtual ~DropShadow ( ) { if (_filter != NULL) g_free(_filter); return; }
33 static void init (void) {
34 Inkscape::Extension::build_from_mem(
35 "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
36 "<name>" N_("Drop Shadow") "</name>\n"
37 "<id>org.inkscape.effect.filter.drop-shadow</id>\n"
38 "<param name=\"blur\" gui-text=\"" N_("Amount of Blur") "\" type=\"float\" min=\"0.0\" max=\"50.0\">2.0</param>\n"
39 "<param name=\"xoffset\" gui-text=\"" N_("Horizontal Offset") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">4.0</param>\n"
40 "<param name=\"yoffset\" gui-text=\"" N_("Vertical Offset") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">4.0</param>\n"
41 "<effect>\n"
42 "<object-type>all</object-type>\n"
43 "<effects-menu>\n"
44 "<submenu name=\"" N_("Filter") "\" />\n"
45 "</effects-menu>\n"
46 "<menu-tip>" N_("I hate text") "</menu-tip>\n"
47 "</effect>\n"
48 "</inkscape-extension>\n", new DropShadow());
49 };
51 };
53 gchar const *
54 DropShadow::get_filter_text (Inkscape::Extension::Extension * ext)
55 {
56 if (_filter != NULL) g_free((void *)_filter);
58 float blur = ext->get_param_float("blur");
59 float x = ext->get_param_float("xoffset");
60 float y = ext->get_param_float("yoffset");
62 _filter = g_strdup_printf(
63 "<filter>\n"
64 "<feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"%f\" result=\"blur\"/>\n"
65 "<feOffset in=\"blur\" dx=\"%f\" dy=\"%f\" result=\"offsetBlur\"/>\n"
66 "<feMerge>\n"
67 "<feMergeNode in=\"offsetBlur\"/>\n"
68 "<feMergeNode in=\"SourceGraphic\"/>\n"
69 "</feMerge>\n"
70 "</filter>\n", blur, x, y);
72 return _filter;
73 };
75 }; /* namespace Filter */
76 }; /* namespace Internal */
77 }; /* namespace Extension */
78 }; /* namespace Inkscape */
80 /* Change the 'DROP_SHADOW' below to be your file name */
81 #endif /* __INKSCAPE_EXTENSION_INTERNAL_FILTER_DROP_SHADOW_H__ */