Code

r16564@tres: ted | 2007-09-12 20:45:12 -0700
authorgouldtj <gouldtj@users.sourceforge.net>
Thu, 13 Sep 2007 04:31:40 +0000 (04:31 +0000)
committergouldtj <gouldtj@users.sourceforge.net>
Thu, 13 Sep 2007 04:31:40 +0000 (04:31 +0000)
 Final GSoC patch from Chris.  I took too long to include it :(

54 files changed:
src/extension/execution-env.cpp
src/extension/extension.cpp
src/extension/extension.h
src/extension/implementation/implementation.cpp
src/extension/implementation/implementation.h
src/extension/init.cpp
src/extension/internal/bitmap/adaptiveThreshold.cpp
src/extension/internal/bitmap/adaptiveThreshold.h
src/extension/internal/bitmap/addNoise.cpp
src/extension/internal/bitmap/blur.cpp
src/extension/internal/bitmap/channel.cpp
src/extension/internal/bitmap/charcoal.cpp
src/extension/internal/bitmap/colorize.cpp
src/extension/internal/bitmap/colorize.h
src/extension/internal/bitmap/contrast.cpp
src/extension/internal/bitmap/contrast.h
src/extension/internal/bitmap/convolve.cpp
src/extension/internal/bitmap/cycleColormap.cpp
src/extension/internal/bitmap/despeckle.cpp
src/extension/internal/bitmap/edge.cpp
src/extension/internal/bitmap/edge.h
src/extension/internal/bitmap/emboss.cpp
src/extension/internal/bitmap/enhance.cpp
src/extension/internal/bitmap/equalize.cpp
src/extension/internal/bitmap/flop.cpp
src/extension/internal/bitmap/gaussianBlur.cpp
src/extension/internal/bitmap/imagemagick.cpp
src/extension/internal/bitmap/imagemagick.h
src/extension/internal/bitmap/implode.cpp
src/extension/internal/bitmap/level.cpp
src/extension/internal/bitmap/levelChannel.cpp
src/extension/internal/bitmap/medianFilter.cpp
src/extension/internal/bitmap/modulate.cpp
src/extension/internal/bitmap/negate.cpp
src/extension/internal/bitmap/normalize.cpp
src/extension/internal/bitmap/oilPaint.cpp
src/extension/internal/bitmap/opacity.cpp
src/extension/internal/bitmap/raise.cpp
src/extension/internal/bitmap/raise.h
src/extension/internal/bitmap/reduceNoise.cpp
src/extension/internal/bitmap/shade.cpp
src/extension/internal/bitmap/sharpen.cpp
src/extension/internal/bitmap/solarize.cpp
src/extension/internal/bitmap/spread.cpp
src/extension/internal/bitmap/swirl.cpp
src/extension/internal/bitmap/swirl.h
src/extension/internal/bitmap/threshold.cpp
src/extension/internal/bitmap/unsharpmask.cpp
src/extension/internal/bitmap/wave.cpp
src/extension/internal/bitmap/wave.h
src/extension/paramcolor.cpp
src/extension/paramcolor.h
src/extension/parameter.cpp
src/extension/parameter.h

index 3e7bb7e273b3efb2b1c875d8f87862e0610eb728..12cccbf908539e837de29903e3788555451e79d5 100644 (file)
@@ -215,6 +215,7 @@ void
 ExecutionEnv::documentCommit (void) {
     sp_document_done(_doc->doc(), SP_VERB_NONE, _(_effect->get_name()));
     Effect::set_last_effect(_effect);
+    _effect->get_imp()->commitDocument();
     return;
 }
 
index b56a1d6f203d4ec8aab85ed25b0ca1f93479176f..825a935adc93d0babac69cf0c9210fc498d0391a 100644 (file)
@@ -505,7 +505,7 @@ Extension::get_param_float (const gchar * name, const SPDocument * doc, const In
     Look up in the parameters list, then execute the function on that
     found parameter.
 */
-SPColor*
+guint32
 Extension::get_param_color (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node)
 {
     Parameter* param = param_shared(name, parameters);
@@ -604,8 +604,8 @@ Extension::set_param_string (const gchar * name, const gchar * value, SPDocument
     Look up in the parameters list, then execute the function on that
     found parameter.
 */
-SPColor*
-Extension::set_param_color (const gchar * name, SPColor* color, SPDocument * doc, Inkscape::XML::Node * node)
+guint32
+Extension::set_param_color (const gchar * name, guint32 color, SPDocument * doc, Inkscape::XML::Node * node)
 {
     Parameter* param = param_shared(name, parameters);
     return param->set_color(color, doc, node);
index b1171548b0bb387a7611281c3acf158941282b29..aef41a548c765c2f6d1293ecbafd557e1e3dd4c5 100644 (file)
@@ -165,10 +165,10 @@ public:
     const gchar *    get_param_string (const gchar * name,
                                        const SPDocument *   doc = NULL,
                                        const Inkscape::XML::Node * node = NULL);
-    SPColor*        get_param_color   (const gchar * name,
+    guint32          get_param_color  (const gchar * name,
                                        const SPDocument *   doc = NULL,
                                        const Inkscape::XML::Node * node = NULL);
-    const gchar *   get_param_enum    (const gchar * name,
+    const gchar *    get_param_enum   (const gchar * name,
                                        const SPDocument *   doc = NULL,
                                        const Inkscape::XML::Node * node = NULL);
     bool             set_param_bool   (const gchar * name,
@@ -187,8 +187,8 @@ public:
                                        const gchar * value,
                                        SPDocument *   doc = NULL,
                                        Inkscape::XML::Node *       node = NULL);
-    SPColor*         set_param_color  (const gchar * name,
-                                       SPColor* color,
+    guint32          set_param_color  (const gchar * name,
+                                       guint32 color,
                                        SPDocument *   doc = NULL,
                                        Inkscape::XML::Node *       node = NULL);
 
index 6a9a7955f2a7a75a9565560d1d8e2c8820bd66b9..70423472b2d1d773375e2ebb4807aca83cacd23d 100644 (file)
@@ -49,6 +49,11 @@ Implementation::cancelProcessing (void) {
     return true;
 }
 
+void
+Implementation::commitDocument (void) {
+    return;
+}
+
 Gtk::Widget *
 Implementation::prefs_input(Inkscape::Extension::Input *module, gchar const *filename) {
     return module->autogui(NULL, NULL);
index a132996f739faa2b4500f18aa8725efe970ee768..e69686775dd0e6946508b8605ee19c7a5dacb859 100644 (file)
@@ -47,6 +47,7 @@ public:
     virtual bool check(Inkscape::Extension::Extension *module);
 
     virtual bool cancelProcessing (void);
+       virtual void commitDocument (void);
 
     /* ----- Input functions ----- */
     /** Find out information about the file. */
index fca5a7e5d2481b3cc7b08dc09db5114917f08d8e..284c45e6b257f10bee5c8a75d21053be69d6d3bd 100644 (file)
@@ -70,7 +70,7 @@
 #include "internal/bitmap/charcoal.h"
 #include "internal/bitmap/colorize.h"
 #include "internal/bitmap/contrast.h"
-#include "internal/bitmap/convolve.h"
+//#include "internal/bitmap/convolve.h"
 #include "internal/bitmap/cycleColormap.h"
 #include "internal/bitmap/despeckle.h"
 #include "internal/bitmap/edge.h"
@@ -95,7 +95,7 @@
 #include "internal/bitmap/solarize.h"
 #include "internal/bitmap/spread.h"
 #include "internal/bitmap/swirl.h"
-#include "internal/bitmap/threshold.h"
+//#include "internal/bitmap/threshold.h"
 #include "internal/bitmap/unsharpmask.h"
 #include "internal/bitmap/wave.h"
 #endif /* WITH_IMAGE_MAGICK */
@@ -204,7 +204,7 @@ init()
     Internal::Bitmap::Charcoal::init();
     Internal::Bitmap::Colorize::init();
     Internal::Bitmap::Contrast::init();
-    Internal::Bitmap::Convolve::init();
+    //Internal::Bitmap::Convolve::init();
     Internal::Bitmap::CycleColormap::init();
     Internal::Bitmap::Edge::init();
     Internal::Bitmap::Despeckle::init();
@@ -229,7 +229,7 @@ init()
     Internal::Bitmap::Solarize::init();
     Internal::Bitmap::Spread::init();
     Internal::Bitmap::Swirl::init();
-    Internal::Bitmap::Threshold::init();
+    //Internal::Bitmap::Threshold::init();
     Internal::Bitmap::Unsharpmask::init();
     Internal::Bitmap::Wave::init();
 #endif /* WITH_IMAGE_MAGICK */
index 5a2db5dc0de66118521803cb7547e9ca6fec2049..df1c3ea8208db7f040fa16a496574eb214ecc487 100644 (file)
@@ -25,6 +25,7 @@ void
 AdaptiveThreshold::refreshParameters(Inkscape::Extension::Effect *module) {    
        _width = module->get_param_int("width");
        _height = module->get_param_int("height");
+       _offset = module->get_param_int("offset");
 }
 
 #include "../clear-n_.h"
@@ -36,14 +37,15 @@ AdaptiveThreshold::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Adaptive Threshold") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.adaptiveThreshold</id>\n"
-                       "<param name=\"width\" gui-text=\"" N_("Width") "\" type=\"int\" min=\"0\" max=\"100\">5</param>\n"
-                       "<param name=\"height\" gui-text=\"" N_("Height") "\" type=\"int\" min=\"0\" max=\"100\">1</param>\n"
+                       "<param name=\"width\" gui-text=\"" N_("Width") "\" type=\"int\" min=\"-100\" max=\"100\">5</param>\n"
+                       "<param name=\"height\" gui-text=\"" N_("Height") "\" type=\"int\" min=\"-100\" max=\"100\">5</param>\n"
+                       "<param name=\"offset\" gui-text=\"" N_("Offset") "\" type=\"int\" min=\"0\" max=\"100\">0</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Adaptive Threshold Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Apply adaptive thresholding to selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new AdaptiveThreshold());
 }
index e7b5e753fabc4326ba3713c233ddfc800249b545..75501720b68c20ff08b33fac246f985e5807bafe 100644 (file)
@@ -16,8 +16,9 @@ namespace Bitmap {
 class AdaptiveThreshold : public ImageMagick
 {
 private:
-       int _width;
-       int _height;
+       unsigned int _width;
+       unsigned int _height;
+       unsigned _offset;
 public:
     void applyEffect(Magick::Image *image);
        void refreshParameters(Inkscape::Extension::Effect *module);
index 11e3835cf34f89b4ecb6d5e881e3396de87d4c23..c846f549a5f950a61bdbdc215ebd6e673b4902d9 100644 (file)
@@ -56,7 +56,7 @@ AddNoise::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Add Noise Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Add random noise to selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new AddNoise());
 }
index ad2b5a83767f96b6b34e7d8507337be95aa48cc9..9349f471096fd73b888bb794d8b231afa3517794 100644 (file)
@@ -36,14 +36,14 @@ Blur::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Blur") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.blur</id>\n"
-                       "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0.1\" max=\"20\">5.0</param>\n"
-                       "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0.1\" max=\"5\">1.0</param>\n"
+                       "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0\" max=\"100\">1</param>\n"
+                       "<param name=\"sigma\"  gui-text=\"" N_("Sigma") "\"  type=\"float\" min=\"0\" max=\"100\">0.5</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Blur Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Blur selected bitmap(s)") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Blur());
 }
index 708638371bccdf30312d3e35263916cb89de40eb..a0da25ee9684327895529f19c0783f1d5089bdcc 100644 (file)
@@ -62,7 +62,7 @@ Channel::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Channel Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Extract specific channel from image.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Channel());
 }
index 6f3244b8d3163059c65175bfb0e5ec8a6e8a8c42..442a5d480457eb09550a9aadb1008a2d8abf71dd 100644 (file)
@@ -36,14 +36,14 @@ Charcoal::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Charcoal") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.charcoal</id>\n"
-                       "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0.1\" max=\"20\">5.0</param>\n"
-                       "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0.1\" max=\"5\">1.0</param>\n"
+                       "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0\" max=\"100\">1</param>\n"
+                       "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0\" max=\"100\">0.5</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Charcoal Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Apply charcoal stylization to selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Charcoal());
 }
index cf8ff5dd3573d030f7b675b2e587a1ac4796e6ca..beb6d823b3603ea4d9f04aeb9a8050701612fca4 100644 (file)
@@ -24,29 +24,19 @@ namespace Bitmap {
        
 void
 Colorize::applyEffect(Magick::Image *image) {
-       float rgb[3];
-    sp_color_get_rgb_floatv(_color, rgb);
-    int red = (int)(rgb[0] * 255);     
-    int green = (int)(rgb[1] * 255);
-    int blue = (int)(rgb[2] * 255);
+       float r = ((_color >> 24) & 0xff) / 255.0F;
+       float g = ((_color >> 16) & 0xff) / 255.0F;
+       float b = ((_color >>  8) & 0xff) / 255.0F;
+       float a = ((_color      ) & 0xff) / 255.0F;
        
-           
-       printf("(2fk) applying colorize\n");    
-       printf("(2fl) rgb: %i,%i,%i\n", red, green, blue);
-       printf("(2fm) opacity: %i\n", _opacity);
+    Magick::ColorRGB mc(r,g,b);
        
-    Magick::ColorRGB mc(red, green, blue);
-       
-       image->colorize(_opacity, mc);
+       image->colorize(a * 100, mc);
 }
 
 void
 Colorize::refreshParameters(Inkscape::Extension::Effect *module) {     
-       _opacity = module->get_param_int("opacity");
        _color = module->get_param_color("color");
-       
-       printf("(2ga) refreshing colorize\n");
-       printf("(2gb) _color: %f,%f,%f,%f\n", _color->v.c[0], _color->v.c[1], _color->v.c[2], _color->v.c[3]);
 }
 
 #include "../clear-n_.h"
@@ -58,14 +48,13 @@ Colorize::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Colorize") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.colorize</id>\n"
-                       "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\" >#FF0000</param>\n"
-                       "<param name=\"opacity\" gui-text=\"" N_("Opacity") "\" type=\"int\" min=\"0\" max=\"100\">1</param>\n"
+                       "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">0</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Colorize Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Colorize selected bitmap(s) with specified color, using given opacity.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Colorize());
 }
index e82ef88a47997ff45fe899078edadc85ba1f90f5..5b55a1814f64a5fd014e410d31c9c15c9a31df5d 100644 (file)
@@ -17,8 +17,8 @@ namespace Bitmap {
 
 class Colorize : public ImageMagick {
 private:
-       SPColor* _color;
-       int _opacity;
+       unsigned int _opacity;
+       guint32 _color; 
 
 public:
     void applyEffect(Magick::Image *image);
index 1728c325f2f8aa285910278f20a7517f21184440..f4803dda46fbd45f22aad84d821c9da2d96275b7 100644 (file)
@@ -18,13 +18,12 @@ namespace Bitmap {
        
 void
 Contrast::applyEffect(Magick::Image *image) {
-       printf("(o0x) Sharpening at: %i\n", _sharpen);
        image->contrast(_sharpen);
 }
 
 void
 Contrast::refreshParameters(Inkscape::Extension::Effect *module) {     
-       _sharpen = module->get_param_bool("sharpen");
+       _sharpen = module->get_param_int("sharpen");
 }
 
 #include "../clear-n_.h"
@@ -36,13 +35,13 @@ Contrast::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Contrast") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.contrast</id>\n"
-                       "<param name=\"sharpen\" gui-text=\"" N_("Sharpen") "\" type=\"boolean\" >1</param>\n"
+                       "<param name=\"sharpen\" gui-text=\"" N_("Sharpen") "\" type=\"int\" min=\"0\" max=\"100\">1</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Contrast Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Enhance intensity differences in selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Contrast());
 }
index acb5982a353a7c6ea770e6f8fabae16958395526..53a6366477c0f291ab432fe2c33965aadd363d15 100644 (file)
@@ -16,7 +16,7 @@ namespace Bitmap {
 class Contrast : public ImageMagick
 {
 private:
-       bool _sharpen;
+       unsigned int _sharpen;
 public:
     void applyEffect(Magick::Image *image);
        void refreshParameters(Inkscape::Extension::Effect *module);
index 3c04bfebe5a48094c490a7e71dbbd9528b62be38..65b22bf6170042a1e4093cea6614be2a848f0a65 100644 (file)
@@ -24,7 +24,19 @@ Convolve::applyEffect(Magick::Image *image) {
 void
 Convolve::refreshParameters(Inkscape::Extension::Effect *module) {
        _order = module->get_param_int("order");
-       *_kernel = 0;
+       if (_order % 2 == 0) _order--;
+       _kernel = new double[_order];
+       int i = 0;
+       
+       char *arrayStr = g_strdup(module->get_param_string("kernel"));
+       
+       char *num = strtok(arrayStr, ",");
+       while (num != NULL)
+       {
+               _kernel[i++] = atof(num);
+               
+               num = strtok(NULL, ",");
+       }
 }
 
 #include "../clear-n_.h"
@@ -37,8 +49,8 @@ Convolve::init(void)
 // TRANSLATORS: see http://docs.gimp.org/en/gimp-tool-convolve.html
                        "<name>" N_("Convolve") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.convolve</id>\n"
-                       "<param name=\"order\" gui-text=\"" N_("Order") "\" type=\"int\" >1</param>\n"
-                       "<param name=\"kernel\" gui-text=\"" N_("Kernel") "\" type=\"string\" >1,1,1,0,0,0</param>\n"
+                       "<param name=\"order\" gui-text=\"" N_("Order") "\" type=\"int\" min=\"0\" max=\"64\">4</param>\n"
+                       "<param name=\"kernel\" gui-text=\"" N_("Kernal Array") "\" type=\"string\" >1,1,0,0</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
index 309837abe7eca98cd30a601e25c365ede2c39edd..7282fa52e06c13c7ebba1a3df4da39cd9339a9c9 100644 (file)
@@ -35,13 +35,13 @@ CycleColormap::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Cycle Colormap") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.cycleColormap</id>\n"
-                       "<param name=\"amount\" gui-text=\"" N_("Amount") "\" type=\"int\" min=\"0\" max=\"255\">1</param>\n"
+                       "<param name=\"amount\" gui-text=\"" N_("Amount") "\" type=\"int\" min=\"0\" max=\"360\">180</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Cycle Colormap Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Cycle colormap(s) of selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new CycleColormap());
 }
index 75a1ca35a3f83614758e138408cd44577cb94097..2a81d1b3d6f0b49b697e225f9035b4337f111c5d 100644 (file)
@@ -23,7 +23,6 @@ Despeckle::applyEffect(Magick::Image *image) {
 
 void
 Despeckle::refreshParameters(Inkscape::Extension::Effect *module) {    
-       
 }
 
 #include "../clear-n_.h"
@@ -40,7 +39,7 @@ Despeckle::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Despeckle Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Reduce speckle noise of selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Despeckle());
 }
index f9b14b2467520f845df1c4f836c2ee30f18c12fb..4bde1a779262cd131394d214632ddf87a647ccfa 100644 (file)
@@ -35,13 +35,13 @@ Edge::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Edge") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.edge</id>\n"
-                       "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"int\" min=\"0\" max=\"100\">5</param>\n"
+                       "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"int\" min=\"0\" max=\"100\">0</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Edge Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Hilight edges of selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Edge());
 }
index 4585648f23d3a2cdbc134cfba6393a724864234a..40277a89e1a44ee86c965049040fec313cef7b9d 100644 (file)
@@ -15,7 +15,7 @@ namespace Bitmap {
 
 class Edge : public ImageMagick {
 private:
-       int _radius;
+       unsigned int _radius;
 public:
     void applyEffect(Magick::Image *image);
        void refreshParameters(Inkscape::Extension::Effect *module);
index 8d7f7245989a36b066e936000368b585ad805292..cf47bee9e8d0d48ab13056c9c425f40e982f7af3 100644 (file)
@@ -36,14 +36,14 @@ Emboss::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Emboss") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.emboss</id>\n"
-                       "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0.1\" max=\"50\">5.0</param>\n"
-                       "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0.1\" max=\"10\">1.0</param>\n"
+                       "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0\" max=\"100\">1.0</param>\n"
+                       "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"-50\" max=\"50\">0.5</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Emboss Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Emboss selected bitmap(s) -- hilight edges with 3D effect.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Emboss());
 }
index dae90776b6f0d023b8bca657dfa37029e5ff8ee6..99ac4a171d2dc749083176250b9e6c67891b15db 100644 (file)
@@ -22,9 +22,7 @@ Enhance::applyEffect(Magick::Image *image) {
 }
 
 void
-Enhance::refreshParameters(Inkscape::Extension::Effect *module) {      
-       
-}
+Enhance::refreshParameters(Inkscape::Extension::Effect *module) { }
 
 #include "../clear-n_.h"
 
@@ -40,7 +38,7 @@ Enhance::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Enhance Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Enhance selected bitmap(s) -- minimize noise.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Enhance());
 }
index 1b0911ac39f0358ed1bb804c27106df308af716b..9caf342b0650b6c01a5c303f4427805ac885d549 100644 (file)
@@ -22,9 +22,7 @@ Equalize::applyEffect(Magick::Image *image) {
 }
 
 void
-Equalize::refreshParameters(Inkscape::Extension::Effect *module) {     
-       
-}
+Equalize::refreshParameters(Inkscape::Extension::Effect *module) { }
 
 #include "../clear-n_.h"
 
@@ -40,7 +38,7 @@ Equalize::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Equalize Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Equalize selected bitmap(s) -- histogram equalization.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Equalize());
 }
index 437c8afbd2a4ad7e2774e9d282979539e4508fb1..ef5d41d4917fa2597f84cb54f63c80e0f1934ce8 100644 (file)
@@ -22,9 +22,7 @@ Flop::applyEffect(Magick::Image *image) {
 }
 
 void
-Flop::refreshParameters(Inkscape::Extension::Effect *module) { 
-       
-}
+Flop::refreshParameters(Inkscape::Extension::Effect *module) { }
 
 #include "../clear-n_.h"
 
@@ -40,7 +38,7 @@ Flop::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Flop Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Flop selected bitmap(s) -- reflect each scanline in the horizontal direction.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Flop());
 }
index 36087c5256956dd7a759cee5e9f0df3da327ea66..97a2482cbd21f56ebcca68450acc74a9909e8c86 100644 (file)
@@ -36,14 +36,14 @@ GaussianBlur::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Gaussian Blur") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.gaussianBlur</id>\n"
-                       "<param name=\"width\" gui-text=\"" N_("Factor") "\" type=\"float\" min=\"0\" max=\"50\">5.0</param>\n"
-                       "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0\" max=\"50\">5.0</param>\n"
+                       "<param name=\"width\" gui-text=\"" N_("Factor") "\" type=\"float\" min=\"0\" max=\"100\">5.0</param>\n"
+                       "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0\" max=\"100\">5.0</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Gaussian Blur Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Gaussian blur selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new GaussianBlur());
 }
index db67294ea040746a2b8d719b9b465fa932fc9082..a6c30a587b6c1666d34d91fd64d340c348bbc76c 100644 (file)
@@ -8,9 +8,12 @@
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
 
+#include <libintl.h>
+
 #include <gtkmm/box.h>
 #include <gtkmm/adjustment.h>
 #include <gtkmm/spinbutton.h>
+#include <gtkmm.h>
 
 #include <glib/gstdio.h>
 
@@ -34,6 +37,7 @@ bool
 ImageMagick::load(Inkscape::Extension::Extension *module)
 {
        _loaded = FALSE;
+       
        return TRUE;
 }
 
@@ -42,19 +46,22 @@ ImageMagick::commitDocument(void) {
        _loaded = FALSE;
 }
 
-void
+/*void
 ImageMagick::cancelDocument(void) {    
        for (int i = 0; i < _imageCount; i++) {
                _nodes[i]->setAttribute("xlink:href", _originals[i], true);
+               
+               if (strlen(_originals[i]) < 256)
+                       _nodes[i]->setAttribute("sodipodi:absref", _originals[i], true);
        }
        
        _loaded = FALSE;
-}
+}*/
 
 void
 ImageMagick::readImage(const char *xlink, Magick::Image *image)
 {
-       // Find if the xlink:href is base64 data, i.e. if the image is embedded
+       // Find if the xlink:href is base64 data, i.e. if the image is embedded 
        char *search = (char *) g_strndup(xlink, 30);
        if (strstr(search, "base64") != (char*)NULL) {
                // 7 = strlen("base64") + strlen(",")
@@ -74,17 +81,19 @@ ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::Vi
        refreshParameters(module);
        
        if (!_loaded)
-       {               
+       {
                SPDesktop *desktop = (SPDesktop*)document;
                const GSList *selectedReprList = desktop->selection->reprList();
                int selectCount = g_slist_length((GSList *)selectedReprList);
-               
+
                // Init the data-holders
                _nodes = new Inkscape::XML::Node*[selectCount];
                _originals = new const char*[selectCount];
-               _images = new Magick::Image[selectCount];
+               _caches = new char*[selectCount];
+               _cacheLengths = new unsigned[selectCount];
+               _images = new Magick::Image*[selectCount];
                _imageCount = 0;
-               
+
                // Loop through selected nodes
                for (; selectedReprList != NULL; selectedReprList = g_slist_next(selectedReprList))
                {
@@ -93,79 +102,71 @@ ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::Vi
                        {
                                _nodes[_imageCount] = node;     
                                char const *xlink = node->attribute("xlink:href");
-                               
+
                                _originals[_imageCount] = xlink;
-                               
-                               readImage(xlink, &_images[_imageCount]);
-                               
+                               _caches[_imageCount] = "";
+                               _cacheLengths[_imageCount] = 0;
+                               _images[_imageCount] = new Magick::Image();
+                               readImage(xlink, _images[_imageCount]);                 
+
                                _imageCount++;
                        }                       
                }
-               
+
                _loaded = 1;
        }
-       
+
        for (int i = 0; i < _imageCount; i++)
        {
                try
                {
-                       Magick::Image effectedImage = _images[i];
+                       Magick::Image effectedImage = *_images[i]; // make a copy
                        applyEffect(&effectedImage);
 
-                       Magick::Blob blob;
-                       effectedImage.write(&blob);
-                               
-                               std::string raw_string = blob.base64();
-                               const char *raw = raw_string.c_str();
-
-                               /*
-                               const int raw_len = raw_string.length();
-                               const char *raw_i = raw;
-                int formatted_len = (int)(raw_len / 76.0 * 78.0) + 100;
-                               char *formatted = new char[formatted_len];
-                               char *formatted_i = formatted;
-                               // data:image/png;base64,
-                               formatted_i = stpcpy(formatted_i, "data:image/");
-                               formatted_i = stpcpy(formatted_i, effectedImage.magick().c_str());
-                               formatted_i = stpcpy(formatted_i, ";base64, \n");
-                               while (strnlen(raw_i, 80) > 76)
-                               {
-                                       formatted_i = stpncpy(formatted_i, raw_i, 76);
-                                       formatted_i = stpcpy(formatted_i, "\n");                                        
-                                       raw_i += 76;            
-                               }
-                               if (strlen(raw_i) > 0)
-                               {
-                                       formatted_i = stpcpy(formatted_i, raw_i);
-                                       formatted_i = stpcpy(formatted_i, "\n");
-                               }
-                               
-                               formatted_i = stpcpy(formatted_i, "\0");
-
-                               _nodes[i]->setAttribute("xlink:href", formatted, true);
-                               */
-                               
-                               Glib::ustring buf = "data:image/";
-                               buf.append(effectedImage.magick());
-                               buf.append(";base64, \n");
-                               int col = 0;
-                               while (*raw)
-                    {
-                    buf.push_back(*raw++);
-                    if (col>=76)
-                        {
-                        buf.push_back('\n');
-                        col = 0;
-                        }
-                    }
-                if (col)
-                    buf.push_back('\n');
-
-                               _nodes[i]->setAttribute("xlink:href", buf.c_str(), true);
+                       Magick::Blob *blob = new Magick::Blob();
+                       effectedImage.write(blob);
+
+                       std::string raw_string = blob->base64();
+                       const int raw_len = raw_string.length();
+                       const char *raw_i = raw_string.c_str();
+
+                       unsigned new_len = (int)(raw_len * (77.0 / 76.0) + 100);
+                       if (new_len > _cacheLengths[i]) {
+                               _cacheLengths[i] = (int)(new_len * 1.2);
+                               _caches[i] = new char[_cacheLengths[i]];
+                       }
+                       char *formatted_i = _caches[i];
+                       const char *src;
+
+                       for (src = "data:image/"; *src; )
+                               *formatted_i++ = *src++;
+                       for (src = effectedImage.magick().c_str(); *src ; )
+                               *formatted_i++ = *src++;
+                       for (src = ";base64, \n" ; *src; )
+                               *formatted_i++ = *src++;
+
+                       int col = 0;
+                       while (*raw_i) {
+                          *formatted_i++ = *raw_i++;
+                          if (col++ > 76) {
+                                  *formatted_i++ = '\n';
+                                  col = 0;
+                          }
+                       }                       
+                       if (col) {
+                          *formatted_i++ = '\n';
+                       }
+                       *formatted_i = '\0';
+
+                       _nodes[i]->setAttribute("xlink:href", _caches[i], true);                        
+                       _nodes[i]->setAttribute("sodipodi:absref", NULL, true);
                }
                catch (Magick::Exception &error_) {
                        printf("Caught exception: %s \n", error_.what());
                }
+
+               while(Gtk::Main::events_pending())
+                       Gtk::Main::iteration();
        }
 }
 
index 36536bb690f0523475177f8a6fb3cbeb8b5a54c9..4afdcfbb497dd7597504bf368c6283f80b63a15e 100644 (file)
@@ -23,19 +23,21 @@ class ImageMagick : public Inkscape::Extension::Implementation::Implementation {
 private:
        bool _loaded;
 
-       Inkscape::XML::Node **_nodes;   
+       Inkscape::XML::Node** _nodes;   
        
-       Magick::Image *_images;
+       Magick::Image** _images;
        int _imageCount;
+       char** _caches;
+       unsigned* _cacheLengths;
        
-       const char **_originals;
+       const char** _originals;
 public:
        virtual void applyEffect(Magick::Image *image) { };
        virtual void refreshParameters(Inkscape::Extension::Effect *module) { };
        bool load(Inkscape::Extension::Extension *module);
     
        void commitDocument(void);
-       void cancelDocument(void);
+       /*void cancelDocument(void);*/
 
        void readImage(char const *xlink, Magick::Image *image);
        void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document);
index 74dc81e4e1fc7f071220a49335a1e1944d42007f..e8fd2201ce58cf7055b2cefa8811571c4051c249 100644 (file)
@@ -35,13 +35,13 @@ Implode::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Implode") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.implode</id>\n"
-                       "<param name=\"factor\" gui-text=\"" N_("Factor") "\" type=\"float\" min=\"0.1\" max=\"50\">5.0</param>\n"
+                       "<param name=\"factor\" gui-text=\"" N_("Factor") "\" type=\"float\" min=\"0\" max=\"100\">10</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Implode Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Implode selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Implode());
 }
index f48be32a295e0aa06435cc40ae11ba753e35b763..04f78d7e56a56b3cb3176ee598d93cc383472200 100644 (file)
@@ -39,15 +39,15 @@ Level::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Level") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.level</id>\n"
-                       "<param name=\"blackPoint\" gui-text=\"" N_("Black Point") "\" type=\"float\" min=\"0.0\" max=\"100.0\">0.0</param>\n"                  
-                       "<param name=\"whitePoint\" gui-text=\"" N_("White Point") "\" type=\"float\" min=\"0.0\" max=\"100.0\">100.0</param>\n"                        
-                       "<param name=\"midPoint\" gui-text=\"" N_("Gamma Correction") "\" type=\"float\" min=\"0.0\" max=\"10.0\">1.0</param>\n"
+                       "<param name=\"blackPoint\" gui-text=\"" N_("Black Point") "\" type=\"float\" min=\"0\" max=\"100\">0</param>\n"                        
+                       "<param name=\"whitePoint\" gui-text=\"" N_("White Point") "\" type=\"float\" min=\"0\" max=\"100\">100</param>\n"                      
+                       "<param name=\"midPoint\" gui-text=\"" N_("Gamma Correction") "\" type=\"float\" min=\"0\" max=\"10\">1</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Level Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Level selected bitmap(s) by scaling values falling between the given ranges to the full color range.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Level());
 }
index 90372aa84b53b9787edfc2b690770592d455bbe4..265ea78d005e45df2849ab6ef26dcc645a1f88bb 100644 (file)
@@ -69,7 +69,7 @@ LevelChannel::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Level (with Channel) Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Level the specified channel of selected bitmap(s) by scaling values falling between the given ranges to the full color range.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new LevelChannel());
 }
index 4ba14fd70d302e2449ca6b11935cd8968c5281e2..3255043ce084c6ba4653561e0f25ccabcc166df3 100644 (file)
@@ -35,13 +35,13 @@ MedianFilter::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Median Filter") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.medianFilter</id>\n"
-                       "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0.0\" max=\"100.0\">5.0</param>\n"                   
+                       "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0\" max=\"100\">0</param>\n"                 
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Median Filter Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Filter selected bitmap(s) by replacing each pixel component with the median color in a circular neighborhood.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new MedianFilter());
 }
index 97a4d5a47a11a7125b5f64741baa930da1e94368..f8dbca86d6aa80c5f160798eee9484bec834974d 100644 (file)
@@ -38,15 +38,15 @@ Modulate::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Modulate") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.modulate</id>\n"                        
-                       "<param name=\"brightness\" gui-text=\"" N_("Brightness") "\" type=\"float\" min=\"0.0\" max=\"10.0\">1.0</param>\n"
-                       "<param name=\"saturation\" gui-text=\"" N_("Saturation") "\" type=\"float\" min=\"0.0\" max=\"10.0\">1.0</param>\n"
-                       "<param name=\"hue\" gui-text=\"" N_("Hue") "\" type=\"float\" min=\"-180.0\" max=\"180.0\">0.0</param>\n"
+                       "<param name=\"brightness\" gui-text=\"" N_("Brightness") "\" type=\"float\" min=\"0\" max=\"100\">1</param>\n"
+                       "<param name=\"saturation\" gui-text=\"" N_("Saturation") "\" type=\"float\" min=\"0\" max=\"100\">1</param>\n"
+                       "<param name=\"hue\" gui-text=\"" N_("Hue") "\" type=\"float\" min=\"-180\" max=\"180\">0</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Modulate Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Modulate percent hue, saturation, and brightness of selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Modulate());
 }
index 19e72e8dd22195d256818a4ac23af3a79bdec6f2..8792883dc84366f11e5bef8fd1c34ffc1e5d64b0 100644 (file)
@@ -39,7 +39,7 @@ Negate::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Negate Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Negate (take inverse) selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Negate());
 }
index 6d8b4330be3ba5eeaaf1aeafbabccd829ba5ecf7..0b2ddb303c32d6a2e653c7c6b396f9362dc2fccf 100644 (file)
@@ -39,7 +39,7 @@ Normalize::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Normalize Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Normalize selected bitmap(s), expanding color range to the full possible range of color.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Normalize());
 }
index 7b95fe1609de102c52ee8cafcfa13862b915bedf..6e8bacdaeb6ac3313c6c65998540823e7d1d295f 100644 (file)
@@ -41,7 +41,7 @@ OilPaint::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply OilPaint Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Stylize selected bitmap(s) so that they appear to be painted with oils.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new OilPaint());
 }
index af2c3fe269592247add42ce6fbabb8b7936d2e4b..e2db6792b3f4715116e1faa8606cb9484aad571e 100644 (file)
@@ -18,7 +18,7 @@ namespace Bitmap {
        
 void
 Opacity::applyEffect(Magick::Image* image) {
-       Magick::Quantum opacity = Magick::Color::scaleDoubleToQuantum(_opacity / 100.0);
+       Magick::Quantum opacity = Magick::Color::scaleDoubleToQuantum((100 - _opacity) / 100.0);
        image->opacity(opacity);
 }
 
@@ -42,7 +42,7 @@ Opacity::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Opacity Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Modify opacity channel(s) of selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Opacity());
 }
index 6f050fcef145be14e4dd480d9939acdd5d904c42..d3130a11d6f8c071fec7ddc3b31c7f0a73f6b749 100644 (file)
@@ -18,7 +18,7 @@ namespace Bitmap {
        
 void
 Raise::applyEffect(Magick::Image* image) {
-       Magick::Geometry geometry(_width, _height, _x, _y);
+       Magick::Geometry geometry(_width, _height, 0, 0);
        image->raise(geometry, _raisedFlag);
 }
 
@@ -26,8 +26,6 @@ void
 Raise::refreshParameters(Inkscape::Extension::Effect* module) {
        _width = module->get_param_int("width");
        _height = module->get_param_int("height");
-       _x = module->get_param_int("x");
-       _y = module->get_param_int("y");
        _raisedFlag = module->get_param_bool("raisedFlag");
 }
 
@@ -42,15 +40,13 @@ Raise::init(void)
                        "<id>org.inkscape.effect.bitmap.raise</id>\n"
                        "<param name=\"width\" gui-text=\"" N_("Width") "\" type=\"int\" min=\"0\" max=\"800\">6</param>\n"
                        "<param name=\"height\" gui-text=\"" N_("Height") "\" type=\"int\" min=\"0\" max=\"800\">6</param>\n"
-                       "<param name=\"x\" gui-text=\"" N_("X") "\" type=\"int\" min=\"0\" max=\"100\">0</param>\n"
-                       "<param name=\"y\" gui-text=\"" N_("Y") "\" type=\"int\" min=\"0\" max=\"100\">0</param>\n"
-                       "<param name=\"raisedFlag\" gui-text=\"" N_("RaisedFlag") "\" type=\"bool\">0</param>\n"
+                       "<param name=\"raisedFlag\" gui-text=\"" N_("Raised") "\" type=\"boolean\">0</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Raise Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Alter lightness the edges of selected bitmap(s) to create a raised appearance.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Raise());
 }
index 7ceb08867470df67d0670004eb395bf6c50445c3..81a6c65c3b54b15e91885bfa06ba520e631c06e0 100644 (file)
@@ -16,8 +16,6 @@ namespace Bitmap {
 class Raise : public ImageMagick
 {
 private:
-       int _x;
-       int _y;
        int _width;
        int _height;
        bool _raisedFlag;
index 689a97361537df13b14ba5d684aec53cc9bf096f..972ab39be583f2c7c5aade55b8cfea906223736a 100644 (file)
@@ -44,7 +44,7 @@ ReduceNoise::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply ReduceNoise Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Reduce noise in selected bitmap(s) using a noise peak elimination filter.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new ReduceNoise());
 }
index a9bb5a2662553231bb0638ff6b994cb8403fc2c9..3ee83b43f5a25667253b1473bfba2fb642e6b8af 100644 (file)
@@ -18,7 +18,8 @@ namespace Bitmap {
        
 void
 Shade::applyEffect(Magick::Image* image) {
-       image->shade(_azimuth, _elevation, _colorShading);
+       image->shade(_azimuth, _elevation, !_colorShading);
+       // I don't know why, but I have to invert colorShading here
 }
 
 void
@@ -39,13 +40,13 @@ Shade::init(void)
                        "<id>org.inkscape.effect.bitmap.shade</id>\n"
                        "<param name=\"azimuth\" gui-text=\"" N_("Azimuth") "\" type=\"float\" min=\"-180\" max=\"180\">30</param>\n"
                        "<param name=\"elevation\" gui-text=\"" N_("Elevation") "\" type=\"float\" min=\"-180\" max=\"180\">30</param>\n"
-                       "<param name=\"colorShading\" gui-text=\"" N_("Colored Shading") "\" type=\"bool\">0</param>\n"                 
+                       "<param name=\"colorShading\" gui-text=\"" N_("Colored Shading") "\" type=\"boolean\">false</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Shade Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Shade selected bitmap(s) simulating distant light source.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Shade());
 }
index cf0bf519e2d0a2f8b495095d7756ced7597f0d8b..4e21017ed0e38ccc9ca412c43fa550484d5df47c 100644 (file)
@@ -43,7 +43,7 @@ Sharpen::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Sharpen Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Sharpen selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Sharpen());
 }
index 1de9bf9da90dcb08df6c8b56720d6ef99c398e9e..744b09046c6a5fc4a22ad7381480a2b82e54c0b5 100644 (file)
@@ -35,13 +35,13 @@ Solarize::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Solarize") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.solarize</id>\n"
-                       "<param name=\"factor\" gui-text=\"" N_("Factor") "\" type=\"float\" min=\"-100.0\" max=\"100.0\">50.0</param>\n"
+                       "<param name=\"factor\" gui-text=\"" N_("Factor") "\" type=\"float\" min=\"0\" max=\"100\">50</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Solarize Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Solarize selected bitmap(s), like overexposing photographic film.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Solarize());
 }
index dfc9b8bf5f58a455493b24a1b5b27a9b19e45935..1000d304d3788612ecb132c535e915b42554d447 100644 (file)
@@ -41,7 +41,7 @@ Spread::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Spread Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Randomly spread pixels in selected bitmap(s), within the radius of 'amount.'") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Spread());
 }
index a880552c690ad00ac0238bb5e450122bf7561cd7..668528616fb616afda55ccce0639372e6f7f456c 100644 (file)
@@ -23,7 +23,7 @@ Swirl::applyEffect(Magick::Image* image) {
 
 void
 Swirl::refreshParameters(Inkscape::Extension::Effect* module) {
-       _degrees = module->get_param_float("degrees");
+       _degrees = module->get_param_int("degrees");
 }
 
 #include "../clear-n_.h"
@@ -35,13 +35,13 @@ Swirl::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Swirl") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.swirl</id>\n"
-                       "<param name=\"degrees\" gui-text=\"" N_("Degrees") "\" type=\"float\" min=\"0\" max=\"360\">30</param>\n"
+                       "<param name=\"degrees\" gui-text=\"" N_("Degrees") "\" type=\"int\" min=\"-360\" max=\"360\">30</param>\n"
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Swirl Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Swirl selected bitmap(s) around center point.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Swirl());
 }
index cea1850eaaf8fd2da10ea36528f3f16e65f69b05..b54b835812bba52488645d144fca6f631b2c8bed 100644 (file)
@@ -16,11 +16,11 @@ namespace Bitmap {
 class Swirl : public ImageMagick
 {
 private:
-       double _degrees;
+       float _degrees;
 public:
-  void applyEffect(Magick::Image *image);
-  void refreshParameters(Inkscape::Extension::Effect *module);
-  static void init(void);
+       void applyEffect(Magick::Image *image);
+       void refreshParameters(Inkscape::Extension::Effect *module);
+       static void init(void);
 };
 
 }; /* namespace Bitmap */
index 702d274e9110a39b0f48bb55ec2b032e22bf3620..ee920a57ffa7e418237dac8b71b6667598e7c237 100644 (file)
@@ -42,7 +42,7 @@ Threshold::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Threshold Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Threshold selected bitmap(s).") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Threshold());
 }
index 6e4a1759a1ff4360bdd09fda3dc6f8d97dd29637..1249345ba678bd9a73e7a788077827537a07e677 100644 (file)
@@ -48,7 +48,7 @@ Unsharpmask::init(void)
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Unsharp Mask Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Sharpen selected bitmap(s) using unsharp mask algorithms.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Unsharpmask());
 }
index c1a2994c0e8974068b908701841e61338bfa2a4e..b654fa7e0c249d41e6d3f6d7af6e3b8fcbff0b1f 100644 (file)
@@ -24,7 +24,7 @@ Wave::applyEffect(Magick::Image* image) {
 void
 Wave::refreshParameters(Inkscape::Extension::Effect* module) {
        _amplitude = module->get_param_float("amplitude");
-       _wavelength = module->get_param_int("wavelength");
+       _wavelength = module->get_param_float("wavelength");
 }
 
 #include "../clear-n_.h"
@@ -36,14 +36,14 @@ Wave::init(void)
                "<inkscape-extension>\n"
                        "<name>" N_("Wave") "</name>\n"
                        "<id>org.inkscape.effect.bitmap.wave</id>\n"
-                       "<param name=\"amplitude\" gui-text=\"" N_("Amplitude") "\" type=\"float\" min=\"-720.0\" max=\"720.0\">25.0</param>\n"                 
-                       "<param name=\"wavelength\" gui-text=\"" N_("Wavelength") "\" type=\"float\" min=\"-720.0\" max=\"720.0\">150.0</param>\n"                      
+                       "<param name=\"amplitude\" gui-text=\"" N_("Amplitude") "\" type=\"float\" min=\"-720.0\" max=\"720.0\">25</param>\n"                   
+                       "<param name=\"wavelength\" gui-text=\"" N_("Wavelength") "\" type=\"float\" min=\"-720.0\" max=\"720.0\">150</param>\n"                        
                        "<effect>\n"
                                "<object-type>all</object-type>\n"
                                "<effects-menu>\n"
                                        "<submenu name=\"" N_("Raster") "\" />\n"
                                "</effects-menu>\n"
-                               "<menu-tip>" N_("Apply Wave Effect") "</menu-tip>\n"
+                               "<menu-tip>" N_("Alter selected bitmap(s) along sine wave.") "</menu-tip>\n"
                        "</effect>\n"
                "</inkscape-extension>\n", new Wave());
 }
index 8ee1fc7f56b0cafcd6220a50eb845a77a9a4d6e6..5bbde9e487a58adf47b356e6f5b60326b0088a51 100644 (file)
@@ -17,7 +17,7 @@ class Wave : public ImageMagick
 {
 private:
        float _amplitude;
-       int _wavelength;
+       float _wavelength;
 public:
        void applyEffect(Magick::Image *image);
        void refreshParameters(Inkscape::Extension::Effect *module);
index c70d407f633c074aa34fb95d9a269bee961dc051..e051fc8dc6b48c24216310f372ee955bfaf8e345 100644 (file)
@@ -36,11 +36,11 @@ void sp_color_param_changed(SPColorSelector *csel, GObject *cp);
 /** \brief  Free the allocated data. */
 ParamColor::~ParamColor(void)
 {
-    g_free(_value);
+    
 }
      
-SPColor* 
-ParamColor::set (SPColor* in, SPDocument * doc, Inkscape::XML::Node * node)
+guint32 
+ParamColor::set (guint32 in, SPDocument * doc, Inkscape::XML::Node * node)
 {
     _value = in;
 
@@ -53,7 +53,7 @@ ParamColor::set (SPColor* in, SPDocument * doc, Inkscape::XML::Node * node)
 
 /** \brief  Initialize the object, to do that, copy the data. */
 ParamColor::ParamColor (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
-    Parameter(name, guitext, desc, scope, ext), _value(NULL)
+    Parameter(name, guitext, desc, scope, ext)
 {
     const char * defaulthex = NULL;
     if (sp_repr_children(xml) != NULL)
@@ -65,26 +65,8 @@ ParamColor::ParamColor (const gchar * name, const gchar * guitext, const gchar *
 
     if (paramval != NULL)
         defaulthex = paramval;
-    
-       const char* hexMark = strchr(defaulthex, '#');
-       if (hexMark != NULL)
-           defaulthex++;// = hexMark;
-       
-       if (strlen(defaulthex) == 6) {
-               int r = 0, g = 0, b = 0;        
-               std::stringstream ss;
-               ss << g_strndup(defaulthex, 2);
-               ss >> std::hex >> r;
-               ss << g_strndup(defaulthex + 2, 2);
-               ss >> std::hex >> g;
-               ss << defaulthex + 4;
-               ss >> std::hex >> b;
-               g_free(ss);
-                       
-               SPColor defaultColor;
-               sp_color_set_rgb_float(&defaultColor, r / 255.0, g / 255.0, b / 255.0);
-               _value = &defaultColor;
-       }
+               
+       _value = atoi(defaulthex);
 
     return;
 }
@@ -93,16 +75,10 @@ ParamColor::ParamColor (const gchar * name, const gchar * guitext, const gchar *
 Glib::ustring *
 ParamColor::string (void)
 {
-    float rgb[3];
-    sp_color_get_rgb_floatv(_value, rgb);
-    char hex[8];
-       snprintf(hex, 8, "#%02X%02X%02X", (int)(rgb[0] * 255), (int)(rgb[1] * 255), (int)(rgb[2] * 255));
+    char str[16];
+       sprintf(str, "%i", _value);
        
-       Glib::ustring* ret = new Glib::ustring(hex);
-       
-       printf("ParamColor::string = '%s'\n", hex);
-       
-    return ret;
+       return new Glib::ustring(str);
 }
 
 Gtk::Widget *
@@ -113,15 +89,15 @@ ParamColor::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::sign
        SPColorSelector* spColorSelector = (SPColorSelector*)sp_color_selector_new(SP_TYPE_COLOR_NOTEBOOK, SP_COLORSPACE_TYPE_RGB);
        
        ColorSelector* colorSelector = spColorSelector->base;
-       if (_value == NULL) {
-               _value = new SPColor();
-               sp_color_set_rgb_float(_value, 1.0, 0.0, 0.0);
+       if (_value < 1) {
+               _value = 0xFF000000;
        }
-    colorSelector->setColor(*_value);
+       SPColor *color = new SPColor();
+       sp_color_set_rgb_rgba32(color, _value);
+       float alpha = (_value & 0xff) / 255.0F;
+    colorSelector->setColorAlpha(*color, alpha);
 
        hbox->pack_start (*Glib::wrap(&spColorSelector->vbox), true, true, 0);
-       g_signal_connect(G_OBJECT(spColorSelector), "dragged",  G_CALLBACK(sp_color_param_changed), (void*)this);
-       g_signal_connect(G_OBJECT(spColorSelector), "released", G_CALLBACK(sp_color_param_changed), (void*)this);
        g_signal_connect(G_OBJECT(spColorSelector), "changed",  G_CALLBACK(sp_color_param_changed), (void*)this);
 
        gtk_widget_show(GTK_WIDGET(spColorSelector));
@@ -133,14 +109,11 @@ ParamColor::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::sign
 void
 sp_color_param_changed(SPColorSelector *csel, GObject *obj)
 {
-       SPColor color;
-    float alpha;
-    csel->base->getColorAlpha(color, &alpha);
-    guint32 rgba = sp_color_get_rgba32_falpha(&color, alpha);
-       
+       const SPColor color = csel->base->getColor();
+       float alpha = csel->base->getAlpha();
 
-    ParamColor* ptr = (ParamColor* )obj;
-       ptr->set(&color, NULL, NULL); 
+    ParamColor* ptr = (ParamColor*)obj;
+       ptr->set(sp_color_get_rgba32_falpha(&color, alpha), NULL, NULL);
        
        ptr->_changeSignal->emit();
 }
index c109df04fc794945efc224d8609644e920584f5f..fc9d939cdd23ac83795fc45868684fc3eaf9e041 100644 (file)
@@ -18,13 +18,13 @@ namespace Extension {
 
 class ParamColor : public Parameter {
 private:
-    SPColor* _value;
+    guint32 _value;
 public:
     ParamColor(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
     ~ParamColor(void);
     /** \brief  Returns \c _value, with a \i const to protect it. */
-    SPColor* get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; }
-    SPColor* set (SPColor* in, SPDocument * doc, Inkscape::XML::Node * node);
+    guint32 get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; }
+    guint32 set (guint32 in, SPDocument * doc, Inkscape::XML::Node * node);
     Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
     Glib::ustring * string (void);
        sigc::signal<void> * _changeSignal;
@@ -34,14 +34,3 @@ public:
 }  /* namespace Inkscape */
 
 #endif /* __INK_EXTENSION_PARAMCOLOR_H__ */
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
-  indent-tabs-mode:nil
-  fill-column:99
-  End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
index 52c67267f7e2615002865df3e3df1e771517bf20..4af448b2057c06cea1f6f643732966640ce34e7f 100644 (file)
@@ -215,7 +215,7 @@ Parameter::get_enum (const SPDocument * doc, const Inkscape::XML::Node * node)
     return param->get(doc, node);
 }
 
-SPColor*
+guint32
 Parameter::get_color(const SPDocument* doc, const Inkscape::XML::Node* node)
 {
     ParamColor* param = dynamic_cast<ParamColor *>(this);
@@ -265,8 +265,8 @@ Parameter::set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node *
     return stringpntr->set(in, doc, node);
 }
 /** \brief  Wrapper to cast to the object and use it's function.  */
-SPColor*
-Parameter::set_color (SPColor* in, SPDocument * doc, Inkscape::XML::Node * node)
+guint32
+Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node)
 {
     ParamColor* param = dynamic_cast<ParamColor *>(this);
     if (param == NULL)
index 0c799a1c24ab7cf1049aae9457fd8f412fff63fc..19cd75ecd021426d776a32cb9237921bb5d61936 100644 (file)
@@ -87,7 +87,7 @@ public:
                               const Inkscape::XML::Node * node);
     const gchar * get_string (const SPDocument * doc,
                               const Inkscape::XML::Node * node);
-    SPColor* get_color              (const SPDocument * doc,
+    guint32       get_color  (const SPDocument * doc,
                               const Inkscape::XML::Node * node);
        const gchar * get_enum   (const SPDocument * doc,
                               const Inkscape::XML::Node * node);
@@ -96,7 +96,7 @@ public:
     int           set_int    (int  in,          SPDocument * doc, Inkscape::XML::Node * node);
     float         set_float  (float in,         SPDocument * doc, Inkscape::XML::Node * node);
     const gchar * set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node);
-    SPColor*     set_color  (SPColor* in, SPDocument * doc, Inkscape::XML::Node * node);
+    guint32      set_color  (guint32 in, SPDocument * doc, Inkscape::XML::Node * node);
 
     const gchar * name       (void) {return _name;}