这篇文章主要介绍了php基于GD库画五星红旗的方法,涉及php操作GD库及数组的使用技巧,具有一定参考借鉴价值,需要的朋友可以参考下
本文实例讲述了php基于GD库画五星红旗的方法。分享给大家供大家参考。具体分析如下:
这里实例分析php画的五星红旗(GD库),代码如下:
复制代码 代码如下:
header("Content-Type:image/jpeg");
$ing = imagecreatetruecolor(700,410);
//新建一个真彩色图像,返回值为一个图像标识符,背景默认为黑色,参数(x_size*y_size)
$red = imagecolorallocate($ing,255,0,0);//定义背景颜色
$yellow = imagecolorallocate($ing,237,231,32);//定义黄色
imagefill($ing,0,0,$red);//填充颜色,以坐标(0,0)开始起填充
//数组坐标,,表示(x1,y1,x2,y2,x3,y3.....x11,y11);
$a = array(90,30,108,73,157,73,119,102,135,152,93,123,52,152,66,102,29,74,76,73,90,30);
imagefilledpolygon($ing,$a,10,$yellow);//画一个多边形:10表示顶点总数,$yellow表示填充色
$a1 = array(229,25,229,43,248,48,229,55,229,74,217,60,198,66,210,50,197,34,218,39,229,25);
imagefilledpolygon($ing,$a1,10,$yellow);
$a2 = array(227,108,227,127,245,134,228,139,227,157,215,143,196,149,208,132,196,117,215,122,227,108);
imagefilledpolygon($ing,$a2,10,$yellow);
$a3 = array(163,184,163,204,181,211,163,216,163,234,152,220,132,225,144,209,132,193,151,199,163,184);
imagefilledpolygon($ing,$a3,10,$yellow);
$a4 = array(65,209,65,228,84,235,65,240,65,259,54,245,33,249,46,233,34,217,53,224,68,209);
imagefilledpolygon($ing,$a4,10,$yellow);
ob_clean();
imagejpeg($ing);
imagedestroy($ing);
?>
希望本文所述对大家的php程序设计有所帮助。

Outils d'IA chauds

Undresser.AI Undress
Application basée sur l'IA pour créer des photos de nu réalistes

AI Clothes Remover
Outil d'IA en ligne pour supprimer les vêtements des photos.

Undress AI Tool
Images de déshabillage gratuites

Clothoff.io
Dissolvant de vêtements AI

Video Face Swap
Échangez les visages dans n'importe quelle vidéo sans effort grâce à notre outil d'échange de visage AI entièrement gratuit !

Article chaud

Outils chauds

MinGW - GNU minimaliste pour Windows
Ce projet est en cours de migration vers osdn.net/projects/mingw, vous pouvez continuer à nous suivre là-bas. MinGW : un port Windows natif de GNU Compiler Collection (GCC), des bibliothèques d'importation et des fichiers d'en-tête librement distribuables pour la création d'applications Windows natives ; inclut des extensions du runtime MSVC pour prendre en charge la fonctionnalité C99. Tous les logiciels MinGW peuvent fonctionner sur les plates-formes Windows 64 bits.

SublimeText3 version anglaise
Recommandé : version Win, prend en charge les invites de code !

SublimeText3 Linux nouvelle version
Dernière version de SublimeText3 Linux

SublimeText3 version Mac
Logiciel d'édition de code au niveau de Dieu (SublimeText3)

Télécharger la version Mac de l'éditeur Atom
L'éditeur open source le plus populaire
