From 77f2a5f29601711a1177eef5a01855e9cdb30b34 Mon Sep 17 00:00:00 2001 From: gouldtj Date: Tue, 30 Oct 2007 19:30:20 +0000 Subject: [PATCH] r16895@shi: ted | 2007-10-30 09:35:24 -0700 Adding in Chris' downsample patch. --- src/extension/init.cpp | 2 + src/extension/internal/Makefile_insert | 50 ++++++++++----------- src/extension/internal/bitmap/sample.cpp | 55 ++++++++++++++++++++++++ src/extension/internal/bitmap/sample.h | 30 +++++++++++++ 4 files changed, 113 insertions(+), 24 deletions(-) create mode 100644 src/extension/internal/bitmap/sample.cpp create mode 100644 src/extension/internal/bitmap/sample.h diff --git a/src/extension/init.cpp b/src/extension/init.cpp index 8c2be3e28..3a9f1e9aa 100644 --- a/src/extension/init.cpp +++ b/src/extension/init.cpp @@ -85,6 +85,7 @@ #include "internal/bitmap/opacity.h" #include "internal/bitmap/raise.h" #include "internal/bitmap/reduceNoise.h" +#include "internal/bitmap/sample.h" #include "internal/bitmap/shade.h" #include "internal/bitmap/sharpen.h" #include "internal/bitmap/solarize.h" @@ -214,6 +215,7 @@ init() Internal::Bitmap::Opacity::init(); Internal::Bitmap::Raise::init(); Internal::Bitmap::ReduceNoise::init(); + Internal::Bitmap::Sample::init(); Internal::Bitmap::Shade::init(); Internal::Bitmap::Sharpen::init(); Internal::Bitmap::Solarize::init(); diff --git a/src/extension/internal/Makefile_insert b/src/extension/internal/Makefile_insert index dc2d9bbf3..87d76a3ec 100644 --- a/src/extension/internal/Makefile_insert +++ b/src/extension/internal/Makefile_insert @@ -6,17 +6,17 @@ extension/internal/clean: rm -f extension/internal/libinternal.a $(extension_internal_libinternal_OBJECTS) if USE_IMAGE_MAGICK -extension_internal_image_magick_sources = \ +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/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/blur.cpp \ + extension/internal/bitmap/blur.h \ extension/internal/bitmap/channel.cpp \ - extension/internal/bitmap/channel.h \ + extension/internal/bitmap/channel.h \ extension/internal/bitmap/charcoal.cpp \ extension/internal/bitmap/charcoal.h \ extension/internal/bitmap/colorize.cpp \ @@ -27,20 +27,20 @@ extension_internal_image_magick_sources = \ 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/edge.cpp \ + extension/internal/bitmap/edge.h \ extension/internal/bitmap/emboss.cpp \ - extension/internal/bitmap/emboss.h \ + extension/internal/bitmap/emboss.h \ extension/internal/bitmap/enhance.cpp \ - extension/internal/bitmap/enhance.h \ + extension/internal/bitmap/enhance.h \ extension/internal/bitmap/equalize.cpp \ extension/internal/bitmap/equalize.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/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 \ @@ -48,32 +48,34 @@ extension_internal_image_magick_sources = \ extension/internal/bitmap/modulate.cpp \ extension/internal/bitmap/modulate.h \ extension/internal/bitmap/negate.cpp \ - extension/internal/bitmap/negate.h \ + 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/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/sample.cpp \ + extension/internal/bitmap/sample.h \ + extension/internal/bitmap/shade.cpp \ + extension/internal/bitmap/shade.h \ extension/internal/bitmap/sharpen.cpp \ - extension/internal/bitmap/sharpen.h \ + 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/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.cpp \ extension/internal/bitmap/wave.h endif diff --git a/src/extension/internal/bitmap/sample.cpp b/src/extension/internal/bitmap/sample.cpp new file mode 100644 index 000000000..9c245432a --- /dev/null +++ b/src/extension/internal/bitmap/sample.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 "sample.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Bitmap { + +void +Sample::applyEffect(Magick::Image* image) { + Magick::Geometry geometry(_width, _height, 0, 0); + image->sample(geometry); +} + +void +Sample::refreshParameters(Inkscape::Extension::Effect* module) { + _width = module->get_param_int("width"); + _height = module->get_param_int("height"); +} + +#include "../clear-n_.h" + +void +Sample::init(void) +{ + Inkscape::Extension::build_from_mem( + "\n" + "" N_("Sample") "\n" + "org.inkscape.effect.bitmap.sample\n" + "100\n" + "100\n" + "\n" + "all\n" + "\n" + "\n" + "\n" + "" N_("Alter the resolution of selected image by resizing it by given dimensions.") "\n" + "\n" + "\n", new Sample()); +} + +}; /* namespace Bitmap */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ diff --git a/src/extension/internal/bitmap/sample.h b/src/extension/internal/bitmap/sample.h new file mode 100644 index 000000000..a378229d9 --- /dev/null +++ b/src/extension/internal/bitmap/sample.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 Sample : 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 */ -- 2.30.2