Code

r16217@tres: ted | 2007-08-10 10:36:27 -0700
[inkscape.git] / src / extension / internal / bitmap / opacity.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 "opacity.h"
14 namespace Inkscape {
15 namespace Extension {
16 namespace Internal {
17 namespace Bitmap {
18         
19 void
20 Opacity::applyEffect(Magick::Image* image) {
21         Magick::Quantum opacity = Magick::Color::scaleDoubleToQuantum(_opacity / 100.0);
22         image->opacity(opacity);
23 }
25 void
26 Opacity::refreshParameters(Inkscape::Extension::Effect* module) {
27         _opacity = module->get_param_float("opacity");
28 }
30 #include "../clear-n_.h"
32 void
33 Opacity::init(void)
34 {
35         Inkscape::Extension::build_from_mem(
36                 "<inkscape-extension>\n"
37                         "<name>" N_("Opacity") "</name>\n"
38                         "<id>org.inkscape.effect.bitmap.opacity</id>\n"
39                         "<param name=\"opacity\" gui-text=\"" N_("Opacity") "\" type=\"float\" min=\"0.0\" max=\"100.0\">80.0</param>\n"
40                         "<effect>\n"
41                                 "<object-type>all</object-type>\n"
42                                 "<effects-menu>\n"
43                                         "<submenu name=\"" N_("Raster") "\" />\n"
44                                 "</effects-menu>\n"
45                                 "<menu-tip>" N_("Apply Opacity Effect") "</menu-tip>\n"
46                         "</effect>\n"
47                 "</inkscape-extension>\n", new Opacity());
48 }
50 }; /* namespace Bitmap */
51 }; /* namespace Internal */
52 }; /* namespace Extension */
53 }; /* namespace Inkscape */