DJ Mike's Tutorials: PHP

Imagick Functions

^

ImagickDraw::setFillColor

Description:
bool ImagickDraw::setFillColor ( mixed $fill_color )

Sets the fill color to be used for drawing filled objects. According to PHP.net, the parameter must be an ImagickPixel but as you can see in the example below, you can also use a string.
Parameters:
fill_color
ImagickPixel or string to use to set the color
Return Values
No value is returned.

Example


<?
$text 
"DJ Mike";
$font "Bookman-DemiItalic";
$pointsize 100;
$depth 4;

# make a transparent pallete
$pallete = new Imagick;
$pallete->newimage(450,105"transparent");
# set pallet format to gif
$pallete->setimageformat("gif");

# make a draw object with settings
$draw = new imagickdraw();
$draw->setgravity(imagick::GRAVITY_CENTER);
$draw->setfont("$font");
$draw->setfontsize($pointsize);

# set font color white
$draw->setfillcolor("#ffffff");
# offset annotate
$pallete->annotateImage $draw,$depth ,-$depth-30$text );
$pallete->annotateImage $draw,-$depth ,-$depth-30$text );

# set font color black
$draw->setfillcolor("#000000");
# offset annotate
$pallete->annotateImage $draw,-$depth ,$depth-20$text );
$pallete->annotateImage $draw,$depth ,$depth-30$text );

# set font color blue
$draw->setfillcolor("#0000ff");
# center annotate on top of offset annotates
$pallete->annotateImage $draw,,00$text );

# blur
$pallete->gaussianBlurImage21.5 ); 

# output to browser
$pallete->setImageFormat("gif");
header"Content-Type: image/gif" );
echo 
$pallete;
?>


^


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>