@c %start of fragment @deffn Function cairo-create (@var{target} @code{}) @result{} (@var{ret} @code{}) Creates a new @code{} with all graphics state parameters set to default values and with @var{target} as a target surface. The target surface should be constructed with a backend-specific function such as @code{cairo-image-surface-create} (or any other @samp{cairo__surface_create} variant). @table @var @item target target surface for the context @item ret a newly allocated @code{}. @end table @end deffn @deffn Function cairo-save (@var{cr}@tie{}@code{}) Makes a copy of the current state of @var{cr} and saves it on an internal stack of saved states for @var{cr}. When @code{cairo-restore} is called, @var{cr} will be restored to the saved state. Multiple calls to @code{cairo-save} and @code{cairo-restore} can be nested; each call to @code{cairo-restore} restores the state from the matching paired @code{cairo-save}. It isn't necessary to clear all saved states before a @code{} is freed. If the reference count of a @code{} drops to zero in response to a call to @code{cairo-destroy}, any saved states will be freed along with the @code{}. @table @var @item cr a @code{} @end table @end deffn @deffn Function cairo-restore (@var{cr}@tie{}@code{}) Restores @var{cr} to the state saved by a preceding call to @code{cairo-save} and removes that state from the stack of saved states. @table @var @item cr a @code{} @end table @end deffn @deffn Function cairo-get-target (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Gets the target surface for the cairo context as passed to @code{cairo-create}. This function will always return a valid pointer, but the result can be a "nil" surface if @var{cr} is already in an error state, (ie. @code{cairo-status}@samp{!=}@samp{CAIRO_STATUS_SUCCESS}). A nil surface is indicated by @code{cairo-surface-status}@samp{!=}@samp{CAIRO_STATUS_SUCCESS}. @table @var @item cr a cairo context @item ret the target surface. This object is owned by cairo. To keep a reference to it, you must call @code{cairo-surface-reference}. @end table @end deffn @deffn Function cairo-push-group (@var{cr}@tie{}@code{}) Temporarily redirects drawing to an intermediate surface known as a group. The redirection lasts until the group is completed by a call to @code{cairo-pop-group} or @code{cairo-pop-group-to-source}. These calls provide the result of any drawing to the group as a pattern, (either as an explicit object, or set as the source pattern). This group functionality can be convenient for performing intermediate compositing. One common use of a group is to render objects as opaque within the group, (so that they occlude each other), and then blend the result with translucence onto the destination. Groups can be nested arbitrarily deep by making balanced calls to @code{cairo-push-group}/@code{cairo-pop-group}. Each call pushes/pops the new target group onto/from a stack. The @code{cairo-push-group} function calls @code{cairo-save} so that any changes to the graphics state will not be visible outside the group, (the pop_group functions call @code{cairo-restore}). By default the intermediate group will have a content type of @samp{CAIRO_CONTENT_COLOR_ALPHA}. Other content types can be chosen for the group by using @code{cairo-push-group-with-content} instead. As an example, here is how one might fill and stroke a path with translucence, but without any portion of the fill being visible under the stroke: @example cairo_push_group (cr); cairo_set_source (cr, fill_pattern); cairo_fill_preserve (cr); cairo_set_source (cr, stroke_pattern); cairo_stroke (cr); cairo_pop_group_to_source (cr); cairo_paint_with_alpha (cr, alpha); @end example @table @var @item cr a cairo context @end table Since 1.2 @end deffn @deffn Function cairo-pop-group (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Terminates the redirection begun by a call to @code{cairo-push-group} or @code{cairo-push-group-with-content} and returns a new pattern containing the results of all drawing operations performed to the group. The @code{cairo-pop-group} function calls @code{cairo-restore}, (balancing a call to @code{cairo-save} by the push_group function), so that any changes to the graphics state will not be visible outside the group. @table @var @item cr a cairo context @item ret a newly created (surface) pattern containing the results of all drawing operations performed to the group. The caller owns the returned object and should call @code{cairo-pattern-destroy} when finished with it. @end table Since 1.2 @end deffn @deffn Function cairo-pop-group-to-source (@var{cr}@tie{}@code{}) Terminates the redirection begun by a call to @code{cairo-push-group} or @code{cairo-push-group-with-content} and installs the resulting pattern as the source pattern in the given cairo context. The behavior of this function is equivalent to the sequence of operations: @example cairo_pattern_t *group = cairo_pop_group (cr); cairo_set_source (cr, group); cairo_pattern_destroy (group); @end example but is more convenient as their is no need for a variable to store the short-lived pointer to the pattern. The @code{cairo-pop-group} function calls @code{cairo-restore}, (balancing a call to @code{cairo-save} by the push_group function), so that any changes to the graphics state will not be visible outside the group. @table @var @item cr a cairo context @end table Since 1.2 @end deffn @deffn Function cairo-get-group-target (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Gets the current destination surface for the context. This is either the original target surface as passed to @code{cairo-create} or the target surface for the current group as started by the most recent call to @code{cairo-push-group} or @code{cairo-push-group-with-content}. This function will always return a valid pointer, but the result can be a "nil" surface if @var{cr} is already in an error state, (ie. @code{cairo-status}@samp{!=}@samp{CAIRO_STATUS_SUCCESS}). A nil surface is indicated by @code{cairo-surface-status}@samp{!=}@samp{CAIRO_STATUS_SUCCESS}. @table @var @item cr a cairo context @item ret the target surface. This object is owned by cairo. To keep a reference to it, you must call @code{cairo-surface-reference}. @end table Since 1.2 @end deffn @deffn Function cairo-set-source-rgb (@var{cr}@tie{}@code{}) (@var{red}@tie{}@code{}) (@var{green}@tie{}@code{}) (@var{blue}@tie{}@code{}) Sets the source pattern within @var{cr} to an opaque color. This opaque color will then be used for any subsequent drawing operation until a new source pattern is set. The color components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped. The default source pattern is opaque black, (that is, it is equivalent to cairo_set_source_rgb(cr, 0.0, 0.0, 0.0)). @table @var @item cr a cairo context @item red red component of color @item green green component of color @item blue blue component of color @end table @end deffn @deffn Function cairo-set-source-rgba (@var{cr}@tie{}@code{}) (@var{red}@tie{}@code{}) (@var{green}@tie{}@code{}) (@var{blue}@tie{}@code{}) (@var{alpha}@tie{}@code{}) Sets the source pattern within @var{cr} to a translucent color. This color will then be used for any subsequent drawing operation until a new source pattern is set. The color and alpha components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped. The default source pattern is opaque black, (that is, it is equivalent to cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 1.0)). @table @var @item cr a cairo context @item red red component of color @item green green component of color @item blue blue component of color @item alpha alpha component of color @end table @end deffn @deffn Function cairo-set-source (@var{cr}@tie{}@code{}) (@var{source}@tie{}@code{}) Sets the source pattern within @var{cr} to @var{source}. This pattern will then be used for any subsequent drawing operation until a new source pattern is set. Note: The pattern's transformation matrix will be locked to the user space in effect at the time of @code{cairo-set-source}. This means that further modifications of the current transformation matrix will not affect the source pattern. See @code{cairo-pattern-set-matrix}. The default source pattern is a solid pattern that is opaque black, (that is, it is equivalent to cairo_set_source_rgb(cr, 0.0, 0.0, 0.0)). @table @var @item cr a cairo context @item source a @code{} to be used as the source for subsequent drawing operations. @end table @end deffn @deffn Function cairo-set-source-surface (@var{cr}@tie{}@code{}) (@var{surface}@tie{}@code{}) (@var{x}@tie{}@code{}) (@var{y}@tie{}@code{}) This is a convenience function for creating a pattern from @var{surface} and setting it as the source in @var{cr} with @code{cairo-set-source}. The @var{x} and @var{y} parameters give the user-space coordinate at which the surface origin should appear. (The surface origin is its upper-left corner before any transformation has been applied.) The @var{x} and @var{y} parameters are negated and then set as translation values in the pattern matrix. Other than the initial translation pattern matrix, as described above, all other pattern attributes, (such as its extend mode), are set to the default values as in @code{cairo-pattern-create-for-surface}. The resulting pattern can be queried with @code{cairo-get-source} so that these attributes can be modified if desired, (eg. to create a repeating pattern with @code{cairo-pattern-set-extend}). @table @var @item cr a cairo context @item surface a surface to be used to set the source pattern @item x User-space X coordinate for surface origin @item y User-space Y coordinate for surface origin @end table @end deffn @deffn Function cairo-get-source (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Gets the current source pattern for @var{cr}. @table @var @item cr a cairo context @item ret the current source pattern. This object is owned by cairo. To keep a reference to it, you must call @code{cairo-pattern-reference}. @end table @end deffn @deffn Function cairo-set-antialias (@var{cr}@tie{}@code{}) (@var{antialias}@tie{}@code{}) Set the antialiasing mode of the rasterizer used for drawing shapes. This value is a hint, and a particular backend may or may not support a particular value. At the current time, no backend supports @samp{CAIRO_ANTIALIAS_SUBPIXEL} when drawing shapes. Note that this option does not affect text rendering, instead see @code{cairo-font-options-set-antialias}. @table @var @item cr a @code{} @item antialias the new antialiasing mode @end table @end deffn @deffn Function cairo-get-antialias (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Gets the current shape antialiasing mode, as set by @code{cairo-set-shape-antialias}. @table @var @item cr a cairo context @item ret the current shape antialiasing mode. @end table @end deffn @deffn Function cairo-set-dash (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{dashes}@tie{}@code{}) (@var{num-dashes}@tie{}@code{}) (@var{offset}@tie{}@code{}) Sets the dash pattern to be used by @code{cairo-stroke}. A dash pattern is specified by @var{dashes}, an array of positive values. Each value provides the length of alternate "on" and "off" portions of the stroke. The @var{offset} specifies an offset into the pattern at which the stroke begins. Each "on" segment will have caps applied as if the segment were a separate sub-path. In particular, it is valid to use an "on" length of 0.0 with @samp{CAIRO_LINE_CAP_ROUND} or @samp{CAIRO_LINE_CAP_SQUARE} in order to distributed dots or squares along a path. Note: The length values are in user-space units as evaluated at the time of stroking. This is not necessarily the same as the user space at the time of @code{cairo-set-dash}. If @var{num-dashes} is 0 dashing is disabled. If @var{num-dashes} is 1 a symmetric pattern is assumed with alternating on and off portions of the size specified by the single value in @var{dashes}. If any value in @var{dashes} is negative, or if all values are 0, then @var{cr} will be put into an error state with a status of @samp{CAIRO_STATUS_INVALID_DASH}. @table @var @item cr a cairo context @item dashes an array specifying alternate lengths of on and off stroke portions @item num-dashes the length of the dashes array @item offset an offset into the dash pattern at which the stroke should start @end table @end deffn @deffn Function cairo-get-dash-count (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) This function returns the length of the dash array in @var{cr} (0 if dashing is not currently in effect). See also @code{cairo-set-dash} and @code{cairo-get-dash}. @table @var @item cr a @code{} @item ret the length of the dash array, or 0 if no dash array set. @end table Since 1.4 @end deffn @deffn Function cairo-set-fill-rule (@var{cr}@tie{}@code{}) (@var{fill-rule}@tie{}@code{}) Set the current fill rule within the cairo context. The fill rule is used to determine which regions are inside or outside a complex (potentially self-intersecting) path. The current fill rule affects both @code{cairo-fill} and @code{cairo-clip}. See @code{} for details on the semantics of each available fill rule. The default fill rule is @samp{CAIRO_FILL_RULE_WINDING}. @table @var @item cr a @code{} @item fill-rule a fill rule, specified as a @code{} @end table @end deffn @deffn Function cairo-get-fill-rule (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Gets the current fill rule, as set by @code{cairo-set-fill-rule}. @table @var @item cr a cairo context @item ret the current fill rule. @end table @end deffn @deffn Function cairo-set-line-cap (@var{cr}@tie{}@code{}) (@var{line-cap}@tie{}@code{}) Sets the current line cap style within the cairo context. See @code{} for details about how the available line cap styles are drawn. As with the other stroke parameters, the current line cap style is examined by @code{cairo-stroke}, @code{cairo-stroke-extents}, and @code{cairo-stroke-to-path}, but does not have any effect during path construction. The default line cap style is @samp{CAIRO_LINE_CAP_BUTT}. @table @var @item cr a cairo context @item line-cap a line cap style @end table @end deffn @deffn Function cairo-get-line-cap (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Gets the current line cap style, as set by @code{cairo-set-line-cap}. @table @var @item cr a cairo context @item ret the current line cap style. @end table @end deffn @deffn Function cairo-set-line-join (@var{cr}@tie{}@code{}) (@var{line-join}@tie{}@code{}) Sets the current line join style within the cairo context. See @code{} for details about how the available line join styles are drawn. As with the other stroke parameters, the current line join style is examined by @code{cairo-stroke}, @code{cairo-stroke-extents}, and @code{cairo-stroke-to-path}, but does not have any effect during path construction. The default line join style is @samp{CAIRO_LINE_JOIN_MITER}. @table @var @item cr a cairo context @item line-join a line join style @end table @end deffn @deffn Function cairo-get-line-join (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Gets the current line join style, as set by @code{cairo-set-line-join}. @table @var @item cr a cairo context @item ret the current line join style. @end table @end deffn @deffn Function cairo-set-line-width (@var{cr}@tie{}@code{}) (@var{width}@tie{}@code{}) Sets the current line width within the cairo context. The line width value specifies the diameter of a pen that is circular in user space, (though device-space pen may be an ellipse in general due to scaling/shear/rotation of the CTM). Note: When the description above refers to user space and CTM it refers to the user space and CTM in effect at the time of the stroking operation, not the user space and CTM in effect at the time of the call to @code{cairo-set-line-width}. The simplest usage makes both of these spaces identical. That is, if there is no change to the CTM between a call to @code{cairo-set-line-width} and the stroking operation, then one can just pass user-space values to @code{cairo-set-line-width} and ignore this note. As with the other stroke parameters, the current line width is examined by @code{cairo-stroke}, @code{cairo-stroke-extents}, and @code{cairo-stroke-to-path}, but does not have any effect during path construction. The default line width value is 2.0. @table @var @item cr a @code{} @item width a line width @end table @end deffn @deffn Function cairo-get-line-width (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) This function returns the current line width value exactly as set by @code{cairo-set-line-width}. Note that the value is unchanged even if the CTM has changed between the calls to @code{cairo-set-line-width} and @code{cairo-get-line-width}. @table @var @item cr a cairo context @item ret the current line width. @end table @end deffn @deffn Function cairo-set-miter-limit (@var{cr}@tie{}@code{}) (@var{limit}@tie{}@code{}) Sets the current miter limit within the cairo context. If the current line join style is set to @samp{CAIRO_LINE_JOIN_MITER} (see @code{cairo-set-line-join}), the miter limit is used to determine whether the lines should be joined with a bevel instead of a miter. Cairo divides the length of the miter by the line width. If the result is greater than the miter limit, the style is converted to a bevel. As with the other stroke parameters, the current line miter limit is examined by @code{cairo-stroke}, @code{cairo-stroke-extents}, and @code{cairo-stroke-to-path}, but does not have any effect during path construction. The default miter limit value is 10.0, which will convert joins with interior angles less than 11 degrees to bevels instead of miters. For reference, a miter limit of 2.0 makes the miter cutoff at 60 degrees, and a miter limit of 1.414 makes the cutoff at 90 degrees. A miter limit for a desired angle can be computed as: miter limit = 1/sin(angle/2) @table @var @item cr a cairo context @item limit miter limit to set @end table @end deffn @deffn Function cairo-get-miter-limit (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Gets the current miter limit, as set by @code{cairo-set-miter-limit}. @table @var @item cr a cairo context @item ret the current miter limit. @end table @end deffn @deffn Function cairo-set-operator (@var{cr}@tie{}@code{}) (@var{op}@tie{}@code{}) Sets the compositing operator to be used for all drawing operations. See @code{} for details on the semantics of each available compositing operator. The default operator is @samp{CAIRO_OPERATOR_OVER}. @table @var @item cr a @code{} @item op a compositing operator, specified as a @code{} @end table @end deffn @deffn Function cairo-get-operator (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Gets the current compositing operator for a cairo context. @table @var @item cr a cairo context @item ret the current compositing operator. @end table @end deffn @deffn Function cairo-set-tolerance (@var{cr}@tie{}@code{}) (@var{tolerance}@tie{}@code{}) Sets the tolerance used when converting paths into trapezoids. Curved segments of the path will be subdivided until the maximum deviation between the original path and the polygonal approximation is less than @var{tolerance}. The default value is 0.1. A larger value will give better performance, a smaller value, better appearance. (Reducing the value from the default value of 0.1 is unlikely to improve appearance significantly.) The accuracy of paths within Cairo is limited by the precision of its internal arithmetic, and the prescribed @var{tolerance} is restricted to the smallest representable internal value. @table @var @item cr a @code{} @item tolerance the tolerance, in device units (typically pixels) @end table @end deffn @deffn Function cairo-get-tolerance (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Gets the current tolerance value, as set by @code{cairo-set-tolerance}. @table @var @item cr a cairo context @item ret the current tolerance value. @end table @end deffn @deffn Function cairo-clip (@var{cr}@tie{}@code{}) Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by @code{cairo-fill} and according to the current fill rule (see @code{cairo-set-fill-rule}). After @code{cairo-clip}, the current path will be cleared from the cairo context. The current clip region affects all drawing operations by effectively masking out any changes to the surface that are outside the current clip region. Calling @code{cairo-clip} can only make the clip region smaller, never larger. But the current clip is part of the graphics state, so a temporary restriction of the clip region can be achieved by calling @code{cairo-clip} within a @code{cairo-save}/@code{cairo-restore} pair. The only other means of increasing the size of the clip region is @code{cairo-reset-clip}. @table @var @item cr a cairo context @end table @end deffn @deffn Function cairo-clip-preserve (@var{cr}@tie{}@code{}) Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by @code{cairo-fill} and according to the current fill rule (see @code{cairo-set-fill-rule}). Unlike @code{cairo-clip}, @code{cairo-clip-preserve} preserves the path within the cairo context. The current clip region affects all drawing operations by effectively masking out any changes to the surface that are outside the current clip region. Calling @code{cairo-clip-preserve} can only make the clip region smaller, never larger. But the current clip is part of the graphics state, so a temporary restriction of the clip region can be achieved by calling @code{cairo-clip-preserve} within a @code{cairo-save}/@code{cairo-restore} pair. The only other means of increasing the size of the clip region is @code{cairo-reset-clip}. @table @var @item cr a cairo context @end table @end deffn @deffn Function cairo-clip-extents (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{x1}@tie{}@code{}) (@var{y1}@tie{}@code{}) (@var{x2}@tie{}@code{}) (@var{y2}@tie{}@code{}) Computes a bounding box in user coordinates covering the area inside the current clip. @table @var @item cr a cairo context @item x1 left of the resulting extents @item y1 top of the resulting extents @item x2 right of the resulting extents @item y2 bottom of the resulting extents @end table Since 1.4 @end deffn @deffn Function cairo-in-clip (@var{cr}@tie{}@code{}) (@var{x}@tie{}@code{}) (@var{y}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Tests whether the given point is inside the area that would be visible through the current clip, i.e. the area that would be filled by a @code{cairo-paint} operation. See @code{cairo-clip}, and @code{cairo-clip-preserve}. @table @var @item cr a cairo context @item x X coordinate of the point to test @item y Y coordinate of the point to test @item ret A non-zero value if the point is inside, or zero if outside. @end table Since 1.10 @end deffn @deffn Function cairo-reset-clip (@var{cr}@tie{}@code{}) Reset the current clip region to its original, unrestricted state. That is, set the clip region to an infinitely large shape containing the target surface. Equivalently, if infinity is too hard to grasp, one can imagine the clip region being reset to the exact bounds of the target surface. Note that code meant to be reusable should not call @code{cairo-reset-clip} as it will cause results unexpected by higher-level code which calls @code{cairo-clip}. Consider using @code{cairo-save} and @code{cairo-restore} around @code{cairo-clip} as a more robust means of temporarily restricting the clip region. @table @var @item cr a cairo context @end table @end deffn @deffn Function cairo-copy-clip-rectangle-list (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Gets the current clip region as a list of rectangles in user coordinates. Never returns @samp{@code{#f}}. The status in the list may be @samp{CAIRO_STATUS_CLIP_NOT_REPRESENTABLE} to indicate that the clip region cannot be represented as a list of user-space rectangles. The status may have other values to indicate other errors. @table @var @item cr a cairo context @item ret the current clip region as a list of rectangles in user coordinates, which should be destroyed using @code{cairo-rectangle-list-destroy}. @end table Since 1.4 @end deffn @deffn Function cairo-fill (@var{cr}@tie{}@code{}) A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled). After @code{cairo-fill}, the current path will be cleared from the cairo context. See @code{cairo-set-fill-rule} and @code{cairo-fill-preserve}. @table @var @item cr a cairo context @end table @end deffn @deffn Function cairo-fill-preserve (@var{cr}@tie{}@code{}) A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled). Unlike @code{cairo-fill}, @code{cairo-fill-preserve} preserves the path within the cairo context. See @code{cairo-set-fill-rule} and @code{cairo-fill}. @table @var @item cr a cairo context @end table @end deffn @deffn Function cairo-fill-extents (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{x1}@tie{}@code{}) (@var{y1}@tie{}@code{}) (@var{x2}@tie{}@code{}) (@var{y2}@tie{}@code{}) Computes a bounding box in user coordinates covering the area that would be affected, (the "inked" area), by a @code{cairo-fill} operation given the current path and fill parameters. If the current path is empty, returns an empty rectangle ((0,0), (0,0)). Surface dimensions and clipping are not taken into account. Contrast with @code{cairo-path-extents}, which is similar, but returns non-zero extents for some paths with no inked area, (such as a simple line segment). Note that @code{cairo-fill-extents} must necessarily do more work to compute the precise inked areas in light of the fill rule, so @code{cairo-path-extents} may be more desirable for sake of performance if the non-inked path extents are desired. See @code{cairo-fill}, @code{cairo-set-fill-rule} and @code{cairo-fill-preserve}. @table @var @item cr a cairo context @item x1 left of the resulting extents @item y1 top of the resulting extents @item x2 right of the resulting extents @item y2 bottom of the resulting extents @end table @end deffn @deffn Function cairo-in-fill (@var{cr}@tie{}@code{}) (@var{x}@tie{}@code{}) (@var{y}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Tests whether the given point is inside the area that would be affected by a @code{cairo-fill} operation given the current path and filling parameters. Surface dimensions and clipping are not taken into account. See @code{cairo-fill}, @code{cairo-set-fill-rule} and @code{cairo-fill-preserve}. @table @var @item cr a cairo context @item x X coordinate of the point to test @item y Y coordinate of the point to test @item ret A non-zero value if the point is inside, or zero if outside. @end table @end deffn @deffn Function cairo-mask (@var{cr}@tie{}@code{}) (@var{pattern}@tie{}@code{}) A drawing operator that paints the current source using the alpha channel of @var{pattern} as a mask. (Opaque areas of @var{pattern} are painted with the source, transparent areas are not painted.) @table @var @item cr a cairo context @item pattern a @code{} @end table @end deffn @deffn Function cairo-mask-surface (@var{cr}@tie{}@code{}) (@var{surface}@tie{}@code{}) (@var{surface-x}@tie{}@code{}) (@var{surface-y}@tie{}@code{}) A drawing operator that paints the current source using the alpha channel of @var{surface} as a mask. (Opaque areas of @var{surface} are painted with the source, transparent areas are not painted.) @table @var @item cr a cairo context @item surface a @code{} @item surface-x X coordinate at which to place the origin of @var{surface} @item surface-y Y coordinate at which to place the origin of @var{surface} @end table @end deffn @deffn Function cairo-paint (@var{cr}@tie{}@code{}) A drawing operator that paints the current source everywhere within the current clip region. @table @var @item cr a cairo context @end table @end deffn @deffn Function cairo-paint-with-alpha (@var{cr}@tie{}@code{}) (@var{alpha}@tie{}@code{}) A drawing operator that paints the current source everywhere within the current clip region using a mask of constant alpha value @var{alpha}. The effect is similar to @code{cairo-paint}, but the drawing is faded out using the alpha value. @table @var @item cr a cairo context @item alpha alpha value, between 0 (transparent) and 1 (opaque) @end table @end deffn @deffn Function cairo-stroke (@var{cr}@tie{}@code{}) A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. After @code{cairo-stroke}, the current path will be cleared from the cairo context. See @code{cairo-set-line-width}, @code{cairo-set-line-join}, @code{cairo-set-line-cap}, @code{cairo-set-dash}, and @code{cairo-stroke-preserve}. Note: Degenerate segments and sub-paths are treated specially and provide a useful result. These can result in two different situations: 1. Zero-length "on" segments set in @code{cairo-set-dash}. If the cap style is @samp{CAIRO_LINE_CAP_ROUND} or @samp{CAIRO_LINE_CAP_SQUARE} then these segments will be drawn as circular dots or squares respectively. In the case of @samp{CAIRO_LINE_CAP_SQUARE}, the orientation of the squares is determined by the direction of the underlying path. 2. A sub-path created by @code{cairo-move-to} followed by either a @code{cairo-close-path} or one or more calls to @code{cairo-line-to} to the same coordinate as the @code{cairo-move-to}. If the cap style is @samp{CAIRO_LINE_CAP_ROUND} then these sub-paths will be drawn as circular dots. Note that in the case of @samp{CAIRO_LINE_CAP_SQUARE} a degenerate sub-path will not be drawn at all, (since the correct orientation is indeterminate). In no case will a cap style of @samp{CAIRO_LINE_CAP_BUTT} cause anything to be drawn in the case of either degenerate segments or sub-paths. @table @var @item cr a cairo context @end table @end deffn @deffn Function cairo-stroke-preserve (@var{cr}@tie{}@code{}) A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. Unlike @code{cairo-stroke}, @code{cairo-stroke-preserve} preserves the path within the cairo context. See @code{cairo-set-line-width}, @code{cairo-set-line-join}, @code{cairo-set-line-cap}, @code{cairo-set-dash}, and @code{cairo-stroke-preserve}. @table @var @item cr a cairo context @end table @end deffn @deffn Function cairo-stroke-extents (@var{cr}@tie{}@code{}) @result{}@tie{} (@var{x1}@tie{}@code{}) (@var{y1}@tie{}@code{}) (@var{x2}@tie{}@code{}) (@var{y2}@tie{}@code{}) Computes a bounding box in user coordinates covering the area that would be affected, (the "inked" area), by a @code{cairo-stroke} operation given the current path and stroke parameters. If the current path is empty, returns an empty rectangle ((0,0), (0,0)). Surface dimensions and clipping are not taken into account. Note that if the line width is set to exactly zero, then @code{cairo-stroke-extents} will return an empty rectangle. Contrast with @code{cairo-path-extents} which can be used to compute the non-empty bounds as the line width approaches zero. Note that @code{cairo-stroke-extents} must necessarily do more work to compute the precise inked areas in light of the stroke parameters, so @code{cairo-path-extents} may be more desirable for sake of performance if non-inked path extents are desired. See @code{cairo-stroke}, @code{cairo-set-line-width}, @code{cairo-set-line-join}, @code{cairo-set-line-cap}, @code{cairo-set-dash}, and @code{cairo-stroke-preserve}. @table @var @item cr a cairo context @item x1 left of the resulting extents @item y1 top of the resulting extents @item x2 right of the resulting extents @item y2 bottom of the resulting extents @end table @end deffn @deffn Function cairo-in-stroke (@var{cr}@tie{}@code{}) (@var{x}@tie{}@code{}) (@var{y}@tie{}@code{}) @result{}@tie{} (@var{ret}@tie{}@code{}) Tests whether the given point is inside the area that would be affected by a @code{cairo-stroke} operation given the current path and stroking parameters. Surface dimensions and clipping are not taken into account. See @code{cairo-stroke}, @code{cairo-set-line-width}, @code{cairo-set-line-join}, @code{cairo-set-line-cap}, @code{cairo-set-dash}, and @code{cairo-stroke-preserve}. @table @var @item cr a cairo context @item x X coordinate of the point to test @item y Y coordinate of the point to test @item ret A non-zero value if the point is inside, or zero if outside. @end table @end deffn @deffn Function cairo-copy-page (@var{cr}@tie{}@code{}) Emits the current page for backends that support multiple pages, but doesn't clear it, so, the contents of the current page will be retained for the next page too. Use @code{cairo-show-page} if you want to get an empty page after the emission. This is a convenience function that simply calls @code{cairo-surface-copy-page} on @var{cr}'s target. @table @var @item cr a cairo context @end table @end deffn @deffn Function cairo-show-page (@var{cr}@tie{}@code{}) Emits and clears the current page for backends that support multiple pages. Use @code{cairo-copy-page} if you don't want to clear the page. This is a convenience function that simply calls @code{cairo-surface-show-page} on @var{cr}'s target. @table @var @item cr a cairo context @end table @end deffn @c %end of fragment