2017 © Pedro Peláez
 

library vector-graphics

Library for OO-modeling of vector graphics.

image

mwoerlein/vector-graphics

Library for OO-modeling of vector graphics.

  • Sunday, December 6, 2015
  • by mwoerlein
  • Repository
  • 1 Watchers
  • 0 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 7 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

Vector Graphics Library

PHP library for OO-modeling of vector graphics., (*2)

Objectives

This library is designed to construct and describe general vector graphics independent of its application backend. These descriptions are intended to separate the definition on an graphic/chart/... and its representation., (*3)

A graphic could be serialized into various document types using there capabilities for vectorized representations. Currently supported/planed serializations are:, (*4)

  • export as standalone SVG content
  • serialize into a Zend-PDF page
  • serialize into an Imagine image

Installation

To add vector-graphics as a local, per-project dependency to your project, simply add a dependency on mwoerlein/vector-graphics to your project's composer.json file. Here is a minimal example of a composer.json file:, (*5)

{
    "require": {
        "mwoerlein/vector-graphics": ">0.2"
    }
}

Example Usage

The following example generates a svg-image containing a pentagram in a red circle inside of a square, (*6)

$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./5. * pi()), $radius * cos(0./5. * pi()));
$path->lineTo($radius * sin(4./5. * pi()), $radius * cos(4./5. * pi()));
$path->lineTo($radius * sin(8./5. * pi()), $radius * cos(8./5. * pi()));
$path->lineTo($radius * sin(2./5. * pi()), $radius * cos(2./5. * pi()));
$path->lineTo($radius * sin(6./5. * pi()), $radius * cos(6./5. * pi()));
$path->close();
$graphic->addPath($path);

header('Content-Type: image/svg+xml');
echo (new SVGWriter())->toSVG($graphic, 10, 10);

SVG Sample, (*7)

Progress

see in ChangeLog, (*8)

The Versions

06/12 2015

dev-develop

dev-develop

Library for OO-modeling of vector graphics.

  Sources   Download

LGPL-2.1

The Requires

 

The Development Requires

by Marc Woerlein

06/12 2015

dev-master

9999999-dev

Library for OO-modeling of vector graphics.

  Sources   Download

LGPL-2.1

The Requires

 

The Development Requires

by Marc Woerlein

06/12 2015

0.2

0.2.0.0

Library for OO-modeling of vector graphics.

  Sources   Download

LGPL-2.1

The Requires

 

The Development Requires

by Marc Woerlein

02/12 2015

0.1.1

0.1.1.0

Library for OO-modeling of vector graphics.

  Sources   Download

LGPL-2.1

The Requires

 

The Development Requires

by Marc Woerlein

30/11 2015

0.1

0.1.0.0

Library for OO-modeling of vector graphics.

  Sources   Download

LGPL-2.1

The Requires

 

The Development Requires

by Marc Woerlein