Support different colors.
This commit is contained in:
parent
9eb4c3b3c2
commit
9756b498b2
@ -2,6 +2,7 @@
|
||||
|
||||
namespace StaticMapLite\ElementPrinter\Polyline;
|
||||
|
||||
use Imagine\Image\Palette\Color\ColorInterface;
|
||||
use Imagine\Image\Point;
|
||||
use StaticMapLite\Canvas\Canvas;
|
||||
use StaticMapLite\Element\Polyline\Polyline;
|
||||
@ -27,8 +28,7 @@ class PolylinePrinter
|
||||
public function paint(Canvas $canvas): PolylinePrinter
|
||||
{
|
||||
$pointList = $this->convertPolylineToPointList($canvas);
|
||||
|
||||
$color = $canvas->getImage()->palette()->color('f00');
|
||||
$color = $this->getPolylineColor($canvas);
|
||||
|
||||
$startPoint = null;
|
||||
$endPoint = null;
|
||||
@ -44,11 +44,19 @@ class PolylinePrinter
|
||||
|
||||
$startPoint = $endPoint;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getPolylineColor(Canvas $canvas): ColorInterface
|
||||
{
|
||||
return $canvas->getImage()->palette()->color([
|
||||
$this->polyline->getColorRed(),
|
||||
$this->polyline->getColorGreen(),
|
||||
$this->polyline->getColorBlue(),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function convertPolylineToPointList(Canvas $canvas): array
|
||||
{
|
||||
$polylineList = \Polyline::decode($this->polyline->getPolyline());
|
||||
|
Loading…
Reference in New Issue
Block a user