本文整理汇总了PHP中Color::HexToRGB方法的典型用法代码示例。如果您正苦于以下问题:PHP Color::HexToRGB方法的具体用法?PHP Color::HexToRGB怎么用?PHP Color::HexToRGB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color::HexToRGB方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HexToRGBA
public static function HexToRGBA($hex, $alpha){
$res = Color::HexToRGB($hex);
if( $alpha > 1 ){
$alpha = $alpha / 100;
}
elseif( $alpha < 0 ){
$alpha = 0;
}
$res[0]['alpha'] = $alpha;
$res[1] = "rgba(" . substr($res[1], 3, -1) . ", $alpha)";
return $res;
}
示例2: Template
<?php
set_include_path('.:backbone:global:jquery');
require_once('Template.php');
require_once('Color.php');
require_once('Image.php');
require_once('RedirectBrowserException.php');
require_once('Session.php');
require_once('URL.php');
$tmpl = new Template();
$tmpl->passedvar = "This string was passed through the Template object to be rendered in the HTML file.";
$tmpl->hex = Color::RGBToHex(60, 120, 60);
$tmpl->alpha = Color::HexToRGBA($tmpl->hex, .5);
$tmpl->rgb = Color::HexToRGB($tmpl->hex);
$img = new Image();
$img->source = 'portrait.png';
$img->Write->Normal(20, 20, "A Self Portrait of Me", 5, "#000000", 1);
$img->destination = 'portrait2.png';
$img->output();
$img->clean();
unset($img);
//start a session and store a variable;
setSession(0,'/'); // expires with browser session, the root is '/'
setSessionVar('foo', 'bar'); //there's no retrieval function, so this is kind of stupid
if( !isset($_SESSION['foo']) ){
throw new RedirectBrowserException("example.php");
}