Non-conforming drawing primitive definition (line)
Swiss army knife of image processing
Brought to you by:
bfriesen
Hello,
we like to switch from IMagick to GMagick, but drawing lines make problems.
The following sample fails with this message: "Non-conforming drawing primitive definition (line)"
$draw1 = new GmagickDraw();
$draw2 = new GmagickDraw();
$color1 = new GmagickPixel();
$color1->setColor('white');
$color2 = new GmagickPixel();
$color2->setColor('black');
$draw1->setFillColor($color1);
$draw1->setFillOpacity(0.5);
$draw2->setFillColor($color2);
$draw2->setFillOpacity(0.2);
for($i = -$width; $i < $h*2 + $width; $i=$i+200){
$draw1->line(1, $h-$i, 1+$i, $h);
$draw2->line(2, $h-$i, 2+$i, $h);
}
Version gmagick-1.1.7RC3
Do you know what version of GraphicsMagick is used?
GraphicsMagick 1.3.24 2016-05-30 Q8
I am assuming that GMagick is based on the Wand API. If this is the case then there is likely a MagickDrawImage() request which is missing from your example. GraphicsMagick 1.3.24 has an undocumented feature in that if you export the environment variable MAGICK_SKIP_RENDERING (e.g. 'export MAGICK_SKIP_RENDERING=TRUE') before requesting to render the drawing, then the actual rendering (where the error is detected) is skipped. This will likely avoid the error. Please export this environment variable, request to draw on the image as usual, and then request to save the image to a MVG file name like "mvg:somefile.mvg". If you succeed with this, then please attach the MVG file to this bug report. The file will be a simple ASCII eqivalent of the drawing requests.
Great the export work for us!
But I not really understand what you mean with the "MVG file"?
Please explain, if you need something more from us we can help you.
The drawing APIs are producing an easy to read text format called MVG ("Magick Vector Graphics") which is then used as input to the renderer. By saving the resulting "image" to a file named like mvg:myfile.mvg then you will have a text equivalent to your drawing API requests. The reason why I am interested in this is that the MVG commands might be garbled in some way or the parser might have some issue with them.
Something I see strange about your usage is that you are creating two drawing objects and then interleaving the requests between both objects. Normally one creates just one drawing object and then modifies drawing options in the stream.
Hello Bob,
great to know. Please see the attached file!
If you look at your .mvg file, you will find that it includes many negative coordinates which would be way outside of the image unless a coordinate transformation has been applied. Also, if the canvas image is smaller than the positive coordinates, the object endings may be outside of the image as well.
What I found was that lines where the starting and ending points are the same are intentionally devolved into a point and due to overly-aggressive error checking I added, an error was reported when the coordinates of the point are outside of the image. I have now removed most of the error checking which may cause such errors and so your drawing "works".
The fixes are in Mercurial changeset 14861:e44eae04207e.
Thank you for reporting this problem and please report any other similar issues.