+AC_ARG_WITH(magickpp,[
+ --without-magickpp Disable support for Magick++],[
+],[
+ with_magickpp="yes"
+])
+if test $with_magickpp = "yes" ; then {
+ AC_CHECK_HEADER([Magick++.h],[
+ MAGICKPP_LIBS="-lMagick++"
+ AC_DEFINE(HAVE_MAGICKPP,[], [ Define if Magick++ library is available ] )
+ AC_SUBST(MAGICKPP_LIBS)
+ AM_CONDITIONAL(HAVE_LIBMAGICKPP,true)
+ AC_CHECK_LIB(Magick++,OptimizeImageTransparency,[
+ AC_DEFINE(HAVE_MAGICK_OPTIMIZE,[], [ Define if Magick++ defines OptimizeImageTransparency() ] )
+ AM_CONDITIONAL(HAVE_MAGICK_OPTIMIZE,true)
+ ],[
+ AC_MSG_RESULT([ *** OptimizeImageTransparency() not available - need ImageMagick 6.3 or newer ])
+ AM_CONDITIONAL(HAVE_MAGICK_OPTIMIZE,false)
+ ])
+ ],[
+ with_magickpp="no"
+ AC_MSG_RESULT([ *** Magick++ Output target disabled])
+ TARGET_MAGICKPP="no"
+ AM_CONDITIONAL(HAVE_LIBMAGICKPP,false)
+ ])
+} else {
+ AM_CONDITIONAL(HAVE_LIBMAGICKPP,false)
+} ; fi
+
+
+
+
AC_ARG_WITH(ffmpeg,[
--without-ffmpeg Disable support for FFMPEG],[
],[
src/modules/mod_imagemagick/Makefile
src/modules/mod_jpeg/Makefile
src/modules/mod_libavcodec/Makefile
+src/modules/mod_magickpp/Makefile
src/modules/mod_mng/Makefile
src/modules/mod_noise/Makefile
src/modules/mod_openexr/Makefile
libavcodec -----------------------> $with_libavcodec
vImage ---------------------------> $with_vimage
ImageMagick ----------------------> $with_imagemagick
+Magick++ -------------------------> $with_magickpp
FFMPEG ---------------------------> $with_ffmpeg
libdv ----------------------------> $with_libdv
OpenEXR --------------------------> $with_openexr
synfiglibdir=@SYNFIGLIB_DIR@
MAINTAINERCLEANFILES=Makefile.in
-SUBDIRS=mod_particle mod_filter mod_yuv420p mod_gif mod_gradient mod_geometry mod_noise mod_libavcodec mod_jpeg mod_openexr mod_bmp mod_ppm mod_png mod_dv mod_imagemagick mod_ffmpeg lyr_freetype lyr_std mod_mng
-EXTRA_DIST=untemplate.nsh template.nsh example/simplecircle.h example/simplecircle.cpp example/filledrect.h example/main.cpp example/Makefile.am example/filledrect.cpp example/metaballs.cpp example/metaballs.h mod_mng/trgt_mng.h mod_mng/unmod_mng.nsh mod_mng/main.cpp mod_mng/Makefile.am mod_mng/mod_mng.nsh mod_mng/trgt_mng.cpp mptr_mplayer/main.cpp mptr_mplayer/mptr_mplayer.h mptr_mplayer/Makefile.am mptr_mplayer/mptr_mplayer.cpp
+SUBDIRS=mod_particle mod_filter mod_yuv420p mod_gif mod_gradient mod_geometry mod_noise mod_libavcodec mod_jpeg mod_openexr mod_bmp mod_ppm mod_png mod_dv mod_imagemagick mod_ffmpeg lyr_freetype lyr_std mod_mng mod_magickpp
+EXTRA_DIST=untemplate.nsh template.nsh example/simplecircle.h example/simplecircle.cpp example/filledrect.h example/main.cpp example/Makefile.am example/filledrect.cpp example/metaballs.cpp example/metaballs.h mod_mng/trgt_mng.h mod_mng/unmod_mng.nsh mod_mng/main.cpp mod_mng/Makefile.am mod_mng/mod_mng.nsh mod_mng/trgt_mng.cpp mptr_mplayer/main.cpp mptr_mplayer/mptr_mplayer.h mptr_mplayer/Makefile.am mptr_mplayer/mptr_mplayer.cpp mod_magickpp/trgt_magickpp.h mod_magickpp/unmod_magickpp.nsh mod_magickpp/main.cpp mod_magickpp/Makefile.am mod_magickpp/mod_magickpp.nsh mod_magickpp/trgt_magickpp.cpp
sysconf_DATA = synfig_modules.cfg
--- /dev/null
+# $Id$
+
+MAINTAINERCLEANFILES=Makefile.in
+INCLUDES = -I$(top_srcdir)/src
+
+moduledir=@MODULE_DIR@
+
+if HAVE_LIBMAGICKPP
+module_LTLIBRARIES = libmod_magickpp.la
+libmod_magickpp_la_SOURCES = main.cpp trgt_magickpp.cpp trgt_magickpp.h
+libmod_magickpp_la_LDFLAGS = -module @MAGICKPP_LIBS@ -no-undefined
+libmod_magickpp_la_CXXFLAGS = @SYNFIG_CFLAGS@
+libmod_magickpp_la_LIBADD = -L../../synfig -lsynfig @SYNFIG_LIBS@
+else
+endif
+EXTRA_DIST= mod_magickpp.nsh unmod_magickpp.nsh
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file mod_magickpp/main.cpp
+** \brief Magick++ plugin
+**
+** $Id$
+**
+** \legal
+** Copyright 2007 Chris Moore
+**
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
+** \endlegal
+**
+** === N O T E S ===========================================================
+**
+** ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#define SYNFIG_MODULE
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <synfig/module.h>
+#include "trgt_magickpp.h"
+#endif
+
+/* === E N T R Y P O I N T ================================================= */
+
+MODULE_DESC_BEGIN(mod_magickpp)
+ MODULE_NAME("Magick++ Module (libMagick++)")
+ MODULE_DESCRIPTION("Provides an animated GIF target")
+ MODULE_AUTHOR("Chris Moore")
+ MODULE_VERSION("1.0")
+ MODULE_COPYRIGHT(SYNFIG_COPYRIGHT)
+MODULE_DESC_END
+
+MODULE_INVENTORY_BEGIN(mod_magickpp)
+ BEGIN_TARGETS
+ TARGET(magickpp_trgt)
+ END_TARGETS
+MODULE_INVENTORY_END
--- /dev/null
+Section "mod_magickpp" Sec_mod_magickpp
+ SetOutPath "$INSTDIR\lib\synfig\modules"
+ File /oname=mod_magickpp.dll "src\modules\mod_magickpp\.libs\libmod_magickpp-0.dll"
+ FileOpen $0 $INSTDIR\etc\synfig_modules.cfg a
+ FileSeek $0 0 END
+ FileWrite $0 "mod_magickpp"
+ FileWriteByte $0 "13"
+ FileWriteByte $0 "10"
+ FileClose $0
+SectionEnd
+
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file trgt_magickpp.cpp
+** \brief Magick++ Target Module
+**
+** $Id$
+**
+** \legal
+** Copyright 2007 Chris Moore
+**
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
+** \endlegal
+**
+** === N O T E S ===========================================================
+**
+** ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#define SYNFIG_TARGET
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <ETL/misc>
+#include "trgt_magickpp.h"
+
+#endif
+
+/* === M A C R O S ========================================================= */
+
+using namespace synfig;
+using namespace std;
+using namespace etl;
+
+/* === G L O B A L S ======================================================= */
+
+SYNFIG_TARGET_INIT(magickpp_trgt);
+SYNFIG_TARGET_SET_NAME(magickpp_trgt,"magick++");
+SYNFIG_TARGET_SET_EXT(magickpp_trgt,"gif");
+SYNFIG_TARGET_SET_VERSION(magickpp_trgt,"0.1");
+SYNFIG_TARGET_SET_CVS_ID(magickpp_trgt,"$Id$");
+
+/* === M E T H O D S ======================================================= */
+
+magickpp_trgt::~magickpp_trgt()
+{
+ MagickLib::ExceptionInfo exceptionInfo;
+ MagickLib::GetExceptionInfo(&exceptionInfo);
+
+ // check whether this file format supports multiple-image files
+ Magick::Image image(*(images.begin()));
+ image.fileName(filename);
+ SetImageInfo(image.imageInfo(),Magick::MagickTrue,&exceptionInfo);
+
+ // the file type is now in image.imageInfo()->magick and
+ // image.adjoin() tells us whether we can write to a single file
+ if (image.adjoin())
+ {
+ unsigned int delay = round_to_int(100.0 / desc.get_frame_rate());
+ for_each(images.begin(), images.end(), Magick::animationDelayImage(delay));
+
+ // if we can write multiple images to a single file, optimize
+ // the images (only write the pixels that change from frame to
+ // frame
+#ifdef HAVE_MAGICK_OPTIMIZE
+ linkImages(images.begin(), images.end());
+ OptimizeImageTransparency(images.begin()->image(),&exceptionInfo);
+ unlinkImages(images.begin(), images.end());
+#else
+ // linkImages(images.begin(), images.end());
+ // MagickLib::Image* new_images = DeconstructImages(images.begin()->image(),&exceptionInfo);
+ // unlinkImages(images.begin(), images.end());
+ // images.clear();
+ // insertImages(&images, new_images);
+#endif
+ }
+ else
+ // if we can't write multiple images to a file of this type,
+ // include '%04d' in the filename, so the files will be numbered
+ // with a fixed width, '0'-padded number
+ filename = (filename_sans_extension(filename) + ".%04d" + filename_extension(filename));
+
+ Magick::writeImages(images.begin(), images.end(), filename);
+
+ if (buffer != NULL) delete [] buffer;
+ if (color_buffer != NULL) delete [] color_buffer;
+}
+
+bool
+magickpp_trgt::set_rend_desc(RendDesc *given_desc)
+{
+ desc = *given_desc;
+ return true;
+}
+
+bool
+magickpp_trgt::init()
+{
+ width = desc.get_w();
+ height = desc.get_h();
+
+ buffer = new unsigned char[4*width*height];
+ if (buffer == NULL)
+ return false;
+
+ color_buffer = new Color[width];
+ if (color_buffer == NULL)
+ {
+ delete [] buffer;
+ return false;
+ }
+
+ return true;
+}
+
+void
+magickpp_trgt::end_frame()
+{
+ Magick::Image image(width, height, "RGBA", Magick::CharPixel, buffer);
+ images.push_back(image);
+}
+
+bool
+magickpp_trgt::start_frame(synfig::ProgressCallback *callback)
+{
+ row = 0;
+ return true;
+}
+
+Color*
+magickpp_trgt::start_scanline(int scanline)
+{
+ return color_buffer;
+}
+
+bool
+magickpp_trgt::end_scanline()
+{
+ convert_color_format(buffer + row++ * width*4, color_buffer, width, PF_RGB|PF_A, gamma());
+ return true;
+}
--- /dev/null
+/*! ========================================================================
+** Synfig
+**
+** Copyright (c) 2007 Chris Moore
+**
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
+**
+** === N O T E S ===========================================================
+**
+** ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_TRGT_MAGICKPP_H
+#define __SYNFIG_TRGT_MAGICKPP_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/target_scanline.h>
+#include <synfig/string.h>
+#include <cstdio>
+
+#include <vector>
+#include <Magick++.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+class magickpp_trgt : public synfig::Target_Scanline
+{
+ SYNFIG_TARGET_MODULE_EXT
+
+private:
+
+ int width, height, row;
+
+ synfig::String filename;
+ unsigned char *buffer;
+ synfig::Color *color_buffer;
+ std::vector<Magick::Image> images;
+
+public:
+
+ magickpp_trgt(const char *filename) : filename(filename) { }
+ virtual ~magickpp_trgt();
+
+ virtual bool set_rend_desc(synfig::RendDesc *desc);
+ virtual bool init();
+
+ virtual bool start_frame(synfig::ProgressCallback *cb);
+ virtual void end_frame();
+
+ virtual synfig::Color* start_scanline(int scanline);
+ virtual bool end_scanline();
+};
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+Section "un.mod_magicpp"
+ Delete "$INSTDIR\lib\synfig\modules\mod_magicpp.dll"
+ RMDir "$INSTDIR"
+SectionEnd
+
mod_jpeg
mod_libavcodec
mod_yuv420p
+mod_magickpp