📄 cairo.c
字号:
voidcairo_stroke_preserve (cairo_t *cr){ if (cr->status) return; cr->status = _cairo_gstate_stroke (cr->gstate, &cr->path); if (cr->status) _cairo_set_error (cr, cr->status);}slim_hidden_def(cairo_stroke_preserve);/** * cairo_fill: * @cr: a cairo context * * A drawing operator that fills the current path according to the * current fill rule, (each sub-path is implicitly closed before being * filled). After cairo_fill, the current path will be cleared from * the cairo context. See cairo_set_fill_rule() and * cairo_fill_preserve(). **/voidcairo_fill (cairo_t *cr){ cairo_fill_preserve (cr); cairo_new_path (cr);}/** * cairo_fill_preserve: * @cr: a cairo context * * A drawing operator that fills the current path according to the * current fill rule, (each sub-path is implicitly closed before being * filled). Unlike cairo_fill(), cairo_fill_preserve preserves the * path within the cairo context. * * See cairo_set_fill_rule() and cairo_fill(). **/voidcairo_fill_preserve (cairo_t *cr){ if (cr->status) return; cr->status = _cairo_gstate_fill (cr->gstate, &cr->path); if (cr->status) _cairo_set_error (cr, cr->status);}slim_hidden_def(cairo_fill_preserve);voidcairo_copy_page (cairo_t *cr){ if (cr->status) return; cr->status = _cairo_gstate_copy_page (cr->gstate); if (cr->status) _cairo_set_error (cr, cr->status);}voidcairo_show_page (cairo_t *cr){ if (cr->status) return; cr->status = _cairo_gstate_show_page (cr->gstate); if (cr->status) _cairo_set_error (cr, cr->status);}cairo_bool_tcairo_in_stroke (cairo_t *cr, double x, double y){ int inside; if (cr->status) return 0; cr->status = _cairo_gstate_in_stroke (cr->gstate, &cr->path, x, y, &inside); if (cr->status) return 0; return inside;}cairo_bool_tcairo_in_fill (cairo_t *cr, double x, double y){ int inside; if (cr->status) return 0; cr->status = _cairo_gstate_in_fill (cr->gstate, &cr->path, x, y, &inside); if (cr->status) { _cairo_set_error (cr, cr->status); return 0; } return inside;}voidcairo_stroke_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2){ if (cr->status) return; cr->status = _cairo_gstate_stroke_extents (cr->gstate, &cr->path, x1, y1, x2, y2); if (cr->status) _cairo_set_error (cr, cr->status);}voidcairo_fill_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2){ if (cr->status) return; cr->status = _cairo_gstate_fill_extents (cr->gstate, &cr->path, x1, y1, x2, y2); if (cr->status) _cairo_set_error (cr, cr->status);}/** * cairo_clip: * @cr: a cairo context * * Establishes a new clip region by intersecting the current clip * region with the current path as it would be filled by cairo_fill() * and according to the current fill rule (see cairo_set_fill_rule()). * * After 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 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 cairo_clip() within a cairo_save()/cairo_restore() * pair. The only other means of increasing the size of the clip * region is cairo_reset_clip(). **/voidcairo_clip (cairo_t *cr){ cairo_clip_preserve (cr); cairo_new_path (cr);}/** * cairo_clip_preserve: * @cr: a cairo context * * Establishes a new clip region by intersecting the current clip * region with the current path as it would be filled by cairo_fill() * and according to the current fill rule (see cairo_set_fill_rule()). * * Unlike cairo_clip(), 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 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 cairo_clip() within a cairo_save()/cairo_restore() * pair. The only other means of increasing the size of the clip * region is cairo_reset_clip(). **/voidcairo_clip_preserve (cairo_t *cr){ if (cr->status) return; cr->status = _cairo_gstate_clip (cr->gstate, &cr->path); if (cr->status) _cairo_set_error (cr, cr->status);}slim_hidden_def(cairo_clip_preserve);/** * cairo_reset_clip: * @cr: a cairo context * * 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 * cairo_reset_clip() as it will cause results unexpected by * higher-level code which calls cairo_clip(). Consider using * cairo_save() and cairo_restore() around cairo_clip() as a more * robust means of temporarily restricting the clip region. **/voidcairo_reset_clip (cairo_t *cr){ if (cr->status) return; cr->status = _cairo_gstate_reset_clip (cr->gstate); if (cr->status) _cairo_set_error (cr, cr->status);}/** * cairo_select_font_face: * @cr: a #cairo_t * @family: a font family name, encoded in UTF-8 * @slant: the slant for the font * @weight: the weight for the font * * Selects a family and style of font from a simplified description as * a family name, slant and weight. This function is meant to be used * only for applications with simple font needs: Cairo doesn't provide * for operations such as listing all available fonts on the system, * and it is expected that most applications will need to use a more * comprehensive font handling and text layout library in addition to * cairo. **/voidcairo_select_font_face (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight){ if (cr->status) return; cr->status = _cairo_gstate_select_font_face (cr->gstate, family, slant, weight); if (cr->status) _cairo_set_error (cr, cr->status);}/** * cairo_get_font_face: * @cr: a #cairo_t * * Gets the current font face for a #cairo_t. * * Return value: the current font object. Can return %NULL * on out-of-memory or if the context is already in * an error state. This object is owned by cairo. To keep * a reference to it, you must call cairo_font_face_reference(). **/cairo_font_face_t *cairo_get_font_face (cairo_t *cr){ cairo_font_face_t *font_face; if (cr->status) return (cairo_font_face_t*) &_cairo_font_face_nil; cr->status = _cairo_gstate_get_font_face (cr->gstate, &font_face); if (cr->status) { _cairo_set_error (cr, cr->status); return (cairo_font_face_t*) &_cairo_font_face_nil; } return font_face;}/** * cairo_font_extents: * @cr: a #cairo_t * @extents: a #cairo_font_extents_t object into which the results * will be stored. * * Gets the font extents for the currently selected font. **/voidcairo_font_extents (cairo_t *cr, cairo_font_extents_t *extents){ if (cr->status) return; cr->status = _cairo_gstate_get_font_extents (cr->gstate, extents); if (cr->status) _cairo_set_error (cr, cr->status);}/** * cairo_set_font_face: * @cr: a #cairo_t * @font_face: a #cairo_font_face_t, or %NULL to restore to the default font * * Replaces the current #cairo_font_face_t object in the #cairo_t with * @font_face. The replaced font face in the #cairo_t will be * destroyed if there are no other references to it. **/voidcairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face){ if (cr->status) return; cr->status = _cairo_gstate_set_font_face (cr->gstate, font_face); if (cr->status) _cairo_set_error (cr, cr->status);}/** * cairo_set_font_size: * @cr: a #cairo_t * @size: the new font size, in user space units * * Sets the current font matrix to a scale by a factor of @size, replacing * any font matrix previously set with cairo_set_font_size() or * cairo_set_font_matrix(). This results in a font size of @size user space * units. (More precisely, this matrix will result in the font's * em-square being a @size by @size square in user space.) **/voidcairo_set_font_size (cairo_t *cr, double size){ if (cr->status) return; cr->status = _cairo_gstate_set_font_size (cr->gstate, size); if (cr->status) _cairo_set_error (cr, cr->status);}/** * cairo_set_font_matrix * @cr: a #cairo_t * @matrix: a #cairo_matrix_t describing a transform to be applied to * the current font. * * Sets the current font matrix to @matrix. The font matrix gives a * transformation from the design space of the font (in this space, * the em-square is 1 unit by 1 unit) to user space. Normally, a * simple scale is used (see cairo_set_font_size()), but a more * complex font matrix can be used to shear the font * or stretch it unequally along the two axes **/voidcairo_set_font_matrix (cairo_t *cr, const cairo_matrix_t *matrix){ if (cr->status) return; cr->status = _cairo_gstate_set_font_matrix (cr->gstate, matrix); if (cr->status) _cairo_set_error (cr, cr->status);}/** * cairo_get_font_matrix * @cr: a #cairo_t * @matrix: return value for the matrix * * Stores the current font matrix into @matrix. See * cairo_set_font_matrix(). **/voidcairo_get_font_matrix (cairo_t *cr, cairo_matrix_t *matrix){ _cairo_gstate_get_font_matrix (cr->gstate, matrix);}/** * cairo_set_font_options: * @cr: a #cairo_t * @options: font options to use * * Sets a set of custom font rendering options for the #cairo_t. * Rendering options are derived by merging these options with the * options derived from underlying surface; if the value in @options * has a default value (like %CAIRO_ANTIALIAS_DEFAULT), then the value * from the surface is used. **/voidcairo_set_font_options (cairo_t *cr, const cairo_font_options_t *options){ if (cr->status) return; cr->status = _cairo_gstate_set_font_options (cr->gstate, options); if (cr->status) _cairo_set_error (cr, cr->status);}/** * cairo_get_font_options: * @cr: a #cairo_t * @options: a #cairo_font_options_t object into which to store * the retrieved options. All existing values are overwritten * * Retrieves font rendering options set via #cairo_set_font_options. * Note that the returned options do not include any options derived * from the underlying surface; they are literally the options * passed to cairo_set_font_options(). **/voidcairo_get_font_options (cairo_t *cr, cairo_font_options_t *options){ _cairo_gstate_get_font_options (cr->gstate, options);}/** * cairo_set_scaled_font: * @cr: a #cairo_t * @scaled_font: a #cairo_scaled_font_t * * Replaces the current font face, font matrix, and font options in * the #cairo_t with those of the #cairo_scaled_font_t. Except for * some translation, the current CTM of the #cairo_t should be the * same as that of the #cairo_scaled_font_t, which can be accessed * using cairo_scaled_font_get_ctm(). * * Since: 1.2 **/voidcairo_set_scaled_font (cairo_t *cr, const cairo_scaled_font_t *scaled_font){ if (cr->status) return; cr->status = scaled_font->status; if (cr->status) goto BAIL; cr->status = _cairo_gstate_set_font_face (cr->gstate, scaled_font->font_face); if (cr->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -