public function draw()
    {
        $canvas = $this->resource;

        if ($canvas) {
            foreach ($this->elementList as $element) {
                if ($element instanceof Image) {
                    $this->drawImage($element, $canvas);
                }

                if ($element instanceof Text) {
                    $this->drawText($element, $canvas);
                }
            }

            $this->resource = $canvas;
        } else {
            throw new \Exception(''
            . 'Image or Figure class is not assigned. '
            . 'E.g. "new Canvas($image_or_figure)"'
            . '');
        }

        return $this;
    }
public function draw()
    {
        $canvas = $this->resource;

        if ($canvas) {
            foreach ($this->elementList as $element) {
                if ($element instanceof Image) {
                    $this->drawImage($element, $canvas);
                }

                if ($element instanceof Text) {
                    $this->drawText($element, $canvas);
                }
            }

            $this->resource = $canvas;
        } else {
            throw new \Exception(''
            . 'Image or Figure class is not assigned. '
            . 'E.g. "new Canvas($image_or_figure)"'
            . '');
        }

        return $this;
    }
public function draw ( ) { $ canvas = $ this -> resource ; if ( $ canvas ) { foreach ( $ this -> elementList as $ element ) { if ( $ element instanceof Image ) { $ this -> drawImage ( $ element , $ canvas ) ; } if ( $ element instanceof Text ) { $ this -> drawText ( $ element , $ canvas ) ; } } $ this -> resource = $ canvas ; } else { throw new \ Exception ( '' . 'Image or Figure class is not assigned. ' . 'E.g. "new Canvas($image_or_figure)"' . '' ) ; } return $ this ; }
Draws the canvas.

@access public
@return \GImage\Canvas
@throws \Exception
Draws the canvas .