File: ttf.pl

package info (click to toggle)
libgd-perl 2.78-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,552 kB
  • sloc: perl: 2,508; pascal: 336; sh: 18; makefile: 9
file content (31 lines) | stat: -rwxr-xr-x 742 bytes parent folder | download | duplicates (19)
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
#!/usr/local/bin/perl

use lib '../blib/lib','../blib/arch';
use GD 1.20;
use constant font => '../t/Generic.ttf';

$im = new GD::Image(400,250);


warn $GD::VERSION;

($white,$black,$red,$blue,$yellow) = 
    (
     $im->colorAllocate(255, 255, 255),
     $im->colorAllocate(0, 0, 0),
     $im->colorAllocate(255, 0, 0),
     $im->colorAllocate(0,0,255),
     $im->colorAllocate(255,250,205)
     );
$im->interlaced(1);		# cool venetian blinds effect

# Some TTFs
$im->stringTTF($black,font,12.0,0.0,20,20,"Hello world!") || die $@;
$im->stringTTF($red,font,14.0,0.0,20,80,"Hello world!")|| die $@;;
$im->stringTTF($blue,font,30.0,-0.5,60,100,"Goodbye cruel world!")|| die $@;;

binmode STDOUT;

# print the image to stdout
print $im->png;