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 "unsharpmask.h"
14 namespace Inkscape {
15 namespace Extension {
16 namespace Internal {
17 namespace Bitmap {
19 void
20 Unsharpmask::applyEffect(Magick::Image* image) {
21 float amount = _amount / 100.0;
22 image->unsharpmask(_radius, _sigma, amount, _threshold);
23 }
25 void
26 Unsharpmask::refreshParameters(Inkscape::Extension::Effect* module) {
27 _radius = module->get_param_float("radius");
28 _sigma = module->get_param_float("sigma");
29 _amount = module->get_param_float("amount");
30 _threshold = module->get_param_float("threshold");
31 }
33 #include "../clear-n_.h"
35 void
36 Unsharpmask::init(void)
37 {
38 Inkscape::Extension::build_from_mem(
39 "<inkscape-extension>\n"
40 "<name>" N_("Unsharp Mask") "</name>\n"
41 "<id>org.inkscape.effect.bitmap.unsharpmask</id>\n"
42 "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n"
43 "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n"
44 "<param name=\"amount\" gui-text=\"" N_("Amount") "\" type=\"float\" min=\"0.0\" max=\"100.0\">50.0</param>\n"
45 "<param name=\"threshold\" gui-text=\"" N_("Threshold") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n"
46 "<effect>\n"
47 "<object-type>all</object-type>\n"
48 "<effects-menu>\n"
49 "<submenu name=\"" N_("Raster") "\" />\n"
50 "</effects-menu>\n"
51 "<menu-tip>" N_("Sharpen selected bitmap(s) using unsharp mask algorithms.") "</menu-tip>\n"
52 "</effect>\n"
53 "</inkscape-extension>\n", new Unsharpmask());
54 }
56 }; /* namespace Bitmap */
57 }; /* namespace Internal */
58 }; /* namespace Extension */
59 }; /* namespace Inkscape */