本文整理汇总了PHP中Text::SetAngle方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::SetAngle方法的具体用法?PHP Text::SetAngle怎么用?PHP Text::SetAngle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::SetAngle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Stroke
//.........这里部分代码省略.........
$width = $tw;
}
$g = new CanvasGraph($width, $height);
$g->img->SetImgFormat($this->iImgFormat);
$g->SetMarginColor($this->iBkgColor);
$g->SetColor($this->iBkgColor);
if ($this->iShowFrame) {
$g->InitFrame();
} else {
$g->frame_weight = 0;
$g->InitFrame();
}
$g->img->SetLineWeight(1);
$g->img->SetColor('black');
$x = $w * $spec->iLeftMargin;
$ystart = $topmargin;
$inunder = false;
$under_s = '';
$startx = $x;
for ($r = 0; $r < count($spec->iBar); ++$r) {
$yend = $ystart + $this->iHeight - 1;
$x = $startx;
for ($i = 0; $i < $n; ++$i) {
$b = $spec->iBar[$r][$i];
$bn = strlen($b[3]);
for ($j = 0; $j < $bn; ++$j) {
$wb = substr($b[3], $j, 1) * $w;
if (!($j % 2)) {
$g->img->SetColor($this->iColor);
$g->img->FilledRectangle($x, $ystart, $x + $wb - 1, $yend);
}
$x += $wb;
}
}
$ystart += $this->iHeight;
}
// row
$g->img->SetColor($this->iColor);
if ($spec->iStrokeDataBelow) {
// Center data underneath
$y = $yend + $txtmargin;
$bw = $totwidth - $spec->iLeftMargin * $w - $spec->iRightMargin * $w;
$x = $spec->iLeftMargin * $w + floor($bw / 2);
$g->img->SetTextAlign('center', 'top');
$g->img->SetFont($this->iFontFam, $this->iFontStyle, $this->iFontSize);
$g->img->StrokeText($x, $y, $data);
}
if (ADD_DEMOTXT) {
$ystart = 0;
$t = new Text(" DEMO ", $totwidth / 2, $ystart);
if ($this->iModuleWidth > 1) {
if ($this->iModuleWidth > 2) {
$t->SetFont(FF_ARIAL, FS_BOLD, 24);
$step = 120;
} else {
$t->SetFont(FF_ARIAL, FS_BOLD, 16);
$step = 100;
}
} else {
$t->SetFont(FF_ARIAL, FS_BOLD, 12);
$step = 80;
}
$t->SetColor('red@0.5');
$t->Align('center', 'top');
$t->SetAngle(-15);
$n = ceil($totwidth / $step);
for ($y = $ystart; $y < $yend; $y += 50) {
for ($i = 0; $i < $n; ++$i) {
$t->SetPos(-30 + $i * $step, $y);
$t->Stroke($g->img);
}
}
}
if ($this->iVertical) {
$g->img->img = $this->Rotate($g->img->img, 90);
}
if ($this->iScale != 1) {
$nwidth = round($width * $this->iScale);
$nheight = round($height * $this->iScale);
if ($this->iVertical) {
$tmp = $height;
$height = $width;
$width = $tmp;
$tmp = $nheight;
$nheight = $nwidth;
$nwidth = $tmp;
}
$img = @imagecreatetruecolor($nwidth, $nheight);
if ($img) {
imagealphablending($img, true);
imagecopyresampled($img, $g->img->img, 0, 0, 0, 0, $nwidth, $nheight, $width, $height);
$g->img->CreateImgCanvas($nwidth, $nheight);
$g->img->img = $img;
} else {
return false;
}
}
$g->Stroke($aFile);
return true;
}
示例2: Stroke
//.........这里部分代码省略.........
$g->img->FilledRectangle($x, $ystart, $x + $wb - 1, $yend);
} else {
$g->img->FilledRectangle($x, $ystart, $x + $wb - 1, $yend - $th);
}
$x += $wb;
}
if ($this->iDebugBackground) {
$g->SetAlphaBlending();
if (($i & 1) == 0) {
$g->img->SetColor('lightblue@0.5');
} else {
$g->img->SetColor('yellow@0.5');
}
$g->img->FilledRectangle($startx, $ystart - 2, $x, $yend);
}
if ($spec->iInterCharModuleSpace) {
$x += $w;
}
}
$g->img->SetColor($this->iColor);
if (!($spec->iLeftData === '')) {
$g->img->SetTextAlign('right', 'top');
$g->img->SetFont($this->iSmallFontFam, $this->iSmallFontStyle, $this->iSmallFontSize);
$g->img->StrokeText($w * $spec->iLeftMargin - 3, $yend - $th, $spec->iLeftData);
}
if (!($spec->iRightData === '')) {
$g->img->SetTextAlign('left', 'top');
$g->img->SetFont($this->iSmallFontFam, $this->iSmallFontStyle, $this->iSmallFontSize);
$g->img->StrokeText($x + 3, $yend - $th, $spec->iRightData);
}
if ($spec->iStrokeDataBelow) {
$y = $yend + $this->iDataBelowMargin;
$bw = $totwidth - $spec->iLeftMargin * $w - $spec->iRightMargin * $w;
$x = $spec->iLeftMargin * $w + floor($bw / 2);
$g->img->SetTextAlign('center', 'top');
$g->img->SetFont($this->iFontFam, $this->iFontStyle, $this->iFontSize);
if ($this->iHumanTxt !== '') {
$g->img->StrokeText($x, $y, $this->iHumanTxt);
} else {
$g->img->StrokeText($x, $y, $spec->iData);
}
}
if ($aShowDetails) {
$g->img->SetColor('navy');
$g->img->SetTextAlign('left', 'top');
$g->img->SetFont(FF_FONT2);
$g->img->StrokeText($textmargin, $this->iTopMargin, $s);
}
if (ADD_DEMOTXT === true) {
$t = new Text("<<DEMO>>", $totwidth / 2, $ystart);
if ($this->iModuleWidth > 1) {
if ($this->iModuleWidth > 4) {
$t->SetFont(FF_ARIAL, FS_BOLD, 32);
$step = 140;
$yadj = 50;
} else {
$t->SetFont(FF_ARIAL, FS_BOLD, 24);
$step = 110;
$yadj = 40;
}
} else {
$t->SetFont(FF_ARIAL, FS_BOLD, 18);
$step = 80;
$yadj = 30;
}
$t->SetColor('red@0.4');
$t->Align('center', 'center');
$t->SetAngle(-25);
$n = ceil($totwidth / $step);
for ($i = 0; $i < $n; ++$i) {
$t->SetPos(-30 + $i * $step, ($yend - $ystart) / 2 - $yadj);
$t->Stroke($g->img);
}
}
if ($this->iVertical) {
$g->img->img = $this->Rotate($g->img->img, 90);
}
if ($this->iScale != 1) {
$nwidth = round($width * $this->iScale);
$nheight = round($height * $this->iScale);
if ($this->iVertical) {
$tmp = $height;
$height = $width;
$width = $tmp;
$tmp = $nheight;
$nheight = $nwidth;
$nwidth = $tmp;
}
$img = @imagecreatetruecolor($nwidth, $nheight);
if ($img) {
imagealphablending($img, true);
imagecopyresampled($img, $g->img->img, 0, 0, 0, 0, $nwidth, $nheight, $width, $height);
$g->img->CreateImgCanvas($nwidth, $nheight);
$g->img->img = $img;
} else {
return false;
}
}
return $g->Stroke($aFile);
}
示例3: strokeLabels
function strokeLabels()
{
$t = new Text();
$t->SetColor($this->labelColor);
$t->SetFont($this->labelFF, $this->labelFS, $this->labelFSize);
$t->SetAlign('center', 'center');
foreach ($this->labels as $cont_idx => $pos) {
if ($cont_idx >= 10) {
return;
}
foreach ($pos as $idx => $coord) {
$t->Set(sprintf("%.1f", $coord[2]));
$t->SetAngle($coord[3]);
$t->Stroke($this->g->img, $coord[0], $coord[1]);
}
}
}
示例4: Init
/**
* Construct the graph
*
*/
private function Init()
{
// Setup limits for color indications
$lowx = $this->iXMin;
$highx = $this->iXMax;
$lowy = $this->iYMin;
$highy = $this->iYMax;
$width = $this->iWidth;
$height = $this->iHeight;
// Margins
$lm = 50;
$rm = 40;
$tm = 60;
$bm = 40;
if ($width <= 300 || $height <= 250) {
$labelsize = 8;
$lm = 25;
$rm = 25;
$tm = 45;
$bm = 25;
} elseif ($width <= 450 || $height <= 300) {
$labelsize = 8;
$lm = 30;
$rm = 30;
$tm = 50;
$bm = 30;
} elseif ($width <= 600 || $height <= 400) {
$labelsize = 9;
} else {
$labelsize = 11;
}
if ($this->iSubTitle == '') {
$tm -= $labelsize + 4;
}
$graph = new Graph($width, $height);
$graph->SetScale('intint', $lowy, $highy, $lowx, $highx);
$graph->SetMargin($lm, $rm, $tm, $bm);
$graph->SetMarginColor($this->iMarginColor[$this->iColorMap]);
$graph->SetClipping();
$graph->title->Set($this->iTitle);
$graph->subtitle->Set($this->iSubTitle);
$graph->title->SetFont(FF_ARIAL, FS_BOLD, $labelsize + 4);
$graph->subtitle->SetFont(FF_ARIAL, FS_BOLD, $labelsize + 1);
$graph->SetBox(true, 'black@0.3');
$graph->xaxis->SetFont(FF_ARIAL, FS_BOLD, $labelsize);
$graph->yaxis->SetFont(FF_ARIAL, FS_BOLD, $labelsize);
$graph->xaxis->scale->ticks->Set(CCBPGraph::TickStep, CCBPGraph::TickStep);
$graph->yaxis->scale->ticks->Set(CCBPGraph::TickStep, CCBPGraph::TickStep);
$graph->xaxis->HideZeroLabel();
$graph->yaxis->HideZeroLabel();
$graph->xaxis->SetLabelFormatString('%d%%');
$graph->yaxis->SetLabelFormatString('%d%%');
// For the x-axis we adjust the color so labels on the left of the Y-axis are in black
$n1 = floor(abs($this->iXMin / 25)) + 1;
$n2 = floor($this->iXMax / 25);
if ($this->iColorMap == 0) {
$xlcolors = array();
for ($i = 0; $i < $n1; ++$i) {
$xlcolors[$i] = 'black';
}
for ($i = 0; $i < $n2; ++$i) {
$xlcolors[$n1 + $i] = 'lightgray:1.5';
}
$graph->xaxis->SetColor('gray', $xlcolors);
$graph->yaxis->SetColor('gray', 'lightgray:1.5');
} else {
$graph->xaxis->SetColor('darkgray', 'darkgray:0.8');
$graph->yaxis->SetColor('darkgray', 'darkgray:0.8');
}
$graph->SetGridDepth(DEPTH_FRONT);
$graph->ygrid->SetColor('gray@0.6');
$graph->ygrid->SetLineStyle('dotted');
$graph->ygrid->Show();
$graph->xaxis->SetWeight(1);
$graph->yaxis->SetWeight(1);
$ytitle = new Text(CCBPGraph::YTitle, floor($lm * 0.75), ($height - $tm - $bm) / 2 + $tm);
#$ytitle->SetFont(FF_VERA,FS_BOLD,$labelsize+1);
$ytitle->SetAlign('right', 'center');
$ytitle->SetAngle(90);
$graph->Add($ytitle);
$xtitle = new Text(CCBPGraph::XTitle, ($width - $lm - $rm) / 2 + $lm, $height - 10);
#$xtitle->SetFont(FF_VERA,FS_BOLD,$labelsize);
$xtitle->SetAlign('center', 'bottom');
$graph->Add($xtitle);
$df = 'D j:S M, Y';
if ($width < 400) {
$df = 'D j:S M';
}
$time = new Text(date($df), $width - 10, $height - 10);
$time->SetAlign('right', 'bottom');
#$time->SetFont(FF_VERA,FS_NORMAL,$labelsize-1);
$time->SetColor('darkgray');
$graph->Add($time);
// Use an accumulated fille line graph to create the colored bands
$n = 3;
for ($i = 0; $i < $n; ++$i) {
//.........这里部分代码省略.........
示例5: Draw
public function Draw($aTitle, $aStart, $aEnd, $n = 64, $aReverse = false, $addColorNames = false)
{
// Setup to draw colormap with names platoe colors
$lmarg = ColorMapDriver::LMARG;
// left margin
$rmarg = ColorMapDriver::RMARG;
// right margin
$width = ColorMapDriver::WIDTH;
// Overall image width
// Module height
$mh = ColorMapDriver::MODHEIGHT;
// Step between each map
$ymarg = $mh + ColorMapDriver::MAPMARG;
if ($addColorNames) {
$ymarg += 50;
}
// Start position
$xs = $lmarg;
$ys = ColorMapDriver::YSTART;
// Setup a basic canvas graph
$height = ($aEnd - $aStart + 1) * $ymarg + 50;
$graph = new CanvasGraph($width, $height);
$graph->img->SetColor('darkgray');
$graph->img->Rectangle(0, 0, $width - 1, $height - 1);
$t = new Text($aTitle, $width / 2, 5);
$t->SetAlign('center', 'top');
$t->SetFont(FF_ARIAL, FS_BOLD, 14);
$t->Stroke($graph->img);
// Instantiate a colormap
$cm = new ColorMap();
$cm->InitRGB($graph->img->rgb);
for ($mapidx = $aStart; $mapidx <= $aEnd; ++$mapidx, $ys += $ymarg) {
$cm->SetMap($mapidx, $aReverse);
$n = $cm->SetNumColors($n);
list($mapidx, $maparray) = $cm->GetCurrMap();
$ncols = count($maparray);
$colbuckets = $cm->GetBuckets();
// The module width will depend on the actual number of colors
$mw = round(($width - $lmarg - $rmarg) / $n);
// Draw color map title (name)
$t->Set('Basic colors: ' . $ncols . ', Total colors: ' . $n);
$t->SetAlign('center', 'bottom');
$t->SetAngle(0);
$t->SetFont(FF_TIMES, FS_NORMAL, 14);
$t->Stroke($graph->img, $width / 2, $ys - 3);
// Add the name/number of the map to the left
$t->SetAlign('right', 'center');
$t->Set('Map: ' . $mapidx);
$t->SetFont(FF_ARIAL, FS_NORMAL, 14);
$t->Stroke($graph->img, $xs - 20, round($ys + $mh / 2));
// Setup text properties for the color names
if ($addColorNames) {
$t->SetAngle(30);
$t->SetFont(FF_ARIAL, FS_NORMAL, 12);
$t->SetAlign('right', 'top');
}
// Loop through all colors in the map
$x = $xs;
$y = $ys;
$k = 0;
for ($i = 0; $i < $n; ++$i) {
$graph->img->SetColor($colbuckets[$i]);
$graph->img->FilledRectangle($x, $y, $x + $mw, $y + $mh);
// Mark all basic colors in the map with a bar and name
if ($i % (($n - $ncols) / ($ncols - 1) + 1) == 0) {
$graph->img->SetColor('black');
$graph->img->FilledRectangle($x, $y + $mh + 4, $x + $mw - 1, $y + $mh + 6);
if ($addColorNames) {
$t->Set($maparray[$k++]);
$t->Stroke($graph->img, $x + $mw / 2, $y + $mh + 10);
}
}
$x += $mw;
}
// Draw a border around the map
$graph->img->SetColor('black');
$graph->img->Rectangle($xs, $ys, $xs + $mw * $n, $ys + $mh);
}
// Send back to client
$graph->Stroke();
}
示例6: Stroke
/**
* Internal. Stroke labels
* @param MatrixPlot $aMPlot
* @param Image $aImg
*/
function Stroke(MatrixPlot $aMPlot, Image $aImg)
{
$t = new Text();
$t->SetColor($this->iColor);
$t->SetFont($this->iFF, $this->iFS, $this->iFSize);
$n = count($this->iLabels);
$rows = count($aMPlot->iData);
$cols = count($aMPlot->iData[0]);
list($modwidth, $modheight) = $aMPlot->GetModSizes();
$x = $this->iStartX;
$y = $this->iStartY;
if (!empty($this->csimtargets) || is_array($this->csimtargets) && count($this->csimtargets) == 0) {
$csn = count($this->csimtargets);
if ($csn != $n) {
JpGraphError::RaiseL(29210, $csn, $n);
// CSIM Target for matrix labels must be the same length as the labels
}
}
$csim = '';
switch ($this->iSide) {
case 'top':
case 'bottom':
$t->SetAngle($this->iAngle);
$x += round($modwidth / 2);
if ($this->iSide == 'top') {
$y -= $this->iMargin;
$t->SetAlign('center', 'bottom');
} else {
$y += $this->iMargin + $rows * $modheight;
if ($this->iAngle > 0 && $this->iAngle < 90) {
$t->SetAlign('right', 'top');
} else {
$t->SetAlign('center', 'top');
}
}
for ($i = 0; $i < $n && $i < $cols; ++$i, $x += $modwidth) {
$t->Set($this->iLabels[$i]);
if (!empty($this->csimtargets)) {
if (!empty($this->csimalts[$i]) && !empty($this->csimwintargets[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], $this->csimalts[$i], $this->csimwintargets[$i]);
} elseif (!empty($this->csimalts[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], $this->csimalts[$i]);
} elseif (!empty($this->csimwintargets[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], '', $this->csimwintargets[$i]);
} else {
$t->SetCSIMTarget($this->csimtargets[$i]);
}
}
$t->Stroke($aImg, $x, $y);
$csim .= $t->GetCSIMareas();
}
break;
case 'left':
case 'right':
$t->SetAngle($this->iAngle);
$y += round($modheight / 2);
if ($this->iSide == 'left') {
$x -= $this->iMargin + 1;
$t->SetAlign('right', 'center');
} else {
$x += $this->iMargin + $cols * $modwidth;
$t->SetAlign('left', 'center');
}
for ($i = 0; $i < $n && $i < $rows; ++$i, $y += $modheight) {
$t->Set($this->iLabels[$i]);
if (!empty($this->csimtargets)) {
if (!empty($this->csimalts[$i]) && !empty($this->csimwintargets[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], $this->csimalts[$i], $this->csimwintargets[$i]);
} elseif (!empty($this->csimalts[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], $this->csimalts[$i]);
} elseif (!empty($this->csimwintargets[$i])) {
$t->SetCSIMTarget($this->csimtargets[$i], '', $this->csimwintargets[$i]);
} else {
$t->SetCSIMTarget($this->csimtargets[$i]);
}
}
$t->Stroke($aImg, $x, $y);
$csim .= $t->GetCSIMareas();
}
break;
}
$this->csimareas = $csim;
}
示例7: PolarGraph
function create_image()
{
include './lib/jpgraph/jpgraph.php';
include './lib/jpgraph/jpgraph_polar.php';
$graph = new PolarGraph(250, 250);
$graph->SetScale('lin');
$graph->SetMargin(0, 1, 0, 1);
$graph->axis->ShowAngleLabel(false);
$graph->axis->HideTicks();
$graph->axis->HideLabels();
$graph->axis->HideLine();
$fonts = array(FF_ARIAL, FF_VERDANA, FF_TREBUCHE, FF_GEORGIA, FF_COMIC, FF_COURIER, FF_TIMES);
$styles = array(FS_NORMAL, FS_BOLD, FS_ITALIC);
$text = $this->generate_pass(6);
$font = $fonts[rand(0, count($fonts) - 1)];
$style = $styles[rand(0, count($styles) - 1)];
if ($font == FF_COMIC && $style == FS_ITALIC) {
$style = FS_NORMAL;
}
$txt = new Text($text);
$txt->Pos(rand(10, 140), rand(10, 140));
$txt->SetFont($font, $style, rand(20, 26));
$txt->SetColor('black');
$txt->SetAngle(rand(-45, 45));
$graph->AddText($txt);
$graph->Stroke('./register.png');
return array(md5("{$this->sets['db_pass']}{$this->sets['mostonlinetime']}{$text}"), './register.png');
}
示例8: StrokeLabels
/**
* Stroke all stored labels to the plot
*
* @return void
*/
function StrokeLabels()
{
$t = new Text();
$t->SetColor($this->labelColor);
$t->SetFont($this->labelFF, $this->labelFS, $this->labelFSize);
$t->SetAlign('center', 'center');
foreach ($this->labels as $cont_idx => $pos) {
// FIXME:
//if( $cont_idx >= 10 ) return;
foreach ($pos as $idx => $coord) {
$t->Set(sprintf("%.1f", $coord[2]));
if ($this->angledLabels) {
$t->SetAngle($coord[3]);
}
//$t->SetBox2('lightyellow:1.9');
$t->Stroke($this->img, $coord[0], $coord[1]);
}
}
}
示例9: imagejpeg
function create_image()
{
include './lib/jpgraph/jpgraph.php';
include './lib/jpgraph/jpgraph_polar.php';
if (!function_exists('imagejpeg')) {
JpGraphError::Raise("This PHP installation is not configured with JPEG support meaning that anti-robot registration cannnot be run at this current time. Please recompile PHP with GD and JPEG support to run JpGraph and that will allow anti-robot registration to fully function. (Function imagejpeg() does not exist)");
}
$graph = new PolarGraph(250, 250);
$graph->SetScale('lin');
$graph->SetMargin(0, 1, 0, 1);
$graph->axis->ShowAngleLabel(false);
$graph->axis->HideTicks();
$graph->axis->HideLabels();
$graph->axis->HideLine();
$fonts = array(FF_ARIAL, FF_VERDANA, FF_TREBUCHE, FF_GEORGIA, FF_COMIC, FF_COURIER, FF_TIMES);
$styles = array(FS_NORMAL, FS_BOLD, FS_ITALIC);
$text = $this->generate_pass(6);
$font = $fonts[rand(0, count($fonts) - 1)];
$style = $styles[rand(0, count($styles) - 1)];
if ($font == FF_COMIC && $style == FS_ITALIC) {
$style = FS_NORMAL;
}
$txt = new Text($text);
$txt->Pos(rand(10, 140), rand(10, 140));
$txt->SetFont($font, $style, rand(20, 26));
$txt->SetColor('black');
$txt->SetAngle(rand(-45, 45));
$graph->AddText($txt);
$graph->Stroke('./register.png');
return array(md5("{$this->sets['db_pass']}{$this->sets['mostonlinetime']}{$text}"), './register.png');
}