1 /*
2 * Copyright (C) 2007 Authors:
3 * Christopher Brown <audiere@gmail.com>
4 * Ted Gould <ted@gould.cx>
5 *
6 * Released under GNU GPL, read the file 'COPYING' for more information
7 */
9 #include "extension/effect.h"
10 #include "extension/system.h"
12 #include "shade.h"
14 namespace Inkscape {
15 namespace Extension {
16 namespace Internal {
17 namespace Bitmap {
19 void
20 Shade::applyEffect(Magick::Image* image) {
21 image->shade(_azimuth, _elevation, !_colorShading);
22 // I don't know why, but I have to invert colorShading here
23 }
25 void
26 Shade::refreshParameters(Inkscape::Extension::Effect* module) {
27 _azimuth = module->get_param_float("azimuth");
28 _elevation = module->get_param_float("elevation");
29 _colorShading = module->get_param_bool("colorShading");
30 }
32 #include "../clear-n_.h"
34 void
35 Shade::init(void)
36 {
37 Inkscape::Extension::build_from_mem(
38 "<inkscape-extension>\n"
39 "<name>" N_("Shade") "</name>\n"
40 "<id>org.inkscape.effect.bitmap.shade</id>\n"
41 "<param name=\"azimuth\" gui-text=\"" N_("Azimuth") "\" type=\"float\" min=\"-180\" max=\"180\">30</param>\n"
42 "<param name=\"elevation\" gui-text=\"" N_("Elevation") "\" type=\"float\" min=\"-180\" max=\"180\">30</param>\n"
43 "<param name=\"colorShading\" gui-text=\"" N_("Colored Shading") "\" type=\"boolean\">false</param>\n"
44 "<effect>\n"
45 "<object-type>all</object-type>\n"
46 "<effects-menu>\n"
47 "<submenu name=\"" N_("Raster") "\" />\n"
48 "</effects-menu>\n"
49 "<menu-tip>" N_("Shade selected bitmap(s) simulating distant light source.") "</menu-tip>\n"
50 "</effect>\n"
51 "</inkscape-extension>\n", new Shade());
52 }
54 }; /* namespace Bitmap */
55 }; /* namespace Internal */
56 }; /* namespace Extension */
57 }; /* namespace Inkscape */