summaryrefslogtreecommitdiffstats
path: root/src/renderer
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-05-29 11:28:30 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-05-29 11:28:30 +0000
commit2942447b30b3be16ec869a40087ed6e79ed330e0 (patch)
tree762f8a0f86296ced69d23581623092f09af3b91d /src/renderer
parent89a8010b0b0869d07cb1d433351a1334bf232c57 (diff)
downloadzetacomponents-graph-2942447b30b3be16ec869a40087ed6e79ed330e0.zip
zetacomponents-graph-2942447b30b3be16ec869a40087ed6e79ed330e0.tar.gz
- Added basic 2d renderer test
- Implemented tested 2d renderer functions
Diffstat (limited to 'src/renderer')
-rw-r--r--src/renderer/2d.php70
1 files changed, 67 insertions, 3 deletions
diff --git a/src/renderer/2d.php b/src/renderer/2d.php
index 2711374..c7c943f 100644
--- a/src/renderer/2d.php
+++ b/src/renderer/2d.php
@@ -43,7 +43,11 @@ class ezcGraphRenderer2D extends ezcGraphRenderer
*/
public function drawLine( ezcGraphColor $color, ezcGraphCoordinate $position, ezcGraphCoordinate $end, $filled = true )
{
-
+ $this->driver->drawLine(
+ $position,
+ $end,
+ $color
+ );
}
/**
@@ -57,7 +61,13 @@ class ezcGraphRenderer2D extends ezcGraphRenderer
*/
public function drawTextBox( ezcGraphCoordinate $position, $text, $width = null, $height = null, $align = ezcGraph::LEFT )
{
-
+ $this->driver->drawTextBox(
+ $text,
+ $position,
+ $width,
+ $height,
+ $align
+ );
}
/**
@@ -88,6 +98,16 @@ class ezcGraphRenderer2D extends ezcGraphRenderer
*/
public function drawBackground( ezcGraphColor $color, ezcGraphCoordinate $position = null, $width = null, $height = null )
{
+ $this->driver->drawPolygon(
+ array(
+ $position,
+ new ezcGraphCoordinate( $position->x + $width, $position->y ),
+ new ezcGraphCoordinate( $position->x + $width, $position->y + $height ),
+ new ezcGraphCoordinate( $position->x, $position->y + $height )
+ ),
+ $color,
+ true
+ );
}
@@ -116,7 +136,51 @@ class ezcGraphRenderer2D extends ezcGraphRenderer
*/
public function drawSymbol( ezcGraphColor $color, ezcGraphCoordinate $position, $width, $height, $symbol = ezcGraph::NO_SYMBOL)
{
-
+ switch ( $symbol )
+ {
+ case ezcGraph::NO_SYMBOL:
+ $this->driver->drawPolygon(
+ array(
+ $position,
+ new ezcGraphCoordinate( $position->x + $width, $position->y ),
+ new ezcGraphCoordinate( $position->x + $width, $position->y + $height ),
+ new ezcGraphCoordinate( $position->x, $position->y + $height )
+ ),
+ $color,
+ true
+ );
+ break;
+ case ezcGraph::DIAMOND:
+ $this->driver->drawPolygon(
+ array(
+ new ezcGraphCoordinate( $position->x + $width / 2, $position->y ),
+ new ezcGraphCoordinate( $position->x + $width, $position->y + $height / 2 ),
+ new ezcGraphCoordinate( $position->x + $width / 2 , $position->y + $height ),
+ new ezcGraphCoordinate( $position->x, $position->y + $height / 2 )
+ ),
+ $color,
+ true
+ );
+ break;
+ case ezcGraph::BULLET:
+ $this->driver->drawCircle(
+ new ezcGraphCoordinate( $position->x + $width / 2, $position->y + $height / 2 ),
+ $width,
+ $height,
+ $color,
+ true
+ );
+ break;
+ case ezcGraph::CIRCLE:
+ $this->driver->drawCircle(
+ new ezcGraphCoordinate( $position->x + $width / 2, $position->y + $height / 2 ),
+ $width,
+ $height,
+ $color,
+ false
+ );
+ break;
+ }
}
}
OpenPOWER on IntegriCloud