fixed memory realloc issue in xpdf
[swftools.git] / spec / pattern.py
1 from sys import * 
2 from pdflib_py import * 
3 p = PDF_new() 
4 PDF_open_file(p, "pattern.pdf")
5
6 PDF_set_parameter(p, "usercoordinates", "true")
7 PDF_set_info(p, "Creator", "pattern.py")
8
9 width=595
10 height=842
11
12 PDF_begin_page(p, width, height)
13
14 PDF_setrgbcolor_stroke(p, 0, 0, 0.9)
15 PDF_setrgbcolor_fill(p, 0.7, 0.7, 0.0)
16 pattern = PDF_begin_pattern(p, 4, 4, 4, 4, 2)
17 PDF_moveto(p, 0, 0)
18 PDF_lineto(p, 4, 4)
19 PDF_moveto(p, 4, 0)
20 PDF_lineto(p, 0, 4)
21 PDF_stroke(p)
22 PDF_moveto(p, 0, 2)
23 PDF_lineto(p, 0, 4)
24 PDF_lineto(p, 4, 4)
25 PDF_lineto(p, 4, 2)
26 PDF_lineto(p, 0, 2)
27 PDF_fill(p)
28 PDF_end_pattern(p)
29
30 PDF_setcolor(p, "fill", "pattern", pattern, 0.0, 0.9, 0.0)
31 PDF_moveto(p, 0, 0)
32 PDF_lineto(p, width-100, 0)
33 PDF_lineto(p, width-100, height)
34 PDF_lineto(p, 0, height)
35 PDF_lineto(p, 0, 0)
36 PDF_fill(p)
37
38 PDF_end_page(p)
39
40 PDF_close(p)
41 PDF_delete(p);