setFillColor() public method

Set the fill color.
public setFillColor ( Pop\Color\Space\ColorInterface $color = null ) : Svg
$color Pop\Color\Space\ColorInterface
return Svg
Exemplo n.º 1
0
 public function testAddPolygon()
 {
     $s = new Svg('graph.svg', '640px', '480px');
     $points = array(array('x' => 320, 'y' => 50), array('x' => 400, 'y' => 100), array('x' => 420, 'y' => 200), array('x' => 280, 'y' => 320), array('x' => 200, 'y' => 180));
     $s->setStrokeColor(new Rgb(0, 0, 0))->drawPolygon($points);
     $s->setBackgroundColor(new Rgb(255, 0, 0));
     $s->drawPolygon($points);
     $s->setFillColor(new Rgb(255, 0, 0));
     $s->drawPolygon($points);
     $this->assertEquals(640, $s->getWidth());
 }
Exemplo n.º 2
0
<?php

require_once '../../bootstrap.php';
use Pop\Color\Space\Rgb;
use Pop\Image\Svg;
try {
    $points = array(array('x' => 320, 'y' => 50), array('x' => 400, 'y' => 100), array('x' => 420, 'y' => 200), array('x' => 280, 'y' => 320), array('x' => 200, 'y' => 180));
    $image = new Svg('new-image.svg', 640, 480, new Rgb(255, 0, 0));
    $image->setFillColor(new Rgb(0, 0, 255))->setStrokeColor(new Rgb(255, 255, 255))->setStrokeWidth(3)->drawPolygon($points)->output();
} catch (\Exception $e) {
    echo $e->getMessage();
}