root/cleversvg/trunk/quick_examples.php

Revision 336, 0.9 KB (checked in by nperriault, 4 years ago)

Clever Svg:

  • refs #40: more elements tests
  • Removed depth management, as svg handle it natively

Warning: breaks BC from 0.5.

Line 
1<?php
2require_once('cleversvg.php');
3$doc = new csDocument(550, 400, 'SVG test document');
4
5$gradient = new csLinearGradient(0, 0, '100%', '100%');
6$gradient->addStop('0%', 'yellow');
7$gradient->addStop('100%', 'red');
8$doc->addAsDefinition($gradient, 'gradient');
9
10$star = new csPolygon();
11$star->setPointsArray(array(array(350,75),  array(379,161),
12                            array(469,161), array(397,215),
13                            array(423,301), array(350,250),
14                            array(277,301), array(303,215),
15                            array(231,161), array(321,161)));
16$star->setStroke('blue');
17$star->setFill('url(#gradient)');
18$star->setStrokeWidth(4);
19$linkedstar = new csLink();
20$linkedstar->setHref('http://prendreuncafe.com/blog/');
21$linkedstar->addElement($star);
22$doc->addElement($linkedstar);
23
24header("Content-type: image/svg+xml");
25echo $doc->toXML();
Note: See TracBrowser for help on using the browser.