Page 1 of 1
Problems with rectangle
Posted: 2009-06-11T10:58:50-07:00
by piotrpsz
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
Re: Problems with rectangle
Posted: 2009-06-11T11:07:02-07:00
by magick
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
Posted: 2009-06-11T11:20:46-07:00
by piotrpsz
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.
But in file piddle.cpp, you are drawing a rectangle with lines.
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
Posted: 2009-06-11T12:46:50-07:00
by magick
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;
}