本文整理汇总了PHP中Canvas::setColorANSI方法的典型用法代码示例。如果您正苦于以下问题:PHP Canvas::setColorANSI方法的具体用法?PHP Canvas::setColorANSI怎么用?PHP Canvas::setColorANSI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas::setColorANSI方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
die("Error while attaching canvas to display\n");
}
$pig->setColorANSI(AnsiColor::LIGHTMAGENTA, AnsiColor::TRANSPARENT);
$pig->importString($pig_str, "text");
$display->setDisplayTime(20000);
$x = $y = 0;
$ix = $iy = 1;
while (!$display->getEvent(EventType::KEY_PRESS)) {
// In case of resize ...
if ($x + $pig->getWidth() - 1 >= $canvas->getWidth() || $x < 0) {
$x = 0;
}
if ($y + $pig->getHeight() - 1 >= $canvas->getHeight() || $y < 0) {
$y = 0;
}
$canvas->Clear();
// Draw
$canvas->Blit($x, $y, $pig, NULL);
$canvas->setColorANSI(AnsiColor::LIGHTBLUE, AnsiColor::BLACK);
$canvas->putStr($canvas->getWidth() / 2 - 10, $canvas->getHeight() / 2, "Powered by libcaca " . Libcaca::getVersion());
$display->refresh();
// Move cursor
$x += $ix;
$y += $iy;
if ($x + $pig->getWidth() >= $canvas->getWidth() || $x < 0) {
$ix = -$ix;
}
if ($y + $pig->getHeight() >= $canvas->getHeight() || $y < 0) {
$iy = -$iy;
}
}