Using imagesetbrush in php

<?php
$pic = imagecreatetruecolor(400,400);
$redcol = 0;
for ($i = -20;$i<450; $i=$i+90) 
{
    for ($j=-20; $j<450;$j=$j+80) 
    {
        $brush = imagecreate(100,100);
        $brushtrans = imagecolorallocate($brush, 0, 0, 0);
        imagecolortransparent($brush, $brushtrans);
        for ($k = 1;$k<18;++$k)
        {
            $color = imagecolorallocate($brush,255,$k * 15,$redcol);
            imagefilledellipse($brush,$k*2,$k*2,1,1,$color);
        }

        imagesetbrush($pic,$brush);
        imageellipse($pic,$i,$j,50,50,IMG_COLOR_BRUSHED);
        imagedestroy($brush);
    }
    $redcol=$redcol+40;
}
imagepng($pic);
imagedestroy($pic);
?>

Output :


Top