Example of the function of drawing the dice pattern in the Mid-Autumn pie game implemented by php: Mid-Autumn dice

Source: Internet
Author: User

Example of the function of drawing the dice pattern in the Mid-Autumn pie game implemented by php: Mid-Autumn dice

This article describes how to draw a dice in the Mid-Autumn pie game implemented by php. We will share this with you for your reference. The details are as follows:

Recently, the company's Mid-Autumn Festival blog (in Xiamen), I want to play it myself, so I want to write a pure php Mid-Autumn Festival blog game, since it needs to be implemented in pure php, php is used to generate a pattern, so the first step is to draw a dice pattern.

Php is rarely used for plotting, but the information is still drawn. The Code is as follows:

header('Content-Type:image/png');$img  = imagecreatetruecolor(200, 200);$white = imagecolorallocate($img, 255, 255, 255);$grey = imagecolorallocate($img, 100, 100, 100);$blue = imagecolorallocate($img, 0, 102, 255);$red  = imagecolorallocate($img, 255, 0, 0);imagefill($img, 0, 0, $white);imageline($img, 10, 20, 10, 180, $grey);imageline($img, 10, 180, 20, 190, $grey);imageline($img, 20, 190, 180, 190, $grey);imageline($img, 180, 190, 190, 180, $grey);imageline($img, 190, 180, 190, 20, $grey);imageline($img, 190, 20, 180, 10, $grey);imageline($img, 180, 10, 20, 10, $grey);imageline($img, 20, 10, 10, 20, $grey);//1imagefilledarc($img, 100, 100, 50, 50, 0, 0, $blue, IMG_ARC_PIE);//2//imagefilledarc($img, 60, 100, 40, 40, 0, 0 , $red, IMG_ARC_PIE);//imagefilledarc($img, 140, 100, 40, 40, 0, 0 , $red, IMG_ARC_PIE);//3//imagefilledarc($img, 50, 50, 40, 40, 0, 0 , $blue, IMG_ARC_PIE);//imagefilledarc($img, 100, 100, 40, 40, 0, 0 , $blue, IMG_ARC_PIE);//imagefilledarc($img, 150, 150, 40, 40, 0, 0 , $blue, IMG_ARC_PIE);//4//imagefilledarc($img, 50, 50, 40, 40, 0, 0 , $red, IMG_ARC_PIE);//imagefilledarc($img, 50, 150, 40, 40, 0, 0 , $red, IMG_ARC_PIE);//imagefilledarc($img, 150, 150, 40, 40, 0, 0 , $red, IMG_ARC_PIE);//imagefilledarc($img, 150, 50, 40, 40, 0, 0 , $red, IMG_ARC_PIE);//5//imagefilledarc($img, 50, 50, 40, 40, 0, 0 , $blue, IMG_ARC_PIE);//imagefilledarc($img, 50, 150, 40, 40, 0, 0 , $blue, IMG_ARC_PIE);//imagefilledarc($img, 100, 100, 40, 40, 0, 0 , $blue, IMG_ARC_PIE);//imagefilledarc($img, 150, 150, 40, 40, 0, 0 , $blue, IMG_ARC_PIE);//imagefilledarc($img, 150, 50, 40, 40, 0, 0 , $blue, IMG_ARC_PIE);//6//imagefilledarc($img, 50, 50, 40, 40, 0, 0 , $red, IMG_ARC_PIE);//imagefilledarc($img, 50, 150, 40, 40, 0, 0 , $red, IMG_ARC_PIE);//imagefilledarc($img, 100, 50, 40, 40, 0, 0 , $red, IMG_ARC_PIE);//imagefilledarc($img, 100, 150, 40, 40, 0, 0 , $red, IMG_ARC_PIE);//imagefilledarc($img, 150, 150, 40, 40, 0, 0 , $red, IMG_ARC_PIE);//imagefilledarc($img, 150, 50, 40, 40, 0, 0 , $red, IMG_ARC_PIE);imagepng($img);imagedestroy($img);

You can draw a 1-6 point pattern, 1/3/5 color is blue, 2/4/6 is red, as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.