コード例 #1
0
ファイル: sample.php プロジェクト: mwoerlein/vector-graphics
$text->setFont(80, FontStyle::FONT_COURIER);
$text->align(FontStyle::HORIZONTAL_ALIGN_LEFT, FontStyle::VERTICAL_ALIGN_BOTTOM);
$text->setFillColor('blue');
$text->setStrokeColor('red', 0.4);
$text->setStrokeWidth(1);
$graphic->addCircle(-40, -40, 40)->setStrokeColor('yellow');
$graphic->addText("C\nh\nj i", -40, -40);
$graphic->addCircle(40, -40, 40)->setStrokeColor('yellow');
$text = $graphic->addText('DaDa', 40, -40);
$text->setRotation(45);
$text->setFont(60, FontStyle::FONT_HELVETICA);
$text->align(FontStyle::HORIZONTAL_ALIGN_MIDDLE, FontStyle::VERTICAL_ALIGN_CENTRAL);
$text->setStrokeColor('red');
$text->setStrokeWidth(1);
$text->setOpacity(0.4);
$shape = $graphic->addPath((new Path(0, 0))->lineTo(80, -80)->moveTo(0, -80)->lineTo(80, 0));
$shape->setStrokeColor('black');
$shape->setFillColor(null);
$shape->setOpacity(0.6);
$rect = $graphic->addRectangle(-20, 0, 20, 15);
$rect->setFillColor('red');
$rect->setStrokeColor('green');
$rect->setOpacity(0.3);
$rect = $graphic->addRectangle(-35, 10, 30, 30);
$rect->setFillColor('red');
$rect->setStrokeColor('green');
$rect->setOpacity(0.7);
$rect = $graphic->addRectangle(0, 0, 30, 30);
$rect->setFillColor('blue');
$rect->setStrokeColor(null);
$rect = $graphic->addRectangle(-30, -30, 30, 30);
コード例 #2
0
        $path->curveTo($c1X, $c1Y, $c2X, $c2Y, $nextX, $nextY);
        $curX = $nextX;
        $curY = $nextY;
    }
    list($eX, $eY) = ArcUtils::getPolarPoint($r2, end($radians));
    if ($r1 !== $r2) {
        $path->lineTo($eX, $eY);
    }
    return $path;
}
$graphic = new Graphic();
$graphic->setViewportCorners(-300, -300, 300, 300);
$graphic->getDefaultTextFontStyle()->setName(FontStyle::FONT_HELVETICA)->setHAlign(FontStyle::HORIZONTAL_ALIGN_MIDDLE);
// draw group labels
$graphic->getDefaultShapeStrokeStyle()->setColor('gray');
$graphic->addPath(getGroupPath(275, 280, 1, 118));
$graphic->addPathText('Meine Gruppe', getGroupPath(280, 280, 1, 118));
$graphic->addPath(getGroupPath(275, 280, 121, 118));
$graphic->addPathText('Meine andere Gruppe', getGroupPath(280, 280, 121, 118));
$graphic->addPath(getGroupPath(275, 280, 241, 118));
$graphic->addPathText('Meine dritte Gruppe', getGroupPath(280, 280, 241, 118));
// draw inner arcs
$graphic->getDefaultTextFontStyle()->setVAlign(FontStyle::VERTICAL_ALIGN_CENTRAL);
$graphic->getDefaultTextFillStyle()->setColor('white');
$graphic->getDefaultShapeFillStyle()->setColor(HtmlColor::rgb(236, 88, 85));
$graphic->getDefaultShapeStrokeStyle()->setColor('white');
for ($i = -4; $i < 25; $i++) {
    $arc = $graphic->addRingArc(0, 0, 6 * $i + 50, 240, 15 * $i, 15);
    $arc->setFillOpacity(($i + 8) / 32.0);
    $anchor = $arc->getAnchor(RingArc::ALPHA_CENTRAL, RingArc::RADIUS_MIDDLE);
    $graphic->addText($i, $anchor->x, $anchor->y);
コード例 #3
0
h<?php 
use VectorGraphics\Model\Graphic;
use VectorGraphics\Model\Path;
$graphic = new Graphic();
$graphic->setViewportCorners(-50, -50, 50, 50);
$graphic->addRectangle(-49, -49, 98, 98)->setStrokeWidth(2);
$graphic->addCircle(0, 0, 45)->setFillColor('red', 0.5);
$radius = 40;
$path = new Path($radius * sin(0.0 / 5.0 * pi()), $radius * cos(0.0 / 5.0 * pi()));
$path->lineTo($radius * sin(4.0 / 5.0 * pi()), $radius * cos(4.0 / 5.0 * pi()));
$path->lineTo($radius * sin(8.0 / 5.0 * pi()), $radius * cos(8.0 / 5.0 * pi()));
$path->lineTo($radius * sin(2.0 / 5.0 * pi()), $radius * cos(2.0 / 5.0 * pi()));
$path->lineTo($radius * sin(6.0 / 5.0 * pi()), $radius * cos(6.0 / 5.0 * pi()));
$path->close();
$graphic->addPath($path);
return $graphic;