DrawPolygon doesn't seem to work for me. Where is my error?
Posted: 2009-09-08T14:16:33-07:00
I'm trying to port an old program of mine to use MagickWand for drawing, but I can't get DrawPolygon to work.
The following code:
doesn't do what I expect. I get the image created and filled with the background colour, but I don't see the polygon.
I'm sure I'm making some fundamental mistake, but I can't see what it is ...
The following code:
Code: Select all
#define WIDTH 4000
#define HEIGHT 3000
void mwtest(void)
{
MagickWand *image;
PixelWand *colour;
DrawingWand *drawing;
PointInfo ptest[5] = {{1000, 750}, {3000, 750}, {3000, 2250}, {1000, 2250}, {1000, 750}};
MagickWandGenesis();
image = NewMagickWand();
colour = NewPixelWand();
PixelSetColor(colour, "rgb(200, 200, 255)");
if (!MagickNewImage(image, WIDTH, HEIGHT, colour)) return;
drawing = NewDrawingWand();
PixelSetColor(colour, "black");
DrawSetStrokeColor(drawing, colour);
PixelSetColor(colour, "white");
DrawSetFillColor(drawing, colour);
DrawPolygon(drawing,5,ptest);
MagickWriteImage(image, "mwtest.png");
MagickWandTerminus();
}
I'm sure I'm making some fundamental mistake, but I can't see what it is ...