Recherche sur les Noms des fonctions php/mysql
Définition
Alloue une couleur pour une image - (PHP 4, PHP 5)Retourne un identifiant de couleur, représentant la couleur composée avec les couleurs RGB.
imagecolorallocate() doit être appelée pour créer chaque couleur qui sera représentée par image .
Note: Le premier appel à imagecolorallocate() remplit la couleur de fond avec la palette des images - images créées en utilisant imagecreate().
- image
-
Une ressource d'image, retourné par une des fonctions de création d'images, comme imagecreatetruecolor().
- red
-
Valeur pour le composant rouge
- green
-
Valeur pour le composant vert
- blue
-
Valeur pour le composant bleu
Un identifiant de couleur ou FALSE si l'allocation échoue.
| Version | Description |
|---|---|
| Avant la version 5.1.3 | Retourne -1 si l'allocation échoue. |
Exemple #1 Exemple avec imagecolorallocate()
<?php
$im = imagecreate(100, 100);
// Le fond de l'image est en rouge
$background = imagecolorallocate($im, 255, 0, 0);
// On définit des couleurs avec des entiers ..
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// .. ou des hexadécimaux
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);
?>
Bouts de code utilisant la fonction imagecolorallocate()
Connexion
Les fonctions
Références
- gd_info
- getimagesize
- image_type_to_extension...
- image_type_to_mime_type...
- image2wbmp
- imagealphablending
- imageantialias
- imagearc
- imagechar
- imagecharup
- imagecolorallocate
- imagecolorallocatealpha...
- imagecolorat
- imagecolorclosest
- imagecolorclosestalpha...
- imagecolorclosesthwb...
- imagecolordeallocate...
- imagecolorexact
- imagecolorexactalpha...
- imagecolormatch
- imagecolorresolve
- imagecolorresolvealpha...
- imagecolorset
- imagecolorsforindex...
- imagecolorstotal
- imagecolortransparent...
- imageconvolution
- imagecopy
- imagecopymerge
- imagecopymergegray
- imagecopyresampled
- imagecopyresized
- imagecreate
- imagecreatefromgd2
- imagecreatefromgd2part...
- imagecreatefromgd
- imagecreatefromgif
- imagecreatefromjpeg...
- imagecreatefrompng
- imagecreatefromstring...
- imagecreatefromwbmp...
- imagecreatefromxbm
- imagecreatefromxpm
- imagecreatetruecolor...
- imagedashedline
- imagedestroy
- imageellipse
- imagefill
- imagefilledarc
- imagefilledellipse
- imagefilledpolygon
- imagefilledrectangle...
- imagefilltoborder
- imagefilter
- imagefontheight
- imagefontwidth
- imageftbbox
- imagefttext
- imagegammacorrect
- imagegd2
- imagegd
- imagegif
- imagegrabscreen
- imagegrabwindow
- imageinterlace
- imageistruecolor
- imagejpeg
- imagelayereffect
- imageline
- imageloadfont
- imagepalettecopy
- imagepng
- imagepolygon
- imagepsbbox
- imagepsencodefont
- imagepsextendfont
- imagepsfreefont
- imagepsloadfont
- imagepsslantfont
- imagepstext
- imagerectangle
- imagerotate
- imagesavealpha
- imagesetbrush
- imagesetpixel
- imagesetstyle
- imagesetthickness
- imagesettile
- imagestring
- imagestringup
- imagesx
- imagesy
- imagetruecolortopalette...
- imagettfbbox
- imagettftext
- imagetypes
- imagewbmp
- imagexbm
- iptcembed
- iptcparse
- jpeg2wbmp
- png2wbmp





