本文整理匯總了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;
}
}