imagecolorallocatealpha() - gd函数(图像处理)
imagecolorallocatealpha()
(PHP 4 >= 4.3.2, PHP 5, PHP 7)
为一幅图像分配颜色+ alpha
说明
imagecolorallocatealpha(resource $image,int $red,int $green,int $blue,int $alpha): intimagecolorallocatealpha()的行为和imagecolorallocate()相同,但多了一个额外的透明度参数$alpha,其值从0到127。0表示完全不透明,127表示完全透明。
如果分配失败则返回FALSE
。
使用imagecolorallocatealpha()的例子
Note:此函数需要 GD 2.0.1 或更高版本(推荐 2.0.28 及更高版本)。
参见imagecolorallocate()和imagecolordeallocate()。
参数
$image
由图象创建函数(例如imagecreatetruecolor())返回的图象资源。
$red红色成分的值。
$green绿色成分的值。
$blue蓝色成分的值。
$alphaA value between0and127.0indicates completely opaque while127indicates completely transparent.
The colors parameters are integers between 0 and 255 or hexadecimals between 0x00 and 0xFF.返回值
A color identifier orFALSE
if the allocation failed.
此函数可能返回布尔值FALSE
,但也可能返回等同于FALSE
的非布尔值。请阅读布尔类型章节以获取更多信息。应使用===运算符来测试此函数的返回值。
更新日志
版本 | 说明 |
---|---|
Prior to 5.1.3 | Returns -1 if the allocation failed. |
范例
Example of usingimagecolorallocatealpha()
内容声明:本文中引用的各种信息及资料(包括但不限于文字、数据、图表及超链接等)均来源于该信息及资料的相关主体(包括但不限于公司、媒体、协会等机构)的官方网站或公开发表的信息。部分内容参考包括:(百度百科,百度知道,头条百科,中国民法典,刑法,牛津词典,新华词典,汉语词典,国家院校,科普平台)等数据,内容仅供参考使用,不准确地方联系删除处理!本站为非盈利性质站点,本着为中国教育事业出一份力,发布内容不收取任何费用也不接任何广告!)