本文整理汇总了PHP中Transform::StopTransform方法的典型用法代码示例。如果您正苦于以下问题:PHP Transform::StopTransform方法的具体用法?PHP Transform::StopTransform怎么用?PHP Transform::StopTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform::StopTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CircularText
public function CircularText(\PhpSigep\Pdf\ImprovedFPDF $pdf, $x, $y, $r, $text, $align = 'top', $kerning = 120, $fontwidth = 100)
{
$transf = new Transform();
$kerning /= 100;
$fontwidth /= 100;
if ($kerning == 0) {
$pdf->Error('Please use values unequal to zero for kerning');
}
if ($fontwidth == 0) {
$pdf->Error('Please use values unequal to zero for font width');
}
//get width of every letter
$t = 0;
for ($i = 0; $i < strlen($text); $i++) {
$w[$i] = $pdf->GetStringWidth($text[$i]);
$w[$i] *= $kerning * $fontwidth;
//total width of string
$t += $w[$i];
}
//circumference
$u = $r * 2 * M_PI;
//total width of string in degrees
$d = $t / $u * 360;
$transf->StartTransform($pdf);
// rotate matrix for the first letter to center the text
// (half of total degrees)
if ($align == 'top') {
$transf->Rotate($pdf, $d / 2, $x, $y);
} else {
$transf->Rotate($pdf, -$d / 2, $x, $y);
}
//run through the string
for ($i = 0; $i < strlen($text); $i++) {
if ($align == 'top') {
//rotate matrix half of the width of current letter + half of the width of preceding letter
if ($i == 0) {
$transf->Rotate($pdf, -($w[$i] / 2 / $u) * 360, $x, $y);
} else {
$transf->Rotate($pdf, -(($w[$i] / 2 + $w[$i - 1] / 2) / $u) * 360, $x, $y);
}
if ($fontwidth != 1) {
$transf->StartTransform($pdf);
$transf->ScaleX($pdf, $fontwidth * 100, $x, $y);
}
$pdf->SetXY($x - $w[$i] / 2, $y - $r);
} else {
//rotate matrix half of the width of current letter + half of the width of preceding letter
if ($i == 0) {
$transf->Rotate($pdf, $w[$i] / 2 / $u * 360, $x, $y);
} else {
$transf->Rotate($pdf, ($w[$i] / 2 + $w[$i - 1] / 2) / $u * 360, $x, $y);
}
if ($fontwidth != 1) {
$transf->StartTransform($pdf);
$transf->ScaleX($pdf, $fontwidth * 100, $x, $y);
}
$pdf->SetXY($x - $w[$i] / 2, $y + $r - $pdf->FontSize);
}
$pdf->Cell($w[$i], $pdf->FontSize, $text[$i], 0, 0, 'C');
if ($fontwidth != 1) {
$transf->StopTransform($pdf);
}
}
$transf->StopTransform($pdf);
}