DJ Mike's Tutorials: PHP

Imagemagick Functions


^

ImagickDraw::setStrokeDashArray

Description:
bool ImagickDraw::setStrokeDashArray ( array $dashArray )

Specifies the pattern of dashes and gaps used to stroke paths. The strokeDashArray represents an array of numbers that specify the lengths of alternating dashes and gaps in pixels. If an odd number of values is provided, then the list of values is repeated to yield an even number of values. To remove an existing dash array, pass a zero number_elements argument and null dash_array. A typical strokeDashArray_ array might contain the members 5 3 2.
Parameters:
dashArray
An array of floats.
Return Values
Returns TRUE on success.

Example


<?php
$move 
30;
$image = new Imagick(); 
$image->newimage(450,130"#cc9999");
$image->setimageformat"png" );

# define some color objects
$none = new imagickpixel"transparent" );
$red = new imagickpixel"red" );
$blue = new imagickpixel"#0000ff" );
$green = new imagickpixel"green" );
$yellow = new imagickpixel"yellow" );
$purple = new imagickpixel"purple" );

# define a line
$line = new ImagickDraw;
$line->setfillcolor($blue);
$line->line20,2042040);

# draw the line
$image->drawimage($line);

# change the lines color
$line->setfillcolor($green);
# and the stroke color
$line->setstrokecolor($green);
# Make it wider
$line->setstrokewidth(20);
# Gve it a round end
$line->setStrokeLineCap(imagick::LINECAP_ROUND);
# Move it over
$line->line20,5042070);
# Draw the line
$image->drawimage($line);

# make dash array
$dash = array( 2,2,);
# set dash pattern
$line->setStrokeDashArray$dash );
# make fill color transparent
$line->setfillcolor($none);
# set stroke color purple
$line->setstrokecolor($purple);
$line->setStrokeLineCapimagick::LINECAP_BUTT );
$line->line20,80420100);
$image->drawimage($line);

# make a new draw object
$line_2 = new ImagickDraw;
$line_2->setfillcolor($yellow);
$line_2->setstrokecolor($yellow);
$line_2->setstrokewidth(20);
# make it simitransparent with setFillOpacity and setStrokeAlpha
$line_2->setFillOpacity(.75);
$line_2->setStrokeAlpha(.3);
$line_2->line400,2040100);
$image->drawimage($line_2);

# send to bowser
header("Content-type: image/png");
echo 
$image;
?>

^

Was this webpage useful to you? You can support this website by donating.


Created by DJ Mike from Santa Barbara

DJ Mike


<a href="http://www.statcounter.com/" target="_blank"> <img src="http://c5.statcounter.com/counter.php?sc_project=1321035&java=0&security=da2193dc" alt="counter free hit invisible" border="0" /></a>