commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / vendor / dompdf / dompdf / src / Canvas.php
1 <?php
2 /**
3 * @package dompdf
4 * @link http://dompdf.github.com/
5 * @author Benj Carson <benjcarson@digitaljunkies.ca>
6 * @author Fabien Ménager <fabien.menager@gmail.com>
7 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
8 */
9
10 namespace Dompdf;
11
12 /**
13 * Main rendering interface
14 *
15 * Currently {@link Dompdf\Adapter\CPDF}, {@link Dompdf\Adapter\PDFLib}, and {@link Dompdf\Adapter\GD}
16 * implement this interface.
17 *
18 * Implementations should measure x and y increasing to the left and down,
19 * respectively, with the origin in the top left corner. Implementations
20 * are free to use a unit other than points for length, but I can't
21 * guarantee that the results will look any good.
22 *
23 * @package dompdf
24 */
25 interface Canvas
26 {
27 function __construct($paper = "letter", $orientation = "portrait", Dompdf $dompdf);
28
29 /**
30 * @return Dompdf
31 */
32 function get_dompdf();
33
34 /**
35 * Returns the current page number
36 *
37 * @return int
38 */
39 function get_page_number();
40
41 /**
42 * Returns the total number of pages
43 *
44 * @return int
45 */
46 function get_page_count();
47
48 /**
49 * Sets the total number of pages
50 *
51 * @param int $count
52 */
53 function set_page_count($count);
54
55 /**
56 * Draws a line from x1,y1 to x2,y2
57 *
58 * See {@link Style::munge_color()} for the format of the color array.
59 * See {@link Cpdf::setLineStyle()} for a description of the format of the
60 * $style parameter (aka dash).
61 *
62 * @param float $x1
63 * @param float $y1
64 * @param float $x2
65 * @param float $y2
66 * @param array $color
67 * @param float $width
68 * @param array $style
69 */
70 function line($x1, $y1, $x2, $y2, $color, $width, $style = null);
71
72 /**
73 * Draws a rectangle at x1,y1 with width w and height h
74 *
75 * See {@link Style::munge_color()} for the format of the color array.
76 * See {@link Cpdf::setLineStyle()} for a description of the $style
77 * parameter (aka dash)
78 *
79 * @param float $x1
80 * @param float $y1
81 * @param float $w
82 * @param float $h
83 * @param array $color
84 * @param float $width
85 * @param array $style
86 */
87 function rectangle($x1, $y1, $w, $h, $color, $width, $style = null);
88
89 /**
90 * Draws a filled rectangle at x1,y1 with width w and height h
91 *
92 * See {@link Style::munge_color()} for the format of the color array.
93 *
94 * @param float $x1
95 * @param float $y1
96 * @param float $w
97 * @param float $h
98 * @param array $color
99 */
100 function filled_rectangle($x1, $y1, $w, $h, $color);
101
102 /**
103 * Starts a clipping rectangle at x1,y1 with width w and height h
104 *
105 * @param float $x1
106 * @param float $y1
107 * @param float $w
108 * @param float $h
109 */
110 function clipping_rectangle($x1, $y1, $w, $h);
111
112 /**
113 * Starts a rounded clipping rectangle at x1,y1 with width w and height h
114 *
115 * @param float $x1
116 * @param float $y1
117 * @param float $w
118 * @param float $h
119 * @param float $tl
120 * @param float $tr
121 * @param float $br
122 * @param float $bl
123 *
124 * @return
125 */
126 function clipping_roundrectangle($x1, $y1, $w, $h, $tl, $tr, $br, $bl);
127
128 /**
129 * Ends the last clipping shape
130 */
131 function clipping_end();
132
133 /**
134 * Save current state
135 */
136 function save();
137
138 /**
139 * Restore last state
140 */
141 function restore();
142
143 /**
144 * Rotate
145 */
146 function rotate($angle, $x, $y);
147
148 /**
149 * Skew
150 */
151 function skew($angle_x, $angle_y, $x, $y);
152
153 /**
154 * Scale
155 */
156 function scale($s_x, $s_y, $x, $y);
157
158 /**
159 * Translate
160 */
161 function translate($t_x, $t_y);
162
163 /**
164 * Transform
165 */
166 function transform($a, $b, $c, $d, $e, $f);
167
168 /**
169 * Draws a polygon
170 *
171 * The polygon is formed by joining all the points stored in the $points
172 * array. $points has the following structure:
173 * <code>
174 * array(0 => x1,
175 * 1 => y1,
176 * 2 => x2,
177 * 3 => y2,
178 * ...
179 * );
180 * </code>
181 *
182 * See {@link Style::munge_color()} for the format of the color array.
183 * See {@link Cpdf::setLineStyle()} for a description of the $style
184 * parameter (aka dash)
185 *
186 * @param array $points
187 * @param array $color
188 * @param float $width
189 * @param array $style
190 * @param bool $fill Fills the polygon if true
191 */
192 function polygon($points, $color, $width = null, $style = null, $fill = false);
193
194 /**
195 * Draws a circle at $x,$y with radius $r
196 *
197 * See {@link Style::munge_color()} for the format of the color array.
198 * See {@link Cpdf::setLineStyle()} for a description of the $style
199 * parameter (aka dash)
200 *
201 * @param float $x
202 * @param float $y
203 * @param float $r
204 * @param array $color
205 * @param float $width
206 * @param array $style
207 * @param bool $fill Fills the circle if true
208 */
209 function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false);
210
211 /**
212 * Add an image to the pdf.
213 *
214 * The image is placed at the specified x and y coordinates with the
215 * given width and height.
216 *
217 * @param string $img_url the path to the image
218 * @param float $x x position
219 * @param float $y y position
220 * @param int $w width (in pixels)
221 * @param int $h height (in pixels)
222 * @param string $resolution The resolution of the image
223 */
224 function image($img_url, $x, $y, $w, $h, $resolution = "normal");
225
226 /**
227 * Add an arc to the PDF
228 * See {@link Style::munge_color()} for the format of the color array.
229 *
230 * @param float $x X coordinate of the arc
231 * @param float $y Y coordinate of the arc
232 * @param float $r1 Radius 1
233 * @param float $r2 Radius 2
234 * @param float $astart Start angle in degrees
235 * @param float $aend End angle in degrees
236 * @param array $color Color
237 * @param float $width
238 * @param array $style
239 *
240 * @return void
241 */
242 function arc($x, $y, $r1, $r2, $astart, $aend, $color, $width, $style = array());
243
244 /**
245 * Writes text at the specified x and y coordinates
246 * See {@link Style::munge_color()} for the format of the color array.
247 *
248 * @param float $x
249 * @param float $y
250 * @param string $text the text to write
251 * @param string $font the font file to use
252 * @param float $size the font size, in points
253 * @param array $color
254 * @param float $word_space word spacing adjustment
255 * @param float $char_space char spacing adjustment
256 * @param float $angle angle
257 *
258 * @return void
259 */
260 function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $word_space = 0.0, $char_space = 0.0, $angle = 0.0);
261
262 /**
263 * Add a named destination (similar to <a name="foo">...</a> in html)
264 *
265 * @param string $anchorname The name of the named destination
266 */
267 function add_named_dest($anchorname);
268
269 /**
270 * Add a link to the pdf
271 *
272 * @param string $url The url to link to
273 * @param float $x The x position of the link
274 * @param float $y The y position of the link
275 * @param float $width The width of the link
276 * @param float $height The height of the link
277 *
278 * @return void
279 */
280 function add_link($url, $x, $y, $width, $height);
281
282 /**
283 * Add meta information to the pdf
284 *
285 * @param string $name Label of the value (Creator, Producer, etc.)
286 * @param string $value The text to set
287 */
288 function add_info($name, $value);
289
290 /**
291 * Calculates text size, in points
292 *
293 * @param string $text the text to be sized
294 * @param string $font the desired font
295 * @param float $size the desired font size
296 * @param float $word_spacing word spacing, if any
297 * @param float $char_spacing
298 *
299 * @return float
300 */
301 function get_text_width($text, $font, $size, $word_spacing = 0.0, $char_spacing = 0.0);
302
303 /**
304 * Calculates font height, in points
305 *
306 * @param string $font
307 * @param float $size
308 *
309 * @return float
310 */
311 function get_font_height($font, $size);
312
313 /**
314 * Calculates font baseline, in points
315 *
316 * @param string $font
317 * @param float $size
318 *
319 * @return float
320 */
321 function get_font_baseline($font, $size);
322
323 /**
324 * Returns the font x-height, in points
325 *
326 * @param string $font
327 * @param float $size
328 *
329 * @return float
330 */
331 //function get_font_x_height($font, $size);
332
333 /**
334 * Sets the opacity
335 *
336 * @param float $opacity
337 * @param string $mode
338 */
339 function set_opacity($opacity, $mode = "Normal");
340
341 /**
342 * Sets the default view
343 *
344 * @param string $view
345 * 'XYZ' left, top, zoom
346 * 'Fit'
347 * 'FitH' top
348 * 'FitV' left
349 * 'FitR' left,bottom,right
350 * 'FitB'
351 * 'FitBH' top
352 * 'FitBV' left
353 * @param array $options
354 *
355 * @return void
356 */
357 function set_default_view($view, $options = array());
358
359 /**
360 * @param string $script
361 *
362 * @return void
363 */
364 function javascript($script);
365
366 /**
367 * Starts a new page
368 *
369 * Subsequent drawing operations will appear on the new page.
370 */
371 function new_page();
372
373 /**
374 * Streams the PDF directly to the browser
375 *
376 * @param string $filename the name of the PDF file
377 * @param array $options associative array, 'Attachment' => 0 or 1, 'compress' => 1 or 0
378 */
379 function stream($filename, $options = null);
380
381 /**
382 * Returns the PDF as a string
383 *
384 * @param array $options associative array: 'compress' => 1 or 0
385 * @return string
386 */
387 function output($options = null);
388 }