ImagickDraw, more complex drawing : Image Paint : Graphics Image PHP Source Code


PHP Source Code » Graphics Image » Image Paint »

 

ImagickDraw, more complex drawing


Here's the result:

flower

<?php
class Flower extends ImagickDraw
{
    private 
$ImagickPixel;
    public function 
__construct()
    {
        
$this->ImagickPixel = new ImagickPixel();
    }
    public function 
drawFlower()
    {
        
$this->createStraw();
        
$this->createPetals();
        
$this->createLeafs();
    }
    private function 
createPetals()
    {
        
$this->ImagickPixel->setColor'red' );
        
$this->setFillColor$this->ImagickPixel );
        
$this->ImagickPixel->setColor'black' );
        
$this->setStrokeColor$this->ImagickPixel );
        
$this->setStrokeWidth0.5 );
        
$this->circle409070110 );
        
$this->circle855011570 );
        
$this->circle12590155110 );
        
$this->circle85130115150 );
        
$this->ImagickPixel->setColor'white' );
        
$this->setFillColor$this->ImagickPixel );
        
$this->circle8590115110 );
    }
    private function 
createStraw()
    {
        
$this->ImagickPixel->setColor'transparent' );
        
$this->setFillColor$this->ImagickPixel );
        
$this->ImagickPixel->setColor'green' );
        
$this->setStrokeColor$this->ImagickPixel );
        
$this->setStrokeWidth);
        
$this->bezier( array(
                             array( 
'x' => 85'y' => 150 ),
                             array( 
'x' => 105'y' => 190 ),
                             array( 
'x' => 55'y' => 400 ),
                             array( 
'x' => 75'y' => 500 ),
                             )
                      );
    }
    private function 
createLeafs()
    {
        
$this->ImagickPixel->setColor'green' );
        
$this->setFillColor$this->ImagickPixel );
        
$this->setStrokeColor$this->ImagickPixel );
        
$this->bezier( array(
                             array( 
'x' => 75'y' => 370 ),
                             array( 
'x' => 65'y' => 250 ),
                             array( 
'x' => 25'y' => 270 ),
                             array( 
'x' => 15'y' => 290 ),
                             array( 
'x' => 25'y' => 310 ),
                             array( 
'x' => 35'y' => 330 ),
                             array( 
'x' => 55'y' => 350 ),
                             )
                      );
        
$this->bezier( array(
                             array( 
'x' => 75'y' => 365 ),
                             array( 
'x' => 95'y' => 250 ),
                             array( 
'x' => 135'y' => 270 ),
                             array( 
'x' => 145'y' => 280 ),
                             array( 
'x' => 145'y' => 290 ),
                             array( 
'x' => 135'y' => 310 ),
                             array( 
'x' => 125'y' => 320 ),
                            )
                     );
    }
}
$Flower = new Flower();
$Flower->drawFlower();
$Imagick = new Imagick();
$Imagick->newPseudoImage175500"gradient:pink-white" );
$Imagick->setImageFormat'png' );
$Imagick->drawImage$Flower );
header"Content-Type: image/{$Imagick->getImageFormat()}" );
echo 
$Imagick;
?>




HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Graphics Image
» Image Paint