.' ); } $this->source = $propertyValue; break; case 'position': $this->position = (int) $propertyValue; break; default: return parent::__set( $propertyName, $propertyValue ); } } /** * Render a legend * * @param ezcGraphRenderer $renderer * @access public * @return void */ public function render( ezcGraphRenderer $renderer, ezcGraphBoundings $boundings ) { if ( empty( $this->source ) ) { return $boundings; } // Get background image boundings $data = getimagesize( $this->source ); // Determine x position switch ( true ) { case ( $this->position & ezcGraph::LEFT ): $xPosition = 0; break; case ( $this->position & ezcGraph::RIGHT ): $xPosition = $boundings->x1 - $data[0]; break; case ( $this->position & ezcGraph::CENTER ): default: $xPosition = (int) round( ( $boundings->x1 - $data[0] ) / 2 ); break; } // Determine y position switch ( true ) { case ( $this->position & ezcGraph::TOP ): $yPosition = 0; break; case ( $this->position & ezcGraph::BOTTOM ): $yPosition = $boundings->y1 - $data[1]; break; case ( $this->position & ezcGraph::MIDDLE ): default: $yPosition = (int) round( ( $boundings->y1 - $data[1] ) / 2 ); break; } $renderer->drawBackgroundImage( $this->source, new ezcGraphCoordinate( $xPosition, $yPosition ), $data[0], $data[1] ); return $boundings; } } ?>