From b29eafffd0b92cc7b67e5cd877aad5e98b0f0231 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 10 Aug 2007 17:38:51 +0000 Subject: r16217@tres: ted | 2007-08-10 10:36:27 -0700 ImageMagick effects patch from Chris Brown. Google Summer of Code project. (bzr r3450) --- src/extension/internal/Makefile_insert | 80 +++++++++- .../internal/bitmap/adaptiveThreshold.cpp | 54 +++++++ src/extension/internal/bitmap/adaptiveThreshold.h | 30 ++++ src/extension/internal/bitmap/addNoise.cpp | 67 ++++++++ src/extension/internal/bitmap/addNoise.h | 29 ++++ src/extension/internal/bitmap/blur.cpp | 54 +++++++ src/extension/internal/bitmap/blur.h | 30 ++++ src/extension/internal/bitmap/channel.cpp | 73 +++++++++ src/extension/internal/bitmap/channel.h | 31 ++++ src/extension/internal/bitmap/charcoal.cpp | 54 +++++++ src/extension/internal/bitmap/charcoal.h | 30 ++++ src/extension/internal/bitmap/colorize.cpp | 76 +++++++++ src/extension/internal/bitmap/colorize.h | 33 ++++ src/extension/internal/bitmap/contrast.cpp | 53 +++++++ src/extension/internal/bitmap/contrast.h | 29 ++++ src/extension/internal/bitmap/convolve.cpp | 54 +++++++ src/extension/internal/bitmap/convolve.h | 29 ++++ src/extension/internal/bitmap/cycleColormap.cpp | 52 ++++++ src/extension/internal/bitmap/cycleColormap.h | 28 ++++ src/extension/internal/bitmap/despeckle.cpp | 51 ++++++ src/extension/internal/bitmap/despeckle.h | 26 +++ src/extension/internal/bitmap/edge.cpp | 52 ++++++ src/extension/internal/bitmap/edge.h | 28 ++++ src/extension/internal/bitmap/emboss.cpp | 54 +++++++ src/extension/internal/bitmap/emboss.h | 30 ++++ src/extension/internal/bitmap/enhance.cpp | 51 ++++++ src/extension/internal/bitmap/enhance.h | 27 ++++ src/extension/internal/bitmap/equalize.cpp | 51 ++++++ src/extension/internal/bitmap/equalize.h | 27 ++++ src/extension/internal/bitmap/flop.cpp | 51 ++++++ src/extension/internal/bitmap/flop.h | 27 ++++ src/extension/internal/bitmap/gaussianBlur.cpp | 54 +++++++ src/extension/internal/bitmap/gaussianBlur.h | 30 ++++ src/extension/internal/bitmap/imagemagick.cpp | 175 +++++++++++++++++++++ src/extension/internal/bitmap/imagemagick.h | 51 ++++++ src/extension/internal/bitmap/implode.cpp | 52 ++++++ src/extension/internal/bitmap/implode.h | 29 ++++ src/extension/internal/bitmap/level.cpp | 58 +++++++ src/extension/internal/bitmap/level.h | 31 ++++ src/extension/internal/bitmap/levelChannel.cpp | 80 ++++++++++ src/extension/internal/bitmap/levelChannel.h | 32 ++++ src/extension/internal/bitmap/medianFilter.cpp | 52 ++++++ src/extension/internal/bitmap/medianFilter.h | 29 ++++ src/extension/internal/bitmap/modulate.cpp | 57 +++++++ src/extension/internal/bitmap/modulate.h | 31 ++++ src/extension/internal/bitmap/negate.cpp | 50 ++++++ src/extension/internal/bitmap/negate.h | 27 ++++ src/extension/internal/bitmap/normalize.cpp | 50 ++++++ src/extension/internal/bitmap/normalize.h | 27 ++++ src/extension/internal/bitmap/oilPaint.cpp | 52 ++++++ src/extension/internal/bitmap/oilPaint.h | 29 ++++ src/extension/internal/bitmap/opacity.cpp | 53 +++++++ src/extension/internal/bitmap/opacity.h | 29 ++++ src/extension/internal/bitmap/raise.cpp | 61 +++++++ src/extension/internal/bitmap/raise.h | 33 ++++ src/extension/internal/bitmap/reduceNoise.cpp | 55 +++++++ src/extension/internal/bitmap/reduceNoise.h | 29 ++++ src/extension/internal/bitmap/shade.cpp | 56 +++++++ src/extension/internal/bitmap/shade.h | 31 ++++ src/extension/internal/bitmap/sharpen.cpp | 54 +++++++ src/extension/internal/bitmap/sharpen.h | 30 ++++ src/extension/internal/bitmap/solarize.cpp | 52 ++++++ src/extension/internal/bitmap/solarize.h | 29 ++++ src/extension/internal/bitmap/spread.cpp | 52 ++++++ src/extension/internal/bitmap/spread.h | 29 ++++ src/extension/internal/bitmap/swirl.cpp | 52 ++++++ src/extension/internal/bitmap/swirl.h | 29 ++++ src/extension/internal/bitmap/threshold.cpp | 52 ++++++ src/extension/internal/bitmap/threshold.h | 29 ++++ src/extension/internal/bitmap/unsharpmask.cpp | 59 +++++++ src/extension/internal/bitmap/unsharpmask.h | 32 ++++ src/extension/internal/bitmap/wave.cpp | 54 +++++++ src/extension/internal/bitmap/wave.h | 30 ++++ 73 files changed, 3286 insertions(+), 1 deletion(-) create mode 100644 src/extension/internal/bitmap/adaptiveThreshold.cpp create mode 100644 src/extension/internal/bitmap/adaptiveThreshold.h create mode 100644 src/extension/internal/bitmap/addNoise.cpp create mode 100644 src/extension/internal/bitmap/addNoise.h create mode 100644 src/extension/internal/bitmap/blur.cpp create mode 100644 src/extension/internal/bitmap/blur.h create mode 100644 src/extension/internal/bitmap/channel.cpp create mode 100644 src/extension/internal/bitmap/channel.h create mode 100644 src/extension/internal/bitmap/charcoal.cpp create mode 100644 src/extension/internal/bitmap/charcoal.h create mode 100644 src/extension/internal/bitmap/colorize.cpp create mode 100644 src/extension/internal/bitmap/colorize.h create mode 100644 src/extension/internal/bitmap/contrast.cpp create mode 100644 src/extension/internal/bitmap/contrast.h create mode 100644 src/extension/internal/bitmap/convolve.cpp create mode 100644 src/extension/internal/bitmap/convolve.h create mode 100644 src/extension/internal/bitmap/cycleColormap.cpp create mode 100644 src/extension/internal/bitmap/cycleColormap.h create mode 100644 src/extension/internal/bitmap/despeckle.cpp create mode 100644 src/extension/internal/bitmap/despeckle.h create mode 100644 src/extension/internal/bitmap/edge.cpp create mode 100644 src/extension/internal/bitmap/edge.h create mode 100644 src/extension/internal/bitmap/emboss.cpp create mode 100644 src/extension/internal/bitmap/emboss.h create mode 100644 src/extension/internal/bitmap/enhance.cpp create mode 100644 src/extension/internal/bitmap/enhance.h create mode 100644 src/extension/internal/bitmap/equalize.cpp create mode 100644 src/extension/internal/bitmap/equalize.h create mode 100644 src/extension/internal/bitmap/flop.cpp create mode 100644 src/extension/internal/bitmap/flop.h create mode 100644 src/extension/internal/bitmap/gaussianBlur.cpp create mode 100644 src/extension/internal/bitmap/gaussianBlur.h create mode 100644 src/extension/internal/bitmap/imagemagick.cpp create mode 100644 src/extension/internal/bitmap/imagemagick.h create mode 100644 src/extension/internal/bitmap/implode.cpp create mode 100644 src/extension/internal/bitmap/implode.h create mode 100644 src/extension/internal/bitmap/level.cpp create mode 100644 src/extension/internal/bitmap/level.h create mode 100644 src/extension/internal/bitmap/levelChannel.cpp create mode 100644 src/extension/internal/bitmap/levelChannel.h create mode 100644 src/extension/internal/bitmap/medianFilter.cpp create mode 100644 src/extension/internal/bitmap/medianFilter.h create mode 100644 src/extension/internal/bitmap/modulate.cpp create mode 100644 src/extension/internal/bitmap/modulate.h create mode 100644 src/extension/internal/bitmap/negate.cpp create mode 100644 src/extension/internal/bitmap/negate.h create mode 100644 src/extension/internal/bitmap/normalize.cpp create mode 100644 src/extension/internal/bitmap/normalize.h create mode 100644 src/extension/internal/bitmap/oilPaint.cpp create mode 100644 src/extension/internal/bitmap/oilPaint.h create mode 100644 src/extension/internal/bitmap/opacity.cpp create mode 100644 src/extension/internal/bitmap/opacity.h create mode 100644 src/extension/internal/bitmap/raise.cpp create mode 100644 src/extension/internal/bitmap/raise.h create mode 100644 src/extension/internal/bitmap/reduceNoise.cpp create mode 100644 src/extension/internal/bitmap/reduceNoise.h create mode 100644 src/extension/internal/bitmap/shade.cpp create mode 100644 src/extension/internal/bitmap/shade.h create mode 100644 src/extension/internal/bitmap/sharpen.cpp create mode 100644 src/extension/internal/bitmap/sharpen.h create mode 100644 src/extension/internal/bitmap/solarize.cpp create mode 100644 src/extension/internal/bitmap/solarize.h create mode 100644 src/extension/internal/bitmap/spread.cpp create mode 100644 src/extension/internal/bitmap/spread.h create mode 100644 src/extension/internal/bitmap/swirl.cpp create mode 100644 src/extension/internal/bitmap/swirl.h create mode 100644 src/extension/internal/bitmap/threshold.cpp create mode 100644 src/extension/internal/bitmap/threshold.h create mode 100644 src/extension/internal/bitmap/unsharpmask.cpp create mode 100644 src/extension/internal/bitmap/unsharpmask.h create mode 100644 src/extension/internal/bitmap/wave.cpp create mode 100644 src/extension/internal/bitmap/wave.h (limited to 'src/extension/internal') diff --git a/src/extension/internal/Makefile_insert b/src/extension/internal/Makefile_insert index f615e02fd..418498efd 100644 --- a/src/extension/internal/Makefile_insert +++ b/src/extension/internal/Makefile_insert @@ -11,6 +11,82 @@ extension_internal_gnome_print_sources = \ extension/internal/gnome.h endif +if USE_IMAGE_MAGICK +extension_internal_image_magick_sources = \ + extension/internal/bitmap/imagemagick.cpp \ + extension/internal/bitmap/imagemagick.h \ + extension/internal/bitmap/adaptiveThreshold.cpp \ + extension/internal/bitmap/adaptiveThreshold.h \ + extension/internal/bitmap/addNoise.cpp \ + extension/internal/bitmap/addNoise.h \ + extension/internal/bitmap/blur.cpp \ + extension/internal/bitmap/blur.h \ + extension/internal/bitmap/channel.cpp \ + extension/internal/bitmap/channel.h \ + extension/internal/bitmap/charcoal.cpp \ + extension/internal/bitmap/charcoal.h \ + extension/internal/bitmap/colorize.cpp \ + extension/internal/bitmap/colorize.h \ + extension/internal/bitmap/contrast.cpp \ + extension/internal/bitmap/contrast.h \ + extension/internal/bitmap/convolve.cpp \ + extension/internal/bitmap/convolve.h \ + extension/internal/bitmap/cycleColormap.cpp \ + extension/internal/bitmap/cycleColormap.h \ + extension/internal/bitmap/despeckle.cpp \ + extension/internal/bitmap/despeckle.h \ + extension/internal/bitmap/edge.cpp \ + extension/internal/bitmap/edge.h \ + extension/internal/bitmap/emboss.cpp \ + extension/internal/bitmap/emboss.h \ + extension/internal/bitmap/enhance.cpp \ + extension/internal/bitmap/enhance.h \ + extension/internal/bitmap/equalize.cpp \ + extension/internal/bitmap/equalize.h \ + extension/internal/bitmap/flop.cpp \ + extension/internal/bitmap/flop.h \ + extension/internal/bitmap/gaussianBlur.cpp \ + extension/internal/bitmap/gaussianBlur.h \ + extension/internal/bitmap/implode.cpp \ + extension/internal/bitmap/implode.h \ + extension/internal/bitmap/level.cpp \ + extension/internal/bitmap/level.h \ + extension/internal/bitmap/levelChannel.cpp \ + extension/internal/bitmap/levelChannel.h \ + extension/internal/bitmap/medianFilter.cpp \ + extension/internal/bitmap/medianFilter.h \ + extension/internal/bitmap/modulate.cpp \ + extension/internal/bitmap/modulate.h \ + extension/internal/bitmap/negate.cpp \ + extension/internal/bitmap/negate.h \ + extension/internal/bitmap/normalize.cpp \ + extension/internal/bitmap/normalize.h \ + extension/internal/bitmap/oilPaint.cpp \ + extension/internal/bitmap/oilPaint.h \ + extension/internal/bitmap/opacity.cpp \ + extension/internal/bitmap/opacity.h \ + extension/internal/bitmap/raise.cpp \ + extension/internal/bitmap/raise.h \ + extension/internal/bitmap/reduceNoise.cpp \ + extension/internal/bitmap/reduceNoise.h \ + extension/internal/bitmap/shade.cpp \ + extension/internal/bitmap/shade.h \ + extension/internal/bitmap/sharpen.cpp \ + extension/internal/bitmap/sharpen.h \ + extension/internal/bitmap/solarize.cpp \ + extension/internal/bitmap/solarize.h \ + extension/internal/bitmap/spread.cpp \ + extension/internal/bitmap/spread.h \ + extension/internal/bitmap/swirl.cpp \ + extension/internal/bitmap/swirl.h \ + extension/internal/bitmap/threshold.cpp \ + extension/internal/bitmap/threshold.h \ + extension/internal/bitmap/unsharpmask.cpp \ + extension/internal/bitmap/unsharpmask.h \ + extension/internal/bitmap/wave.cpp \ + extension/internal/bitmap/wave.h +endif + extension_internal_libinternal_a_SOURCES = \ extension/internal/bluredge.h \ extension/internal/bluredge.cpp \ @@ -63,4 +139,6 @@ extension_internal_libinternal_a_SOURCES = \ extension/internal/latex-pstricks-out.h \ extension/internal/wpg-input.cpp \ extension/internal/wpg-input.h \ - $(extension_internal_gnome_print_sources) + $(extension_internal_gnome_print_sources) \ + $(extension_internal_image_magick_sources) + 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Adaptive Threshold") "\n" + "org.inkscape.effect.bitmap.adaptiveThreshold\n" + "5\n" + "1\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Adaptive Threshold Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Add Noise") "\n" + "org.inkscape.effect.bitmap.addNoise\n" + "\n" + "Uniform Noise\n" + "Gaussian Noise\n" + "Multiplicative Gaussian Noise\n" + "Impulse Noise\n" + "Laplacian Noise\n" + "Poisson Noise\n" + "\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Add Noise Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Blur") "\n" + "org.inkscape.effect.bitmap.blur\n" + "5.0\n" + "1.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Blur Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Channel") "\n" + "org.inkscape.effect.bitmap.channel\n" + "\n" + "Red Channel\n" + "Green Channel\n" + "Blue Channel\n" + "Cyan Channel\n" + "Magenta Channel\n" + "Yellow Channel\n" + "Black Channel\n" + "Opacity Channel\n" + "Matte Channel\n" + "\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Channel Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Charcoal") "\n" + "org.inkscape.effect.bitmap.charcoal\n" + "5.0\n" + "1.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Charcoal Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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 + +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( + "\n" + "" N_("Colorize") "\n" + "org.inkscape.effect.bitmap.colorize\n" + "#FF0000\n" + "1\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Colorize Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Contrast") "\n" + "org.inkscape.effect.bitmap.contrast\n" + "1\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Contrast Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Convolve") "\n" + "org.inkscape.effect.bitmap.convolve\n" + "1\n" + "1,1,1,0,0,0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Convolve Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Cycle Colormap") "\n" + "org.inkscape.effect.bitmap.cycleColormap\n" + "1\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Cycle Colormap Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Despeckle") "\n" + "org.inkscape.effect.bitmap.despeckle\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Despeckle Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Edge") "\n" + "org.inkscape.effect.bitmap.edge\n" + "5\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Edge Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Emboss") "\n" + "org.inkscape.effect.bitmap.emboss\n" + "5.0\n" + "1.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Emboss Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Enhance") "\n" + "org.inkscape.effect.bitmap.enhance\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Enhance Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Equalize") "\n" + "org.inkscape.effect.bitmap.equalize\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Equalize Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Flop") "\n" + "org.inkscape.effect.bitmap.flop\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Flop Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Gaussian Blur") "\n" + "org.inkscape.effect.bitmap.gaussianBlur\n" + "5.0\n" + "5.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Gaussian Blur Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * Copyright (C) 2007 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include +#include +#include + +#include + +#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(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 * changeSignal) +{ + SPDocument * current_document = view->doc(); + + using Inkscape::Util::GSListConstIterator; + GSListConstIterator 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 + * Ted Gould + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "extension/implementation/implementation.h" +#include "extension/extension-forward.h" +#include + +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 * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Implode") "\n" + "org.inkscape.effect.bitmap.implode\n" + "5.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Implode Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Level") "\n" + "org.inkscape.effect.bitmap.level\n" + "0.0\n" + "100.0\n" + "1.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Level Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Level (with Channel)") "\n" + "org.inkscape.effect.bitmap.levelChannel\n" + "\n" + "Red Channel\n" + "Green Channel\n" + "Blue Channel\n" + "Cyan Channel\n" + "Magenta Channel\n" + "Yellow Channel\n" + "Black Channel\n" + "Opacity Channel\n" + "Matte Channel\n" + "\n" + "0.0\n" + "100.0\n" + "1.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Level (with Channel) Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Median Filter") "\n" + "org.inkscape.effect.bitmap.medianFilter\n" + "5.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Median Filter Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Modulate") "\n" + "org.inkscape.effect.bitmap.modulate\n" + "1.0\n" + "1.0\n" + "0.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Modulate Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Negate") "\n" + "org.inkscape.effect.bitmap.negate\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Negate Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Normalize") "\n" + "org.inkscape.effect.bitmap.normalize\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Normalize Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Oil Paint") "\n" + "org.inkscape.effect.bitmap.oilPaint\n" + "3\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply OilPaint Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Opacity") "\n" + "org.inkscape.effect.bitmap.opacity\n" + "80.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Opacity Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Raise") "\n" + "org.inkscape.effect.bitmap.raise\n" + "6\n" + "6\n" + "0\n" + "0\n" + "0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Raise Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Reduce Noise") "\n" + "org.inkscape.effect.bitmap.reduceNoise\n" + "-1\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply ReduceNoise Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Shade") "\n" + "org.inkscape.effect.bitmap.shade\n" + "30\n" + "30\n" + "0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Shade Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Sharpen") "\n" + "org.inkscape.effect.bitmap.sharpen\n" + "1.0\n" + "0.5\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Sharpen Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Solarize") "\n" + "org.inkscape.effect.bitmap.solarize\n" + "50.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Solarize Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Spread") "\n" + "org.inkscape.effect.bitmap.spread\n" + "3\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Spread Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Swirl") "\n" + "org.inkscape.effect.bitmap.swirl\n" + "30\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Swirl Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Threshold") "\n" + "org.inkscape.effect.bitmap.threshold\n" + "\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Threshold Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Unsharp Mask") "\n" + "org.inkscape.effect.bitmap.unsharpmask\n" + "5.0\n" + "5.0\n" + "50.0\n" + "5.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Unsharp Mask Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 + * Ted Gould + * + * 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( + "\n" + "" N_("Wave") "\n" + "org.inkscape.effect.bitmap.wave\n" + "25.0\n" + "150.0\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Apply Wave Effect") "\n" + "\n" + "\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 + * Ted Gould + * + * 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 */ -- cgit v1.2.3