Create a larger image, recreate that brush, and use it as the outline for a shape in PHP

Description

The following code shows how to create a larger image, recreate that brush, and use it as the outline for a shape.

Example


<?php//  ww  w .  ja  v a 2  s  .  c o  m
    $pic = imagecreatetruecolor(600,600);
    $brush = imagecreate(100,100);

    $brushtrans = imagecolorallocate($brush, 0, 0, 0);
    imagecolortransparent($brush, $brushtrans);

    for ($k = 1; $k < 8; ++$k) {
         $color = imagecolorallocate($brush, 255, $k * 15, 0);
         imagefilledellipse($brush, $k * 5, $k * 5, 5, 5, $color);
    }

    imagesetbrush($pic, $brush);
    imageellipse($pic, 300, 300, 350, 350, IMG_COLOR_BRUSHED);

    imagepng($pic);
    imagedestroy($pic);
    imagedestroy($brush);
?>




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text