Changed the entire file structure to remove the .c includes from cairo.c
[phpCairo.git] / testcases / phpCairo / dash-scale.php
blob75af3b312685e36bdebde2e281a47fe8b79f0ec4
1 <?
2 $linewidth = 8.0;
3 $size = 5*$linewidth;
4 $pad = 2*$linewidth;
6 $imwidth = 3*($pad + $size) + $pad;
7 $imheight = $size*5 + 6*$pad;
9 $sur = new CairoImageSurface(FORMAT_ARGB32, $imwidth, $imheight);
10 $con = new CairoContext($sur);
12 $dash= array(1.5*$linewidth);
13 $con->save();
14 $con->setSourceRgb(1,1,1);
15 $con->paint();
16 $con->restore();
18 $con->translate($pad, $pad);
20 $con->setDash($dash, 1, -2*$linewidth);
21 $con->setLineWidth($linewidth);
23 $con->save();
25 $con->moveTo(0,0);
26 $con->relLineTo(0,$size);
27 $con->relLineTo($size,0);
28 $con->closePath();
29 $con->moveTo(2*$linewidth, 0);
30 $con->relLineTo(3*$linewidth, 0);
31 $con->relLineTo(0, 3 * $linewidth);
33 $con->setLineCap(LINE_CAP_BUTT);
34 $con->setLineJoin(LINE_JOIN_BEVEL);
35 $con->stroke();
36 $con->translate($size+$pad,0);
38 $con->moveTo(0,0);
39 $con->relLineTo(0,$size);
40 $con->relLineTo($size,0);
41 $con->closePath();
42 $con->moveTo(2*$linewidth, 0);
43 $con->relLineTo(3*$linewidth, 0);
44 $con->relLineTo(0, 3 * $linewidth);
46 $con->setLineCap(LINE_CAP_ROUND);
47 $con->setLineJoin(LINE_JOIN_ROUND);
48 $con->stroke();
49 $con->translate($size+$pad, 0);
51 $con->moveTo(0,0);
52 $con->relLineTo(0,$size);
53 $con->relLineTo($size,0);
54 $con->closePath();
55 $con->moveTo(2*$linewidth, 0);
56 $con->relLineTo(3*$linewidth, 0);
57 $con->relLineTo(0, 3 * $linewidth);
59 $con->setLineCap(LINE_CAP_SQUARE);
60 $con->setLineJoin(LINE_JOIN_MITER);
61 $con->stroke();
62 $con->restore();
64 $con->translate(0, $size + 2*$pad);
65 //$con->save();
67 $con->save();
68 $con->scale(1,2);
69 $con->moveTo(0,0);
70 $con->relLineTo(0,$size);
71 $con->relLineTo($size,0);
72 $con->closePath();
73 $con->moveTo(2*$linewidth, 0);
74 $con->relLineTo(3*$linewidth, 0);
75 $con->relLineTo(0, 3 * $linewidth);
77 $con->setLineCap(LINE_CAP_BUTT);
78 $con->setLineJoin(LINE_JOIN_BEVEL);
79 $con->stroke();
80 $con->translate($size+$pad, 0);
82 $con->moveTo(0,0);
83 $con->relLineTo(0,$size);
84 $con->relLineTo($size,0);
85 $con->closePath();
86 $con->moveTo(2*$linewidth, 0);
87 $con->relLineTo(3*$linewidth, 0);
88 $con->relLineTo(0, 3 * $linewidth);
90 $con->setLineCap(LINE_CAP_ROUND);
91 $con->setLineJoin(LINE_JOIN_ROUND);
92 $con->stroke();
93 $con->translate($size+$pad, 0);
95 $con->moveTo(0,0);
96 $con->relLineTo(0,$size);
97 $con->relLineTo($size,0);
98 $con->closePath();
99 $con->moveTo(2*$linewidth, 0);
100 $con->relLineTo(3*$linewidth, 0);
101 $con->relLineTo(0, 3 * $linewidth);
103 $con->setLineCap(LINE_CAP_SQUARE);
104 $con->setLineJoin(LINE_JOIN_MITER);
105 $con->stroke();
106 $con->restore();
108 $con->translate(0, 2*$size + 2*$pad);
109 $con->save();
110 $con->scale(1,2);
111 $con->moveTo(0,0);
112 $con->relLineTo(0,$size);
113 $con->relLineTo($size,0);
114 $con->closePath();
115 $con->moveTo(2*$linewidth, 0);
116 $con->relLineTo(3*$linewidth, 0);
117 $con->relLineTo(0, 3 * $linewidth);
119 $con->setLineCap(LINE_CAP_BUTT);
120 $con->setLineJoin(LINE_JOIN_BEVEL);
121 $con->stroke();
122 $con->translate($size+$pad, 0);
124 $con->moveTo(0,0);
125 $con->relLineTo(0,$size);
126 $con->relLineTo($size,0);
127 $con->closePath();
128 $con->moveTo(2*$linewidth, 0);
129 $con->relLineTo(3*$linewidth, 0);
130 $con->relLineTo(0, 3 * $linewidth);
132 $con->setLineCap(LINE_CAP_ROUND);
133 $con->setLineJoin(LINE_JOIN_ROUND);
134 $con->stroke();
135 $con->translate($size+$pad, 0);
137 $con->moveTo(0,0);
138 $con->relLineTo(0,$size);
139 $con->relLineTo($size,0);
140 $con->closePath();
141 $con->moveTo(2*$linewidth, 0);
142 $con->relLineTo(3*$linewidth, 0);
143 $con->relLineTo(0, 3 * $linewidth);
144 $con->setLineCap(LINE_CAP_SQUARE);
145 $con->setLineJoin(LINE_JOIN_MITER);
146 $con->stroke();
147 $con->restore();
149 $sur->writeToPng("dash-scale-php.png");