When I tried to call SetMagickResourceLimit, the GCC reported:
./my_magick.cpp:10: error: 'ThreadResource' was not declared in this scope
./my_magick.cpp:10: error: 'SetMagickResourceLimit' was not declared in this scope
Code: Select all
int warterMark(void** buff, int* len)
{
if (!magick_init) {
SetMagickResourceLimit(ThreadResource, 1);
magick_init = true;
}
int need_write = 0;
Blob destBlob;
try
{
Image image;
Blob srcBlob(*buff, *len);
image.read(srcBlob);
list<Drawable> text_draw_list;
//text_draw_list.push_back(DrawableFont("-*-helvetica-medium-r-normal-*-*-120-*-*-*-*-iso8859-1"));
text_draw_list.push_back(DrawableFont("Courier"));
text_draw_list.push_back(DrawableText(50, 50, "Hello world!"));
text_draw_list.push_back( DrawableStrokeColor(Color("red")));
text_draw_list.push_back( DrawableFillColor(Color(0, 0, 0, MaxRGB)));
image.draw(text_draw_list);
image.magick("JPEG");
image.write(&destBlob);
int outputSize = destBlob.length();
if (outputSize > *len)
{
*buff = (char *)realloc(*buff, outputSize);
}
*len = outputSize;
memcpy(*buff, destBlob.data(), outputSize);
}
catch (exception &e)
{
return 5;
}
return 0;
}
Thanks in advance.