本文整理汇总了PHP中ImageFilledPolygon函数的典型用法代码示例。如果您正苦于以下问题:PHP ImageFilledPolygon函数的具体用法?PHP ImageFilledPolygon怎么用?PHP ImageFilledPolygon使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ImageFilledPolygon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: circle
function circle($arr)
{
$pos = 100;
// choose a color for the ellipse
$col_ellipse = imagecolorallocate($this->im, 200, 200, 200);
$col_ellipse_top = imagecolorallocate($this->im, 180, 180, 180);
// draw the ellipse
imagefilledellipse($this->im, 150, $pos + 10, 200, 100, $col_ellipse);
imagefilledellipse($this->im, 150, $pos, 200, 100, $col_ellipse_top);
$arrCount = count($arr);
$start = 0;
$gesamt = 0;
$textline = 20;
for ($x = 0; $arrCount > $x; $x++) {
$move = $arr[$x]['size'] * 3.6 + $gesamt;
$add = $arr[$x]['size'] * 3.6;
$fillcolor = ImageColorAllocate($this->im, rand(0, 255), rand(0, 255), rand(0, 255));
$black = ImageColorAllocate($this->im, 0, 0, 0);
// Startpunkte / mitte des Kuchens
$point[] = 150;
$point[] = $pos;
$radius = 100;
for ($i = $start; $i <= $move; $i++) {
$point[] = 150 + $radius * sin(deg2rad($i));
$point[] = $pos - $radius * cos(deg2rad($i)) * 0.5;
}
$start = $i;
ImageFilledPolygon($this->im, $point, sizeof($point) / 2, $fillcolor);
unset($point);
$textline = $textline + 15;
imagefilledrectangle($this->im, 300 - 15, $textline + 2, 300 - 5, $textline + 13, $fillcolor);
imagerectangle($this->im, 300 - 5, $textline + 2, 300 - 15, $textline + 13, $black);
ImageString($this->im, 2, 300, $textline, $arr[$x]['name'], $this->text_color);
$gesamt = $gesamt + $add;
}
}
示例2:
//=================================
//=================================
// Polygone 5/20
unset($tab5);
$tab5=array();
for($i=0;$i<$nbMat;$i++){
$angle=round($i*360/$nbMat);
//writinfo('/tmp/infos_graphe.txt','a+',"\$angle=$angle\n");
$tab=coordcirc(5,$angle);
$tab5[]=$tab[0];
$tab5[]=$tab[1];
}
ImageFilledPolygon($img,$tab5,count($tab5)/2,$bande1);
//=================================
//=================================
// Axes
for($i=0;$i<count($tab20)/2;$i++){
imageline ($img,$x0,$y0,$tab20[2*$i],$tab20[2*$i+1],$axes);
if($i>0){
imageline ($img,$tab20[2*($i-1)],$tab20[2*($i-1)+1],$tab20[2*$i],$tab20[2*$i+1],$axes);
}
else{
//imageline ($img,$tab20[2*count($tab20)/2],$tab20[2*count($tab20)/2+1],$tab20[2*$i],$tab20[2*$i+1],$axes);
}
}
imageline ($img,$tab20[0],$tab20[1],$tab20[2*($i-1)],$tab20[2*($i-1)+1],$axes);
示例3: DrawSquaredArea
/**
* Draws a squaredarea or stackedsquaredarea plot (Squared Area)
*
* This is the main function for drawing squaredarea and stackedsquaredarea plots,
* which area a blend of 'squared' plus either 'area' or 'stackedarea'. Supported
* data types are data-data and text-data. Missing points are not allowed,
* and all data sets must have the same number of points.
*
* @param bool $do_stacked True for cumulative (stacked), false or omit for unstacked.
* @return bool True (False on error if an error handler returns True)
*/
protected function DrawSquaredArea($do_stacked = FALSE)
{
if (!$this->CheckDataType('text-data, data-data')) {
return FALSE;
}
// Validation: Need at least 2 rows; all rows must have same number of columns.
if (($n_rows = $this->num_data_rows) < 2) {
return TRUE;
}
if ($this->records_per_group != min($this->num_recs)) {
return $this->PrintError("DrawSquaredArea(): Data array must contain the same number" . " of Y values for each X");
}
// Calculate and store device coordinates xd[] and yd[][], and draw the data labels.
$n_columns = $this->SetupAreaPlot($do_stacked, $xd, $yd);
// Draw a filled polygon for each Y column
$prev_col = 0;
for ($col = 1; $col < $n_columns; $col++) {
// 1 extra for X axis artificial column
// Current data set forms the top. For each point after the first, add 2 points.
$x_prev = $xd[0];
$y_prev = $yd[0][$col];
$pts = array($x_prev, $y_prev);
// Bottom left point
for ($row = 1; $row < $n_rows; $row++) {
$x = $xd[$row];
$y = $yd[$row][$col];
array_push($pts, $x, $y_prev, $x, $y);
$x_prev = $x;
$y_prev = $y;
}
// Previous data set forms the bottom. Process right to left.
// Note $row is now $n_rows, and it will be stepped back to 0.
$row--;
$x_prev = $xd[$row];
$y_prev = $yd[$row][$prev_col];
array_push($pts, $x_prev, $y_prev);
// Bottom right point
while (--$row >= 0) {
$x = $xd[$row];
$y = $yd[$row][$prev_col];
array_push($pts, $x_prev, $y, $x, $y);
$x_prev = $x;
$y_prev = $y;
}
// Draw the resulting polygon, which has (2 * (1 + 2*(n_rows-1))) points:
ImageFilledPolygon($this->img, $pts, 4 * $n_rows - 2, $this->ndx_data_colors[$prev_col]);
$prev_col = $col;
}
// Draw the data borders, if enabled. (After, else the area fills cover parts of it.)
if (!empty($this->draw_data_borders)) {
$this->DrawAreaFillBorders($n_columns, $xd, $yd, $do_stacked, TRUE);
}
return TRUE;
}
示例4: _done
/**
* Output the plot
* @access private
*/
function _done()
{
parent::_done();
$totalY = 0;
$this->_dataset->_reset();
while ($point = $this->_dataset->_next()) {
$totalY += $point['Y'];
}
$centerX = (int) (($this->_left + $this->_right) / 2);
$centerY = (int) (($this->_top + $this->_bottom) / 2);
$diameter = min($this->height(), $this->width()) * 0.75;
$currentY = 0; //rand(0, 100)*$totalY/100;
$this->_dataset->_reset();
while ($point = $this->_dataset->_next()) {
$angle1 = 360 * ($currentY / $totalY);
$currentY += $point['Y'];
$angle2 = 360 * ($currentY / $totalY);
$dX = $diameter * ($this->_radius / 100) * cos(deg2rad(($angle1 + $angle2) / 2));
$dY = $diameter * ($this->_radius / 100) * sin(deg2rad(($angle1 + $angle2) / 2));
$dD = sqrt($dX * $dX + $dY * $dY);
$polygon[] = $centerX;
$polygon[] = $centerY;
$angle = min($angle1, $angle2);
$dA = 360 / (pi() * $diameter);
while ($angle <= max($angle1, $angle2)) {
$polygon[] = ($centerX + ($diameter / 2) * cos(deg2rad($angle % 360)));
$polygon[] = ($centerY + ($diameter / 2) * sin(deg2rad($angle % 360)));
$angle += $dA;
}
if ($angle != max($angle1, $angle2)) {
$polygon[] = ($centerX + ($diameter / 2) * cos(deg2rad($angle2 % 360)));
$polygon[] = ($centerY + ($diameter / 2) * sin(deg2rad($angle2 % 360)));
}
//ImageFilledArc($this->_canvas(), $centerX+$dX, $centerY+$dY, $diameter-$dD, $diameter-$dD, $angle1 % 360, $angle2 % 360, $this->_getFillStyle(), IMG_ARC_PIE);
//ImageFilledArc($this->_canvas(), $centerX+$dX, $centerY+$dY, $diameter-$dD, $diameter-$dD, $angle1 % 360, $angle2 % 360, $this->_getLineStyle(), IMG_ARC_NOFILL+IMG_ARC_EDGED);
ImageFilledPolygon($this->_canvas(), $polygon, count($polygon) / 2, $this->_getFillStyle());
//echo $this->_getFillStyle();
// Modified: Don't draw border
//ImagePolygon($this->_canvas(), $polygon, count($polygon) / 2, $this->_getLineStyle());
unset ($polygon);
}
//ImageEllipse($this->_canvas(), $centerX, $centerY, $diameter, $diameter, 0);
$this->_drawMarker();
}
示例5: drawArrow
function drawArrow($X1, $Y1, $X2, $Y2, $Format = "")
{
$FillR = isset($Format["FillR"]) ? $Format["FillR"] : 0;
$FillG = isset($Format["FillG"]) ? $Format["FillG"] : 0;
$FillB = isset($Format["FillB"]) ? $Format["FillB"] : 0;
$BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $FillR;
$BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $FillG;
$BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $FillB;
$Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
$Size = isset($Format["Size"]) ? $Format["Size"] : 10;
$Ratio = isset($Format["Ratio"]) ? $Format["Ratio"] : 0.5;
$TwoHeads = isset($Format["TwoHeads"]) ? $Format["TwoHeads"] : FALSE;
$Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : FALSE;
/* Calculate the line angle */
$Angle = $this->getAngle($X1, $Y1, $X2, $Y2);
/* Override Shadow support, this will be managed internally */
$RestoreShadow = $this->Shadow;
if ($this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0) {
$this->Shadow = FALSE;
$this->drawArrow($X1 + $this->ShadowX, $Y1 + $this->ShadowY, $X2 + $this->ShadowX, $Y2 + $this->ShadowY, array("FillR" => $this->ShadowR, "FillG" => $this->ShadowG, "FillB" => $this->ShadowB, "Alpha" => $this->Shadowa, "Size" => $Size, "Ratio" => $Ratio, "TwoHeads" => $TwoHeads, "Ticks" => $Ticks));
}
/* Draw the 1st Head */
$TailX = cos(($Angle - 180) * PI / 180) * $Size + $X2;
$TailY = sin(($Angle - 180) * PI / 180) * $Size + $Y2;
$Points = "";
$Points[] = $X2;
$Points[] = $Y2;
$Points[] = cos(($Angle - 90) * PI / 180) * $Size * $Ratio + $TailX;
$Points[] = sin(($Angle - 90) * PI / 180) * $Size * $Ratio + $TailY;
$Points[] = cos(($Angle - 270) * PI / 180) * $Size * $Ratio + $TailX;
$Points[] = sin(($Angle - 270) * PI / 180) * $Size * $Ratio + $TailY;
$Points[] = $X2;
$Points[] = $Y2;
/* Visual correction */
if ($Angle == 180 || $Angle == 360) {
$Points[4] = $Points[2];
}
if ($Angle == 90 || $Angle == 270) {
$Points[5] = $Points[3];
}
$ArrowColor = $this->allocateColor($this->Picture, $FillR, $FillG, $FillB, $Alpha);
ImageFilledPolygon($this->Picture, $Points, 4, $ArrowColor);
$this->drawLine($Points[0], $Points[1], $Points[2], $Points[3], array("R" => $BorderR, "G" => $BorderG, "B" => $BorderB, "Alpha" => $Alpha));
$this->drawLine($Points[2], $Points[3], $Points[4], $Points[5], array("R" => $BorderR, "G" => $BorderG, "B" => $BorderB, "Alpha" => $Alpha));
$this->drawLine($Points[0], $Points[1], $Points[4], $Points[5], array("R" => $BorderR, "G" => $BorderG, "B" => $BorderB, "Alpha" => $Alpha));
/* Draw the second head */
if ($TwoHeads) {
$Angle = $this->getAngle($X2, $Y2, $X1, $Y1);
$TailX2 = cos(($Angle - 180) * PI / 180) * $Size + $X1;
$TailY2 = sin(($Angle - 180) * PI / 180) * $Size + $Y1;
$Points = "";
$Points[] = $X1;
$Points[] = $Y1;
$Points[] = cos(($Angle - 90) * PI / 180) * $Size * $Ratio + $TailX2;
$Points[] = sin(($Angle - 90) * PI / 180) * $Size * $Ratio + $TailY2;
$Points[] = cos(($Angle - 270) * PI / 180) * $Size * $Ratio + $TailX2;
$Points[] = sin(($Angle - 270) * PI / 180) * $Size * $Ratio + $TailY2;
$Points[] = $X1;
$Points[] = $Y1;
/* Visual correction */
if ($Angle == 180 || $Angle == 360) {
$Points[4] = $Points[2];
}
if ($Angle == 90 || $Angle == 270) {
$Points[5] = $Points[3];
}
$ArrowColor = $this->allocateColor($this->Picture, $FillR, $FillG, $FillB, $Alpha);
ImageFilledPolygon($this->Picture, $Points, 4, $ArrowColor);
$this->drawLine($Points[0], $Points[1], $Points[2], $Points[3], array("R" => $BorderR, "G" => $BorderG, "B" => $BorderB, "Alpha" => $Alpha));
$this->drawLine($Points[2], $Points[3], $Points[4], $Points[5], array("R" => $BorderR, "G" => $BorderG, "B" => $BorderB, "Alpha" => $Alpha));
$this->drawLine($Points[0], $Points[1], $Points[4], $Points[5], array("R" => $BorderR, "G" => $BorderG, "B" => $BorderB, "Alpha" => $Alpha));
$this->drawLine($TailX, $TailY, $TailX2, $TailY2, array("R" => $BorderR, "G" => $BorderG, "B" => $BorderB, "Alpha" => $Alpha, "Ticks" => $Ticks));
} else {
$this->drawLine($X1, $Y1, $TailX, $TailY, array("R" => $BorderR, "G" => $BorderG, "B" => $BorderB, "Alpha" => $Alpha, "Ticks" => $Ticks));
}
/* Re-enable shadows */
$this->Shadow = $RestoreShadow;
}
示例6: DrawArea
function DrawArea()
{
$width = $this->chart_area[2] - $this->chart_area[0];
$height = $this->chart_area[3] - $this->chart_area[1];
$step = $width / $this->record_count_group;
$corr = $step / 2;
$xpos = $step;
$init = $this->chart_area[0];
for ($i = 0; $i < $this->record_group; $i++) {
$x = $this->chart_area[0] + $corr;
$x = round($x, 0);
$y = $this->chart_area[3];
$posarr[$i][] = $x;
$posarr[$i][] = $y;
}
foreach ($this->data_values as $row) {
$arrcounter = 0;
foreach ($row as $v) {
if ($v != $row[0]) {
$x = $xpos + $init - $corr;
$y = $this->chart_area[3] - $v / $this->record_max * $height;
$x = round($x, 0);
$y = round($y, 0);
$posarr[$arrcounter][] = $x;
$posarr[$arrcounter][] = $y;
$arrcounter++;
}
}
$xpos += $step;
}
for ($i = 0; $i < $this->record_group; $i++) {
$x = $this->chart_area[2] - $corr;
$y = $this->chart_area[3];
$posarr[$i][] = $x;
$posarr[$i][] = $y;
}
$colcount = 0;
foreach ($posarr as $row) {
if ($colcount >= count($this->bar_color)) {
$colcount = 0;
}
$barcol = $this->col_bar_color[$colcount];
ImageFilledPolygon($this->img, $row, count($row) / 2, $barcol);
$colcount++;
}
}
示例7: draw_brush
function draw_brush($x, $y, $size, $type, $colour)
{
$x = round($x);
$y = round($y);
$half = round($size / 2);
switch ($type) {
case 'circle':
ImageArc($this->image, $x, $y, $size, $size, 0, 360, $this->colour[$colour]);
ImageFillToBorder($this->image, $x, $y, $this->colour[$colour], $this->colour[$colour]);
break;
case 'square':
ImageFilledRectangle($this->image, $x - $half, $y - $half, $x + $half, $y + $half, $this->colour[$colour]);
break;
case 'vertical':
ImageFilledRectangle($this->image, $x, $y - $half, $x + 1, $y + $half, $this->colour[$colour]);
break;
case 'horizontal':
ImageFilledRectangle($this->image, $x - $half, $y, $x + $half, $y + 1, $this->colour[$colour]);
break;
case 'slash':
ImageFilledPolygon($this->image, array($x + $half, $y - $half, $x + $half + 1, $y - $half, $x - $half + 1, $y + $half, $x - $half, $y + $half), 4, $this->colour[$colour]);
break;
case 'backslash':
ImageFilledPolygon($this->image, array($x - $half, $y - $half, $x - $half + 1, $y - $half, $x + $half + 1, $y + $half, $x + $half, $y + $half), 4, $this->colour[$colour]);
break;
default:
@eval($type);
// user can create own brush script.
}
}
示例8: pieslice
/**
* Draw a pie slice
*
* Parameter array:
*
* 'x': int X center point
*
* 'y': int Y center point
*
* 'rx': int X radius
*
* 'ry': int Y radius
*
* 'v1': int The starting angle (in degrees)
*
* 'v2': int The end angle (in degrees)
*
* 'srx': int [optional] Starting X-radius of the pie slice (i.e. for a doughnut)
*
* 'sry': int [optional] Starting Y-radius of the pie slice (i.e. for a doughnut)
*
* 'fill': mixed [optional] The fill color
*
* 'line': mixed [optional] The line color
*
* @param array $params Parameter array
*/
function pieslice($params)
{
$x = $this->_getX($params['x']);
$y = $this->_getY($params['y']);
$rx = $params['rx'];
$ry = $params['ry'];
$v1 = $params['v1'];
$v2 = $params['v2'];
$srx = isset($params['srx']) ? $params['srx'] : 0;
$sry = isset($params['sry']) ? $params['sry'] : 0;
$fillColor = isset($params['fill']) ? $params['fill'] : false;
$lineColor = isset($params['line']) ? $params['line'] : false;
$dA = 0.1;
if ($srx !== false && $sry !== false) {
$angle = max($v1, $v2);
while ($angle >= min($v1, $v2)) {
$polygon[] = $x + $srx * cos(deg2rad($angle % 360));
$polygon[] = $y + $sry * sin(deg2rad($angle % 360));
$angle -= $dA;
}
if ($angle + $dA > min($v1, $v2)) {
$polygon[] = $x + $srx * cos(deg2rad(min($v1, $v2) % 360));
$polygon[] = $y + $sry * sin(deg2rad(min($v1, $v2) % 360));
}
} else {
$polygon[] = $x;
$polygon[] = $y;
}
$angle = min($v1, $v2);
while ($angle <= max($v1, $v2)) {
$polygon[] = $x + $rx * cos(deg2rad($angle % 360));
$polygon[] = $y + $ry * sin(deg2rad($angle % 360));
$angle += $dA;
}
if ($angle - $dA < max($v1, $v2)) {
$polygon[] = $x + $rx * cos(deg2rad(max($v1, $v2) % 360));
$polygon[] = $y + $ry * sin(deg2rad(max($v1, $v2) % 360));
}
if (($fill = $this->_getFillStyle($fillColor, $x - $rx - 1, $y - $ry - 1, $x + $rx + 1, $y + $ry + 1)) !== false && count($polygon) > 2) {
ImageFilledPolygon($this->_canvas, $polygon, count($polygon) / 2, $fill);
}
if (($line = $this->_getLineStyle($lineColor)) !== false) {
ImagePolygon($this->_canvas, $polygon, count($polygon) / 2, $line);
}
parent::pieSlice($params);
}
示例9: DrawStackedBars
function DrawStackedBars()
{
if ($this->data_type != 'text-data') {
$this->DrawError('DrawStackedBars(): Bar plots must be text-data: use SetDataType("text-data")');
return FALSE;
}
for ($row = 0; $row < $this->num_data_rows; $row++) {
$record = 1;
// Skip record #0 (data label)
$x_now_pixels = $this->xtr(0.5 + $row);
// Place text-data at X = 0.5, 1.5, 2.5, etc...
if ($this->x_data_label_pos != 'none') {
// Draw X Data labels?
$this->DrawXDataLabel($this->data[$row][0], $x_now_pixels);
}
// Draw the bars
$oldv = 0;
for ($idx = 0; $record < $this->num_recs[$row]; $record++, $idx++) {
if (is_numeric($this->data[$row][$record])) {
// Allow for missing Y data
$x1 = $x_now_pixels - $this->data_group_space;
$x2 = $x_now_pixels + $this->data_group_space;
$y1 = $this->ytr(abs($this->data[$row][$record]) + $oldv);
$y2 = $this->ytr($this->x_axis_position + $oldv);
$oldv += abs($this->data[$row][$record]);
if ($this->shading) {
// Draw the shade?
ImageFilledPolygon($this->img, array($x1, $y1, $x1 + $this->shading, $y1 - $this->shading, $x2 + $this->shading, $y1 - $this->shading, $x2 + $this->shading, $y2 - $this->shading, $x2, $y2, $x2, $y1), 6, $this->ndx_data_dark_colors[$idx]);
} else {
ImageRectangle($this->img, $x1, $y1, $x2, $y2, $this->ndx_data_border_colors[$idx]);
}
// Draw the bar
ImageFilledRectangle($this->img, $x1, $y1, $x2, $y2, $this->ndx_data_colors[$idx]);
}
}
// end for
}
// end for
}
示例10: DrawBullet
function DrawBullet($image, $x, $y, $type, $color)
{
switch ($type) {
case 0:
case 5:
for ($i = 0; $i < 8; $i++) {
ImageArc($image, $x, $y, $i, $i, 0, 359, $color);
}
break;
case 1:
case 6:
ImageFilledRectangle($image, $x - 3, $y - 3, $x + 3, $y + 3, $color);
break;
case 2:
case 7:
ImageFilledRectangle($image, $x - 1, $y - 4, $x + 1, $y + 4, $color);
ImageFilledRectangle($image, $x - 4, $y - 1, $x + 4, $y + 1, $color);
break;
case 3:
case 8:
$points[0] = $x;
$points[1] = $y - 4;
$points[2] = $x + 4;
$points[3] = $y;
$points[4] = $x;
$points[5] = $y + 4;
$points[6] = $x - 4;
$points[7] = $y;
ImageFilledPolygon($image, $points, 4, $color);
break;
case 4:
case 9:
$points[0] = $x;
$points[1] = $y - 4;
$points[2] = $x + 4;
$points[3] = $y + 4;
$points[4] = $x - 4;
$points[5] = $y + 4;
ImageFilledPolygon($image, $points, 3, $color);
break;
default:
}
return;
}
示例11: draw_plage_spher
function draw_plage_spher($im, $results, $flg, $l0, $b0, $p0, $sx, $r, $col)
{
$lon = $results['LON'];
$lat = $results['LAT'];
/*if ($flg == 0)
$col=ImageColorAllocate($im, 255, 255-$results['INTENSITY'], 255-$results['INTENSITY']);
else
$col=ImageColorAllocate($im, 255, 255-$results['INTENSITY'], 255);*/
$cBlack = ImageColorAllocate($im, 0, 0, 0);
$nb = count($lon);
for ($i = 0; $i < $nb; $i++) {
$lon[$i] = $lon[$i] + 360 * $flg - rad2deg($l0);
//if ( ($lon[$i] <= 90) && ($lon[$i] >= -90) ) {
$coord = ToHelio($lon[$i], $lat[$i], $b0, $p0, $r, $sx);
$points[] = $coord['lon'];
$points[] = $coord['lat'];
//}
}
if (count($points) > 0) {
ImageFilledPolygon($im, $points, count($points) / 2, $col);
imagepolygon($im, $points, count($points) / 2, $cBlack);
}
unset($points);
}
示例12: draw_feat_pix
function draw_feat_pix($im, $tab_xpix, $tab_ypix, $c_x, $c_y, $intensity, $feat_id, $filled, $zoom)
{
global $global;
$font_ttf = $global['FONT_PATH'];
$sizey = imagesy($im);
$nb = count($tab_xpix);
$points = array();
if ($filled) {
$col = ImageColorAllocate($im, 255, 255 - $intensity, 255 - $intensity);
} else {
$col = ImageColorAllocate($im, 255, 255, 255);
}
if ($filled) {
$gc_col = ImageColorAllocate($im, 0, 0, 0);
} else {
$gc_col = ImageColorAllocate($im, 0, 0, 255);
}
for ($i = 0; $i < $nb; $i++) {
$points[] = $tab_xpix[$i] * $zoom;
$points[] = $sizey - $tab_ypix[$i] * $zoom;
// en PHP, l'origine de l'image est coin gauche haut
}
if (count($points) > 0) {
if ($filled) {
ImageFilledPolygon($im, $points, $nb, $col);
}
ImagePolygon($im, $points, $nb, $col);
}
imagefilledellipse($im, $c_x * $zoom, $sizey - $c_y * $zoom, 2, 2, $gc_col);
//ImageString ($im, 3, $c_x*$zoom-strlen($feat_id), $sizey-$c_y*$zoom+5, $feat_id, $gc_col);
$textArray = explode(' ', $feat_id);
$y = $sizey - $c_y * $zoom + 15;
foreach ($textArray as $txt) {
ImageTTFText($im, 8, 0, $c_x * $zoom - strlen($feat_id) + 10, $y, $gc_col, $font_ttf, $txt);
$y += 15;
}
//ImageTTFText($im, 8, 0, $c_x*$zoom-strlen($feat_id)+10, $sizey-$c_y*$zoom+15, $gc_col, $font_ttf, $feat_id);
}
示例13: _drawxaxis
function _drawxaxis() {
$maxlabwid = $this->_maxlab();
$x0 = $this->lm;
$y0 = $this->tm + $this->cheight;
$x1 = $x0 + $this->cwidth;
$y1 = $y0;
$div = $this->xgridint;
imageline($this->image,$x0,$y0,$x1,$y1,$this->gridcol);
$gry = $this->xgrid ? $this->tm : $this->tm + $this->cheight + 3 ;
$ii=0;
for ($x=$x1,$i=$this->xcount-1; $x>$x0+3; $x -= $div, $i--, $ii++) {
if ($this->xdashed) {
for ($xd=$gry;$xd<=$y0; $xd=$xd+4) {
imagesetpixel($this->image,$x,$xd,$this->gridcol);
}
} else {
imageline($this->image,$x,$gry,$x,$y0,$this->gridcol);
}
imageline($this->image,$x,$y0-4,$x,$y0+3,$this->txtcol);
$v = $this->xlabels[$i];
$tw = strlen("$v")*imagefontwidth(2);
$th = imagefontheight(2);
if (!($ii%$this->xstep)) {
if ($this->xdelta) { if (!$delta) { $delta=12; } else { $delta=0; } } else { $delta=0; }
$this->_writestring($this->image,2,$x - ($div+$tw)/2, $y0 + 5 + $delta, $v, $this->txtcol,0,0);
}
}
$y = $this->height - 30;
$tw = strlen($this->xtitle)*imagefontwidth(3);
$x = ($this->lm + $this->cwidth + $this->lm - $tw)/2;
$this->_writestring($this->image,3,$this->lm + $this->cwidth+2,$y0-20,$this->xtitle,$this->txtcol,1,0);
if ($this->xstr) {
$points[0] = $this->lm + $this->cwidth+10;
$points[1] = $y0-3;
$points[2] = $points[0]+15;
$points[3] = $points[1]+3;
$points[4] = $points[2]-15;
$points[5] = $points[3]+3;
$points[6] = $points[4]+3;
$points[7] = $points[5]-3;
ImageSetThickness($this->image, $this->xline);
imageline($this->image,$x0,$y0,$x1+15,$y1,$this->txtcol);
ImageSetThickness($this->image, 1);
ImageFilledPolygon($this->image,$points,4,$this->txtcol);
}
}
示例14: array
}
$text_size = 1;
//Compute the pic's center and the radius
$x_center = $width / 2;
$y_center = $height / 2;
$radius = $width / 2 - 30;
$div_length = 10;
$subdiv_length = 6;
//Plot the data
$points = array();
for ($i = 0; $i < $num_points; $i++) {
//Compute the point
$points[$i * 2] = $x_center + $data[$i] * $radius / 10 * cos(deg2rad($angles[$i]));
$points[$i * 2 + 1] = $y_center - $data[$i] * $radius / 10 * sin(deg2rad($angles[$i]));
}
ImageFilledPolygon($im, $points, $num_points, $orange);
ImagePolygon($im, $points, $num_points, $blue);
//Plot the sub-areas
$suba_nb = 4;
for ($i = 0; $i < $suba_nb; $i++) {
for ($j = 0; $j < $num_points; $j++) {
//Compute the point
$points[$j * 2] = $x_center + $radius / $suba_nb * ($i + 1) * cos(deg2rad($angles[$j]));
$points[$j * 2 + 1] = $y_center - $radius / $suba_nb * ($i + 1) * sin(deg2rad($angles[$j]));
}
ImagePolygon($im, $points, $num_points, $grey);
}
//Plot the axis
for ($i = 0; $i < $num_points; $i++) {
//Axis
$x = $x_center + $radius * cos(deg2rad($angles[$i]));
示例15: drawshape
private function drawshape($image, $action, $color)
{
switch ($action % 7) {
case 0:
ImageFilledRectangle($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $color);
break;
case 1:
case 2:
ImageFilledEllipse($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $color);
break;
case 3:
$points = array($this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY());
ImageFilledPolygon($image, $points, 4, $color);
break;
case 4:
case 5:
case 6:
$start = $this->getInt() * 360 / 256;
$end = $start + $this->getInt() * 180 / 256;
ImageFilledArc($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $start, $end, $color, IMG_ARC_PIE);
break;
}
}