本文整理汇总了PHP中ImageColorResolve函数的典型用法代码示例。如果您正苦于以下问题:PHP ImageColorResolve函数的具体用法?PHP ImageColorResolve怎么用?PHP ImageColorResolve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ImageColorResolve函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callback
function callback($img, $arg)
{
#fwrite(STDERR, "callback in object: arg=" . print_r($arg, True) . "\nimg=" . print_r($img, True) . "\n");
# fwrite(STDERR, print_r($this, True));
#fwrite(STDERR, "Plot area: ({$this->plot_area[0]}, {$this->plot_area[1]}) :");
#fwrite(STDERR, " ({$this->plot_area[2]}, {$this->plot_area[2]})\n");
# Draw an X across the plot area.
$red = ImageColorResolve($img, 255, 0, 0);
ImageLine($img, $this->plot_area[0], $this->plot_area[1], $this->plot_area[2], $this->plot_area[3], $red);
ImageLine($img, $this->plot_area[0], $this->plot_area[3], $this->plot_area[2], $this->plot_area[1], $red);
}
示例2: SetIndexDarkColor
function SetIndexDarkColor($which_color)
{
list($r, $g, $b) = $this->SetRGBColor($which_color);
$r = max(0, $r - 0x30);
$g = max(0, $g - 0x30);
$b = max(0, $b - 0x30);
return ImageColorResolve($this->img, $r, $g, $b);
}
示例3: PrintError
function PrintError($error_message)
{
// Be sure not to loop recursively, e.g. PrintError - PrintImage - PrintError.
if (isset($this->in_error)) {
return FALSE;
}
$this->in_error = TRUE;
// Output an image containing the error message:
if (!empty($this->img)) {
$ypos = $this->image_height / 2;
$xpos = $this->image_width / 2;
$bgcolor = ImageColorResolve($this->img, 255, 255, 255);
$fgcolor = ImageColorResolve($this->img, 0, 0, 0);
ImageFilledRectangle($this->img, 0, 0, $this->image_width, $this->image_height, $bgcolor);
// Switch to built-in fonts, in case of error with TrueType fonts:
$this->SetUseTTF(FALSE);
$this->DrawText($this->fonts['generic'], 0, $xpos, $ypos, $fgcolor, wordwrap($error_message), 'center', 'center');
$this->PrintImage();
} elseif (!$this->is_inline) {
Header('HTTP/1.0 500 Internal Server Error');
}
trigger_error($error_message, E_USER_ERROR);
unset($this->in_error);
return FALSE;
# In case error handler returns, rather than doing exit().
}
示例4: SetIndexDarkColor
function SetIndexDarkColor($which_color)
{
list($r, $g, $b) = $this->SetRGBColor($which_color);
$r -= 0x30;
$r = $r < 0 ? 0 : $r;
$g -= 0x30;
$g = $g < 0 ? 0 : $g;
$b -= 0x30;
$b = $b < 0 ? 0 : $b;
$index = ImageColorExact($this->img, $r, $g, $b);
if ($index == -1) {
return ImageColorResolve($this->img, $r, $g, $b);
} else {
return $index;
}
}
示例5: SetIndexColor
function SetIndexColor($which_color)
{
//Color is passed in as anything
list($r, $g, $b) = $this->SetRgbColor($which_color);
//Translate to RGB
$index = ImageColorExact($this->img, $r, $g, $b);
if ($index == -1) {
//return ImageColorAllocate($this->img, $r, $g, $b);
//return ImageColorClosest($this->img, $r, $g, $b);
return ImageColorResolve($this->img, $r, $g, $b);
//requires PHP 3.0.2 and later
} else {
return $index;
}
}