18.1 Linien, Rechtecke und Vielecke zeichnen

Problem

Sie wollen eine Linie, ein Rechteck oder ein Vieleck zeichnen. Sie wollen außerdem bestimmen können, ob das Recht- oder Vieleck offen oder gefüllt sein soll. Beispiel: Sie wollen Säulendiagramme oder Kurven mit Börsenwerten erstellen.

Lösung

Mit ImageLine( ) können Sie eine Linie zeichnen:

ImageLine($image, $x1, $y1, $x2, $y2, $color);

Mit ImageRectangle( ) können Sie ein leeres Rechteck zeichnen:

ImageRectangle($image, $x1, $y1, $x2, $y2, $color);

Mit ImageFilledRectangle( ) zeichnen Sie ein gefülltes Rechteck:

ImageFilledRectangle($image, $x1, $y1, $x2, $y2, $color);

Ein leeres Vieleck zeichnen Sie mit ImagePolygon( ):

$points = array($x1, $y1, $x2, $y2, $x3, $y3); ImagePolygon($image, $points, count($points)/2, ...

Get PHP 5 Kochbuch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.