⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cairo-surface.c

📁 按照官方的说法:Cairo is a vector graphics library with cross-device output support. 翻译过来
💻 C
📖 第 1 页 / 共 5 页
字号:
}cairo_status_t_cairo_surface_stroke (cairo_surface_t		*surface,		       cairo_operator_t		 op,		       cairo_pattern_t		*source,		       cairo_path_fixed_t	*path,		       cairo_stroke_style_t	*stroke_style,		       cairo_matrix_t		*ctm,		       cairo_matrix_t		*ctm_inverse,		       double			 tolerance,		       cairo_antialias_t	 antialias){    cairo_status_t status;    cairo_pattern_union_t dev_source;    cairo_path_fixed_t *dev_path = path;    cairo_path_fixed_t real_dev_path;    cairo_matrix_t dev_ctm = *ctm;    cairo_matrix_t dev_ctm_inverse = *ctm_inverse;    assert (! surface->is_snapshot);    if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&	(source->extend == CAIRO_EXTEND_REFLECT || source->extend == CAIRO_EXTEND_PAD))    {        return CAIRO_STATUS_NO_MEMORY;    }    _cairo_surface_copy_pattern_for_destination (source, surface, &dev_source.base);    if (surface->backend->stroke) {	status = surface->backend->stroke (surface, op, &dev_source.base,					   path, stroke_style,					   &dev_ctm, &dev_ctm_inverse,					   tolerance, antialias);	if (status != CAIRO_INT_STATUS_UNSUPPORTED)            goto FINISH;    }    status = _cairo_surface_fallback_stroke (surface, op, &dev_source.base,                                             path, stroke_style,                                             &dev_ctm, &dev_ctm_inverse,                                             tolerance, antialias); FINISH:    if (dev_path == &real_dev_path)        _cairo_path_fixed_fini (&real_dev_path);    _cairo_pattern_fini (&dev_source.base);    return status;}cairo_status_t_cairo_surface_fill (cairo_surface_t	*surface,		     cairo_operator_t	 op,		     cairo_pattern_t	*source,		     cairo_path_fixed_t	*path,		     cairo_fill_rule_t	 fill_rule,		     double		 tolerance,		     cairo_antialias_t	 antialias){    cairo_status_t status;    cairo_pattern_union_t dev_source;    assert (! surface->is_snapshot);    if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&	(source->extend == CAIRO_EXTEND_REFLECT || source->extend == CAIRO_EXTEND_PAD))    {        return CAIRO_STATUS_NO_MEMORY;    }    _cairo_surface_copy_pattern_for_destination (source, surface, &dev_source.base);    if (surface->backend->fill) {	status = surface->backend->fill (surface, op, &dev_source.base,					 path, fill_rule,					 tolerance, antialias);	if (status != CAIRO_INT_STATUS_UNSUPPORTED)            goto FINISH;    }    status = _cairo_surface_fallback_fill (surface, op, &dev_source.base,                                           path, fill_rule,                                           tolerance, antialias); FINISH:    _cairo_pattern_fini (&dev_source.base);    return status;}cairo_status_t_cairo_surface_composite_trapezoids (cairo_operator_t		op,				     cairo_pattern_t		*pattern,				     cairo_surface_t		*dst,				     cairo_antialias_t		antialias,				     int			src_x,				     int			src_y,				     int			dst_x,				     int			dst_y,				     unsigned int		width,				     unsigned int		height,				     cairo_trapezoid_t		*traps,				     int			num_traps){    cairo_int_status_t status;    assert (! dst->is_snapshot);    /* These operators aren't interpreted the same way by the backends;     * they are implemented in terms of other operators in cairo-gstate.c     */    assert (op != CAIRO_OPERATOR_SOURCE && op != CAIRO_OPERATOR_CLEAR);    if (dst->status)	return dst->status;    if (dst->finished)	return CAIRO_STATUS_SURFACE_FINISHED;    if (dst->backend->composite_trapezoids) {	status = dst->backend->composite_trapezoids (op,						     pattern, dst,						     antialias,						     src_x, src_y,                                                     dst_x, dst_y,						     width, height,						     traps, num_traps);	if (status != CAIRO_INT_STATUS_UNSUPPORTED)	    return status;    }    return  _cairo_surface_fallback_composite_trapezoids (op, pattern, dst,							  antialias,							  src_x, src_y,							  dst_x, dst_y,							  width, height,							  traps, num_traps);}/* _copy_page and _show_page are unique among _cairo_surface functions * in that they will actually return CAIRO_INT_STATUS_UNSUPPORTED * rather than performing any fallbacks. */cairo_int_status_t_cairo_surface_copy_page (cairo_surface_t *surface){    assert (! surface->is_snapshot);    if (surface->status)	return surface->status;    if (surface->finished)	return CAIRO_STATUS_SURFACE_FINISHED;    if (surface->backend->copy_page == NULL)	return CAIRO_INT_STATUS_UNSUPPORTED;    return surface->backend->copy_page (surface);}/* _show_page and _copy_page are unique among _cairo_surface functions * in that they will actually return CAIRO_INT_STATUS_UNSUPPORTED * rather than performing any fallbacks. */cairo_int_status_t_cairo_surface_show_page (cairo_surface_t *surface){    assert (! surface->is_snapshot);    if (surface->status)	return surface->status;    if (surface->finished)	return CAIRO_STATUS_SURFACE_FINISHED;    if (surface->backend->show_page == NULL)	return CAIRO_INT_STATUS_UNSUPPORTED;    return surface->backend->show_page (surface);}/** * _cairo_surface_get_current_clip_serial: * @surface: the #cairo_surface_t to return the serial number for * * Returns the serial number associated with the current * clip in the surface.  All gstate functions must * verify that the correct clip is set in the surface before * invoking any surface drawing function */unsigned int_cairo_surface_get_current_clip_serial (cairo_surface_t *surface){    return surface->current_clip_serial;}/** * _cairo_surface_allocate_clip_serial: * @surface: the #cairo_surface_t to allocate a serial number from * * Each surface has a separate set of clipping serial numbers, and * this function allocates one from the specified surface.  As zero is * reserved for the special no-clipping case, this function will not * return that except for an in-error surface, (ie. surface->status != * CAIRO_STATUS_SUCCESS). */unsigned int_cairo_surface_allocate_clip_serial (cairo_surface_t *surface){    unsigned int    serial;    if (surface->status)	return 0;    if ((serial = ++(surface->next_clip_serial)) == 0)	serial = ++(surface->next_clip_serial);    return serial;}/** * _cairo_surface_reset_clip: * @surface: the #cairo_surface_t to reset the clip on * * This function sets the clipping for the surface to * None, which is to say that drawing is entirely * unclipped.  It also sets the clip serial number * to zero. */cairo_status_t_cairo_surface_reset_clip (cairo_surface_t *surface){    cairo_status_t  status;    if (surface->status)	return surface->status;    if (surface->finished)	return CAIRO_STATUS_SURFACE_FINISHED;    surface->current_clip_serial = 0;    if (surface->backend->intersect_clip_path) {	status = surface->backend->intersect_clip_path (surface,							NULL,							CAIRO_FILL_RULE_WINDING,							0,							CAIRO_ANTIALIAS_DEFAULT);	if (status)	    return status;    }    if (surface->backend->set_clip_region != NULL) {	status = surface->backend->set_clip_region (surface, NULL);	if (status)	    return status;    }    return CAIRO_STATUS_SUCCESS;}/** * _cairo_surface_set_clip_region: * @surface: the #cairo_surface_t to reset the clip on * @region: the #pixman_region16_t to use for clipping * @serial: the clip serial number associated with the region * * This function sets the clipping for the surface to * the specified region and sets the surface clipping * serial number to the associated serial number. */cairo_status_t_cairo_surface_set_clip_region (cairo_surface_t	    *surface,				pixman_region16_t   *region,				unsigned int	    serial){    cairo_status_t status;    if (surface->status)	return surface->status;    if (surface->finished)	return CAIRO_STATUS_SURFACE_FINISHED;    assert (surface->backend->set_clip_region != NULL);    surface->current_clip_serial = serial;    status = surface->backend->set_clip_region (surface, region);    return status;}cairo_int_status_t_cairo_surface_intersect_clip_path (cairo_surface_t    *surface,				    cairo_path_fixed_t *path,				    cairo_fill_rule_t   fill_rule,				    double		tolerance,				    cairo_antialias_t	antialias){    cairo_path_fixed_t *dev_path = path;    cairo_status_t status;    if (surface->status)	return surface->status;    if (surface->finished)	return CAIRO_STATUS_SURFACE_FINISHED;    assert (surface->backend->intersect_clip_path != NULL);    status = surface->backend->intersect_clip_path (surface,						    dev_path,						    fill_rule,						    tolerance,						    antialias);    return status;}static cairo_status_t_cairo_surface_set_clip_path_recursive (cairo_surface_t *surface,					cairo_clip_path_t *clip_path){    cairo_status_t status;    if (clip_path == NULL)	return CAIRO_STATUS_SUCCESS;    status = _cairo_surface_set_clip_path_recursive (surface, clip_path->prev);    if (status)	return status;    return _cairo_surface_intersect_clip_path (surface,					       &clip_path->path,					       clip_path->fill_rule,					       clip_path->tolerance,					       clip_path->antialias);}/** * _cairo_surface_set_clip_path: * @surface: the #cairo_surface_t to set the clip on * @clip_path: the clip path to set * @serial: the clip serial number associated with the clip path * * Sets the given clipping path for the surface and assigns the * clipping serial to the surface. **/static cairo_status_t_cairo_surface_set_clip_path (cairo_surface_t	*surface,			      cairo_clip_path_t	*clip_path,			      unsigned int	serial){    cairo_status_t status;    if (surface->status)	return surface->status;    if (surface->finished)	return CAIRO_STATUS_SURFACE_FINISHED;    assert (surface->backend->intersect_clip_path != NULL);    status = surface->backend->intersect_clip_path (surface,						    NULL,						    CAIRO_FILL_RULE_WINDING,						    0,						    CAIRO_ANTIALIAS_DEFAULT);    if (status)	return status;    status = _cairo_surface_set_clip_path_recursive (surface, clip_path);    if (status)	return status;    surface->current_clip_serial = serial;    return CAIRO_STATUS_SUCCESS;}cairo_status_t_cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip){    unsigned int serial = 0;    if (!surface)	return CAIRO_STATUS_NULL_POINTER;    if (surface->status)	return surface->status;    if (surface->finished)	return CAIRO_STATUS_SURFACE_FINISHED;    if (clip) {	serial = clip->serial;	if (serial == 0)	    clip = NULL;    }    surface->clip = clip;    if (serial == _cairo_surface_get_current_clip_serial (surface))	return CAIRO_STATUS_SUCCESS;    if (clip) {	if (clip->path)	    return _cairo_surface_set_clip_path (surface,						 clip->path,						 clip->serial);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -