本文整理汇总了PHP中Color::getDefault方法的典型用法代码示例。如果您正苦于以下问题:PHP Color::getDefault方法的具体用法?PHP Color::getDefault怎么用?PHP Color::getDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color::getDefault方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: values
function values(array $v = NULL)
{
if ($v !== NULL) {
if (isset($v['bgcolors']) && is_array($v['bgcolors'])) {
$this->values['bgcolors'] = array_filter($v['bgcolors'], function ($a) {
return $a instanceof Color;
});
}
if (isset($v['fgcolors']) && is_array($v['fgcolors'])) {
$this->values['fgcolors'] = array_filter($v['fgcolors'], function ($a) {
return $a instanceof Color;
});
}
if (isset($v['font']) && $v['font'] instanceof Font) {
$this->values['font'] = $v['font'];
}
if (isset($v['labels'])) {
$this->values['labels'] = $v['labels'];
}
if (count($this->values['bgcolors']) == 0) {
$this->values['bgcolors'][] = Color::getDefault();
}
if (count($this->values['fgcolors']) == 0) {
$this->values['fgcolors'][] = Color::getDefault();
}
}
return $this->values;
}
示例2: drawValues
function drawValues($image, Boundary $b)
{
$out = $this->getValuesArea($b);
if ($out->width() < $this->depth || $out->height() < $this->depth || $out->left() > $out->right() || $out->top() > $out->bottom()) {
throw new ChartException("Недостаточно места для вывода значений.");
}
$line = new Line(new Boundary(0, 0, 0, 0), $this->values['bgcolors'][0], $this->values['thickness']);
$w = ($out->width() - $this->depth) / count($this->data);
$l = new Label(new Boundary(0, 0, 0, 0), '', $this->values['font'], Color::getDefault(), Label::ALIGN_CENTER_MIDDLE);
$e = new Ellipse(new Boundary(0, 0, $this->values['thickness'] * 3, $this->values['thickness'] * 3));
for ($i = 0; $i < count($this->data); $i++) {
$c = $out->left() + $w * $i + $w / 2.0;
$line->bounds()->right($c);
$line->bounds()->bottom($out->bottom() - ($this->data[$i] - $this->min) * $out->height() / ($this->max - $this->min));
$line->background($this->values['bgcolors'][$i % count($this->values['bgcolors'])]);
if ($i != 0) {
$line->draw($image);
$e->bounds()->move(new Size($line->bounds()->left() - $this->values['thickness'] * 3 / 2, $line->bounds()->top() - $this->values['thickness'] * 3 / 2));
$e->background($this->values['bgcolors'][($i - 1) % count($this->values['bgcolors'])]);
$e->draw($image);
}
$line->bounds()->left($line->bounds()->right());
$line->bounds()->top($line->bounds()->bottom());
if ($this->values['labels']) {
$l->text($this->data[$i]);
$l->bounds()->bottom($line->bounds()->top() - 5);
$l->bounds()->top($l->bounds()->bottom() - $this->values['font']->getTextExtent()->height);
$l->bounds()->left($line->bounds()->left());
$l->bounds()->right($line->bounds()->left());
$l->background($this->values['fgcolors'][$i % count($this->values['fgcolors'])]);
$l->draw($image);
}
}
$e->bounds()->move(new Size($line->bounds()->left() - $this->values['thickness'] * 3 / 2, $line->bounds()->top() - $this->values['thickness'] * 3 / 2));
$e->background($line->background());
$e->draw($image);
}
示例3: drawValues
function drawValues($image, Boundary $b)
{
$out = $this->getValuesArea($b);
if ($out->width() < $this->depth || $out->height() < $this->depth || $out->left() > $out->right() || $out->top() > $out->bottom()) {
throw new ChartException("Недостаточно места для вывода значений.");
}
$r = new Rectangle3D(new Boundary(0, 0, 0, 0), NULL, Color::getDefault(), NULL, $this->depth);
$w = ($out->width() - $this->depth) / count($this->data);
$wr = $w / 1.5 - $this->depth;
$l = new Label(new Boundary(0, 0, 0, 0), '', $this->values['font'], Color::getDefault(), Label::ALIGN_CENTER_MIDDLE);
for ($i = 0; $i < count($this->data); $i++) {
$c = $out->left() + $w * $i + $w / 2.0;
$r->bounds()->left($c - $wr / 2);
$r->bounds()->right($c + $wr / 2);
$r->bounds()->top($out->bottom() - ($this->data[$i] - $this->min) * $out->height() / ($this->max - $this->min));
$r->bounds()->bottom($out->bottom() - 1);
$r->background($this->values['bgcolors'][$i % count($this->values['bgcolors'])]);
$r->draw($image);
$l->text($this->data[$i]);
if (($h = $this->values['font']->getTextExtent()->height) > $r->bounds()->height()) {
$r->bounds()->bottom($r->bounds()->top());
$r->bounds()->top($r->bounds()->bottom() - $h);
}
if ($this->values['labels']) {
$l->bounds($r->bounds());
$l->background($this->values['fgcolors'][$i % count($this->values['fgcolors'])]);
$l->draw($image);
}
}
}
示例4: __construct
function __construct(Boundary $bound, Color $bgcolor = NULL)
{
$this->bound = Boundary::copyOrDefault($bound);
$this->background($bgcolor) or $this->bgcolor = Color::getDefault();
}