📄 cairoint.h
字号:
cairo_cache_entry_t cache_entry; /* hash is glyph index */ cairo_scaled_font_t *scaled_font; /* font the glyph lives in */ cairo_text_extents_t metrics; /* user-space metrics */ cairo_box_t bbox; /* device-space bounds */ cairo_image_surface_t *surface; /* device-space image */ cairo_path_fixed_t *path; /* device-space outline */ void *surface_private; /* for the surface backend */} cairo_scaled_glyph_t;#define _cairo_scaled_glyph_index(g) ((g)->cache_entry.hash)#define _cairo_scaled_glyph_set_index(g,i) ((g)->cache_entry.hash = (i))struct _cairo_scaled_font { /* must be first to be stored in a hash table */ cairo_hash_entry_t hash_entry; /* useful bits for _cairo_scaled_font_nil */ cairo_status_t status; int ref_count; /* hash key members */ cairo_font_face_t *font_face; /* may be NULL */ cairo_matrix_t font_matrix; /* font space => user space */ cairo_matrix_t ctm; /* user space => device space */ cairo_font_options_t options; /* "live" scaled_font members */ cairo_matrix_t scale; /* font space => device space */ cairo_font_extents_t extents; /* user space */ cairo_cache_t *glyphs; /* glyph index -> cairo_scaled_glyph_t */ /* * One surface backend may store data in each glyph. * Whichever surface manages to store its pointer here * first gets to store data in each glyph */ const cairo_surface_backend_t *surface_backend; void *surface_private; /* font backend managing this scaled font */ const cairo_scaled_font_backend_t *backend;};struct _cairo_font_face { /* hash_entry must be first */ cairo_hash_entry_t hash_entry; cairo_status_t status; int ref_count; cairo_user_data_array_t user_data; const cairo_font_face_backend_t *backend;};cairo_private void_cairo_font_reset_static_data (void);cairo_private void_cairo_ft_font_reset_static_data (void);cairo_private void_cairo_xlib_surface_reset_static_data (void);cairo_private void_cairo_xlib_screen_reset_static_data (void);/* the font backend interface */struct _cairo_unscaled_font_backend { void (*destroy) (void *unscaled_font);};/* cairo_toy_font_face_t - simple family/slant/weight font faces used for * the built-in font API */typedef struct _cairo_toy_font_face { cairo_font_face_t base; const char *family; cairo_bool_t owns_family; cairo_font_slant_t slant; cairo_font_weight_t weight;} cairo_toy_font_face_t;typedef enum _cairo_scaled_glyph_info { CAIRO_SCALED_GLYPH_INFO_METRICS = (1 << 0), CAIRO_SCALED_GLYPH_INFO_SURFACE = (1 << 1), CAIRO_SCALED_GLYPH_INFO_PATH = (1 << 2)} cairo_scaled_glyph_info_t;struct _cairo_scaled_font_backend { cairo_font_type_t type; cairo_status_t (*create_toy) (cairo_toy_font_face_t *toy_face, const cairo_matrix_t *font_matrix, const cairo_matrix_t *ctm, const cairo_font_options_t *options, cairo_scaled_font_t **scaled_font); void (*fini) (void *scaled_font); cairo_int_status_t (*scaled_glyph_init) (void *scaled_font, cairo_scaled_glyph_t *scaled_glyph, cairo_scaled_glyph_info_t info); /* A backend only needs to implement this or ucs4_to_index(), not * both. This allows the backend to do something more sophisticated * then just converting characters one by one. */ cairo_int_status_t (*text_to_glyphs) (void *scaled_font, double x, double y, const char *utf8, cairo_glyph_t **glyphs, int *num_glyphs); unsigned long (*ucs4_to_index) (void *scaled_font, uint32_t ucs4); cairo_int_status_t (*show_glyphs) (void *scaled_font, cairo_operator_t op, cairo_pattern_t *pattern, cairo_surface_t *surface, int source_x, int source_y, int dest_x, int dest_y, unsigned int width, unsigned int height, const cairo_glyph_t *glyphs, int num_glyphs);};struct _cairo_font_face_backend { cairo_font_type_t type; /* The destroy() function is allowed to resurrect the font face * by re-referencing. This is needed for the FreeType backend. */ void (*destroy) (void *font_face); cairo_status_t (*scaled_font_create) (void *font_face, const cairo_matrix_t *font_matrix, const cairo_matrix_t *ctm, const cairo_font_options_t *options, cairo_scaled_font_t **scaled_font);};/* concrete font backends */#if CAIRO_HAS_FT_FONTextern const cairo_private struct _cairo_scaled_font_backend cairo_ft_scaled_font_backend;#endif#if CAIRO_HAS_WIN32_FONTextern const cairo_private struct _cairo_scaled_font_backend cairo_win32_scaled_font_backend;#endif#if CAIRO_HAS_ATSUI_FONTextern const cairo_private struct _cairo_scaled_font_backend cairo_atsui_scaled_font_backend;#endiftypedef struct _cairo_stroke_style { double line_width; cairo_line_cap_t line_cap; cairo_line_join_t line_join; double miter_limit; double *dash; int num_dashes; double dash_offset;} cairo_stroke_style_t;struct _cairo_surface_backend { cairo_surface_type_t type; cairo_surface_t * (*create_similar) (void *surface, cairo_content_t content, int width, int height); cairo_status_t (*finish) (void *surface); cairo_status_t (*acquire_source_image) (void *abstract_surface, cairo_image_surface_t **image_out, void **image_extra); void (*release_source_image) (void *abstract_surface, cairo_image_surface_t *image, void *image_extra); cairo_status_t (*acquire_dest_image) (void *abstract_surface, cairo_rectangle_int16_t *interest_rect, cairo_image_surface_t **image_out, cairo_rectangle_int16_t *image_rect, void **image_extra); void (*release_dest_image) (void *abstract_surface, cairo_rectangle_int16_t *interest_rect, cairo_image_surface_t *image, cairo_rectangle_int16_t *image_rect, void *image_extra); cairo_status_t (*clone_similar) (void *surface, cairo_surface_t *src, cairo_surface_t **clone_out); /* XXX: dst should be the first argument for consistency */ cairo_int_status_t (*composite) (cairo_operator_t op, cairo_pattern_t *src, cairo_pattern_t *mask, void *dst, int src_x, int src_y, int mask_x, int mask_y, int dst_x, int dst_y, unsigned int width, unsigned int height); cairo_int_status_t (*fill_rectangles) (void *surface, cairo_operator_t op, const cairo_color_t *color, cairo_rectangle_int16_t *rects, int num_rects); /* XXX: dst should be the first argument for consistency */ cairo_int_status_t (*composite_trapezoids) (cairo_operator_t op, cairo_pattern_t *pattern, void *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 (*copy_page) (void *surface); cairo_int_status_t (*show_page) (void *surface); /* Set given region as the clip region for the surface, replacing * any previously set clip region. Passing in a NULL region will * clear the surface clip region. * * The surface is expected to store the clip region and clip all * following drawing operations against it until the clip region * is cleared of replaced by another clip region. * * Cairo will call this function whenever a clip path can be * represented as a device pixel aligned set of rectangles. When * this is not possible, cairo will use mask surfaces for * clipping. */ cairo_int_status_t (*set_clip_region) (void *surface, pixman_region16_t *region); /* Intersect the given path against the clip path currently set in * the surface, using the given fill_rule and tolerance, and set * the result as the new clipping path for the surface. Passing * in a NULL path will clear the surface clipping path. * * The surface is expected to store the resulting clip path and * clip all following drawing operations against it until the clip * path cleared or intersected with a new path. * * If a surface implements this function, set_clip_region() will * never be called and should not be implemented. If this * function is not implemented cairo will use set_clip_region() * (if available) and mask surfaces for clipping. */ cairo_int_status_t (*intersect_clip_path) (void *dst, cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, double tolerance, cairo_antialias_t antialias); /* Get the extents of the current surface. For many surface types * this will be as simple as { x=0, y=0, width=surface->width, * height=surface->height}. * * This function need not take account of any clipping from * set_clip_region since the generic version of set_clip_region * saves those, and the generic get_clip_extents will only call * into the specific surface->get_extents if there is no current * clip. */ cairo_int_status_t (*get_extents) (void *surface, cairo_rectangle_int16_t *rectangle); /* * This is an optional entry to let the surface manage its own glyph * resources. If null, render against this surface, using image * surfaces as glyphs. */ cairo_int_status_t (*old_show_glyphs) (cairo_scaled_font_t *font, cairo_operator_t op, cairo_pattern_t *pattern, void *surface, int source_x, int source_y, int dest_x, int dest_y, unsigned int width, unsigned int height, const cairo_glyph_t *glyphs, int num_glyphs); void (*get_font_options) (void *surface, cairo_font_options_t *options); cairo_status_t (*flush) (void *surface); cairo_status_t (*mark_dirty_rectangle) (void *surface, int x, int y, int width, int height); void (*scaled_font_fini) (cairo_scaled_font_t *scaled_font); void (*scaled_glyph_fini) (cairo_scaled_glyph_t *scaled_glyph, cairo_scaled_font_t *scaled_font); /* OK, I'm starting over somewhat by defining the 5 top-level * drawing operators for the surface backend here with consistent * naming and argument-order conventions. */ cairo_int_status_t (*paint) (void *surface, cairo_operator_t op, cairo_pattern_t *source); cairo_int_status_t (*mask) (void *surface, cairo_operator_t op, cairo_pattern_t *source, cairo_pattern_t *mask); cairo_int_status_t (*stroke) (void *surface, cairo_operator_t op, cairo_pattern_t *source, cairo_path_fixed_t *path, cairo_stroke_style_t *style, cairo_matrix_t *ctm, cairo_matrix_t *ctm_inverse, double tolerance, cairo_antialias_t antialias); cairo_int_status_t (*fill) (void *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_int_status_t (*show_glyphs) (void *surface, cairo_operator_t op, cairo_pattern_t *source, const cairo_glyph_t *glyphs, int num_glyphs, cairo_scaled_font_t *scaled_font); cairo_surface_t * (*snapshot) (void *surface);};typedef struct _cairo_format_masks { int bpp; unsigned long alpha_mask; unsigned long red_mask; unsigned long green_mask; unsigned long blue_mask;} cairo_format_masks_t;struct _cairo_surface { const cairo_surface_backend_t *backend; /* We allow surfaces to override the backend->type by shoving something * else into surface->type. This is for "wrapper" surfaces that want to * hide their internal type from the user-level API. */ cairo_surface_type_t type; cairo_content_t content; unsigned int ref_count; cairo_status_t status; cairo_bool_t finished; cairo_user_data_array_t user_data; cairo_matrix_t device_transform; cairo_matrix_t device_transform_inverse; double x_fallback_resolution; double y_fallback_resolution; cairo_clip_t *clip; /* * Each time a clip region is modified, it gets the next value in this * sequence. This means that clip regions for this surface are uniquely * identified and updates to the clip can be readily identified */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -