From d0a9b9a03fc7ae74ef8a64593ac6b592526ec4d5 Mon Sep 17 00:00:00 2001 From: pp Date: Wed, 19 May 2004 04:59:31 +0000 Subject: - initial import git-svn-id: https://siedziba.pl:790/svn/repos/php-imlib/trunk@7 455248ca-bdda-0310-9134-f4ebb693071a --- examples/draw.php | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 examples/draw.php (limited to 'examples/draw.php') diff --git a/examples/draw.php b/examples/draw.php new file mode 100644 index 0000000..f9469e2 --- /dev/null +++ b/examples/draw.php @@ -0,0 +1,69 @@ +create(225,260); + +$outlinecolor = Array(255,0,0,255); +$color = Array(255,127,0,255); + +$box = new ImlibDraw(); +$box->set_image($im->get_id()); +$box->set_color_array($outlinecolor); +$box->draw_rectangle(7,7,106,56); +$box->set_color_array($color); +$box->fill_rectangle(10,10,100,50); + +$poly = new ImlibPoly(); +$poly->new_poly(); +$poly->set_image($im->get_id()); +$poly->set_color(255,0,255,255); +$poly->add_point(100,100); +$poly->add_point(215,110); +$poly->add_point(150,215); +$poly->add_point(102,255); + +// The cliprect will leave a gap in the middle of this polygon +$poly->set_cliprect(100,50,125,110); // Draw the top +$poly->draw(); +$poly->set_cliprect(100,190,125,70); // Draw the bottom +$poly->draw(); +$poly->free(); + +$poly->set_cliprect(0,0,0,0); // Turns off the clipping rectangle +$poly->new_poly(); +$poly->set_color(255,255,255,255); +$poly->add_point(106,106); +$poly->add_point(205,115); +$poly->add_point(147,211); +$poly->add_point(106,245); + +$poly->draw(); +$poly->free(); + +// This will draw a few pseudo-randomly colored ellipses +$j = 30; +for ($i = 90; $i < 260; $i += 20) +{ + $box->set_color($i,$i*2,255-$i*2,255); + $box->draw_ellipse($j,$i,10,$j/2); + $j += 20; + if ($j > 70) + $j = 25; +} + +$im->save('./draw.png'); +$im->free(); + +?> -- cgit v1.2.3