andrewgjohnson / imageblendedcolorallocate
imageblendedcolorallocate 是一个函数,可以根据您 PHP GD 图像中两个现有的分配颜色来分配一个新的混合颜色。
Requires
- php: >=5.0.0
- ext-gd: *
This package is auto-updated.
Last update: 2024-09-18 19:07:17 UTC
README
描述
imageblendedcolorallocate 是一个函数,可以根据您 PHP GD 图像中两个现有的分配颜色来分配一个新的混合颜色。
imageblendedcolorallocate 是一个 agjgd 项目。
用法
使用 Composer
本项目支持 Composer 依赖管理器。您可以在 packagist.org 上找到 imageblendedcolorallocate 包。
使用 Composer 安装
运行此命令
composer require andrewgjohnson/imageblendedcolorallocate
或将其添加到 composer.json 文件的 require
部分
"andrewgjohnson/imageblendedcolorallocate": "1.*"
不使用 Composer
要使用而不使用 Composer,请将 include 添加到 imageblendedcolorallocate.php
源文件。
include_once 'source/imageblendedcolorallocate.php';
示例
// standard method to allocate a color for an image
$red = imagecolorallocate($im, 0xFF, 0x00, 0x00);
$yellow = imagecolorallocate($im, 0xFF, 0xFF, 0x00);
// this will allocate an average of our two previously allocated colors
$orange = imageblendedcolorallocate($im, $red, $yellow);
// yes, we do support alpha if you want to use transparent or translucent colors
$opaqueBlack = imagecolorallocatealpha($im, 0x00, 0x00, 0x00, 0);
$translucentBlack = imagecolorallocatealpha($im, 0x00, 0x00, 0x00, 63);
$blendedBlack = imageblendedcolorallocate($im, $opaqueBlack, $translucentBlack);
// by default we do a 50/50 blend where we average the red, blue, green & alpha values for each color
// we also support non-50/50 blends
$blue = imagecolorallocate($im, 0x00, 0x00, 0xFF);
$cyan = imagecolorallocate($im, 0x00, 0xFF, 0xFF);
$blendedMostlyCyan = imageblendedcolorallocate($im, $blue, $cyan, 0.25); // 25% blue, 75% cyan
$blendedEvenly = imageblendedcolorallocate($im, $blue, $cyan); // 50% blue, 50% cyan
$blendedMostlyBlue = imageblendedcolorallocate($im, $blue, $cyan, 0.75); // 75% blue, 25% cyan
GitHub 存储库和 imageblendedcolorallocate.agjgd.org 上包含其他示例。
帮助请求
如果您需要帮助,请在 GitHub 上的 讨论区域 发帖。
如果您发现一个错误,请 在 GitHub 上创建问题。提交问题时,请使用我们的 问题模板。
贡献
如果您想贡献,请阅读我们的 贡献指南。
您可以通过成为 patreon 的赞助商在 patreon.com/agjopensource 上资助 imageblendedcolorallocate 和 其他 agjgd.org 项目。
致谢
该项目由 Andrew G. Johnson (@andrewgjohnson) 开始。
贡献者完整列表
我们的安全策略和程序来自atomist/samples项目。我们的问题模板来自tensorflow/tensorflow项目。我们的拉取请求模板来自stevemao/github-issue-templates项目。这张山脉照片由Gabriel Garcia Marengo提供。
变更日志
您可以在变更日志中找到所有显著的更改。