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 /src/driver | |
parent | 6b8824e4674e5607da4fd88d1b24799f2101e3ec (diff) | |
download | zetacomponents-graph-c6ae8ad4cfe4cab62e69c04e5598c7c2311af013.zip zetacomponents-graph-c6ae8ad4cfe4cab62e69c04e5598c7c2311af013.tar.gz |
- Fixed issue #12064: Gradients are not rendered correctly in Flash driver
Diffstat (limited to 'src/driver')
-rw-r--r-- | src/driver/flash.php | 30 |
1 files changed, 22 insertions, 8 deletions
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++ ); |