Code

Added missing (and very important) file.
[inkscape.git] / src / extension / internal / bitmap / modulate.cpp
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 "modulate.h"
14 namespace Inkscape {
15 namespace Extension {
16 namespace Internal {
17 namespace Bitmap {
18         
19 void
20 Modulate::applyEffect(Magick::Image* image) {
21         float hue = (_hue * 200 / 360.0) + 100;
22         image->modulate(_brightness + 100, _saturation + 100, hue);
23 }
25 void
26 Modulate::refreshParameters(Inkscape::Extension::Effect* module) {
27         _brightness = module->get_param_float("brightness");
28         _saturation = module->get_param_float("saturation");
29         _hue = module->get_param_float("hue");
30 }
32 #include "../clear-n_.h"
34 void
35 Modulate::init(void)
36 {
37         Inkscape::Extension::build_from_mem(
38                 "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
39                         "<name>" N_("HSB Adjust") "</name>\n"
40                         "<id>org.inkscape.effect.bitmap.modulate</id>\n"                        
41                         "<param name=\"hue\" gui-text=\"" N_("Hue") "\" type=\"float\" min=\"-360\" max=\"360\">0</param>\n"
42                         "<param name=\"saturation\" gui-text=\"" N_("Saturation") "\" type=\"float\" min=\"-200\" max=\"200\">0</param>\n"
43                         "<param name=\"brightness\" gui-text=\"" N_("Brightness") "\" type=\"float\" min=\"-200\" max=\"200\">0</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_("Adjust the amount of hue, saturation, and brightness in selected bitmap(s)") "</menu-tip>\n"
50                         "</effect>\n"
51                 "</inkscape-extension>\n", new Modulate());
52 }
54 }; /* namespace Bitmap */
55 }; /* namespace Internal */
56 }; /* namespace Extension */
57 }; /* namespace Inkscape */