From: ishmal Date: Sun, 19 Aug 2007 01:01:08 +0000 (+0000) Subject: fix build for boost and imagemagick X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=51a7ed2e71d7d651612a02fec497a11c4930752f;p=inkscape.git fix build for boost and imagemagick --- diff --git a/build.xml b/build.xml index 7e152429d..f17afa30f 100644 --- a/build.xml +++ b/build.xml @@ -50,7 +50,6 @@ - @@ -146,6 +145,9 @@ /* use poppler for pdf import? */ #define HAVE_POPPLER 1 + + /* do we want bitmap manipulation? */ + #define WITH_IMAGE_MAGICK 1 #endif /* _CONFIG_H_ */ @@ -248,7 +250,6 @@ - -Wall -O3 @@ -291,9 +292,6 @@ -Wno-comment -I${gtk}/perl/lib/CORE -I${gtk}/python/include - - - -I${boost} @@ -381,10 +379,11 @@ -lpoppler ${gtk}/lib/iconv.lib -lfreetype.dll -lfontconfig.dll - -llcms.dll -lssl -lcrypto - -lpng -ljpeg.dll -lpopt ${gtk}/lib/zdll.lib - -lgc -mconsole -lws2_32 -lintl -lgdi32 -lcomdlg32 -lm + -lMagick++ -lWand -lMagick + -llcms.dll + -lpng -ljpeg.dll -ltiff.dll -lpopt ${gtk}/lib/zdll.lib + -lgc -lws2_32 -lintl -lgdi32 -lcomdlg32 -lm diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index 83650aaa7..db67294ea 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -55,7 +55,7 @@ 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); + char *search = (char *) g_strndup(xlink, 30); if (strstr(search, "base64") != (char*)NULL) { // 7 = strlen("base64") + strlen(",") char* pureBase64 = strstr(xlink, "base64") + 7; @@ -116,11 +116,12 @@ ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::Vi 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; + + /* + const int raw_len = raw_string.length(); + const char *raw_i = raw; + int formatted_len = (int)(raw_len / 76.0 * 78.0) + 100; char *formatted = new char[formatted_len]; char *formatted_i = formatted; // data:image/png;base64, @@ -140,8 +141,27 @@ ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::Vi } formatted_i = stpcpy(formatted_i, "\0"); - + _nodes[i]->setAttribute("xlink:href", formatted, true); + */ + + Glib::ustring buf = "data:image/"; + buf.append(effectedImage.magick()); + buf.append(";base64, \n"); + int col = 0; + while (*raw) + { + buf.push_back(*raw++); + if (col>=76) + { + buf.push_back('\n'); + col = 0; + } + } + if (col) + buf.push_back('\n'); + + _nodes[i]->setAttribute("xlink:href", buf.c_str(), true); } catch (Magick::Exception &error_) { printf("Caught exception: %s \n", error_.what());