summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 17702c3)
raw | patch | inline | side by side (parent: 17702c3)
author | ishmal <ishmal@users.sourceforge.net> | |
Sun, 19 Aug 2007 01:01:08 +0000 (01:01 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Sun, 19 Aug 2007 01:01:08 +0000 (01:01 +0000) |
build.xml | patch | blob | history | |
src/extension/internal/bitmap/imagemagick.cpp | patch | blob | history |
diff --git a/build.xml b/build.xml
index 7e152429d8c9e2c1bc24b8fada9da0ea08239bf8..f17afa30f355badb51f092d40278c82b3988896c 100644 (file)
--- a/build.xml
+++ b/build.xml
<property name="lib" location="lib"/>
<property name="build" location="build"/>
<property name="dist" location="inkscape"/>
- <property name="boost" location="c:/boost"/>
/* use poppler for pdf import? */
#define HAVE_POPPLER 1
+
+ /* do we want bitmap manipulation? */
+ #define WITH_IMAGE_MAGICK 1
#endif /* _CONFIG_H_ */
</makefile>
<exclude name="removeoverlap/test.cpp"/>
<exclude name="removeoverlap/remove_rectangle_overlap-test.cpp"/>
<exclude name="removeoverlap/remove_rectangle_overlap-test.h"/>
- <exclude name="extension/internal/bitmap/.*"/>
</fileset>
<flags>
-Wall -O3
-Wno-comment -I${gtk}/perl/lib/CORE
<!-- PYTHON -->
-I${gtk}/python/include
- <!-- 2geom -->
- <!-- -I${gtk}/include/2geom -->
- -I${boost}
</includes>
</cc>
</target>
-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
<!-- 2geom -->
<!-- -l2geom -->
</libs>
diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp
index 83650aaa788b84c2640544e0d0b0677974a0ddb5..db67294ea040746a2b8d719b9b465fa932fc9082 100644 (file)
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());