2 from pdflib_py
import *
4 PDF_open_file(p
, "gradients.pdf")
6 PDF_set_parameter(p
, "usercoordinates", "true")
7 PDF_set_value(p
, "compress", 0)
9 PDF_set_info(p
, "Author", "pdflib")
10 PDF_set_info(p
, "Creator", "pdflib_py")
11 PDF_set_info(p
, "Title", "gradients")
15 PDF_begin_page(p
, width
, height
)
17 type,x
,params
= "radial",0,"r0=0 r1=320"
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)
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
)
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
)
36 type,x
,params
= "axial",200,""
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)
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
)
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
)
55 type,x
,params
= "radial",500,"r0=0 r1=220"
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)
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)
74 type,x
,params
= "axial",600,""
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)
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)
93 type,x
,params
= "axial",50,""
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)
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)