diff options
| author | Ted Gould <ted@gould.cx> | 2007-08-10 17:38:51 +0000 |
|---|---|---|
| committer | gouldtj <gouldtj@users.sourceforge.net> | 2007-08-10 17:38:51 +0000 |
| commit | b29eafffd0b92cc7b67e5cd877aad5e98b0f0231 (patch) | |
| tree | 167c348e5e11ebf3d8afec37593f023180675039 /src/extension/internal/bitmap | |
| parent | fix 1767940 (diff) | |
| download | inkscape-b29eafffd0b92cc7b67e5cd877aad5e98b0f0231.tar.gz inkscape-b29eafffd0b92cc7b67e5cd877aad5e98b0f0231.zip | |
r16217@tres: ted | 2007-08-10 10:36:27 -0700
ImageMagick effects patch from Chris Brown. Google Summer of Code
project.
(bzr r3450)
Diffstat (limited to 'src/extension/internal/bitmap')
72 files changed, 3207 insertions, 0 deletions
diff --git a/src/extension/internal/bitmap/adaptiveThreshold.cpp b/src/extension/internal/bitmap/adaptiveThreshold.cpp new file mode 100644 index 000000000..5a2db5dc0 --- /dev/null +++ b/src/extension/internal/bitmap/adaptiveThreshold.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "adaptiveThreshold.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +AdaptiveThreshold::applyEffect(Magick::Image *image) { + image->adaptiveThreshold(_width, _height); +} + +void +AdaptiveThreshold::refreshParameters(Inkscape::Extension::Effect *module) { + _width = module->get_param_int("width"); + _height = module->get_param_int("height"); +} + +#include "../clear-n_.h" + +void +AdaptiveThreshold::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new AdaptiveThreshold()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/adaptiveThreshold.h b/src/extension/internal/bitmap/adaptiveThreshold.h new file mode 100644 index 000000000..e7b5e753f --- /dev/null +++ b/src/extension/internal/bitmap/adaptiveThreshold.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class AdaptiveThreshold : public ImageMagick +{ +private: + int _width; + int _height; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/addNoise.cpp b/src/extension/internal/bitmap/addNoise.cpp new file mode 100644 index 000000000..11e3835cf --- /dev/null +++ b/src/extension/internal/bitmap/addNoise.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "addNoise.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +AddNoise::applyEffect(Magick::Image *image) { + Magick::NoiseType noiseType = Magick::UniformNoise; + if (!strcmp(_noiseTypeName, "Uniform Noise")) noiseType = Magick::UniformNoise; + else if (!strcmp(_noiseTypeName, "Gaussian Noise")) noiseType = Magick::GaussianNoise; + else if (!strcmp(_noiseTypeName, "Multiplicative Gaussian Noise")) noiseType = Magick::MultiplicativeGaussianNoise; + else if (!strcmp(_noiseTypeName, "Impulse Noise")) noiseType = Magick::ImpulseNoise; + else if (!strcmp(_noiseTypeName, "Laplacian Noise")) noiseType = Magick::LaplacianNoise; + else if (!strcmp(_noiseTypeName, "Poisson Noise")) noiseType = Magick::PoissonNoise; + + image->addNoise(noiseType); +} + +void +AddNoise::refreshParameters(Inkscape::Extension::Effect *module) { + _noiseTypeName = module->get_param_enum("noiseType"); +} + +#include "../clear-n_.h" + +void +AddNoise::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Add Noise") "</name>\n" + "<id>org.inkscape.effect.bitmap.addNoise</id>\n" + "<param name=\"noiseType\" gui-text=\"" N_("Type") "\" type=\"enum\" >\n" + "<item value='Uniform Noise'>Uniform Noise</item>\n" + "<item value='Gaussian Noise'>Gaussian Noise</item>\n" + "<item value='Multiplicative Gaussian Noise'>Multiplicative Gaussian Noise</item>\n" + "<item value='Impulse Noise'>Impulse Noise</item>\n" + "<item value='Laplacian Noise'>Laplacian Noise</item>\n" + "<item value='Poisson Noise'>Poisson Noise</item>\n" + "</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 Add Noise Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new AddNoise()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/addNoise.h b/src/extension/internal/bitmap/addNoise.h new file mode 100644 index 000000000..b1ac6a9f5 --- /dev/null +++ b/src/extension/internal/bitmap/addNoise.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class AddNoise : public ImageMagick +{ +private: + const gchar* _noiseTypeName; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/blur.cpp b/src/extension/internal/bitmap/blur.cpp new file mode 100644 index 000000000..ad2b5a837 --- /dev/null +++ b/src/extension/internal/bitmap/blur.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "blur.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Blur::applyEffect(Magick::Image *image) { + image->blur(_radius, _sigma); +} + +void +Blur::refreshParameters(Inkscape::Extension::Effect *module) { + _radius = module->get_param_float("radius"); + _sigma = module->get_param_float("sigma"); +} + +#include "../clear-n_.h" + +void +Blur::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Blur()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/blur.h b/src/extension/internal/bitmap/blur.h new file mode 100644 index 000000000..be58ba5ba --- /dev/null +++ b/src/extension/internal/bitmap/blur.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Blur : public ImageMagick +{ +private: + float _radius; + float _sigma; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/channel.cpp b/src/extension/internal/bitmap/channel.cpp new file mode 100644 index 000000000..708638371 --- /dev/null +++ b/src/extension/internal/bitmap/channel.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "channel.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Channel::applyEffect(Magick::Image *image) { + Magick::ChannelType layer = Magick::UndefinedChannel; + if (!strcmp(_layerName, "Red Channel")) layer = Magick::RedChannel; + else if (!strcmp(_layerName, "Green Channel")) layer = Magick::GreenChannel; + else if (!strcmp(_layerName, "Blue Channel")) layer = Magick::BlueChannel; + else if (!strcmp(_layerName, "Cyan Channel")) layer = Magick::CyanChannel; + else if (!strcmp(_layerName, "Magenta Channel")) layer = Magick::MagentaChannel; + else if (!strcmp(_layerName, "Yellow Channel")) layer = Magick::YellowChannel; + else if (!strcmp(_layerName, "Black Channel")) layer = Magick::BlackChannel; + else if (!strcmp(_layerName, "Opacity Channel")) layer = Magick::OpacityChannel; + else if (!strcmp(_layerName, "Matte Channel")) layer = Magick::MatteChannel; + + image->channel(layer); +} + +void +Channel::refreshParameters(Inkscape::Extension::Effect *module) { + _layerName = module->get_param_enum("layer"); +} + +#include "../clear-n_.h" + +void +Channel::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Channel") "</name>\n" + "<id>org.inkscape.effect.bitmap.channel</id>\n" + "<param name=\"layer\" gui-text=\"" N_("Layer") "\" type=\"enum\" >\n" + "<item value='Red Channel'>Red Channel</item>\n" + "<item value='Green Channel'>Green Channel</item>\n" + "<item value='Blue Channel'>Blue Channel</item>\n" + "<item value='Cyan Channel'>Cyan Channel</item>\n" + "<item value='Magenta Channel'>Magenta Channel</item>\n" + "<item value='Yellow Channel'>Yellow Channel</item>\n" + "<item value='Black Channel'>Black Channel</item>\n" + "<item value='Opacity Channel'>Opacity Channel</item>\n" + "<item value='Matte Channel'>Matte Channel</item>\n" + "</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 Channel Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Channel()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/channel.h b/src/extension/internal/bitmap/channel.h new file mode 100644 index 000000000..898d3af46 --- /dev/null +++ b/src/extension/internal/bitmap/channel.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Channel : public ImageMagick { + +private: + const gchar * _layerName; + +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/charcoal.cpp b/src/extension/internal/bitmap/charcoal.cpp new file mode 100644 index 000000000..6f3244b8d --- /dev/null +++ b/src/extension/internal/bitmap/charcoal.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "charcoal.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Charcoal::applyEffect(Magick::Image* image) { + image->charcoal(_radius, _sigma); +} + +void +Charcoal::refreshParameters(Inkscape::Extension::Effect* module) { + _radius = module->get_param_float("radius"); + _sigma = module->get_param_float("sigma"); +} + +#include "../clear-n_.h" + +void +Charcoal::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Charcoal()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/charcoal.h b/src/extension/internal/bitmap/charcoal.h new file mode 100644 index 000000000..2bedba76e --- /dev/null +++ b/src/extension/internal/bitmap/charcoal.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Charcoal : public ImageMagick +{ +private: + float _radius; + float _sigma; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/colorize.cpp b/src/extension/internal/bitmap/colorize.cpp new file mode 100644 index 000000000..cf8ff5dd3 --- /dev/null +++ b/src/extension/internal/bitmap/colorize.cpp @@ -0,0 +1,76 @@ +/* + * Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Copyright (C) 2007 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "colorize.h" + +#include "color.h" + +#include <iostream> + +namespace Inkscape { +namespace Extension { +namespace Internal { +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); + + + printf("(2fk) applying colorize\n"); + printf("(2fl) rgb: %i,%i,%i\n", red, green, blue); + printf("(2fm) opacity: %i\n", _opacity); + + Magick::ColorRGB mc(red, green, blue); + + image->colorize(_opacity, 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" + +void +Colorize::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Colorize()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/colorize.h b/src/extension/internal/bitmap/colorize.h new file mode 100644 index 000000000..e82ef88a4 --- /dev/null +++ b/src/extension/internal/bitmap/colorize.h @@ -0,0 +1,33 @@ +/* + * Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Copyright (C) 2007 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Colorize : public ImageMagick { +private: + SPColor* _color; + int _opacity; + +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/contrast.cpp b/src/extension/internal/bitmap/contrast.cpp new file mode 100644 index 000000000..1728c325f --- /dev/null +++ b/src/extension/internal/bitmap/contrast.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "contrast.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +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"); +} + +#include "../clear-n_.h" + +void +Contrast::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Contrast()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/contrast.h b/src/extension/internal/bitmap/contrast.h new file mode 100644 index 000000000..acb5982a3 --- /dev/null +++ b/src/extension/internal/bitmap/contrast.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Contrast : public ImageMagick +{ +private: + bool _sharpen; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/convolve.cpp b/src/extension/internal/bitmap/convolve.cpp new file mode 100644 index 000000000..008cd4390 --- /dev/null +++ b/src/extension/internal/bitmap/convolve.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "convolve.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Convolve::applyEffect(Magick::Image *image) { + image->convolve(_order, _kernel); +} + +void +Convolve::refreshParameters(Inkscape::Extension::Effect *module) { + _order = module->get_param_int("order"); + *_kernel = 0; +} + +#include "../clear-n_.h" + +void +Convolve::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<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" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Raster") "\" />\n" + "</effects-menu>\n" + "<menu-tip>" N_("Apply Convolve Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Convolve()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/convolve.h b/src/extension/internal/bitmap/convolve.h new file mode 100644 index 000000000..3cfdc7fd3 --- /dev/null +++ b/src/extension/internal/bitmap/convolve.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Convolve : public ImageMagick { +private: + int _order; + double* _kernel; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/cycleColormap.cpp b/src/extension/internal/bitmap/cycleColormap.cpp new file mode 100644 index 000000000..309837abe --- /dev/null +++ b/src/extension/internal/bitmap/cycleColormap.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "cycleColormap.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +CycleColormap::applyEffect(Magick::Image *image) { + image->cycleColormap(_amount); +} + +void +CycleColormap::refreshParameters(Inkscape::Extension::Effect *module) { + _amount = module->get_param_int("amount"); +} + +#include "../clear-n_.h" + +void +CycleColormap::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new CycleColormap()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/cycleColormap.h b/src/extension/internal/bitmap/cycleColormap.h new file mode 100644 index 000000000..7d8f49504 --- /dev/null +++ b/src/extension/internal/bitmap/cycleColormap.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class CycleColormap : public ImageMagick { +private: + int _amount; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/despeckle.cpp b/src/extension/internal/bitmap/despeckle.cpp new file mode 100644 index 000000000..75a1ca35a --- /dev/null +++ b/src/extension/internal/bitmap/despeckle.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "despeckle.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Despeckle::applyEffect(Magick::Image *image) { + image->despeckle(); +} + +void +Despeckle::refreshParameters(Inkscape::Extension::Effect *module) { + +} + +#include "../clear-n_.h" + +void +Despeckle::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Despeckle") "</name>\n" + "<id>org.inkscape.effect.bitmap.despeckle</id>\n" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Raster") "\" />\n" + "</effects-menu>\n" + "<menu-tip>" N_("Apply Despeckle Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Despeckle()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/despeckle.h b/src/extension/internal/bitmap/despeckle.h new file mode 100644 index 000000000..7a9be90a3 --- /dev/null +++ b/src/extension/internal/bitmap/despeckle.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Despeckle : public ImageMagick { +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/edge.cpp b/src/extension/internal/bitmap/edge.cpp new file mode 100644 index 000000000..f9b14b246 --- /dev/null +++ b/src/extension/internal/bitmap/edge.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "edge.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Edge::applyEffect(Magick::Image *image) { + image->edge(_radius); +} + +void +Edge::refreshParameters(Inkscape::Extension::Effect *module) { + _radius = module->get_param_int("radius"); +} + +#include "../clear-n_.h" + +void +Edge::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Edge()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/edge.h b/src/extension/internal/bitmap/edge.h new file mode 100644 index 000000000..4585648f2 --- /dev/null +++ b/src/extension/internal/bitmap/edge.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Edge : public ImageMagick { +private: + int _radius; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/emboss.cpp b/src/extension/internal/bitmap/emboss.cpp new file mode 100644 index 000000000..8d7f72459 --- /dev/null +++ b/src/extension/internal/bitmap/emboss.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "emboss.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Emboss::applyEffect(Magick::Image *image) { + image->emboss(_radius, _sigma); +} + +void +Emboss::refreshParameters(Inkscape::Extension::Effect *module) { + _radius = module->get_param_float("radius"); + _sigma = module->get_param_float("sigma"); +} + +#include "../clear-n_.h" + +void +Emboss::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Emboss()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/emboss.h b/src/extension/internal/bitmap/emboss.h new file mode 100644 index 000000000..4dcfc89d4 --- /dev/null +++ b/src/extension/internal/bitmap/emboss.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Emboss : public ImageMagick +{ +private: + float _radius; + float _sigma; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/enhance.cpp b/src/extension/internal/bitmap/enhance.cpp new file mode 100644 index 000000000..dae90776b --- /dev/null +++ b/src/extension/internal/bitmap/enhance.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "enhance.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Enhance::applyEffect(Magick::Image *image) { + image->enhance(); +} + +void +Enhance::refreshParameters(Inkscape::Extension::Effect *module) { + +} + +#include "../clear-n_.h" + +void +Enhance::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Enhance") "</name>\n" + "<id>org.inkscape.effect.bitmap.enhance</id>\n" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Raster") "\" />\n" + "</effects-menu>\n" + "<menu-tip>" N_("Apply Enhance Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Enhance()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/enhance.h b/src/extension/internal/bitmap/enhance.h new file mode 100644 index 000000000..3f5df47f6 --- /dev/null +++ b/src/extension/internal/bitmap/enhance.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Enhance : public ImageMagick +{ +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/equalize.cpp b/src/extension/internal/bitmap/equalize.cpp new file mode 100644 index 000000000..1b0911ac3 --- /dev/null +++ b/src/extension/internal/bitmap/equalize.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "equalize.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Equalize::applyEffect(Magick::Image *image) { + image->equalize(); +} + +void +Equalize::refreshParameters(Inkscape::Extension::Effect *module) { + +} + +#include "../clear-n_.h" + +void +Equalize::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Equalize") "</name>\n" + "<id>org.inkscape.effect.bitmap.equalize</id>\n" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Raster") "\" />\n" + "</effects-menu>\n" + "<menu-tip>" N_("Apply Equalize Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Equalize()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/equalize.h b/src/extension/internal/bitmap/equalize.h new file mode 100644 index 000000000..22cadf554 --- /dev/null +++ b/src/extension/internal/bitmap/equalize.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Equalize : public ImageMagick +{ +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/flop.cpp b/src/extension/internal/bitmap/flop.cpp new file mode 100644 index 000000000..437c8afbd --- /dev/null +++ b/src/extension/internal/bitmap/flop.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "flop.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Flop::applyEffect(Magick::Image *image) { + image->flop(); +} + +void +Flop::refreshParameters(Inkscape::Extension::Effect *module) { + +} + +#include "../clear-n_.h" + +void +Flop::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Flop") "</name>\n" + "<id>org.inkscape.effect.bitmap.flop</id>\n" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Raster") "\" />\n" + "</effects-menu>\n" + "<menu-tip>" N_("Apply Flop Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Flop()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/flop.h b/src/extension/internal/bitmap/flop.h new file mode 100644 index 000000000..d996396ea --- /dev/null +++ b/src/extension/internal/bitmap/flop.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Flop : public ImageMagick +{ +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init (void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/gaussianBlur.cpp b/src/extension/internal/bitmap/gaussianBlur.cpp new file mode 100644 index 000000000..36087c525 --- /dev/null +++ b/src/extension/internal/bitmap/gaussianBlur.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "gaussianBlur.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +GaussianBlur::applyEffect(Magick::Image* image) { + image->gaussianBlur(_width, _sigma); +} + +void +GaussianBlur::refreshParameters(Inkscape::Extension::Effect* module) { + _width = module->get_param_float("width"); + _sigma = module->get_param_float("sigma"); +} + +#include "../clear-n_.h" + +void +GaussianBlur::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new GaussianBlur()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/gaussianBlur.h b/src/extension/internal/bitmap/gaussianBlur.h new file mode 100644 index 000000000..3b6ca2137 --- /dev/null +++ b/src/extension/internal/bitmap/gaussianBlur.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class GaussianBlur : public ImageMagick +{ +private: + float _width; + float _sigma; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp new file mode 100644 index 000000000..83650aaa7 --- /dev/null +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -0,0 +1,175 @@ +/* + * Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Copyright (C) 2007 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include <gtkmm/box.h> +#include <gtkmm/adjustment.h> +#include <gtkmm/spinbutton.h> + +#include <glib/gstdio.h> + +#include "desktop.h" +#include "desktop-handles.h" +#include "selection.h" +#include "sp-object.h" +#include "util/glib-list-iterators.h" + +#include "extension/effect.h" +#include "extension/system.h" + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +bool +ImageMagick::load(Inkscape::Extension::Extension *module) +{ + _loaded = FALSE; + return TRUE; +} + +void +ImageMagick::commitDocument(void) { + _loaded = FALSE; +} + +void +ImageMagick::cancelDocument(void) { + for (int i = 0; i < _imageCount; i++) { + _nodes[i]->setAttribute("xlink:href", _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 + char *search = strndup(xlink, 30); + if (strstr(search, "base64") != (char*)NULL) { + // 7 = strlen("base64") + strlen(",") + char* pureBase64 = strstr(xlink, "base64") + 7; + Magick::Blob blob; + blob.base64(pureBase64); + image->read(blob); + } + else { + image->read(xlink); + } +} + +void +ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document) +{ + 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]; + _imageCount = 0; + + // Loop through selected nodes + for (; selectedReprList != NULL; selectedReprList = g_slist_next(selectedReprList)) + { + Inkscape::XML::Node *node = reinterpret_cast<Inkscape::XML::Node *>(selectedReprList->data); + if (!strcmp(node->name(), "image") || !strcmp(node->name(), "svg:image")) + { + _nodes[_imageCount] = node; + char const *xlink = node->attribute("xlink:href"); + + _originals[_imageCount] = xlink; + + readImage(xlink, &_images[_imageCount]); + + _imageCount++; + } + } + + _loaded = 1; + } + + for (int i = 0; i < _imageCount; i++) + { + try + { + Magick::Image effectedImage = _images[i]; + applyEffect(&effectedImage); + + Magick::Blob blob; + effectedImage.write(&blob); + + std::string raw_string = blob.base64(); + const int raw_len = raw_string.length(); + const char *raw = raw_string.c_str(); + 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); + } + catch (Magick::Exception &error_) { + printf("Caught exception: %s \n", error_.what()); + } + } +} + +/** \brief A function to get the prefences for the grid + \param moudule Module which holds the params + \param view Unused today - may get style information in the future. + + Uses AutoGUI for creating the GUI. +*/ +Gtk::Widget * +ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal) +{ + SPDocument * current_document = view->doc(); + + using Inkscape::Util::GSListConstIterator; + GSListConstIterator<SPItem *> selected = sp_desktop_selection((SPDesktop *)view)->itemList(); + Inkscape::XML::Node * first_select = NULL; + if (selected != NULL) + first_select = SP_OBJECT_REPR(*selected); + + return module->autogui(current_document, first_select, changeSignal); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/imagemagick.h b/src/extension/internal/bitmap/imagemagick.h new file mode 100644 index 000000000..36536bb69 --- /dev/null +++ b/src/extension/internal/bitmap/imagemagick.h @@ -0,0 +1,51 @@ +#ifndef __INKSCAPE_EXTENSION_INTERNAL_BITMAP_IMAGEMAGICK_H__ +#define __INKSCAPE_EXTENSION_INTERNAL_BITMAP_IMAGEMAGICK_H__ + +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/implementation/implementation.h" +#include "extension/extension-forward.h" +#include <Magick++.h> + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class ImageMagick : public Inkscape::Extension::Implementation::Implementation { + +private: + bool _loaded; + + Inkscape::XML::Node **_nodes; + + Magick::Image *_images; + int _imageCount; + + 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 readImage(char const *xlink, Magick::Image *image); + void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document); + + Gtk::Widget* prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ + +#endif /* __INKSCAPE_EXTENSION_INTERNAL_BITMAP_IMAGEMAGICK_H__ */ diff --git a/src/extension/internal/bitmap/implode.cpp b/src/extension/internal/bitmap/implode.cpp new file mode 100644 index 000000000..74dc81e4e --- /dev/null +++ b/src/extension/internal/bitmap/implode.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "implode.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Implode::applyEffect(Magick::Image* image) { + image->implode(_factor); +} + +void +Implode::refreshParameters(Inkscape::Extension::Effect* module) { + _factor = module->get_param_float("factor"); +} + +#include "../clear-n_.h" + +void +Implode::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Implode()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/implode.h b/src/extension/internal/bitmap/implode.h new file mode 100644 index 000000000..b25b35412 --- /dev/null +++ b/src/extension/internal/bitmap/implode.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Implode : public ImageMagick +{ +private: + float _factor; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/level.cpp b/src/extension/internal/bitmap/level.cpp new file mode 100644 index 000000000..f48be32a2 --- /dev/null +++ b/src/extension/internal/bitmap/level.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "level.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Level::applyEffect(Magick::Image* image) { + Magick::Quantum black_point = Magick::Color::scaleDoubleToQuantum(_black_point / 100.0); + Magick::Quantum white_point = Magick::Color::scaleDoubleToQuantum(_white_point / 100.0); + image->level(black_point, white_point, _mid_point); +} + +void +Level::refreshParameters(Inkscape::Extension::Effect* module) { + _black_point = module->get_param_float("blackPoint"); + _white_point = module->get_param_float("whitePoint"); + _mid_point = module->get_param_float("midPoint"); +} + +#include "../clear-n_.h" + +void +Level::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Level()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/level.h b/src/extension/internal/bitmap/level.h new file mode 100644 index 000000000..111e83af7 --- /dev/null +++ b/src/extension/internal/bitmap/level.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Level : public ImageMagick +{ +private: + float _black_point; + float _white_point; + float _mid_point; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/levelChannel.cpp b/src/extension/internal/bitmap/levelChannel.cpp new file mode 100644 index 000000000..90372aa84 --- /dev/null +++ b/src/extension/internal/bitmap/levelChannel.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "levelChannel.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +LevelChannel::applyEffect(Magick::Image* image) { + Magick::ChannelType channel = Magick::UndefinedChannel; + if (!strcmp(_channelName, "Red Channel")) channel = Magick::RedChannel; + else if (!strcmp(_channelName, "Green Channel")) channel = Magick::GreenChannel; + else if (!strcmp(_channelName, "Blue Channel")) channel = Magick::BlueChannel; + else if (!strcmp(_channelName, "Cyan Channel")) channel = Magick::CyanChannel; + else if (!strcmp(_channelName, "Magenta Channel")) channel = Magick::MagentaChannel; + else if (!strcmp(_channelName, "Yellow Channel")) channel = Magick::YellowChannel; + else if (!strcmp(_channelName, "Black Channel")) channel = Magick::BlackChannel; + else if (!strcmp(_channelName, "Opacity Channel")) channel = Magick::OpacityChannel; + else if (!strcmp(_channelName, "Matte Channel")) channel = Magick::MatteChannel; + Magick::Quantum black_point = Magick::Color::scaleDoubleToQuantum(_black_point / 100.0); + Magick::Quantum white_point = Magick::Color::scaleDoubleToQuantum(_white_point / 100.0); + image->levelChannel(channel, black_point, white_point, _mid_point); +} + +void +LevelChannel::refreshParameters(Inkscape::Extension::Effect* module) { + _channelName = module->get_param_enum("channel"); + _black_point = module->get_param_float("blackPoint"); + _white_point = module->get_param_float("whitePoint"); + _mid_point = module->get_param_float("midPoint"); +} + +#include "../clear-n_.h" + +void +LevelChannel::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Level (with Channel)") "</name>\n" + "<id>org.inkscape.effect.bitmap.levelChannel</id>\n" + "<param name=\"channel\" gui-text=\"" N_("Channel") "\" type=\"enum\" >\n" + "<item value='Red Channel'>Red Channel</item>\n" + "<item value='Green Channel'>Green Channel</item>\n" + "<item value='Blue Channel'>Blue Channel</item>\n" + "<item value='Cyan Channel'>Cyan Channel</item>\n" + "<item value='Magenta Channel'>Magenta Channel</item>\n" + "<item value='Yellow Channel'>Yellow Channel</item>\n" + "<item value='Black Channel'>Black Channel</item>\n" + "<item value='Opacity Channel'>Opacity Channel</item>\n" + "<item value='Matte Channel'>Matte Channel</item>\n" + "</param>\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" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Raster") "\" />\n" + "</effects-menu>\n" + "<menu-tip>" N_("Apply Level (with Channel) Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new LevelChannel()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/levelChannel.h b/src/extension/internal/bitmap/levelChannel.h new file mode 100644 index 000000000..832619d5f --- /dev/null +++ b/src/extension/internal/bitmap/levelChannel.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class LevelChannel : public ImageMagick +{ +private: + float _black_point; + float _white_point; + float _mid_point; + const gchar * _channelName; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/medianFilter.cpp b/src/extension/internal/bitmap/medianFilter.cpp new file mode 100644 index 000000000..4ba14fd70 --- /dev/null +++ b/src/extension/internal/bitmap/medianFilter.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "medianFilter.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +MedianFilter::applyEffect(Magick::Image* image) { + image->medianFilter(_radius); +} + +void +MedianFilter::refreshParameters(Inkscape::Extension::Effect* module) { + _radius = module->get_param_float("radius"); +} + +#include "../clear-n_.h" + +void +MedianFilter::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new MedianFilter()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/medianFilter.h b/src/extension/internal/bitmap/medianFilter.h new file mode 100644 index 000000000..befc57001 --- /dev/null +++ b/src/extension/internal/bitmap/medianFilter.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class MedianFilter : public ImageMagick +{ +private: + float _radius; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/modulate.cpp b/src/extension/internal/bitmap/modulate.cpp new file mode 100644 index 000000000..97a4d5a47 --- /dev/null +++ b/src/extension/internal/bitmap/modulate.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "modulate.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Modulate::applyEffect(Magick::Image* image) { + float hue = (_hue + 180.0) / 180.0; + image->modulate(_brightness, _saturation, hue); +} + +void +Modulate::refreshParameters(Inkscape::Extension::Effect* module) { + _brightness = module->get_param_float("brightness"); + _saturation = module->get_param_float("saturation"); + _hue = module->get_param_float("hue"); +} + +#include "../clear-n_.h" + +void +Modulate::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Modulate()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/modulate.h b/src/extension/internal/bitmap/modulate.h new file mode 100644 index 000000000..f7c6fe9a5 --- /dev/null +++ b/src/extension/internal/bitmap/modulate.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Modulate : public ImageMagick +{ +private: + float _brightness; + float _saturation; + float _hue; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/negate.cpp b/src/extension/internal/bitmap/negate.cpp new file mode 100644 index 000000000..19e72e8dd --- /dev/null +++ b/src/extension/internal/bitmap/negate.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "negate.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Negate::applyEffect(Magick::Image* image) { + image->negate(); +} + +void +Negate::refreshParameters(Inkscape::Extension::Effect* module) { +} + +#include "../clear-n_.h" + +void +Negate::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Negate") "</name>\n" + "<id>org.inkscape.effect.bitmap.negate</id>\n" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Raster") "\" />\n" + "</effects-menu>\n" + "<menu-tip>" N_("Apply Negate Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Negate()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/negate.h b/src/extension/internal/bitmap/negate.h new file mode 100644 index 000000000..7ebe3b79e --- /dev/null +++ b/src/extension/internal/bitmap/negate.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Negate : public ImageMagick +{ +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/normalize.cpp b/src/extension/internal/bitmap/normalize.cpp new file mode 100644 index 000000000..6d8b4330b --- /dev/null +++ b/src/extension/internal/bitmap/normalize.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "normalize.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Normalize::applyEffect(Magick::Image* image) { + image->normalize(); +} + +void +Normalize::refreshParameters(Inkscape::Extension::Effect* module) { +} + +#include "../clear-n_.h" + +void +Normalize::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Normalize") "</name>\n" + "<id>org.inkscape.effect.bitmap.normalize</id>\n" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Raster") "\" />\n" + "</effects-menu>\n" + "<menu-tip>" N_("Apply Normalize Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Normalize()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/normalize.h b/src/extension/internal/bitmap/normalize.h new file mode 100644 index 000000000..0637dbf44 --- /dev/null +++ b/src/extension/internal/bitmap/normalize.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Normalize : public ImageMagick +{ +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/oilPaint.cpp b/src/extension/internal/bitmap/oilPaint.cpp new file mode 100644 index 000000000..7b95fe160 --- /dev/null +++ b/src/extension/internal/bitmap/oilPaint.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "oilPaint.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +OilPaint::applyEffect(Magick::Image* image) { + image->oilPaint(_radius); +} + +void +OilPaint::refreshParameters(Inkscape::Extension::Effect* module) { + _radius = module->get_param_int("radius"); +} + +#include "../clear-n_.h" + +void +OilPaint::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Oil Paint") "</name>\n" + "<id>org.inkscape.effect.bitmap.oilPaint</id>\n" + "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"int\" min=\"0\" max=\"50\">3</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 OilPaint Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new OilPaint()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/oilPaint.h b/src/extension/internal/bitmap/oilPaint.h new file mode 100644 index 000000000..822119d00 --- /dev/null +++ b/src/extension/internal/bitmap/oilPaint.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class OilPaint : public ImageMagick +{ +private: + float _radius; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/opacity.cpp b/src/extension/internal/bitmap/opacity.cpp new file mode 100644 index 000000000..af2c3fe26 --- /dev/null +++ b/src/extension/internal/bitmap/opacity.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "opacity.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Opacity::applyEffect(Magick::Image* image) { + Magick::Quantum opacity = Magick::Color::scaleDoubleToQuantum(_opacity / 100.0); + image->opacity(opacity); +} + +void +Opacity::refreshParameters(Inkscape::Extension::Effect* module) { + _opacity = module->get_param_float("opacity"); +} + +#include "../clear-n_.h" + +void +Opacity::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Opacity") "</name>\n" + "<id>org.inkscape.effect.bitmap.opacity</id>\n" + "<param name=\"opacity\" gui-text=\"" N_("Opacity") "\" type=\"float\" min=\"0.0\" max=\"100.0\">80.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 Opacity Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Opacity()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/opacity.h b/src/extension/internal/bitmap/opacity.h new file mode 100644 index 000000000..2c3a4ecb3 --- /dev/null +++ b/src/extension/internal/bitmap/opacity.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Opacity : public ImageMagick +{ +private: + float _opacity; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/raise.cpp b/src/extension/internal/bitmap/raise.cpp new file mode 100644 index 000000000..6f050fcef --- /dev/null +++ b/src/extension/internal/bitmap/raise.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "raise.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Raise::applyEffect(Magick::Image* image) { + Magick::Geometry geometry(_width, _height, _x, _y); + image->raise(geometry, _raisedFlag); +} + +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"); +} + +#include "../clear-n_.h" + +void +Raise::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Raise") "</name>\n" + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Raise()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/raise.h b/src/extension/internal/bitmap/raise.h new file mode 100644 index 000000000..7ceb08867 --- /dev/null +++ b/src/extension/internal/bitmap/raise.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Raise : public ImageMagick +{ +private: + int _x; + int _y; + int _width; + int _height; + bool _raisedFlag; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/reduceNoise.cpp b/src/extension/internal/bitmap/reduceNoise.cpp new file mode 100644 index 000000000..689a97361 --- /dev/null +++ b/src/extension/internal/bitmap/reduceNoise.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "reduceNoise.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +ReduceNoise::applyEffect(Magick::Image* image) { + if (_order > -1) + image->reduceNoise(_order); + else + image->reduceNoise(); +} + +void +ReduceNoise::refreshParameters(Inkscape::Extension::Effect* module) { + _order = module->get_param_int("order"); +} + +#include "../clear-n_.h" + +void +ReduceNoise::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Reduce Noise") "</name>\n" + "<id>org.inkscape.effect.bitmap.reduceNoise</id>\n" + "<param name=\"order\" gui-text=\"" N_("Order") "\" type=\"int\" min=\"-1\" 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 ReduceNoise Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new ReduceNoise()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/reduceNoise.h b/src/extension/internal/bitmap/reduceNoise.h new file mode 100644 index 000000000..0a4847d63 --- /dev/null +++ b/src/extension/internal/bitmap/reduceNoise.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class ReduceNoise : public ImageMagick +{ +private: + int _order; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/shade.cpp b/src/extension/internal/bitmap/shade.cpp new file mode 100644 index 000000000..a9bb5a266 --- /dev/null +++ b/src/extension/internal/bitmap/shade.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "shade.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Shade::applyEffect(Magick::Image* image) { + image->shade(_azimuth, _elevation, _colorShading); +} + +void +Shade::refreshParameters(Inkscape::Extension::Effect* module) { + _azimuth = module->get_param_float("azimuth"); + _elevation = module->get_param_float("elevation"); + _colorShading = module->get_param_bool("colorShading"); +} + +#include "../clear-n_.h" + +void +Shade::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Shade") "</name>\n" + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Shade()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/shade.h b/src/extension/internal/bitmap/shade.h new file mode 100644 index 000000000..2f8349265 --- /dev/null +++ b/src/extension/internal/bitmap/shade.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Shade : public ImageMagick +{ +private: + float _azimuth; + float _elevation; + bool _colorShading; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/sharpen.cpp b/src/extension/internal/bitmap/sharpen.cpp new file mode 100644 index 000000000..cf0bf519e --- /dev/null +++ b/src/extension/internal/bitmap/sharpen.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "sharpen.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Sharpen::applyEffect(Magick::Image* image) { + image->sharpen(_radius, _sigma); +} + +void +Sharpen::refreshParameters(Inkscape::Extension::Effect* module) { + _radius = module->get_param_float("radius"); + _sigma = module->get_param_float("sigma"); +} + +#include "../clear-n_.h" + +void +Sharpen::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Sharpen") "</name>\n" + "<id>org.inkscape.effect.bitmap.sharpen</id>\n" + "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0\" max=\"50\">1.0</param>\n" + "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0\" max=\"10\">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 Sharpen Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Sharpen()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/sharpen.h b/src/extension/internal/bitmap/sharpen.h new file mode 100644 index 000000000..b8f92ddb3 --- /dev/null +++ b/src/extension/internal/bitmap/sharpen.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Sharpen : public ImageMagick +{ +private: + float _radius; + float _sigma; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/solarize.cpp b/src/extension/internal/bitmap/solarize.cpp new file mode 100644 index 000000000..1de9bf9da --- /dev/null +++ b/src/extension/internal/bitmap/solarize.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "solarize.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Solarize::applyEffect(Magick::Image* image) { + image->solarize(_factor); +} + +void +Solarize::refreshParameters(Inkscape::Extension::Effect* module) { + _factor = module->get_param_float("factor"); +} + +#include "../clear-n_.h" + +void +Solarize::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Solarize()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/solarize.h b/src/extension/internal/bitmap/solarize.h new file mode 100644 index 000000000..4acdf3c5c --- /dev/null +++ b/src/extension/internal/bitmap/solarize.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Solarize : public ImageMagick +{ +private: + float _factor; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/spread.cpp b/src/extension/internal/bitmap/spread.cpp new file mode 100644 index 000000000..dfc9b8bf5 --- /dev/null +++ b/src/extension/internal/bitmap/spread.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "spread.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Spread::applyEffect(Magick::Image* image) { + image->spread(_amount); +} + +void +Spread::refreshParameters(Inkscape::Extension::Effect* module) { + _amount = module->get_param_int("amount"); +} + +#include "../clear-n_.h" + +void +Spread::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Spread") "</name>\n" + "<id>org.inkscape.effect.bitmap.spread</id>\n" + "<param name=\"amount\" gui-text=\"" N_("Amount") "\" type=\"int\" min=\"0\" max=\"100\">3</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 Spread Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Spread()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/spread.h b/src/extension/internal/bitmap/spread.h new file mode 100644 index 000000000..82d955890 --- /dev/null +++ b/src/extension/internal/bitmap/spread.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Spread : public ImageMagick +{ +private: + int _amount; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/swirl.cpp b/src/extension/internal/bitmap/swirl.cpp new file mode 100644 index 000000000..a880552c6 --- /dev/null +++ b/src/extension/internal/bitmap/swirl.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "swirl.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Swirl::applyEffect(Magick::Image* image) { + image->swirl(_degrees); +} + +void +Swirl::refreshParameters(Inkscape::Extension::Effect* module) { + _degrees = module->get_param_float("degrees"); +} + +#include "../clear-n_.h" + +void +Swirl::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Swirl()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/swirl.h b/src/extension/internal/bitmap/swirl.h new file mode 100644 index 000000000..cea1850ea --- /dev/null +++ b/src/extension/internal/bitmap/swirl.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Swirl : public ImageMagick +{ +private: + double _degrees; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/threshold.cpp b/src/extension/internal/bitmap/threshold.cpp new file mode 100644 index 000000000..6f21e61d1 --- /dev/null +++ b/src/extension/internal/bitmap/threshold.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "threshold.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Threshold::applyEffect(Magick::Image* image) { + image->threshold(_threshold); +} + +void +Threshold::refreshParameters(Inkscape::Extension::Effect* module) { + _threshold = module->get_param_float("threshold"); +} + +#include "../clear-n_.h" + +void +Threshold::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Threshold") "</name>\n" + "<id>org.inkscape.effect.bitmap.threshold</id>\n" + "<param name=\"threshold\" gui-text=\"" N_("Threshold") "\" type=\"float\" min=\"-100.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 Threshold Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Threshold()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/threshold.h b/src/extension/internal/bitmap/threshold.h new file mode 100644 index 000000000..2e65a7a6f --- /dev/null +++ b/src/extension/internal/bitmap/threshold.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Threshold : public ImageMagick +{ +private: + double _threshold; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/unsharpmask.cpp b/src/extension/internal/bitmap/unsharpmask.cpp new file mode 100644 index 000000000..6e4a1759a --- /dev/null +++ b/src/extension/internal/bitmap/unsharpmask.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "unsharpmask.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Unsharpmask::applyEffect(Magick::Image* image) { + float amount = _amount / 100.0; + image->unsharpmask(_radius, _sigma, amount, _threshold); +} + +void +Unsharpmask::refreshParameters(Inkscape::Extension::Effect* module) { + _radius = module->get_param_float("radius"); + _sigma = module->get_param_float("sigma"); + _amount = module->get_param_float("amount"); + _threshold = module->get_param_float("threshold"); +} + +#include "../clear-n_.h" + +void +Unsharpmask::init(void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>" N_("Unsharp Mask") "</name>\n" + "<id>org.inkscape.effect.bitmap.unsharpmask</id>\n" + "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n" + "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n" + "<param name=\"amount\" gui-text=\"" N_("Amount") "\" type=\"float\" min=\"0.0\" max=\"100.0\">50.0</param>\n" + "<param name=\"threshold\" gui-text=\"" N_("Threshold") "\" type=\"float\" min=\"0.0\" max=\"50.0\">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 Unsharp Mask Effect") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Unsharpmask()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/unsharpmask.h b/src/extension/internal/bitmap/unsharpmask.h new file mode 100644 index 000000000..5d3a47ecf --- /dev/null +++ b/src/extension/internal/bitmap/unsharpmask.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Unsharpmask : public ImageMagick +{ +private: + float _radius; + float _sigma; + float _amount; + float _threshold; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/wave.cpp b/src/extension/internal/bitmap/wave.cpp new file mode 100644 index 000000000..c1a2994c0 --- /dev/null +++ b/src/extension/internal/bitmap/wave.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/effect.h" +#include "extension/system.h" + +#include "wave.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Wave::applyEffect(Magick::Image* image) { + image->wave(_amplitude, _wavelength); +} + +void +Wave::refreshParameters(Inkscape::Extension::Effect* module) { + _amplitude = module->get_param_float("amplitude"); + _wavelength = module->get_param_int("wavelength"); +} + +#include "../clear-n_.h" + +void +Wave::init(void) +{ + Inkscape::Extension::build_from_mem( + "<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" + "<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" + "</effect>\n" + "</inkscape-extension>\n", new Wave()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/wave.h b/src/extension/internal/bitmap/wave.h new file mode 100644 index 000000000..8ee1fc7f5 --- /dev/null +++ b/src/extension/internal/bitmap/wave.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2007 Authors: + * Christopher Brown <audiere@gmail.com> + * Ted Gould <ted@gould.cx> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "imagemagick.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +class Wave : public ImageMagick +{ +private: + float _amplitude; + int _wavelength; +public: + void applyEffect(Magick::Image *image); + void refreshParameters(Inkscape::Extension::Effect *module); + static void init(void); +}; + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ |
