本文整理汇总了PHP中getColor函数的典型用法代码示例。如果您正苦于以下问题:PHP getColor函数的具体用法?PHP getColor怎么用?PHP getColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getColor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw_clusters
function draw_clusters($tset, $clusters, $centroids = null, $lines = False, $w = 300, $h = 200)
{
if (!function_exists('imagecreate')) {
return null;
}
$im = imagecreatetruecolor($w, $h);
$white = imagecolorallocate($im, 255, 255, 255);
$colors = array();
$NC = count($clusters);
for ($i = 1; $i <= $NC; $i++) {
list($r, $g, $b) = getColor($i / $NC);
$colors[] = imagecolorallocate($im, $r, $g, $b);
}
imagefill($im, 0, 0, $white);
foreach ($clusters as $cid => $cluster) {
foreach ($cluster as $idx) {
$data = $tset[$idx]->getDocumentData();
imagesetpixel($im, $data['x'], $data['y'], $colors[$cid]);
}
if (is_array($centroids)) {
$x = $centroids[$cid]['x'];
$y = $centroids[$cid]['y'];
if ($lines) {
// draw line
// for cosine similarity
//imagesetthickness($im,5);
//imageline($im,0,0,$x*400,$y*400,$colors[$cid]);
} else {
// draw circle for euclidean
imagefilledarc($im, $x, $y, 10, 10, 0, 360, $colors[$cid], 0);
}
}
}
return $im;
}
示例2: createGistagramm
function createGistagramm($width, $heigth)
{
$image = @imagecreate($width, $heigth);
$maxKey = findMaxKey($this->array);
$maxValue = findMaxValue($this->array);
ImageColorAllocate($image, 255, 255, 255);
ImageLine($image, $this->align, $heigth - $this->align, $width - $this->align, $heigth - $this->align, 1);
ImageLine($image, $this->align, $this->align, $this->align, $heigth - $this->align, 1);
$widthRect = round(($width - 2 * $this->align) / ($maxKey + 1)) * $this->widthColumn;
foreach ($this->array as $key => $value) {
$color = getColor($image, $value, $maxValue);
$heigthRect = round($value * ($heigth - 2 * $this->align) / $maxValue);
$pos = round($key / ($maxKey + 1) * ($width - 2 * $this->align)) + $this->align;
ImageFilledRectangle($image, $pos - $widthRect / 2, $heigth - $heigthRect, $pos + $widthRect / 2, $heigth - $this->align, $color);
ImageString($image, 0, $pos - $widthRect / 2, $heigth - $heigthRect - 10, $value, 1);
ImageString($image, 0, $pos - $widthRect / 2, $heigth - $this->align, $key, 1);
}
$this->image = $image;
}
示例3: getPlayers
function getPlayers()
{
$mysqli = new MySQLi("localhost", "wotmanager", "DT5HtrpaUlJ3iVGm", "testing", 3306);
$stmt = $mysqli->prepare("SELECT ID,nick,battles,tier,wn8,wr,rwn8,rwr,clan,time FROM result order by time desc");
$stmt->bind_result($id, $nick, $battles, $tier, $wn8, $wr, $rwn8, $rwr, $clan, $updated);
$stmt->execute();
while ($stmt->fetch()) {
echo '<tr>
<td><b><a href="http://stats.wotmanager.com/na/player/' . $nick . '" target="_blank">' . $nick . '</a></b></td>
<td><b><font color="' . getColor($battles, "bat") . '">' . $battles . '</font></b></td>
<td><b><font color="' . getColor($tier, "tier") . '">' . $tier . '</font></b></td>
<td><b><font color="' . getColor($wn8, "wn8") . '">' . $wn8 . '</font></b></td>
<td><b><font color="' . getColor($wr, "wr") . '">' . $wr . '</font></b></td>
<td><b><font color="' . getColor($rwn8, "wn8") . '">' . $rwn8 . '</font></b></td>
<td><b><font color="' . getColor($rwr, "wr") . '">' . $rwr . '</font></b></td>
<td>' . $clan . '</td>
<td>' . $updated . '</td>
<td><a href="http://forum.worldoftanks.com/index.php?app=members&module=messaging§ion=send&do=form&preview=1&_from=quickPM&fromMemberID=' . $id . '"target="_blank"><i class="fa fa-envelope fa-lg"></i></a></td>
</tr>';
}
}
示例4: htmlGetSpots
function htmlGetSpots($data)
{
$retour = "";
$spots = getSpots($data);
$j = 1;
// Parcours les spots
foreach ($spots as $spot) {
$td_monstres = "";
$i = 0;
$level = 0;
// Parcours le spot
foreach ($spot as $monstre) {
if (count($monstre) != 1) {
$a = explode(" [", $monstre["name"]);
$name = trim($a[0]);
$age = trim(str_replace("]", "", $a[1]));
$td_monstres .= '<tr><td>' . $monstre["level"] . '</td>';
if ($monstre["level"] != "?") {
$level += $monstre["level"];
} else {
--$i;
}
$td_monstres .= '<td><a href="" onClick="window.open(\'http://games.mountyhall.com/mountyhall/View/MonsterView.php?ai_IDPJ=' . $monstre["id"] . '\',\'_blank\',\'toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width=766, height=636\');return(false);">' . $monstre["id"] . '</a></td>';
$td_monstres .= '<td><a href="/bestiaire2/bestiaire.php?Monstre=' . $name . '&Age=' . $age . '&MH=' . $monstre["id"] . '" target="_blank">' . $monstre["name"] . '</a></td>';
$td_monstres .= '<td><a href="/cockpit.php?cX=' . $monstre["X"] . '&cY=' . $monstre["Y"] . '&cZ=' . $monstre["N"] . '" target="_blank">' . $monstre["X"] . " " . $monstre["Y"] . " " . $monstre["N"] . "</a></td></tr>";
++$i;
}
}
// Affiche le spot si il correspond aux critères de recherche
if (intval($data["number"]) <= $i && intval($data["level"]) <= intval($level / $i)) {
$retour .= '<table class="mh_tdtitre" border="1" align="center" cellpadding="5"><tr bgcolor="' . getColor($i) . '"><th>Niv. Moyen : ' . intval($level / $i) . '</th><th colspan="3">Spot numéro : ' . $j . '</th></tr>' . $td_monstres . '</table><br/>';
}
++$j;
}
return $retour;
}
示例5: getTitle
echo getTitle(3);
?>
</div>
<p>
<span class="CuerpoArticulo"><?php
echo getCopete(3, 160);
?>
</span>
</p>
</div>
<div align="left" id="divNoticia4" style="cursor:hand; height:120px;" title="Click aquí para modificar la Noticia 4" onClick="editarNoticia(4)" onMouseOut="mouseOutNotica(4)" onMouseOver="mouseOverNotica(4)">
<div align="left" class="TituloNoticiasSecundarias" style="background-image: url('/modules/arteria_noticias/fondo_titulos/fondo_chico_<?php
echo getColor(4);
?>
.jpg'); background-repeat:no-repeat; color:#<?php
echo getColor(4);
?>
; height:53px; line-height:56px;"><?php
echo getTitle(4);
?>
</div>
<p>
<span class="CuerpoArticulo"><?php
echo getCopete(4, 160);
?>
</span>
</p>
</div>
</td>
</tr>
</table>
示例6: imagecreatetruecolor
$im = imagecreatetruecolor($title_row["w"], $title_row["h"]);
imageantialias($im, true);
imagealphablending($im, false);
$alpha = imagecolorallocatealpha($im, 255, 255, 255, 127);
imagefilledrectangle($im, 0, 0, $title_row["w"], $title_row["h"], $alpha);
imagealphablending($im, true);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
if ($title_row["type"] == "text") {
$commands = getLinesFromText($title_row["path"]);
} else {
$commands = array();
}
foreach ($commands as $c) {
if ($c["command"] == "poly") {
$color = getColor($id, $c["color"], $im);
imagefilledpolygon($im, $c["points"], count($c["points"]) / 2, $color);
} elseif ($c["command"] == "asset") {
$asset = imagecreatefrompng($c["asset"]);
imagecopy($im, $asset, $c["points"][0], $c["points"][1], 0, 0, $c["points"][2], $c["points"][3]);
} elseif ($c["command"] == "img") {
$imgsrc = getContent($id, $c["asset"]);
$img = imagecreatefrompng("{$imgsrc}");
$size = getimagesize("{$imgsrc}");
imagecopyresampled($im, $img, $c["points"][0], $c["points"][1], 0, 0, $c["points"][2], $c["points"][3], $size[0], $size[1]);
} elseif ($c["command"] == "text") {
$content = getContent($id, $c["content"]);
$font = getFont($c["font"]);
if ($c["align"] == "r") {
$r = imagefttext($im, $c["size"], 0, 700, 0, $white, $font, $content);
$c["points"][0] -= $r[2] - $r[0];
示例7: writeText
function writeText($image, $size, $xpos, $ypos, $color, $font, $text, $shadow)
{
$color = getColor($color, $image);
// Create a drop shadow
if ($shadow != '') {
$shadow = getColor($shadow, $image);
imagettftext($image, $size, 0, $xpos + 1, $ypos + 1, $shadow, $font, $text);
}
// Write the text
imagettftext($image, $size, 0, $xpos, $ypos, $color, $font, $text);
}
示例8: str_replace
<tr>
<td><img src="images/<?php
if (isset($_SESSION['color'][$flowername])) {
echo $_SESSION['color'][$flowername];
} else {
echo $_SESSION['image'][$flowername];
}
?>
.jpg" alt="" width="80" height="80"/></td>
<td><?php
echo str_replace('_', ' ', $flowername);
?>
</td>
<td><?php
if (isset($_SESSION['color'][$flowername])) {
echo getColor($_SESSION['color'][$flowername]);
} else {
echo ' ';
}
?>
</td>
<td><?php
echo $amount;
?>
</td>
<td>$<?php
echo $cost = $amount * $price[$flowername];
$total += $cost;
?>
</td>
</tr>
示例9: LinePlot
$graph->title->SetFont(FF_SIMSUN, FS_BOLD);
$graph->SetBox(false);
$graph->ygrid->SetFill(false);
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false, false);
$graph->yaxis->HideZeroLabel();
$graph->yaxis->title->Set(iconv("UTF-8", "GB2312//IGNORE", "得分"));
$graph->yaxis->title->SetFont(FF_SIMSUN, FS_BOLD);
$graph->xaxis->SetTickLabels($X);
$graph->xaxis->SetFont(FF_SIMSUN, FS_BOLD);
$graph->xaxis->title->Set(iconv("UTF-8", "GB2312//IGNORE", "日期"));
$graph->xaxis->title->SetFont(FF_SIMSUN, FS_BOLD);
$i = 0;
$p = new LinePlot($datas);
$graph->Add($p);
$color = getColor($i++);
$p->mark->SetType(MARK_FILLEDCIRCLE, '', 1.0);
$p->mark->SetColor($color);
$p->mark->SetFillColor($color);
$p->SetCenter();
$p->SetColor($color);
$p->value->SetFormat('%d');
$p->value->Show();
$p->value->SetColor($color);
$graph->Stroke();
exit;
} else {
die("No graph, please check your params!");
}
}
}
示例10: count
$tabla = "reclamos";
$id_proceso = "id_reclamo";
break;
}
$objDB->execute("SET lc_time_names = 'es_VE';");
$query = "SELECT nombre, count({$id_proceso}) AS total, id_usuario\n FROM {$tabla}\n INNER JOIN usuarios \n WHERE usuarios.id_usuario = {$tabla}.idusuario\n AND MONTHNAME(STR_TO_DATE(MONTH(fecha_registro), '%m'))='{$mes}'\n AND year = '{$year}' \n GROUP BY idusuario";
$rs = $objDB->getRecords($query);
$rows = array();
$indice = 0;
foreach ($rs as $data) {
$total = $data['total'];
$id_usuario = $data['id_usuario'];
settype($total, int);
settype($id_usuario, int);
$indice = $indice + 1;
$color = getColor($indice);
array_push($rows, array("c" => array(array("v" => $data['nombre']), array("v" => $total), array("v" => $id_usuario), array("v" => $color))));
}
if (isset($_GET['tipoProceso'])) {
$tipo_proceso = $_GET['tipoProceso'];
}
$cols = array(array("label" => "Nombre", "type" => "string"), array("label" => "Total por funcionario", "type" => "number"), array("label" => "Id Usuario", "type" => "number"), array("type" => "string", "role" => "style"));
//$rows = array(array("c"=>array(array("v"=>$tipo_proceso), array("v"=>$total))));//,
// array("c"=>array(array("v"=>"Solicitudes"),array("v"=>$totSolicitudes))),
// array("c"=>array(array("v"=>"Denuncias"),array("v"=>$totDenuncias))),
// array("c"=>array(array("v"=>"Reclamos"),array("v"=>$totReclamos))));
$data = array("cols" => $cols, "rows" => $rows);
echo json_encode($data);
}
?>
示例11: drawPath
function drawPath($myDoc, $name, $n, $weights)
{
global $doc, $SCALE, $dx, $dy;
$path = $doc->createElement("path");
$myD = "";
if (isset($name) && $name != "") {
$tree = $myDoc->getWeightedSubTree($name, $weights);
} else {
$tree = $myDoc->getWeightedTree($weights);
}
/*N
$totalWeight = 0;
for ($i=0; $i < count($tree); $i++) {
$totalWeight = $totalWeight + $weights[$tree[$i]->name];
}*/
drawAxis(count($tree));
$angle = 0;
for ($i = 0; $i < count($tree); $i++) {
/*N $delta = $weights[$tree[$i]->name]*2*pi()/$totalWeight;
$angle_text = $angle + $delta/2;
$angle = $angle + $delta;
drawSingleAxis($angle);*/
$myD .= $i == 0 ? "M" : "L";
//N: should be commented
$angle = ($i + 1) * 2 * pi() / count($tree);
$x = $tree[$i]->score * $SCALE * cos($angle);
$x = $x + $dx;
$y = $tree[$i]->score * $SCALE * sin($angle);
$y = $y + $dy;
$myD .= " {$x} {$y} ";
//2.1 = 2 + 0.1 of padding before actual text display
//N: drawText(2.1*$SCALE*cos($angle_text), 2.1*$SCALE*sin($angle_text), $tree[$i]);
drawText(2.1 * $SCALE * cos($angle), 2.1 * $SCALE * sin($angle), $tree[$i]);
}
$myD .= "z";
$path->setAttribute("d", $myD);
$path->setAttribute("fill", getColor($n));
$path->setAttribute("fill-opacity", "0.2");
$path->setAttribute("stroke-width", "3");
$path->setAttribute("stroke", getColor($n));
return $path;
}
示例12: BRIGHT
function BRIGHT($rgb, $mult = 1.5)
{
getRGB($rgb, $r, $g, $b);
$darker = false;
if ($mult < 0) {
$darker = true;
$mult = -$mult;
}
$a = round(($r - 128) * $mult - ($r - 128));
$ag = round(($g - 128) * $mult - ($g - 128));
$ab = round(($b - 128) * $mult - ($b - 128));
if (abs($ag) > abs($a)) {
$a = $ag;
}
if (abs($ab) > abs($a)) {
$a = $ab;
}
if ($darker) {
$r = $r - $a;
$g = $g - $a;
$b = $b - $a;
} else {
$r = $r + $a;
$g = $g + $a;
$b = $b + $a;
}
$r = $r > 255 ? 255 : ($r < 0 ? 0 : $r);
$g = $g > 255 ? 255 : ($g < 0 ? 0 : $g);
$b = $b > 255 ? 255 : ($b < 0 ? 0 : $b);
return getColor($r, $g, $b);
}
示例13: getColor
<td><input class="style_input" type="text" id="wordColor" name="wordColor" value="<?php
echo getColor("wordColor", "#000000");
?>
" /></td>
</tr>
<tr>
<td class="style_title">边框颜色:</td>
<td><input class="style_input" type="text" id="border" name="border" value="<?php
echo getColor("border", "#C7C5B8");
?>
" /></td>
</tr>
<tr>
<td class="style_title">横条颜色:</td>
<td><input class="style_input" type="text" id="line" name="line" value="<?php
echo getColor("line", "#FFFFFF");
?>
" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" style="float:left;" class="submit_btn" value="保存" />
<a href="setting.php?reset=true" class="link_btn" style="float:left;" >恢复默认</a>
</td>
</tr>
</table>
</form>
<?php
} else {
if ($type == 1) {
?>
示例14: preg_match_all
}
if ($process) {
preg_match_all("/{[^{]*/", $s, $points);
foreach ($points[0] as $point) {
$point = rtrim($point);
// remove possible trailing newline
// 1: first half
// 2: point ID
// 3: P or L or ''
// 4: second half
// 5, 6, 7: x, y, z
if (preg_match("/({([^}]*)} ?([PL])?)([^-0-9]*(-?[0-9]+\\.[0-9]*)[ ,]+(-?[0-9]+\\.[0-9]*)[ ,]+(-?[0-9]+\\.[0-9]*))/", $point, $parts)) {
$x = $parts[5] + 0.0;
$y = $parts[6] + 0.0;
$z = $parts[7] + 0.0;
$color = getColor($parts[2]);
if ($hasPrev && $parts[3] != 'P') {
fwrite($stdout, "{}U {$prevColor} " . ($x + $prevX) / 2.0 . " " . ($y + $prevY) / 2.0 . " " . ($z + $prevZ) / 2.0 . "\n");
fwrite($stdout, "{$parts['1']} {$color} {$parts['4']}\n");
} else {
fwrite($stdout, $point . "\n");
}
$hasPrev = TRUE;
$prevX = $x;
$prevY = $y;
$prevZ = $z;
$prevColor = $color;
}
}
} else {
fwrite($stdout, $s);
示例15: GraphSonda
//.........这里部分代码省略.........
$skip = true;
}
if (isset($_SESSION['filter']['P5']) && $row['value'] < $percentile['P5']) {
$skip = true;
}
if (!$skip) {
if (!isset($theSondaAvg[$tk])) {
$theSondaAvg[$tk] = array($tk, 0, 0);
}
if (!isset($theSondaQoE[$tk])) {
$theSondaQoE[$tk] = array($tk, 0, 0);
}
$sum = $theSondaAvg[$tk][1];
$cnt = $theSondaAvg[$tk][2];
$x = $sum + $row['value'];
$y = $cnt + 1;
$theSondaAvg[$tk] = array($tk, $x, $y);
if ($row['value'] > $nominal) {
$row['value'] = $nominal;
}
$sum = $theSondaQoE[$tk][1];
$cnt = $theSondaQoE[$tk][2];
$x = $sum + $row['value'];
$y = $cnt + 1;
$theSondaQoE[$tk] = array($tk, $x, $y);
}
}
}
if (isset($theSondaAvg)) {
aasort($theSondaAvg, 0);
$next = 0;
$prev = 0;
foreach ($theSondaAvg as $tvalue) {
$next = $tvalue[0] + $offset;
if ($prev > 0 && $next > 0 && $next - $prev > $divide * 2) {
$dataAvg[] = array(($prev + 1000) * 1000, null);
}
$dataAvg[] = array($next * 1000, round($tvalue[1] / $tvalue[2] / $div, 2));
$prev = $next;
}
aasort($theSondaQoE, 0);
$next = 0;
$prev = 0;
foreach ($theSondaQoE as $tvalue) {
$next = $tvalue[0] + $offset;
if ($prev > 0 && $next > 0 && $next - $prev > $divide * 2) {
$dataQoE[] = array(($prev + 1000) * 1000, null);
}
$dataQoE[] = array($next * 1000, round($tvalue[1] / $tvalue[2] / $div, 2));
$prev = $next;
}
}
if (isset($dataAvg)) {
if (!isset($minClock)) {
$minClock = $dataAvg[0][0];
$maxClock = $dataAvg[count($dataAvg) - 1][0];
} else {
if ($dataAvg[0][0] < $minClock) {
$minClock = $dataAvg[0][0];
}
if ($dataAvg[count($dataAvg) - 2][0] > $maxClock) {
$maxClock = $dataAvg[count($dataAvg) - 2][0];
}
}
if ($_GET['qoe'] == 'Average On' || $_GET['qoe'] == 'Both') {
$chart->series[]->name = $hostName . "-AVG";
$chart->series[$index]->type = 'spline';
$chart->series[$index]->dashStyle = 'spline';
$chart->series[$index]->data = $dataAvg;
$chart->series[$index]->color = getColor($colorIndex);
$chart->series[$index]->lineWidth = 1;
$chart->series[$index]->marker->radius = 2;
$index++;
}
if ($_GET['qoe'] == 'QoE On' || $_GET['qoe'] == 'Both') {
$chart->series[]->name = $hostName . '-QoE';
$chart->series[$index]->type = 'shortdot';
$chart->series[$index]->color = getColor($colorIndex);
$chart->series[$index]->data = $dataQoE;
$chart->series[$index]->lineWidth = 1;
$chart->series[$index]->marker->radius = 2;
$index++;
}
$colorIndex++;
}
}
}
$title = 'Sondas for "' . $ldata['item'] . '" on plan "' . $ldata['plan'] . '"';
$subtitle = 'From ' . $ldata['from'] . ' to ' . $ldata['to'];
$chart = chartHeader($chart, $id_chart, $title, $subtitle, $ldata['unit'], null);
if (!isset($minClock)) {
$minClock = 0;
$maxClock = 0;
}
$chart->xAxis->type = 'datetime';
$chart->tooltip->formatter = new HighchartJsExpr("\n function() {\n var s = '<b>'+ Highcharts.dateFormat('%e. %b %H:%M',this.x) +'</b>'; \n \$.each(this.points, function(i, point) {\n s += '<br/><span style=\"color:'+point.series.color+'\">'+ point.series.name +': '+ point.y +' " . $ldata['unit'] . "</span><b>';\n });\n return s;\n }");
echo "\n" . '<script> function redraw() { chart1.xAxis[0].setExtremes(' . $minClock . ', ' . (round($maxClock / (3600 * 24), 0) * 3600 * 24 + $divide * 1000) . ');} </script>';
//var_dump($chart->chart);
return $chart;
}