Home Tutorial Php Phpgd PHP GD brush style coloring

 
 

PHP GD brush style coloring
Posted on: November 13, 2009 at 12:00 AM
This example shows how to display brush style coloring in php gd.

<?php

define("WIDTH", 200);

define("HEIGHT", 200);

$img = imagecreate(WIDTH, HEIGHT);

$background = $white = imagecolorallocate($img,0, 0xFF, 0xFF);

$red = imagecolorallocate($img, 255, 0, 0);

imagerectangle($img, 0, 0, WIDTH-1, HEIGHT-1, $red);

$dashed = array($red, $red, $red, $white, $white, $white);

$sos = array($red, $red,

$white, $white,

$red, $red,

$white, $white,

$red, $red,

$white, $white,

$red, $red, $red, $red,

$white, $white,

$red, $red, $red, $red,

$white, $white,

$red, $red, $red, $red,

$white, $white,

$red, $red,

$white, $white,

$red, $red,

$white, $white,

$red, $red,

$white, $white,$white, $white,$white, $white);

imagesetstyle($img, $sos);

imageline($img, 0, 0, WIDTH-1, HEIGHT-1, IMG_COLOR_STYLED);

imageline($img, 0, HEIGHT-1, WIDTH-1, 0, IMG_COLOR_STYLED);

imagesetstyle($img, $dashed);

imagerectangle($img, 30, 30, WIDTH-31, HEIGHT-31, IMG_COLOR_STYLED);

imagerectangle($img, 50, 50, WIDTH-51, HEIGHT-51, $red);

header("Content-Type: image/png");

imagepng($img);

?>

After running the program you will get the following output

Related Tags for PHP GD brush style coloring:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.