File: imlibtest.txt

package info (click to toggle)
php-imlib 0.7-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,020 kB
  • ctags: 817
  • sloc: php: 2,464; ansic: 1,324; xml: 94; makefile: 67; sh: 12
file content (51 lines) | stat: -rw-r--r-- 1,254 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?

require './class.ImlibImage.php';
require './class.ImlibColor.php';
require './class.ImlibText.php';
require './class.ImlibCliprect.php';
require './class.ImlibDraw.php';
require './class.ImlibPoly.php';

$im = new ImlibImage();
$im->create(480,320);

$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);
$poly->draw();
$poly->free();

$txt = new ImlibText();
$txt->set_image($im->get_id());
$txt->load('','Vera','25');
$txt->draw(250,50,"Always a Boom.",IMLIB_TEXT_TO_UP);
$txt->get_size("Always a Boom.",$tw,$th,IMLIB_TEXT_TO_UP);
$txt->free();

// Draw a box around the text string
$box->set_color(100,100,100,255);
$box->draw_line(245,50,245,50+$th);
$box->draw_line(250,45,250+$tw,45);
$box->draw_line(255+$tw,50,255+$tw,50+$th);
$box->draw_line(250,55+$th,250+$tw,55+$th);

$im->save('./dst.png');
$im->free();

?>