Home Tutorial Php Phpgd PHP GD brush style coloring

 
 

Share on Google+Share on Google+
PHP GD brush style coloring
Posted on: November 13, 2009 at 12:00 AM
Advertisement
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

Advertisement

Related Tags for PHP GD brush style coloring:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 13, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com