Hi,
I'm using Magick++.
I trying to draw a rectangle, for example;
image.draw( Magick::DrawableRectangle( 10, 10, 80, 80 ) );
And I have a message:
Non-conforming drawing primitive definition `rectangle' @ magick/draw.c/DrawImage/3112
Why? Can anyone tell me why?
regards
piotr
Problems with rectangle
Re: Problems with rectangle
Grab the ImageMagick source distribution and compile Magick++/demo/piddle.cpp and Magick++/demo/shapes.cpp. They are good examples to use to get started with Magick++ drawing.
Re: Problems with rectangle
But in file piddle.cpp, you are drawing a rectangle with lines.magick wrote:Grab the ImageMagick source distribution and compile Magick++/demo/piddle.cpp and Magick++/demo/shapes.cpp. They are good examples to use to get started with Magick++ drawing.
DrawableReclangle not exists more?
In documentation is fragment:
> To draw polygon shapes on the canvas, the Magick++ library provides a generic
> 'DrawablePolygon' class and a specialized classes to draw rectangles: 'DrawableRectangle'.
piotr
Re: Problems with rectangle
The following works for us. We're using ImageMagick 6.5.3-4:
Code: Select all
#include <Magick++.h>
#include <string>
#include <iostream>
using namespace std;
using namespace Magick;
int main( int /*argc*/, char ** argv)
{
// Initialize ImageMagick install location for Windows
InitializeMagick(*argv);
try {
string srcdir("");
if(getenv("SRCDIR") != 0)
srcdir = getenv("SRCDIR");
//
// Create a 300x300 white canvas.
//
Image image( "300x300", "white" );
image.draw(Magick::DrawableRectangle( 10, 10, 80, 80 ) );
cout << "Writing image \"piddle_out.miff\" ..." << endl;
image.compressType( RLECompression );
image.write( "piddle_out.miff" );
cout << "Writing MVG metafile \"piddle_out.mvg\" ..." << endl;
image.write( "piddle_out.mvg" );
}
catch( exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}