summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-11-26 15:57:32 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-11-26 15:57:32 +0000
commitc6ae8ad4cfe4cab62e69c04e5598c7c2311af013 (patch)
tree619acc8573b29d169a3682b8d9dd1f7a8bba7cfc
parent6b8824e4674e5607da4fd88d1b24799f2101e3ec (diff)
downloadzetacomponents-graph-c6ae8ad4cfe4cab62e69c04e5598c7c2311af013.zip
zetacomponents-graph-c6ae8ad4cfe4cab62e69c04e5598c7c2311af013.tar.gz
- Fixed issue #12064: Gradients are not rendered correctly in Flash driver
-rw-r--r--ChangeLog1
-rw-r--r--src/driver/flash.php30
-rw-r--r--tests/data/compare/ezcGraphFlashDriverTest_testDrawCircleLinearFill.swfbin749 -> 749 bytes
-rw-r--r--tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcute.swfbin367 -> 367 bytes
-rw-r--r--tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcuteReverse.swfbin367 -> 367 bytes
-rw-r--r--tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcObtuse.swfbin1572 -> 1572 bytes
-rw-r--r--tests/data/compare/ezcGraphFlashDriverTest_testRenderLabeledFlashPieChart.swfbin49047 -> 49047 bytes
7 files changed, 23 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 840b8a5..a247ca0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 5f62700..5d297a1 100644
--- a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircleLinearFill.swf
+++ b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircleLinearFill.swf
Binary files differ
diff --git a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcute.swf b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcute.swf
index b3ba3c7..cf384ce 100644
--- a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcute.swf
+++ b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcute.swf
Binary files differ
diff --git a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcuteReverse.swf b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcuteReverse.swf
index 867031c..f2ae3ea 100644
--- a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcuteReverse.swf
+++ b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcAcuteReverse.swf
Binary files differ
diff --git a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcObtuse.swf b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcObtuse.swf
index 1688f39..22df567 100644
--- a/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcObtuse.swf
+++ b/tests/data/compare/ezcGraphFlashDriverTest_testDrawCircularArcObtuse.swf
Binary files differ
diff --git a/tests/data/compare/ezcGraphFlashDriverTest_testRenderLabeledFlashPieChart.swf b/tests/data/compare/ezcGraphFlashDriverTest_testRenderLabeledFlashPieChart.swf
index 6b2fd3e..30ee68b 100644
--- a/tests/data/compare/ezcGraphFlashDriverTest_testRenderLabeledFlashPieChart.swf
+++ b/tests/data/compare/ezcGraphFlashDriverTest_testRenderLabeledFlashPieChart.swf
Binary files differ
OpenPOWER on IntegriCloud