summaryrefslogtreecommitdiffstats
path: root/src/driver
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-12-18 20:08:00 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-12-18 20:08:00 +0000
commita55d1470ea82f1edbef879e5b83dda530c3428b5 (patch)
tree2a90c6a8cc5e198c1771bcc507dad9935e002dab /src/driver
parent8f5e0af2d66d1b73d841486b7c4f587967ec4152 (diff)
downloadzetacomponents-graph-a55d1470ea82f1edbef879e5b83dda530c3428b5.zip
zetacomponents-graph-a55d1470ea82f1edbef879e5b83dda530c3428b5.tar.gz
- Completed cairo driver
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/cairo.php32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/driver/cairo.php b/src/driver/cairo.php
index 94263e9..f507bf5 100644
--- a/src/driver/cairo.php
+++ b/src/driver/cairo.php
@@ -377,24 +377,35 @@ class ezcGraphCairoDriver extends ezcGraphDriver
// Store current state of context
cairo_save( $this->context );
-
+ cairo_move_to( $this->context, 0, 0 );
if ( $rotation !== null )
{
- cairo_rotate( $this->context, deg2rad( $rotation->getRotation() ) );
- cairo_move_to( $this->context,
- $position->x + $rotation->get( 0, 1 ),
- $position->y + $rotation->get( 0, 2 ) - $size * .15
+ // Move to the center
+ cairo_translate( $this->context,
+ $rotation->getCenter()->x,
+ $rotation->getCenter()->y
+ );
+ // Rotate around text center
+ cairo_rotate( $this->context,
+ deg2rad( $rotation->getRotation() )
+ );
+ // Center the text
+ cairo_translate( $this->context,
+ $position->x - $rotation->getCenter()->x,
+ $position->y - $rotation->getCenter()->y - $size * .15
);
} else {
- cairo_move_to( $this->context,
+ cairo_translate( $this->context,
$position->x,
$position->y - $size * .15
);
}
+ cairo_new_path( $this->context );
$this->getStyle( $color, true );
cairo_show_text( $this->context, $text );
+ cairo_stroke( $this->context );
// Restore state of context
cairo_restore( $this->context );
@@ -419,6 +430,8 @@ class ezcGraphCairoDriver extends ezcGraphDriver
*/
protected function drawAllTexts()
{
+ $this->initiliazeSurface();
+
foreach ( $this->strings as $text )
{
$size = $text['font']->minimalUsedFont;
@@ -457,15 +470,16 @@ class ezcGraphCairoDriver extends ezcGraphDriver
switch ( true )
{
- case ( $text['align'] & ezcGraph::LEFT ):
- $xOffset = 0;
- break;
case ( $text['align'] & ezcGraph::CENTER ):
$xOffset = ( $text['width'] - $width ) / 2;
break;
case ( $text['align'] & ezcGraph::RIGHT ):
$xOffset = $text['width'] - $width;
break;
+ case ( $text['align'] & ezcGraph::LEFT ):
+ default:
+ $xOffset = 0;
+ break;
}
$borderPolygonArray = array(
OpenPOWER on IntegriCloud