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);
14 $con->setSourceRgb(1,1,1);
18 $con->translate($pad, $pad);
20 $con->setDash($dash, 1, -2*$linewidth);
21 $con->setLineWidth($linewidth);
26 $con->relLineTo(0,$size);
27 $con->relLineTo($size,0);
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
);
36 $con->translate($size+
$pad,0);
39 $con->relLineTo(0,$size);
40 $con->relLineTo($size,0);
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
);
49 $con->translate($size+
$pad, 0);
52 $con->relLineTo(0,$size);
53 $con->relLineTo($size,0);
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
);
64 $con->translate(0, $size +
2*$pad);
70 $con->relLineTo(0,$size);
71 $con->relLineTo($size,0);
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
);
80 $con->translate($size+
$pad, 0);
83 $con->relLineTo(0,$size);
84 $con->relLineTo($size,0);
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
);
93 $con->translate($size+
$pad, 0);
96 $con->relLineTo(0,$size);
97 $con->relLineTo($size,0);
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
);
108 $con->translate(0, 2*$size +
2*$pad);
112 $con->relLineTo(0,$size);
113 $con->relLineTo($size,0);
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
);
122 $con->translate($size+
$pad, 0);
125 $con->relLineTo(0,$size);
126 $con->relLineTo($size,0);
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
);
135 $con->translate($size+
$pad, 0);
138 $con->relLineTo(0,$size);
139 $con->relLineTo($size,0);
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
);
149 $sur->writeToPng("dash-scale-php.png");