applied patches from Vicente Jimenez Aguilar
[swftools.git] / spec / layers2.py
blobf0ade050e6812adeb2b5031a394f4c7e42080e4b
1 from sys import *
2 from pdflib_py import *
3 import random
5 p = PDF_new()
6 PDF_open_file(p, "layers2.pdf")
8 PDF_set_parameter(p, "usercoordinates", "true")
9 PDF_set_info(p, "Creator", "layer2.py")
11 width=400
12 height=400
14 PDF_begin_page(p, width, height)
16 PDF_setrgbcolor_fill(p, 0, 0, 1.0)
17 PDF_moveto(p, 10, 10)
18 PDF_lineto(p, 100, 10)
19 PDF_lineto(p, 10, 100)
21 PDF_moveto(p, 20, 110)
22 PDF_lineto(p, 110, 110)
23 PDF_lineto(p, 110, 20)
24 PDF_fill(p)
26 for i in range(100):
27 x = random.randint(10,110)
28 y = random.randint(200,300)
29 PDF_moveto(p, x, y)
30 PDF_lineto(p, x+5, y)
31 PDF_stroke(p)
33 PDF_setrgbcolor_fill(p, 0.5, 0.5, 1.0)
34 x,y = 100,100
35 def rect(x,y):
36 PDF_moveto(p, x,y)
37 PDF_lineto(p, x+50,y)
38 PDF_lineto(p, x+50,y+50)
39 PDF_lineto(p, x,y+50)
40 PDF_lineto(p, x,y)
41 PDF_fill(p)
43 rect(200,100)
44 rect(250,170)
45 rect(300,240)
47 PDF_setrgbcolor_fill(p, 0, 1.0, 0)
48 rect(200,300)
50 x,y = 230,330
51 PDF_moveto(p, x+25,y)
52 PDF_lineto(p, x+50,y)
53 PDF_lineto(p, x+50,y+50)
54 PDF_lineto(p, x,y+50)
55 PDF_lineto(p, x,y+25)
56 PDF_lineto(p, x+25,y+25)
57 PDF_lineto(p, x+25,y)
58 PDF_fill(p)
61 PDF_end_page(p)
63 PDF_close(p)
64 PDF_delete(p);