Page 1 of 1

strange error when drawing curves

Posted: 2008-01-16T02:07:24-07:00
by userfriendly
hi,

started playing around with imagick yesterday. seems to work just fine - except, of course, exactly those functions i actually need. which are the curve drawing functions. i looked at the api docs to be sure i provided the correct parameter count, but all i get is a
Fatal error: Uncaught exception 'ImagickException' with message 'Non-conforming drawing primitive definition `Q50.7'' in /var/www/imtest.php:158 Stack trace: #0 /var/www/imtest.php(158): Imagick->drawimage(Object(ThumbnailMask)) #1 {main} thrown in /var/www/imtest.php on line 158
this for example is what i get when i use ImagickDraw::pathCurveToQuadraticBezierAbsolute, where 50.7 is one of the parameters (the first one).

i'm using imagemagick 6.2.4.5 on ubuntu 7.10, and as i said, the rest of it is working just fine. i'm probably doing something wrong - but for the love of gods i have no idea what it is. :(

Re: strange error when drawing curves

Posted: 2008-01-19T15:51:44-07:00
by mkoppanen
Check if your phpinfo lists ini-setting imagick.locale_fix and what the value is. If it's there and it's 0 set it to 1.

If you can't see this setting in phpinfo, set the locale to "C" in your script before performing drawing operations.

Re: strange error when drawing curves

Posted: 2008-01-22T06:10:56-07:00
by userfriendly
mkoppanen wrote:Check if your phpinfo lists ini-setting imagick.locale_fix and what the value is. If it's there and it's 0 set it to 1.

If you can't see this setting in phpinfo, set the locale to "C" in your script before performing drawing operations.
that imagick.locale_fix setting isn't there.

tried setting the locale:

Code: Select all

setLocale( LC_ALL, "C" );
...but that didn't help, still the same result. :(

i need to cut a user's face out of a picture they upload, going by points they set in our flash app (using quadratic curves), and then use the resulting drawing as mask, take the head and put it on the game preview background - our current workaround is to make kind of a screenshot with the bitmapdata class in flash and send all pixels as an array of integer values, gzipped, to a remoting service class on the server. however, that really impacts performance of the system quite badly, and i'd like to do it the way i had planned initially.

thanks for your response, at least it's a hint at what could be wrong. i'll keep looking for a solution. :)

Re: strange error when drawing curves

Posted: 2008-01-23T01:31:27-07:00
by mkoppanen
Sorry, I jumped to conclusions:
'Non-conforming drawing primitive definition `Q50.7''
Is that the drawing primitive definition?

Re: strange error when drawing curves

Posted: 2008-01-23T04:11:28-07:00
by userfriendly
mkoppanen wrote:Sorry, I jumped to conclusions:
'Non-conforming drawing primitive definition `Q50.7''
Is that the drawing primitive definition?
yes, it's part of it - i've extended a class from the Imagick class, and have an array of points that alternate between anchor and control points for 6 curves:

Code: Select all

$this->point( $this->p[0]['x'], $this->p[0]['y'] );
$this->pathCurveToQuadraticBezierRelative( $this->p[1]['x'],  $this->p[1]['y'],  $this->p[2]['x'],  $this->p[2]['y'] );
$this->pathCurveToQuadraticBezierRelative( $this->p[3]['x'],  $this->p[3]['y'],  $this->p[4]['x'],  $this->p[4]['y'] );
$this->pathCurveToQuadraticBezierRelative( $this->p[5]['x'],  $this->p[5]['y'],  $this->p[6]['x'],  $this->p[6]['y'] );
$this->pathCurveToQuadraticBezierRelative( $this->p[7]['x'],  $this->p[7]['y'],  $this->p[8]['x'],  $this->p[8]['y'] );
$this->pathCurveToQuadraticBezierRelative( $this->p[9]['x'],  $this->p[9]['y'],  $this->p[10]['x'], $this->p[10]['y'] );
$this->pathCurveToQuadraticBezierRelative( $this->p[11]['x'], $this->p[11]['y'], $this->p[0]['x'],  $this->p[0]['y'] );
probably that element "x" in array p[1] is of said value. it's using a dot for the decimal places, not a comma. should be correct, no?

these values of course change depending on the data the user provided (or rather, the flash interface). if there are no decimal places, for example, it looks like this:

Code: Select all

'Non-conforming drawing primitive definition `q94''

Re: strange error when drawing curves

Posted: 2008-01-23T10:02:32-07:00
by mkoppanen
can you show me var_dump( $this->p ); ?

Re: strange error when drawing curves

Posted: 2008-01-24T23:38:45-07:00
by userfriendly
mkoppanen wrote:can you show me var_dump( $this->p ); ?
sure thing. here, i used some data without float values. still no luck:

Code: Select all

array(12) { [0]=>  array(2) { ["x"]=>  int(170) ["y"]=>  int(80) } [1]=>  array(2) { ["x"]=>  int(94) ["y"]=>  int(83) } [2]=>  array(2) { ["x"]=>  int(98) ["y"]=>  int(169) } [3]=>  array(2) { ["x"]=>  int(91) ["y"]=>  int(209) } [4]=>  array(2) { ["x"]=>  int(119) ["y"]=>  int(215) } [5]=>  array(2) { ["x"]=>  int(136) ["y"]=>  int(261) } [6]=>  array(2) { ["x"]=>  int(181) ["y"]=>  int(265) } [7]=>  array(2) { ["x"]=>  int(213) ["y"]=>  int(263) } [8]=>  array(2) { ["x"]=>  int(224) ["y"]=>  int(207) } [9]=>  array(2) { ["x"]=>  int(228) ["y"]=>  int(178) } [10]=>  array(2) { ["x"]=>  int(229) ["y"]=>  int(146) } [11]=>  array(2) { ["x"]=>  int(233) ["y"]=>  int(88) } }

Re: strange error when drawing curves

Posted: 2008-01-28T13:38:26-07:00
by mkoppanen
To be honest I have no idea where this error message originates: 'Non-conforming drawing primitive definition `q94''