fix for x-mirrored text
[swftools.git] / spec / clip.py
1 from sys import * 
2 from pdflib_py import * 
3 p = PDF_new() 
4 PDF_open_file(p, "clip.pdf")
5
6 PDF_set_parameter(p, "usercoordinates", "true")
7 PDF_set_value(p, "compress", 0)
8
9 width = 800
10 height = 800
11 PDF_begin_page(p, width, height)
12
13 PDF_setcolor(p, "fill", "rgb", 0.0, 0.0, 0.0, 0.0)
14 x1,y1,x2,y2 = 100,100,300,300
15 PDF_moveto(p, x1,y1)
16 PDF_lineto(p, x2,y1)
17 PDF_lineto(p, x2,y2)
18 PDF_lineto(p, x1,y2)
19 PDF_lineto(p, x1,y1)
20 x1,y1,x2,y2 = 200,200,400,400
21 PDF_moveto(p, x1,y1)
22 PDF_lineto(p, x2,y1)
23 PDF_lineto(p, x2,y2)
24 PDF_lineto(p, x1,y2)
25 PDF_lineto(p, x1,y1)
26 PDF_stroke(p)
27
28 PDF_setcolor(p, "fill", "rgb", 0.0, 1.0, 0.0, 1.0)
29 x1,y1,x2,y2 = 100,100,300,300
30 PDF_moveto(p, x1,y1)
31 PDF_lineto(p, x2,y1)
32 PDF_lineto(p, x2,y2)
33 PDF_lineto(p, x1,y2)
34 PDF_lineto(p, x1,y1)
35 PDF_clip(p)
36 x1,y1,x2,y2 = 200,200,400,400
37 PDF_moveto(p, x1,y1)
38 PDF_lineto(p, x2,y1)
39 PDF_lineto(p, x2,y2)
40 PDF_lineto(p, x1,y2)
41 PDF_lineto(p, x1,y1)
42 PDF_fill(p)
43
44 PDF_end_page(p)
45 PDF_close(p)
46 PDF_delete(p);