diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-11-26 15:57:32 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-11-26 15:57:32 +0000 |
commit | c6ae8ad4cfe4cab62e69c04e5598c7c2311af013 (patch) | |
tree | 619acc8573b29d169a3682b8d9dd1f7a8bba7cfc | |
parent | 6b8824e4674e5607da4fd88d1b24799f2101e3ec (diff) | |
download | zetacomponents-graph-c6ae8ad4cfe4cab62e69c04e5598c7c2311af013.zip zetacomponents-graph-c6ae8ad4cfe4cab62e69c04e5598c7c2311af013.tar.gz |
- Fixed issue #12064: Gradients are not rendered correctly in Flash driver
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/driver/flash.php | 30 | ||||
-rw-r--r-- | tests/data/compare/ezcGraphFlashDriverTest_testDrawCircleLinearFill.swf | bin | 749 -> 749 bytes | |||
-rw-r--r-- | tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcute.swf | bin | 367 -> 367 bytes | |||
-rw-r--r-- | tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcuteReverse.swf | bin | 367 -> 367 bytes | |||
-rw-r--r-- | tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcObtuse.swf | bin | 1572 -> 1572 bytes | |||
-rw-r--r-- | tests/data/compare/ezcGraphFlashDriverTest_testRenderLabeledFlashPieChart.swf | bin | 49047 -> 49047 bytes |
7 files changed, 23 insertions, 8 deletions
@@ -3,6 +3,7 @@ - Implemented support for odometer charts. Thanks to lars Jankowski from Oxid esales for the initial patch. +- Fixed issue #12064: Gradients are not rendered correctly in Flash driver 1.2alpha1 - Monday 29 October 2007 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/driver/flash.php b/src/driver/flash.php index 9aba002..7c12de5 100644 --- a/src/driver/flash.php +++ b/src/driver/flash.php @@ -129,17 +129,26 @@ class ezcGraphFlashDriver extends ezcGraphDriver $fill = $shape->addFill( $gradient, SWFFILL_LINEAR_GRADIENT ); + // Calculate desired length of gradient + $length = sqrt( + pow( $color->endPoint->x - $color->startPoint->x, 2 ) + + pow( $color->endPoint->y - $color->startPoint->y, 2 ) + ); + + $fill->scaleTo( $this->modifyCoordinate( $length ) / 32768 , $this->modifyCoordinate( $length ) / 32768 ); $fill->rotateTo( rad2deg( asin( - ( $color->endPoint->x - $color->startPoint->x ) / - $length = sqrt( - pow( $color->endPoint->x - $color->startPoint->x, 2 ) + - pow( $color->endPoint->y - $color->startPoint->y, 2 ) - ) + ( $color->endPoint->x - $color->startPoint->x ) / $length ) + 180 ) ); - $fill->scaleTo( $this->modifyCoordinate( $length ) / 32768 , $this->modifyCoordinate( $length ) / 32768 ); - $fill->moveTo( $this->modifyCoordinate( $color->startPoint->x ), $this->modifyCoordinate( $color->startPoint->y ) ); + $fill->moveTo( + $this->modifyCoordinate( + ( $color->startPoint->x + $color->endPoint->x ) / 2 + ), + $this->modifyCoordinate( + ( $color->startPoint->y + $color->endPoint->y ) / 2 + ) + ); $shape->setLeftFill( $fill ); break; @@ -857,7 +866,7 @@ class ezcGraphFlashDriver extends ezcGraphDriver ); // @TODO: User SWFShape::curveTo - for ( $angle = $this->options->circleResolution; $angle <= 360; $angle += $this->options->circleResolution ) + for ( $angle = $this->options->circleResolution; $angle < 360; $angle += $this->options->circleResolution ) { $shape->drawLineTo( $this->modifyCoordinate( $center->x + cos( deg2rad( $angle ) ) * $width / 2 ), @@ -865,6 +874,11 @@ class ezcGraphFlashDriver extends ezcGraphDriver ); } + $shape->drawLineTo( + $this->modifyCoordinate( $center->x + $width / 2 ), + $this->modifyCoordinate( $center->y ) + ); + $object = $movie->add( $shape ); $object->setName( $id = 'ezcGraphCircle_' . $this->id++ ); diff --git a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircleLinearFill.swf b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircleLinearFill.swf Binary files differindex 5f62700..5d297a1 100644 --- a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircleLinearFill.swf +++ b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircleLinearFill.swf diff --git a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcute.swf b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcute.swf Binary files differindex b3ba3c7..cf384ce 100644 --- a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcute.swf +++ b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcute.swf diff --git a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcuteReverse.swf b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcuteReverse.swf Binary files differindex 867031c..f2ae3ea 100644 --- a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcuteReverse.swf +++ b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcuteReverse.swf diff --git a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcObtuse.swf b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcObtuse.swf Binary files differindex 1688f39..22df567 100644 --- a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcObtuse.swf +++ b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcObtuse.swf diff --git a/tests/data/compare/ezcGraphFlashDriverTest_testRenderLabeledFlashPieChart.swf b/tests/data/compare/ezcGraphFlashDriverTest_testRenderLabeledFlashPieChart.swf Binary files differindex 6b2fd3e..30ee68b 100644 --- a/tests/data/compare/ezcGraphFlashDriverTest_testRenderLabeledFlashPieChart.swf +++ b/tests/data/compare/ezcGraphFlashDriverTest_testRenderLabeledFlashPieChart.swf |