DJ Mike's Tutorials: PHP

Imagemagick Functions


^

ImagickDraw::setStrokeAlpha

Description:
bool ImagickDraw::setStrokeAlpha ( float $opacity )

Specifies the opacity of stroked object outlines.
Parameters:
opacity
Float representing opacity. 1.0 is solid, 0 is transparent
Return Values
No value is returned.

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;
?>

^

Created by DJ Mike from Santa Barbara

DJ Mike


Dance Away Santa Barbara's Home Page
<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>