fixed staircase issue with poly2bitmap
[swftools.git] / spec / layers2.py
1 from sys import * 
2 from pdflib_py import * 
3 import random
4
5 p = PDF_new() 
6 PDF_open_file(p, "layers2.pdf")
7
8 PDF_set_parameter(p, "usercoordinates", "true")
9 PDF_set_info(p, "Creator", "layer2.py")
10
11 width=400
12 height=400
13
14 PDF_begin_page(p, width, height)
15
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)
20
21 PDF_moveto(p, 20, 110)
22 PDF_lineto(p, 110, 110)
23 PDF_lineto(p, 110, 20)
24 PDF_fill(p)
25
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)
32
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)
42
43 rect(200,100)
44 rect(250,170)
45 rect(300,240)
46
47 PDF_setrgbcolor_fill(p, 0, 1.0, 0)
48 rect(200,300)
49
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)
59
60
61 PDF_end_page(p)
62
63 PDF_close(p)
64 PDF_delete(p);