fixed memleak, made remove_font_transforms subset the kerning tables
[swftools.git] / spec / gradients.py
1 from sys import * 
2 from pdflib_py import * 
3 p = PDF_new() 
4 PDF_open_file(p, "gradients.pdf")
5
6 PDF_set_parameter(p, "usercoordinates", "true")
7 PDF_set_value(p, "compress", 0)
8
9 PDF_set_info(p, "Author", "pdflib")
10 PDF_set_info(p, "Creator", "pdflib_py")
11 PDF_set_info(p, "Title", "gradients")
12
13 width = 1024
14 height = 800
15 PDF_begin_page(p, width, height)
16
17 type,x,params = "radial",0,"r0=0 r1=320"
18 y = 0
19 PDF_setcolor(p, "fill", "rgb", 0.0, 0.0, 0.0, 1.0)
20 shading = PDF_shading(p, type, 160+x,160+y, 160+x, 160+y, 1.0, 1.0, 1.0, 1.0, params) #axial|radial
21 pattern = PDF_shading_pattern(p,shading,"")
22 PDF_setcolor(p, "fill", "pattern", pattern,0,0,0)
23 PDF_moveto(p, x,y)
24 PDF_curveto(p, x+80, y+80, x+80, y+240, x, y+320)
25 PDF_curveto(p, x+80, y+240, x+240, y+240, x+320, y+320)
26 PDF_curveto(p, x+240, y+240, x+240, y+80, x+320, y)
27 PDF_curveto(p, x+240, y+80, x+80, y+80, x, y)
28 PDF_fill(p)
29 PDF_moveto(p, x,y)
30 PDF_curveto(p, x+80, y+80, x+80, y+240, x, y+320)
31 PDF_curveto(p, x+80, y+240, x+240, y+240, x+320, y+320)
32 PDF_curveto(p, x+240, y+240, x+240, y+80, x+320, y)
33 PDF_curveto(p, x+240, y+80, x+80, y+80, x, y)
34 PDF_stroke(p)
35
36 type,x,params = "axial",200,""
37 y = 0
38 PDF_setcolor(p, "fill", "rgb", 0.0, 0.0, 0.4, 1.0)
39 shading = PDF_shading(p, type, 0+x,0+y, 320+x,320+y, 1.0, 1.0, 1.0, 1.0, params) #axial|radial
40 pattern = PDF_shading_pattern(p,shading,"")
41 PDF_setcolor(p, "fill", "pattern", pattern,0,0,0)
42 PDF_moveto(p, x,y)
43 PDF_curveto(p, x+80, y+80, x+80, y+240, x, y+320)
44 PDF_curveto(p, x+80, y+240, x+240, y+240, x+320, y+320)
45 PDF_curveto(p, x+240, y+240, x+240, y+80, x+320, y)
46 PDF_curveto(p, x+240, y+80, x+80, y+80, x, y)
47 PDF_fill(p)
48 PDF_moveto(p, x,y)
49 PDF_curveto(p, x+80, y+80, x+80, y+240, x, y+320)
50 PDF_curveto(p, x+80, y+240, x+240, y+240, x+320, y+320)
51 PDF_curveto(p, x+240, y+240, x+240, y+80, x+320, y)
52 PDF_curveto(p, x+240, y+80, x+80, y+80, x, y)
53 PDF_stroke(p)
54
55 type,x,params = "radial",500,"r0=0 r1=220"
56 y = 0
57 PDF_setcolor(p, "fill", "rgb", 0.0, 0.0, 0.4, 1.0)
58 shading = PDF_shading(p, type, 120+x, 340+y, 120+x, 340+y, 1.0, 1.0, 1.0, 1.0, params) #axial|radial
59 pattern = PDF_shading_pattern(p,shading,"")
60 PDF_setcolor(p, "fill", "pattern", pattern,0,0,0)
61 PDF_moveto(p, x+80, y+80)
62 PDF_lineto(p, x+80, y+640)
63 PDF_lineto(p, x+160, y+640)
64 PDF_lineto(p, x+160, y+80)
65 PDF_lineto(p, x+80, y+80)
66 PDF_fill(p)
67 PDF_moveto(p, x+80, y+80)
68 PDF_lineto(p, x+80, y+640)
69 PDF_lineto(p, x+160, y+640)
70 PDF_lineto(p, x+160, y+80)
71 PDF_lineto(p, x+80, y+80)
72 PDF_stroke(p)
73
74 type,x,params = "axial",600,""
75 y = 0
76 PDF_setcolor(p, "fill", "rgb", 0.0, 0.0, 0.4, 1.0)
77 shading = PDF_shading(p, type, 80+x, 80+y, 80+x, 640+y, 1.0, 1.0, 1.0, 1.0, params) #axial|radial
78 pattern = PDF_shading_pattern(p,shading,"")
79 PDF_setcolor(p, "fill", "pattern", pattern,0,0,0)
80 PDF_moveto(p, x+80, y+80)
81 PDF_lineto(p, x+80, y+640)
82 PDF_lineto(p, x+160, y+640)
83 PDF_lineto(p, x+160, y+80)
84 PDF_lineto(p, x+80, y+80)
85 PDF_fill(p)
86 PDF_moveto(p, x+80, y+80)
87 PDF_lineto(p, x+80, y+640)
88 PDF_lineto(p, x+160, y+640)
89 PDF_lineto(p, x+160, y+80)
90 PDF_lineto(p, x+80, y+80)
91 PDF_stroke(p)
92
93 type,x,params = "axial",50,""
94 y = 300
95 PDF_setcolor(p, "fill", "rgb", 0.0, 0.0, 0.4, 1.0)
96 shading = PDF_shading(p, type, 80+x, 80+y, 400+x, 80+y, 1.0, 1.0, 1.0, 1.0, params) #axial|radial
97 pattern = PDF_shading_pattern(p,shading,"")
98 PDF_setcolor(p, "fill", "pattern", pattern,0,0,0)
99 PDF_moveto(p, x+80, y+80)
100 PDF_lineto(p, x+80, y+160)
101 PDF_lineto(p, x+400, y+160)
102 PDF_lineto(p, x+400, y+80)
103 PDF_lineto(p, x+80, y+80)
104 PDF_fill(p)
105 PDF_moveto(p, x+80, y+80)
106 PDF_lineto(p, x+80, y+160)
107 PDF_lineto(p, x+400, y+160)
108 PDF_lineto(p, x+400, y+80)
109 PDF_lineto(p, x+80, y+80)
110 PDF_stroke(p)
111
112 PDF_end_page(p)
113 PDF_close(p)
114 PDF_delete(p);