ImagickDraw::pathLineToRelative

(PECL imagick 2.0.0)

ImagickDraw::pathLineToRelativeDraws a line path

Description

bool ImagickDraw::pathLineToRelative ( float $x , float $y )
Warning

This function is currently not documented; only its argument list is available.

Draws a line path from the current point to the given coordinate using relative coordinates. The coordinate then becomes the new current point.

Parameters

x

starting x coordinate

y

starting y coordinate

Return Values

No value is returned.

Коментарии

Автор:
Hope this of help of anything, I had one hell of a time to draw a simple pie slice, where in GD2 is very easily done with the 'arc' function.. this is a bit harder to do in imagick.

The degrees are a mess, seems like the path, arc and ellipse functions all use a different system.. utterly confusing.
Code below should at least be of help in understanding how it works.

For an example of the output, please see: 
http://www.imagebam.com/image/8e0ca432393602
<?php
   
function getPointOnCircumference$widthOfCircle$heightOfCircle$degrees$x 0$y )
    {
        return array( 
           
'x' => $x + ($widthOfCircle/2)  * sindeg2rad$degrees ) ),
           
'y' => $y + ($heightOfCircle/2) * cosdeg2rad$degrees ) )
        );
    }
   
   
$width  200;
   
$height 200;
   
$border 2;
   
$x $width 2;
   
$y $height 2;
   
$im = new Imagick();
   
$im->newImage$width$height"orange""png" );
   
   
   
$draw = new ImagickDraw();
   
$draw->setFillColor'lime' );
   
$draw->setStrokeColor( new ImagickPixel'black' ) );
   
$draw->setStrokeWidth);
   
$draw->arc00, ($width-$border), ($height-$border), 270360  ); //270 till 360 degrees
   
$im->DrawImage$draw );
   
   
$draw2 = new ImagickDraw();
   
$draw2->setFillColor'red' );
   
$draw2->setStrokeColor( new ImagickPixel'black' ) );
   
$draw2->setStrokeWidth);
   
$draw2->ellipse100100$x-$border$y-$border090 );         //0 till 90 degrees
   
$im->DrawImage$draw2 );
   
   
$draw3 = new ImagickDraw();
   
$draw3->setFillColor'navy' );
   
$draw3->setStrokeColor( new ImagickPixel'white' ) );
   
$draw3->setStrokeWidth);
   
$draw3->pathStart();
     
$degrees90  getPointOnCircumference$width-2*$border,$height-2*$border360  );
     
$degrees180 getPointOnCircumference$width-2*$border,$height-2*$border270 );
     
$draw3->pathMoveToRelative$x$y ); //Move 'pencil' to middle of image.
     
$draw3->pathLineToRelative$degrees90['x'],  $degrees90['y'] );
     
$draw3->pathEllipticArcRelative$width-$border$height-$border0falsetrue$degrees180['x'], $degrees180['y']-$y+$border );
   
$draw3->pathClose();
   
$im->DrawImage$draw3 );   
   
   
header"Content-Type: image/png" );
    echo 
$im;
?>
2009-04-11 08:20:15
http://php5.kiev.ua/manual/ru/imagickdraw.pathlinetorelative.html

    Поддержать сайт на родительском проекте КГБ