diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2008-05-03 18:29:35 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2008-05-03 18:29:35 +0000 |
commit | 639d72f8b822bf105d9c8be01a4fa27452b7beee (patch) | |
tree | 3ab33bc6c147ed2eee3e23d08d03ebe4a0f6c534 /src/driver | |
parent | cce8cbce35d5b21fcc2a9ccb7a62d398e7501594 (diff) | |
download | zetacomponents-graph-639d72f8b822bf105d9c8be01a4fa27452b7beee.zip zetacomponents-graph-639d72f8b822bf105d9c8be01a4fa27452b7beee.tar.gz |
- Implemented feature #10829: Get resource from driver
Diffstat (limited to 'src/driver')
-rw-r--r-- | src/driver/cairo.php | 28 | ||||
-rw-r--r-- | src/driver/flash.php | 16 | ||||
-rw-r--r-- | src/driver/gd.php | 26 | ||||
-rw-r--r-- | src/driver/svg.php | 16 |
4 files changed, 77 insertions, 9 deletions
diff --git a/src/driver/cairo.php b/src/driver/cairo.php index b5a4b24..dc69f4d 100644 --- a/src/driver/cairo.php +++ b/src/driver/cairo.php @@ -974,11 +974,37 @@ class ezcGraphCairoDriver extends ezcGraphDriver * @param string $file Destination filename * @return void */ - public function render ( $file ) + public function render( $file ) { $this->drawAllTexts(); cairo_surface_write_to_png( $this->surface, $file ); } + + /** + * Get resource of rendered result + * + * Return the resource of the rendered result. You should not use this + * method before you called either renderToOutput() or render(), as the + * image may not be completely rendered until then. + * + * This method returns an array, containing the surface and the context in + * a structure like: + * <code> + * array( + * 'surface' => resource, + * 'context' => resource, + * ) + * </code> + * + * @return array + */ + public function getResource() + { + return array( + 'surface' => $this->surface, + 'context' => $this->context, + ); + } } ?> diff --git a/src/driver/flash.php b/src/driver/flash.php index 6f10d0a..9c40ada 100644 --- a/src/driver/flash.php +++ b/src/driver/flash.php @@ -947,12 +947,26 @@ class ezcGraphFlashDriver extends ezcGraphDriver * @param string $file Destination filename * @return void */ - public function render ( $file ) + public function render( $file ) { $this->drawAllTexts(); $movie = $this->getDocument(); $movie->save( $file, $this->options->compression ); } + + /** + * Get resource of rendered result + * + * Return the resource of the rendered result. You should not use this + * method before you called either renderToOutput() or render(), as the + * image may not be completely rendered until then. + * + * @return SWFMovie + */ + public function getResource() + { + return $this->movie; + } } ?> diff --git a/src/driver/gd.php b/src/driver/gd.php index 8755961..8f8a7f7 100644 --- a/src/driver/gd.php +++ b/src/driver/gd.php @@ -89,7 +89,7 @@ class ezcGraphGdDriver extends ezcGraphDriver * * @var array */ - protected $psFontRessources = array(); + protected $psFontResources = array(); /** * Constructor @@ -306,12 +306,12 @@ class ezcGraphGdDriver extends ezcGraphDriver switch ( $font->type ) { case ezcGraph::PS_FONT: - if ( !isset( $this->psFontRessources[$font->path] ) ) + if ( !isset( $this->psFontResources[$font->path] ) ) { - $this->psFontRessources[$font->path] = imagePsLoadFont( $font->path ); + $this->psFontResources[$font->path] = imagePsLoadFont( $font->path ); } - $boundings = imagePsBBox( $text, $this->psFontRessources[$font->path], $size ); + $boundings = imagePsBBox( $text, $this->psFontResources[$font->path], $size ); return new ezcGraphBoundings( $boundings[0], $boundings[1], @@ -377,7 +377,7 @@ class ezcGraphGdDriver extends ezcGraphDriver imagePsText( $image, $text, - $this->psFontRessources[$path], + $this->psFontResources[$path], $size, $this->allocate( $color ), 1, @@ -1115,7 +1115,7 @@ class ezcGraphGdDriver extends ezcGraphDriver * @param string $file Destination filename * @return void */ - public function render ( $file ) + public function render( $file ) { $destination = imagecreatetruecolor( $this->options->width, $this->options->height ); @@ -1190,6 +1190,20 @@ class ezcGraphGdDriver extends ezcGraphDriver throw new ezcGraphGdDriverUnsupportedImageTypeException( $this->options->imageFormat ); } } + + /** + * Get resource of rendered result + * + * Return the resource of the rendered result. You should not use this + * method before you called either renderToOutput() or render(), as the + * image may not be completely rendered until then. + * + * @return resource + */ + public function getResource() + { + return $this->image; + } } ?> diff --git a/src/driver/svg.php b/src/driver/svg.php index 9a814f1..84fe267 100644 --- a/src/driver/svg.php +++ b/src/driver/svg.php @@ -1202,7 +1202,7 @@ class ezcGraphSvgDriver extends ezcGraphDriver * @param string $file Destination filename * @return void */ - public function render ( $file ) + public function render( $file ) { $this->createDocument(); $this->drawAllTexts(); @@ -1211,6 +1211,20 @@ class ezcGraphSvgDriver extends ezcGraphDriver $this->font->addFontToDocument( $this->dom ); $this->dom->save( $file ); } + + /** + * Get resource of rendered result + * + * Return the resource of the rendered result. You should not use this + * method before you called either renderToOutput() or render(), as the + * image may not be completely rendered until then. + * + * @return DOMDocument + */ + public function getResource() + { + return $this->dom; + } } ?> |