Debian Codegraph @

doc/defuns-cairo.xml.texi

raw
1
2 @c %start of fragment
3
4 @deffn Function cairo-create (@var{target} @code{<cairo-surface-t>}) @result{} (@var{ret} @code{<cairo-t>})
5 Creates a new @code{<cairo-t>} with all graphics state parameters set to
6 default values and with @var{target} as a target surface. The target
7 surface should be constructed with a backend-specific function such as
8 @code{cairo-image-surface-create} (or any other
9 @samp{cairo_<backend>_surface_create} variant).
10
11 @table @var
12 @item target
13 target surface for the context
14
15 @item ret
16 a newly allocated @code{<cairo-t>}.
17
18 @end table
19
20 @end deffn
21
22 @deffn Function cairo-save (@var{cr}@tie{}@code{<cairo-t>})
23 Makes a copy of the current state of @var{cr} and saves it on an
24 internal stack of saved states for @var{cr}. When @code{cairo-restore}
25 is called, @var{cr} will be restored to the saved state. Multiple calls
26 to @code{cairo-save} and @code{cairo-restore} can be nested; each call
27 to @code{cairo-restore} restores the state from the matching paired
28 @code{cairo-save}.
29
30 It isn't necessary to clear all saved states before a @code{<cairo-t>}
31 is freed. If the reference count of a @code{<cairo-t>} drops to zero in
32 response to a call to @code{cairo-destroy}, any saved states will be
33 freed along with the @code{<cairo-t>}.
34
35 @table @var
36 @item cr
37 a @code{<cairo-t>}
38
39 @end table
40
41 @end deffn
42
43 @deffn Function cairo-restore (@var{cr}@tie{}@code{<cairo-t>})
44 Restores @var{cr} to the state saved by a preceding call to
45 @code{cairo-save} and removes that state from the stack of saved states.
46
47 @table @var
48 @item cr
49 a @code{<cairo-t>}
50
51 @end table
52
53 @end deffn
54
55 @deffn Function cairo-get-target (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-surface-t >})
56 Gets the target surface for the cairo context as passed to
57 @code{cairo-create}.
58
59 This function will always return a valid pointer, but the result can be
60 a "nil" surface if @var{cr} is already in an error state, (ie.
61 @code{cairo-status}@samp{!=}@samp{CAIRO_STATUS_SUCCESS}). A nil surface
62 is indicated by
63 @code{cairo-surface-status}@samp{!=}@samp{CAIRO_STATUS_SUCCESS}.
64
65 @table @var
66 @item cr
67 a cairo context
68
69 @item ret
70 the target surface. This object is owned by cairo. To keep a reference
71 to it, you must call @code{cairo-surface-reference}.
72
73 @end table
74
75 @end deffn
76
77 @deffn Function cairo-push-group (@var{cr}@tie{}@code{<cairo-t>})
78 Temporarily redirects drawing to an intermediate surface known as a
79 group. The redirection lasts until the group is completed by a call to
80 @code{cairo-pop-group} or @code{cairo-pop-group-to-source}. These calls
81 provide the result of any drawing to the group as a pattern, (either as
82 an explicit object, or set as the source pattern).
83
84 This group functionality can be convenient for performing intermediate
85 compositing. One common use of a group is to render objects as opaque
86 within the group, (so that they occlude each other), and then blend the
87 result with translucence onto the destination.
88
89 Groups can be nested arbitrarily deep by making balanced calls to
90 @code{cairo-push-group}/@code{cairo-pop-group}. Each call pushes/pops
91 the new target group onto/from a stack.
92
93 The @code{cairo-push-group} function calls @code{cairo-save} so that any
94 changes to the graphics state will not be visible outside the group,
95 (the pop_group functions call @code{cairo-restore}).
96
97 By default the intermediate group will have a content type of
98 @samp{CAIRO_CONTENT_COLOR_ALPHA}. Other content types can be chosen for
99 the group by using @code{cairo-push-group-with-content} instead.
100
101 As an example, here is how one might fill and stroke a path with
102 translucence, but without any portion of the fill being visible under
103 the stroke:
104
105 @example
106
107 cairo_push_group (cr);
108 cairo_set_source (cr, fill_pattern);
109 cairo_fill_preserve (cr);
110 cairo_set_source (cr, stroke_pattern);
111 cairo_stroke (cr);
112 cairo_pop_group_to_source (cr);
113 cairo_paint_with_alpha (cr, alpha);
114 @end example
115
116 @table @var
117 @item cr
118 a cairo context
119
120 @end table
121
122 Since 1.2
123
124 @end deffn
125
126 @deffn Function cairo-pop-group (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-pattern-t >})
127 Terminates the redirection begun by a call to @code{cairo-push-group} or
128 @code{cairo-push-group-with-content} and returns a new pattern
129 containing the results of all drawing operations performed to the group.
130
131 The @code{cairo-pop-group} function calls @code{cairo-restore},
132 (balancing a call to @code{cairo-save} by the push_group function), so
133 that any changes to the graphics state will not be visible outside the
134 group.
135
136 @table @var
137 @item cr
138 a cairo context
139
140 @item ret
141 a newly created (surface) pattern containing the results of all drawing
142 operations performed to the group. The caller owns the returned object
143 and should call @code{cairo-pattern-destroy} when finished with it.
144
145 @end table
146
147 Since 1.2
148
149 @end deffn
150
151 @deffn Function cairo-pop-group-to-source (@var{cr}@tie{}@code{<cairo-t>})
152 Terminates the redirection begun by a call to @code{cairo-push-group} or
153 @code{cairo-push-group-with-content} and installs the resulting pattern
154 as the source pattern in the given cairo context.
155
156 The behavior of this function is equivalent to the sequence of
157 operations:
158
159 @example
160 cairo_pattern_t *group = cairo_pop_group (cr);
161 cairo_set_source (cr, group);
162 cairo_pattern_destroy (group);
163 @end example
164
165 but is more convenient as their is no need for a variable to store the
166 short-lived pointer to the pattern.
167
168 The @code{cairo-pop-group} function calls @code{cairo-restore},
169 (balancing a call to @code{cairo-save} by the push_group function), so
170 that any changes to the graphics state will not be visible outside the
171 group.
172
173 @table @var
174 @item cr
175 a cairo context
176
177 @end table
178
179 Since 1.2
180
181 @end deffn
182
183 @deffn Function cairo-get-group-target (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-surface-t >})
184 Gets the current destination surface for the context. This is either the
185 original target surface as passed to @code{cairo-create} or the target
186 surface for the current group as started by the most recent call to
187 @code{cairo-push-group} or @code{cairo-push-group-with-content}.
188
189 This function will always return a valid pointer, but the result can be
190 a "nil" surface if @var{cr} is already in an error state, (ie.
191 @code{cairo-status}@samp{!=}@samp{CAIRO_STATUS_SUCCESS}). A nil surface
192 is indicated by
193 @code{cairo-surface-status}@samp{!=}@samp{CAIRO_STATUS_SUCCESS}.
194
195 @table @var
196 @item cr
197 a cairo context
198
199 @item ret
200 the target surface. This object is owned by cairo. To keep a reference
201 to it, you must call @code{cairo-surface-reference}.
202
203 @end table
204
205 Since 1.2
206
207 @end deffn
208
209 @deffn Function cairo-set-source-rgb (@var{cr}@tie{}@code{<cairo-t>}) (@var{red}@tie{}@code{<double>}) (@var{green}@tie{}@code{<double>}) (@var{blue}@tie{}@code{<double>})
210 Sets the source pattern within @var{cr} to an opaque color. This opaque
211 color will then be used for any subsequent drawing operation until a new
212 source pattern is set.
213
214 The color components are floating point numbers in the range 0 to 1. If
215 the values passed in are outside that range, they will be clamped.
216
217 The default source pattern is opaque black, (that is, it is equivalent
218 to cairo_set_source_rgb(cr, 0.0, 0.0, 0.0)).
219
220 @table @var
221 @item cr
222 a cairo context
223
224 @item red
225 red component of color
226
227 @item green
228 green component of color
229
230 @item blue
231 blue component of color
232
233 @end table
234
235 @end deffn
236
237 @deffn Function cairo-set-source-rgba (@var{cr}@tie{}@code{<cairo-t>}) (@var{red}@tie{}@code{<double>}) (@var{green}@tie{}@code{<double>}) (@var{blue}@tie{}@code{<double>}) (@var{alpha}@tie{}@code{<double>})
238 Sets the source pattern within @var{cr} to a translucent color. This
239 color will then be used for any subsequent drawing operation until a new
240 source pattern is set.
241
242 The color and alpha components are floating point numbers in the range 0
243 to 1. If the values passed in are outside that range, they will be
244 clamped.
245
246 The default source pattern is opaque black, (that is, it is equivalent
247 to cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 1.0)).
248
249 @table @var
250 @item cr
251 a cairo context
252
253 @item red
254 red component of color
255
256 @item green
257 green component of color
258
259 @item blue
260 blue component of color
261
262 @item alpha
263 alpha component of color
264
265 @end table
266
267 @end deffn
268
269 @deffn Function cairo-set-source (@var{cr}@tie{}@code{<cairo-t>}) (@var{source}@tie{}@code{<cairo-pattern-t>})
270 Sets the source pattern within @var{cr} to @var{source}. This pattern
271 will then be used for any subsequent drawing operation until a new
272 source pattern is set.
273
274 Note: The pattern's transformation matrix will be locked to the user
275 space in effect at the time of @code{cairo-set-source}. This means that
276 further modifications of the current transformation matrix will not
277 affect the source pattern. See @code{cairo-pattern-set-matrix}.
278
279 The default source pattern is a solid pattern that is opaque black,
280 (that is, it is equivalent to cairo_set_source_rgb(cr, 0.0, 0.0, 0.0)).
281
282 @table @var
283 @item cr
284 a cairo context
285
286 @item source
287 a @code{<cairo-pattern-t>} to be used as the source for subsequent
288 drawing operations.
289
290 @end table
291
292 @end deffn
293
294 @deffn Function cairo-set-source-surface (@var{cr}@tie{}@code{<cairo-t>}) (@var{surface}@tie{}@code{<cairo-surface-t>}) (@var{x}@tie{}@code{<double>}) (@var{y}@tie{}@code{<double>})
295 This is a convenience function for creating a pattern from @var{surface}
296 and setting it as the source in @var{cr} with @code{cairo-set-source}.
297
298 The @var{x} and @var{y} parameters give the user-space coordinate at
299 which the surface origin should appear. (The surface origin is its
300 upper-left corner before any transformation has been applied.) The
301 @var{x} and @var{y} parameters are negated and then set as translation
302 values in the pattern matrix.
303
304 Other than the initial translation pattern matrix, as described above,
305 all other pattern attributes, (such as its extend mode), are set to the
306 default values as in @code{cairo-pattern-create-for-surface}. The
307 resulting pattern can be queried with @code{cairo-get-source} so that
308 these attributes can be modified if desired, (eg. to create a repeating
309 pattern with @code{cairo-pattern-set-extend}).
310
311 @table @var
312 @item cr
313 a cairo context
314
315 @item surface
316 a surface to be used to set the source pattern
317
318 @item x
319 User-space X coordinate for surface origin
320
321 @item y
322 User-space Y coordinate for surface origin
323
324 @end table
325
326 @end deffn
327
328 @deffn Function cairo-get-source (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-pattern-t >})
329 Gets the current source pattern for @var{cr}.
330
331 @table @var
332 @item cr
333 a cairo context
334
335 @item ret
336 the current source pattern. This object is owned by cairo. To keep a
337 reference to it, you must call @code{cairo-pattern-reference}.
338
339 @end table
340
341 @end deffn
342
343 @deffn Function cairo-set-antialias (@var{cr}@tie{}@code{<cairo-t>}) (@var{antialias}@tie{}@code{<cairo-antialias-t>})
344 Set the antialiasing mode of the rasterizer used for drawing shapes.
345 This value is a hint, and a particular backend may or may not support a
346 particular value. At the current time, no backend supports
347 @samp{CAIRO_ANTIALIAS_SUBPIXEL} when drawing shapes.
348
349 Note that this option does not affect text rendering, instead see
350 @code{cairo-font-options-set-antialias}.
351
352 @table @var
353 @item cr
354 a @code{<cairo-t>}
355
356 @item antialias
357 the new antialiasing mode
358
359 @end table
360
361 @end deffn
362
363 @deffn Function cairo-get-antialias (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-antialias-t>})
364 Gets the current shape antialiasing mode, as set by
365 @code{cairo-set-shape-antialias}.
366
367 @table @var
368 @item cr
369 a cairo context
370
371 @item ret
372 the current shape antialiasing mode.
373
374 @end table
375
376 @end deffn
377
378 @deffn Function cairo-set-dash (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{dashes}@tie{}@code{<double>}) (@var{num-dashes}@tie{}@code{<int>}) (@var{offset}@tie{}@code{<double>})
379 Sets the dash pattern to be used by @code{cairo-stroke}. A dash pattern
380 is specified by @var{dashes}, an array of positive values. Each value
381 provides the length of alternate "on" and "off" portions of the stroke.
382 The @var{offset} specifies an offset into the pattern at which the
383 stroke begins.
384
385 Each "on" segment will have caps applied as if the segment were a
386 separate sub-path. In particular, it is valid to use an "on" length of
387 0.0 with @samp{CAIRO_LINE_CAP_ROUND} or @samp{CAIRO_LINE_CAP_SQUARE} in
388 order to distributed dots or squares along a path.
389
390 Note: The length values are in user-space units as evaluated at the time
391 of stroking. This is not necessarily the same as the user space at the
392 time of @code{cairo-set-dash}.
393
394 If @var{num-dashes} is 0 dashing is disabled.
395
396 If @var{num-dashes} is 1 a symmetric pattern is assumed with alternating
397 on and off portions of the size specified by the single value in
398 @var{dashes}.
399
400 If any value in @var{dashes} is negative, or if all values are 0, then
401 @var{cr} will be put into an error state with a status of
402 @samp{CAIRO_STATUS_INVALID_DASH}.
403
404 @table @var
405 @item cr
406 a cairo context
407
408 @item dashes
409 an array specifying alternate lengths of on and off stroke portions
410
411 @item num-dashes
412 the length of the dashes array
413
414 @item offset
415 an offset into the dash pattern at which the stroke should start
416
417 @end table
418
419 @end deffn
420
421 @deffn Function cairo-get-dash-count (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<int>})
422 This function returns the length of the dash array in @var{cr} (0 if
423 dashing is not currently in effect).
424
425 See also @code{cairo-set-dash} and @code{cairo-get-dash}.
426
427 @table @var
428 @item cr
429 a @code{<cairo-t>}
430
431 @item ret
432 the length of the dash array, or 0 if no dash array set.
433
434 @end table
435
436 Since 1.4
437
438 @end deffn
439
440 @deffn Function cairo-set-fill-rule (@var{cr}@tie{}@code{<cairo-t>}) (@var{fill-rule}@tie{}@code{<cairo-fill-rule-t>})
441 Set the current fill rule within the cairo context. The fill rule is
442 used to determine which regions are inside or outside a complex
443 (potentially self-intersecting) path. The current fill rule affects both
444 @code{cairo-fill} and @code{cairo-clip}. See @code{<cairo-fill-rule-t>}
445 for details on the semantics of each available fill rule.
446
447 The default fill rule is @samp{CAIRO_FILL_RULE_WINDING}.
448
449 @table @var
450 @item cr
451 a @code{<cairo-t>}
452
453 @item fill-rule
454 a fill rule, specified as a @code{<cairo-fill-rule-t>}
455
456 @end table
457
458 @end deffn
459
460 @deffn Function cairo-get-fill-rule (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-fill-rule-t>})
461 Gets the current fill rule, as set by @code{cairo-set-fill-rule}.
462
463 @table @var
464 @item cr
465 a cairo context
466
467 @item ret
468 the current fill rule.
469
470 @end table
471
472 @end deffn
473
474 @deffn Function cairo-set-line-cap (@var{cr}@tie{}@code{<cairo-t>}) (@var{line-cap}@tie{}@code{<cairo-line-cap-t>})
475 Sets the current line cap style within the cairo context. See
476 @code{<cairo-line-cap-t>} for details about how the available line cap
477 styles are drawn.
478
479 As with the other stroke parameters, the current line cap style is
480 examined by @code{cairo-stroke}, @code{cairo-stroke-extents}, and
481 @code{cairo-stroke-to-path}, but does not have any effect during path
482 construction.
483
484 The default line cap style is @samp{CAIRO_LINE_CAP_BUTT}.
485
486 @table @var
487 @item cr
488 a cairo context
489
490 @item line-cap
491 a line cap style
492
493 @end table
494
495 @end deffn
496
497 @deffn Function cairo-get-line-cap (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-line-cap-t>})
498 Gets the current line cap style, as set by @code{cairo-set-line-cap}.
499
500 @table @var
501 @item cr
502 a cairo context
503
504 @item ret
505 the current line cap style.
506
507 @end table
508
509 @end deffn
510
511 @deffn Function cairo-set-line-join (@var{cr}@tie{}@code{<cairo-t>}) (@var{line-join}@tie{}@code{<cairo-line-join-t>})
512 Sets the current line join style within the cairo context. See
513 @code{<cairo-line-join-t>} for details about how the available line join
514 styles are drawn.
515
516 As with the other stroke parameters, the current line join style is
517 examined by @code{cairo-stroke}, @code{cairo-stroke-extents}, and
518 @code{cairo-stroke-to-path}, but does not have any effect during path
519 construction.
520
521 The default line join style is @samp{CAIRO_LINE_JOIN_MITER}.
522
523 @table @var
524 @item cr
525 a cairo context
526
527 @item line-join
528 a line join style
529
530 @end table
531
532 @end deffn
533
534 @deffn Function cairo-get-line-join (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-line-join-t>})
535 Gets the current line join style, as set by @code{cairo-set-line-join}.
536
537 @table @var
538 @item cr
539 a cairo context
540
541 @item ret
542 the current line join style.
543
544 @end table
545
546 @end deffn
547
548 @deffn Function cairo-set-line-width (@var{cr}@tie{}@code{<cairo-t>}) (@var{width}@tie{}@code{<double>})
549 Sets the current line width within the cairo context. The line width
550 value specifies the diameter of a pen that is circular in user space,
551 (though device-space pen may be an ellipse in general due to
552 scaling/shear/rotation of the CTM).
553
554 Note: When the description above refers to user space and CTM it refers
555 to the user space and CTM in effect at the time of the stroking
556 operation, not the user space and CTM in effect at the time of the call
557 to @code{cairo-set-line-width}. The simplest usage makes both of these
558 spaces identical. That is, if there is no change to the CTM between a
559 call to @code{cairo-set-line-width} and the stroking operation, then one
560 can just pass user-space values to @code{cairo-set-line-width} and
561 ignore this note.
562
563 As with the other stroke parameters, the current line width is examined
564 by @code{cairo-stroke}, @code{cairo-stroke-extents}, and
565 @code{cairo-stroke-to-path}, but does not have any effect during path
566 construction.
567
568 The default line width value is 2.0.
569
570 @table @var
571 @item cr
572 a @code{<cairo-t>}
573
574 @item width
575 a line width
576
577 @end table
578
579 @end deffn
580
581 @deffn Function cairo-get-line-width (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<double>})
582 This function returns the current line width value exactly as set by
583 @code{cairo-set-line-width}. Note that the value is unchanged even if
584 the CTM has changed between the calls to @code{cairo-set-line-width} and
585 @code{cairo-get-line-width}.
586
587 @table @var
588 @item cr
589 a cairo context
590
591 @item ret
592 the current line width.
593
594 @end table
595
596 @end deffn
597
598 @deffn Function cairo-set-miter-limit (@var{cr}@tie{}@code{<cairo-t>}) (@var{limit}@tie{}@code{<double>})
599 Sets the current miter limit within the cairo context.
600
601 If the current line join style is set to @samp{CAIRO_LINE_JOIN_MITER}
602 (see @code{cairo-set-line-join}), the miter limit is used to determine
603 whether the lines should be joined with a bevel instead of a miter.
604 Cairo divides the length of the miter by the line width. If the result
605 is greater than the miter limit, the style is converted to a bevel.
606
607 As with the other stroke parameters, the current line miter limit is
608 examined by @code{cairo-stroke}, @code{cairo-stroke-extents}, and
609 @code{cairo-stroke-to-path}, but does not have any effect during path
610 construction.
611
612 The default miter limit value is 10.0, which will convert joins with
613 interior angles less than 11 degrees to bevels instead of miters. For
614 reference, a miter limit of 2.0 makes the miter cutoff at 60 degrees,
615 and a miter limit of 1.414 makes the cutoff at 90 degrees.
616
617 A miter limit for a desired angle can be computed as: miter limit =
618 1/sin(angle/2)
619
620 @table @var
621 @item cr
622 a cairo context
623
624 @item limit
625 miter limit to set
626
627 @end table
628
629 @end deffn
630
631 @deffn Function cairo-get-miter-limit (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<double>})
632 Gets the current miter limit, as set by @code{cairo-set-miter-limit}.
633
634 @table @var
635 @item cr
636 a cairo context
637
638 @item ret
639 the current miter limit.
640
641 @end table
642
643 @end deffn
644
645 @deffn Function cairo-set-operator (@var{cr}@tie{}@code{<cairo-t>}) (@var{op}@tie{}@code{<cairo-operator-t>})
646 Sets the compositing operator to be used for all drawing operations. See
647 @code{<cairo-operator-t>} for details on the semantics of each available
648 compositing operator.
649
650 The default operator is @samp{CAIRO_OPERATOR_OVER}.
651
652 @table @var
653 @item cr
654 a @code{<cairo-t>}
655
656 @item op
657 a compositing operator, specified as a @code{<cairo-operator-t>}
658
659 @end table
660
661 @end deffn
662
663 @deffn Function cairo-get-operator (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-operator-t>})
664 Gets the current compositing operator for a cairo context.
665
666 @table @var
667 @item cr
668 a cairo context
669
670 @item ret
671 the current compositing operator.
672
673 @end table
674
675 @end deffn
676
677 @deffn Function cairo-set-tolerance (@var{cr}@tie{}@code{<cairo-t>}) (@var{tolerance}@tie{}@code{<double>})
678 Sets the tolerance used when converting paths into trapezoids. Curved
679 segments of the path will be subdivided until the maximum deviation
680 between the original path and the polygonal approximation is less than
681 @var{tolerance}. The default value is 0.1. A larger value will give
682 better performance, a smaller value, better appearance. (Reducing the
683 value from the default value of 0.1 is unlikely to improve appearance
684 significantly.) The accuracy of paths within Cairo is limited by the
685 precision of its internal arithmetic, and the prescribed @var{tolerance}
686 is restricted to the smallest representable internal value.
687
688 @table @var
689 @item cr
690 a @code{<cairo-t>}
691
692 @item tolerance
693 the tolerance, in device units (typically pixels)
694
695 @end table
696
697 @end deffn
698
699 @deffn Function cairo-get-tolerance (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<double>})
700 Gets the current tolerance value, as set by @code{cairo-set-tolerance}.
701
702 @table @var
703 @item cr
704 a cairo context
705
706 @item ret
707 the current tolerance value.
708
709 @end table
710
711 @end deffn
712
713 @deffn Function cairo-clip (@var{cr}@tie{}@code{<cairo-t>})
714 Establishes a new clip region by intersecting the current clip region
715 with the current path as it would be filled by @code{cairo-fill} and
716 according to the current fill rule (see @code{cairo-set-fill-rule}).
717
718 After @code{cairo-clip}, the current path will be cleared from the cairo
719 context.
720
721 The current clip region affects all drawing operations by effectively
722 masking out any changes to the surface that are outside the current clip
723 region.
724
725 Calling @code{cairo-clip} can only make the clip region smaller, never
726 larger. But the current clip is part of the graphics state, so a
727 temporary restriction of the clip region can be achieved by calling
728 @code{cairo-clip} within a @code{cairo-save}/@code{cairo-restore} pair.
729 The only other means of increasing the size of the clip region is
730 @code{cairo-reset-clip}.
731
732 @table @var
733 @item cr
734 a cairo context
735
736 @end table
737
738 @end deffn
739
740 @deffn Function cairo-clip-preserve (@var{cr}@tie{}@code{<cairo-t>})
741 Establishes a new clip region by intersecting the current clip region
742 with the current path as it would be filled by @code{cairo-fill} and
743 according to the current fill rule (see @code{cairo-set-fill-rule}).
744
745 Unlike @code{cairo-clip}, @code{cairo-clip-preserve} preserves the path
746 within the cairo context.
747
748 The current clip region affects all drawing operations by effectively
749 masking out any changes to the surface that are outside the current clip
750 region.
751
752 Calling @code{cairo-clip-preserve} can only make the clip region
753 smaller, never larger. But the current clip is part of the graphics
754 state, so a temporary restriction of the clip region can be achieved by
755 calling @code{cairo-clip-preserve} within a
756 @code{cairo-save}/@code{cairo-restore} pair. The only other means of
757 increasing the size of the clip region is @code{cairo-reset-clip}.
758
759 @table @var
760 @item cr
761 a cairo context
762
763 @end table
764
765 @end deffn
766
767 @deffn Function cairo-clip-extents (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{x1}@tie{}@code{<double>}) (@var{y1}@tie{}@code{<double>}) (@var{x2}@tie{}@code{<double>}) (@var{y2}@tie{}@code{<double>})
768 Computes a bounding box in user coordinates covering the area inside the
769 current clip.
770
771 @table @var
772 @item cr
773 a cairo context
774
775 @item x1
776 left of the resulting extents
777
778 @item y1
779 top of the resulting extents
780
781 @item x2
782 right of the resulting extents
783
784 @item y2
785 bottom of the resulting extents
786
787 @end table
788
789 Since 1.4
790
791 @end deffn
792
793 @deffn Function cairo-in-clip (@var{cr}@tie{}@code{<cairo-t>}) (@var{x}@tie{}@code{<double>}) (@var{y}@tie{}@code{<double>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-bool-t>})
794 Tests whether the given point is inside the area that would be visible
795 through the current clip, i.e. the area that would be filled by a
796 @code{cairo-paint} operation.
797
798 See @code{cairo-clip}, and @code{cairo-clip-preserve}.
799
800 @table @var
801 @item cr
802 a cairo context
803
804 @item x
805 X coordinate of the point to test
806
807 @item y
808 Y coordinate of the point to test
809
810 @item ret
811 A non-zero value if the point is inside, or zero if outside.
812
813 @end table
814
815 Since 1.10
816
817 @end deffn
818
819 @deffn Function cairo-reset-clip (@var{cr}@tie{}@code{<cairo-t>})
820 Reset the current clip region to its original, unrestricted state. That
821 is, set the clip region to an infinitely large shape containing the
822 target surface. Equivalently, if infinity is too hard to grasp, one can
823 imagine the clip region being reset to the exact bounds of the target
824 surface.
825
826 Note that code meant to be reusable should not call
827 @code{cairo-reset-clip} as it will cause results unexpected by
828 higher-level code which calls @code{cairo-clip}. Consider using
829 @code{cairo-save} and @code{cairo-restore} around @code{cairo-clip} as a
830 more robust means of temporarily restricting the clip region.
831
832 @table @var
833 @item cr
834 a cairo context
835
836 @end table
837
838 @end deffn
839
840 @deffn Function cairo-copy-clip-rectangle-list (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-rectangle-list-t >})
841 Gets the current clip region as a list of rectangles in user
842 coordinates. Never returns @samp{@code{#f}}.
843
844 The status in the list may be @samp{CAIRO_STATUS_CLIP_NOT_REPRESENTABLE}
845 to indicate that the clip region cannot be represented as a list of
846 user-space rectangles. The status may have other values to indicate
847 other errors.
848
849 @table @var
850 @item cr
851 a cairo context
852
853 @item ret
854 the current clip region as a list of rectangles in user coordinates,
855 which should be destroyed using @code{cairo-rectangle-list-destroy}.
856
857 @end table
858
859 Since 1.4
860
861 @end deffn
862
863 @deffn Function cairo-fill (@var{cr}@tie{}@code{<cairo-t>})
864 A drawing operator that fills the current path according to the current
865 fill rule, (each sub-path is implicitly closed before being filled).
866 After @code{cairo-fill}, the current path will be cleared from the cairo
867 context. See @code{cairo-set-fill-rule} and @code{cairo-fill-preserve}.
868
869 @table @var
870 @item cr
871 a cairo context
872
873 @end table
874
875 @end deffn
876
877 @deffn Function cairo-fill-preserve (@var{cr}@tie{}@code{<cairo-t>})
878 A drawing operator that fills the current path according to the current
879 fill rule, (each sub-path is implicitly closed before being filled).
880 Unlike @code{cairo-fill}, @code{cairo-fill-preserve} preserves the path
881 within the cairo context.
882
883 See @code{cairo-set-fill-rule} and @code{cairo-fill}.
884
885 @table @var
886 @item cr
887 a cairo context
888
889 @end table
890
891 @end deffn
892
893 @deffn Function cairo-fill-extents (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{x1}@tie{}@code{<double>}) (@var{y1}@tie{}@code{<double>}) (@var{x2}@tie{}@code{<double>}) (@var{y2}@tie{}@code{<double>})
894 Computes a bounding box in user coordinates covering the area that would
895 be affected, (the "inked" area), by a @code{cairo-fill} operation given
896 the current path and fill parameters. If the current path is empty,
897 returns an empty rectangle ((0,0), (0,0)). Surface dimensions and
898 clipping are not taken into account.
899
900 Contrast with @code{cairo-path-extents}, which is similar, but returns
901 non-zero extents for some paths with no inked area, (such as a simple
902 line segment).
903
904 Note that @code{cairo-fill-extents} must necessarily do more work to
905 compute the precise inked areas in light of the fill rule, so
906 @code{cairo-path-extents} may be more desirable for sake of performance
907 if the non-inked path extents are desired.
908
909 See @code{cairo-fill}, @code{cairo-set-fill-rule} and
910 @code{cairo-fill-preserve}.
911
912 @table @var
913 @item cr
914 a cairo context
915
916 @item x1
917 left of the resulting extents
918
919 @item y1
920 top of the resulting extents
921
922 @item x2
923 right of the resulting extents
924
925 @item y2
926 bottom of the resulting extents
927
928 @end table
929
930 @end deffn
931
932 @deffn Function cairo-in-fill (@var{cr}@tie{}@code{<cairo-t>}) (@var{x}@tie{}@code{<double>}) (@var{y}@tie{}@code{<double>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-bool-t>})
933 Tests whether the given point is inside the area that would be affected
934 by a @code{cairo-fill} operation given the current path and filling
935 parameters. Surface dimensions and clipping are not taken into account.
936
937 See @code{cairo-fill}, @code{cairo-set-fill-rule} and
938 @code{cairo-fill-preserve}.
939
940 @table @var
941 @item cr
942 a cairo context
943
944 @item x
945 X coordinate of the point to test
946
947 @item y
948 Y coordinate of the point to test
949
950 @item ret
951 A non-zero value if the point is inside, or zero if outside.
952
953 @end table
954
955 @end deffn
956
957 @deffn Function cairo-mask (@var{cr}@tie{}@code{<cairo-t>}) (@var{pattern}@tie{}@code{<cairo-pattern-t>})
958 A drawing operator that paints the current source using the alpha
959 channel of @var{pattern} as a mask. (Opaque areas of @var{pattern} are
960 painted with the source, transparent areas are not painted.)
961
962 @table @var
963 @item cr
964 a cairo context
965
966 @item pattern
967 a @code{<cairo-pattern-t>}
968
969 @end table
970
971 @end deffn
972
973 @deffn Function cairo-mask-surface (@var{cr}@tie{}@code{<cairo-t>}) (@var{surface}@tie{}@code{<cairo-surface-t>}) (@var{surface-x}@tie{}@code{<double>}) (@var{surface-y}@tie{}@code{<double>})
974 A drawing operator that paints the current source using the alpha
975 channel of @var{surface} as a mask. (Opaque areas of @var{surface} are
976 painted with the source, transparent areas are not painted.)
977
978 @table @var
979 @item cr
980 a cairo context
981
982 @item surface
983 a @code{<cairo-surface-t>}
984
985 @item surface-x
986 X coordinate at which to place the origin of @var{surface}
987
988 @item surface-y
989 Y coordinate at which to place the origin of @var{surface}
990
991 @end table
992
993 @end deffn
994
995 @deffn Function cairo-paint (@var{cr}@tie{}@code{<cairo-t>})
996 A drawing operator that paints the current source everywhere within the
997 current clip region.
998
999 @table @var
1000 @item cr
1001 a cairo context
1002
1003 @end table
1004
1005 @end deffn
1006
1007 @deffn Function cairo-paint-with-alpha (@var{cr}@tie{}@code{<cairo-t>}) (@var{alpha}@tie{}@code{<double>})
1008 A drawing operator that paints the current source everywhere within the
1009 current clip region using a mask of constant alpha value @var{alpha}.
1010 The effect is similar to @code{cairo-paint}, but the drawing is faded
1011 out using the alpha value.
1012
1013 @table @var
1014 @item cr
1015 a cairo context
1016
1017 @item alpha
1018 alpha value, between 0 (transparent) and 1 (opaque)
1019
1020 @end table
1021
1022 @end deffn
1023
1024 @deffn Function cairo-stroke (@var{cr}@tie{}@code{<cairo-t>})
1025 A drawing operator that strokes the current path according to the
1026 current line width, line join, line cap, and dash settings. After
1027 @code{cairo-stroke}, the current path will be cleared from the cairo
1028 context. See @code{cairo-set-line-width}, @code{cairo-set-line-join},
1029 @code{cairo-set-line-cap}, @code{cairo-set-dash}, and
1030 @code{cairo-stroke-preserve}.
1031
1032 Note: Degenerate segments and sub-paths are treated specially and
1033 provide a useful result. These can result in two different situations:
1034
1035 1. Zero-length "on" segments set in @code{cairo-set-dash}. If the cap
1036 style is @samp{CAIRO_LINE_CAP_ROUND} or @samp{CAIRO_LINE_CAP_SQUARE}
1037 then these segments will be drawn as circular dots or squares
1038 respectively. In the case of @samp{CAIRO_LINE_CAP_SQUARE}, the
1039 orientation of the squares is determined by the direction of the
1040 underlying path.
1041
1042 2. A sub-path created by @code{cairo-move-to} followed by either a
1043 @code{cairo-close-path} or one or more calls to @code{cairo-line-to} to
1044 the same coordinate as the @code{cairo-move-to}. If the cap style is
1045 @samp{CAIRO_LINE_CAP_ROUND} then these sub-paths will be drawn as
1046 circular dots. Note that in the case of @samp{CAIRO_LINE_CAP_SQUARE} a
1047 degenerate sub-path will not be drawn at all, (since the correct
1048 orientation is indeterminate).
1049
1050 In no case will a cap style of @samp{CAIRO_LINE_CAP_BUTT} cause anything
1051 to be drawn in the case of either degenerate segments or sub-paths.
1052
1053 @table @var
1054 @item cr
1055 a cairo context
1056
1057 @end table
1058
1059 @end deffn
1060
1061 @deffn Function cairo-stroke-preserve (@var{cr}@tie{}@code{<cairo-t>})
1062 A drawing operator that strokes the current path according to the
1063 current line width, line join, line cap, and dash settings. Unlike
1064 @code{cairo-stroke}, @code{cairo-stroke-preserve} preserves the path
1065 within the cairo context.
1066
1067 See @code{cairo-set-line-width}, @code{cairo-set-line-join},
1068 @code{cairo-set-line-cap}, @code{cairo-set-dash}, and
1069 @code{cairo-stroke-preserve}.
1070
1071 @table @var
1072 @item cr
1073 a cairo context
1074
1075 @end table
1076
1077 @end deffn
1078
1079 @deffn Function cairo-stroke-extents (@var{cr}@tie{}@code{<cairo-t>}) @result{}@tie{} (@var{x1}@tie{}@code{<double>}) (@var{y1}@tie{}@code{<double>}) (@var{x2}@tie{}@code{<double>}) (@var{y2}@tie{}@code{<double>})
1080 Computes a bounding box in user coordinates covering the area that would
1081 be affected, (the "inked" area), by a @code{cairo-stroke} operation
1082 given the current path and stroke parameters. If the current path is
1083 empty, returns an empty rectangle ((0,0), (0,0)). Surface dimensions and
1084 clipping are not taken into account.
1085
1086 Note that if the line width is set to exactly zero, then
1087 @code{cairo-stroke-extents} will return an empty rectangle. Contrast
1088 with @code{cairo-path-extents} which can be used to compute the
1089 non-empty bounds as the line width approaches zero.
1090
1091 Note that @code{cairo-stroke-extents} must necessarily do more work to
1092 compute the precise inked areas in light of the stroke parameters, so
1093 @code{cairo-path-extents} may be more desirable for sake of performance
1094 if non-inked path extents are desired.
1095
1096 See @code{cairo-stroke}, @code{cairo-set-line-width},
1097 @code{cairo-set-line-join}, @code{cairo-set-line-cap},
1098 @code{cairo-set-dash}, and @code{cairo-stroke-preserve}.
1099
1100 @table @var
1101 @item cr
1102 a cairo context
1103
1104 @item x1
1105 left of the resulting extents
1106
1107 @item y1
1108 top of the resulting extents
1109
1110 @item x2
1111 right of the resulting extents
1112
1113 @item y2
1114 bottom of the resulting extents
1115
1116 @end table
1117
1118 @end deffn
1119
1120 @deffn Function cairo-in-stroke (@var{cr}@tie{}@code{<cairo-t>}) (@var{x}@tie{}@code{<double>}) (@var{y}@tie{}@code{<double>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-bool-t>})
1121 Tests whether the given point is inside the area that would be affected
1122 by a @code{cairo-stroke} operation given the current path and stroking
1123 parameters. Surface dimensions and clipping are not taken into account.
1124
1125 See @code{cairo-stroke}, @code{cairo-set-line-width},
1126 @code{cairo-set-line-join}, @code{cairo-set-line-cap},
1127 @code{cairo-set-dash}, and @code{cairo-stroke-preserve}.
1128
1129 @table @var
1130 @item cr
1131 a cairo context
1132
1133 @item x
1134 X coordinate of the point to test
1135
1136 @item y
1137 Y coordinate of the point to test
1138
1139 @item ret
1140 A non-zero value if the point is inside, or zero if outside.
1141
1142 @end table
1143
1144 @end deffn
1145
1146 @deffn Function cairo-copy-page (@var{cr}@tie{}@code{<cairo-t>})
1147 Emits the current page for backends that support multiple pages, but
1148 doesn't clear it, so, the contents of the current page will be retained
1149 for the next page too. Use @code{cairo-show-page} if you want to get an
1150 empty page after the emission.
1151
1152 This is a convenience function that simply calls
1153 @code{cairo-surface-copy-page} on @var{cr}'s target.
1154
1155 @table @var
1156 @item cr
1157 a cairo context
1158
1159 @end table
1160
1161 @end deffn
1162
1163 @deffn Function cairo-show-page (@var{cr}@tie{}@code{<cairo-t>})
1164 Emits and clears the current page for backends that support multiple
1165 pages. Use @code{cairo-copy-page} if you don't want to clear the page.
1166
1167 This is a convenience function that simply calls
1168 @code{cairo-surface-show-page} on @var{cr}'s target.
1169
1170 @table @var
1171 @item cr
1172 a cairo context
1173
1174 @end table
1175
1176 @end deffn
1177
1178
1179 @c %end of fragment