Why is drawing text failing?
Posted: 2013-05-31T08:10:42-07:00
I am trying to draw an image, when I have imagemagick installed on my system it works fine, however I need to use it from a local directory for this project.
So I've called InitializeMagick so that it points to the folder that contains all the CORE_DB and IM_MOD and xml files in it (though I found somewhere online telling me I should have a modules.xml file? Don't see one of those...)
My code follows, it outputs the debug info above it but not below it so it seems like it must be crashing on this line: errorImg.draw(DrawableText(5, fontSize+5, errorCodeString));
Thoughts as to why?
Also, using windows 7 and built it to use MAGICKCORE_QUANTUM_DEPTH of 8
Thank you!
So I've called InitializeMagick so that it points to the folder that contains all the CORE_DB and IM_MOD and xml files in it (though I found somewhere online telling me I should have a modules.xml file? Don't see one of those...)
My code follows, it outputs the debug info above it but not below it so it seems like it must be crashing on this line: errorImg.draw(DrawableText(5, fontSize+5, errorCodeString));
Thoughts as to why?
Also, using windows 7 and built it to use MAGICKCORE_QUANTUM_DEPTH of 8
Thank you!
Code: Select all
OutputDebugPointer("errorImg pointer", (void *)&errorImg);
errorImg.strokeColor("blue");
OutputDebugInfo("Before drawing rectangle");
errorImg.fillColor("blue");
OutputDebugInt("pluginContext.frameWidth",pluginContext.frameWidth);
OutputDebugInt("pluginContext.frameHeight",pluginContext.frameHeight);
OutputDebugInt("errorImg columns: ",errorImg.columns());
OutputDebugInt("errorImg rows: ",errorImg.rows());
DrawableRectangle testRect = DrawableRectangle(1,1,pluginContext.frameWidth-1,pluginContext.frameHeight-1);
OutputDebugPointer("After creating rectangle, pointer",(void *)&testRect);
errorImg.draw(testRect);
OutputDebugInfo("After drawing rectangle");
//Draw text
//errorImg.font("Arial");
DrawableFont font = font("Arial");
OutputDebugInfo("Font choosen");
errorImg.fontPointsize(fontSize);
errorImg.strokeWidth(1);
errorImg.fillColor("white");
errorImg.strokeColor("white");
errorImg.draw(font);
OutputDebugInfo("Font setup");
OutputDebugInfo("DrawableTextString",errorCodeString);
OutputDebugInt("Fontsize",fontSize);
//drawableText draws to the bottom of the text so draw text, 5x5 pixels from the top left corner
errorImg.draw(DrawableText(5, fontSize+5, errorCodeString));
OutputDebugInfo("Text drawn");
Blob storeYUVdata;
errorImg.write(&storeYUVdata, "YUV", 255);